Even more moves
This commit is contained in:
21
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/Pursuit.cs
Normal file
21
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/Pursuit.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "pursuit")]
|
||||
public class Pursuit : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnBeforeTurnStart(ITurnChoice choice)
|
||||
{
|
||||
if (choice is IMoveChoice moveChoice)
|
||||
choice.User.Volatile.Add(new PursuitEffect(moveChoice));
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit) =>
|
||||
move.User.Volatile.Remove<PursuitEffect>();
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnAfterMove(IExecutingMove move) => move.User.Volatile.Remove<PursuitEffect>();
|
||||
}
|
||||
18
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/Quash.cs
Normal file
18
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/Quash.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "quash")]
|
||||
public class Quash : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
{
|
||||
var battleData = move.User.BattleData;
|
||||
if (battleData == null)
|
||||
return;
|
||||
|
||||
if (battleData.Battle.ChoiceQueue?.MovePokemonChoiceLast(target) == false)
|
||||
{
|
||||
move.GetHitData(target, hit).Fail();
|
||||
}
|
||||
}
|
||||
}
|
||||
13
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/QuickGuard.cs
Normal file
13
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/QuickGuard.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using PkmnLib.Plugin.Gen7.Scripts.Side;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "quick_guard")]
|
||||
public class QuickGuard : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
{
|
||||
move.User.BattleData?.BattleSide.VolatileScripts.Add(new QuickGuardEffect());
|
||||
}
|
||||
}
|
||||
13
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/Rage.cs
Normal file
13
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/Rage.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "rage")]
|
||||
public class Rage : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
{
|
||||
move.User.Volatile.Add(new RageEffect());
|
||||
}
|
||||
}
|
||||
18
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/RagePowder.cs
Normal file
18
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/RagePowder.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using PkmnLib.Plugin.Gen7.Scripts.Side;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "rage_powder")]
|
||||
public class RagePowder : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
{
|
||||
var battleData = move.User.BattleData;
|
||||
if (battleData == null)
|
||||
return;
|
||||
|
||||
var effect = battleData.BattleSide.VolatileScripts.Add(new RagePowderEffect(move.User));
|
||||
((RagePowderEffect)effect.Script!).User = move.User;
|
||||
}
|
||||
}
|
||||
16
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/RainDance.cs
Normal file
16
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/RainDance.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using PkmnLib.Plugin.Gen7.Scripts.Weather;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "rain_dance")]
|
||||
public class RainDance : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
{
|
||||
var battleData = move.User.BattleData;
|
||||
if (battleData == null)
|
||||
return;
|
||||
battleData.Battle.SetWeather(ScriptUtils.ResolveName<Rain>(), 5);
|
||||
}
|
||||
}
|
||||
23
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/RapidSpin.cs
Normal file
23
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/RapidSpin.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "rapid_spin")]
|
||||
public class RapidSpin : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
{
|
||||
move.User.Volatile.Remove<LeechSeedEffect>();
|
||||
move.User.Volatile.Remove<BindEffect>();
|
||||
move.User.Volatile.Remove<FireSpinEffect>();
|
||||
move.User.Volatile.Remove<MagmaStormEffect>();
|
||||
// TODO: Sand Tomb effect removal
|
||||
// TODO: Whirlpool effect removal
|
||||
// TODO: Wrap effect removal
|
||||
|
||||
// TODO: Remove Spikes
|
||||
// TODO: Remove Toxic Spikes
|
||||
// TODO: Remove Stealth Rock
|
||||
}
|
||||
}
|
||||
24
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/RazorWind.cs
Normal file
24
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/RazorWind.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "razor_wind")]
|
||||
public class RazorWind : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void PreventMove(IExecutingMove move, ref bool prevent)
|
||||
{
|
||||
var chargeMoveEffect = move.User.Volatile.Get<ChargeMoveEffect>();
|
||||
if (chargeMoveEffect != null && chargeMoveEffect.MoveName == move.UseMove.Name)
|
||||
return;
|
||||
prevent = true;
|
||||
move.User.Volatile.Add(new ChargeMoveEffect(move.UseMove.Name, move.User, move.MoveChoice.TargetSide,
|
||||
move.MoveChoice.TargetPosition));
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void ChangeCriticalStage(IExecutingMove move, IPokemon target, byte hit, ref byte stage)
|
||||
{
|
||||
stage += 1;
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
19
Plugins/PkmnLib.Plugin.Gen7/Scripts/Pokemon/RageEffect.cs
Normal file
19
Plugins/PkmnLib.Plugin.Gen7/Scripts/Pokemon/RageEffect.cs
Normal 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();
|
||||
}
|
||||
}
|
||||
18
Plugins/PkmnLib.Plugin.Gen7/Scripts/Side/QuickGuardEffect.cs
Normal file
18
Plugins/PkmnLib.Plugin.Gen7/Scripts/Side/QuickGuardEffect.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Side;
|
||||
|
||||
public class QuickGuardEffect : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
/// <inheritdoc />
|
||||
public override void IsInvulnerableToMove(IExecutingMove move, IPokemon target, ref bool invulnerable)
|
||||
{
|
||||
if (move.UseMove.Priority > 0)
|
||||
invulnerable = true;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnEndTurn(IBattle battle)
|
||||
{
|
||||
RemoveSelf();
|
||||
}
|
||||
}
|
||||
30
Plugins/PkmnLib.Plugin.Gen7/Scripts/Side/RagePowderEffect.cs
Normal file
30
Plugins/PkmnLib.Plugin.Gen7/Scripts/Side/RagePowderEffect.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Side;
|
||||
|
||||
[Script(ScriptCategory.Side, "rage_powder")]
|
||||
public class RagePowderEffect : Script
|
||||
{
|
||||
public IPokemon User { get; set; }
|
||||
|
||||
public RagePowderEffect(IPokemon user)
|
||||
{
|
||||
User = user;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void ChangeIncomingTargets(IMoveChoice moveChoice, ref IReadOnlyList<IPokemon?> targets)
|
||||
{
|
||||
// Ignore multi-hit moves
|
||||
if (targets.Count != 1)
|
||||
return;
|
||||
|
||||
targets = [User];
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnEndTurn(IBattle battle)
|
||||
{
|
||||
RemoveSelf();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user