Exemplo n.º 1
0
 // 玩家效果,持续一回合
 public CardATK(Warrior owner) : base(owner, 1)
 {
 }
Exemplo n.º 2
0
 // AXY 类型的基本伤害公式
 public static int CalcBasicAttackByAXY(Warrior attacker, ISkillWithAXY s)
 {
     return(s.A + attacker.ATK * s.X / 100 + attacker.POW * s.Y / 100);
 }
Exemplo n.º 3
0
 public DeployEMPCannon(Warrior owner) : base(owner) { }
Exemplo n.º 4
0
 public POWDec(Warrior onwer, int roundNum, int overlay) : base(onwer, roundNum, overlay)
 {
 }
Exemplo n.º 5
0
 public CountDownBuffWithOwner(Warrior owner, int num)
     : base(owner.Team, num)
 {
     Owner = owner;
 }
Exemplo n.º 6
0
        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;
        }
Exemplo n.º 7
0
 public ReturnBackAfterAttack(Warrior owner) : base(owner)
 {
 }
Exemplo n.º 8
0
 public Kendo(Warrior owner) : base(owner)
 {
 }
Exemplo n.º 9
0
 public TacticalCommand(Warrior owner) : base(owner)
 {
 }
Exemplo n.º 10
0
 public ButterflySingle(Warrior owner) : base(owner)
 {
 }
Exemplo n.º 11
0
 public ButterflyAOE(Warrior owner) : base(owner)
 {
 }
Exemplo n.º 12
0
 void OnBeforeCalculateDamage1(Warrior attacker, Warrior target, HashSet <string> flags, ref int inc, ref int more, List <int> multiplier)
 {
     multiplier.Add(FinalDamageFact);
 }
Exemplo n.º 13
0
 public CounterAttack(Warrior owner) : base(owner)
 {
 }
Exemplo n.º 14
0
 public BuffWithOwner(Warrior owner)
 {
     Owner = owner;
 }
Exemplo n.º 15
0
        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];
            });
        }
Exemplo n.º 16
0
 public OverlayAttrBuff(Warrior onwer, int roundNum, int overlayNum) : base(onwer, roundNum)
 {
     overlays = overlayNum;
 }
Exemplo n.º 17
0
 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);
 }
Exemplo n.º 18
0
 public Faint(Warrior owner, int num) : base(owner, num)
 {
 }
Exemplo n.º 19
0
 public WarriorAI(Warrior warrior)
 {
     Owner = warrior;
 }
Exemplo n.º 20
0
 public AllSuppressCounterAttackOn3POWInc(Warrior owner) : base(owner)
 {
 }
Exemplo n.º 21
0
 public FastAssistance2(Warrior owner) : base(owner)
 {
 }
Exemplo n.º 22
0
 public StarsTears(Warrior owner) : base(owner)
 {
 }
Exemplo n.º 23
0
 public AddConcentrateOnCriticalBeforeAction(Warrior owner) : base(owner) { }
Exemplo n.º 24
0
 public GainENOnEMPDestroyed(Warrior owner) : base(owner)
 {
 }
Exemplo n.º 25
0
 public ArtisanSpirit(Warrior owner) : base(owner)
 {
 }
Exemplo n.º 26
0
 public ActiveSkill(Warrior owner)
 {
     Owner = owner;
 }
Exemplo n.º 27
0
 // 星之泪效果公式
 public static int StarTearsEffect(Warrior attacker)
 {
     return(20 + attacker.POW * 3 / 10);
 }
Exemplo n.º 28
0
 // 对指定位置使用
 public virtual void Use2(Warrior target)
 {
     throw new Exception("not implemented yet");
 }
Exemplo n.º 29
0
 public Untreatable(Warrior owner, int num) : base(owner, num)
 {
 }
Exemplo n.º 30
0
 void OnBeforeAttack(Warrior attacker, Warrior target, List <Warrior> tars, Skill skill, HashSet <string> flags, List <int> multi, List <int> addMulti)
 {
     flags.Add("CriticalAttack");
 }