コード例 #1
0
ファイル: MoveE.cs プロジェクト: gyyfifafans/PBO
        public static bool CanHit(DefContext def)
        {
            var atk  = def.AtkContext;
            var aer  = atk.Attacker;
            var c    = atk.Controller;
            var move = atk.Move;
            int acc;

            if (move.Class == MoveClass.OHKO)
            {
                acc = move.Move.Accuracy + aer.Pokemon.Lv - def.Defender.Pokemon.Lv;
                if (move.Id == Ms.SHEER_COLD && !aer.OnboardPokemon.Types.Contains(BattleType.Ice))
                {
                    acc = acc - 10;
                }
            }
            else
            {
                int lv;
                if (def.AbilityE(As.UNAWARE))
                {
                    lv = 0;
                }
                else
                {
                    lv = aer.OnboardPokemon.AccuracyLv;
                }
                //如果攻击方是天然特性,防御方的回避等级按0计算。
                //循序渐进无视防御方回避等级。
                //将攻击方的命中等级减去防御方的回避等级。
                if (!(move.IgnoreDefenderLv7D || aer.AbilityE(As.UNAWARE) || aer.AbilityE(As.KEEN_EYE)))
                {
                    lv -= def.Defender.OnboardPokemon.EvasionLv;
                }
                if (lv < -6)
                {
                    lv = -6;
                }
                else if (lv > 6)
                {
                    lv = 6;
                }
                //用技能基础命中乘以命中等级修正,向下取整。
                int numerator = 3, denominator = 3;
                if (lv > 0)
                {
                    numerator += lv;
                }
                else
                {
                    denominator -= lv;
                }
                acc  = (c.Weather == Weather.IntenseSunlight && (move.Id == Ms.THUNDER || move.Id == Ms.HURRICANE) ? 50 : atk.Move.Move.Accuracy) * numerator / denominator;
                acc *= AccuracyModifier.Execute(def);
            }
            //产生1~100的随机数,如果小于等于命中,判定为命中,否则判定为失误。
            return(c.RandomHappen(acc));
        }
コード例 #2
0
 public static bool RaiseAbility(this DefContext def, int abilityId)
 {
     if (def.AbilityE(abilityId))
     {
         RaiseAbility(def.Defender);
         return(true);
     }
     return(false);
 }
コード例 #3
0
 public static bool CannotBeCted(this DefContext def)
 {
     return(def.AbilityE(As.BATTLE_ARMOR) || def.AbilityE(As.SHELL_ARMOR));
 }