Getting started with implementing an explicit AI, based on the Essentials one.
All checks were successful
Build / Build (push) Successful in 1m2s
All checks were successful
Build / Build (push) Successful in 1m2s
This commit is contained in:
@@ -6,7 +6,8 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Solar_Power_(Ability)">Bulbapedia - Solar Power</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "solar_power")]
|
||||
public class SolarPower : Script, IScriptChangeOffensiveStatValue, IScriptOnEndTurn
|
||||
public class SolarPower : Script, IScriptChangeOffensiveStatValue, IScriptOnEndTurn,
|
||||
IAIInfoScriptExpectedEndOfTurnDamage
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void ChangeOffensiveStatValue(IExecutingMove move, IPokemon target, byte hit, uint defensiveStat,
|
||||
@@ -29,6 +30,26 @@ public class SolarPower : Script, IScriptChangeOffensiveStatValue, IScriptOnEndT
|
||||
if (!pokemon.IsUsable)
|
||||
return;
|
||||
|
||||
var weatherName = pokemon.BattleData?.Battle.WeatherName;
|
||||
if (weatherName != ScriptUtils.ResolveName<Weather.HarshSunlight>() &&
|
||||
weatherName != ScriptUtils.ResolveName<Weather.DesolateLands>())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
pokemon.Damage(pokemon.MaxHealth / 8, DamageSource.Weather);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void ExpectedEndOfTurnDamage(IPokemon pokemon, ref int damage)
|
||||
{
|
||||
var weatherName = pokemon.BattleData?.Battle.WeatherName;
|
||||
if (weatherName != ScriptUtils.ResolveName<Weather.HarshSunlight>() &&
|
||||
weatherName != ScriptUtils.ResolveName<Weather.DesolateLands>())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
damage += (int)(pokemon.MaxHealth / 8f);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user