Implements several new move scripts.

This commit is contained in:
Deukhoofd 2021-05-13 14:32:56 +02:00
parent 76f62d6c2d
commit 5071f309f3
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
10 changed files with 136 additions and 4 deletions

View File

@ -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",

View File

@ -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);
}

View File

@ -0,0 +1,3 @@
shared interface BattleParty {
Party@ Party { get const; }
}

View File

@ -3,4 +3,5 @@ shared interface ExecutingMove {
bool IsPokemonTarget(Pokemon@ pkmn) const;
Pokemon@ User { get const; }
LearnedMove@ Move { get const; }
MoveData@ UseMove { get const; }
}

View File

@ -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();

View File

@ -0,0 +1,4 @@
shared interface Party {
Pokemon@ GetAtIndex(int index) const;
int Length { get const; }
}

View File

@ -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);
}

31
Scripts/Moves/Assist.as Normal file
View File

@ -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<const MoveData@> 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;
}
}
}

View File

@ -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();
}
}
}
}
}
}

View File

@ -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);
}
}