fix z effect scripts

This commit is contained in:
Evan 2020-12-01 15:35:39 -05:00
parent 9755923cc3
commit f54cd0b25d
7 changed files with 50 additions and 32 deletions

View file

@ -7701,8 +7701,8 @@ BattleScript_ZMoveActivateStatus::
printstring STRINGID_ZPOWERSURROUNDS
playanimation BS_ATTACKER, B_ANIM_ZMOVE_ACTIVATE, NULL
setzeffect
printstring STRINGID_ZMOVEUNLEASHED
waitmessage 0x40
@ printstring STRINGID_ZMOVEUNLEASHED
@ waitmessage 0x40
return
BattleScript_ZEffectPrintString::
@ -7719,12 +7719,22 @@ BattleScript_RecoverHPZMove::
BattleScript_StatUpZMove::
statbuffchange STAT_BUFF_ALLOW_PTR, BattleScript_StatUpZMoveEnd
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x3, BattleScript_StatUpZMoveEnd
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_StatUpZMoveEnd
playanimation BS_SCRIPTING, B_ANIM_STATS_CHANGE, sB_ANIM_ARG1
printfromtable gZEffectStringIds
printstring STRINGID_ZMOVESTATUP
waitmessage 0x40
printfromtable gStatUpStringIds
waitmessage 0x40
BattleScript_StatUpZMoveEnd:
return
BattleScript_HealReplacementZMove::
playanimation BS_SCRIPTING B_ANIM_WISH_HEAL 0x0
printfromtable gZEffectStringIds
waitmessage 0x40
healthbarupdate BS_SCRIPTING
datahpupdate BS_SCRIPTING
return
BattleScript_EffectExtremeEvoboost::
attackcanceler

View file

@ -430,18 +430,18 @@ struct Illusion
struct ZMoveData
{
/*0x00*/ u8 viable:1; // current move can become a z move
u8 viewing:1; //if player is viewing the z move name instead of regular moves
u8 active:1; //is z move being used this turn
u8 viewing:1; // if player is viewing the z move name instead of regular moves
u8 active:1; // is z move being used this turn
u8 zStatusActive:1;
u8 healReplacement:1; //TODO: z-parting shot
u8 activeSplit:1; //active z move split
u8 zUnused:2;
u8 healReplacement:1;
u8 activeSplit:2; // active z move split
u8 zUnused:1;
/*0x01*/ u8 triggerSpriteId;
/*0x02*/ u8 possibleZMoves[MAX_BATTLERS_COUNT];
/*0x02*/ u16 chosenZMove; //z move of move cursor is on
/*0x02*/ u16 chosenZMove; // z move of move cursor is on
u8 effect;
u8 used[MAX_BATTLERS_COUNT]; //one per bank for multi-battles
u16 toBeUsed[MAX_BATTLERS_COUNT]; //TODO z moves per battler to be used
u16 toBeUsed[MAX_BATTLERS_COUNT]; // z moves per battler to be used
u16 baseMoves[MAX_BATTLERS_COUNT];
u8 splits[MAX_BATTLERS_COUNT];
};

View file

@ -355,6 +355,7 @@ extern const u8 BattleScript_ZMoveActivateStatus[];
extern const u8 BattleScript_ZEffectPrintString[];
extern const u8 BattleScript_RecoverHPZMove[];
extern const u8 BattleScript_StatUpZMove[];
extern const u8 BattleScript_HealReplacementZMove[];
extern const u8 BattleScript_EffectExtremeEvoboost[];
#endif // GUARD_BATTLE_SCRIPTS_H

View file

@ -680,12 +680,12 @@ static const u8 sText_CloakedInAFreezingLight[] = _("{B_ATK_NAME_WITH_PREFIX} be
static const u8 sText_StatWasNotLowered[] = _("{B_DEF_NAME_WITH_PREFIX}'s {B_BUFF1}\nwas not lowered!");
static const u8 sText_ZPowerSurrounds[] = _("{B_ATK_NAME_WITH_PREFIX} surrounds\nitself with its Z-Power!");
static const u8 sText_ZPowerUnleashed[] = _("{B_ATK_NAME_WITH_PREFIX} unleashes\nits full-force Z-Move!");
static const u8 sText_ZMoveResetsStats[] = _("");
static const u8 sText_ZMoveAllStatsUp[] = _("");
static const u8 sText_ZMoveBoostCrit[] = _("");
static const u8 sText_ZMoveRestoreHp[] = _("");
static const u8 sText_ZMoveStatUp[] = _("");
static const u8 sText_ZMoveHpSwitchInTrap[] = _("");
static const u8 sText_ZMoveResetsStats[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX} returned its\ndecreased stats to normal using\lits Z-Power!");
static const u8 sText_ZMoveAllStatsUp[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX} boosted all\nof its stats using its Z-Power!");
static const u8 sText_ZMoveBoostCrit[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX} boosted its\ncritical-hit ratio using its Z-Power!");
static const u8 sText_ZMoveRestoreHp[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX} restored its\nHP using its Z-Power!");
static const u8 sText_ZMoveStatUp[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX} boosted\nits stats using its Z-Power!");
static const u8 sText_ZMoveHpSwitchInTrap[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX}'s HP was restored by the Z-Power!");
static const u8 sText_TerrainReturnedToNormal[] = _("The terrain returned to\nnormal!");
const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] =
@ -2579,7 +2579,7 @@ void BufferStringBattle(u16 stringID)
}
break;
case STRINGID_USEDMOVE: // pokemon used a move msg
if (gBattleStruct->zmove.active)
if (gBattleStruct->zmove.active && gBattleStruct->zmove.activeSplit != SPLIT_STATUS)
StringCopy(gBattleTextBuff3, GetZMoveName(gBattleMsgDataPtr->currentMove));
else if (gBattleMsgDataPtr->currentMove >= MOVES_COUNT)
StringCopy(gBattleTextBuff3, sATypeMove_Table[*(&gBattleStruct->stringMoveType)]);

