Move all battle state from IPokemon to an ephemeral IBattlePokemon wrapper
This commit is contained in:
@@ -4,19 +4,18 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Side;
|
||||
public class StealthRockEffect : Script, IScriptOnSwitchIn, IAIInfoScriptExpectedEntryDamage
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void OnSwitchIn(IPokemon pokemon, byte position)
|
||||
public void OnSwitchIn(IBattlePokemon pokemon, byte position)
|
||||
{
|
||||
var damage = CalculateStealthRockDamage(pokemon);
|
||||
EventBatchId batchId = new();
|
||||
pokemon.Damage(damage, DamageSource.Misc, batchId);
|
||||
pokemon.BattleData?.Battle.EventHook.Invoke(new DialogEvent("stealth_rock_damage",
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{ "pokemon", pokemon },
|
||||
}));
|
||||
pokemon.Battle.EventHook.Invoke(new DialogEvent("stealth_rock_damage", new Dictionary<string, object>
|
||||
{
|
||||
{ "pokemon", pokemon },
|
||||
}));
|
||||
}
|
||||
|
||||
private static uint CalculateStealthRockDamage(IPokemon pokemon)
|
||||
private static uint CalculateStealthRockDamage(IBattlePokemon pokemon)
|
||||
{
|
||||
var typeLibrary = pokemon.Library.StaticLibrary.Types;
|
||||
var effectiveness = 1.0f;
|
||||
@@ -28,7 +27,7 @@ public class StealthRockEffect : Script, IScriptOnSwitchIn, IAIInfoScriptExpecte
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void ExpectedEntryDamage(IPokemon pokemon, ref uint damage)
|
||||
public void ExpectedEntryDamage(IBattlePokemon pokemon, ref uint damage)
|
||||
{
|
||||
damage += CalculateStealthRockDamage(pokemon);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user