diff --git a/asm/macros/battle_script.inc b/asm/macros/battle_script.inc index 5c263b11db..ba5a371d9a 100644 --- a/asm/macros/battle_script.inc +++ b/asm/macros/battle_script.inc @@ -1580,6 +1580,10 @@ various \battler, VARIOUS_ACUPRESSURE .4byte \ptr .endm + + .macro setpowder battler:req + various \battler, VARIOUS_SET_POWDER + .endm @ helpful macros .macro setstatchanger stat:req, stages:req, down:req diff --git a/data/battle_anim_scripts.s b/data/battle_anim_scripts.s index a3e1cc89ef..491277060b 100644 --- a/data/battle_anim_scripts.s +++ b/data/battle_anim_scripts.s @@ -650,6 +650,7 @@ gBattleAnims_StatusConditions:: .4byte Status_Freeze .4byte Status_Curse .4byte Status_Nightmare + .4byte Status_Powder .align 2 gBattleAnims_General:: @@ -11929,6 +11930,9 @@ Status_Nightmare: waitforvisualfinish clearmonbg ANIM_DEF_PARTNER end + +Status_Powder: + end General_CastformChange: createvisualtask sub_815BB18, 2 diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 77b4adb6c3..ac9cd6cb05 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -339,6 +339,20 @@ gBattleScriptsForMoveEffects:: @ 82D86A8 .4byte BattleScript_EffectSparklingAria .4byte BattleScript_EffectAcupressure .4byte BattleScript_EffectAromaticMist + .4byte BattleScript_EffectPowder + +BattleScript_EffectPowder: + attackcanceler + accuracycheck BattleScript_PrintMoveMissed, NO_ACC_CALC_CHECK_LOCK_ON + attackstring + ppreduce + jumpifstatus2 BS_TARGET, STATUS2_POWDER, BattleScript_ButItFailed + setpowder BS_TARGET + attackanimation + waitanimation + printstring STRINGID_COVEREDINPOWDER + waitmessage 0x40 + goto BattleScript_MoveEnd BattleScript_EffectAromaticMist: attackcanceler @@ -5522,6 +5536,25 @@ BattleScript_DoSelfConfusionDmg:: goto BattleScript_MoveEnd BattleScript_MoveUsedIsConfusedRet:: return + +BattleScript_MoveUsedPowder:: + bicword gHitMarker, HITMARKER_NO_ATTACKSTRING | HITMARKER_ATTACKSTRING_PRINTED + attackstring + ppreduce + pause 0x20 + cancelmultiturnmoves BS_ATTACKER + status2animation BS_ATTACKER, STATUS2_POWDER + waitanimation + effectivenesssound + hitanimation BS_ATTACKER + waitstate + orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_x100000 + healthbarupdate BS_ATTACKER + datahpupdate BS_ATTACKER + printstring STRINGID_POWDEREXPLODES + waitmessage 0x40 + tryfaintmon BS_ATTACKER, FALSE, NULL + goto BattleScript_MoveEnd BattleScript_MoveUsedIsConfusedNoMore:: printstring STRINGID_PKMNHEALEDCONFUSION diff --git a/include/battle.h b/include/battle.h index c7aa1132dc..7d84043dff 100644 --- a/include/battle.h +++ b/include/battle.h @@ -203,6 +203,7 @@ struct ProtectStruct u32 usesBouncedMove:1; u32 usedHealBlockedMove:1; u32 usedGravityPreventedMove:1; + u32 powderSelfDmg:1; u32 physicalDmg; u32 specialDmg; u8 physicalBattlerId; diff --git a/include/battle_scripts.h b/include/battle_scripts.h index 4855d52b1d..3961a44bbc 100644 --- a/include/battle_scripts.h +++ b/include/battle_scripts.h @@ -286,5 +286,6 @@ extern const u8 BattleScript_MoveEffectFeint[]; extern const u8 BattleScript_ProteanActivates[]; extern const u8 BattleScript_DazzlingProtected[]; extern const u8 BattleScript_MoveUsedPsychicTerrainPrevents[]; +extern const u8 BattleScript_MoveUsedPowder[]; #endif // GUARD_BATTLE_SCRIPTS_H diff --git a/include/constants/battle.h b/include/constants/battle.h index 99eb49053c..b801f90a1b 100644 --- a/include/constants/battle.h +++ b/include/constants/battle.h @@ -116,6 +116,7 @@ #define STATUS2_LOCK_CONFUSE 0x00000C00 #define STATUS2_MULTIPLETURNS 0x00001000 #define STATUS2_WRAPPED 0x00002000 +#define STATUS2_POWDER 0x00004000 #define STATUS2_INFATUATION 0x000F0000 // 4 bits, one for every battler #define STATUS2_INFATUATED_WITH(battler) (gBitTable[battler] << 16) #define STATUS2_FOCUS_ENERGY 0x00100000 diff --git a/include/constants/battle_move_effects.h b/include/constants/battle_move_effects.h index 6407d93a12..31ffec84ea 100644 --- a/include/constants/battle_move_effects.h +++ b/include/constants/battle_move_effects.h @@ -327,5 +327,6 @@ #define EFFECT_SPARKLING_ARIA 321 #define EFFECT_ACUPRESSURE 322 #define EFFECT_AROMATIC_MIST 323 +#define EFFECT_POWDER 324 #endif // GUARD_CONSTANTS_BATTLE_MOVE_EFFECTS_H diff --git a/include/constants/battle_script_commands.h b/include/constants/battle_script_commands.h index 9c345f91c6..da1c073e4b 100644 --- a/include/constants/battle_script_commands.h +++ b/include/constants/battle_script_commands.h @@ -133,6 +133,7 @@ #define VARIOUS_SET_AURORA_VEIL 71 #define VARIOUS_TRY_THIRD_TYPE 72 #define VARIOUS_ACUPRESSURE 73 +#define VARIOUS_SET_POWDER 74 // atk80, dmg manipulation #define ATK80_DMG_CHANGE_SIGN 0 diff --git a/include/constants/battle_string_ids.h b/include/constants/battle_string_ids.h index 6089b6aa73..77f4e86a80 100644 --- a/include/constants/battle_string_ids.h +++ b/include/constants/battle_string_ids.h @@ -514,6 +514,8 @@ #define STRINGID_THIRDTYPEADDED 510 #define STRINGID_FELLFORFEINT 511 #define STRINGID_POKEMONCANNOTUSEMOVE 512 +#define STRINGID_COVEREDINPOWDER 513 +#define STRINGID_POWDEREXPLODES 514 #define BATTLESTRINGS_COUNT 525 diff --git a/src/battle_message.c b/src/battle_message.c index 5a36b42de6..4cdb4b2e25 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -651,6 +651,8 @@ static const u8 sText_BestowItemGiving[] = _("{B_DEF_NAME_WITH_PREFIX} received static const u8 sText_ThirdTypeAdded[] = _("{B_BUFF1} type was added to\n{B_DEF_NAME_WITH_PREFIX}!"); static const u8 sText_FellForFeint[] = _("{B_DEF_NAME_WITH_PREFIX} fell for\nthe feint!"); static const u8 sText_PokemonCannotUseMove[] = _("{B_ATK_NAME_WITH_PREFIX} cannot\nuse {B_CURRENT_MOVE}!"); +static const u8 sText_CoveredInPowder[] = _("{B_DEF_NAME_WITH_PREFIX} is covered in powder!"); +static const u8 sText_PowderExplodes[] = _("When the flame touched the powder \non the Pokémon, it exploded!"); const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] = { @@ -1156,6 +1158,8 @@ const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] = sText_ThirdTypeAdded, sText_FellForFeint, sText_PokemonCannotUseMove, + sText_CoveredInPowder, + sText_PowderExplodes, }; const u16 gTerrainStringIds[] = diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index f6d00e62dd..e003adaf79 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -6338,6 +6338,9 @@ static void atk76_various(void) switch (gBattlescriptCurrInstr[2]) { + case VARIOUS_SET_POWDER: + gBattleMons[gActiveBattler].status2 |= STATUS2_POWDER; + break; case VARIOUS_ACUPRESSURE: bits = 0; for (i = STAT_ATK; i < NUM_BATTLE_STATS; i++) diff --git a/src/battle_util.c b/src/battle_util.c index b4ed7458c7..83b0f0cb76 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -483,7 +483,8 @@ bool8 WasUnableToUseMove(u8 battler) || gProtectStructs[battler].usedHealBlockedMove || gProtectStructs[battler].flag2Unknown || gProtectStructs[battler].flinchImmobility - || gProtectStructs[battler].confusionSelfDmg) + || gProtectStructs[battler].confusionSelfDmg + || gProtectStructs[battler].powderSelfDmg) return TRUE; else return FALSE; @@ -1306,6 +1307,7 @@ enum ENDTURN_ITEMS2, ENDTURN_ROOST, ENDTURN_ELECTRIFY, + ENDTURN_POWDER, ENDTURN_BATTLER_COUNT }; @@ -1756,7 +1758,9 @@ u8 DoBattlerEndTurnEffects(void) case ENDTURN_ELECTRIFY: gStatuses3[gActiveBattler] &= ~(STATUS3_ELECTRIFIED); gBattleStruct->turnEffectsTracker++; - break; + case ENDTURN_POWDER: + gBattleMons[gActiveBattler].status2 &= ~(STATUS2_POWDER); + gBattleStruct->turnEffectsTracker++; case ENDTURN_BATTLER_COUNT: // done gBattleStruct->turnEffectsTracker = 0; gBattleStruct->turnEffectsBattlerId++; @@ -1982,6 +1986,7 @@ enum CANCELLER_IN_LOVE, CANCELLER_BIDE, CANCELLER_THAW, + CANCELLER_POWDER, CANCELLER_END, CANCELLER_PSYCHIC_TERRAIN, CANCELLER_END2, @@ -2272,6 +2277,20 @@ u8 AtkCanceller_UnableToUseMove(void) } gBattleStruct->atkCancellerTracker++; break; + case CANCELLER_POWDER: + if (gBattleMons[gBattlerAttacker].status2 & STATUS2_POWDER) + { + u32 moveType; + GET_MOVE_TYPE(gCurrentMove, moveType); + if (moveType == TYPE_FIRE) + { + gProtectStructs[gBattlerAttacker].powderSelfDmg = 1; + gBattleMoveDamage = gBattleMons[gBattlerAttacker].maxHP / 4; + gBattlescriptCurrInstr = BattleScript_MoveUsedPowder; + } + } + gBattleStruct->atkCancellerTracker++; + break; case CANCELLER_END: break; } diff --git a/src/data/battle_moves.h b/src/data/battle_moves.h index d6535d82a3..daa8f6a2bc 100644 --- a/src/data/battle_moves.h +++ b/src/data/battle_moves.h @@ -7218,7 +7218,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] = .split = SPLIT_STATUS, }, { // MOVE_POWDER - .effect = EFFECT_PLACEHOLDER, // Needs a custom move effect + .effect = EFFECT_POWDER, .power = 0, .type = TYPE_BUG, .accuracy = 100,