View file

@ -5866,6 +5866,16 @@ static void Cmd_switchineffects(void)
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_StickyWebOnSwitchIn;
}
else if (gBattleMons[gActiveBattler].hp != gBattleMons[gActiveBattler].maxHP && gBattleStruct->zmove.healReplacement)
{
gBattleStruct->zmove.healReplacement = FALSE;
gBattleMoveDamage = -1 * (gBattleMons[gActiveBattler].maxHP);
gBattleScripting.battler = gActiveBattler;
BattleScriptPushCursor();
gBattleCommunication[MULTISTRING_CHOOSER] = MULTISTRING_Z_HP_TRAP;
gBattlescriptCurrInstr = BattleScript_HealReplacementZMove;
return;
}
else
{
// There is a hack here to ensure the truant counter will be 0 when the battler's next turn starts.

View file

@ -124,7 +124,7 @@ void HandleAction_UseMove(void)
}
// check z move used
if (gBattleStruct->zmove.toBeUsed[gBattlerAttacker])
if (gBattleStruct->zmove.toBeUsed[gBattlerAttacker] != MOVE_NONE && !IS_MOVE_STATUS(gCurrentMove))
{
gCurrentMove = gBattleStruct->zmove.toBeUsed[gBattlerAttacker];
}
@ -3198,7 +3198,7 @@ u8 AtkCanceller_UnableToUseMove(void)
gBattleStruct->zmove.used[BATTLE_PARTNER(gBattlerAttacker)] = TRUE; //if 1v1 double, set partner used flag as well
gBattleScripting.battler = gBattlerAttacker;
if (IS_MOVE_STATUS(gBattleStruct->zmove.splits[gBattlerAttacker]))
if (gBattleStruct->zmove.activeSplit == SPLIT_STATUS)
{
gBattleStruct->zmove.effect = gBattleMoves[gBattleStruct->zmove.baseMoves[gBattlerAttacker]].zMoveEffect;
BattleScriptPushCursor();

View file

@ -593,7 +593,7 @@ void SetZEffect(void)
}
gBattleCommunication[MULTISTRING_CHOOSER] = MULTISTRING_Z_RESET_STATS;
BattleScriptPush(gBattlescriptCurrInstr + Z_EFFECT_BS_LENGTH);
gBattlescriptCurrInstr = BattleScript_ZEffectPrintString - Z_EFFECT_BS_LENGTH;
gBattlescriptCurrInstr = BattleScript_ZEffectPrintString;
break;
case Z_EFFECT_ALL_STATS_UP_1:
if (!AreStatsMaxed(gBattlerAttacker, STAT_SPDEF))
@ -605,7 +605,7 @@ void SetZEffect(void)
}
gBattleCommunication[MULTISTRING_CHOOSER] = MULTISTRING_Z_ALL_STATS_UP;
BattleScriptPush(gBattlescriptCurrInstr + Z_EFFECT_BS_LENGTH);
gBattlescriptCurrInstr = BattleScript_ZEffectPrintString - Z_EFFECT_BS_LENGTH;
gBattlescriptCurrInstr = BattleScript_ZEffectPrintString;
}
break;
case Z_EFFECT_BOOST_CRITS:
@ -614,7 +614,7 @@ void SetZEffect(void)
gBattleMons[gBattlerAttacker].status2 |= STATUS2_FOCUS_ENERGY;
gBattleCommunication[MULTISTRING_CHOOSER] = MULTISTRING_Z_BOOST_CRITS;
BattleScriptPush(gBattlescriptCurrInstr + Z_EFFECT_BS_LENGTH);
gBattlescriptCurrInstr = BattleScript_ZEffectPrintString - Z_EFFECT_BS_LENGTH;
gBattlescriptCurrInstr = BattleScript_ZEffectPrintString;
}
break;
case Z_EFFECT_FOLLOW_ME:
@ -622,7 +622,7 @@ void SetZEffect(void)
gSideTimers[GetBattlerSide(gBattlerAttacker)].followmeTarget = gBattlerAttacker;
gBattleCommunication[MULTISTRING_CHOOSER] = MULTISTRING_Z_FOLLOW_ME;
BattleScriptPush(gBattlescriptCurrInstr + Z_EFFECT_BS_LENGTH);
gBattlescriptCurrInstr = BattleScript_ZEffectPrintString - Z_EFFECT_BS_LENGTH;
gBattlescriptCurrInstr = BattleScript_ZEffectPrintString;
break;
case Z_EFFECT_RECOVER_HP:
if (gBattleMons[gBattlerAttacker].hp != gBattleMons[gBattlerAttacker].maxHP)
@ -630,14 +630,14 @@ void SetZEffect(void)
gBattleMoveDamage = (-1) * gBattleMons[gBattlerAttacker].maxHP;
gBattleCommunication[MULTISTRING_CHOOSER] = MULTISTRING_Z_RECOVER_HP;
BattleScriptPush(gBattlescriptCurrInstr + Z_EFFECT_BS_LENGTH);
gBattlescriptCurrInstr = BattleScript_RecoverHPZMove - Z_EFFECT_BS_LENGTH;
gBattlescriptCurrInstr = BattleScript_RecoverHPZMove;
}
break;
case Z_EFFECT_RESTORE_REPLACEMENT_HP:
gBattleStruct->zmove.healReplacement = TRUE;
BattleScriptPush(gBattlescriptCurrInstr + Z_EFFECT_BS_LENGTH);
gBattleCommunication[MULTISTRING_CHOOSER] = MULTISTRING_Z_HP_TRAP;
gBattlescriptCurrInstr = BattleScript_ZEffectPrintString - Z_EFFECT_BS_LENGTH;
gBattlescriptCurrInstr = BattleScript_ZEffectPrintString;
break;
case Z_EFFECT_ATK_UP_1:
case Z_EFFECT_DEF_UP_1:
@ -649,9 +649,8 @@ void SetZEffect(void)
SET_STATCHANGER(gBattleStruct->zmove.effect - Z_EFFECT_ATK_UP_1 + 1, 1, FALSE);
gBattleScripting.animArg1 = 0xE + (gBattleStruct->zmove.effect - Z_EFFECT_ATK_UP_1 + 1);
gBattleScripting.animArg2 = 0;
gBattleCommunication[MULTISTRING_CHOOSER] = MULTISTRING_Z_STAT_UP;
BattleScriptPush(gBattlescriptCurrInstr + Z_EFFECT_BS_LENGTH);
gBattlescriptCurrInstr = BattleScript_StatUpZMove - Z_EFFECT_BS_LENGTH;
gBattlescriptCurrInstr = BattleScript_StatUpZMove;
break;
case Z_EFFECT_ATK_UP_2:
case Z_EFFECT_DEF_UP_2:
@ -663,9 +662,8 @@ void SetZEffect(void)
SET_STATCHANGER(gBattleStruct->zmove.effect - Z_EFFECT_ATK_UP_2 + 1, 2, FALSE);
gBattleScripting.animArg1 = 0xE + (gBattleStruct->zmove.effect - Z_EFFECT_ATK_UP_2 + 1);
gBattleScripting.animArg2 = 0;
gBattleCommunication[MULTISTRING_CHOOSER] = MULTISTRING_Z_STAT_UP;
BattleScriptPush(gBattlescriptCurrInstr + Z_EFFECT_BS_LENGTH);
gBattlescriptCurrInstr = BattleScript_StatUpZMove - Z_EFFECT_BS_LENGTH;
gBattlescriptCurrInstr = BattleScript_StatUpZMove;
break;
case Z_EFFECT_ATK_UP_3:
case Z_EFFECT_DEF_UP_3:
@ -677,9 +675,8 @@ void SetZEffect(void)
SET_STATCHANGER(gBattleStruct->zmove.effect - Z_EFFECT_ATK_UP_3 + 1, 3, FALSE);
gBattleScripting.animArg1 = 0xE + (gBattleStruct->zmove.effect - Z_EFFECT_ATK_UP_3 + 1);
gBattleScripting.animArg2 = 0;
gBattleCommunication[MULTISTRING_CHOOSER] = MULTISTRING_Z_STAT_UP;
BattleScriptPush(gBattlescriptCurrInstr + Z_EFFECT_BS_LENGTH);
gBattlescriptCurrInstr = BattleScript_StatUpZMove - Z_EFFECT_BS_LENGTH;
gBattlescriptCurrInstr = BattleScript_StatUpZMove;
break;
default:
gBattlescriptCurrInstr += 3;