// 玩家效果,持续一回合 public CardATK(Warrior owner) : base(owner, 1) { }
// AXY 类型的基本伤害公式 public static int CalcBasicAttackByAXY(Warrior attacker, ISkillWithAXY s) { return(s.A + attacker.ATK * s.X / 100 + attacker.POW * s.Y / 100); }
public DeployEMPCannon(Warrior owner) : base(owner) { }
public POWDec(Warrior onwer, int roundNum, int overlay) : base(onwer, roundNum, overlay) { }
public CountDownBuffWithOwner(Warrior owner, int num) : base(owner.Team, num) { Owner = owner; }
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 ReturnBackAfterAttack(Warrior owner) : base(owner) { }
public Kendo(Warrior owner) : base(owner) { }
public TacticalCommand(Warrior owner) : base(owner) { }
public ButterflySingle(Warrior owner) : base(owner) { }
public ButterflyAOE(Warrior owner) : base(owner) { }
void OnBeforeCalculateDamage1(Warrior attacker, Warrior target, HashSet <string> flags, ref int inc, ref int more, List <int> multiplier) { multiplier.Add(FinalDamageFact); }
public CounterAttack(Warrior owner) : base(owner) { }
public BuffWithOwner(Warrior owner) { Owner = owner; }
public void AutoSortCards(Warrior warrior) { // 没有pattern技能则不自动排序 if (warrior.PatternSkill == null) { return; } BattleCard [] AfterSortingCards = new BattleCard[AvailableCards.Count]; var skillOrder = warrior.PatternSkill.CardsPattern; bool[] visited = new bool[AvailableCards.Count]; int currentIndex = 0; int countNumber = 0; int[] StoreIndex = new int[AvailableCards.Count]; while (countNumber < AvailableCards.Count) { for (int i = 0; i < skillOrder.Length; i++) { for (int j = 0; j < AvailableCards.Count; j++) { if (!visited[j] && AvailableCards[j].Name.Equals(skillOrder[i])) { visited[j] = true; StoreIndex[currentIndex] = j; // 记录下排序后当前位置的卡牌原来的index currentIndex++; break; } } countNumber++; } // 判断是否应该将StoreIndex储存的卡牌更新到排序后的卡组 if (currentIndex % skillOrder.Length == 0 && currentIndex != 0) { FC.For(currentIndex - skillOrder.Length, currentIndex, (i) => { var j = StoreIndex[i]; AfterSortingCards[i] = AvailableCards[j]; }); } else // 将不符合组合的卡牌退回到剩余卡牌中 { var remainder = currentIndex % skillOrder.Length; FC.For(currentIndex - remainder, currentIndex, (i) => { visited[StoreIndex[i]] = false; }); currentIndex = currentIndex - remainder; break; } } // 将不符合组合条件的剩余卡牌放入排序后的卡组 for (int i = currentIndex; i < AfterSortingCards.Length; i++) { for (int j = 0; j < AvailableCards.Count; j++) { if (!visited[j]) { visited[j] = true; AfterSortingCards[i] = AvailableCards[j]; break; } } } // 将排序后的卡组赋给原来卡组 FC.For(AvailableCards.Count, (i) => { AvailableCards[i] = AfterSortingCards[i]; }); }
public OverlayAttrBuff(Warrior onwer, int roundNum, int overlayNum) : base(onwer, roundNum) { overlays = overlayNum; }
public event Action <Warrior, Warrior, List <Warrior>, Dictionary <Warrior, int>, Dictionary <Warrior, int>, Skill, HashSet <string> > OnWarriorAttack = null; // 角色进行攻击 public void Attack(Warrior attacker, Warrior target, Skill skill = null, params string[] flags) { Attack(attacker, target, null, skill, flags); }
public Faint(Warrior owner, int num) : base(owner, num) { }
public WarriorAI(Warrior warrior) { Owner = warrior; }
public AllSuppressCounterAttackOn3POWInc(Warrior owner) : base(owner) { }
public FastAssistance2(Warrior owner) : base(owner) { }
public StarsTears(Warrior owner) : base(owner) { }
public AddConcentrateOnCriticalBeforeAction(Warrior owner) : base(owner) { }
public GainENOnEMPDestroyed(Warrior owner) : base(owner) { }
public ArtisanSpirit(Warrior owner) : base(owner) { }
public ActiveSkill(Warrior owner) { Owner = owner; }
// 星之泪效果公式 public static int StarTearsEffect(Warrior attacker) { return(20 + attacker.POW * 3 / 10); }
// 对指定位置使用 public virtual void Use2(Warrior target) { throw new Exception("not implemented yet"); }
public Untreatable(Warrior owner, int num) : base(owner, num) { }
void OnBeforeAttack(Warrior attacker, Warrior target, List <Warrior> tars, Skill skill, HashSet <string> flags, List <int> multi, List <int> addMulti) { flags.Add("CriticalAttack"); }