More moves

This commit is contained in:
2025-04-17 13:07:45 +02:00
parent 1b54c78b07
commit d02c05874b
31 changed files with 682 additions and 65 deletions

View File

@@ -1,37 +1,10 @@
using PkmnLib.Plugin.Gen7.Scripts.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
[Script(ScriptCategory.Pokemon, "outrage")]
public class OutrageEffect : Script
public class OutrageEffect : OutrageLikeEffect
{
private readonly IPokemon _owner;
private int _turns;
private readonly byte _targetSide;
private readonly byte _targetPosition;
public OutrageEffect(IPokemon owner, int turns, byte targetSide, byte targetPosition)
public OutrageEffect(IPokemon owner, int turns, byte targetSide, byte targetPosition) : base(owner, turns,
targetSide, targetPosition, "outrage")
{
_owner = owner;
_turns = turns;
_targetSide = targetSide;
_targetPosition = targetPosition;
}
/// <inheritdoc />
public override void ForceTurnSelection(byte sideIndex, byte position, ref ITurnChoice? choice)
{
choice = TurnChoiceHelper.CreateMoveChoice(_owner, "outrage", _targetSide, _targetPosition);
}
/// <inheritdoc />
public override void OnAfterHits(IExecutingMove move, IPokemon target)
{
_turns--;
if (_turns <= 0)
{
RemoveSelf();
_owner.Volatile.Add(new Confusion());
}
}
}

View File

@@ -0,0 +1,39 @@
using PkmnLib.Plugin.Gen7.Scripts.Utils;
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
public abstract class OutrageLikeEffect : Script
{
private readonly IPokemon _owner;
private int _turns;
private readonly byte _targetSide;
private readonly byte _targetPosition;
private readonly StringKey _move;
public OutrageLikeEffect(IPokemon owner, int turns, byte targetSide, byte targetPosition, StringKey move)
{
_owner = owner;
_turns = turns;
_targetSide = targetSide;
_targetPosition = targetPosition;
_move = move;
}
/// <inheritdoc />
public override void ForceTurnSelection(byte sideIndex, byte position, ref ITurnChoice? choice)
{
choice = TurnChoiceHelper.CreateMoveChoice(_owner, "_move", _targetSide, _targetPosition);
}
/// <inheritdoc />
public override void OnAfterHits(IExecutingMove move, IPokemon target)
{
_turns--;
if (_turns <= 0)
{
RemoveSelf();
_owner.Volatile.Add(new Confusion());
}
}
}

View File

@@ -0,0 +1,27 @@
using PkmnLib.Static;
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
[Script(ScriptCategory.Pokemon, "perish_song")]
public class PerishSongEffect : Script
{
private int _turns;
private IPokemon _owner;
public PerishSongEffect(IPokemon owner, int turns = 3)
{
_owner = owner;
_turns = turns;
}
/// <inheritdoc />
public override void OnEndTurn(IBattle battle)
{
_turns--;
if (_turns <= 0)
{
RemoveSelf();
_owner.Faint(DamageSource.Misc);
}
}
}

View File

@@ -0,0 +1,10 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
[Script(ScriptCategory.Pokemon, "petal_dance")]
public class PetalDanceEffect : OutrageLikeEffect
{
public PetalDanceEffect(IPokemon owner, int turns, byte targetSide, byte targetPosition) : base(owner, turns,
targetSide, targetPosition, "petal_dance")
{
}
}

View File

@@ -0,0 +1,27 @@
using PkmnLib.Plugin.Gen7.Scripts.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
[Script(ScriptCategory.Pokemon, "phantom_force")]
public class PhantomForceCharge : Script
{
private readonly IPokemon _owner;
public PhantomForceCharge(IPokemon owner)
{
_owner = owner;
}
/// <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, "phantom_force", opposingSideIndex, position);
}
/// <inheritdoc />
public override void BlockIncomingHit(IExecutingMove executingMove, IPokemon target, byte hitIndex, ref bool block)
{
block = true;
}
}

View File

@@ -0,0 +1,28 @@
using System.Collections.Generic;
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
[Script(ScriptCategory.Pokemon, "powder")]
public class PowderEffect : Script
{
/// <inheritdoc />
/// <inheritdoc />
public override void BlockOutgoingHit(IExecutingMove executingMove, IPokemon target, byte hitIndex, ref bool block)
{
var hit = executingMove.GetHitData(target, hitIndex);
if (hit.Type.Name == "fire")
{
executingMove.User.BattleData?.Battle.EventHook.Invoke(new DialogEvent("powder_explodes",
new Dictionary<string, object>
{
{ "user", executingMove.User },
{ "target", target },
}));
var health = executingMove.User.MaxHealth / 4;
executingMove.User.Damage(health, DamageSource.Misc);
block = true;
}
}
}

View File

@@ -0,0 +1,19 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
[Script(ScriptCategory.Pokemon, "power_trick")]
public class PowerTrickEffect : Script
{
/// <inheritdoc />
public override void ChangeOffensiveStatValue(IExecutingMove move, IPokemon target, byte hit, uint defensiveStat,
ref uint value)
{
value = defensiveStat;
}
/// <inheritdoc />
public override void ChangeDefensiveStatValue(IExecutingMove move, IPokemon target, byte hit, uint offensiveStat,
ref uint value)
{
value = offensiveStat;
}
}

View File

@@ -0,0 +1,10 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
[Script(ScriptCategory.Pokemon, "thrash")]
public class ThrashEffect : OutrageLikeEffect
{
public ThrashEffect(IPokemon owner, int turns, byte targetSide, byte targetPosition) : base(owner, turns,
targetSide, targetPosition, "thrash")
{
}
}