More abilities, refactor IPokemon.SetStatus to pass pokemon that caused the status change
All checks were successful
Build / Build (push) Successful in 50s
All checks were successful
Build / Build (push) Successful in 50s
This commit is contained in:
19
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/Synchronize.cs
Normal file
19
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/Synchronize.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
|
||||
/// <summary>
|
||||
/// Synchronize is an ability that passes major status conditions to the foe that inflicted them.
|
||||
///
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Synchronize_(Ability)">Bulbapedia - Synchronize</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "synchronize")]
|
||||
public class Synchronize : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnAfterStatusChange(IPokemon pokemon, StringKey status, IPokemon? originPokemon)
|
||||
{
|
||||
if (originPokemon == null || pokemon == originPokemon)
|
||||
return;
|
||||
pokemon.BattleData?.Battle.EventHook.Invoke(new AbilityTriggerEvent(pokemon));
|
||||
originPokemon.SetStatus(status, pokemon);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user