Even more moves
This commit is contained in:
52
Plugins/PkmnLib.Plugin.Gen7/Scripts/Pokemon/PursuitEffect.cs
Normal file
52
Plugins/PkmnLib.Plugin.Gen7/Scripts/Pokemon/PursuitEffect.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user