Further work on the script interface rework
This commit is contained in:
parent
1feb27e826
commit
4499927551
@ -220,8 +220,10 @@ public static class MoveTurnExecutor
|
|||||||
}
|
}
|
||||||
|
|
||||||
var blockIncomingHit = false;
|
var blockIncomingHit = false;
|
||||||
target.RunScriptHook(x => x.BlockIncomingHit(executingMove, target, hitIndex, ref blockIncomingHit));
|
target.RunScriptHookInterface<IScriptBlockIncomingHit>(x =>
|
||||||
executingMove.RunScriptHook(x => x.BlockOutgoingHit(executingMove, target, hitIndex, ref blockIncomingHit));
|
x.BlockIncomingHit(executingMove, target, hitIndex, ref blockIncomingHit));
|
||||||
|
executingMove.RunScriptHookInterface<IScriptBlockOutgoingHit>(x =>
|
||||||
|
x.BlockOutgoingHit(executingMove, target, hitIndex, ref blockIncomingHit));
|
||||||
if (blockIncomingHit)
|
if (blockIncomingHit)
|
||||||
break;
|
break;
|
||||||
if (executingMove.GetHitData(target, hitIndex).HasFailed)
|
if (executingMove.GetHitData(target, hitIndex).HasFailed)
|
||||||
|
@ -111,7 +111,8 @@ public static class TurnRunner
|
|||||||
if (battleData == null)
|
if (battleData == null)
|
||||||
return;
|
return;
|
||||||
var preventSwitch = false;
|
var preventSwitch = false;
|
||||||
fleeChoice.RunScriptHook(script => script.PreventSelfSwitch(fleeChoice, ref preventSwitch));
|
fleeChoice.RunScriptHookInterface<IScriptPreventSelfSwitch>(script =>
|
||||||
|
script.PreventSelfSwitch(fleeChoice, ref preventSwitch));
|
||||||
if (preventSwitch)
|
if (preventSwitch)
|
||||||
return;
|
return;
|
||||||
foreach (var side in battle.Sides)
|
foreach (var side in battle.Sides)
|
||||||
@ -120,7 +121,8 @@ public static class TurnRunner
|
|||||||
continue;
|
continue;
|
||||||
foreach (var pokemon in side.Pokemon.WhereNotNull())
|
foreach (var pokemon in side.Pokemon.WhereNotNull())
|
||||||
{
|
{
|
||||||
pokemon.RunScriptHook(script => script.PreventOpponentSwitch(fleeChoice, ref preventSwitch));
|
pokemon.RunScriptHookInterface<IScriptPreventOpponentSwitch>(script =>
|
||||||
|
script.PreventOpponentSwitch(fleeChoice, ref preventSwitch));
|
||||||
if (preventSwitch)
|
if (preventSwitch)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -140,7 +142,8 @@ public static class TurnRunner
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
var preventFlee = false;
|
var preventFlee = false;
|
||||||
fleeChoice.RunScriptHook(script => script.PreventSelfRunAway(fleeChoice, ref preventFlee));
|
fleeChoice.RunScriptHookInterface<IScriptPreventSelfRunAway>(script =>
|
||||||
|
script.PreventSelfRunAway(fleeChoice, ref preventFlee));
|
||||||
if (preventFlee)
|
if (preventFlee)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -150,7 +153,8 @@ public static class TurnRunner
|
|||||||
continue;
|
continue;
|
||||||
foreach (var pokemon in side.Pokemon.WhereNotNull())
|
foreach (var pokemon in side.Pokemon.WhereNotNull())
|
||||||
{
|
{
|
||||||
pokemon.RunScriptHook(script => script.PreventOpponentRunAway(fleeChoice, ref preventFlee));
|
pokemon.RunScriptHookInterface<IScriptPreventOpponentRunAway>(script =>
|
||||||
|
script.PreventOpponentRunAway(fleeChoice, ref preventFlee));
|
||||||
if (preventFlee)
|
if (preventFlee)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -261,7 +261,7 @@ public class BattleSideImpl : ScriptSource, IBattleSide
|
|||||||
var oldPokemon = _pokemon[position];
|
var oldPokemon = _pokemon[position];
|
||||||
if (oldPokemon is not null)
|
if (oldPokemon is not null)
|
||||||
{
|
{
|
||||||
oldPokemon.RunScriptHook(script => script.OnSwitchOut(oldPokemon, position));
|
oldPokemon.RunScriptHookInterface<IScriptOnSwitchOut>(script => script.OnSwitchOut(oldPokemon, position));
|
||||||
oldPokemon.RunScriptHook(script => script.OnRemove());
|
oldPokemon.RunScriptHook(script => script.OnRemove());
|
||||||
oldPokemon.SetOnBattlefield(false);
|
oldPokemon.SetOnBattlefield(false);
|
||||||
}
|
}
|
||||||
@ -272,7 +272,7 @@ public class BattleSideImpl : ScriptSource, IBattleSide
|
|||||||
pokemon.SetOnBattlefield(true);
|
pokemon.SetOnBattlefield(true);
|
||||||
pokemon.SetBattleSidePosition(position);
|
pokemon.SetBattleSidePosition(position);
|
||||||
Battle.EventHook.Invoke(new SwitchEvent(Index, position, pokemon));
|
Battle.EventHook.Invoke(new SwitchEvent(Index, position, pokemon));
|
||||||
pokemon.RunScriptHook(script => script.OnSwitchIn(pokemon, position));
|
pokemon.RunScriptHookInterface<IScriptOnSwitchIn>(script => script.OnSwitchIn(pokemon, position));
|
||||||
|
|
||||||
foreach (var side in Battle.Sides)
|
foreach (var side in Battle.Sides)
|
||||||
{
|
{
|
||||||
@ -286,9 +286,11 @@ public class BattleSideImpl : ScriptSource, IBattleSide
|
|||||||
|
|
||||||
scripts.Clear();
|
scripts.Clear();
|
||||||
opponent.GetOwnScripts(scripts);
|
opponent.GetOwnScripts(scripts);
|
||||||
opponent.RunScriptHook(script => script.OnOpponentSwitchIn(pokemon, position));
|
opponent.RunScriptHookInterface<IScriptOnOpponentSwitchIn>(script =>
|
||||||
|
script.OnOpponentSwitchIn(pokemon, position));
|
||||||
}
|
}
|
||||||
side.RunScriptHook(script => script.OnOpponentSwitchIn(pokemon, position));
|
side.RunScriptHookInterface<IScriptOnOpponentSwitchIn>(script =>
|
||||||
|
script.OnOpponentSwitchIn(pokemon, position));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -861,7 +861,8 @@ public class PokemonImpl : ScriptSource, IPokemon
|
|||||||
if (BattleData != null)
|
if (BattleData != null)
|
||||||
{
|
{
|
||||||
var prevented = false;
|
var prevented = false;
|
||||||
this.RunScriptHook(script => script.PreventHeldItemConsume(this, HeldItem, ref prevented));
|
this.RunScriptHookInterface<IScriptPreventHeldItemConsume>(script =>
|
||||||
|
script.PreventHeldItemConsume(this, HeldItem, ref prevented));
|
||||||
if (prevented)
|
if (prevented)
|
||||||
return false;
|
return false;
|
||||||
BattleData.MarkItemAsConsumed(HeldItem);
|
BattleData.MarkItemAsConsumed(HeldItem);
|
||||||
@ -879,7 +880,7 @@ public class PokemonImpl : ScriptSource, IPokemon
|
|||||||
{
|
{
|
||||||
// TODO: actually consume the item
|
// TODO: actually consume the item
|
||||||
|
|
||||||
this.RunScriptHook(x => x.OnAfterItemConsume(this, item));
|
this.RunScriptHookInterface<IScriptOnAfterItemConsume>(x => x.OnAfterItemConsume(this, item));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
@ -1055,7 +1056,8 @@ public class PokemonImpl : ScriptSource, IPokemon
|
|||||||
if (BattleData is not null && !forceDamage)
|
if (BattleData is not null && !forceDamage)
|
||||||
{
|
{
|
||||||
var dmg = damage;
|
var dmg = damage;
|
||||||
this.RunScriptHook(script => script.ChangeIncomingDamage(this, source, ref dmg));
|
this.RunScriptHookInterface<IScriptChangeIncomingDamage>(script =>
|
||||||
|
script.ChangeIncomingDamage(this, source, ref dmg));
|
||||||
damage = dmg;
|
damage = dmg;
|
||||||
}
|
}
|
||||||
if (damage == 0)
|
if (damage == 0)
|
||||||
@ -1075,7 +1077,8 @@ public class PokemonImpl : ScriptSource, IPokemon
|
|||||||
BatchId = batchId,
|
BatchId = batchId,
|
||||||
});
|
});
|
||||||
// And allow scripts to execute.
|
// And allow scripts to execute.
|
||||||
this.RunScriptHook(script => script.OnDamage(this, source, CurrentHealth, newHealth));
|
this.RunScriptHookInterface<IScriptOnDamage>(script =>
|
||||||
|
script.OnDamage(this, source, CurrentHealth, newHealth));
|
||||||
}
|
}
|
||||||
|
|
||||||
CurrentHealth = newHealth;
|
CurrentHealth = newHealth;
|
||||||
@ -1104,10 +1107,10 @@ public class PokemonImpl : ScriptSource, IPokemon
|
|||||||
BattleData.Battle.EventHook.Invoke(new FaintEvent(this));
|
BattleData.Battle.EventHook.Invoke(new FaintEvent(this));
|
||||||
|
|
||||||
// Allow scripts to trigger based on the faint.
|
// Allow scripts to trigger based on the faint.
|
||||||
this.RunScriptHook(script => script.OnFaint(this, source));
|
this.RunScriptHookInterface<IScriptOnFaint>(script => script.OnFaint(this, source));
|
||||||
foreach (var ally in BattleData.BattleSide.Pokemon.WhereNotNull().Where(x => x != this))
|
foreach (var ally in BattleData.BattleSide.Pokemon.WhereNotNull().Where(x => x != this))
|
||||||
{
|
{
|
||||||
ally.RunScriptHook(script => script.OnAllyFaint(ally, this));
|
ally.RunScriptHookInterface<IScriptOnAllyFaint>(script => script.OnAllyFaint(ally, this));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make sure the OnRemove script is run.
|
// Make sure the OnRemove script is run.
|
||||||
|
@ -39,14 +39,6 @@ public abstract class Script : IDeepCloneable
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public virtual ScriptCategory Category => this.ResolveCategory();
|
public virtual ScriptCategory Category => this.ResolveCategory();
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// This function is ran when a volatile effect is added while that volatile effect already is
|
|
||||||
/// in place. Instead of adding the volatile effect twice, it will execute this function instead.
|
|
||||||
/// </summary>
|
|
||||||
public virtual void Stack()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This function is ran when this script stops being in effect, and is removed from its owner.
|
/// This function is ran when this script stops being in effect, and is removed from its owner.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -61,101 +53,6 @@ public abstract class Script : IDeepCloneable
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// This function prevents the Pokemon it is attached to from being able to switch out.
|
|
||||||
/// </summary>
|
|
||||||
public virtual void PreventSelfSwitch(ISwitchChoice choice, ref bool prevent)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// This function allows the prevention of switching for any opponent.
|
|
||||||
/// </summary>
|
|
||||||
public virtual void PreventOpponentSwitch(ISwitchChoice choice, ref bool prevent)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// This function is called on a move and its parents when the move fails.
|
|
||||||
/// </summary>
|
|
||||||
public virtual void OnFail(IPokemon pokemon)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// This function is called on a script when an opponent fails.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="pokemon"></param>
|
|
||||||
public virtual void OnOpponentFail(IPokemon pokemon)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// This function allows preventing the running away of the Pokemon its attached to
|
|
||||||
/// </summary>
|
|
||||||
public virtual void PreventSelfRunAway(IFleeChoice choice, ref bool prevent)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// This function prevents a Pokemon on another side than where its attached to from running away.
|
|
||||||
/// </summary>
|
|
||||||
public virtual void PreventOpponentRunAway(IFleeChoice choice, ref bool prevent)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// This function is triggered on a Pokemon and its parents when the given Pokemon takes damage.
|
|
||||||
/// </summary>
|
|
||||||
public virtual void OnDamage(IPokemon pokemon, DamageSource source, uint oldHealth, uint newHealth)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// This function is triggered on a Pokemon and its parents when the given Pokemon faints.
|
|
||||||
/// </summary>
|
|
||||||
public virtual void OnFaint(IPokemon pokemon, DamageSource source)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// This function is triggered on a Pokemon when an ally Pokemon faints.
|
|
||||||
/// </summary>
|
|
||||||
public virtual void OnAllyFaint(IPokemon ally, IPokemon faintedPokemon)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// This function is triggered on a Pokemon and its parents when the given Pokemon switches out
|
|
||||||
/// of the battlefield.
|
|
||||||
/// </summary>
|
|
||||||
public virtual void OnSwitchOut(IPokemon oldPokemon, byte position)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// This function is triggered on a Pokemon and its parents when the given Pokemon is switched into
|
|
||||||
/// the battlefield.
|
|
||||||
/// </summary>
|
|
||||||
public virtual void OnSwitchIn(IPokemon pokemon, byte position)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// This function is triggered on a Pokemon and its parents when an opponent switches in.
|
|
||||||
/// </summary>
|
|
||||||
public virtual void OnOpponentSwitchIn(IPokemon pokemon, byte position)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// This function is triggered on a Pokemon and its parents when the given Pokemon consumes the
|
|
||||||
/// held item it had.
|
|
||||||
/// </summary>
|
|
||||||
public virtual void OnAfterItemConsume(IPokemon pokemon, IItem item)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This function is triggered on a Pokemon and its parents when the given Pokemon gains experience,
|
/// This function is triggered on a Pokemon and its parents when the given Pokemon gains experience,
|
||||||
/// and allows for changing this amount of experience.
|
/// and allows for changing this amount of experience.
|
||||||
@ -191,20 +88,6 @@ public abstract class Script : IDeepCloneable
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// This function allows a script to block an incoming hit.
|
|
||||||
/// </summary>
|
|
||||||
public virtual void BlockIncomingHit(IExecutingMove executingMove, IPokemon target, byte hitIndex, ref bool block)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// This function allows a script to block an outgoing hit.
|
|
||||||
/// </summary>
|
|
||||||
public virtual void BlockOutgoingHit(IExecutingMove executingMove, IPokemon target, byte hitIndex, ref bool block)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Custom triggers for scripts. This allows scripts to run custom events that are not part of the
|
/// Custom triggers for scripts. This allows scripts to run custom events that are not part of the
|
||||||
/// standard battle flow.
|
/// standard battle flow.
|
||||||
@ -220,20 +103,6 @@ public abstract class Script : IDeepCloneable
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// This function allows a script to prevent a held item from being consumed.
|
|
||||||
/// </summary>
|
|
||||||
public virtual void PreventHeldItemConsume(IPokemon pokemon, IItem heldItem, ref bool prevented)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// This function allows a script to change any kind of damage that is incoming.
|
|
||||||
/// </summary>
|
|
||||||
public virtual void ChangeIncomingDamage(IPokemon pokemon, DamageSource source, ref uint damage)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This function allows a script to change the accuracy of a move used. The value for accuracy is in percentage.
|
/// This function allows a script to change the accuracy of a move used. The value for accuracy is in percentage.
|
||||||
/// A custom case goes when 255 is returned, in which case the entire accuracy check is skipped, and the move
|
/// A custom case goes when 255 is returned, in which case the entire accuracy check is skipped, and the move
|
||||||
@ -1054,3 +923,183 @@ public interface IScriptOnEndTurn
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
void OnEndTurn(IScriptSource owner, IBattle battle);
|
void OnEndTurn(IScriptSource owner, IBattle battle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This interface allows scripts to prevent the Pokemon it is attached to from being able to switch out.
|
||||||
|
/// </summary>
|
||||||
|
public interface IScriptPreventSelfSwitch
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// This function prevents the Pokemon it is attached to from being able to switch out.
|
||||||
|
/// </summary>
|
||||||
|
void PreventSelfSwitch(ISwitchChoice choice, ref bool prevent);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This interface allows scripts to prevent switching for any opponent.
|
||||||
|
/// </summary>
|
||||||
|
public interface IScriptPreventOpponentSwitch
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// This function allows the prevention of switching for any opponent.
|
||||||
|
/// </summary>
|
||||||
|
void PreventOpponentSwitch(ISwitchChoice choice, ref bool prevent);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This interface allows scripts to prevent the Pokemon its attached to from running away.
|
||||||
|
/// </summary>
|
||||||
|
public interface IScriptPreventSelfRunAway
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// This function allows preventing the running away of the Pokemon its attached to
|
||||||
|
/// </summary>
|
||||||
|
void PreventSelfRunAway(IFleeChoice choice, ref bool prevent);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This interface allows scripts to prevent a Pokemon on another side from running away.
|
||||||
|
/// </summary>
|
||||||
|
public interface IScriptPreventOpponentRunAway
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// This function prevents a Pokemon on another side than where its attached to from running away.
|
||||||
|
/// </summary>
|
||||||
|
void PreventOpponentRunAway(IFleeChoice choice, ref bool prevent);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This interface allows scripts to trigger when a Pokemon takes damage.
|
||||||
|
/// </summary>
|
||||||
|
public interface IScriptOnDamage
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// This function is triggered on a Pokemon and its parents when the given Pokemon takes damage.
|
||||||
|
/// </summary>
|
||||||
|
void OnDamage(IPokemon pokemon, DamageSource source, uint oldHealth, uint newHealth);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This interface allows scripts to trigger when a Pokemon faints.
|
||||||
|
/// </summary>
|
||||||
|
public interface IScriptOnFaint
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// This function is triggered on a Pokemon and its parents when the given Pokemon faints.
|
||||||
|
/// </summary>
|
||||||
|
void OnFaint(IPokemon pokemon, DamageSource source);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This interface allows scripts to trigger when an ally Pokemon faints.
|
||||||
|
/// </summary>
|
||||||
|
public interface IScriptOnAllyFaint
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// This function is triggered on a Pokemon when an ally Pokemon faints.
|
||||||
|
/// </summary>
|
||||||
|
void OnAllyFaint(IPokemon ally, IPokemon faintedPokemon);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This interface allows scripts to trigger when a Pokemon switches out of the battlefield.
|
||||||
|
/// </summary>
|
||||||
|
public interface IScriptOnSwitchOut
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// This function is triggered on a Pokemon and its parents when the given Pokemon switches out
|
||||||
|
/// of the battlefield.
|
||||||
|
/// </summary>
|
||||||
|
void OnSwitchOut(IPokemon oldPokemon, byte position);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This interface allows scripts to trigger when a Pokemon is switched into the battlefield.
|
||||||
|
/// </summary>
|
||||||
|
public interface IScriptOnSwitchIn
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// This function is triggered on a Pokemon and its parents when the given Pokemon is switched into
|
||||||
|
/// the battlefield.
|
||||||
|
/// </summary>
|
||||||
|
void OnSwitchIn(IPokemon pokemon, byte position);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This interface allows scripts to trigger when an opponent Pokemon switches in.
|
||||||
|
/// </summary>
|
||||||
|
public interface IScriptOnOpponentSwitchIn
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// This function is triggered on a Pokemon and its parents when an opponent switches in.
|
||||||
|
/// </summary>
|
||||||
|
void OnOpponentSwitchIn(IPokemon pokemon, byte position);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This interface allows scripts to stack when a volatile effect is added while already in place.
|
||||||
|
/// </summary>
|
||||||
|
public interface IScriptStack
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// This function is ran when a volatile effect is added while that volatile effect already is
|
||||||
|
/// in place. Instead of adding the volatile effect twice, it will execute this function instead.
|
||||||
|
/// </summary>
|
||||||
|
void Stack();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This interface allows scripts to trigger after a Pokemon consumes an item.
|
||||||
|
/// </summary>
|
||||||
|
public interface IScriptOnAfterItemConsume
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// This function is triggered on a Pokemon and its parents when the given Pokemon consumes the
|
||||||
|
/// held item it had.
|
||||||
|
/// </summary>
|
||||||
|
void OnAfterItemConsume(IPokemon pokemon, IItem item);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This interface allows scripts to block incoming hits on a target.
|
||||||
|
/// </summary>
|
||||||
|
public interface IScriptBlockIncomingHit
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// This function allows a script to block an incoming hit.
|
||||||
|
/// </summary>
|
||||||
|
void BlockIncomingHit(IExecutingMove executingMove, IPokemon target, byte hitIndex, ref bool block);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This interface allows scripts to block outgoing hits from a move.
|
||||||
|
/// </summary>
|
||||||
|
public interface IScriptBlockOutgoingHit
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// This function allows a script to block an outgoing hit.
|
||||||
|
/// </summary>
|
||||||
|
void BlockOutgoingHit(IExecutingMove executingMove, IPokemon target, byte hitIndex, ref bool block);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This interface allows scripts to prevent held item consumption.
|
||||||
|
/// </summary>
|
||||||
|
public interface IScriptPreventHeldItemConsume
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// This function allows a script to prevent a held item from being consumed.
|
||||||
|
/// </summary>
|
||||||
|
void PreventHeldItemConsume(IPokemon pokemon, IItem heldItem, ref bool prevented);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This interface allows scripts to change incoming damage to a Pokemon.
|
||||||
|
/// </summary>
|
||||||
|
public interface IScriptChangeIncomingDamage
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// This function allows a script to change any kind of damage that is incoming.
|
||||||
|
/// </summary>
|
||||||
|
void ChangeIncomingDamage(IPokemon pokemon, DamageSource source, ref uint damage);
|
||||||
|
}
|
@ -116,7 +116,8 @@ public class ScriptSet : IScriptSet
|
|||||||
var existing = _scripts.FirstOrDefault(s => s.Script?.Name == script.Name);
|
var existing = _scripts.FirstOrDefault(s => s.Script?.Name == script.Name);
|
||||||
if (existing != null)
|
if (existing != null)
|
||||||
{
|
{
|
||||||
existing.Script!.Stack();
|
if (existing.Script is IScriptStack stackable)
|
||||||
|
stackable.Stack();
|
||||||
return existing;
|
return existing;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -133,7 +134,8 @@ public class ScriptSet : IScriptSet
|
|||||||
var existing = _scripts.FirstOrDefault(s => s.Script?.Name == scriptKey);
|
var existing = _scripts.FirstOrDefault(s => s.Script?.Name == scriptKey);
|
||||||
if (existing != null)
|
if (existing != null)
|
||||||
{
|
{
|
||||||
existing.Script!.Stack();
|
if (existing.Script is IScriptStack stackable)
|
||||||
|
stackable.Stack();
|
||||||
return existing;
|
return existing;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
|||||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Aftermath_(Ability)">Bulbapedia - Aftermath</see>
|
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Aftermath_(Ability)">Bulbapedia - Aftermath</see>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Script(ScriptCategory.Ability, "aftermath")]
|
[Script(ScriptCategory.Ability, "aftermath")]
|
||||||
public class Aftermath : Script, IScriptOnIncomingHit
|
public class Aftermath : Script, IScriptOnIncomingHit, IScriptOnFaint
|
||||||
{
|
{
|
||||||
private IExecutingMove? _lastAttack;
|
private IExecutingMove? _lastAttack;
|
||||||
|
|
||||||
@ -18,7 +18,7 @@ public class Aftermath : Script, IScriptOnIncomingHit
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void OnFaint(IPokemon pokemon, DamageSource source)
|
public void OnFaint(IPokemon pokemon, DamageSource source)
|
||||||
{
|
{
|
||||||
if (source != DamageSource.MoveDamage)
|
if (source != DamageSource.MoveDamage)
|
||||||
return;
|
return;
|
||||||
|
@ -7,7 +7,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
|||||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Anticipation_(Ability)">Bulbapedia - Anticipation</see>
|
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Anticipation_(Ability)">Bulbapedia - Anticipation</see>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Script(ScriptCategory.Ability, "anticipation")]
|
[Script(ScriptCategory.Ability, "anticipation")]
|
||||||
public class Anticipation : Script
|
public class Anticipation : Script, IScriptOnOpponentSwitchIn
|
||||||
{
|
{
|
||||||
private IPokemon? _owner;
|
private IPokemon? _owner;
|
||||||
|
|
||||||
@ -20,7 +20,7 @@ public class Anticipation : Script
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void OnOpponentSwitchIn(IPokemon pokemon, byte position)
|
public void OnOpponentSwitchIn(IPokemon pokemon, byte position)
|
||||||
{
|
{
|
||||||
if (_owner is null)
|
if (_owner is null)
|
||||||
return;
|
return;
|
||||||
|
@ -7,7 +7,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
|||||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Arena_Trap_(Ability)">Bulbapedia - Arena Trap</see>
|
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Arena_Trap_(Ability)">Bulbapedia - Arena Trap</see>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Script(ScriptCategory.Ability, "arena_trap")]
|
[Script(ScriptCategory.Ability, "arena_trap")]
|
||||||
public class ArenaTrap : Script
|
public class ArenaTrap : Script, IScriptPreventOpponentRunAway, IScriptPreventOpponentSwitch
|
||||||
{
|
{
|
||||||
private IPokemon? _owner;
|
private IPokemon? _owner;
|
||||||
|
|
||||||
@ -20,7 +20,7 @@ public class ArenaTrap : Script
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void PreventOpponentRunAway(IFleeChoice choice, ref bool prevent)
|
public void PreventOpponentRunAway(IFleeChoice choice, ref bool prevent)
|
||||||
{
|
{
|
||||||
if (choice.User.IsFloating)
|
if (choice.User.IsFloating)
|
||||||
return;
|
return;
|
||||||
@ -30,7 +30,7 @@ public class ArenaTrap : Script
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void PreventOpponentSwitch(ISwitchChoice choice, ref bool prevent)
|
public void PreventOpponentSwitch(ISwitchChoice choice, ref bool prevent)
|
||||||
{
|
{
|
||||||
if (choice.User.IsFloating)
|
if (choice.User.IsFloating)
|
||||||
return;
|
return;
|
||||||
|
@ -7,10 +7,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
|||||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Aroma_Veil_(Ability)">Bulbapedia - Aroma Veil</see>
|
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Aroma_Veil_(Ability)">Bulbapedia - Aroma Veil</see>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Script(ScriptCategory.Ability, "aroma_veil")]
|
[Script(ScriptCategory.Ability, "aroma_veil")]
|
||||||
public class AromaVeil : Script
|
public class AromaVeil : Script, IScriptOnSwitchIn, IScriptOnSwitchOut
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void OnSwitchIn(IPokemon pokemon, byte position)
|
public void OnSwitchIn(IPokemon pokemon, byte position)
|
||||||
{
|
{
|
||||||
var side = pokemon.BattleData?.BattleSide;
|
var side = pokemon.BattleData?.BattleSide;
|
||||||
var effect = side?.VolatileScripts.Add(new Side.AromaVeilEffect())?.Script as Side.AromaVeilEffect;
|
var effect = side?.VolatileScripts.Add(new Side.AromaVeilEffect())?.Script as Side.AromaVeilEffect;
|
||||||
@ -18,7 +18,7 @@ public class AromaVeil : Script
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void OnSwitchOut(IPokemon oldPokemon, byte position)
|
public void OnSwitchOut(IPokemon oldPokemon, byte position)
|
||||||
{
|
{
|
||||||
var side = oldPokemon.BattleData?.BattleSide;
|
var side = oldPokemon.BattleData?.BattleSide;
|
||||||
var effect = side?.VolatileScripts.Get<Side.AromaVeilEffect>();
|
var effect = side?.VolatileScripts.Get<Side.AromaVeilEffect>();
|
||||||
|
@ -7,10 +7,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
|||||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Battery_(Ability)">Bulbapedia - Battery</see>
|
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Battery_(Ability)">Bulbapedia - Battery</see>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Script(ScriptCategory.Ability, "battery")]
|
[Script(ScriptCategory.Ability, "battery")]
|
||||||
public class Battery : Script
|
public class Battery : Script, IScriptOnSwitchIn, IScriptOnSwitchOut
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void OnSwitchIn(IPokemon pokemon, byte position)
|
public void OnSwitchIn(IPokemon pokemon, byte position)
|
||||||
{
|
{
|
||||||
var side = pokemon.BattleData?.BattleSide;
|
var side = pokemon.BattleData?.BattleSide;
|
||||||
var effect = side?.VolatileScripts.Add(new Side.BatteryAbilityEffect())?.Script as Side.BatteryAbilityEffect;
|
var effect = side?.VolatileScripts.Add(new Side.BatteryAbilityEffect())?.Script as Side.BatteryAbilityEffect;
|
||||||
@ -18,7 +18,7 @@ public class Battery : Script
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void OnSwitchOut(IPokemon oldPokemon, byte position)
|
public void OnSwitchOut(IPokemon oldPokemon, byte position)
|
||||||
{
|
{
|
||||||
var side = oldPokemon.BattleData?.BattleSide;
|
var side = oldPokemon.BattleData?.BattleSide;
|
||||||
var effect = side?.VolatileScripts.Get<Side.BatteryAbilityEffect>();
|
var effect = side?.VolatileScripts.Get<Side.BatteryAbilityEffect>();
|
||||||
|
@ -7,10 +7,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
|||||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Berserk_(Ability)">Bulbapedia - Berserk</see>
|
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Berserk_(Ability)">Bulbapedia - Berserk</see>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Script(ScriptCategory.Ability, "berserk")]
|
[Script(ScriptCategory.Ability, "berserk")]
|
||||||
public class Berserk : Script
|
public class Berserk : Script, IScriptOnDamage
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void OnDamage(IPokemon pokemon, DamageSource source, uint oldHealth, uint newHealth)
|
public void OnDamage(IPokemon pokemon, DamageSource source, uint oldHealth, uint newHealth)
|
||||||
{
|
{
|
||||||
if (source is not DamageSource.MoveDamage)
|
if (source is not DamageSource.MoveDamage)
|
||||||
return;
|
return;
|
||||||
|
@ -7,10 +7,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
|||||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Cheek_Pouch_(Ability)">Bulbapedia - Cheek Pouch</see>
|
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Cheek_Pouch_(Ability)">Bulbapedia - Cheek Pouch</see>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Script(ScriptCategory.Ability, "cheek_pouch")]
|
[Script(ScriptCategory.Ability, "cheek_pouch")]
|
||||||
public class CheekPouch : Script
|
public class CheekPouch : Script, IScriptOnAfterItemConsume
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void OnAfterItemConsume(IPokemon pokemon, IItem item)
|
public void OnAfterItemConsume(IPokemon pokemon, IItem item)
|
||||||
{
|
{
|
||||||
if (item.Category == ItemCategory.Berry)
|
if (item.Category == ItemCategory.Berry)
|
||||||
{
|
{
|
||||||
|
@ -8,10 +8,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
|||||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Delta_Stream_(Ability)">Bulbapedia - Delta Stream</see>
|
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Delta_Stream_(Ability)">Bulbapedia - Delta Stream</see>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Script(ScriptCategory.Ability, "delta_stream")]
|
[Script(ScriptCategory.Ability, "delta_stream")]
|
||||||
public class DeltaStreamAbility : Script
|
public class DeltaStreamAbility : Script, IScriptOnSwitchIn
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void OnSwitchIn(IPokemon pokemon, byte position)
|
public void OnSwitchIn(IPokemon pokemon, byte position)
|
||||||
{
|
{
|
||||||
var battle = pokemon.BattleData?.Battle;
|
var battle = pokemon.BattleData?.Battle;
|
||||||
if (battle == null)
|
if (battle == null)
|
||||||
|
@ -8,10 +8,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
|||||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Desolate_Land_(Ability)">Bulbapedia - Desolate Land</see>
|
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Desolate_Land_(Ability)">Bulbapedia - Desolate Land</see>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Script(ScriptCategory.Ability, "desolate_land")]
|
[Script(ScriptCategory.Ability, "desolate_land")]
|
||||||
public class DesolateLandAbility : Script
|
public class DesolateLandAbility : Script, IScriptOnSwitchIn
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void OnSwitchIn(IPokemon pokemon, byte position)
|
public void OnSwitchIn(IPokemon pokemon, byte position)
|
||||||
{
|
{
|
||||||
var battle = pokemon.BattleData?.Battle;
|
var battle = pokemon.BattleData?.Battle;
|
||||||
if (battle == null)
|
if (battle == null)
|
||||||
|
@ -10,10 +10,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
|||||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Disguise_(Ability)">Bulbapedia - Disguise</see>
|
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Disguise_(Ability)">Bulbapedia - Disguise</see>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Script(ScriptCategory.Ability, "disguise")]
|
[Script(ScriptCategory.Ability, "disguise")]
|
||||||
public class Disguise : Script
|
public class Disguise : Script, IScriptChangeIncomingDamage
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void ChangeIncomingDamage(IPokemon pokemon, DamageSource source, ref uint damage)
|
public void ChangeIncomingDamage(IPokemon pokemon, DamageSource source, ref uint damage)
|
||||||
{
|
{
|
||||||
if (pokemon.BattleData == null)
|
if (pokemon.BattleData == null)
|
||||||
return;
|
return;
|
||||||
|
@ -8,10 +8,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
|||||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Download_(Ability)">Bulbapedia - Download</see>
|
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Download_(Ability)">Bulbapedia - Download</see>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Script(ScriptCategory.Ability, "download")]
|
[Script(ScriptCategory.Ability, "download")]
|
||||||
public class Download : Script
|
public class Download : Script, IScriptOnSwitchIn
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void OnSwitchIn(IPokemon pokemon, byte position)
|
public void OnSwitchIn(IPokemon pokemon, byte position)
|
||||||
{
|
{
|
||||||
var battleData = pokemon.BattleData;
|
var battleData = pokemon.BattleData;
|
||||||
if (battleData == null)
|
if (battleData == null)
|
||||||
|
@ -8,10 +8,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
|||||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Drizzle_(Ability)">Bulbapedia - Drizzle</see>
|
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Drizzle_(Ability)">Bulbapedia - Drizzle</see>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Script(ScriptCategory.Ability, "drizzle")]
|
[Script(ScriptCategory.Ability, "drizzle")]
|
||||||
public class Drizzle : Script
|
public class Drizzle : Script, IScriptOnSwitchIn
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void OnSwitchIn(IPokemon pokemon, byte position)
|
public void OnSwitchIn(IPokemon pokemon, byte position)
|
||||||
{
|
{
|
||||||
var battleData = pokemon.BattleData;
|
var battleData = pokemon.BattleData;
|
||||||
if (battleData == null)
|
if (battleData == null)
|
||||||
|
@ -8,10 +8,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
|||||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Drought_(Ability)">Bulbapedia - Drought</see>
|
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Drought_(Ability)">Bulbapedia - Drought</see>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Script(ScriptCategory.Ability, "drought")]
|
[Script(ScriptCategory.Ability, "drought")]
|
||||||
public class Drought : Script
|
public class Drought : Script, IScriptOnSwitchIn
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void OnSwitchIn(IPokemon pokemon, byte position)
|
public void OnSwitchIn(IPokemon pokemon, byte position)
|
||||||
{
|
{
|
||||||
var battleData = pokemon.BattleData;
|
var battleData = pokemon.BattleData;
|
||||||
if (battleData == null)
|
if (battleData == null)
|
||||||
|
@ -8,10 +8,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
|||||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Electric_Surge_(Ability)">Bulbapedia - Electric Surge</see>
|
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Electric_Surge_(Ability)">Bulbapedia - Electric Surge</see>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Script(ScriptCategory.Ability, "electric_surge")]
|
[Script(ScriptCategory.Ability, "electric_surge")]
|
||||||
public class ElectricSurge : Script
|
public class ElectricSurge : Script, IScriptOnSwitchIn
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void OnSwitchIn(IPokemon pokemon, byte position)
|
public void OnSwitchIn(IPokemon pokemon, byte position)
|
||||||
{
|
{
|
||||||
var battleData = pokemon.BattleData;
|
var battleData = pokemon.BattleData;
|
||||||
if (battleData == null)
|
if (battleData == null)
|
||||||
|
@ -7,10 +7,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
|||||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Emergency_Exit_(Ability)">Bulbapedia - Emergency Exit</see>
|
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Emergency_Exit_(Ability)">Bulbapedia - Emergency Exit</see>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Script(ScriptCategory.Ability, "emergency_exit")]
|
[Script(ScriptCategory.Ability, "emergency_exit")]
|
||||||
public class EmergencyExit : Script
|
public class EmergencyExit : Script, IScriptOnDamage
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void OnDamage(IPokemon pokemon, DamageSource source, uint oldHealth, uint newHealth)
|
public void OnDamage(IPokemon pokemon, DamageSource source, uint oldHealth, uint newHealth)
|
||||||
{
|
{
|
||||||
if (pokemon.BattleData is null)
|
if (pokemon.BattleData is null)
|
||||||
return;
|
return;
|
||||||
|
@ -7,7 +7,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
|||||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Forecast_(Ability)">Bulbapedia - Forecast</see>
|
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Forecast_(Ability)">Bulbapedia - Forecast</see>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Script(ScriptCategory.Ability, "forecast")]
|
[Script(ScriptCategory.Ability, "forecast")]
|
||||||
public class Forecast : Script
|
public class Forecast : Script, IScriptOnSwitchIn
|
||||||
{
|
{
|
||||||
private IPokemon? _pokemon;
|
private IPokemon? _pokemon;
|
||||||
|
|
||||||
@ -20,7 +20,7 @@ public class Forecast : Script
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void OnSwitchIn(IPokemon pokemon, byte position)
|
public void OnSwitchIn(IPokemon pokemon, byte position)
|
||||||
{
|
{
|
||||||
ChangeForm(pokemon, pokemon.BattleData?.Battle.WeatherName);
|
ChangeForm(pokemon, pokemon.BattleData?.Battle.WeatherName);
|
||||||
}
|
}
|
||||||
|
@ -9,10 +9,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
|||||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Forewarn_(Ability)">Bulbapedia - Forewarn</see>
|
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Forewarn_(Ability)">Bulbapedia - Forewarn</see>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Script(ScriptCategory.Ability, "forewarn")]
|
[Script(ScriptCategory.Ability, "forewarn")]
|
||||||
public class Forewarn : Script
|
public class Forewarn : Script, IScriptOnSwitchIn
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void OnSwitchIn(IPokemon pokemon, byte position)
|
public void OnSwitchIn(IPokemon pokemon, byte position)
|
||||||
{
|
{
|
||||||
var battleData = pokemon.BattleData;
|
var battleData = pokemon.BattleData;
|
||||||
if (battleData == null)
|
if (battleData == null)
|
||||||
|
@ -7,10 +7,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
|||||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Frisk_(Ability)">Bulbapedia - Frisk</see>
|
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Frisk_(Ability)">Bulbapedia - Frisk</see>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Script(ScriptCategory.Ability, "frisk")]
|
[Script(ScriptCategory.Ability, "frisk")]
|
||||||
public class Frisk : Script
|
public class Frisk : Script, IScriptOnSwitchIn
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void OnSwitchIn(IPokemon pokemon, byte position)
|
public void OnSwitchIn(IPokemon pokemon, byte position)
|
||||||
{
|
{
|
||||||
if (pokemon.BattleData?.BattleSide is null)
|
if (pokemon.BattleData?.BattleSide is null)
|
||||||
return;
|
return;
|
||||||
|
@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
|||||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Gluttony_(Ability)">Bulbapedia - Gluttony</see>
|
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Gluttony_(Ability)">Bulbapedia - Gluttony</see>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Script(ScriptCategory.Ability, "gluttony")]
|
[Script(ScriptCategory.Ability, "gluttony")]
|
||||||
public class Gluttony : Script
|
public class Gluttony : Script, IScriptOnDamage
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void OnDamage(IPokemon pokemon, DamageSource source, uint oldHealth, uint newHealth)
|
public void OnDamage(IPokemon pokemon, DamageSource source, uint oldHealth, uint newHealth)
|
||||||
{
|
{
|
||||||
if (pokemon.BattleData is null)
|
if (pokemon.BattleData is null)
|
||||||
return;
|
return;
|
||||||
|
@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
|||||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Grassy_Surge_(Ability)">Bulbapedia - Grassy Surge</see>
|
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Grassy_Surge_(Ability)">Bulbapedia - Grassy Surge</see>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Script(ScriptCategory.Ability, "grassy_surge")]
|
[Script(ScriptCategory.Ability, "grassy_surge")]
|
||||||
public class GrassySurge : Script
|
public class GrassySurge : Script, IScriptOnSwitchIn
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void OnSwitchIn(IPokemon pokemon, byte position)
|
public void OnSwitchIn(IPokemon pokemon, byte position)
|
||||||
{
|
{
|
||||||
var battleData = pokemon.BattleData;
|
var battleData = pokemon.BattleData;
|
||||||
if (battleData == null)
|
if (battleData == null)
|
||||||
|
@ -6,7 +6,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
|||||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Illusion_(Ability)">Bulbapedia - Illusion</see>
|
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Illusion_(Ability)">Bulbapedia - Illusion</see>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Script(ScriptCategory.Ability, "illusion")]
|
[Script(ScriptCategory.Ability, "illusion")]
|
||||||
public class Illusion : Script, IScriptOnIncomingHit
|
public class Illusion : Script, IScriptOnIncomingHit, IScriptOnSwitchIn
|
||||||
{
|
{
|
||||||
private IPokemon? _pokemon;
|
private IPokemon? _pokemon;
|
||||||
|
|
||||||
@ -19,7 +19,7 @@ public class Illusion : Script, IScriptOnIncomingHit
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void OnSwitchIn(IPokemon pokemon, byte position)
|
public void OnSwitchIn(IPokemon pokemon, byte position)
|
||||||
{
|
{
|
||||||
var battleData = pokemon.BattleData;
|
var battleData = pokemon.BattleData;
|
||||||
if (battleData is null)
|
if (battleData is null)
|
||||||
|
@ -6,7 +6,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
|||||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Innards_Out_(Ability)">Bulbapedia - Innards Out</see>
|
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Innards_Out_(Ability)">Bulbapedia - Innards Out</see>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Script(ScriptCategory.Ability, "innards_out")]
|
[Script(ScriptCategory.Ability, "innards_out")]
|
||||||
public class InnardsOut : Script, IScriptOnIncomingHit
|
public class InnardsOut : Script, IScriptOnIncomingHit, IScriptOnDamage
|
||||||
{
|
{
|
||||||
private IPokemon? _lastPokemonToHit;
|
private IPokemon? _lastPokemonToHit;
|
||||||
|
|
||||||
@ -17,7 +17,7 @@ public class InnardsOut : Script, IScriptOnIncomingHit
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void OnDamage(IPokemon pokemon, DamageSource source, uint oldHealth, uint newHealth)
|
public void OnDamage(IPokemon pokemon, DamageSource source, uint oldHealth, uint newHealth)
|
||||||
{
|
{
|
||||||
if (newHealth != 0 || source is not DamageSource.MoveDamage)
|
if (newHealth != 0 || source is not DamageSource.MoveDamage)
|
||||||
return;
|
return;
|
||||||
|
@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
|||||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Intimidate_(Ability)">Bulbapedia - Intimidate</see>
|
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Intimidate_(Ability)">Bulbapedia - Intimidate</see>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Script(ScriptCategory.Ability, "intimidate")]
|
[Script(ScriptCategory.Ability, "intimidate")]
|
||||||
public class Intimidate : Script
|
public class Intimidate : Script, IScriptOnSwitchIn
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void OnSwitchIn(IPokemon pokemon, byte position)
|
public void OnSwitchIn(IPokemon pokemon, byte position)
|
||||||
{
|
{
|
||||||
var battle = pokemon.BattleData?.Battle;
|
var battle = pokemon.BattleData?.Battle;
|
||||||
if (battle is null)
|
if (battle is null)
|
||||||
|
@ -6,7 +6,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
|||||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Klutz_(Ability)">Bulbapedia - Klutz</see>
|
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Klutz_(Ability)">Bulbapedia - Klutz</see>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Script(ScriptCategory.Ability, "klutz")]
|
[Script(ScriptCategory.Ability, "klutz")]
|
||||||
public class Klutz : Script, IScriptOnBeforeAnyHookInvoked
|
public class Klutz : Script, IScriptOnBeforeAnyHookInvoked, IScriptPreventHeldItemConsume
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public void OnBeforeAnyHookInvoked(ref List<ScriptCategory>? suppressedCategories)
|
public void OnBeforeAnyHookInvoked(ref List<ScriptCategory>? suppressedCategories)
|
||||||
@ -16,7 +16,7 @@ public class Klutz : Script, IScriptOnBeforeAnyHookInvoked
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void PreventHeldItemConsume(IPokemon pokemon, IItem heldItem, ref bool prevented)
|
public void PreventHeldItemConsume(IPokemon pokemon, IItem heldItem, ref bool prevented)
|
||||||
{
|
{
|
||||||
prevented = true;
|
prevented = true;
|
||||||
}
|
}
|
||||||
|
@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
|||||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Magic_Guard_(Ability)">Bulbapedia - Magic Guard</see>
|
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Magic_Guard_(Ability)">Bulbapedia - Magic Guard</see>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Script(ScriptCategory.Ability, "magic_guard")]
|
[Script(ScriptCategory.Ability, "magic_guard")]
|
||||||
public class MagicGuard : Script
|
public class MagicGuard : Script, IScriptChangeIncomingDamage
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void ChangeIncomingDamage(IPokemon pokemon, DamageSource source, ref uint damage)
|
public void ChangeIncomingDamage(IPokemon pokemon, DamageSource source, ref uint damage)
|
||||||
{
|
{
|
||||||
// Magic Guard doesn't work if the Pokémon is not in battle.
|
// Magic Guard doesn't work if the Pokémon is not in battle.
|
||||||
if (pokemon.BattleData is null)
|
if (pokemon.BattleData is null)
|
||||||
|
@ -6,7 +6,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
|||||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Magma_Armor_(Ability)">Bulbapedia - Magma Armor</see>
|
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Magma_Armor_(Ability)">Bulbapedia - Magma Armor</see>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Script(ScriptCategory.Ability, "magma_armor")]
|
[Script(ScriptCategory.Ability, "magma_armor")]
|
||||||
public class MagmaArmor : Script
|
public class MagmaArmor : Script, IScriptOnSwitchIn
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void PreventStatusChange(IPokemon pokemon, StringKey status, bool selfInflicted,
|
public override void PreventStatusChange(IPokemon pokemon, StringKey status, bool selfInflicted,
|
||||||
@ -20,7 +20,7 @@ public class MagmaArmor : Script
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void OnSwitchIn(IPokemon pokemon, byte position)
|
public void OnSwitchIn(IPokemon pokemon, byte position)
|
||||||
{
|
{
|
||||||
if (pokemon.HasStatus(ScriptUtils.ResolveName<Status.Frozen>()))
|
if (pokemon.HasStatus(ScriptUtils.ResolveName<Status.Frozen>()))
|
||||||
{
|
{
|
||||||
|
@ -6,17 +6,17 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
|||||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Magnet_Pull_(Ability)">Bulbapedia - Magnet Pull</see>
|
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Magnet_Pull_(Ability)">Bulbapedia - Magnet Pull</see>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Script(ScriptCategory.Ability, "magnet_pull")]
|
[Script(ScriptCategory.Ability, "magnet_pull")]
|
||||||
public class MagnetPull : Script
|
public class MagnetPull : Script, IScriptPreventOpponentRunAway, IScriptPreventOpponentSwitch
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void PreventOpponentRunAway(IFleeChoice choice, ref bool prevent)
|
public void PreventOpponentRunAway(IFleeChoice choice, ref bool prevent)
|
||||||
{
|
{
|
||||||
if (choice.User.Types.Any(x => x.Name == "steel"))
|
if (choice.User.Types.Any(x => x.Name == "steel"))
|
||||||
prevent = true;
|
prevent = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void PreventOpponentSwitch(ISwitchChoice choice, ref bool prevent)
|
public void PreventOpponentSwitch(ISwitchChoice choice, ref bool prevent)
|
||||||
{
|
{
|
||||||
if (choice.User.Types.Any(x => x.Name == "steel"))
|
if (choice.User.Types.Any(x => x.Name == "steel"))
|
||||||
prevent = true;
|
prevent = true;
|
||||||
|
@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
|||||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Misty_Surge_(Ability)">Bulbapedia - Misty Surge</see>
|
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Misty_Surge_(Ability)">Bulbapedia - Misty Surge</see>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Script(ScriptCategory.Ability, "misty_surge")]
|
[Script(ScriptCategory.Ability, "misty_surge")]
|
||||||
public class MistySurge : Script
|
public class MistySurge : Script, IScriptOnSwitchIn
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void OnSwitchIn(IPokemon pokemon, byte position)
|
public void OnSwitchIn(IPokemon pokemon, byte position)
|
||||||
{
|
{
|
||||||
if (pokemon.BattleData?.Battle is null)
|
if (pokemon.BattleData?.Battle is null)
|
||||||
return;
|
return;
|
||||||
|
@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
|||||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Natural_Cure_(Ability)">Bulbapedia - Natural Cure</see>
|
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Natural_Cure_(Ability)">Bulbapedia - Natural Cure</see>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Script(ScriptCategory.Ability, "natural_cure")]
|
[Script(ScriptCategory.Ability, "natural_cure")]
|
||||||
public class NaturalCure : Script
|
public class NaturalCure : Script, IScriptOnSwitchOut
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void OnSwitchOut(IPokemon oldPokemon, byte position)
|
public void OnSwitchOut(IPokemon oldPokemon, byte position)
|
||||||
{
|
{
|
||||||
if (!oldPokemon.StatusScript.IsEmpty)
|
if (!oldPokemon.StatusScript.IsEmpty)
|
||||||
{
|
{
|
||||||
|
@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
|||||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Power_of_Alchemy_(Ability)">Bulbapedia - Power of Alchemy</see>
|
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Power_of_Alchemy_(Ability)">Bulbapedia - Power of Alchemy</see>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Script(ScriptCategory.Ability, "power_of_alchemy")]
|
[Script(ScriptCategory.Ability, "power_of_alchemy")]
|
||||||
public class PowerOfAlchemy : Script
|
public class PowerOfAlchemy : Script, IScriptOnAllyFaint
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void OnAllyFaint(IPokemon ally, IPokemon faintedPokemon)
|
public void OnAllyFaint(IPokemon ally, IPokemon faintedPokemon)
|
||||||
{
|
{
|
||||||
if (faintedPokemon.ActiveAbility?.HasFlag("cant_be_copied") != true)
|
if (faintedPokemon.ActiveAbility?.HasFlag("cant_be_copied") != true)
|
||||||
return;
|
return;
|
||||||
|
@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
|||||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Primordial_Sea_(Ability)">Bulbapedia - Primordial Sea</see>
|
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Primordial_Sea_(Ability)">Bulbapedia - Primordial Sea</see>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Script(ScriptCategory.Ability, "primordial_sea")]
|
[Script(ScriptCategory.Ability, "primordial_sea")]
|
||||||
public class PrimordialSeaAbility : Script
|
public class PrimordialSeaAbility : Script, IScriptOnSwitchIn
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void OnSwitchIn(IPokemon pokemon, byte position)
|
public void OnSwitchIn(IPokemon pokemon, byte position)
|
||||||
{
|
{
|
||||||
var battle = pokemon.BattleData?.Battle;
|
var battle = pokemon.BattleData?.Battle;
|
||||||
if (battle == null)
|
if (battle == null)
|
||||||
|
@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
|||||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Psychic_Surge_(Ability)">Bulbapedia - Psychic Surge</see>
|
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Psychic_Surge_(Ability)">Bulbapedia - Psychic Surge</see>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Script(ScriptCategory.Ability, "psychic_surge")]
|
[Script(ScriptCategory.Ability, "psychic_surge")]
|
||||||
public class PsychicSurge : Script
|
public class PsychicSurge : Script, IScriptOnSwitchIn
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void OnSwitchIn(IPokemon pokemon, byte position)
|
public void OnSwitchIn(IPokemon pokemon, byte position)
|
||||||
{
|
{
|
||||||
if (pokemon.BattleData?.Battle is null)
|
if (pokemon.BattleData?.Battle is null)
|
||||||
return;
|
return;
|
||||||
|
@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
|||||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Regenerator_(Ability)">Bulbapedia - Regenerator</see>
|
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Regenerator_(Ability)">Bulbapedia - Regenerator</see>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Script(ScriptCategory.Ability, "regenerator")]
|
[Script(ScriptCategory.Ability, "regenerator")]
|
||||||
public class Regenerator : Script
|
public class Regenerator : Script, IScriptOnSwitchOut
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void OnSwitchOut(IPokemon oldPokemon, byte position)
|
public void OnSwitchOut(IPokemon oldPokemon, byte position)
|
||||||
{
|
{
|
||||||
if (!oldPokemon.IsUsable)
|
if (!oldPokemon.IsUsable)
|
||||||
return;
|
return;
|
||||||
|
@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
|||||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Sand_Stream_(Ability)">Bulbapedia - Sand Stream</see>
|
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Sand_Stream_(Ability)">Bulbapedia - Sand Stream</see>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Script(ScriptCategory.Ability, "sand_stream")]
|
[Script(ScriptCategory.Ability, "sand_stream")]
|
||||||
public class SandStream : Script
|
public class SandStream : Script, IScriptOnSwitchIn
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void OnSwitchIn(IPokemon pokemon, byte position)
|
public void OnSwitchIn(IPokemon pokemon, byte position)
|
||||||
{
|
{
|
||||||
var battleData = pokemon.BattleData;
|
var battleData = pokemon.BattleData;
|
||||||
if (battleData == null)
|
if (battleData == null)
|
||||||
|
@ -6,7 +6,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
|||||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Schooling_(Ability)">Bulbapedia - Schooling</see>
|
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Schooling_(Ability)">Bulbapedia - Schooling</see>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Script(ScriptCategory.Ability, "schooling")]
|
[Script(ScriptCategory.Ability, "schooling")]
|
||||||
public class Schooling : Script, IScriptOnEndTurn
|
public class Schooling : Script, IScriptOnEndTurn, IScriptOnSwitchIn
|
||||||
{
|
{
|
||||||
private IPokemon? _owningPokemon;
|
private IPokemon? _owningPokemon;
|
||||||
|
|
||||||
@ -19,7 +19,7 @@ public class Schooling : Script, IScriptOnEndTurn
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void OnSwitchIn(IPokemon pokemon, byte position) => ChangeFormIfNeeded(pokemon);
|
public void OnSwitchIn(IPokemon pokemon, byte position) => ChangeFormIfNeeded(pokemon);
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public void OnEndTurn(IScriptSource owner, IBattle battle) => ChangeFormIfNeeded(_owningPokemon);
|
public void OnEndTurn(IScriptSource owner, IBattle battle) => ChangeFormIfNeeded(_owningPokemon);
|
||||||
|
@ -6,11 +6,11 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
|||||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Shadow_Tag_(Ability)">Bulbapedia - Shadow Tag</see>
|
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Shadow_Tag_(Ability)">Bulbapedia - Shadow Tag</see>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Script(ScriptCategory.Ability, "shadow_tag")]
|
[Script(ScriptCategory.Ability, "shadow_tag")]
|
||||||
public class ShadowTag : Script
|
public class ShadowTag : Script, IScriptPreventOpponentRunAway, IScriptPreventOpponentSwitch
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void PreventOpponentRunAway(IFleeChoice choice, ref bool prevent) => prevent = true;
|
public void PreventOpponentRunAway(IFleeChoice choice, ref bool prevent) => prevent = true;
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void PreventOpponentSwitch(ISwitchChoice choice, ref bool prevent) => prevent = true;
|
public void PreventOpponentSwitch(ISwitchChoice choice, ref bool prevent) => prevent = true;
|
||||||
}
|
}
|
@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
|||||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Shields_Down_(Ability)">Bulbapedia - Shields Down</see>
|
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Shields_Down_(Ability)">Bulbapedia - Shields Down</see>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Script(ScriptCategory.Ability, "shields_down")]
|
[Script(ScriptCategory.Ability, "shields_down")]
|
||||||
public class ShieldsDown : Script, IScriptOnEndTurn
|
public class ShieldsDown : Script, IScriptOnEndTurn, IScriptOnSwitchIn
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void OnSwitchIn(IPokemon pokemon, byte position) => ChangeFormIfNeeded(pokemon);
|
public void OnSwitchIn(IPokemon pokemon, byte position) => ChangeFormIfNeeded(pokemon);
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public void OnEndTurn(IScriptSource owner, IBattle battle) => ChangeFormIfNeeded(owner as IPokemon);
|
public void OnEndTurn(IScriptSource owner, IBattle battle) => ChangeFormIfNeeded(owner as IPokemon);
|
||||||
|
@ -8,12 +8,12 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
|||||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Slow_Start_(Ability)">Bulbapedia - Slow Start</see>
|
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Slow_Start_(Ability)">Bulbapedia - Slow Start</see>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Script(ScriptCategory.Ability, "slow_start")]
|
[Script(ScriptCategory.Ability, "slow_start")]
|
||||||
public class SlowStart : Script
|
public class SlowStart : Script, IScriptOnSwitchIn
|
||||||
{
|
{
|
||||||
private IPokemon? _pokemon;
|
private IPokemon? _pokemon;
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void OnSwitchIn(IPokemon pokemon, byte position)
|
public void OnSwitchIn(IPokemon pokemon, byte position)
|
||||||
{
|
{
|
||||||
_pokemon = pokemon;
|
_pokemon = pokemon;
|
||||||
pokemon.Volatile.Add(new SlowStartEffect());
|
pokemon.Volatile.Add(new SlowStartEffect());
|
||||||
|
@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
|||||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Snow_Warning_(Ability)">Bulbapedia - Snow Warning</see>
|
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Snow_Warning_(Ability)">Bulbapedia - Snow Warning</see>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Script(ScriptCategory.Ability, "snow_warning")]
|
[Script(ScriptCategory.Ability, "snow_warning")]
|
||||||
public class SnowWarning : Script
|
public class SnowWarning : Script, IScriptOnSwitchIn
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void OnSwitchIn(IPokemon pokemon, byte position)
|
public void OnSwitchIn(IPokemon pokemon, byte position)
|
||||||
{
|
{
|
||||||
var battleData = pokemon.BattleData;
|
var battleData = pokemon.BattleData;
|
||||||
if (battleData == null)
|
if (battleData == null)
|
||||||
|
@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
|||||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Soul-Heart_(Ability)">Bulbapedia - Soul-Heart</see>
|
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Soul-Heart_(Ability)">Bulbapedia - Soul-Heart</see>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Script(ScriptCategory.Ability, "soul_heart")]
|
[Script(ScriptCategory.Ability, "soul_heart")]
|
||||||
public class SoulHeart : Script, IScriptOnOpponentFaints
|
public class SoulHeart : Script, IScriptOnOpponentFaints, IScriptOnAllyFaint
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void OnAllyFaint(IPokemon ally, IPokemon faintedPokemon)
|
public void OnAllyFaint(IPokemon ally, IPokemon faintedPokemon)
|
||||||
{
|
{
|
||||||
ally.ChangeStatBoost(Statistic.SpecialAttack, 1, true, false);
|
ally.ChangeStatBoost(Statistic.SpecialAttack, 1, true, false);
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
|||||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Air_Lock_(Ability)">Bulbapedia - Air Lock</see>
|
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Air_Lock_(Ability)">Bulbapedia - Air Lock</see>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Script(ScriptCategory.Ability, "suppress_weather")]
|
[Script(ScriptCategory.Ability, "suppress_weather")]
|
||||||
public class SuppressWeatherAbility : Script, IScriptOnBeforeAnyHookInvoked
|
public class SuppressWeatherAbility : Script, IScriptOnBeforeAnyHookInvoked, IScriptOnSwitchIn
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public void OnBeforeAnyHookInvoked(ref List<ScriptCategory>? suppressedCategories)
|
public void OnBeforeAnyHookInvoked(ref List<ScriptCategory>? suppressedCategories)
|
||||||
@ -19,7 +19,7 @@ public class SuppressWeatherAbility : Script, IScriptOnBeforeAnyHookInvoked
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void OnSwitchIn(IPokemon pokemon, byte position)
|
public void OnSwitchIn(IPokemon pokemon, byte position)
|
||||||
{
|
{
|
||||||
pokemon.BattleData?.Battle.EventHook.Invoke(new AbilityTriggerEvent(pokemon));
|
pokemon.BattleData?.Battle.EventHook.Invoke(new AbilityTriggerEvent(pokemon));
|
||||||
}
|
}
|
||||||
|
@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
|||||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Wonder_Guard_(Ability)">Bulbapedia - Wonder Guard</see>
|
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Wonder_Guard_(Ability)">Bulbapedia - Wonder Guard</see>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Script(ScriptCategory.Ability, "wonder_guard")]
|
[Script(ScriptCategory.Ability, "wonder_guard")]
|
||||||
public class WonderGuard : Script
|
public class WonderGuard : Script, IScriptBlockIncomingHit
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void BlockIncomingHit(IExecutingMove executingMove, IPokemon target, byte hitIndex, ref bool block)
|
public void BlockIncomingHit(IExecutingMove executingMove, IPokemon target, byte hitIndex, ref bool block)
|
||||||
{
|
{
|
||||||
var effectiveness = executingMove.GetHitData(target, hitIndex).Effectiveness;
|
var effectiveness = executingMove.GetHitData(target, hitIndex).Effectiveness;
|
||||||
if (!(effectiveness <= 1.0))
|
if (!(effectiveness <= 1.0))
|
||||||
|
@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
|||||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Zen_Mode_(Ability)">Bulbapedia - Zen Mode</see>
|
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Zen_Mode_(Ability)">Bulbapedia - Zen Mode</see>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Script(ScriptCategory.Ability, "zen_mode")]
|
[Script(ScriptCategory.Ability, "zen_mode")]
|
||||||
public class ZenMode : Script, IScriptOnEndTurn
|
public class ZenMode : Script, IScriptOnEndTurn, IScriptOnSwitchIn
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void OnSwitchIn(IPokemon pokemon, byte position) => ChangeFormIfNeeded(pokemon);
|
public void OnSwitchIn(IPokemon pokemon, byte position) => ChangeFormIfNeeded(pokemon);
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public void OnEndTurn(IScriptSource owner, IBattle battle) => ChangeFormIfNeeded(owner as IPokemon);
|
public void OnEndTurn(IScriptSource owner, IBattle battle) => ChangeFormIfNeeded(owner as IPokemon);
|
||||||
|
@ -1,18 +1,18 @@
|
|||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Battle;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Battle;
|
||||||
|
|
||||||
[Script(ScriptCategory.Battle, "fairy_lock")]
|
[Script(ScriptCategory.Battle, "fairy_lock")]
|
||||||
public class FairyLockEffect : Script, IScriptOnEndTurn
|
public class FairyLockEffect : Script, IScriptOnEndTurn, IScriptPreventSelfRunAway, IScriptPreventSelfSwitch
|
||||||
{
|
{
|
||||||
private int _turns = 1;
|
private int _turns = 1;
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void PreventSelfRunAway(IFleeChoice choice, ref bool prevent)
|
public void PreventSelfRunAway(IFleeChoice choice, ref bool prevent)
|
||||||
{
|
{
|
||||||
prevent = true;
|
prevent = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void PreventSelfSwitch(ISwitchChoice choice, ref bool prevent)
|
public void PreventSelfSwitch(ISwitchChoice choice, ref bool prevent)
|
||||||
{
|
{
|
||||||
prevent = true;
|
prevent = true;
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Battle;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Battle;
|
||||||
|
|
||||||
[Script(ScriptCategory.Battle, "magic_room")]
|
[Script(ScriptCategory.Battle, "magic_room")]
|
||||||
public class MagicRoomEffect : Script, IScriptOnBeforeAnyHookInvoked, IScriptOnEndTurn
|
public class MagicRoomEffect : Script, IScriptOnBeforeAnyHookInvoked, IScriptOnEndTurn, IScriptPreventHeldItemConsume
|
||||||
{
|
{
|
||||||
private int _turnsLeft = 5;
|
private int _turnsLeft = 5;
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void PreventHeldItemConsume(IPokemon pokemon, IItem heldItem, ref bool prevented)
|
public void PreventHeldItemConsume(IPokemon pokemon, IItem heldItem, ref bool prevented)
|
||||||
{
|
{
|
||||||
prevented = true;
|
prevented = true;
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Battle;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Battle;
|
||||||
|
|
||||||
[Script(ScriptCategory.Battle, "water_sport")]
|
[Script(ScriptCategory.Battle, "water_sport")]
|
||||||
public class WaterSportEffect : Script, IScriptChangeMoveDamage
|
public class WaterSportEffect : Script, IScriptChangeMoveDamage, IScriptOnSwitchOut
|
||||||
{
|
{
|
||||||
public readonly HashSet<IPokemon> Placers = new();
|
public readonly HashSet<IPokemon> Placers = new();
|
||||||
|
|
||||||
@ -15,7 +15,7 @@ public class WaterSportEffect : Script, IScriptChangeMoveDamage
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void OnSwitchOut(IPokemon oldPokemon, byte position)
|
public void OnSwitchOut(IPokemon oldPokemon, byte position)
|
||||||
{
|
{
|
||||||
if (!Placers.Contains(oldPokemon))
|
if (!Placers.Contains(oldPokemon))
|
||||||
return;
|
return;
|
||||||
|
@ -3,10 +3,10 @@ using PkmnLib.Plugin.Gen7.Scripts.Side;
|
|||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
|
||||||
[Script(ScriptCategory.Move, "doom_desire")]
|
[Script(ScriptCategory.Move, "doom_desire")]
|
||||||
public class DoomDesire : Script
|
public class DoomDesire : Script, IScriptBlockOutgoingHit
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void BlockOutgoingHit(IExecutingMove executingMove, IPokemon target, byte hitIndex, ref bool block)
|
public void BlockOutgoingHit(IExecutingMove executingMove, IPokemon target, byte hitIndex, ref bool block)
|
||||||
{
|
{
|
||||||
var battleData = target.BattleData;
|
var battleData = target.BattleData;
|
||||||
if (battleData == null)
|
if (battleData == null)
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
|
||||||
[Script(ScriptCategory.Move, "dream_eater")]
|
[Script(ScriptCategory.Move, "dream_eater")]
|
||||||
public class DreamEater : Script, IScriptOnSecondaryEffect
|
public class DreamEater : Script, IScriptOnSecondaryEffect, IScriptBlockOutgoingHit
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void BlockOutgoingHit(IExecutingMove executingMove, IPokemon target, byte hitIndex, ref bool block)
|
public void BlockOutgoingHit(IExecutingMove executingMove, IPokemon target, byte hitIndex, ref bool block)
|
||||||
{
|
{
|
||||||
if (!target.HasStatus("asleep"))
|
if (!target.HasStatus("asleep"))
|
||||||
block = true;
|
block = true;
|
||||||
|
@ -4,7 +4,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
|||||||
public class KingsShield : ProtectionScript
|
public class KingsShield : ProtectionScript
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||||
{
|
{
|
||||||
base.OnSecondaryEffect(move, target, hit);
|
base.OnSecondaryEffect(move, target, hit);
|
||||||
// Default form is shield form
|
// Default form is shield form
|
||||||
|
@ -8,7 +8,7 @@ public class ProtectionScript : Script, IScriptOnSecondaryEffect
|
|||||||
protected virtual Script GetEffectScript() => new ProtectionEffectScript();
|
protected virtual Script GetEffectScript() => new ProtectionEffectScript();
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
public virtual void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||||
{
|
{
|
||||||
var battleData = target.BattleData;
|
var battleData = target.BattleData;
|
||||||
if (battleData == null)
|
if (battleData == null)
|
||||||
|
@ -3,12 +3,12 @@ using PkmnLib.Plugin.Gen7.Scripts.Utils;
|
|||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||||
|
|
||||||
[Script(ScriptCategory.Pokemon, "autotomize")]
|
[Script(ScriptCategory.Pokemon, "autotomize")]
|
||||||
public class AutotomizeEffect : Script, IBatonPassException
|
public class AutotomizeEffect : Script, IBatonPassException, IScriptStack
|
||||||
{
|
{
|
||||||
public int Stacks { get; private set; } = 1;
|
public int Stacks { get; private set; } = 1;
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void Stack()
|
public void Stack()
|
||||||
{
|
{
|
||||||
Stacks++;
|
Stacks++;
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@ using PkmnLib.Plugin.Gen7.Scripts.Utils;
|
|||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||||
|
|
||||||
[Script(ScriptCategory.Pokemon, "bide")]
|
[Script(ScriptCategory.Pokemon, "bide")]
|
||||||
public class BideEffect : Script, IScriptForceTurnSelection, IScriptOnIncomingHit
|
public class BideEffect : Script, IScriptForceTurnSelection, IScriptOnIncomingHit, IScriptOnDamage
|
||||||
{
|
{
|
||||||
private readonly IPokemon? _owner;
|
private readonly IPokemon? _owner;
|
||||||
public byte Turns;
|
public byte Turns;
|
||||||
@ -26,7 +26,7 @@ public class BideEffect : Script, IScriptForceTurnSelection, IScriptOnIncomingHi
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void OnDamage(IPokemon pokemon, DamageSource source, uint oldHealth, uint newHealth)
|
public void OnDamage(IPokemon pokemon, DamageSource source, uint oldHealth, uint newHealth)
|
||||||
{
|
{
|
||||||
DamageTaken += oldHealth - newHealth;
|
DamageTaken += oldHealth - newHealth;
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||||
|
|
||||||
[Script(ScriptCategory.Pokemon, "bind")]
|
[Script(ScriptCategory.Pokemon, "bind")]
|
||||||
public class BindEffect : Script, IScriptOnEndTurn
|
public class BindEffect : Script, IScriptOnEndTurn, IScriptPreventSelfSwitch, IScriptPreventSelfRunAway
|
||||||
{
|
{
|
||||||
private readonly IPokemon? _owner;
|
private readonly IPokemon? _owner;
|
||||||
private int _turns;
|
private int _turns;
|
||||||
@ -29,8 +29,8 @@ public class BindEffect : Script, IScriptOnEndTurn
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void PreventSelfSwitch(ISwitchChoice choice, ref bool prevent) => prevent = _turns > 0;
|
public void PreventSelfSwitch(ISwitchChoice choice, ref bool prevent) => prevent = _turns > 0;
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void PreventSelfRunAway(IFleeChoice choice, ref bool prevent) => prevent = _turns > 0;
|
public void PreventSelfRunAway(IFleeChoice choice, ref bool prevent) => prevent = _turns > 0;
|
||||||
}
|
}
|
@ -1,11 +1,11 @@
|
|||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||||
|
|
||||||
[Script(ScriptCategory.Pokemon, "block")]
|
[Script(ScriptCategory.Pokemon, "block")]
|
||||||
public class BlockEffect : Script
|
public class BlockEffect : Script, IScriptPreventSelfRunAway, IScriptPreventSelfSwitch
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void PreventSelfRunAway(IFleeChoice choice, ref bool prevent) => prevent = true;
|
public void PreventSelfRunAway(IFleeChoice choice, ref bool prevent) => prevent = true;
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void PreventSelfSwitch(ISwitchChoice choice, ref bool prevent) => prevent = true;
|
public void PreventSelfSwitch(ISwitchChoice choice, ref bool prevent) => prevent = true;
|
||||||
}
|
}
|
@ -3,7 +3,8 @@ using PkmnLib.Plugin.Gen7.Scripts.Utils;
|
|||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||||
|
|
||||||
[Script(ScriptCategory.Pokemon, "charge_bounce")]
|
[Script(ScriptCategory.Pokemon, "charge_bounce")]
|
||||||
public class ChargeBounceEffect : Script, IScriptForceTurnSelection, IScriptChangeIncomingMoveDamage
|
public class ChargeBounceEffect : Script, IScriptForceTurnSelection, IScriptChangeIncomingMoveDamage,
|
||||||
|
IScriptBlockIncomingHit
|
||||||
{
|
{
|
||||||
private readonly IPokemon _owner;
|
private readonly IPokemon _owner;
|
||||||
|
|
||||||
@ -20,7 +21,7 @@ public class ChargeBounceEffect : Script, IScriptForceTurnSelection, IScriptChan
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void BlockIncomingHit(IExecutingMove executingMove, IPokemon target, byte hitIndex, ref bool block)
|
public void BlockIncomingHit(IExecutingMove executingMove, IPokemon target, byte hitIndex, ref bool block)
|
||||||
{
|
{
|
||||||
if (!executingMove.UseMove.HasFlag("hit_flying"))
|
if (!executingMove.UseMove.HasFlag("hit_flying"))
|
||||||
block = true;
|
block = true;
|
||||||
|
@ -3,7 +3,8 @@ using PkmnLib.Plugin.Gen7.Scripts.Utils;
|
|||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||||
|
|
||||||
[Script(ScriptCategory.Pokemon, "charge_fly")]
|
[Script(ScriptCategory.Pokemon, "charge_fly")]
|
||||||
public class ChargeFlyEffect : Script, IScriptForceTurnSelection, IScriptChangeIncomingMoveDamage
|
public class ChargeFlyEffect : Script, IScriptForceTurnSelection, IScriptChangeIncomingMoveDamage,
|
||||||
|
IScriptBlockIncomingHit
|
||||||
{
|
{
|
||||||
private readonly IPokemon _owner;
|
private readonly IPokemon _owner;
|
||||||
|
|
||||||
@ -20,7 +21,7 @@ public class ChargeFlyEffect : Script, IScriptForceTurnSelection, IScriptChangeI
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void BlockIncomingHit(IExecutingMove executingMove, IPokemon target, byte hitIndex, ref bool block)
|
public void BlockIncomingHit(IExecutingMove executingMove, IPokemon target, byte hitIndex, ref bool block)
|
||||||
{
|
{
|
||||||
if (!executingMove.UseMove.HasFlag("hit_flying"))
|
if (!executingMove.UseMove.HasFlag("hit_flying"))
|
||||||
block = true;
|
block = true;
|
||||||
|
@ -3,7 +3,8 @@ using PkmnLib.Plugin.Gen7.Scripts.Utils;
|
|||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||||
|
|
||||||
[Script(ScriptCategory.Pokemon, "charge_sky_drop")]
|
[Script(ScriptCategory.Pokemon, "charge_sky_drop")]
|
||||||
public class ChargeSkyDropEffect : Script, IScriptForceTurnSelection, IScriptChangeIncomingMoveDamage
|
public class ChargeSkyDropEffect : Script, IScriptForceTurnSelection, IScriptChangeIncomingMoveDamage,
|
||||||
|
IScriptBlockIncomingHit
|
||||||
{
|
{
|
||||||
private readonly IPokemon _owner;
|
private readonly IPokemon _owner;
|
||||||
|
|
||||||
@ -20,7 +21,7 @@ public class ChargeSkyDropEffect : Script, IScriptForceTurnSelection, IScriptCha
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void BlockIncomingHit(IExecutingMove executingMove, IPokemon target, byte hitIndex, ref bool block)
|
public void BlockIncomingHit(IExecutingMove executingMove, IPokemon target, byte hitIndex, ref bool block)
|
||||||
{
|
{
|
||||||
if (!executingMove.UseMove.HasFlag("hit_flying"))
|
if (!executingMove.UseMove.HasFlag("hit_flying"))
|
||||||
block = true;
|
block = true;
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||||
|
|
||||||
[Script(ScriptCategory.Pokemon, "destiny_bond")]
|
[Script(ScriptCategory.Pokemon, "destiny_bond")]
|
||||||
public class DestinyBondEffect : Script, IScriptOnBeforeMove
|
public class DestinyBondEffect : Script, IScriptOnBeforeMove, IScriptOnFaint
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void OnFaint(IPokemon pokemon, DamageSource source)
|
public void OnFaint(IPokemon pokemon, DamageSource source)
|
||||||
{
|
{
|
||||||
if (source == DamageSource.MoveDamage)
|
if (source == DamageSource.MoveDamage)
|
||||||
{
|
{
|
||||||
|
@ -3,7 +3,7 @@ using PkmnLib.Plugin.Gen7.Scripts.Utils;
|
|||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||||
|
|
||||||
[Script(ScriptCategory.Pokemon, "dig")]
|
[Script(ScriptCategory.Pokemon, "dig")]
|
||||||
public class DigEffect : Script, IScriptForceTurnSelection, IScriptChangeIncomingMoveDamage
|
public class DigEffect : Script, IScriptForceTurnSelection, IScriptChangeIncomingMoveDamage, IScriptBlockIncomingHit
|
||||||
{
|
{
|
||||||
private readonly IPokemon _owner;
|
private readonly IPokemon _owner;
|
||||||
|
|
||||||
@ -20,7 +20,7 @@ public class DigEffect : Script, IScriptForceTurnSelection, IScriptChangeIncomin
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void BlockIncomingHit(IExecutingMove executingMove, IPokemon target, byte hitIndex, ref bool block)
|
public void BlockIncomingHit(IExecutingMove executingMove, IPokemon target, byte hitIndex, ref bool block)
|
||||||
{
|
{
|
||||||
if (!executingMove.UseMove.HasFlag("hit_underground"))
|
if (!executingMove.UseMove.HasFlag("hit_underground"))
|
||||||
block = true;
|
block = true;
|
||||||
|
@ -3,7 +3,7 @@ using PkmnLib.Plugin.Gen7.Scripts.Utils;
|
|||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||||
|
|
||||||
[Script(ScriptCategory.Pokemon, "dive")]
|
[Script(ScriptCategory.Pokemon, "dive")]
|
||||||
public class DiveEffect : Script, IScriptForceTurnSelection, IScriptChangeIncomingMoveDamage
|
public class DiveEffect : Script, IScriptForceTurnSelection, IScriptChangeIncomingMoveDamage, IScriptBlockIncomingHit
|
||||||
{
|
{
|
||||||
private readonly IPokemon _owner;
|
private readonly IPokemon _owner;
|
||||||
|
|
||||||
@ -20,7 +20,7 @@ public class DiveEffect : Script, IScriptForceTurnSelection, IScriptChangeIncomi
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void BlockIncomingHit(IExecutingMove executingMove, IPokemon target, byte hitIndex, ref bool block)
|
public void BlockIncomingHit(IExecutingMove executingMove, IPokemon target, byte hitIndex, ref bool block)
|
||||||
{
|
{
|
||||||
if (!executingMove.UseMove.HasFlag("hit_underwater"))
|
if (!executingMove.UseMove.HasFlag("hit_underwater"))
|
||||||
block = true;
|
block = true;
|
||||||
|
@ -1,18 +1,18 @@
|
|||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||||
|
|
||||||
[Script(ScriptCategory.Pokemon, "embargo")]
|
[Script(ScriptCategory.Pokemon, "embargo")]
|
||||||
public class EmbargoEffect : Script, IScriptOnEndTurn
|
public class EmbargoEffect : Script, IScriptOnEndTurn, IScriptStack, IScriptPreventHeldItemConsume
|
||||||
{
|
{
|
||||||
private int _turns = 5;
|
private int _turns = 5;
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void PreventHeldItemConsume(IPokemon pokemon, IItem heldItem, ref bool prevented)
|
public void PreventHeldItemConsume(IPokemon pokemon, IItem heldItem, ref bool prevented)
|
||||||
{
|
{
|
||||||
prevented = true;
|
prevented = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void Stack()
|
public void Stack()
|
||||||
{
|
{
|
||||||
_turns = 5;
|
_turns = 5;
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||||
|
|
||||||
[Script(ScriptCategory.Pokemon, "endure")]
|
[Script(ScriptCategory.Pokemon, "endure")]
|
||||||
public class EndureEffect : Script, IScriptOnEndTurn
|
public class EndureEffect : Script, IScriptOnEndTurn, IScriptChangeIncomingDamage
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void ChangeIncomingDamage(IPokemon pokemon, DamageSource source, ref uint damage)
|
public void ChangeIncomingDamage(IPokemon pokemon, DamageSource source, ref uint damage)
|
||||||
{
|
{
|
||||||
if (damage > pokemon.CurrentHealth)
|
if (damage > pokemon.CurrentHealth)
|
||||||
damage = pokemon.CurrentHealth - 1;
|
damage = pokemon.CurrentHealth - 1;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||||
|
|
||||||
[Script(ScriptCategory.Pokemon, "fire_spin")]
|
[Script(ScriptCategory.Pokemon, "fire_spin")]
|
||||||
public class FireSpinEffect : Script, IScriptOnEndTurn
|
public class FireSpinEffect : Script, IScriptOnEndTurn, IScriptPreventSelfRunAway, IScriptPreventSelfSwitch
|
||||||
{
|
{
|
||||||
private readonly IPokemon _owner;
|
private readonly IPokemon _owner;
|
||||||
|
|
||||||
@ -17,8 +17,8 @@ public class FireSpinEffect : Script, IScriptOnEndTurn
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void PreventSelfRunAway(IFleeChoice choice, ref bool prevent) => prevent = true;
|
public void PreventSelfRunAway(IFleeChoice choice, ref bool prevent) => prevent = true;
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void PreventSelfSwitch(ISwitchChoice choice, ref bool prevent) => prevent = true;
|
public void PreventSelfSwitch(ISwitchChoice choice, ref bool prevent) => prevent = true;
|
||||||
}
|
}
|
@ -1,7 +1,7 @@
|
|||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||||
|
|
||||||
[Script(ScriptCategory.Pokemon, "grudge")]
|
[Script(ScriptCategory.Pokemon, "grudge")]
|
||||||
public class GrudgeEffect : Script, IScriptOnIncomingHit
|
public class GrudgeEffect : Script, IScriptOnIncomingHit, IScriptOnFaint
|
||||||
{
|
{
|
||||||
private ILearnedMove? _lastMove;
|
private ILearnedMove? _lastMove;
|
||||||
|
|
||||||
@ -12,7 +12,7 @@ public class GrudgeEffect : Script, IScriptOnIncomingHit
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void OnFaint(IPokemon pokemon, DamageSource source)
|
public void OnFaint(IPokemon pokemon, DamageSource source)
|
||||||
{
|
{
|
||||||
if (_lastMove != null && source == DamageSource.MoveDamage)
|
if (_lastMove != null && source == DamageSource.MoveDamage)
|
||||||
{
|
{
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||||
|
|
||||||
[Script(ScriptCategory.Pokemon, "infestation")]
|
[Script(ScriptCategory.Pokemon, "infestation")]
|
||||||
public class InfestationEffect : Script, IScriptOnEndTurn
|
public class InfestationEffect : Script, IScriptOnEndTurn, IScriptPreventSelfSwitch, IScriptPreventSelfRunAway
|
||||||
{
|
{
|
||||||
private readonly IPokemon _owner;
|
private readonly IPokemon _owner;
|
||||||
private int _turns;
|
private int _turns;
|
||||||
@ -13,10 +13,10 @@ public class InfestationEffect : Script, IScriptOnEndTurn
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void PreventSelfSwitch(ISwitchChoice choice, ref bool prevent) => prevent = true;
|
public void PreventSelfSwitch(ISwitchChoice choice, ref bool prevent) => prevent = true;
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void PreventSelfRunAway(IFleeChoice choice, ref bool prevent) => prevent = true;
|
public void PreventSelfRunAway(IFleeChoice choice, ref bool prevent) => prevent = true;
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public void OnEndTurn(IScriptSource owner, IBattle battle)
|
public void OnEndTurn(IScriptSource owner, IBattle battle)
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||||
|
|
||||||
[Script(ScriptCategory.Pokemon, "ingrain")]
|
[Script(ScriptCategory.Pokemon, "ingrain")]
|
||||||
public class IngrainEffect : Script, IScriptFailIncomingMove, IScriptOnEndTurn
|
public class IngrainEffect : Script, IScriptFailIncomingMove, IScriptOnEndTurn, IScriptPreventSelfSwitch,
|
||||||
|
IScriptPreventSelfRunAway
|
||||||
{
|
{
|
||||||
private readonly IPokemon _owner;
|
private readonly IPokemon _owner;
|
||||||
|
|
||||||
@ -11,10 +12,10 @@ public class IngrainEffect : Script, IScriptFailIncomingMove, IScriptOnEndTurn
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void PreventSelfSwitch(ISwitchChoice choice, ref bool prevent) => prevent = true;
|
public void PreventSelfSwitch(ISwitchChoice choice, ref bool prevent) => prevent = true;
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void PreventSelfRunAway(IFleeChoice choice, ref bool prevent) => prevent = true;
|
public void PreventSelfRunAway(IFleeChoice choice, ref bool prevent) => prevent = true;
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public void OnEndTurn(IScriptSource owner, IBattle battle)
|
public void OnEndTurn(IScriptSource owner, IBattle battle)
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||||
|
|
||||||
[Script(ScriptCategory.Pokemon, "magma_storm")]
|
[Script(ScriptCategory.Pokemon, "magma_storm")]
|
||||||
public class MagmaStormEffect : Script, IScriptOnEndTurn
|
public class MagmaStormEffect : Script, IScriptOnEndTurn, IScriptPreventSelfRunAway, IScriptPreventSelfSwitch
|
||||||
{
|
{
|
||||||
private readonly IPokemon _owner;
|
private readonly IPokemon _owner;
|
||||||
|
|
||||||
@ -17,8 +17,8 @@ public class MagmaStormEffect : Script, IScriptOnEndTurn
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void PreventSelfRunAway(IFleeChoice choice, ref bool prevent) => prevent = true;
|
public void PreventSelfRunAway(IFleeChoice choice, ref bool prevent) => prevent = true;
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void PreventSelfSwitch(ISwitchChoice choice, ref bool prevent) => prevent = true;
|
public void PreventSelfSwitch(ISwitchChoice choice, ref bool prevent) => prevent = true;
|
||||||
}
|
}
|
@ -19,11 +19,11 @@ public class MeanLookEffectUser : Script
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Script(ScriptCategory.Pokemon, "mean_look_target")]
|
[Script(ScriptCategory.Pokemon, "mean_look_target")]
|
||||||
public class MeanLookEffectTarget : Script
|
public class MeanLookEffectTarget : Script, IScriptPreventSelfSwitch, IScriptPreventSelfRunAway
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void PreventSelfSwitch(ISwitchChoice choice, ref bool prevent) => prevent = true;
|
public void PreventSelfSwitch(ISwitchChoice choice, ref bool prevent) => prevent = true;
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void PreventSelfRunAway(IFleeChoice choice, ref bool prevent) => prevent = true;
|
public void PreventSelfRunAway(IFleeChoice choice, ref bool prevent) => prevent = true;
|
||||||
}
|
}
|
@ -3,7 +3,7 @@ using PkmnLib.Plugin.Gen7.Scripts.Utils;
|
|||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||||
|
|
||||||
[Script(ScriptCategory.Pokemon, "phantom_force")]
|
[Script(ScriptCategory.Pokemon, "phantom_force")]
|
||||||
public class PhantomForceCharge : Script, IScriptForceTurnSelection
|
public class PhantomForceCharge : Script, IScriptForceTurnSelection, IScriptBlockIncomingHit
|
||||||
{
|
{
|
||||||
private readonly IPokemon _owner;
|
private readonly IPokemon _owner;
|
||||||
|
|
||||||
@ -20,7 +20,7 @@ public class PhantomForceCharge : Script, IScriptForceTurnSelection
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void BlockIncomingHit(IExecutingMove executingMove, IPokemon target, byte hitIndex, ref bool block)
|
public void BlockIncomingHit(IExecutingMove executingMove, IPokemon target, byte hitIndex, ref bool block)
|
||||||
{
|
{
|
||||||
block = true;
|
block = true;
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||||
|
|
||||||
[Script(ScriptCategory.Pokemon, "powder")]
|
[Script(ScriptCategory.Pokemon, "powder")]
|
||||||
public class PowderEffect : Script
|
public class PowderEffect : Script, IScriptBlockOutgoingHit
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void BlockOutgoingHit(IExecutingMove executingMove, IPokemon target, byte hitIndex, ref bool block)
|
public void BlockOutgoingHit(IExecutingMove executingMove, IPokemon target, byte hitIndex, ref bool block)
|
||||||
{
|
{
|
||||||
var hit = executingMove.GetHitData(target, hitIndex);
|
var hit = executingMove.GetHitData(target, hitIndex);
|
||||||
if (hit.Type?.Name == "fire")
|
if (hit.Type?.Name == "fire")
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||||
|
|
||||||
[Script(ScriptCategory.Pokemon, "prevent_foes_exit_effect")]
|
[Script(ScriptCategory.Pokemon, "prevent_foes_exit_effect")]
|
||||||
public class PreventFoesExitEffect : Script
|
public class PreventFoesExitEffect : Script, IScriptPreventOpponentSwitch, IScriptPreventOpponentRunAway
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void PreventOpponentSwitch(ISwitchChoice choice, ref bool prevent)
|
public void PreventOpponentSwitch(ISwitchChoice choice, ref bool prevent)
|
||||||
{
|
{
|
||||||
prevent = true;
|
prevent = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void PreventOpponentRunAway(IFleeChoice choice, ref bool prevent)
|
public void PreventOpponentRunAway(IFleeChoice choice, ref bool prevent)
|
||||||
{
|
{
|
||||||
prevent = true;
|
prevent = true;
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||||
|
|
||||||
[Script(ScriptCategory.Pokemon, "protect")]
|
[Script(ScriptCategory.Pokemon, "protect")]
|
||||||
public class ProtectionEffectScript : Script
|
public class ProtectionEffectScript : Script, IScriptBlockIncomingHit
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void BlockIncomingHit(IExecutingMove executingMove, IPokemon target, byte hitIndex, ref bool block)
|
public virtual void BlockIncomingHit(IExecutingMove executingMove, IPokemon target, byte hitIndex, ref bool block)
|
||||||
{
|
{
|
||||||
if (target.BattleData == null)
|
if (target.BattleData == null)
|
||||||
return;
|
return;
|
||||||
|
@ -3,7 +3,7 @@ using PkmnLib.Dynamic.BattleFlow;
|
|||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||||
|
|
||||||
[Script(ScriptCategory.Pokemon, "pursuit")]
|
[Script(ScriptCategory.Pokemon, "pursuit")]
|
||||||
public class PursuitEffect : Script
|
public class PursuitEffect : Script, IScriptOnSwitchOut
|
||||||
{
|
{
|
||||||
private readonly IMoveChoice _choice;
|
private readonly IMoveChoice _choice;
|
||||||
|
|
||||||
@ -13,7 +13,7 @@ public class PursuitEffect : Script
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void OnSwitchOut(IPokemon oldPokemon, byte position)
|
public void OnSwitchOut(IPokemon oldPokemon, byte position)
|
||||||
{
|
{
|
||||||
var battleData = oldPokemon.BattleData;
|
var battleData = oldPokemon.BattleData;
|
||||||
if (battleData == null)
|
if (battleData == null)
|
||||||
|
@ -3,7 +3,7 @@ using PkmnLib.Plugin.Gen7.Scripts.Utils;
|
|||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||||
|
|
||||||
[Script(ScriptCategory.Pokemon, "shadow_force")]
|
[Script(ScriptCategory.Pokemon, "shadow_force")]
|
||||||
public class ShadowForceCharge : Script, IScriptForceTurnSelection
|
public class ShadowForceCharge : Script, IScriptForceTurnSelection, IScriptBlockIncomingHit
|
||||||
{
|
{
|
||||||
private readonly IPokemon _owner;
|
private readonly IPokemon _owner;
|
||||||
|
|
||||||
@ -20,7 +20,7 @@ public class ShadowForceCharge : Script, IScriptForceTurnSelection
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void BlockIncomingHit(IExecutingMove executingMove, IPokemon target, byte hitIndex, ref bool block)
|
public void BlockIncomingHit(IExecutingMove executingMove, IPokemon target, byte hitIndex, ref bool block)
|
||||||
{
|
{
|
||||||
block = true;
|
block = true;
|
||||||
}
|
}
|
||||||
|
@ -1,19 +1,19 @@
|
|||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||||
|
|
||||||
[Script(ScriptCategory.Pokemon, "spider_web_effect")]
|
[Script(ScriptCategory.Pokemon, "spider_web_effect")]
|
||||||
public class SpiderWebEffect : Script
|
public class SpiderWebEffect : Script, IScriptPreventOpponentRunAway, IScriptPreventOpponentSwitch
|
||||||
{
|
{
|
||||||
private HashSet<IPokemon> _targets = new();
|
private HashSet<IPokemon> _targets = new();
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void PreventOpponentRunAway(IFleeChoice choice, ref bool prevent)
|
public void PreventOpponentRunAway(IFleeChoice choice, ref bool prevent)
|
||||||
{
|
{
|
||||||
if (_targets.Contains(choice.User))
|
if (_targets.Contains(choice.User))
|
||||||
prevent = true;
|
prevent = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void PreventOpponentSwitch(ISwitchChoice choice, ref bool prevent)
|
public void PreventOpponentSwitch(ISwitchChoice choice, ref bool prevent)
|
||||||
{
|
{
|
||||||
if (_targets.Contains(choice.User))
|
if (_targets.Contains(choice.User))
|
||||||
prevent = true;
|
prevent = true;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||||
|
|
||||||
[Script(ScriptCategory.Pokemon, "stockpile_effect")]
|
[Script(ScriptCategory.Pokemon, "stockpile_effect")]
|
||||||
public class StockpileEffect : Script
|
public class StockpileEffect : Script, IScriptStack
|
||||||
{
|
{
|
||||||
private IPokemon? _pokemon;
|
private IPokemon? _pokemon;
|
||||||
public int StockpileCount { get; set; } = 1;
|
public int StockpileCount { get; set; } = 1;
|
||||||
@ -21,7 +21,7 @@ public class StockpileEffect : Script
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void Stack()
|
public void Stack()
|
||||||
{
|
{
|
||||||
if (StockpileCount < 3)
|
if (StockpileCount < 3)
|
||||||
{
|
{
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||||
|
|
||||||
[Script(ScriptCategory.Pokemon, "substitute")]
|
[Script(ScriptCategory.Pokemon, "substitute")]
|
||||||
public class SubstituteEffect(uint health) : Script
|
public class SubstituteEffect(uint health) : Script, IScriptBlockIncomingHit
|
||||||
{
|
{
|
||||||
private uint _health = health;
|
private uint _health = health;
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void BlockIncomingHit(IExecutingMove executingMove, IPokemon target, byte hitIndex, ref bool block)
|
public void BlockIncomingHit(IExecutingMove executingMove, IPokemon target, byte hitIndex, ref bool block)
|
||||||
{
|
{
|
||||||
if (executingMove.UseMove.HasFlag("ignore-substitute"))
|
if (executingMove.UseMove.HasFlag("ignore-substitute"))
|
||||||
return;
|
return;
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||||
|
|
||||||
[Script(ScriptCategory.Pokemon, "thousand_waves")]
|
[Script(ScriptCategory.Pokemon, "thousand_waves")]
|
||||||
public class ThousandWavesEffect : Script
|
public class ThousandWavesEffect : Script, IScriptPreventSelfSwitch, IScriptPreventSelfRunAway
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void PreventSelfSwitch(ISwitchChoice choice, ref bool prevent) => prevent = true;
|
public void PreventSelfSwitch(ISwitchChoice choice, ref bool prevent) => prevent = true;
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void PreventSelfRunAway(IFleeChoice choice, ref bool prevent) => prevent = true;
|
public void PreventSelfRunAway(IFleeChoice choice, ref bool prevent) => prevent = true;
|
||||||
}
|
}
|
@ -1,7 +1,7 @@
|
|||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||||
|
|
||||||
[Script(ScriptCategory.Pokemon, "whirlpool")]
|
[Script(ScriptCategory.Pokemon, "whirlpool")]
|
||||||
public class WhirlpoolEffect : Script, IScriptOnEndTurn
|
public class WhirlpoolEffect : Script, IScriptOnEndTurn, IScriptPreventOpponentRunAway, IScriptPreventOpponentSwitch
|
||||||
{
|
{
|
||||||
public record PokemonTurn
|
public record PokemonTurn
|
||||||
{
|
{
|
||||||
@ -42,14 +42,14 @@ public class WhirlpoolEffect : Script, IScriptOnEndTurn
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void PreventOpponentRunAway(IFleeChoice choice, ref bool prevent)
|
public void PreventOpponentRunAway(IFleeChoice choice, ref bool prevent)
|
||||||
{
|
{
|
||||||
if (_targetedPokemon.Any(x => x.Pokemon == choice.User))
|
if (_targetedPokemon.Any(x => x.Pokemon == choice.User))
|
||||||
prevent = true;
|
prevent = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void PreventOpponentSwitch(ISwitchChoice choice, ref bool prevent)
|
public void PreventOpponentSwitch(ISwitchChoice choice, ref bool prevent)
|
||||||
{
|
{
|
||||||
if (_targetedPokemon.Any(x => x.Pokemon == choice.User))
|
if (_targetedPokemon.Any(x => x.Pokemon == choice.User))
|
||||||
prevent = true;
|
prevent = true;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Side;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Side;
|
||||||
|
|
||||||
[Script(ScriptCategory.Side, "double_power_if_target_damaged_in_turn_data")]
|
[Script(ScriptCategory.Side, "double_power_if_target_damaged_in_turn_data")]
|
||||||
public class DoublePowerIfTargetDamagedInTurnData : Script, IScriptOnEndTurn
|
public class DoublePowerIfTargetDamagedInTurnData : Script, IScriptOnEndTurn, IScriptOnDamage
|
||||||
{
|
{
|
||||||
public readonly HashSet<IPokemon> HitPokemon = [];
|
public readonly HashSet<IPokemon> HitPokemon = [];
|
||||||
|
|
||||||
@ -14,7 +14,7 @@ public class DoublePowerIfTargetDamagedInTurnData : Script, IScriptOnEndTurn
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void OnDamage(IPokemon pokemon, DamageSource source, uint oldHealth, uint newHealth)
|
public void OnDamage(IPokemon pokemon, DamageSource source, uint oldHealth, uint newHealth)
|
||||||
{
|
{
|
||||||
HitPokemon.Add(pokemon);
|
HitPokemon.Add(pokemon);
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Side;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Side;
|
||||||
|
|
||||||
[Script(ScriptCategory.Side, "healing_wish")]
|
[Script(ScriptCategory.Side, "healing_wish")]
|
||||||
public class HealingWishEffect : Script
|
public class HealingWishEffect : Script, IScriptOnSwitchIn
|
||||||
{
|
{
|
||||||
private readonly byte _position;
|
private readonly byte _position;
|
||||||
|
|
||||||
@ -11,7 +11,7 @@ public class HealingWishEffect : Script
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void OnSwitchIn(IPokemon pokemon, byte position)
|
public void OnSwitchIn(IPokemon pokemon, byte position)
|
||||||
{
|
{
|
||||||
if (position == _position)
|
if (position == _position)
|
||||||
{
|
{
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Side;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Side;
|
||||||
|
|
||||||
[Script(ScriptCategory.Side, "lunar_dance")]
|
[Script(ScriptCategory.Side, "lunar_dance")]
|
||||||
public class LunarDanceEffect(byte position) : Script
|
public class LunarDanceEffect(byte position) : Script, IScriptOnSwitchIn
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void OnSwitchIn(IPokemon pokemon, byte position1)
|
public void OnSwitchIn(IPokemon pokemon, byte position1)
|
||||||
{
|
{
|
||||||
if (position != position1)
|
if (position != position1)
|
||||||
return;
|
return;
|
||||||
|
@ -2,10 +2,10 @@ using PkmnLib.Static.Moves;
|
|||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Side;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Side;
|
||||||
|
|
||||||
public class MatBlockEffect : Script, IScriptOnEndTurn
|
public class MatBlockEffect : Script, IScriptOnEndTurn, IScriptBlockIncomingHit
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void BlockIncomingHit(IExecutingMove executingMove, IPokemon target, byte hitIndex, ref bool block)
|
public void BlockIncomingHit(IExecutingMove executingMove, IPokemon target, byte hitIndex, ref bool block)
|
||||||
{
|
{
|
||||||
if (executingMove.UseMove.Category != MoveCategory.Status)
|
if (executingMove.UseMove.Category != MoveCategory.Status)
|
||||||
block = true;
|
block = true;
|
||||||
|
@ -1,19 +1,19 @@
|
|||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Side;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Side;
|
||||||
|
|
||||||
[Script(ScriptCategory.Side, "spikes")]
|
[Script(ScriptCategory.Side, "spikes")]
|
||||||
public class SpikesEffect : Script
|
public class SpikesEffect : Script, IScriptOnSwitchIn, IScriptStack
|
||||||
{
|
{
|
||||||
private int _layers = 1;
|
private int _layers = 1;
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void Stack()
|
public void Stack()
|
||||||
{
|
{
|
||||||
if (_layers < 3)
|
if (_layers < 3)
|
||||||
_layers++;
|
_layers++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void OnSwitchIn(IPokemon pokemon, byte position)
|
public void OnSwitchIn(IPokemon pokemon, byte position)
|
||||||
{
|
{
|
||||||
if (pokemon.IsFloating)
|
if (pokemon.IsFloating)
|
||||||
return;
|
return;
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Side;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Side;
|
||||||
|
|
||||||
[Script(ScriptCategory.Side, "stealth_rock")]
|
[Script(ScriptCategory.Side, "stealth_rock")]
|
||||||
public class StealthRockEffect : Script
|
public class StealthRockEffect : Script, IScriptOnSwitchIn
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void OnSwitchIn(IPokemon pokemon, byte position)
|
public void OnSwitchIn(IPokemon pokemon, byte position)
|
||||||
{
|
{
|
||||||
var typeLibrary = pokemon.Library.StaticLibrary.Types;
|
var typeLibrary = pokemon.Library.StaticLibrary.Types;
|
||||||
var effectiveness = 1.0f;
|
var effectiveness = 1.0f;
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Side;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Side;
|
||||||
|
|
||||||
[Script(ScriptCategory.Side, "sticky_web")]
|
[Script(ScriptCategory.Side, "sticky_web")]
|
||||||
public class StickyWebEffect : Script
|
public class StickyWebEffect : Script, IScriptOnSwitchIn
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void OnSwitchIn(IPokemon pokemon, byte position)
|
public void OnSwitchIn(IPokemon pokemon, byte position)
|
||||||
{
|
{
|
||||||
if (pokemon.IsFloating)
|
if (pokemon.IsFloating)
|
||||||
return;
|
return;
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Side;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Side;
|
||||||
|
|
||||||
[Script(ScriptCategory.Side, "toxic_spikes")]
|
[Script(ScriptCategory.Side, "toxic_spikes")]
|
||||||
public class ToxicSpikesEffect : Script
|
public class ToxicSpikesEffect : Script, IScriptOnSwitchIn
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void OnSwitchIn(IPokemon pokemon, byte position)
|
public void OnSwitchIn(IPokemon pokemon, byte position)
|
||||||
{
|
{
|
||||||
if (pokemon.IsFloating)
|
if (pokemon.IsFloating)
|
||||||
return;
|
return;
|
||||||
|
@ -9,7 +9,7 @@ public class BadlyPoisoned : Poisoned, IScriptOnEndTurn
|
|||||||
public override float GetPoisonMultiplier() => 1f / (16f * _turns);
|
public override float GetPoisonMultiplier() => 1f / (16f * _turns);
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public void OnEndTurn(IScriptSource owner, IBattle battle)
|
public override void OnEndTurn(IScriptSource owner, IBattle battle)
|
||||||
{
|
{
|
||||||
base.OnEndTurn(owner, battle);
|
base.OnEndTurn(owner, battle);
|
||||||
_turns = Math.Min(_turns + 1, 15);
|
_turns = Math.Min(_turns + 1, 15);
|
||||||
|
@ -16,7 +16,7 @@ public class Poisoned : Script, IScriptOnEndTurn
|
|||||||
public virtual float GetPoisonMultiplier() => 1f / 8f;
|
public virtual float GetPoisonMultiplier() => 1f / 8f;
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public void OnEndTurn(IScriptSource owner, IBattle battle)
|
public virtual void OnEndTurn(IScriptSource owner, IBattle battle)
|
||||||
{
|
{
|
||||||
if (_pokemon == null)
|
if (_pokemon == null)
|
||||||
return;
|
return;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Weather;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Weather;
|
||||||
|
|
||||||
[Script(ScriptCategory.Weather, "desolate_lands")]
|
[Script(ScriptCategory.Weather, "desolate_lands")]
|
||||||
public class DesolateLands : HarshSunlight, IScriptFailMove, IScriptOnEndTurn
|
public class DesolateLands : HarshSunlight, IScriptFailMove, IScriptOnEndTurn, IScriptOnSwitchOut
|
||||||
{
|
{
|
||||||
private readonly HashSet<IPokemon> _placers = [];
|
private readonly HashSet<IPokemon> _placers = [];
|
||||||
|
|
||||||
@ -11,7 +11,7 @@ public class DesolateLands : HarshSunlight, IScriptFailMove, IScriptOnEndTurn
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void OnSwitchOut(IPokemon oldPokemon, byte position)
|
public void OnSwitchOut(IPokemon oldPokemon, byte position)
|
||||||
{
|
{
|
||||||
_placers.Remove(oldPokemon);
|
_placers.Remove(oldPokemon);
|
||||||
if (_placers.Count == 0)
|
if (_placers.Count == 0)
|
||||||
@ -35,7 +35,7 @@ public class DesolateLands : HarshSunlight, IScriptFailMove, IScriptOnEndTurn
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public void OnEndTurn(IScriptSource owner, IBattle battle)
|
public override void OnEndTurn(IScriptSource owner, IBattle battle)
|
||||||
{
|
{
|
||||||
// We don't want to call base.OnEndTurn here, as we want to prevent the weather from ending
|
// We don't want to call base.OnEndTurn here, as we want to prevent the weather from ending
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ public class HarshSunlight : Script, ILimitedTurnsScript, IScriptChangeBasePower
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public void OnEndTurn(IScriptSource owner, IBattle battle)
|
public virtual void OnEndTurn(IScriptSource owner, IBattle battle)
|
||||||
{
|
{
|
||||||
_duration--;
|
_duration--;
|
||||||
if (_duration <= 0)
|
if (_duration <= 0)
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Weather;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Weather;
|
||||||
|
|
||||||
[Script(ScriptCategory.Weather, "primordial_sea")]
|
[Script(ScriptCategory.Weather, "primordial_sea")]
|
||||||
public class PrimordialSea : Rain, IScriptFailMove, IScriptOnEndTurn
|
public class PrimordialSea : Rain, IScriptFailMove, IScriptOnEndTurn, IScriptOnSwitchOut
|
||||||
{
|
{
|
||||||
private HashSet<IPokemon> _placers = new();
|
private HashSet<IPokemon> _placers = new();
|
||||||
|
|
||||||
@ -11,7 +11,7 @@ public class PrimordialSea : Rain, IScriptFailMove, IScriptOnEndTurn
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void OnSwitchOut(IPokemon oldPokemon, byte position)
|
public void OnSwitchOut(IPokemon oldPokemon, byte position)
|
||||||
{
|
{
|
||||||
_placers.Remove(oldPokemon);
|
_placers.Remove(oldPokemon);
|
||||||
if (_placers.Count == 0)
|
if (_placers.Count == 0)
|
||||||
@ -34,7 +34,7 @@ public class PrimordialSea : Rain, IScriptFailMove, IScriptOnEndTurn
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public void OnEndTurn(IScriptSource owner, IBattle battle)
|
public override void OnEndTurn(IScriptSource owner, IBattle battle)
|
||||||
{
|
{
|
||||||
// We don't want to call base.OnEndTurn here, as we want to prevent the weather from ending
|
// We don't want to call base.OnEndTurn here, as we want to prevent the weather from ending
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ public class Rain : Script, ILimitedTurnsScript, IScriptChangeBasePower, IScript
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public void OnEndTurn(IScriptSource owner, IBattle battle)
|
public virtual void OnEndTurn(IScriptSource owner, IBattle battle)
|
||||||
{
|
{
|
||||||
_duration--;
|
_duration--;
|
||||||
if (_duration <= 0)
|
if (_duration <= 0)
|
||||||
|
@ -6,7 +6,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Weather;
|
|||||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Strong_winds">Bulbapedia - Strong Winds</see>
|
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Strong_winds">Bulbapedia - Strong Winds</see>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Script(ScriptCategory.Weather, "strong_winds")]
|
[Script(ScriptCategory.Weather, "strong_winds")]
|
||||||
public class StrongWinds : Script
|
public class StrongWinds : Script, IScriptOnSwitchOut
|
||||||
{
|
{
|
||||||
private HashSet<IPokemon> _placers = new();
|
private HashSet<IPokemon> _placers = new();
|
||||||
|
|
||||||
@ -16,7 +16,7 @@ public class StrongWinds : Script
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void OnSwitchOut(IPokemon oldPokemon, byte position)
|
public void OnSwitchOut(IPokemon oldPokemon, byte position)
|
||||||
{
|
{
|
||||||
_placers.Remove(oldPokemon);
|
_placers.Remove(oldPokemon);
|
||||||
if (_placers.Count == 0)
|
if (_placers.Count == 0)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user