diff --git a/asm/macros/battle_script.inc b/asm/macros/battle_script.inc index 410c72a3a..2474488af 100644 --- a/asm/macros/battle_script.inc +++ b/asm/macros/battle_script.inc @@ -1688,6 +1688,11 @@ .4byte \ptr .endm + .macro losetype battler:req, type:req + various \battler, VARIOUS_LOSE_TYPE + .byte \type + .endm + @ helpful macros .macro setstatchanger stat:req, stages:req, down:req setbyte sSTATCHANGER \stat | \stages << 3 | \down << 7 diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 0b0ba1811..0f085feda 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -357,6 +357,55 @@ gBattleScriptsForMoveEffects:: @ 82D86A8 .4byte BattleScript_EffectBugBite .4byte BattleScript_EffectStrengthSap .4byte BattleScript_EffectMindBlown + .4byte BattleScript_EffectPurify + .4byte BattleScript_EffectBurnUp + +BattleScript_EffectBurnUp: + attackcanceler + attackstring + ppreduce + jumpiftype BS_ATTACKER, TYPE_FIRE, BattleScript_BurnUpWorks + goto BattleScript_ButItFailed +BattleScript_BurnUpWorks: + accuracycheck BattleScript_MoveMissedPause, ACC_CURR_MOVE + critcalc + damagecalc + adjustdamage + attackanimation + waitanimation + effectivenesssound + hitanimation BS_TARGET + waitstate + healthbarupdate BS_TARGET + datahpupdate BS_TARGET + critmessage + waitmessage 0x40 + resultmessage + waitmessage 0x40 + losetype BS_ATTACKER, TYPE_FIRE + printstring STRINGID_ATTACKERLOSTFIRETYPE + waitmessage 0x40 + tryfaintmon BS_TARGET, FALSE, NULL + goto BattleScript_MoveEnd + +BattleScript_EffectPurify: + attackcanceler + attackstring + ppreduce + accuracycheck BattleScript_ButItFailed, NO_ACC_CALC_CHECK_LOCK_ON + typecalc + jumpifmovehadnoeffect BattleScript_NotAffected + jumpifstatus BS_TARGET, STATUS1_ANY, BattleScript_PurifyWorks + goto BattleScript_ButItFailed +BattleScript_PurifyWorks: + attackanimation + waitanimation + curestatus BS_TARGET + updatestatusicon BS_TARGET + printstring STRINGID_ATTACKERCUREDTARGETSTATUS + waitmessage 0x40 + tryhealhalfhealth BattleScript_AlreadyAtFullHp, BS_ATTACKER + goto BattleScript_RestoreHp BattleScript_EffectStrengthSap: setstatchanger STAT_ATK, 1, TRUE @@ -2552,6 +2601,7 @@ BattleScript_EffectRestoreHp:: tryhealhalfhealth BattleScript_AlreadyAtFullHp, BS_ATTACKER attackanimation waitanimation +BattleScript_RestoreHp: orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE healthbarupdate BS_ATTACKER datahpupdate BS_ATTACKER diff --git a/include/constants/battle_move_effects.h b/include/constants/battle_move_effects.h index 971f14adf..185e902f8 100644 --- a/include/constants/battle_move_effects.h +++ b/include/constants/battle_move_effects.h @@ -345,5 +345,7 @@ #define EFFECT_BUG_BITE 339 #define EFFECT_STRENGTH_SAP 340 #define EFFECT_MIND_BLOWN 341 +#define EFFECT_PURIFY 342 +#define EFFECT_BURN_UP 343 #endif // GUARD_CONSTANTS_BATTLE_MOVE_EFFECTS_H diff --git a/include/constants/battle_script_commands.h b/include/constants/battle_script_commands.h index bee610bdc..81ea474e9 100644 --- a/include/constants/battle_script_commands.h +++ b/include/constants/battle_script_commands.h @@ -148,6 +148,7 @@ #define VARIOUS_HANDLE_FORM_CHANGE 85 #define VARIOUS_GET_STAT_VALUE 86 #define VARIOUS_JUMP_IF_FULL_HP 87 +#define VARIOUS_LOSE_TYPE 88 // Cmd_manipulatedamage #define DMG_CHANGE_SIGN 0 diff --git a/include/constants/battle_string_ids.h b/include/constants/battle_string_ids.h index af497e73b..550f567e8 100644 --- a/include/constants/battle_string_ids.h +++ b/include/constants/battle_string_ids.h @@ -540,7 +540,9 @@ #define STRINGID_INCINERATEBURN 536 #define STRINGID_BUGBITE 537 #define STRINGID_ILLUSIONWOREOFF 538 +#define STRINGID_ATTACKERCUREDTARGETSTATUS 539 +#define STRINGID_ATTACKERLOSTFIRETYPE 540 -#define BATTLESTRINGS_COUNT 539 +#define BATTLESTRINGS_COUNT 541 #endif // GUARD_CONSTANTS_BATTLE_STRING_IDS_H diff --git a/src/battle_message.c b/src/battle_message.c index d84caf6bf..3bc2999b3 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -661,9 +661,13 @@ static const u8 sText_AirBalloonPop[] = _("{B_DEF_NAME_WITH_PREFIX}'s {B_LAST_IT static const u8 sText_IncinerateBurn[] = _("{B_EFF_NAME_WITH_PREFIX}'s {B_LAST_ITEM}\nwas burnt up!"); static const u8 sText_BugBite[] = _("{B_ATK_NAME_WITH_PREFIX} stole and ate\n{B_EFF_NAME_WITH_PREFIX}'s {B_LAST_ITEM}!"); static const u8 sText_IllusionWoreOff[] = _("{B_DEF_NAME_WITH_PREFIX}'s Illusion wore off!"); +static const u8 sText_AttackerCuredTargetStatus[] = _("{B_ATK_NAME_WITH_PREFIX} cured\n{B_DEF_NAME_WITH_PREFIX}'s problem!"); +static const u8 sText_AttackerLostFireType[] = _("{B_ATK_NAME_WITH_PREFIX} burned itself out!"); const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] = { + [STRINGID_ATTACKERLOSTFIRETYPE - 12] = sText_AttackerLostFireType, + [STRINGID_ATTACKERCUREDTARGETSTATUS - 12] = sText_AttackerCuredTargetStatus, [STRINGID_ILLUSIONWOREOFF - 12] = sText_IllusionWoreOff, [STRINGID_BUGBITE - 12] = sText_BugBite, [STRINGID_INCINERATEBURN - 12] = sText_IncinerateBurn, diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index b3aaf8647..a8c7a9f2e 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -7575,6 +7575,14 @@ static void Cmd_various(void) else gBattlescriptCurrInstr += 7; return; + case VARIOUS_LOSE_TYPE: + for (i = 0; i < 3; i++) + { + if (*(u8*)(&gBattleMons[gActiveBattler].type1 + i) == gBattlescriptCurrInstr[3]) + *(u8*)(&gBattleMons[gActiveBattler].type1 + i) = TYPE_MYSTERY; + } + gBattlescriptCurrInstr += 4; + return; case VARIOUS_PSYCHO_SHIFT: i = TRUE; if (gBattleMons[gBattlerAttacker].status1 & STATUS1_PARALYSIS) diff --git a/src/battle_util.c b/src/battle_util.c index 3d127c0b0..ccfd6d958 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -2379,7 +2379,8 @@ u8 AtkCanceller_UnableToUseMove(void) case CANCELLER_THAW: // move thawing if (gBattleMons[gBattlerAttacker].status1 & STATUS1_FREEZE) { - if (gBattleMoves[gCurrentMove].effect == EFFECT_THAW_HIT) + if (gBattleMoves[gCurrentMove].effect == EFFECT_THAW_HIT + || (gBattleMoves[gCurrentMove].effect == EFFECT_BURN_UP && IS_BATTLER_OF_TYPE(gBattlerAttacker, TYPE_FIRE))) { gBattleMons[gBattlerAttacker].status1 &= ~(STATUS1_FREEZE); BattleScriptPushCursor(); diff --git a/src/data/battle_moves.h b/src/data/battle_moves.h index d8463df56..fd7290dd1 100644 --- a/src/data/battle_moves.h +++ b/src/data/battle_moves.h @@ -9054,7 +9054,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] = [MOVE_BURN_UP] = { - .effect = EFFECT_PLACEHOLDER, + .effect = EFFECT_BURN_UP, .power = 130, .type = TYPE_FIRE, .accuracy = 100, @@ -9096,7 +9096,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] = [MOVE_PURIFY] = { - .effect = EFFECT_PLACEHOLDER, + .effect = EFFECT_PURIFY, .power = 0, .type = TYPE_POISON, .accuracy = 0,