From a961980e0f007fbd620a954dd7d235de15fc2d38 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Tue, 6 Dec 2022 05:14:05 -0300 Subject: [PATCH] Implemented Toxic Debris' effect --- data/battle_scripts_1.s | 9 +++++++++ include/battle_scripts.h | 1 + src/battle_util.c | 14 ++++++++++++++ 3 files changed, 24 insertions(+) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index d6e0499ba..d1249e384 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -7135,6 +7135,15 @@ BattleScript_WindPowerActivates:: BattleScript_WindPowerActivates_Ret: return +BattleScript_ToxicDebrisActivates:: + call BattleScript_AbilityPopUp + pause B_WAIT_TIME_SHORT + settoxicspikes BattleScript_ToxicDebrisRet + printstring STRINGID_POISONSPIKESSCATTERED + waitmessage B_WAIT_TIME_LONG +BattleScript_ToxicDebrisRet: + return + BattleScript_PerishSongCountGoesDown:: printstring STRINGID_PKMNPERISHCOUNTFELL waitmessage B_WAIT_TIME_LONG diff --git a/include/battle_scripts.h b/include/battle_scripts.h index 20575a5b6..2faf22260 100644 --- a/include/battle_scripts.h +++ b/include/battle_scripts.h @@ -447,6 +447,7 @@ extern const u8 BattleScript_RuinAbilityActivates[]; extern const u8 BattleScript_CudChewActivates[]; extern const u8 BattleScript_SupremeOverlordActivates[]; extern const u8 BattleScript_CostarActivates[]; +extern const u8 BattleScript_ToxicDebrisActivates[]; // zmoves extern const u8 BattleScript_ZMoveActivateDamaging[]; diff --git a/src/battle_util.c b/src/battle_util.c index 9bc5e24d4..13bd933f9 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -5911,6 +5911,20 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move effect++; } break; + case ABILITY_TOXIC_DEBRIS: + if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT) + && !gProtectStructs[gBattlerAttacker].confusionSelfDmg + && IS_MOVE_PHYSICAL(gCurrentMove) + && TARGET_TURN_DAMAGED + && !(gSideStatuses[gBattlerAttacker] & SIDE_STATUS_TOXIC_SPIKES) + && IsBattlerAlive(gBattlerTarget)) + { + gBattlerTarget = gBattlerAttacker; + BattleScriptPushCursor(); + gBattlescriptCurrInstr = BattleScript_ToxicDebrisActivates; + effect++; + } + break; } break; case ABILITYEFFECT_MOVE_END_ATTACKER: // Same as above, but for attacker