Even more moves

This commit is contained in:
2025-04-19 13:01:10 +02:00
parent c22ad1a793
commit 807acf1947
19 changed files with 505 additions and 19 deletions

View File

@@ -0,0 +1,27 @@
using PkmnLib.Plugin.Gen7.Scripts.Utils;
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
[Script(ScriptCategory.Pokemon, "charge_move_effect")]
public class ChargeMoveEffect : Script
{
public readonly StringKey MoveName;
private readonly IPokemon _user;
private readonly byte _targetSide;
private readonly byte _targetPosition;
public ChargeMoveEffect(StringKey moveName, IPokemon user, byte targetSide, byte targetPosition)
{
MoveName = moveName;
_user = user;
_targetSide = targetSide;
_targetPosition = targetPosition;
}
/// <inheritdoc />
public override void ForceTurnSelection(byte sideIndex, byte position, ref ITurnChoice? choice)
{
choice = TurnChoiceHelper.CreateMoveChoice(_user, MoveName, _targetSide, _targetPosition);
}
}

View File

@@ -0,0 +1,52 @@
using PkmnLib.Dynamic.Models.BattleFlow;
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
[Script(ScriptCategory.Pokemon, "pursuit")]
public class PursuitEffect : Script
{
private readonly IMoveChoice _choice;
public PursuitEffect(IMoveChoice choice)
{
_choice = choice;
}
/// <inheritdoc />
public override void OnSwitchOut(IPokemon oldPokemon, byte position)
{
var battleData = oldPokemon.BattleData;
if (battleData == null)
return;
if (battleData.Battle.HasEnded)
return;
if (battleData.Position != _choice.TargetPosition || battleData.SideIndex != _choice.TargetSide)
return;
if (!_choice.User.IsUsable)
return;
if (_choice.User.BattleData?.IsOnBattlefield != true)
return;
var choiceQueue = battleData.Battle.ChoiceQueue;
var choice = choiceQueue?.FirstOrDefault(x => x == _choice);
if (choice == null)
return;
choiceQueue!.Remove(choice);
_choice.Volatile.Add(new PursuitDoublePowerEffect());
RemoveSelf();
TurnRunner.ExecuteChoice(battleData.Battle, _choice);
}
[Script(ScriptCategory.Pokemon, "pursuit_double_power")]
private class PursuitDoublePowerEffect : Script
{
/// <inheritdoc />
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref byte basePower)
{
basePower = basePower.MultiplyOrMax(2);
}
}
}

View File

@@ -0,0 +1,19 @@
using PkmnLib.Static;
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
[Script(ScriptCategory.Pokemon, "rage")]
public class RageEffect : Script
{
/// <inheritdoc />
public override void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit)
{
move.User.ChangeStatBoost(Statistic.Attack, 1, true);
}
/// <inheritdoc />
public override void OnEndTurn(IBattle battle)
{
RemoveSelf();
}
}