public static bool IsGroundAffectable(PokemonProxy pm, bool abilityAvailable, bool raiseAbility) { var o = pm.OnboardPokemon; return ((o.HasCondition(Cs.SmackDown) || o.HasCondition(Cs.Ingrain) || pm.Controller.Board.HasCondition(Cs.Gravity)) || pm.ItemE(Is.IRON_BALL) || !(o.HasType(BattleType.Flying) || o.HasCondition(Cs.MagnetRise) || o.HasCondition(Cs.Telekinesis) || pm.ItemE(Is.AIR_BALLOON) || (abilityAvailable && (raiseAbility ? pm.RaiseAbility(As.LEVITATE) : pm.AbilityE(As.LEVITATE))))); }
public static bool Remaining1HP(PokemonProxy pm, bool ability) { if (pm.OnboardPokemon.HasCondition(Cs.Endure)) { pm.ShowLogPm("Endure"); return(true); } if (ability && pm.Hp == pm.Pokemon.MaxHp && pm.RaiseAbility(As.STURDY)) { pm.ShowLogPm("Endure"); return(true); } if (pm.ItemE(Is.FOCUS_BAND) && pm.Controller.OneNth(10) || pm.ItemE(Is.FOCUS_SASH) && pm.Hp == pm.Pokemon.MaxHp) { pm.ShowLogPm("FocusItem", pm.Pokemon.Item); if (pm.Pokemon.Item == Is.FOCUS_SASH) { pm.ConsumeItem(); } return(true); } return(false); }
public static bool SetWeather(PokemonProxy pm, Weather weather, bool ability, bool showFail) { var c = pm.Controller; if (c.Board.Weather == weather) { if (showFail) { c.ReportBuilder.ShowLog(Ls.Fail0); } return(false); } if (ability) { pm.RaiseAbility(); } switch (c.Board.GetCondition <int>(Cs.SpWeather)) { case As.PRIMORDIAL_SEA: c.ReportBuilder.ShowLog(Ls.HeavyRain2); return(false); case As.DESOLATE_LAND: c.ReportBuilder.ShowLog(Ls.HarshSunlight2); return(false); case As.DELTA_STREAM: c.ReportBuilder.ShowLog(Ls.MysteriousAirCurrent2); return(false); default: c.ReportBuilder.ShowLog(weather == Weather.IntenseSunlight ? Ls.EnIntenseSunlight : weather == Weather.Rain ? Ls.EnRain : weather == Weather.Hailstorm ? Ls.EnHailstorm : Ls.EnSandstorm); c.Weather = weather; c.Board.SetCondition(Cs.Weather, (c.TurnNumber == 0 ? 1 : c.TurnNumber) + (pm.ItemE(weather.Item()) ? 7 : 4)); return(true); } }