コード例 #1
0
        public static bool AddState(this PokemonProxy pm, DefContext def)
        {
            var aer  = def.AtkContext.Attacker;
            var move = def.AtkContext.Move;

            if (def.RandomHappen(move.AttachedProbability) && CanAddState(pm, aer, def.AtkContext.DefenderAbilityAvailable(), move.AttachedState, def.AtkContext.Move.Move.Category == MoveCategory.Status))
            {
                int turn;
                if (move.Id == Ms.TOXIC || move.Id == Ms.POISON_FANG)
                {
                    turn = 0x0F;
                }
                else if (move.AttachedState == AttachedState.Trap && aer.Item == Is.GRIP_CLAW)
                {
                    turn = 8;
                }
                else
                {
                    turn = 0;
                }
                AddStateImplement(pm, aer, move.AttachedState, turn, null, 0);
                return(true);
            }
            return(false);
        }
コード例 #2
0
        public static bool MustHit(DefContext def)
        {
            var m = def.AtkContext.Move.Id;

            return
                (def.NoGuard ||
                 (m == Ms.STOMP || m == Ms.DRAGON_RUSH || m == Ms.STEAMROLLER || m == Ms.PHANTOM_FORCE || m == Ms.FLYING_PRESS) && def.Defender.OnboardPokemon.HasCondition(Cs.Minimize));
        }
コード例 #3
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));
        }
コード例 #4
0
 public static bool RaiseAbility(this DefContext def, int abilityId)
 {
     if (def.AbilityE(abilityId))
     {
         RaiseAbility(def.Defender);
         return(true);
     }
     return(false);
 }
コード例 #5
0
        private static bool IsYInRange(DefContext def)
        {
            var y = def.Defender.CoordY;
            var m = def.AtkContext.Move.Id;

            return
                (y == CoordY.Plate ||
                 y == CoordY.Water && (m == Ms.SURF || m == Ms.WHIRLPOOL) ||
                 y == CoordY.Underground && (m == Ms.EARTHQUAKE || m == Ms.FISSURE) ||
                 y == CoordY.Air && (m == Ms.GUST || m == Ms.TWISTER || m == Ms.THUNDER || m == Ms.HURRICANE || m == Ms.SKY_UPPERCUT));
        }
コード例 #6
0
 public static void ColorChange(DefContext def)
 {
     var type = def.AtkContext.Type;
     if (type == BattleType.Invalid) type = BattleType.Normal;
     if (!def.HitSubstitute) // performance
     {
         var dt = def.Defender.OnboardPokemon.Types;
         if (!(dt.First() == type && dt.Last() == type) && def.Defender.RaiseAbility(As.COLOR_CHANGE))
         {
             def.Defender.OnboardPokemon.SetTypes(type);
             def.Defender.ShowLogPm("TypeChange", (int)type);
         }
     }
 }
コード例 #7
0
 public static bool CannotBeCted(this DefContext def)
 {
     return(def.AbilityE(As.BATTLE_ARMOR) || def.AbilityE(As.SHELL_ARMOR));
 }
コード例 #8
0
 public static bool Stench(DefContext def)
 {
     return(def.AtkContext.Attacker.AbilityE(As.STENCH) && def.Defender.Controller.RandomHappen(10));
 }
コード例 #9
0
 public static bool CanAttackFlinch(DefContext def)
 {
     return((def.AtkContext.Attacker.ItemE(Is.KINGS_ROCK) || def.AtkContext.Attacker.ItemE(Is.RAZOR_FANG)) && def.Defender.Controller.RandomHappen(10));
 }
コード例 #10
0
 public static void AirBalloon(DefContext def)
 {
     def.Defender.RemoveItem();
     def.Defender.ShowLogPm("DeBalloon");
 }
コード例 #11
0
        public static bool ChangeLv7D(this PokemonProxy pm, DefContext def)
        {
            var c = def.AtkContext.Move.Lv7DChanges;

            return(c != null && def.RandomHappen(c.Probability) && ChangeLv7D(pm, def.AtkContext.Attacker, def.AtkContext.Move));
        }
コード例 #12
0
 public void SetTargets(IEnumerable <DefContext> targets)
 {
     Targets = targets;
     Target  = targets.FirstOrDefault();
 }