diff --git a/Moves.json b/Moves.json index 9fabba9..5230200 100644 --- a/Moves.json +++ b/Moves.json @@ -363,7 +363,10 @@ "priority": 0, "target": "AdjacentAllySelf", "category": "status", - "flags": ["snatch", "distance"] + "flags": ["snatch", "distance"], + "effect": { + "name": "CurePartyStatus" + } }, { "name": "aromatic_mist", @@ -374,7 +377,11 @@ "priority": 0, "target": "AdjacentAlly", "category": "status", - "flags": ["ignore-substitute"] + "flags": ["ignore-substitute"], + "effect": { + "name": "ChangeTargetSpDef", + "parameters": [1] + } }, { "name": "assist", @@ -385,7 +392,10 @@ "priority": 0, "target": "Self", "category": "status", - "flags": [] + "flags": [], + "effect": { + "name": "Assist" + } }, { "name": "assurance", diff --git a/Scripts/Interfaces/Battle.as b/Scripts/Interfaces/Battle.as index 4c04820..394436c 100644 --- a/Scripts/Interfaces/Battle.as +++ b/Scripts/Interfaces/Battle.as @@ -10,4 +10,6 @@ shared interface Battle { void ClearWeather(const constString &in name) const; const constString& GetWeatherName() const; BattleSide@ GetBattleSide(uint8 index); + BattleParty@ GetParty(uint8 index); + BattleParty@ FindPartyForPokemon(Pokemon@ pokemon); } diff --git a/Scripts/Interfaces/BattleParty.as b/Scripts/Interfaces/BattleParty.as new file mode 100644 index 0000000..a784edd --- /dev/null +++ b/Scripts/Interfaces/BattleParty.as @@ -0,0 +1,3 @@ +shared interface BattleParty { + Party@ Party { get const; } +} diff --git a/Scripts/Interfaces/ExecutingMove.as b/Scripts/Interfaces/ExecutingMove.as index 8021173..ab03631 100644 --- a/Scripts/Interfaces/ExecutingMove.as +++ b/Scripts/Interfaces/ExecutingMove.as @@ -3,4 +3,5 @@ shared interface ExecutingMove { bool IsPokemonTarget(Pokemon@ pkmn) const; Pokemon@ User { get const; } LearnedMove@ Move { get const; } + MoveData@ UseMove { get const; } } diff --git a/Scripts/Interfaces/MoveTurnChoice.as b/Scripts/Interfaces/MoveTurnChoice.as index 8b84f75..8716d38 100644 --- a/Scripts/Interfaces/MoveTurnChoice.as +++ b/Scripts/Interfaces/MoveTurnChoice.as @@ -1,6 +1,6 @@ shared interface MoveTurnChoice { TurnChoiceKind Kind { get const; } - const Pokemon@ User { get const; } + Pokemon@ User { get const; } LearnedMove@ Move { get const; } int8 Priority { get const; } BaseTurnChoice@ opImplCast(); diff --git a/Scripts/Interfaces/Party.as b/Scripts/Interfaces/Party.as new file mode 100644 index 0000000..9d8f3a7 --- /dev/null +++ b/Scripts/Interfaces/Party.as @@ -0,0 +1,4 @@ +shared interface Party { + Pokemon@ GetAtIndex(int index) const; + int Length { get const; } +} diff --git a/Scripts/Interfaces/Pokemon.as b/Scripts/Interfaces/Pokemon.as index 6efeb9a..7572c69 100644 --- a/Scripts/Interfaces/Pokemon.as +++ b/Scripts/Interfaces/Pokemon.as @@ -31,4 +31,7 @@ shared interface Pokemon { void RemoveVolatile(const constString &in name) const; Battle@ Battle { get const; } BattleSide@ BattleSide { get const; } + const constString& Status { get const; } + void ClearStatus() const; + void SetStatus(const constString &inout name); } diff --git a/Scripts/Moves/Assist.as b/Scripts/Moves/Assist.as new file mode 100644 index 0000000..4c2ab16 --- /dev/null +++ b/Scripts/Moves/Assist.as @@ -0,0 +1,31 @@ +#include "Utilities/CopyableMoves.as" + +namespace Gen7 { + [Move effect=Assist] + class Assist : PkmnScript { + void ChangeAttack(MoveTurnChoice@ move, constString &inout moveName) override { + auto user = move.User; + auto battle = user.Battle; + auto party = battle.FindPartyForPokemon(user).Party; + array possibleMoves; + for (int i = 0; i < party.Length; i++){ + auto mon = party.GetAtIndex(i); + if (mon is null){ continue; } + auto moves = mon.GetMoves(); + for (uint j = 0; j < moves.length; j++){ + auto m = moves[j]; + if (m is null){ continue; } + if (CanCopyMove(m.MoveData)){ + possibleMoves.insertLast(m.MoveData); + } + } + } + if (possibleMoves.length == 0){ + // TODO: Log failure. + return; + } + auto i = battle.Random.Get(possibleMoves.length); + moveName = possibleMoves[i].Name; + } + } +} \ No newline at end of file diff --git a/Scripts/Moves/CurePartyStatus.as b/Scripts/Moves/CurePartyStatus.as new file mode 100644 index 0000000..22040e4 --- /dev/null +++ b/Scripts/Moves/CurePartyStatus.as @@ -0,0 +1,20 @@ +namespace Gen7 { + [Move effect=CurePartyStatus] + shared class CurePartyStatus : PkmnScript{ + void OnSecondaryEffect(ExecutingMove@ attack, Pokemon@ target, uint8 hit) override { + auto user = attack.User; + user.ClearStatus(); + + auto battleParty = user.Battle.FindPartyForPokemon(user); + if (battleParty !is null){ + auto party = battleParty.Party; + for (int i = 0; i < party.Length; i++){ + auto m = party.GetAtIndex(i); + if (m !is null){ + m.ClearStatus(); + } + } + } + } + } +} \ No newline at end of file diff --git a/Scripts/Utilities/CopyableMoves.as b/Scripts/Utilities/CopyableMoves.as new file mode 100644 index 0000000..526d441 --- /dev/null +++ b/Scripts/Utilities/CopyableMoves.as @@ -0,0 +1,58 @@ +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); + } +} \ No newline at end of file