private static bool PrepareOneTurn(AtkContext atk) { var aer = atk.Attacker; if (aer.Action == PokemonAction.MoveAttached) { var m = atk.Move.Id; switch (m) { case Ms.FLY: //19 case Ms.BOUNCE: //340 aer.CoordY = CoordY.Air; break; case Ms.DIG: //91 aer.CoordY = CoordY.Underground; break; case Ms.DIVE: //291 aer.CoordY = CoordY.Water; break; case Ms.SHADOW_FORCE: //467 case Ms.PHANTOM_FORCE: aer.CoordY = CoordY.Another; break; case Ms.SKY_DROP: MoveE.FilterDefContext(atk); if (atk.Target == null) { atk.FailAll(null); } else { aer.CoordY = CoordY.Air; atk.Target.Defender.CoordY = CoordY.Air; atk.Target.Defender.OnboardPokemon.SetCondition(Cs.SkyDrop); aer.ShowLogPm(Ls.EnSkyDrop, atk.Target.Defender.Id); atk.SetAttackerAction(PokemonAction.Moving); } return(true); } aer.ShowLogPm("Prepare" + m.ToString()); if (m == Ms.SKULL_BASH) { aer.ChangeLv7D(atk.Attacker, StatType.Def, 1, false); } atk.SetAttackerAction(PokemonAction.Moving); return(!((m == Ms.SOLAR_BEAM || m == Ms.Solar_Blade) && aer.Controller.Weather == Weather.IntenseSunlight || ITs.PowerHerb(aer))); } return(false); }
private static void Generic(AtkContext atk) { var move = atk.Move; var aer = atk.Attacker; if (move.PrepareOneTurn && PrepareOneTurn(atk)) { return; } if (aer.Controller.GameSettings.Mode.XBound() != 1 && (move.Id == Ms.WATER_PLEDGE || move.Id == Ms.FIRE_PLEDGE || move.Id == Ms.GRASS_PLEDGE)) { if (aer.Field.AddTurnCondition(Cs.Plege, move.Id)) { foreach (var pm in aer.Controller.ActingPokemons) { if (pm.Pokemon.TeamId == aer.Pokemon.TeamId && pm.SelectedMove != null && pm.SelectedMove.MoveE.Id != move.Id && (pm.SelectedMove.MoveE.Id == Ms.WATER_PLEDGE || pm.SelectedMove.MoveE.Id == Ms.FIRE_PLEDGE || pm.SelectedMove.MoveE.Id == Ms.GRASS_PLEDGE) && pm.CanMove) { aer.ShowLogPm(Ls.Pledge, pm.Id); aer.Controller.Board.SetTurnCondition(Cs.NextActingPokemon, pm); return; } } } } if (move.Snatchable) { foreach (var pm in atk.Controller.OnboardPokemons) { if (pm.OnboardPokemon.HasCondition(Cs.Snatch)) { pm.OnboardPokemon.RemoveCondition(Cs.Snatch); pm.ShowLogPm("Snatch", aer.Id); var s = new AtkContext(pm) { Move = move }; InitAtkContext.Execute(s); MoveE.BuildDefContext(s, null); if (MoveNotFail.Execute(s)) { MoveAct.Execute(s); } else { s.FailAll(); } atk.SetAttackerAction(PokemonAction.Done); return; } } } if (move.MagicCoat && atk.Targets == null && !atk.HasCondition(Cs.IgnoreMagicCoat)) { foreach (var p in aer.Controller.GetOnboardPokemons(1 - aer.Pokemon.TeamId)) { if (STs.MagicCoat(atk, p)) { atk.SetCondition(Cs.MagicCoat, new List <PokemonProxy>() { p }); atk.FailAll(null); MoveE.MagicCoat(atk); return; } } } CalculateType.Execute(atk); if (atk.Type == BattleType.Fire && aer.OnboardPokemon.HasCondition(Cs.Powder)) { aer.EffectHurtByOneNth(4, Ls.Powder); atk.FailAll(null); return; } if (atk.Move.Move.Category != MoveCategory.Status) { if (atk.Type == BattleType.Fire && aer.Controller.Board.GetCondition <int>(Cs.SpWeather) == As.PRIMORDIAL_SEA) { atk.FailAll(Ls.HeavyRain); return; } if (atk.Type == BattleType.Water && aer.Controller.Board.GetCondition <int>(Cs.SpWeather) == As.DESOLATE_LAND) { atk.FailAll(Ls.HarshSunlight); return; } } if (aer.AbilityE(As.PROTEAN) && aer.OnboardPokemon.SetTypes(atk.Type)) { aer.RaiseAbility(); aer.ShowLogPm("TypeChange", (int)atk.Type); } MoveE.FilterDefContext(atk); if (atk.Targets != null && atk.Target == null) { atk.FailAll(null); } else { MoveAct.Execute(atk); MoveE.MoveEnding(atk); } if (move.MagicCoat && atk.Targets != null) { MoveE.MagicCoat(atk); } }
public static void Execute(DefContext def) { var move = def.AtkContext.Move; switch (move.Id) { case Ms.RAPID_SPIN: //229 RapidSpin(def); break; case Ms.SMELLING_SALTS: //265 DeAbnormalState(def, PokemonState.PAR); break; case Ms.WAKEUP_SLAP: //358 DeAbnormalState(def, PokemonState.SLP); break; case Ms.Sparkling_Aria: //358 DeAbnormalState(def, PokemonState.BRN); break; case Ms.Burn_Up: def.AtkContext.Attacker.OnboardPokemon.LoseType(BattleType.Fire); def.AtkContext.Attacker.ShowLogPm("LoseFire"); break; case Ms.PLUCK: //365 case Ms.BUG_BITE: //450 EatDefenderBerry(def); break; case Ms.SMACK_DOWN: //479 SmackDown(def); break; case Ms.CIRCLE_THROW: //509 case Ms.DRAGON_TAIL: //525 if (def.Defender.Hp != 0 && def.Defender.Controller.CanWithdraw(def.Defender)) { MoveE.ForceSwitchImplement(def.Defender, def.AtkContext.DefenderAbilityAvailable()); } break; case Ms.WATER_PLEDGE: case Ms.FIRE_PLEDGE: case Ms.GRASS_PLEDGE: { var aer = def.AtkContext.Attacker; var pledge = aer.Field.GetCondition <int>(Cs.Plege); if (aer.Field.RemoveCondition(Cs.Plege) && pledge != move.Id) { pledge += move.Id; switch (pledge) { case Ms.WATER_PLEDGE + Ms.FIRE_PLEDGE: if (aer.Field.AddCondition(Cs.Rainbow, aer.Controller.TurnNumber + 4)) { aer.Controller.ReportBuilder.ShowLog(Ls.EnRainbow, aer.Pokemon.TeamId); } break; case Ms.FIRE_PLEDGE + Ms.GRASS_PLEDGE: if (def.Defender.Field.AddCondition(Cs.FireSea, aer.Controller.TurnNumber + 4)) { aer.Controller.ReportBuilder.ShowLog(Ls.EnFireSea, def.Defender.Pokemon.TeamId); } break; case Ms.GRASS_PLEDGE + Ms.WATER_PLEDGE: if (def.Defender.Field.AddCondition(Cs.Swamp, aer.Controller.TurnNumber + 4)) { aer.Controller.ReportBuilder.ShowLog(Ls.EnSwamp, def.Defender.Pokemon.TeamId); } break; } } } break; default: { var aer = def.AtkContext.Attacker; if (move.HurtPercentage < 0 && !aer.AbilityE(As.ROCK_HEAD)) { aer.EffectHurt(-def.Damage * move.HurtPercentage / 100, Ls.ReHurt); } else if (move.MaxHpPercentage < 0) //拼命专用 { var change = aer.Pokemon.MaxHp * move.MaxHpPercentage / 100; aer.OnboardPokemon.SetTurnCondition(Cs.Assurance); aer.ShowLogPm(Ls.ReHurt); aer.Hp += (change == 0 ? -1 : change); } } break; } }