Adds more move scripts

This commit is contained in:
2025-03-07 12:07:57 +01:00
parent a3a9f1800a
commit 3571b2130e
16 changed files with 193 additions and 21 deletions

View File

@@ -1,8 +1,9 @@
using System.Collections.Generic;
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
public abstract class BaseChargeMove<TVolatile> : Script where TVolatile : Script
public abstract class BaseChargeMove<TVolatile> : Script where TVolatile : RequireChargeEffect
{
public abstract TVolatile CreateVolatile(IPokemon user);

View File

@@ -7,6 +7,6 @@ public class ElectricTerrain : Script
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{
var battleData = move.User.BattleData;
battleData?.Battle.SetTerrain(ScriptUtils.ResolveName<ElectricTerrain>());
battleData?.Battle.SetTerrain(ScriptUtils.ResolveName<Terrain.ElectricTerrain>());
}
}

View File

@@ -3,10 +3,10 @@ using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "freeze_shock")]
public class FreezeShock : BaseChargeMove<FreezeShockEffect>
public class FreezeShock : BaseChargeMove<RequireChargeEffect>
{
/// <inheritdoc />
public override FreezeShockEffect CreateVolatile(IPokemon user) => new(user);
public override RequireChargeEffect CreateVolatile(IPokemon user) => new(user, "freeze_shock");
/// <inheritdoc />
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)

View File

@@ -0,0 +1,27 @@
using PkmnLib.Static;
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "gear_up")]
public class GearUp : Script
{
/// <inheritdoc />
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{
var battleData = move.User.BattleData;
if (battleData == null)
return;
var side = battleData.Battle.Sides[battleData.SideIndex];
EventBatchId evtBatchId = new();
foreach (var pokemon in side.Pokemon.WhereNotNull())
{
var ability = pokemon.ActiveAbility?.Name;
if (ability != "plus" && ability != "minus")
continue;
pokemon.ChangeStatBoost(Statistic.Attack, 1, pokemon == move.User, evtBatchId);
pokemon.ChangeStatBoost(Statistic.SpecialAttack, 1, pokemon == move.User, evtBatchId);
}
}
}

View File

@@ -0,0 +1,17 @@
using PkmnLib.Plugin.Gen7.Scripts.Terrain;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "genesis_supernova")]
public class GenesisSupernova : Script
{
/// <inheritdoc />
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{
var battleData = move.User.BattleData;
if (battleData == null)
return;
battleData.Battle.SetTerrain(ScriptUtils.ResolveName<PsychicTerrain>());
}
}

View File

@@ -0,0 +1,19 @@
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
using PkmnLib.Static;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
public class Geomancy : BaseChargeMove<RequireChargeEffect>
{
/// <inheritdoc />
public override RequireChargeEffect CreateVolatile(IPokemon user) => new(user, "geomancy");
/// <inheritdoc />
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{
EventBatchId eventBatchId = new();
move.User.ChangeStatBoost(Statistic.SpecialAttack, 2, true, eventBatchId);
move.User.ChangeStatBoost(Statistic.SpecialDefense, 2, true, eventBatchId);
move.User.ChangeStatBoost(Statistic.Speed, 2, true, eventBatchId);
}
}

View File

@@ -0,0 +1,20 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "grass_knot")]
public class GrassKnot : Script
{
/// <inheritdoc />
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref byte basePower)
{
var targetWeight = target.WeightInKg;
basePower = targetWeight switch
{
< 10 => 20,
< 25 => 40,
< 50 => 60,
< 100 => 80,
< 200 => 100,
_ => 120,
};
}
}

View File

@@ -0,0 +1,7 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "grass_pledge")]
public class GrassPledge : Script
{
// TODO: pledge moves
}

View File

@@ -0,0 +1,14 @@
using PkmnLib.Plugin.Gen7.Scripts.Terrain;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "grassy_terrain")]
public class GrassyTerrain : Script
{
/// <inheritdoc />
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{
var battleData = move.User.BattleData;
battleData?.Battle.SetTerrain(ScriptUtils.ResolveName<Terrain.GrassyTerrain>());
}
}

View File

@@ -1,13 +1,14 @@
using PkmnLib.Plugin.Gen7.Scripts.Utils;
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
public abstract class BaseChargeEffect : Script
{
private readonly IPokemon _owner;
private readonly string _moveName;
private readonly StringKey _moveName;
public BaseChargeEffect(IPokemon owner, string moveName)
public BaseChargeEffect(IPokemon owner, StringKey moveName)
{
_owner = owner;
_moveName = moveName;

View File

@@ -1,4 +1,5 @@
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
[Script(ScriptCategory.Pokemon, "freeze_shock")]
public class FreezeShockEffect(IPokemon owner) : BaseChargeEffect(owner, "freeze_shock");
public class RequireChargeEffect(IPokemon owner, StringKey moveName) : BaseChargeEffect(owner, moveName);

View File

@@ -3,5 +3,5 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Terrain;
[Script(ScriptCategory.Terrain, "electric_terrain")]
public class ElectricTerrain : Script
{
// TODO: Implement Electric Terrain
// TODO: Implement Terrain
}

View File

@@ -3,5 +3,5 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Terrain;
[Script(ScriptCategory.Terrain, "grassy_terrain")]
public class GrassyTerrain : Script
{
// TODO: Implement Electric Terrain
// TODO: Implement Terrain
}

View File

@@ -0,0 +1,7 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Terrain;
[Script(ScriptCategory.Terrain, "psychic_terrain")]
public class PsychicTerrain : Script
{
// TODO: Implement Terrain
}