Move all battle state from IPokemon to an ephemeral IBattlePokemon wrapper
This commit is contained in:
@@ -8,9 +8,9 @@ public class ProtectionScript : Script, IScriptOnSecondaryEffect
|
||||
protected virtual Script GetEffectScript() => new ProtectionEffectScript();
|
||||
|
||||
/// <inheritdoc />
|
||||
public virtual void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
public virtual void OnSecondaryEffect(IExecutingMove move, IBattlePokemon target, byte hit)
|
||||
{
|
||||
var battleData = target.BattleData;
|
||||
var battleData = target;
|
||||
if (battleData == null)
|
||||
return;
|
||||
// If the user goes last in the turn, the move will fail
|
||||
@@ -30,7 +30,7 @@ public class ProtectionScript : Script, IScriptOnSecondaryEffect
|
||||
var successive = failure.ProtectTurns;
|
||||
// Each time, the chance of success is divided by 3.
|
||||
var chance = 1.0 / Math.Pow(3, successive);
|
||||
var random = target.BattleData!.Battle.Random.GetFloat();
|
||||
var random = target.Battle.Random.GetFloat();
|
||||
if (random < chance)
|
||||
{
|
||||
failure.ProtectTurns++;
|
||||
|
||||
Reference in New Issue
Block a user