public static bool MagicCoat(AtkContext atk, PokemonProxy der)
 {
     //atk.Move.AdvancedFlags.MagicCoat is already checked
     if (der.OnboardPokemon.HasCondition(Cs.MagicCoat) || atk.DefenderAbilityAvailable() && der.AbilityE(As.MAGIC_BOUNCE))
     {
         var o = atk.GetCondition <List <PokemonProxy> >(Cs.MagicCoat);
         if (o == null)
         {
             o = new List <PokemonProxy>();
             atk.SetCondition(Cs.MagicCoat, o);
         }
         o.Add(der);
         return(true);
     }
     return(false);
 }
Beispiel #2
0
        public static void Execute(AtkContext atk)
        {
            var move = atk.Move;
            var def  = atk.Target;
            var der  = def.Defender;
            var aer  = atk.Attacker;

            bool ls = false, r = false, av = false, feint = false;

            switch (move.Id)
            {
            case Ms.BRICK_BREAK:     //280
            case Ms.Psychic_Fangs:
                if (der.Pokemon.TeamId != aer.Pokemon.TeamId)
                {
                    ls = der.Field.RemoveCondition(Cs.LightScreen);
                    r  = der.Field.RemoveCondition(Cs.Reflect);
                    av = der.Field.RemoveCondition(Cs.Aurora_Veil);
                }
                break;

            case Ms.FEINT:     //364
                feint = der.OnboardPokemon.RemoveCondition(Cs.Protect) | (der.Pokemon.TeamId != atk.Attacker.Pokemon.TeamId && (der.Field.RemoveCondition(Cs.QuickGuar) | der.Field.RemoveCondition(Cs.WideGuard)));
                break;
            }
            switch (move.Id)
            {
            case Ms.COUNTER:
                Counter(atk, Cs.PhysicalDamage, 0x2000);
                break;

            case Ms.MIRROR_COAT:
                Counter(atk, Cs.SpecialDamage, 0x2000);
                break;

            case Ms.METAL_BURST:
                Counter(atk, Cs.Damage, 0x1800);
                break;

            case Ms.SONIC_BOOM:     //49
                def.Damage = 20;
                break;

            case Ms.DRAGON_RAGE:     //82
                def.Damage = 40;
                break;

            case Ms.SEISMIC_TOSS:    //69
            case Ms.NIGHT_SHADE:     //101
                def.Damage = aer.Pokemon.Lv;
                break;

            case Ms.BIDE:     //117
                def.Damage = atk.GetCondition(Cs.Bide).Damage << 1;
                break;

            case Ms.PSYWAVE:     //149
                def.Damage = der.Controller.GetRandomInt(50, 150) * aer.Pokemon.Lv / 100;
                if (def.Damage == 0)
                {
                    def.Damage = 1;
                }
                break;

            case Ms.SUPER_FANG:     //162
            case Ms.Natures_Madness:
                def.Damage = der.Hp >> 1;
                if (def.Damage == 0)
                {
                    def.Damage = 1;
                }
                break;

            case Ms.Guardian_of_Alola:
                def.Damage = der.Hp * 3 / 4;
                if (def.Damage == 0)
                {
                    def.Damage = 1;
                }
                break;

            case Ms.ENDEAVOR:     //283
                def.Damage = der.Hp - aer.Hp;
                if (def.Damage < 0)
                {
                    def.Damage = 0;
                }
                break;

            case Ms.FINAL_GAMBIT:     //515
                def.Damage = atk.Attacker.Hp;
                break;

            default:
                if (move.Class != MoveClass.OHKO)
                {
                    ITs.CheckGem(atk);
                    foreach (DefContext d in atk.Targets)
                    {
                        CalculateDamage(d);
                    }
                }
                break;
            }
            switch (move.Id)
            {
            case Ms.FALSE_SWIPE:
            case Ms.HOLD_BACK:
                if (def.Damage >= def.Defender.Hp)
                {
                    def.Damage = def.Defender.Hp - 1;
                }
                break;

            case Ms.BEAT_UP:
            {        //无视属性相克修正,但依然会显示“没有什么效果”“效果拔群”的战报。
                BattleType a = def.AtkContext.Type;
                def.EffectRevise = a == BattleType.Ground && der.ItemE(Is.IRON_BALL) && der.OnboardPokemon.HasType(BattleType.Flying) ? 0 : a.EffectRevise(der.OnboardPokemon.Types);
            }
            break;

            case Ms.SELFDESTRUCT:  //120
            case Ms.EXPLOSION:     //153
            case Ms.FINAL_GAMBIT:  //515
                atk.Attacker.Faint();
                break;

            case Ms.BRICK_BREAK:     //280
            case Ms.Psychic_Fangs:
                if (ls)
                {
                    atk.Controller.ReportBuilder.ShowLog("DeLightScreen", der.Field.Team);
                }
                if (r)
                {
                    atk.Controller.ReportBuilder.ShowLog("DeReflect", der.Field.Team);
                }
                if (av)
                {
                    atk.Controller.ReportBuilder.ShowLog("DeAurora_Veil", der.Field.Team);
                }
                break;

            case Ms.FEINT:     //364
                if (feint)
                {
                    der.ShowLogPm("Feint");
                }
                break;
            }
            bool Zprotect = false;

            if (move.Zmove)
            {
                Zprotect = der.OnboardPokemon.RemoveCondition(Cs.Protect);
            }
            if (Zprotect)
            {
                def.Damage >>= 2;
                der.ShowLogPm("Zprotect");
            }
            if (atk.DefenderAbilityAvailable() && def.Defender.CanChangeForm(778, 1) && def.Damage > 0 && def.Defender.RaiseAbility(As.Disguise))
            {
                def.Defender.ChangeForm(1, true);
                def.Damage = 0;
            }
        }