From 61a7bd2788e6a9bd67edc62374bd12f09d0dfe7b Mon Sep 17 00:00:00 2001 From: Papa Cancer Date: Sun, 24 Mar 2019 02:45:21 +0000 Subject: [PATCH] Taunt fix etc. Taunt now works for the correct number of turns and has its own ending string - made by reusing the "Heal Block ends" string as a multi-purpose "X wore off" one. Fixed a bug in PREPARE_STRING_BUFFER and touched up the ENDTURN timers for various STATUS3's. Heal Block now displays the correct string when preventing usage of a move. --- data/battle_scripts_1.s | 15 ++++-------- include/battle_message.h | 2 +- include/battle_scripts.h | 3 +-- include/constants/battle_string_ids.h | 4 ++-- src/battle_message.c | 16 ++++++------- src/battle_script_commands.c | 7 ++++-- src/battle_util.c | 34 ++++++++++++--------------- 7 files changed, 37 insertions(+), 44 deletions(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 30c4cdc03..e97e18465 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -5350,16 +5350,16 @@ BattleScript_SelectingNotAllowedMoveGravityInPalace:: goto BattleScript_SelectingUnusableMoveInPalace BattleScript_SelectingNotAllowedMoveHealBlock:: - printselectionstring STRINGID_GRAVITYPREVENTSUSAGE + printselectionstring STRINGID_HEALBLOCKPREVENTSUSAGE endselectionscript BattleScript_MoveUsedHealBlockPrevents:: - printstring STRINGID_GRAVITYPREVENTSUSAGE + printstring STRINGID_HEALBLOCKPREVENTSUSAGE waitmessage 0x40 goto BattleScript_MoveEnd BattleScript_SelectingNotAllowedMoveHealBlockInPalace:: - printstring STRINGID_GRAVITYPREVENTSUSAGE + printstring STRINGID_HEALBLOCKPREVENTSUSAGE goto BattleScript_SelectingUnusableMoveInPalace BattleScript_WishComesTrue:: @@ -5773,18 +5773,13 @@ BattleScript_EmbargoEndTurn:: waitmessage 0x40 end2 -BattleScript_MagnetRiseEndTurn:: - printstring STRINGID_MAGNETRISEENDS - waitmessage 0x40 - end2 - BattleScript_TelekinesisEndTurn:: printstring STRINGID_TELEKINESISENDS waitmessage 0x40 end2 -BattleScript_HealBlockEndTurn:: - printstring STRINGID_HEALBLOCKENDS +BattleScript_BufferEndTurn:: + printstring STRINGID_BUFFERENDS waitmessage 0x40 end2 diff --git a/include/battle_message.h b/include/battle_message.h index 102398d0d..04142dd49 100644 --- a/include/battle_message.h +++ b/include/battle_message.h @@ -150,7 +150,7 @@ { \ textVar[0] = B_BUFF_PLACEHOLDER_BEGIN; \ textVar[1] = B_BUFF_STRING; \ - textVar[2] = stringId; \ + textVar[2] = stringId & 0xFF; \ textVar[3] = (stringId & 0xFF00) >> 8; \ textVar[4] = B_BUFF_EOS; \ } diff --git a/include/battle_scripts.h b/include/battle_scripts.h index 1c68b909b..351ee9706 100644 --- a/include/battle_scripts.h +++ b/include/battle_scripts.h @@ -225,9 +225,8 @@ extern const u8 BattleScript_ActionWatchesCarefully[]; extern const u8 BattleScript_ActionGetNear[]; extern const u8 BattleScript_ActionThrowPokeblock[]; extern const u8 BattleScript_EmbargoEndTurn[]; -extern const u8 BattleScript_MagnetRiseEndTurn[]; extern const u8 BattleScript_TelekinesisEndTurn[]; -extern const u8 BattleScript_HealBlockEndTurn[]; +extern const u8 BattleScript_BufferEndTurn[]; extern const u8 BattleScript_AquaRingHeal[]; extern const u8 BattleScript_AuroraVeilEnds[]; extern const u8 BattleScript_LuckyChantEnds[]; diff --git a/include/constants/battle_string_ids.h b/include/constants/battle_string_ids.h index c3ddf2c0a..9f9425d0d 100644 --- a/include/constants/battle_string_ids.h +++ b/include/constants/battle_string_ids.h @@ -434,8 +434,8 @@ #define STRINGID_REFLECTTARGETSTYPE 430 #define STRINGID_TRANSFERHELDITEM 431 #define STRINGID_EMBARGOENDS 432 -#define STRINGID_MAGNETRISEENDS 433 -#define STRINGID_HEALBLOCKENDS 434 +#define STRINGID_ELECTROMAGNETISM 433 +#define STRINGID_BUFFERENDS 434 #define STRINGID_TELEKINESISENDS 435 #define STRINGID_TAILWINDENDS 436 #define STRINGID_LUCKYCHANTENDS 437 diff --git a/src/battle_message.c b/src/battle_message.c index a2d475876..68a6cad93 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -223,7 +223,7 @@ static const u8 sText_NaturePowerTurnedInto[] = _("NATURE POWER turned into\n{B_ static const u8 sText_PkmnStatusNormal[] = _("{B_ATK_NAME_WITH_PREFIX}'s status\nreturned to normal!"); static const u8 sText_PkmnSubjectedToTorment[] = _("{B_DEF_NAME_WITH_PREFIX} was subjected\nto TORMENT!"); static const u8 sText_PkmnTighteningFocus[] = _("{B_ATK_NAME_WITH_PREFIX} is tightening\nits focus!"); -static const u8 sText_PkmnFellForTaunt[] = _("{B_DEF_NAME_WITH_PREFIX} fell for\nthe TAUNT!"); +static const u8 sText_PkmnFellForTaunt[] = _("{B_DEF_NAME_WITH_PREFIX} fell for\nthe Taunt!"); static const u8 sText_PkmnReadyToHelp[] = _("{B_ATK_NAME_WITH_PREFIX} is ready to\nhelp {B_DEF_NAME_WITH_PREFIX}!"); static const u8 sText_PkmnSwitchedItems[] = _("{B_ATK_NAME_WITH_PREFIX} switched\nitems with its opponent!"); static const u8 sText_PkmnObtainedX[] = _("{B_ATK_NAME_WITH_PREFIX} obtained\n{B_BUFF1}."); @@ -258,8 +258,8 @@ static const u8 sText_TheWallShattered[] = _("The wall shattered!"); static const u8 sText_ButNoEffect[] = _("But it had no effect!"); static const u8 sText_PkmnHasNoMovesLeft[] = _("{B_ACTIVE_NAME_WITH_PREFIX} has no\nmoves left!\p"); static const u8 sText_PkmnMoveIsDisabled[] = _("{B_ACTIVE_NAME_WITH_PREFIX}'s {B_CURRENT_MOVE}\nis disabled!\p"); -static const u8 sText_PkmnCantUseMoveTorment[] = _("{B_ACTIVE_NAME_WITH_PREFIX} can't use the same\nmove in a row due to the TORMENT!\p"); -static const u8 sText_PkmnCantUseMoveTaunt[] = _("{B_ACTIVE_NAME_WITH_PREFIX} can't use\n{B_CURRENT_MOVE} after the TAUNT!\p"); +static const u8 sText_PkmnCantUseMoveTorment[] = _("{B_ACTIVE_NAME_WITH_PREFIX} can't use the same\nmove in a row due to the Torment!\p"); +static const u8 sText_PkmnCantUseMoveTaunt[] = _("{B_ACTIVE_NAME_WITH_PREFIX} can't use\n{B_CURRENT_MOVE} after the Taunt!\p"); static const u8 sText_PkmnCantUseMoveSealed[] = _("{B_ACTIVE_NAME_WITH_PREFIX} can't use the\nsealed {B_CURRENT_MOVE}!\p"); static const u8 sText_PkmnMadeItRain[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX}'s {B_SCR_ACTIVE_ABILITY}\nmade it rain!"); static const u8 sText_PkmnRaisedSpeed[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX}'s {B_SCR_ACTIVE_ABILITY}\nraised its SPEED!"); @@ -559,8 +559,8 @@ static const u8 sText_PostponeTargetMove[] =_("{B_DEF_NAME_WITH_PREFIX}'s move\n static const u8 sText_ReflectTargetsType[] =_("{B_ATK_NAME_WITH_PREFIX}'s type\nchanged to match the {B_DEF_NAME_WITH_PREFIX}'s!"); static const u8 sText_TransferHeldItem[] =_("{B_DEF_NAME_WITH_PREFIX} recieved {B_LAST_ITEM}\nfrom {B_ATK_NAME_WITH_PREFIX}"); static const u8 sText_EmbargoEnds[] = _("{B_DEF_NAME_WITH_PREFIX}can\nuse items again!"); -static const u8 sText_MagnetRiseEnds[] = _("{B_ATK_NAME_WITH_PREFIX}'s electromagnetism\nwore off!"); -static const u8 sText_HealBlockEnds[] = _("{B_ATK_NAME_WITH_PREFIX}'s Heal Block\nwore off!"); +static const u8 sText_Electromagnetism[] = _("electromagnetism"); +static const u8 sText_BufferEnds[] = _("{B_ATK_NAME_WITH_PREFIX}'s {B_BUFF1}\nwore off!"); static const u8 sText_TelekinesisEnds[] = _("{B_ATK_NAME_WITH_PREFIX} was freed\nfrom the telekinesis!"); static const u8 sText_TailwindEnds[] = _("{B_ATK_TEAM1} team's tailwind\n petered out!"); static const u8 sText_LuckyChantEnds[] = _("{B_ATK_TEAM1} team's Lucky Chant\n wore off!"); @@ -627,7 +627,7 @@ static const u8 sText_TerrainBecomesPsychic[] = _("The battlefield got weird!"); static const u8 sText_TargetElectrified[] = _("The opposing {B_ATK_NAME_WITH_PREFIX}'s moves\nhave been electrified!"); static const u8 sText_AssaultVestDoesntAllow[] = _("The effects of the {B_LAST_ITEM} prevent status\nmoves from being used!\p"); static const u8 sText_GravityPreventsUsage[] = _("{B_ATK_NAME_WITH_PREFIX} can't use {B_CURRENT_MOVE}\nbecause of gravity!\p"); -static const u8 sText_HealBlockPreventsUsage[] = _("The opposing {B_ATK_NAME_WITH_PREFIX} was\nprevented from healing!\p"); +static const u8 sText_HealBlockPreventsUsage[] = _("{B_ATK_NAME_WITH_PREFIX} was\nprevented from healing!\p"); static const u8 sText_MegaEvoReacting[] = _("{B_ATK_NAME_WITH_PREFIX}'s {B_LAST_ITEM} is reacting\nto {B_ATK_TRAINER_NAME}'s Mega Ring!"); static const u8 sText_MegaEvoEvolved[] = _("{B_ATK_NAME_WITH_PREFIX} has Mega\nEvolved into Mega {B_BUFF1}!"); static const u8 sText_drastically[] = _("drastically "); @@ -1076,8 +1076,8 @@ const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] = [STRINGID_REFLECTTARGETSTYPE - 12] = sText_ReflectTargetsType, [STRINGID_TRANSFERHELDITEM - 12] = sText_TransferHeldItem, [STRINGID_EMBARGOENDS - 12] = sText_EmbargoEnds, - [STRINGID_MAGNETRISEENDS - 12] = sText_MagnetRiseEnds, - [STRINGID_HEALBLOCKENDS - 12] = sText_HealBlockEnds, + [STRINGID_ELECTROMAGNETISM - 12] = sText_Electromagnetism, + [STRINGID_BUFFERENDS - 12] = sText_BufferEnds, [STRINGID_TELEKINESISENDS - 12] = sText_TelekinesisEnds, [STRINGID_TAILWINDENDS - 12] = sText_TailwindEnds, [STRINGID_LUCKYCHANTENDS - 12] = sText_LuckyChantEnds, diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index a5b6e46f4..c286833b0 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -9970,8 +9970,11 @@ static void atkD0_settaunt(void) { if (gDisableStructs[gBattlerTarget].tauntTimer == 0) { - gDisableStructs[gBattlerTarget].tauntTimer = 2; - gDisableStructs[gBattlerTarget].tauntTimer2 = 2; + u8 turns = 4; + if (GetBattlerTurnOrderNum(gBattlerTarget) > GetBattlerTurnOrderNum(gBattlerAttacker)) + turns--; // If the target hasn't yet moved this turn, Taunt lasts for only three turns (source: Bulbapedia) + + gDisableStructs[gBattlerTarget].tauntTimer = gDisableStructs[gBattlerTarget].tauntTimer2 = turns; gBattlescriptCurrInstr += 5; } else diff --git a/src/battle_util.c b/src/battle_util.c index 901edb152..c67d4950d 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -1685,8 +1685,12 @@ u8 DoBattlerEndTurnEffects(void) gBattleStruct->turnEffectsTracker++; break; case ENDTURN_TAUNT: // taunt - if (gDisableStructs[gActiveBattler].tauntTimer) - gDisableStructs[gActiveBattler].tauntTimer--; + if (gDisableStructs[gActiveBattler].tauntTimer && --gDisableStructs[gActiveBattler].tauntTimer == 0) + { + BattleScriptExecute(BattleScript_BufferEndTurn); + PREPARE_MOVE_BUFFER(gBattleTextBuff1, MOVE_TAUNT); + effect++; + } gBattleStruct->turnEffectsTracker++; break; case ENDTURN_YAWN: // yawn @@ -1711,9 +1715,7 @@ u8 DoBattlerEndTurnEffects(void) case ENDTURN_LASER_FOCUS: if (gStatuses3[gActiveBattler] & STATUS3_LASER_FOCUS) { - if (gDisableStructs[gActiveBattler].laserFocusTimer != 0) - gDisableStructs[gActiveBattler].laserFocusTimer--; - if (gDisableStructs[gActiveBattler].laserFocusTimer == 0) + if (gDisableStructs[gActiveBattler].laserFocusTimer == 0 || --gDisableStructs[gActiveBattler].laserFocusTimer == 0) gStatuses3[gActiveBattler] &= ~(STATUS3_LASER_FOCUS); } gBattleStruct->turnEffectsTracker++; @@ -1721,9 +1723,7 @@ u8 DoBattlerEndTurnEffects(void) case ENDTURN_EMBARGO: if (gStatuses3[gActiveBattler] & STATUS3_EMBARGO) { - if (gDisableStructs[gActiveBattler].embargoTimer != 0) - gDisableStructs[gActiveBattler].embargoTimer--; - if (gDisableStructs[gActiveBattler].embargoTimer == 0) + if (gDisableStructs[gActiveBattler].embargoTimer == 0 || --gDisableStructs[gActiveBattler].embargoTimer == 0) { gStatuses3[gActiveBattler] &= ~(STATUS3_EMBARGO); BattleScriptExecute(BattleScript_EmbargoEndTurn); @@ -1735,12 +1735,11 @@ u8 DoBattlerEndTurnEffects(void) case ENDTURN_MAGNET_RISE: if (gStatuses3[gActiveBattler] & STATUS3_MAGNET_RISE) { - if (gDisableStructs[gActiveBattler].magnetRiseTimer != 0) - gDisableStructs[gActiveBattler].magnetRiseTimer--; - if (gDisableStructs[gActiveBattler].magnetRiseTimer == 0) + if (gDisableStructs[gActiveBattler].magnetRiseTimer == 0 || --gDisableStructs[gActiveBattler].magnetRiseTimer == 0) { gStatuses3[gActiveBattler] &= ~(STATUS3_MAGNET_RISE); - BattleScriptExecute(BattleScript_MagnetRiseEndTurn); + BattleScriptExecute(BattleScript_BufferEndTurn); + PREPARE_STRING_BUFFER(gBattleTextBuff1, STRINGID_ELECTROMAGNETISM); effect++; } } @@ -1749,9 +1748,7 @@ u8 DoBattlerEndTurnEffects(void) case ENDTURN_TELEKINESIS: if (gStatuses3[gActiveBattler] & STATUS3_TELEKINESIS) { - if (gDisableStructs[gActiveBattler].telekinesisTimer != 0) - gDisableStructs[gActiveBattler].telekinesisTimer--; - if (gDisableStructs[gActiveBattler].telekinesisTimer == 0) + if (gDisableStructs[gActiveBattler].telekinesisTimer == 0 || --gDisableStructs[gActiveBattler].telekinesisTimer == 0) { gStatuses3[gActiveBattler] &= ~(STATUS3_TELEKINESIS); BattleScriptExecute(BattleScript_TelekinesisEndTurn); @@ -1763,12 +1760,11 @@ u8 DoBattlerEndTurnEffects(void) case ENDTURN_HEALBLOCK: if (gStatuses3[gActiveBattler] & STATUS3_HEAL_BLOCK) { - if (gDisableStructs[gActiveBattler].healBlockTimer != 0) - gDisableStructs[gActiveBattler].healBlockTimer--; - if (gDisableStructs[gActiveBattler].healBlockTimer == 0) + if (gDisableStructs[gActiveBattler].healBlockTimer == 0 || --gDisableStructs[gActiveBattler].healBlockTimer == 0) { gStatuses3[gActiveBattler] &= ~(STATUS3_HEAL_BLOCK); - BattleScriptExecute(BattleScript_HealBlockEndTurn); + BattleScriptExecute(BattleScript_BufferEndTurn); + PREPARE_MOVE_BUFFER(gBattleTextBuff1, MOVE_HEAL_BLOCK); effect++; } }