public static void MagicCoat(AtkContext atk)
        {
            var list = atk.GetCondition <List <PokemonProxy> >(Cs.MagicCoat);

            if (list != null)
            {
                atk.RemoveCondition(Cs.MagicCoat);
                foreach (var d in list)
                {
                    var a = new AtkContext(d);
                    a.SetCondition(Cs.IgnoreMagicCoat);
                    a.StartExecute(atk.Move, atk.Attacker.Tile, d.RaiseAbility(As.MAGIC_BOUNCE) ? "MagicBounce" : "MagicCoat");
                    if (atk.Target == null)
                    {
                        break;
                    }
                }
            }
        }
Esempio n. 2
0
        internal void Move()
        {
            if (SelectZmove)
            {
                Pokemon.Zmove = true;
            }
            STs.FocusPunch(Controller);
            LastMoveTurn = Controller.TurnNumber;
            STs.WillAct(this);
            switch (Action)
            {
            case PokemonAction.Stiff:
                PTs.ShowLogPm(this, "Stiff");
                Action = PokemonAction.Done;
                break;

            case PokemonAction.Moving:
                if (AtkContext.Move.Id == Ms.SKY_DROP)
                {
                    CoordY = CoordY.Plate;
                    if (AtkContext.Target.Defender.AliveOnboard)
                    {
                        AtkContext.Target.Defender.CoordY = CoordY.Plate;
                        AtkContext.Target.Defender.OnboardPokemon.RemoveCondition(Cs.SkyDrop);
                    }
                    else
                    {
                        AtkContext.SetTargets(Enumerable.Empty <DefContext>());
                    }
                }
                if (CanExecute())
                {
                    if (AtkContext.Move.Id != Ms.BIDE)
                    {
                        PTs.ShowLogPm(this, "UseMove", AtkContext.Move.Id);
                    }
                    AtkContext.ContinueExecute(SelectedTarget);
                }
                else
                {
                    Action = PokemonAction.Done;
                }
                break;

            case PokemonAction.MoveAttached:
            {
                var o = OnboardPokemon.GetCondition(Cs.Encore);
                if (o != null)
                {
                    foreach (var m in Moves)
                    {
                        if (m.MoveE == o.Move)
                        {
                            SelectedMove = m;
                        }
                    }
                }
            }
                ATs.StanceChange(this);
                if (SelectZmove && SelectedMove.MoveE.Move.Category == MoveCategory.Status)
                {
                    switch (GameHelper.ZStatus(SelectedMove.MoveE.Move.Id))
                    {
                    case 0:
                        break;

                    case 1:
                        this.ChangeLv7D(this, StatType.Atk, 1, false);
                        break;

                    case 2:
                        this.ChangeLv7D(this, StatType.Atk, 2, false);
                        break;

                    case 3:
                        this.ChangeLv7D(this, StatType.Atk, 3, false);
                        break;

                    case 4:
                        this.ChangeLv7D(this, StatType.Def, 1, false);
                        break;

                    case 5:
                        this.ChangeLv7D(this, StatType.SpAtk, 1, false);
                        break;

                    case 6:
                        this.ChangeLv7D(this, StatType.SpAtk, 2, false);
                        break;

                    case 7:
                        this.ChangeLv7D(this, StatType.SpDef, 1, false);
                        break;

                    case 8:
                        this.ChangeLv7D(this, StatType.SpDef, 2, false);
                        break;

                    case 9:
                        this.ChangeLv7D(this, StatType.Speed, 1, false);
                        break;

                    case 10:
                        this.ChangeLv7D(this, StatType.Speed, 2, false);
                        break;

                    case 11:
                        this.ChangeLv7D(this, StatType.Accuracy, 1, false);
                        break;

                    case 12:
                        this.ChangeLv7D(this, StatType.Evasion, 1, false);
                        break;

                    case 13:
                        this.ChangeLv7D(this, false, false, 1, 1, 1, 1, 1, 0, 0);
                        break;

                    case 14:
                        if (OnboardPokemon.AddCondition(Cs.FocusEnergy))
                        {
                            this.ShowLogPm("En" + Cs.FocusEnergy);
                        }
                        break;

                    case 15:
                        ITs.Reset7D(this);
                        break;

                    case 16:
                        this.HpRecover(Pokemon.MaxHp);
                        break;

                    case 17:
                        if (Pokemon.Owner.PmsAlive > Controller.GameSettings.Mode.OnboardPokemonsPerPlayer())
                        {
                            Tile.SetTurnCondition(Cs.Zheal);
                        }
                        break;

                    case 18:
                        OnboardPokemon.AddTurnCondition(Cs.FollowMe, SelectedMove.MoveE.Move.Id);
                        this.ShowLogPm(Ls.EnFollowMe);
                        break;

                    default:
                        break;
                    }
                    if (SelectedMove.MoveE.Move.Id == Ms.CURSE)
                    {
                        if (OnboardPokemon.HasType(BattleType.Ghost))
                        {
                            this.HpRecover(Pokemon.MaxHp);
                        }
                        else
                        {
                            this.ChangeLv7D(this, StatType.Atk, 1, false);
                        }
                    }
                }
                if (CanExecute() && SelectedMove.CanExecute())
                {
                    _atkContext = null;
                    SelectedMove.Execute();
                    var o = OnboardPokemon.GetCondition(Cs.LastMove);
                    if (o == null)
                    {
                        o      = new Condition();
                        o.Move = AtkContext.Move;
                        OnboardPokemon.SetCondition(Cs.LastMove, o);
                    }
                    else if (o.Move != AtkContext.Move)
                    {
                        o.Move = AtkContext.Move;
                        o.Int  = 0;
                    }
                    if (AtkContext.Fail)
                    {
                        o.Int = 0;
                    }
                    else
                    {
                        o.Int++;
                    }
                    Controller.Board.SetCondition(Cs.LastMove, o);
                }
                else
                {
                    OnboardPokemon.RemoveCondition(Cs.LastMove);
                    Action = PokemonAction.Done;
                }
                if (AtkContext != null && AtkContext.Move.Dance && AtkContext.Attacker.LastMoveTurn == Controller.TurnNumber)
                {
                    foreach (var p in Controller.Board.Pokemons)
                    {
                        if (p != null && p.AbilityE(As.Dancer) && p != AtkContext.Attacker)
                        {
                            p.RaiseAbility();
                            AtkContext dance = new AtkContext(p);
                            dance.StartExecute(AtkContext.Move, null, "UseMove", false);
                        }
                    }
                }
                break;
            } //switch(Action)
        }