From 12765c5e6990cdbd1158ae902e8df5a344066165 Mon Sep 17 00:00:00 2001 From: Deukhoofd Date: Sun, 29 Aug 2021 11:51:04 +0200 Subject: [PATCH] Puts Copyable Moves in its own namespace for clarity, began working on assist unit tests --- Scripts/Moves/Assist.as | 16 ++++- Scripts/Utilities/CopyableMoves.as | 112 +++++++++++++++-------------- 2 files changed, 71 insertions(+), 57 deletions(-) diff --git a/Scripts/Moves/Assist.as b/Scripts/Moves/Assist.as index 4c2ab16..bf6b1bd 100644 --- a/Scripts/Moves/Assist.as +++ b/Scripts/Moves/Assist.as @@ -15,7 +15,7 @@ namespace Gen7 { for (uint j = 0; j < moves.length; j++){ auto m = moves[j]; if (m is null){ continue; } - if (CanCopyMove(m.MoveData)){ + if (CopyableMoves::CanCopyMove(m.MoveData)){ possibleMoves.insertLast(m.MoveData); } } @@ -28,4 +28,16 @@ namespace Gen7 { moveName = possibleMoves[i].Name; } } -} \ No newline at end of file +} + +#if TESTS +[Test name="Assist: Switch move to known move from party member"] +void Assist_ChangesMove(){ + auto p1 = CreateSimpleParty({"charizard", "blastoise"}, 100); + auto p2 = CreateSimpleParty({"venusaur", "pikachu"}, 100); + + auto battle = CreateSimpleBattle(684, p1, p2); + +} + +#endif \ No newline at end of file diff --git a/Scripts/Utilities/CopyableMoves.as b/Scripts/Utilities/CopyableMoves.as index 526d441..125ea82 100644 --- a/Scripts/Utilities/CopyableMoves.as +++ b/Scripts/Utilities/CopyableMoves.as @@ -1,58 +1,60 @@ namespace Gen7 { - dictionary _nonCopyableMoves = { - {"assist", true}, - {"baneful_bunker", true}, - {"beak_blast", true}, - {"belch", true}, - {"bestow", true}, - {"bounce", true}, - {"celebrate", true}, - {"chatter", true}, - {"circle_throw", true}, - {"copycat", true}, - {"counter", true}, - {"covet", true}, - {"destiny_bond", true}, - {"detect", true}, - {"dig", true}, - {"dive", true}, - {"dragon_tail", true}, - {"endure", true}, - {"feint", true}, - {"fly", true}, - {"focus_punch", true}, - {"follow_me", true}, - {"helping_hand", true}, - {"hold_hands", true}, - {"kings_shield", true}, - {"mat_block", true}, - {"me_first", true}, - {"metronome", true}, - {"mimic", true}, - {"mirror_coat", true}, - {"mirror_move", true}, - {"nature_power", true}, - {"phantom_force", true}, - {"protect", true}, - {"rage_powder", true}, - {"roar", true}, - {"shadow_force", true}, - {"shell_trap", true}, - {"sketch", true}, - {"sky_drop", true}, - {"sleep_talk", true}, - {"snatch", true}, - {"spiky_shield", true}, - {"spotlight", true}, - {"struggle", true}, - {"switcheroo", true}, - {"thief", true}, - {"transform", true}, - {"trick", true}, - {"whirlwind", true} - }; - - bool CanCopyMove(const MoveData@ move){ - return !_nonCopyableMoves.exists(move.Name); + namespace CopyableMoves{ + dictionary _nonCopyableMoves = { + {"assist", true}, + {"baneful_bunker", true}, + {"beak_blast", true}, + {"belch", true}, + {"bestow", true}, + {"bounce", true}, + {"celebrate", true}, + {"chatter", true}, + {"circle_throw", true}, + {"copycat", true}, + {"counter", true}, + {"covet", true}, + {"destiny_bond", true}, + {"detect", true}, + {"dig", true}, + {"dive", true}, + {"dragon_tail", true}, + {"endure", true}, + {"feint", true}, + {"fly", true}, + {"focus_punch", true}, + {"follow_me", true}, + {"helping_hand", true}, + {"hold_hands", true}, + {"kings_shield", true}, + {"mat_block", true}, + {"me_first", true}, + {"metronome", true}, + {"mimic", true}, + {"mirror_coat", true}, + {"mirror_move", true}, + {"nature_power", true}, + {"phantom_force", true}, + {"protect", true}, + {"rage_powder", true}, + {"roar", true}, + {"shadow_force", true}, + {"shell_trap", true}, + {"sketch", true}, + {"sky_drop", true}, + {"sleep_talk", true}, + {"snatch", true}, + {"spiky_shield", true}, + {"spotlight", true}, + {"struggle", true}, + {"switcheroo", true}, + {"thief", true}, + {"transform", true}, + {"trick", true}, + {"whirlwind", true} + }; + + bool CanCopyMove(const MoveData@ move){ + return !_nonCopyableMoves.exists(move.Name); + } } } \ No newline at end of file