This commit is contained in:
34
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/SolarPower.cs
Normal file
34
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/SolarPower.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
|
||||
/// <summary>
|
||||
/// Solar Power is an ability that boosts Special Attack in harsh sunlight but causes the Pokémon to lose HP each turn.
|
||||
///
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Solar_Power_(Ability)">Bulbapedia - Solar Power</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "solar_power")]
|
||||
public class SolarPower : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeOffensiveStatValue(IExecutingMove move, IPokemon target, byte hit, uint defensiveStat,
|
||||
ImmutableStatisticSet<uint> targetStats, Statistic stat, ref uint value)
|
||||
{
|
||||
if ((stat == Statistic.SpecialAttack &&
|
||||
move.Battle.WeatherName == ScriptUtils.ResolveName<Weather.HarshSunlight>()) ||
|
||||
move.Battle.WeatherName == ScriptUtils.ResolveName<Weather.DesolateLands>())
|
||||
{
|
||||
value = value.MultiplyOrMax(1.5f);
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user