Adds more move scripts
This commit is contained in:
parent
a3a9f1800a
commit
3571b2130e
|
@ -46,4 +46,17 @@ public readonly record struct StringKey
|
||||||
|
|
||||||
/// <inheritdoc cref="Equals(StringKey)"/>
|
/// <inheritdoc cref="Equals(StringKey)"/>
|
||||||
public static bool operator !=(StringKey left, string right) => !(left == right);
|
public static bool operator !=(StringKey left, string right) => !(left == right);
|
||||||
|
|
||||||
|
/// <inheritdoc cref="Equals(StringKey)"/>
|
||||||
|
public static bool operator ==(StringKey? left, string? right) =>
|
||||||
|
(left is null && right is null) || (right != null && (left?.Equals(right) ?? false));
|
||||||
|
|
||||||
|
/// <inheritdoc cref="Equals(StringKey)"/>
|
||||||
|
public static bool operator !=(StringKey? left, string? right) => !(left == right);
|
||||||
|
|
||||||
|
/// <inheritdoc cref="Equals(StringKey)"/>
|
||||||
|
public static bool operator ==(StringKey? left, StringKey right) => left?.Equals(right) ?? false;
|
||||||
|
|
||||||
|
/// <inheritdoc cref="Equals(StringKey)"/>
|
||||||
|
public static bool operator !=(StringKey? left, StringKey right) => !(left == right);
|
||||||
}
|
}
|
|
@ -4346,7 +4346,10 @@
|
||||||
"flags": [
|
"flags": [
|
||||||
"snatch",
|
"snatch",
|
||||||
"ignore-substitute"
|
"ignore-substitute"
|
||||||
]
|
],
|
||||||
|
"effect": {
|
||||||
|
"name": "gear_up"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "genesis_supernova",
|
"name": "genesis_supernova",
|
||||||
|
@ -4357,7 +4360,10 @@
|
||||||
"priority": 0,
|
"priority": 0,
|
||||||
"target": "Any",
|
"target": "Any",
|
||||||
"category": "special",
|
"category": "special",
|
||||||
"flags": []
|
"flags": [],
|
||||||
|
"effect": {
|
||||||
|
"name": "genesis_supernova"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "geomancy",
|
"name": "geomancy",
|
||||||
|
@ -4371,7 +4377,10 @@
|
||||||
"flags": [
|
"flags": [
|
||||||
"charge",
|
"charge",
|
||||||
"nonskybattle"
|
"nonskybattle"
|
||||||
]
|
],
|
||||||
|
"effect": {
|
||||||
|
"name": "geomancy"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "giga_drain",
|
"name": "giga_drain",
|
||||||
|
@ -4386,7 +4395,13 @@
|
||||||
"protect",
|
"protect",
|
||||||
"mirror",
|
"mirror",
|
||||||
"heal"
|
"heal"
|
||||||
]
|
],
|
||||||
|
"effect": {
|
||||||
|
"name": "drain",
|
||||||
|
"parameters": {
|
||||||
|
"drain_modifier": 0.5
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "giga_impact",
|
"name": "giga_impact",
|
||||||
|
@ -4402,7 +4417,10 @@
|
||||||
"recharge",
|
"recharge",
|
||||||
"protect",
|
"protect",
|
||||||
"mirror"
|
"mirror"
|
||||||
]
|
],
|
||||||
|
"effect": {
|
||||||
|
"name": "requires_recharge"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "gigavolt_havoc__physical",
|
"name": "gigavolt_havoc__physical",
|
||||||
|
@ -4438,7 +4456,13 @@
|
||||||
"flags": [
|
"flags": [
|
||||||
"protect",
|
"protect",
|
||||||
"mirror"
|
"mirror"
|
||||||
]
|
],
|
||||||
|
"effect": {
|
||||||
|
"name": "change_target_speed",
|
||||||
|
"parameters": {
|
||||||
|
"amount": -1
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "glare",
|
"name": "glare",
|
||||||
|
@ -4453,7 +4477,13 @@
|
||||||
"protect",
|
"protect",
|
||||||
"reflectable",
|
"reflectable",
|
||||||
"mirror"
|
"mirror"
|
||||||
]
|
],
|
||||||
|
"effect": {
|
||||||
|
"name": "set_status",
|
||||||
|
"parameters": {
|
||||||
|
"status": "paralyzed"
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "grass_knot",
|
"name": "grass_knot",
|
||||||
|
@ -4469,7 +4499,10 @@
|
||||||
"protect",
|
"protect",
|
||||||
"mirror",
|
"mirror",
|
||||||
"nonskybattle"
|
"nonskybattle"
|
||||||
]
|
],
|
||||||
|
"effect": {
|
||||||
|
"name": "grass_knot"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "grass_pledge",
|
"name": "grass_pledge",
|
||||||
|
@ -4484,7 +4517,10 @@
|
||||||
"protect",
|
"protect",
|
||||||
"mirror",
|
"mirror",
|
||||||
"nonskybattle"
|
"nonskybattle"
|
||||||
]
|
],
|
||||||
|
"effect": {
|
||||||
|
"name": "grass_pledge"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "grass_whistle",
|
"name": "grass_whistle",
|
||||||
|
@ -4501,7 +4537,13 @@
|
||||||
"mirror",
|
"mirror",
|
||||||
"sound",
|
"sound",
|
||||||
"ignore-substitute"
|
"ignore-substitute"
|
||||||
]
|
],
|
||||||
|
"effect": {
|
||||||
|
"name": "set_status",
|
||||||
|
"parameters": {
|
||||||
|
"status": "sleep"
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "grassy_terrain",
|
"name": "grassy_terrain",
|
||||||
|
@ -4514,7 +4556,10 @@
|
||||||
"category": "status",
|
"category": "status",
|
||||||
"flags": [
|
"flags": [
|
||||||
"nonskybattle"
|
"nonskybattle"
|
||||||
]
|
],
|
||||||
|
"effect": {
|
||||||
|
"name": "grassy_terrain"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "gravity",
|
"name": "gravity",
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
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);
|
public abstract TVolatile CreateVolatile(IPokemon user);
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,6 @@ public class ElectricTerrain : Script
|
||||||
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||||
{
|
{
|
||||||
var battleData = move.User.BattleData;
|
var battleData = move.User.BattleData;
|
||||||
battleData?.Battle.SetTerrain(ScriptUtils.ResolveName<ElectricTerrain>());
|
battleData?.Battle.SetTerrain(ScriptUtils.ResolveName<Terrain.ElectricTerrain>());
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -3,10 +3,10 @@ using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
|
||||||
[Script(ScriptCategory.Move, "freeze_shock")]
|
[Script(ScriptCategory.Move, "freeze_shock")]
|
||||||
public class FreezeShock : BaseChargeMove<FreezeShockEffect>
|
public class FreezeShock : BaseChargeMove<RequireChargeEffect>
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override FreezeShockEffect CreateVolatile(IPokemon user) => new(user);
|
public override RequireChargeEffect CreateVolatile(IPokemon user) => new(user, "freeze_shock");
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||||
|
|
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -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>());
|
||||||
|
}
|
||||||
|
}
|
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
|
@ -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,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
|
||||||
|
[Script(ScriptCategory.Move, "grass_pledge")]
|
||||||
|
public class GrassPledge : Script
|
||||||
|
{
|
||||||
|
// TODO: pledge moves
|
||||||
|
}
|
|
@ -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>());
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,13 +1,14 @@
|
||||||
using PkmnLib.Plugin.Gen7.Scripts.Utils;
|
using PkmnLib.Plugin.Gen7.Scripts.Utils;
|
||||||
|
using PkmnLib.Static.Utils;
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||||
|
|
||||||
public abstract class BaseChargeEffect : Script
|
public abstract class BaseChargeEffect : Script
|
||||||
{
|
{
|
||||||
private readonly IPokemon _owner;
|
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;
|
_owner = owner;
|
||||||
_moveName = moveName;
|
_moveName = moveName;
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
|
using PkmnLib.Static.Utils;
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||||
|
|
||||||
[Script(ScriptCategory.Pokemon, "freeze_shock")]
|
public class RequireChargeEffect(IPokemon owner, StringKey moveName) : BaseChargeEffect(owner, moveName);
|
||||||
public class FreezeShockEffect(IPokemon owner) : BaseChargeEffect(owner, "freeze_shock");
|
|
|
@ -3,5 +3,5 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Terrain;
|
||||||
[Script(ScriptCategory.Terrain, "electric_terrain")]
|
[Script(ScriptCategory.Terrain, "electric_terrain")]
|
||||||
public class ElectricTerrain : Script
|
public class ElectricTerrain : Script
|
||||||
{
|
{
|
||||||
// TODO: Implement Electric Terrain
|
// TODO: Implement Terrain
|
||||||
}
|
}
|
|
@ -3,5 +3,5 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Terrain;
|
||||||
[Script(ScriptCategory.Terrain, "grassy_terrain")]
|
[Script(ScriptCategory.Terrain, "grassy_terrain")]
|
||||||
public class GrassyTerrain : Script
|
public class GrassyTerrain : Script
|
||||||
{
|
{
|
||||||
// TODO: Implement Electric Terrain
|
// TODO: Implement Terrain
|
||||||
}
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
namespace PkmnLib.Plugin.Gen7.Scripts.Terrain;
|
||||||
|
|
||||||
|
[Script(ScriptCategory.Terrain, "psychic_terrain")]
|
||||||
|
public class PsychicTerrain : Script
|
||||||
|
{
|
||||||
|
// TODO: Implement Terrain
|
||||||
|
}
|
Loading…
Reference in New Issue