More abilities, refactor IPokemon.SetStatus to pass pokemon that caused the status change
All checks were successful
Build / Build (push) Successful in 50s
All checks were successful
Build / Build (push) Successful in 50s
This commit is contained in:
@@ -12,7 +12,7 @@ public class BanefulBunkerEffect : ProtectionEffectScript
|
||||
if (executingMove.UseMove.Category != MoveCategory.Status &&
|
||||
executingMove.GetHitData(target, hitIndex).IsContact)
|
||||
{
|
||||
executingMove.User.SetStatus("poisoned", false);
|
||||
executingMove.User.SetStatus(ScriptUtils.ResolveName<Status.Poisoned>(), executingMove.User);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,7 @@ public class BeakBlastEffect : Script
|
||||
{
|
||||
if (move.GetHitData(target, hit).IsContact)
|
||||
{
|
||||
move.User.SetStatus("burned", false);
|
||||
move.User.SetStatus(ScriptUtils.ResolveName<Status.Burned>(), move.User);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,34 +3,18 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
[Script(ScriptCategory.Pokemon, "yawn")]
|
||||
public class YawnEffect : Script
|
||||
{
|
||||
private IPokemon? _pokemon;
|
||||
private bool _hasDoneFirstTurn;
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnAddedToParent(IScriptSource source)
|
||||
{
|
||||
if (source is IPokemon pokemon)
|
||||
{
|
||||
_pokemon = pokemon;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new InvalidOperationException("YawnEffect can only be added to a Pokemon.");
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnEndTurn(IScriptSource owner, IBattle battle)
|
||||
{
|
||||
if (_pokemon == null)
|
||||
{
|
||||
if (owner is not IPokemon pokemon)
|
||||
return;
|
||||
}
|
||||
if (!_hasDoneFirstTurn)
|
||||
{
|
||||
_hasDoneFirstTurn = true;
|
||||
return;
|
||||
}
|
||||
_pokemon.SetStatus(ScriptUtils.ResolveName<Status.Sleep>(), true);
|
||||
pokemon.SetStatus(ScriptUtils.ResolveName<Status.Sleep>(), pokemon);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user