Unverified Commit c419b9e3 authored by Yudi Wang's avatar Yudi Wang
Browse files

继续加固磁暴幻影剑性能风险

parent 7f2458b7
Loading
Loading
Loading
Loading
+3 −1
Changes for src/NegoreRouse/mods/slashblade/Network/message/MessageSMSRangeAttackHandler.java: 3 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -25,6 +25,9 @@ import net.minecraft.world.World;
public class MessageSMSRangeAttackHandler
implements IMessageHandler<MessageSMSRangeAttack, IMessage> {
    public IMessage onMessage(MessageSMSRangeAttack message, MessageContext ctx) {
        if (ctx == null || ctx.getServerHandler() == null || ctx.getServerHandler().field_147369_b == null || message == null) {
            return null;
        }
        EntityPlayerMP entityPlayer = ctx.getServerHandler().field_147369_b;
        ItemStack stack = entityPlayer.func_70694_bm();
        World world = entityPlayer.field_70170_p;
@@ -34,4 +37,3 @@ implements IMessageHandler<MessageSMSRangeAttack, IMessage> {
        return null;
    }
}
+3 −1
Changes for src/NegoreRouse/mods/slashblade/Network/message/MessageSMSTierHandler.java: 3 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -25,6 +25,9 @@ import net.minecraft.world.World;
public class MessageSMSTierHandler
implements IMessageHandler<MessageSMSTier, IMessage> {
    public IMessage onMessage(MessageSMSTier message, MessageContext ctx) {
        if (ctx == null || ctx.getServerHandler() == null || ctx.getServerHandler().field_147369_b == null || message == null) {
            return null;
        }
        EntityPlayerMP entityPlayer = ctx.getServerHandler().field_147369_b;
        ItemStack stack = entityPlayer.func_70694_bm();
        World world = entityPlayer.field_70170_p;
@@ -34,4 +37,3 @@ implements IMessageHandler<MessageSMSTier, IMessage> {
        return null;
    }
}
+14 −1
Changes for src/NegoreRouse/mods/slashblade/SA/SA_8.java: 14 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -39,11 +39,21 @@ import net.minecraft.world.World;
public class SA_8
extends SpecialAttackBase {
    public static String AttackType = StylishRankManager.AttackTypes.registerAttackType((String)"SA_8", (float)0.5f);
    private static final long ATTACK_COOLDOWN_TICKS = 10L;
    private static final String ATTACK_NEXT_TICK = "negorerouse.sa8NextTick";

    public String toString() {
        return "sa_8";
    }

    private static boolean isOnCooldown(NBTTagCompound tag, World world) {
        return tag.func_74763_f(ATTACK_NEXT_TICK) > world.func_82737_E();
    }

    private static void setCooldown(NBTTagCompound tag, World world) {
        tag.func_74772_a(ATTACK_NEXT_TICK, world.func_82737_E() + ATTACK_COOLDOWN_TICKS);
    }

    public void doSpacialAttack(ItemStack stack, EntityPlayer player) {
        Entity tmp;
        World world = player.field_70170_p;
@@ -66,6 +76,9 @@ extends SpecialAttackBase {
                player.field_70170_p.func_72869_a("magicCrit", player.field_70165_t + ((double)(player.func_70681_au().nextFloat() * player.field_70130_N * 2.0f - player.field_70130_N) - d0 * d3) * 2.0, player.field_70163_u, player.field_70161_v + ((double)(player.func_70681_au().nextFloat() * player.field_70130_N * 2.0f - player.field_70130_N) - d2 * d3) * 2.0, d0, d1, d2);
            }
            if (!world.field_72995_K) {
                if (SA_8.isOnCooldown(tag, world)) {
                    return;
                }
                int cost = -20;
                if (!ItemSlashBlade.ProudSoul.tryAdd(tag, Integer.valueOf(cost), false)) {
                    stack.func_77972_a(10, (EntityLivingBase)player);
@@ -95,6 +108,7 @@ extends SpecialAttackBase {
                    entityDrive.setTargetEntityId(entityId);
                    world.func_72838_d((Entity)entityDrive);
                }
                SA_8.setCooldown(tag, world);
            }
            ItemSlashBlade.setComboSequence((NBTTagCompound)tag, (ItemSlashBlade.ComboSequence)ItemSlashBlade.ComboSequence.Battou);
        }
@@ -123,4 +137,3 @@ extends SpecialAttackBase {
        return target;
    }
}
+14 −1
Changes for src/NegoreRouse/mods/slashblade/SA/SA_9.java: 14 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -40,11 +40,21 @@ import net.minecraft.world.World;
public class SA_9
extends SpecialAttackBase {
    public static String AttackType = StylishRankManager.AttackTypes.registerAttackType((String)"SA_9", (float)0.5f);
    private static final long ATTACK_COOLDOWN_TICKS = 10L;
    private static final String ATTACK_NEXT_TICK = "negorerouse.sa9NextTick";

    public String toString() {
        return "sa_9";
    }

    private static boolean isOnCooldown(NBTTagCompound tag, World world) {
        return tag.func_74763_f(ATTACK_NEXT_TICK) > world.func_82737_E();
    }

    private static void setCooldown(NBTTagCompound tag, World world) {
        tag.func_74772_a(ATTACK_NEXT_TICK, world.func_82737_E() + ATTACK_COOLDOWN_TICKS);
    }

    public void doSpacialAttack(ItemStack stack, EntityPlayer player) {
        Entity tmp;
        World world = player.field_70170_p;
@@ -67,6 +77,9 @@ extends SpecialAttackBase {
                player.field_70170_p.func_72869_a("flame", player.field_70165_t + ((double)(player.func_70681_au().nextFloat() * player.field_70130_N * 2.0f - player.field_70130_N) - d0 * d3) * 2.0, player.field_70163_u, player.field_70161_v + ((double)(player.func_70681_au().nextFloat() * player.field_70130_N * 2.0f - player.field_70130_N) - d2 * d3) * 2.0, d0, d1, d2);
            }
            if (!world.field_72995_K) {
                if (SA_9.isOnCooldown(tag, world)) {
                    return;
                }
                int cost = -20;
                if (!ItemSlashBlade.ProudSoul.tryAdd(tag, Integer.valueOf(cost), false)) {
                    stack.func_77972_a(10, (EntityLivingBase)player);
@@ -108,6 +121,7 @@ extends SpecialAttackBase {
                        world.func_72838_d((Entity)entityDrive2);
                    }
                }
                SA_9.setCooldown(tag, world);
            }
            ItemSlashBlade.setComboSequence((NBTTagCompound)tag, (ItemSlashBlade.ComboSequence)ItemSlashBlade.ComboSequence.Battou);
        }
@@ -136,4 +150,3 @@ extends SpecialAttackBase {
        return target;
    }
}
+27 −1
Changes for src/NegoreRouse/mods/slashblade/SA/entity/EntityMagneticStorm.java: 27 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -32,8 +32,11 @@ import cpw.mods.fml.common.registry.IThrowableEntity;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.WeakHashMap;
import mods.flammpfeil.slashblade.ItemSlashBlade;
import mods.flammpfeil.slashblade.ability.StylishRankManager;
import net.minecraft.block.Block;
@@ -57,6 +60,9 @@ import net.minecraft.world.World;
public class EntityMagneticStorm
extends Entity
implements IThrowableEntity {
    private static final String PLAYER_HIT_NEXT_TICK = "negorerouse.magneticStormNextHitTick";
    private static final long PLAYER_HIT_COOLDOWN_TICKS = 5L;
    private static final Map<Entity, Long> playerHitCooldown = Collections.synchronizedMap(new WeakHashMap<Entity, Long>());
    protected Entity thrower;
    protected ItemStack blade = null;
    protected List<Entity> alreadyHitEntity = new ArrayList<Entity>();
@@ -187,6 +193,20 @@ implements IThrowableEntity {
        return par1 + f3;
    }

    private boolean shouldSkipPlayerHit(Entity hitEntity) {
        if (!(hitEntity instanceof EntityPlayer)) {
            return false;
        }
        long now = this.field_70170_p.func_82737_E();
        Long nextTick = playerHitCooldown.get(hitEntity);
        if (nextTick != null && nextTick.longValue() > now) {
            this.func_70106_y();
            return true;
        }
        playerHitCooldown.put(hitEntity, Long.valueOf(now + PLAYER_HIT_COOLDOWN_TICKS));
        return false;
    }

    public void setDriveVector(float fYVecOfset) {
        this.setDriveVector(fYVecOfset, true);
    }
@@ -310,16 +330,22 @@ implements IThrowableEntity {
                d0 = d1;
            }
            if (hitEntity != null) {
                if (this.shouldSkipPlayerHit(hitEntity)) {
                    return;
                }
                float magicDamage = Math.max(1.0f, this.AttackLevel);
                hitEntity.field_70172_ad = 0;
                DamageSource ds = new EntityDamageSource("MagneticStorm", this.getThrower()).func_82726_p().func_76348_h().func_76359_i().func_151518_m();
                hitEntity.func_70097_a(ds, magicDamage);
                boolean hitPlayer = hitEntity instanceof EntityPlayer;
                if (!hitPlayer) {
                    this.field_70170_p.func_72885_a((Entity)this, this.field_70165_t, this.field_70163_u, this.field_70161_v, 1.0f, false, false);
                }
                if (this.blade != null && hitEntity instanceof EntityLivingBase) {
                    StylishRankManager.setNextAttackType((Entity)this.thrower, (String)StylishRankManager.AttackTypes.PhantomSword);
                    ((ItemSlashBlade)this.blade.func_77973_b()).func_77644_a(this.blade, (EntityLivingBase)hitEntity, (EntityLivingBase)this.thrower);
                }
                if (hitEntity instanceof EntityPlayer) {
                if (hitPlayer) {
                    this.func_70106_y();
                    return;
                }
Loading