namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
///
/// Solar Power is an ability that boosts Special Attack in harsh sunlight but causes the Pokémon to lose HP each turn.
///
/// Bulbapedia - Solar Power
///
[Script(ScriptCategory.Ability, "solar_power")]
public class SolarPower : Script
{
///
public override void ChangeOffensiveStatValue(IExecutingMove move, IPokemon target, byte hit, uint defensiveStat,
ImmutableStatisticSet targetStats, Statistic stat, ref uint value)
{
if ((stat == Statistic.SpecialAttack &&
move.Battle.WeatherName == ScriptUtils.ResolveName()) ||
move.Battle.WeatherName == ScriptUtils.ResolveName())
{
value = value.MultiplyOrMax(1.5f);
}
}
///
public override void OnEndTurn(IScriptSource owner, IBattle battle)
{
if (owner is not IPokemon pokemon)
return;
if (!pokemon.IsUsable)
return;
pokemon.Damage(pokemon.MaxHealth / 8, DamageSource.Weather);
}
}