Update Healing wish to gen5 / gen8 mechanics (#2708)

* Updated Healing Wish and added config
* Fixed Lunar Dance message

Co-authored-by: AgustinGDLV <agustingomezdelavega@gmail.com>
Co-authored-by: AgustinGDLV <103095241+AgustinGDLV@users.noreply.github.com>
Co-authored-by: Martin Griffin <martinrgriffin@gmail.com>
This commit is contained in:
DizzyEggg 2023-02-20 12:25:43 +01:00 committed by GitHub
parent 2581f91353
commit 53180ebf87
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 133 additions and 7 deletions

View File

@ -1322,6 +1322,11 @@
.macro cancelmultiturnmoves battler:req
various \battler, VARIOUS_CANCEL_MULTI_TURN_MOVES
.endm
@ Stores Healing Wish effect.
.macro storehealingwish battler:req
various \battler, VARIOUS_STORE_HEALING_WISH
.endm
.macro setmagiccoattarget battler:req
various \battler, VARIOUS_SET_MAGIC_COAT_TARGET

View File

@ -2697,6 +2697,8 @@ BattleScript_EffectHealingWish:
instanthpdrop BS_ATTACKER
setatkhptozero
tryfaintmon BS_ATTACKER
storehealingwish BS_ATTACKER
.if B_HEALING_WISH_SWITCH <= GEN_4
openpartyscreen BS_ATTACKER, BattleScript_EffectHealingWishEnd
switchoutabilities BS_ATTACKER
waitstate
@ -2711,11 +2713,19 @@ BattleScript_EffectHealingWish:
printstring STRINGID_SWITCHINMON
switchinanim BS_ATTACKER, TRUE
waitstate
switchineffects BS_ATTACKER
.endif
BattleScript_EffectHealingWishEnd:
moveendall
end
BattleScript_HealingWishActivates::
setbyte cMULTISTRING_CHOOSER, 0
jumpifnotchosenmove MOVE_LUNAR_DANCE, BattleScript_EffectHealingWishNewMon
goto BattleScript_EffectHealingWishRestore
BattleScript_LunarDanceActivates::
setbyte cMULTISTRING_CHOOSER, 1
restorepp BS_ATTACKER
BattleScript_EffectHealingWishNewMon:
BattleScript_EffectHealingWishRestore:
printfromtable gHealingWishStringIds
waitmessage B_WAIT_TIME_LONG
playanimation BS_ATTACKER, B_ANIM_WISH_HEAL
@ -2730,10 +2740,7 @@ BattleScript_EffectHealingWishNewMon:
waitstate
printstring STRINGID_HEALINGWISHHEALED
waitmessage B_WAIT_TIME_LONG
switchineffects BS_ATTACKER
BattleScript_EffectHealingWishEnd:
moveendall
end
return
BattleScript_EffectWorrySeed:
attackcanceler

View File

@ -655,6 +655,8 @@ struct BattleStruct
u16 overwrittenAbilities[MAX_BATTLERS_COUNT]; // abilities overwritten during battle (keep separate from battle history in case of switching)
bool8 allowedToChangeFormInWeather[PARTY_SIZE][2]; // For each party member and side, used by Ice Face.
u8 battleBondTransformed[NUM_BATTLE_SIDES]; // Bitfield for each party.
u8 storedHealingWish:4; // Each battler as a bit.
u8 storedLunarDance:4; // Each battler as a bit.
};
#define F_DYNAMIC_TYPE_1 (1 << 6)

View File

@ -452,6 +452,8 @@ extern const u8 BattleScript_MimicryActivates_End3[];
extern const u8 BattleScript_IceFaceNullsDamage[];
extern const u8 BattleScript_BattlerFormChangeWithStringEnd3[];
extern const u8 BattleScript_DampPreventsAftermath[];
extern const u8 BattleScript_HealingWishActivates[];
extern const u8 BattleScript_LunarDanceActivates[];
// zmoves
extern const u8 BattleScript_ZMoveActivateDamaging[];

