/// <summary> /// contains battle log /// </summary> /// <param name="atk"></param> /// <returns></returns> public static bool Execute(AtkContext atk) { var aer = atk.Attacker; if (atk.Targets == null || atk.Target != null) { switch (atk.Move.Id) { case Ms.SKETCH: //166 case Ms.TELEPORT: case Ms.HAPPY_HOUR: break; case Ms.SELFDESTRUCT: //120 case Ms.EXPLOSION: if (aer.Controller.Board.Pokemons.RaiseAbility(As.DAMP) != null) { atk.FailAll("FailSp", atk.Attacker.Id, atk.Move.Id); return(false); } return(true); case Ms.REST: //156 if (aer.Hp == aer.Pokemon.MaxHp) { atk.FailAll("FullHp", aer.Id); return(false); } if (!PTs.CanAddXXX(aer, aer, true, AttachedState.SLP, true)) { atk.FailAll(null); return(false); } return(true); case Ms.SNORE: //173 case Ms.SLEEP_TALK: if (aer.State == PokemonState.SLP) { return(true); } break; case Ms.FAKE_OUT: //252 case Ms.MAT_BLOCK: foreach (var m in aer.Moves) { if (m.HasUsed) { goto FAIL; } } return(true); case Ms.STOCKPILE: //254 if (aer.OnboardPokemon.GetCondition <int>(Cs.Stockpile) != 3) { return(true); } break; case Ms.SPIT_UP: //255 case Ms.SWALLOW: if (aer.OnboardPokemon.HasCondition(Cs.Stockpile)) { return(true); } break; case Ms.NATURAL_GIFT: //363 if (ITs.CanLostItem(aer) && ITs.CanUseItem(aer) && ITs.Berry(aer.Pokemon.Item)) { return(true); } break; case Ms.FLING: //374 if (ITs.CanLostItem(aer) && ITs.CanUseItem(aer) && MoveBasePower.FlingPower(aer.Pokemon.Item) != 0) { return(true); } break; case Ms.ME_FIRST: //382 case Ms.SUCKER_PUNCH: //389 { var der = atk.Target.Defender; var dm = der.SelectedMove; if (!(der.LastMoveTurn == der.Controller.TurnNumber || dm == null || dm.Move.Type.Category == MoveCategory.Status)) { return(true); } } break; case Ms.LAST_RESORT: //387 foreach (var m in aer.Moves) { if (!m.HasUsed && m.MoveE.Id != Ms.LAST_RESORT) { goto FAIL; } } return(true); case Ms.ALLY_SWITCH: if (aer.Controller.GameSettings.Mode == GameMode.Double || aer.Controller.GameSettings.Mode == GameMode.Triple && aer.OnboardPokemon.X != 1) { return(true); } break; case Ms.BESTOW: //516 if (aer.Pokemon.Item == 0 || ITs.NeverLostItem(aer.Pokemon)) { return(true); } break; case Ms.BELCH: //562 if (aer.OnboardPokemon.HasCondition(Cs.Belch)) { return(true); } break; case Ms.HYPERSPACE_FURY: if (aer.Pokemon.Form.Species.Number == Ps.HOOPA) { return(true); } break; default: if (!atk.Move.HardToUseContinuously || ContinuousUse(atk)) { return(true); } break; } } FAIL: atk.FailAll(); return(false); }
public static Modifier Execute(DefContext def) { var der = def.Defender; var atk = def.AtkContext; var move = atk.Move; var aer = atk.Attacker; //If the target's side is affected by Reflect, the move used was physical, the user's ability isn't Infiltrator and the critical hit flag isn't set. //The value of the modificator is 0xA8F if there is more than one Pokemon per side of the field and 0x800 otherwise. //Same as above with Light Screen and special moves. Modifier m = (Modifier)(!def.IsCt && (der.Pokemon.TeamId == aer.Pokemon.TeamId || !aer.AbilityE(As.INFILTRATOR)) && (move.Move.Category == MoveCategory.Physical && der.Field.HasCondition(Cs.Reflect) || move.Move.Category == MoveCategory.Special && der.Field.HasCondition(Cs.LightScreen)) ? atk.MultiTargets ? 0xA8F : 0x800 : 0x1000); { //If the target's ability is Multiscale and the target is at full health. m *= (Modifier)(def.AbilityE(As.MULTISCALE) && der.Hp == der.Pokemon.MaxHp ? 0x800 : 0x1000); //If the user's ability is Tinted Lens and the move wasn't very effective. if (def.EffectRevise < 0 && aer.AbilityE(As.TINTED_LENS)) { m *= 0x2000; } //If one of the target's allies' ability is Friend Guard. foreach (PokemonProxy pm in der.Controller.GetOnboardPokemons(der.Pokemon.TeamId)) { if (pm != der && pm.AbilityE(As.FRIEND_GUARD)) { m *= 0xC00; } } //If user has ability Sniper and move was a critical hit. if (def.IsCt && aer.AbilityE(As.SNIPER)) { m *= 0x1800; } //If the target's ability is Solid Rock or Filter and the move was super effective. if (def.EffectRevise > 0 && (def.AbilityE(As.FILTER) || def.AbilityE(As.SOLID_ROCK))) { m *= 0xC00; } if (atk.Hit == 2 && atk.HasCondition(Cs.ParentalBond)) { m *= 0x800; } } switch (aer.Item) { //If the user is holding an expert belt and the move was super effective. case Is.EXPERT_BELT: if (def.EffectRevise > 0) { m *= 0x1333; } break; //If the user is holding a Life Orb. case Is.LIFE_ORB: m *= 0x14cc; break; //If the user is holding the item Metronome. If n is the number of time the current move was used successfully and successively, the value of the modifier is 0x1000+n*0x333 if n≤4 and 0x2000 otherwise. case Is.METRONOME: var c = aer.OnboardPokemon.GetCondition(Cs.LastMove); if (c != null && move == c.Move) { if (c.Int < 5) { m *= (ushort)(0x1000 + c.Int * 0x333); } else { m *= 0x2000; } } break; } //If the target is holding a damage lowering berry of the attack's type. { var item = der.Item; if ( item == Is.CHILAN_BERRY && atk.Type == BattleType.Normal || atk.Type == AntiBerry(item) && def.EffectRevise > 0 ) { def.SetCondition(Cs.Antiberry); m *= 0x800; } } switch (move.Id) { case Ms.STOMP: //23 case Ms.DRAGON_RUSH: case Ms.STEAMROLLER: //537 case Ms.PHANTOM_FORCE: case Ms.FLYING_PRESS: if (der.OnboardPokemon.HasCondition(Cs.Minimize)) { m *= 0x2000; } break; case Ms.SURF: case Ms.WHIRLPOOL: if (der.CoordY == CoordY.Water) { m *= 0x2000; } break; case Ms.EARTH_POWER: //89 case Ms.MAGNITUDE: //222 if (der.CoordY == CoordY.Underground) { m *= 0x2000; } break; case Ms.KNOCK_OFF: if (der.Pokemon.Item != 0 && !ITs.NeverLostItem(der.Pokemon)) { m *= 0x1800; } break; } return(m); }