Implements a bunch more moves
This commit is contained in:
41
Plugins/PkmnLib.Plugin.Gen7/Scripts/Pokemon/IceBallEffect.cs
Normal file
41
Plugins/PkmnLib.Plugin.Gen7/Scripts/Pokemon/IceBallEffect.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
using PkmnLib.Plugin.Gen7.Scripts.Utils;
|
||||
using PkmnLib.Static.Utils;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
|
||||
[Script(ScriptCategory.Pokemon, "ice_ball")]
|
||||
public class IceBallEffect : Script
|
||||
{
|
||||
private readonly IPokemon _owner;
|
||||
private readonly StringKey _moveName;
|
||||
public int TurnCount { get; set; }
|
||||
|
||||
public IceBallEffect(IPokemon owner, StringKey moveName)
|
||||
{
|
||||
_owner = owner;
|
||||
_moveName = moveName;
|
||||
TurnCount = 0;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void ForceTurnSelection(byte sideIndex, byte position, ref ITurnChoice? choice)
|
||||
{
|
||||
var opposingSideIndex = (byte)(_owner.BattleData?.SideIndex == 0 ? 1 : 0);
|
||||
choice = TurnChoiceHelper.CreateMoveChoice(_owner, _moveName, opposingSideIndex, position);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnMoveMiss(IExecutingMove move, IPokemon target)
|
||||
{
|
||||
RemoveSelf();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnEndTurn(IBattle battle)
|
||||
{
|
||||
if (TurnCount < 5)
|
||||
TurnCount++;
|
||||
else
|
||||
RemoveSelf();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user