static void additems() { BeforeAttack.additem("Youmuu", (int)ItemId.Youmuus_Ghostblade, Orbwalking.GetRealAutoAttackRange(Player)); AfterAttack.additem("Tiamat", (int)ItemId.Tiamat_Melee_Only, 250f); AfterAttack.additem("Hydra", (int)ItemId.Ravenous_Hydra_Melee_Only, 250f); AfterAttack.additem("Bilgewater", (int)ItemId.Bilgewater_Cutlass, 450f, true); AfterAttack.additem("BoTRK", (int)ItemId.Blade_of_the_Ruined_King, 450f, true); }
public void Attack(AfterAttack afterAttack) { _afterAttack = afterAttack; SetState(PieceState.AttackWindup); // BasicAttack1.ShowSprite(); // BasicAttack1.Windup(BasicAttack1WindupSpeed, ExecuteAttack); }
private void Attack(Character character, Damage damage) { BeforeAttack?.Invoke(character, damage); character.ReceiveDamage(damage); AfterAttack?.Invoke(character, damage); if (!character.IsAlive) { OnKill?.Invoke(); } }
public void Attack(Character character, Damage damage) //, AttackType attackType, int atkPoints) { BeforeAttack?.Invoke(character, damage); character.ReceiveDamage(damage); AfterAttack?.Invoke(character, damage); if (!character.IsAlive) { OnEnemyKill?.Invoke(); } }
static void AddOrderData() { AfterAttack.AddOrderData("MasterYi", SpellSlot.W, CastingOrder.ItemFirst); AfterAttack.AddOrderData("Talon", SpellSlot.Q, CastingOrder.SpellFirst); AfterAttack.AddOrderData("Fiora", SpellSlot.E, CastingOrder.SpellFirst); AfterAttack.AddOrderData("Jax", SpellSlot.W, CastingOrder.SpellFirst); AfterAttack.AddOrderData("Rengar", SpellSlot.Q, CastingOrder.SpellFirst); AfterAttack.AddOrderData("Renekton", SpellSlot.W, CastingOrder.SpellFirst); AfterAttack.AddOrderData("Khazix", SpellSlot.Q, CastingOrder.SpellFirst); AfterAttack.AddOrderData("Yorick", SpellSlot.Q, CastingOrder.SpellFirst); AfterAttack.AddOrderData("XinZhao", SpellSlot.Q, CastingOrder.SpellFirst); AfterAttack.AddOrderData("Vi", SpellSlot.Q, CastingOrder.SpellFirst); AfterAttack.AddOrderData("Nasus", SpellSlot.Q, CastingOrder.SpellFirst); AfterAttack.AddOrderData("Mordekaiser", SpellSlot.Q, CastingOrder.SpellFirst); AfterAttack.AddOrderData("MonkeyKing", SpellSlot.Q, CastingOrder.SpellFirst); AfterAttack.AddOrderData("Leona", SpellSlot.Q, CastingOrder.SpellFirst); AfterAttack.AddOrderData("Kassadin", SpellSlot.Q, CastingOrder.SpellFirst); AfterAttack.AddOrderData("Garen", SpellSlot.Q, CastingOrder.SpellFirst); AfterAttack.AddOrderData("Darius", SpellSlot.W, CastingOrder.SpellFirst); AfterAttack.AddOrderData("Blitzcrank", SpellSlot.E, CastingOrder.SpellFirst); AfterAttack.AddOrderData("Sejuani", SpellSlot.W, CastingOrder.SpellFirst); AfterAttack.AddOrderData("Sejuani", SpellSlot.Q, CastingOrder.SpellFirst); }
public void Attack(Warrior attacker, Warrior target, Warrior[] addtionalTargets, Skill skill = null, params string[] flags) { // 在连续指令的情况下,可能条件已经不满足 if (attacker == null || target == null) { return; } // 整理攻击标记 var attackFlags = new HashSet <string>(); attackFlags.UnionWith(flags); attackFlags.Add(attacker.AttackingType); // 额外攻击目标 var addTars = new List <Warrior>(); if (addtionalTargets != null) { addTars.AddRange(addtionalTargets); } PrepareAttack?.Invoke(attacker, target, addTars, skill, attackFlags); if (!attackFlags.Contains("IgnoreAttackRange")) // 可能是无视攻击距离限制的 { target.GetPosInMap(out int tx, out int ty); // 检查攻击范围限制 if (!attacker.InAttackRange(tx, ty)) { return; } } // 额外伤害系数 var multi = new List <int>(); var addMulti = new List <int>(); BeforeAttack?.Invoke(attacker, target, addTars, skill, attackFlags, multi, addMulti); // 可能需要取消攻击 或者因为 PatternSkill 导致已经行动过了 if (attacker.ActionDone || attackFlags.Contains("CancelAttack")) { return; } var tars = new List <Warrior>(); tars.Add(target); tars.AddRange(addTars); // 计算实际伤害 var damages = new Dictionary <Warrior, int>(); foreach (var tar in tars) { damages[tar] = CalculateDamage(attacker, tar, skill, attackFlags, tar == target ? multi : addMulti); } // ExtraAttack 不影响行动标记 if (!attackFlags.Contains("ExtraAttack")) { Debug.Assert(!attacker.ActionDone, "attacker has already attacted in this round"); SetActionFlag(attacker, true, true, true); } // 混乱攻击不计算护盾,其它类型攻击需要先消耗护盾 var dhps = new Dictionary <Warrior, int>(); var dess = new Dictionary <Warrior, int>(); foreach (var tar in tars) { var damage = damages[tar]; var dhp = -damage; var des = 0; if (!attackFlags.Contains("chaos") && target.ES > 0) { dhp = damage > target.ES ? target.ES - damage : 0; des = damage > target.ES ? 0 : -damage; } dhps[tar] = dhp; dess[tar] = des; } OnWarriorAttack?.Invoke(attacker, target, addTars, dhps, dess, skill, attackFlags); foreach (var tar in tars) { var dhp = dhps[tar]; var des = dess[tar]; if (des != 0) { AddES(tar, des); } if (dhp != 0) { AddHP(tar, dhp); } } AfterAttack?.Invoke(attacker, target, addTars, skill, attackFlags); return; }
public static void OnAfterAttack(object sender, AfterAttackEventArgs args) { AfterAttack?.Invoke(sender, args); }
protected static void ProcessAfterAttack(IAttackable target) { AfterAttack.SafeInvoke(new AfterAttackEventArgs(target)); }