View File

@ -95,6 +95,8 @@
#define B_BEAT_UP GEN_LATEST // In Gen5+, Beat Up uses a different formula to calculate its damage, and deals Dark-type damage. Prior to Gen 5, each hit also announces the party member's name.
#define B_DARK_VOID_FAIL GEN_LATEST // In Gen7+, only Darkrai can use Dark Void.
#define B_BURN_HIT_THAW GEN_LATEST // In Gen6+, damaging moves with a chance of burn will thaw the target, regardless if they're fire-type moves or not.
#define B_HEALING_WISH_SWITCH GEN_LATEST // In Gen5+, the mon receiving Healing Wish is sent out at the end of the turn.
// Additionally, in gen8+ the Healing Wish's effect will be stored until the user switches into a statused or hurt mon.
// Ability settings
#define B_EXPANDED_ABILITY_NAMES TRUE // If TRUE, ability names are increased from 12 characters to 16 characters.

View File

@ -257,6 +257,7 @@
#define VARIOUS_ACTIVATE_TERRAIN_CHANGE_ABILITIES 165
#define VARIOUS_JUMP_IF_NO_VALID_TARGETS 166
#define VARIOUS_JUMP_IF_EMERGENCY_EXITED 167
#define VARIOUS_STORE_HEALING_WISH 168
// Cmd_manipulatedamage
#define DMG_CHANGE_SIGN 0

View File

@ -6924,6 +6924,24 @@ static void Cmd_switchineffects(void)
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_SwitchInAbilityMsgRet;
}
// Healing Wish activates before hazards.
// Starting from Gen8 - it heals only pokemon which can be healed. In gens 5,6,7 the effect activates anyways.
else if (((gBattleStruct->storedHealingWish & gBitTable[gActiveBattler]) || (gBattleStruct->storedLunarDance & gBitTable[gActiveBattler]))
&& (gBattleMons[gActiveBattler].hp != gBattleMons[gActiveBattler].maxHP || gBattleMons[gActiveBattler].status1 != 0 || B_HEALING_WISH_SWITCH < GEN_8))
{
if (gBattleStruct->storedHealingWish & gBitTable[gActiveBattler])
{
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_HealingWishActivates;
gBattleStruct->storedHealingWish &= ~(gBitTable[gActiveBattler]);
}
else // Lunar Dance
{
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_LunarDanceActivates;
gBattleStruct->storedLunarDance &= ~(gBitTable[gActiveBattler]);
}
}
else if (!(gSideStatuses[GetBattlerSide(gActiveBattler)] & SIDE_STATUS_SPIKES_DAMAGED)
&& (gSideStatuses[GetBattlerSide(gActiveBattler)] & SIDE_STATUS_SPIKES)
&& GetBattlerAbility(gActiveBattler) != ABILITY_MAGIC_GUARD
@ -11040,6 +11058,15 @@ static void Cmd_various(void)
gBattlescriptCurrInstr = cmd->nextInstr;
return;
}
case VARIOUS_STORE_HEALING_WISH:
{
VARIOUS_ARGS();
if (gCurrentMove == MOVE_LUNAR_DANCE)
gBattleStruct->storedLunarDance |= gBitTable[gActiveBattler];
else
gBattleStruct->storedHealingWish |= gBitTable[gActiveBattler];
break;
}
} // End of switch (cmd->id)
gBattlescriptCurrInstr = cmd->nextInstr;

View File

