Make another pass through moves file
All checks were successful
Build / Build (push) Successful in 47s
All checks were successful
Build / Build (push) Successful in 47s
This commit is contained in:
parent
9ff4745c0a
commit
cbd4340b13
@ -1,6 +1,11 @@
|
|||||||
|
using System.Buffers;
|
||||||
|
using System.Text.Json;
|
||||||
using PkmnLib.Dynamic.Libraries;
|
using PkmnLib.Dynamic.Libraries;
|
||||||
|
using PkmnLib.Dynamic.Libraries.DataLoaders.Models;
|
||||||
using PkmnLib.Dynamic.ScriptHandling;
|
using PkmnLib.Dynamic.ScriptHandling;
|
||||||
|
using PkmnLib.Dynamic.ScriptHandling.Registry;
|
||||||
using PkmnLib.Static.Moves;
|
using PkmnLib.Static.Moves;
|
||||||
|
using TUnit.Core.Logging;
|
||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Tests.DataTests;
|
namespace PkmnLib.Plugin.Gen7.Tests.DataTests;
|
||||||
|
|
||||||
@ -84,4 +89,106 @@ public class MoveDataTests
|
|||||||
|
|
||||||
await Assert.That(test.Library.ScriptResolver.TryResolve(ScriptCategory.Status, status, null, out _)).IsTrue();
|
await Assert.That(test.Library.ScriptResolver.TryResolve(ScriptCategory.Status, status, null, out _)).IsTrue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public record HasEitherEffectOrComment(string MoveName, bool HasEffect, bool HasComment)
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override string ToString() => MoveName + " has effect: " + HasEffect + ", comment: " + HasComment;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static IEnumerable<Func<HasEitherEffectOrComment>> EveryMoveHasEitherEffectOrCommentData()
|
||||||
|
{
|
||||||
|
IResourceProvider plugin = new Gen7Plugin();
|
||||||
|
using var movesJson = plugin.GetResource(ResourceFileType.Moves)!.Open();
|
||||||
|
var json = new BinaryReader(movesJson);
|
||||||
|
var moves = json.ReadBytes((int)movesJson.Length);
|
||||||
|
var reader = new Utf8JsonReader(new ReadOnlySequence<byte>(moves), new JsonReaderOptions
|
||||||
|
{
|
||||||
|
CommentHandling = JsonCommentHandling.Allow,
|
||||||
|
AllowTrailingCommas = true,
|
||||||
|
});
|
||||||
|
Console.WriteLine("Reading moves.json");
|
||||||
|
|
||||||
|
// The JSON is an object { "data": [] }.
|
||||||
|
// Each move is an object in the "data" array.
|
||||||
|
// Each object needs to have either an "effect" or a "comment" property.
|
||||||
|
|
||||||
|
// Read the first object
|
||||||
|
reader.Read();
|
||||||
|
// Read the properties, until we find the "data" property
|
||||||
|
while (reader.TokenType != JsonTokenType.PropertyName || reader.GetString() != "data")
|
||||||
|
{
|
||||||
|
reader.Read();
|
||||||
|
}
|
||||||
|
// Read the "data" property
|
||||||
|
reader.Read();
|
||||||
|
// Read the start of the array
|
||||||
|
reader.Read();
|
||||||
|
|
||||||
|
var results = new List<HasEitherEffectOrComment>();
|
||||||
|
// Read each move object
|
||||||
|
while (reader.TokenType != JsonTokenType.EndArray)
|
||||||
|
{
|
||||||
|
// Read the start of the object
|
||||||
|
if (!reader.Read())
|
||||||
|
break;
|
||||||
|
// Read each property
|
||||||
|
var name = "";
|
||||||
|
var hasEffect = false;
|
||||||
|
var hasComment = false;
|
||||||
|
while (reader.TokenType != JsonTokenType.EndObject)
|
||||||
|
{
|
||||||
|
if (reader.TokenType == JsonTokenType.PropertyName)
|
||||||
|
{
|
||||||
|
var propertyName = reader.GetString();
|
||||||
|
if (propertyName == "name")
|
||||||
|
{
|
||||||
|
reader.Read();
|
||||||
|
name = reader.GetString()!;
|
||||||
|
}
|
||||||
|
else if (propertyName == "effect")
|
||||||
|
{
|
||||||
|
hasEffect = true;
|
||||||
|
reader.Read();
|
||||||
|
// Read the effect object
|
||||||
|
while (reader.TokenType != JsonTokenType.EndObject)
|
||||||
|
{
|
||||||
|
reader.Read();
|
||||||
|
if (reader.TokenType != JsonTokenType.StartObject)
|
||||||
|
continue;
|
||||||
|
while (reader.TokenType != JsonTokenType.EndObject)
|
||||||
|
{
|
||||||
|
reader.Read();
|
||||||
|
}
|
||||||
|
reader.Read();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (reader.TokenType == JsonTokenType.Comment)
|
||||||
|
{
|
||||||
|
// Read the comment
|
||||||
|
var comment = reader.GetComment();
|
||||||
|
hasComment = comment.Trim() == "No secondary effect";
|
||||||
|
}
|
||||||
|
|
||||||
|
reader.Read();
|
||||||
|
}
|
||||||
|
results.Add(new HasEitherEffectOrComment(name, hasEffect, hasComment));
|
||||||
|
}
|
||||||
|
return results.Where(x => !string.IsNullOrWhiteSpace(x.MoveName))
|
||||||
|
.Select<HasEitherEffectOrComment, Func<HasEitherEffectOrComment>>(x => () => x).ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// To ensure that all moves have been properly implemented, we require that each move has either an "effect" property,
|
||||||
|
/// or a comment with the exact text "No secondary effect". This ensures that we have not missed any moves.
|
||||||
|
///
|
||||||
|
/// The implementation of this test is a bit tricky, as we need to read the JSON file and parse it ourselves,
|
||||||
|
/// as System.Text.Json does not support reading comments in JSON files beyond the low-level API.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="test"></param>
|
||||||
|
[Test, MethodDataSource(nameof(EveryMoveHasEitherEffectOrCommentData))]
|
||||||
|
public async Task AllMovesHaveEitherEffectOrComment(HasEitherEffectOrComment test) =>
|
||||||
|
// Check that each move has either an "effect" or a "comment" property
|
||||||
|
await Assert.That(test.HasEffect || test.HasComment).IsTrue();
|
||||||
}
|
}
|
@ -49,6 +49,7 @@
|
|||||||
"protect",
|
"protect",
|
||||||
"mirror"
|
"mirror"
|
||||||
]
|
]
|
||||||
|
// No secondary effect
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "acid",
|
"name": "acid",
|
||||||
@ -101,6 +102,7 @@
|
|||||||
"target": "Any",
|
"target": "Any",
|
||||||
"category": "physical",
|
"category": "physical",
|
||||||
"flags": []
|
"flags": []
|
||||||
|
// No secondary effect
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "acid_downpour__special",
|
"name": "acid_downpour__special",
|
||||||
@ -112,6 +114,7 @@
|
|||||||
"target": "Any",
|
"target": "Any",
|
||||||
"category": "special",
|
"category": "special",
|
||||||
"flags": []
|
"flags": []
|
||||||
|
// No secondary effect
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "acid_spray",
|
"name": "acid_spray",
|
||||||
@ -175,7 +178,7 @@
|
|||||||
"type": "flying",
|
"type": "flying",
|
||||||
"power": 60,
|
"power": 60,
|
||||||
"pp": 20,
|
"pp": 20,
|
||||||
"accuracy": 0,
|
"accuracy": 255,
|
||||||
"priority": 0,
|
"priority": 0,
|
||||||
"target": "Any",
|
"target": "Any",
|
||||||
"category": "physical",
|
"category": "physical",
|
||||||
@ -185,6 +188,7 @@
|
|||||||
"mirror",
|
"mirror",
|
||||||
"distance"
|
"distance"
|
||||||
]
|
]
|
||||||
|
// No secondary effect
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "aeroblast",
|
"name": "aeroblast",
|
||||||
@ -285,6 +289,7 @@
|
|||||||
"target": "Any",
|
"target": "Any",
|
||||||
"category": "physical",
|
"category": "physical",
|
||||||
"flags": []
|
"flags": []
|
||||||
|
// No secondary effect
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "all_out_pummeling__special",
|
"name": "all_out_pummeling__special",
|
||||||
@ -296,6 +301,7 @@
|
|||||||
"target": "Any",
|
"target": "Any",
|
||||||
"category": "special",
|
"category": "special",
|
||||||
"flags": []
|
"flags": []
|
||||||
|
// No secondary effect
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "ally_switch",
|
"name": "ally_switch",
|
||||||
@ -383,6 +389,7 @@
|
|||||||
"protect",
|
"protect",
|
||||||
"mirror"
|
"mirror"
|
||||||
]
|
]
|
||||||
|
// No secondary effect
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "aqua_ring",
|
"name": "aqua_ring",
|
||||||
@ -417,6 +424,7 @@
|
|||||||
"protect",
|
"protect",
|
||||||
"mirror"
|
"mirror"
|
||||||
]
|
]
|
||||||
|
// No secondary effect
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "arm_thrust",
|
"name": "arm_thrust",
|
||||||
@ -576,6 +584,7 @@
|
|||||||
"pulse",
|
"pulse",
|
||||||
"ballistics"
|
"ballistics"
|
||||||
]
|
]
|
||||||
|
// No secondary effect
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "aurora_beam",
|
"name": "aurora_beam",
|
||||||
@ -881,6 +890,7 @@
|
|||||||
"target": "Any",
|
"target": "Any",
|
||||||
"category": "physical",
|
"category": "physical",
|
||||||
"flags": []
|
"flags": []
|
||||||
|
// No secondary effect
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "black_hole_eclipse__special",
|
"name": "black_hole_eclipse__special",
|
||||||
@ -892,6 +902,7 @@
|
|||||||
"target": "Any",
|
"target": "Any",
|
||||||
"category": "special",
|
"category": "special",
|
||||||
"flags": []
|
"flags": []
|
||||||
|
// No secondary effect
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "blast_burn",
|
"name": "blast_burn",
|
||||||
@ -981,6 +992,7 @@
|
|||||||
"target": "Any",
|
"target": "Any",
|
||||||
"category": "physical",
|
"category": "physical",
|
||||||
"flags": []
|
"flags": []
|
||||||
|
// No secondary effect
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "bloom_doom__special",
|
"name": "bloom_doom__special",
|
||||||
@ -992,6 +1004,7 @@
|
|||||||
"target": "Any",
|
"target": "Any",
|
||||||
"category": "special",
|
"category": "special",
|
||||||
"flags": []
|
"flags": []
|
||||||
|
// No secondary effect
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "blue_flare",
|
"name": "blue_flare",
|
||||||
@ -1126,6 +1139,7 @@
|
|||||||
"sound",
|
"sound",
|
||||||
"ignore-substitute"
|
"ignore-substitute"
|
||||||
]
|
]
|
||||||
|
// No secondary effect
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "bounce",
|
"name": "bounce",
|
||||||
@ -1180,6 +1194,7 @@
|
|||||||
"target": "Any",
|
"target": "Any",
|
||||||
"category": "physical",
|
"category": "physical",
|
||||||
"flags": []
|
"flags": []
|
||||||
|
// No secondary effect
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "breakneck_blitz__special",
|
"name": "breakneck_blitz__special",
|
||||||
@ -1191,6 +1206,7 @@
|
|||||||
"target": "Any",
|
"target": "Any",
|
||||||
"category": "special",
|
"category": "special",
|
||||||
"flags": []
|
"flags": []
|
||||||
|
// No secondary effect
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "brick_break",
|
"name": "brick_break",
|
||||||
@ -1241,6 +1257,7 @@
|
|||||||
"protect",
|
"protect",
|
||||||
"mirror"
|
"mirror"
|
||||||
]
|
]
|
||||||
|
// No secondary effect
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "bubble",
|
"name": "bubble",
|
||||||
@ -1381,6 +1398,7 @@
|
|||||||
"mirror",
|
"mirror",
|
||||||
"punch"
|
"punch"
|
||||||
]
|
]
|
||||||
|
// No secondary effect
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "bullet_seed",
|
"name": "bullet_seed",
|
||||||
@ -1484,6 +1502,7 @@
|
|||||||
"flags": [
|
"flags": [
|
||||||
"contact"
|
"contact"
|
||||||
]
|
]
|
||||||
|
// No secondary effect
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "celebrate",
|
"name": "celebrate",
|
||||||
@ -1823,6 +1842,7 @@
|
|||||||
"target": "Any",
|
"target": "Any",
|
||||||
"category": "physical",
|
"category": "physical",
|
||||||
"flags": []
|
"flags": []
|
||||||
|
// No secondary effect
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "continental_crush__special",
|
"name": "continental_crush__special",
|
||||||
@ -1834,6 +1854,7 @@
|
|||||||
"target": "Any",
|
"target": "Any",
|
||||||
"category": "special",
|
"category": "special",
|
||||||
"flags": []
|
"flags": []
|
||||||
|
// No secondary effect
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "conversion",
|
"name": "conversion",
|
||||||
@ -1908,6 +1929,7 @@
|
|||||||
"target": "Any",
|
"target": "Any",
|
||||||
"category": "physical",
|
"category": "physical",
|
||||||
"flags": []
|
"flags": []
|
||||||
|
// No secondary effect
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "corkscrew_crash__special",
|
"name": "corkscrew_crash__special",
|
||||||
@ -1919,6 +1941,7 @@
|
|||||||
"target": "Any",
|
"target": "Any",
|
||||||
"category": "special",
|
"category": "special",
|
||||||
"flags": []
|
"flags": []
|
||||||
|
// No secondary effect
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "cosmic_power",
|
"name": "cosmic_power",
|
||||||
@ -2029,7 +2052,10 @@
|
|||||||
"contact",
|
"contact",
|
||||||
"protect",
|
"protect",
|
||||||
"mirror"
|
"mirror"
|
||||||
]
|
],
|
||||||
|
"effect": {
|
||||||
|
"name": "increased_critical_stage"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "crafty_shield",
|
"name": "crafty_shield",
|
||||||
@ -2058,7 +2084,10 @@
|
|||||||
"contact",
|
"contact",
|
||||||
"protect",
|
"protect",
|
||||||
"mirror"
|
"mirror"
|
||||||
]
|
],
|
||||||
|
"effect": {
|
||||||
|
"name": "increased_critical_stage"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "cross_poison",
|
"name": "cross_poison",
|
||||||
@ -2175,6 +2204,7 @@
|
|||||||
"protect",
|
"protect",
|
||||||
"mirror"
|
"mirror"
|
||||||
]
|
]
|
||||||
|
// No secondary effect
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "dark_pulse",
|
"name": "dark_pulse",
|
||||||
@ -2248,6 +2278,7 @@
|
|||||||
"protect",
|
"protect",
|
||||||
"mirror"
|
"mirror"
|
||||||
]
|
]
|
||||||
|
// No secondary effect
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "defend_order",
|
"name": "defend_order",
|
||||||
@ -2347,6 +2378,7 @@
|
|||||||
"target": "Any",
|
"target": "Any",
|
||||||
"category": "physical",
|
"category": "physical",
|
||||||
"flags": []
|
"flags": []
|
||||||
|
// No secondary effect
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "devastating_drake__special",
|
"name": "devastating_drake__special",
|
||||||
@ -2358,6 +2390,7 @@
|
|||||||
"target": "Any",
|
"target": "Any",
|
||||||
"category": "special",
|
"category": "special",
|
||||||
"flags": []
|
"flags": []
|
||||||
|
// No secondary effect
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "diamond_storm",
|
"name": "diamond_storm",
|
||||||
@ -2425,7 +2458,7 @@
|
|||||||
"type": "fairy",
|
"type": "fairy",
|
||||||
"power": 40,
|
"power": 40,
|
||||||
"pp": 15,
|
"pp": 15,
|
||||||
"accuracy": 0,
|
"accuracy": 255,
|
||||||
"priority": 0,
|
"priority": 0,
|
||||||
"target": "AllOpponent",
|
"target": "AllOpponent",
|
||||||
"category": "special",
|
"category": "special",
|
||||||
@ -2435,6 +2468,7 @@
|
|||||||
"sound",
|
"sound",
|
||||||
"ignore-substitute"
|
"ignore-substitute"
|
||||||
]
|
]
|
||||||
|
// No secondary effect
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "discharge",
|
"name": "discharge",
|
||||||
@ -2683,6 +2717,7 @@
|
|||||||
"protect",
|
"protect",
|
||||||
"mirror"
|
"mirror"
|
||||||
]
|
]
|
||||||
|
// No secondary effect
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "dragon_dance",
|
"name": "dragon_dance",
|
||||||
@ -2719,6 +2754,7 @@
|
|||||||
"protect",
|
"protect",
|
||||||
"mirror"
|
"mirror"
|
||||||
]
|
]
|
||||||
|
// No secondary effect
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "dragon_pulse",
|
"name": "dragon_pulse",
|
||||||
@ -2735,6 +2771,7 @@
|
|||||||
"distance",
|
"distance",
|
||||||
"pulse"
|
"pulse"
|
||||||
]
|
]
|
||||||
|
// No secondary effect
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "dragon_rage",
|
"name": "dragon_rage",
|
||||||
@ -2871,6 +2908,7 @@
|
|||||||
"mirror",
|
"mirror",
|
||||||
"distance"
|
"distance"
|
||||||
]
|
]
|
||||||
|
// No secondary effect
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "drill_run",
|
"name": "drill_run",
|
||||||
@ -2885,7 +2923,10 @@
|
|||||||
"contact",
|
"contact",
|
||||||
"protect",
|
"protect",
|
||||||
"mirror"
|
"mirror"
|
||||||
]
|
],
|
||||||
|
"effect": {
|
||||||
|
"name": "increased_critical_stage"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "dual_chop",
|
"name": "dual_chop",
|
||||||
@ -2962,6 +3003,7 @@
|
|||||||
"hit_underground",
|
"hit_underground",
|
||||||
"effective_against_underground"
|
"effective_against_underground"
|
||||||
]
|
]
|
||||||
|
// No secondary effect
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "echoed_voice",
|
"name": "echoed_voice",
|
||||||
@ -3017,6 +3059,7 @@
|
|||||||
"mirror",
|
"mirror",
|
||||||
"ballistics"
|
"ballistics"
|
||||||
]
|
]
|
||||||
|
// No secondary effect
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "electric_terrain",
|
"name": "electric_terrain",
|
||||||
@ -3304,6 +3347,7 @@
|
|||||||
"protect",
|
"protect",
|
||||||
"mirror"
|
"mirror"
|
||||||
]
|
]
|
||||||
|
// No secondary effect
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "facade",
|
"name": "facade",
|
||||||
@ -3353,6 +3397,7 @@
|
|||||||
"protect",
|
"protect",
|
||||||
"mirror"
|
"mirror"
|
||||||
]
|
]
|
||||||
|
// No secondary effect
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "fake_out",
|
"name": "fake_out",
|
||||||
@ -3444,14 +3489,17 @@
|
|||||||
"category": "physical",
|
"category": "physical",
|
||||||
"flags": [
|
"flags": [
|
||||||
"mirror"
|
"mirror"
|
||||||
]
|
],
|
||||||
|
"effect": {
|
||||||
|
"name": "feint"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "feint_attack",
|
"name": "feint_attack",
|
||||||
"type": "dark",
|
"type": "dark",
|
||||||
"power": 60,
|
"power": 60,
|
||||||
"pp": 20,
|
"pp": 20,
|
||||||
"accuracy": 0,
|
"accuracy": 255,
|
||||||
"priority": 0,
|
"priority": 0,
|
||||||
"target": "Any",
|
"target": "Any",
|
||||||
"category": "physical",
|
"category": "physical",
|
||||||
@ -3460,6 +3508,7 @@
|
|||||||
"protect",
|
"protect",
|
||||||
"mirror"
|
"mirror"
|
||||||
]
|
]
|
||||||
|
// No secondary effect
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "fell_stinger",
|
"name": "fell_stinger",
|
||||||
@ -4436,6 +4485,7 @@
|
|||||||
"target": "Any",
|
"target": "Any",
|
||||||
"category": "physical",
|
"category": "physical",
|
||||||
"flags": []
|
"flags": []
|
||||||
|
// No secondary effect
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "gigavolt_havoc__special",
|
"name": "gigavolt_havoc__special",
|
||||||
@ -4447,6 +4497,7 @@
|
|||||||
"target": "Any",
|
"target": "Any",
|
||||||
"category": "special",
|
"category": "special",
|
||||||
"flags": []
|
"flags": []
|
||||||
|
// No secondary effect
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "glaciate",
|
"name": "glaciate",
|
||||||
@ -4652,7 +4703,10 @@
|
|||||||
"category": "status",
|
"category": "status",
|
||||||
"flags": [
|
"flags": [
|
||||||
"protect"
|
"protect"
|
||||||
]
|
],
|
||||||
|
"effect": {
|
||||||
|
"name": "guard_split"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "guard_swap",
|
"name": "guard_swap",
|
||||||
@ -4741,6 +4795,7 @@
|
|||||||
"hit_flying",
|
"hit_flying",
|
||||||
"effective_against_fly"
|
"effective_against_fly"
|
||||||
]
|
]
|
||||||
|
// No secondary effect
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "gyro_ball",
|
"name": "gyro_ball",
|
||||||
@ -4809,8 +4864,10 @@
|
|||||||
"priority": 0,
|
"priority": 0,
|
||||||
"target": "AllAlly",
|
"target": "AllAlly",
|
||||||
"category": "status",
|
"category": "status",
|
||||||
"flags": []
|
"flags": [],
|
||||||
// TODO: Add effect
|
"effect": {
|
||||||
|
"name": "happy_hour"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "harden",
|
"name": "harden",
|
||||||
@ -5217,7 +5274,7 @@
|
|||||||
"flags": [
|
"flags": [
|
||||||
"ignore-substitute"
|
"ignore-substitute"
|
||||||
]
|
]
|
||||||
// Does nothing
|
// No secondary effect
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "hone_claws",
|
"name": "hone_claws",
|
||||||
@ -5376,6 +5433,7 @@
|
|||||||
"target": "Any",
|
"target": "Any",
|
||||||
"category": "physical",
|
"category": "physical",
|
||||||
"flags": []
|
"flags": []
|
||||||
|
// No secondary effect
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "hydro_vortex__special",
|
"name": "hydro_vortex__special",
|
||||||
@ -5387,6 +5445,7 @@
|
|||||||
"target": "Any",
|
"target": "Any",
|
||||||
"category": "special",
|
"category": "special",
|
||||||
"flags": []
|
"flags": []
|
||||||
|
// No secondary effect
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "hyper_beam",
|
"name": "hyper_beam",
|
||||||
@ -5757,6 +5816,7 @@
|
|||||||
"target": "Any",
|
"target": "Any",
|
||||||
"category": "physical",
|
"category": "physical",
|
||||||
"flags": []
|
"flags": []
|
||||||
|
// No secondary effect
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "inferno_overdrive__special",
|
"name": "inferno_overdrive__special",
|
||||||
@ -5768,6 +5828,7 @@
|
|||||||
"target": "Any",
|
"target": "Any",
|
||||||
"category": "special",
|
"category": "special",
|
||||||
"flags": []
|
"flags": []
|
||||||
|
// No secondary effect
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "infestation",
|
"name": "infestation",
|
||||||
@ -6565,7 +6626,10 @@
|
|||||||
"snatch",
|
"snatch",
|
||||||
"distance",
|
"distance",
|
||||||
"ignore-substitute"
|
"ignore-substitute"
|
||||||
]
|
],
|
||||||
|
"effect": {
|
||||||
|
"name": "magnetic_flux"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "magnitude",
|
"name": "magnitude",
|
||||||
@ -9238,7 +9302,10 @@
|
|||||||
"mirror",
|
"mirror",
|
||||||
"sound",
|
"sound",
|
||||||
"ignore-substitute"
|
"ignore-substitute"
|
||||||
]
|
],
|
||||||
|
"effect": {
|
||||||
|
"name": "round"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "sacred_fire",
|
"name": "sacred_fire",
|
||||||
@ -12232,7 +12299,10 @@
|
|||||||
"mirror",
|
"mirror",
|
||||||
"sound",
|
"sound",
|
||||||
"ignore-substitute"
|
"ignore-substitute"
|
||||||
]
|
],
|
||||||
|
"effect": {
|
||||||
|
"name": "uproar"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "v_create",
|
"name": "v_create",
|
||||||
|
53
Plugins/PkmnLib.Plugin.Gen7/Scripts/Battle/UproarEffect.cs
Normal file
53
Plugins/PkmnLib.Plugin.Gen7/Scripts/Battle/UproarEffect.cs
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
using PkmnLib.Static.Utils;
|
||||||
|
|
||||||
|
namespace PkmnLib.Plugin.Gen7.Scripts.Battle;
|
||||||
|
|
||||||
|
[Script(ScriptCategory.Battle, "uproar_effect")]
|
||||||
|
public class UproarEffect : Script
|
||||||
|
{
|
||||||
|
private IPokemon? _placer;
|
||||||
|
private bool _hasUsedUproar;
|
||||||
|
private int _turns = 3;
|
||||||
|
|
||||||
|
public void SetPlacer(IPokemon placer)
|
||||||
|
{
|
||||||
|
_placer = placer;
|
||||||
|
_hasUsedUproar = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override void PreventStatusChange(IPokemon pokemonImpl, StringKey status, ref bool preventStatus)
|
||||||
|
{
|
||||||
|
if (status == ScriptUtils.ResolveName<Status.Sleep>())
|
||||||
|
{
|
||||||
|
preventStatus = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override void OnBeforeTurnStart(ITurnChoice choice)
|
||||||
|
{
|
||||||
|
_hasUsedUproar = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||||
|
{
|
||||||
|
if (move.User == _placer && move.UseMove.Name == "uproar")
|
||||||
|
_hasUsedUproar = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override void OnEndTurn(IBattle battle)
|
||||||
|
{
|
||||||
|
if (!_hasUsedUproar)
|
||||||
|
{
|
||||||
|
RemoveSelf();
|
||||||
|
}
|
||||||
|
_turns--;
|
||||||
|
if (_turns <= 0)
|
||||||
|
{
|
||||||
|
RemoveSelf();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
16
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/Feint.cs
Normal file
16
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/Feint.cs
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||||
|
|
||||||
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
|
||||||
|
[Script(ScriptCategory.Move, "feint")]
|
||||||
|
public class Feint : Script
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override void OnBeforeHit(IExecutingMove move, IPokemon target, byte hitIndex)
|
||||||
|
{
|
||||||
|
if (target.Volatile.Contains<ProtectionEffectScript>())
|
||||||
|
{
|
||||||
|
target.Volatile.Remove<ProtectionEffectScript>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
7
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/HappyHour.cs
Normal file
7
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/HappyHour.cs
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
|
||||||
|
[Script(ScriptCategory.Move, "happy_hour")]
|
||||||
|
public class HappyHour : Script
|
||||||
|
{
|
||||||
|
// TODO: Implement Happy Hour
|
||||||
|
}
|
@ -8,10 +8,7 @@ public class IncreasedCriticalStage : Script
|
|||||||
{
|
{
|
||||||
// Extreme edge case, should never happen
|
// Extreme edge case, should never happen
|
||||||
if (stage == byte.MaxValue)
|
if (stage == byte.MaxValue)
|
||||||
{
|
|
||||||
move.GetHitData(target, hit).Fail();
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
stage += 1;
|
stage += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
25
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/MagneticFlux.cs
Normal file
25
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/MagneticFlux.cs
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
using PkmnLib.Static.Utils;
|
||||||
|
|
||||||
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
|
||||||
|
[Script(ScriptCategory.Move, "magnetic_flux")]
|
||||||
|
public class MagneticFlux : Script
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||||
|
{
|
||||||
|
var battleData = move.User.BattleData;
|
||||||
|
if (battleData is null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
foreach (var pokemon in battleData.BattleSide.Pokemon.WhereNotNull())
|
||||||
|
{
|
||||||
|
if (pokemon.ActiveAbility?.Name != "plus" && pokemon.ActiveAbility?.Name != "minus")
|
||||||
|
continue;
|
||||||
|
|
||||||
|
EventBatchId batch = new();
|
||||||
|
pokemon.ChangeStatBoost(Statistic.Defense, 1, pokemon == move.User, batch);
|
||||||
|
pokemon.ChangeStatBoost(Statistic.SpecialDefense, 1, pokemon == move.User, batch);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
27
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/Uproar.cs
Normal file
27
Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/Uproar.cs
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
using PkmnLib.Plugin.Gen7.Scripts.Battle;
|
||||||
|
using PkmnLib.Static.Utils;
|
||||||
|
|
||||||
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||||
|
|
||||||
|
[Script(ScriptCategory.Move, "uproar")]
|
||||||
|
public class Uproar : Script
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||||
|
{
|
||||||
|
var battle = move.Battle;
|
||||||
|
|
||||||
|
foreach (var pokemon in battle.Sides.SelectMany(x => x.Pokemon).WhereNotNull())
|
||||||
|
{
|
||||||
|
if (pokemon.HasStatus(ScriptUtils.ResolveName<Status.Sleep>()))
|
||||||
|
{
|
||||||
|
pokemon.ClearStatus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var script = battle.Volatile.Add(new UproarEffect());
|
||||||
|
if (script?.Script is UproarEffect uproarEffect)
|
||||||
|
{
|
||||||
|
uproarEffect.SetPlacer(move.User);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -2,6 +2,7 @@ using PkmnLib.Static.Moves;
|
|||||||
|
|
||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||||
|
|
||||||
|
[Script(ScriptCategory.Pokemon, "baneful_bunker")]
|
||||||
public class BanefulBunkerEffect : ProtectionEffectScript
|
public class BanefulBunkerEffect : ProtectionEffectScript
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||||
|
|
||||||
|
[Script(ScriptCategory.Pokemon, "protect")]
|
||||||
public class ProtectionEffectScript : Script
|
public class ProtectionEffectScript : Script
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||||
|
|
||||||
|
[Script(ScriptCategory.Pokemon, "spiky_shield")]
|
||||||
public class SpikyShieldEffect : ProtectionEffectScript
|
public class SpikyShieldEffect : ProtectionEffectScript
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
|
Loading…
x
Reference in New Issue
Block a user