private static void EatDefenderBerry(DefContext def)
        {
            var i = def.GetCondition <int>(Cs.EatenBerry);

            if (i != 0)
            {
                var aer = def.AtkContext.Attacker;
                def.AtkContext.Attacker.ShowLogPm("EatDefenderBerry", i);
                ITs.RaiseItemByMove(aer, i, aer);
            }
        }
Example #2
0
        public static void Execute(DefContext def)
        {
            var der  = def.Defender;
            var atk  = def.AtkContext;
            var aer  = atk.Attacker;
            var move = atk.Move;

            switch (move.Id)
            {
            case Ms.TRI_ATTACK:     //161
                TriAttack(def);
                break;

            case Ms.THIEF:     //168
            case Ms.COVET:     //343
                Thief(def);
                break;

            case Ms.KNOCK_OFF:     //282
                RemoveItem(def, false, "KnockOff");
                break;

            case Ms.INCINERATE:     //510
                RemoveItem(def, true, "Incinerate");
                break;

            case Ms.SECRET_POWER:     //290
                SecretPower(def);
                break;

            case Ms.NATURAL_GIFT:     //363
                def.AtkContext.Attacker.ConsumeItem(false);
                break;

            case Ms.PLUCK:     //365
            case Ms.BUG_BITE:  //450
                EatDefenderBerry(def);
                break;

            case Ms.FLING:     //374
            {
                var i = aer.Pokemon.Item;
                aer.ConsumeItem(false);
                ITs.RaiseItemByMove(def.Defender, i, aer);
            }
            break;

            case Ms.SHADOW_FORCE:     //467
            case Ms.PHANTOM_FORCE:
            case Ms.HYPERSPACE_HOLE:
            case Ms.HYPERSPACE_FURY:
                if (def.Defender.OnboardPokemon.RemoveCondition(Cs.Protect))
                {
                    def.Defender.ShowLogPm("DeProtect");
                }
                break;

            case Ms.CLEAR_SMOG:     //499
                der.OnboardPokemon.SetLv7D(0, 0, 0, 0, 0, 0, 0);
                der.ShowLogPm("7DReset");
                break;

            case Ms.Core_Enforcer:
                if (der.LastMoveTurn == der.Controller.TurnNumber && !GameHelper.CantLoseAbility(der.Ability) && der.OnboardPokemon.AddCondition(Cs.GastroAcid))
                {
                    der.ShowLogPm("LoseAbility");
                }
                break;

            default:
                if (der.Hp > 0)
                {
                    if (move.Class == MoveClass.AttackWithTargetLv7DChange)
                    {
                        der.ChangeLv7D(def);
                    }
                    else if (move.Class == MoveClass.AttackWithState)
                    {
                        der.AddState(def);
                    }
                    if (!def.AbilityE(As.INNER_FOCUS) && (move.FlinchProbability != 0 && def.RandomHappen(move.FlinchProbability) || ATs.Stench(def) || ITs.CanAttackFlinch(def)))
                    {
                        der.OnboardPokemon.SetTurnCondition(Cs.Flinch);
                    }
                }
                break;
            }
            switch (move.Id)
            {
            case Ms.RELIC_SONG:
                if (aer.CanChangeForm(648))
                {
                    aer.ChangeForm(1 - aer.OnboardPokemon.Form.Index);
                }
                break;
            }
        }