@ -0,0 +1,80 @@
#include "global.h"
#include "test_battle.h"
ASSUMPTIONS
{
ASSUME(gBattleMoves[MOVE_HEALING_WISH].effect == EFFECT_HEALING_WISH);
ASSUME(gBattleMoves[MOVE_LUNAR_DANCE].effect == EFFECT_HEALING_WISH);
}
#define TEST_MAX_HP (100)
SINGLE_BATTLE_TEST("Healing Wish causes the user to faint and fully heals the replacement")
{
GIVEN {
ASSUME(B_HEALING_WISH_SWITCH >= GEN_5);
PLAYER(SPECIES_GARDEVOIR);
PLAYER(SPECIES_WYNAUT) { HP(1); MaxHP(TEST_MAX_HP); Status1(STATUS1_POISON); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_HEALING_WISH); SEND_OUT(player, 1); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_HEALING_WISH, player);
HP_BAR(player, hp: 0);
MESSAGE("Gardevoir fainted!");
MESSAGE("The healing wish came true for Wynaut!");
HP_BAR(player, hp: TEST_MAX_HP);
STATUS_ICON(player, none: TRUE);
MESSAGE("Wynaut regained health!");
}
}
DOUBLE_BATTLE_TEST("Lunar Dance causes the user to faint and fully heals the replacement in a double battle")
{
GIVEN {
ASSUME(B_HEALING_WISH_SWITCH >= GEN_5);
PLAYER(SPECIES_GARDEVOIR) { Speed(300); }
PLAYER(SPECIES_WOBBUFFET) { Speed(50); }
PLAYER(SPECIES_WYNAUT) { HP(TEST_MAX_HP - 1); MaxHP(TEST_MAX_HP); Status1(STATUS1_BURN); Speed(50); }
OPPONENT(SPECIES_WOBBUFFET) { Speed(50); }
OPPONENT(SPECIES_WOBBUFFET) { Speed(50); }
} WHEN {
TURN { MOVE(playerLeft, MOVE_LUNAR_DANCE); SEND_OUT(playerLeft, 2); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_LUNAR_DANCE, playerLeft);
HP_BAR(playerLeft, hp: 0);
MESSAGE("Gardevoir fainted!");
MESSAGE("Wynaut became cloaked in mystical moonlight!");
HP_BAR(playerLeft, hp: TEST_MAX_HP);
STATUS_ICON(playerLeft, none: TRUE);
MESSAGE("Wynaut regained health!");
}
}
SINGLE_BATTLE_TEST("Healing Wish effect activates only if the switched pokemon can be healed")
{
GIVEN {
ASSUME(B_HEALING_WISH_SWITCH >= GEN_8);
PLAYER(SPECIES_GARDEVOIR) { Speed(300); }
PLAYER(SPECIES_NINJASK) { Speed(400); }
PLAYER(SPECIES_WYNAUT) { HP(TEST_MAX_HP / 2); MaxHP(TEST_MAX_HP); Status1(STATUS1_PARALYSIS); Speed(50); }
OPPONENT(SPECIES_WOBBUFFET) {Speed(50); }
} WHEN {
TURN { MOVE(player, MOVE_HEALING_WISH); SEND_OUT(player, 1); }
TURN { MOVE(player, MOVE_U_TURN); SEND_OUT(player, 2); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_HEALING_WISH, player);
HP_BAR(player, hp: 0);
MESSAGE("Gardevoir fainted!");
NONE_OF {
MESSAGE("The healing wish came true for Wynaut!");
MESSAGE("Wynaut regained health!");
}
ANIMATION(ANIM_TYPE_MOVE, MOVE_U_TURN, player);
MESSAGE("Do it! Wynaut!");
MESSAGE("The healing wish came true for Wynaut!");
HP_BAR(player, hp: TEST_MAX_HP);
STATUS_ICON(player, none: TRUE);
MESSAGE("Wynaut regained health!");
}
}

View File

@ -42,8 +42,8 @@ SINGLE_BATTLE_TEST("Jump Kick has 50% recoil on protect")
SINGLE_BATTLE_TEST("Jump Kick has no recoil if no target")
{
KNOWN_FAILING; // #2596.
GIVEN {
ASSUME(B_HEALING_WISH_SWITCH >= GEN_5);
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WYNAUT);