diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 833d01348..113318f1f 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -7900,6 +7900,16 @@ BattleScript_AftermathDmg:: waitmessage B_WAIT_TIME_LONG tryfaintmon BS_ATTACKER return + +BattleScript_DampPreventsAftermath:: + pause B_WAIT_TIME_SHORT + call BattleScript_AbilityPopUp + pause 40 + copybyte gBattlerAbility, sBATTLER + call BattleScript_AbilityPopUp + printstring STRINGID_PKMNSABILITYPREVENTSABILITY + waitmessage B_WAIT_TIME_LONG + return BattleScript_MoveUsedIsAsleep:: printstring STRINGID_PKMNFASTASLEEP diff --git a/include/battle_scripts.h b/include/battle_scripts.h index 8acf6e8ef..18c1911e5 100644 --- a/include/battle_scripts.h +++ b/include/battle_scripts.h @@ -451,6 +451,7 @@ extern const u8 BattleScript_EarthEaterActivates[]; extern const u8 BattleScript_MimicryActivates_End3[]; extern const u8 BattleScript_IceFaceNullsDamage[]; extern const u8 BattleScript_BattlerFormChangeWithStringEnd3[]; +extern const u8 BattleScript_DampPreventsAftermath[]; // zmoves extern const u8 BattleScript_ZMoveActivateDamaging[]; diff --git a/include/constants/battle_string_ids.h b/include/constants/battle_string_ids.h index f63aa79bc..636bcb94b 100644 --- a/include/constants/battle_string_ids.h +++ b/include/constants/battle_string_ids.h @@ -638,8 +638,9 @@ #define STRINGID_ELECTRICTERRAINACTIVATEDABILITY 636 #define STRINGID_ABILITYWEAKENEDFSURROUNDINGMONSSTAT 637 #define STRINGID_ATTACKERGAINEDSTRENGTHFROMTHEFALLEN 638 +#define STRINGID_PKMNSABILITYPREVENTSABILITY 639 -#define BATTLESTRINGS_COUNT 639 +#define BATTLESTRINGS_COUNT 640 // This is the string id that gBattleStringsTable starts with. // String ids before this (e.g. STRINGID_INTROMSG) are not in the table, diff --git a/src/battle_message.c b/src/battle_message.c index 34542e58d..7ec079e72 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -306,6 +306,7 @@ static const u8 sText_PreventedFromWorking[] = _("{B_DEF_NAME_WITH_PREFIX}'s {B_ static const u8 sText_PkmnsXMadeItIneffective[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX}'s {B_SCR_ACTIVE_ABILITY}\nmade it ineffective!"); static const u8 sText_PkmnsXPreventsFlinching[] = _("{B_EFF_NAME_WITH_PREFIX}'s {B_EFF_ABILITY}\nprevents flinching!"); static const u8 sText_PkmnsXPreventsYsZ[] = _("{B_ATK_NAME_WITH_PREFIX}'s {B_ATK_ABILITY}\nprevents {B_DEF_NAME_WITH_PREFIX}'s\l{B_DEF_ABILITY} from working!"); +static const u8 sText_PkmnsAbilityPreventsAbility[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX}'s {B_SCR_ACTIVE_ABILITY}\nprevents {B_DEF_NAME_WITH_PREFIX}'s\l{B_DEF_ABILITY} from working!"); static const u8 sText_PkmnsXCuredItsYProblem[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX}'s {B_SCR_ACTIVE_ABILITY}\ncured its {B_BUFF1} problem!"); static const u8 sText_PkmnsXHadNoEffectOnY[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX}'s {B_SCR_ACTIVE_ABILITY}\nhad no effect on {B_EFF_NAME_WITH_PREFIX}!"); const u8 gText_StatSharply[] = _("sharply "); @@ -1402,6 +1403,7 @@ const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] = [STRINGID_PKMNTOOKTARGETHIGH - BATTLESTRINGS_TABLE_START] = sText_PkmnTookTargetHigh, [STRINGID_TARGETTOOHEAVY - BATTLESTRINGS_TABLE_START] = sText_TargetTooHeavy, [STRINGID_ATTACKERLOSTELECTRICTYPE - BATTLESTRINGS_TABLE_START] = sText_AttackerLostElectricType, + [STRINGID_PKMNSABILITYPREVENTSABILITY - BATTLESTRINGS_TABLE_START] = sText_PkmnsAbilityPreventsAbility, }; const u16 gZEffectStringIds[] = @@ -1592,7 +1594,6 @@ const u16 gUproarAwakeStringIds[] = { [B_MSG_CANT_SLEEP_UPROAR] = STRINGID_PKMNCANTSLEEPINUPROAR2, [B_MSG_UPROAR_KEPT_AWAKE] = STRINGID_UPROARKEPTPKMNAWAKE, - [B_MSG_STAYED_AWAKE_USING] = STRINGID_PKMNSTAYEDAWAKEUSING, }; const u16 gStatUpStringIds[] = diff --git a/src/battle_util.c b/src/battle_util.c index 2bbd2f530..c51585185 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -5566,17 +5566,26 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move } break; case ABILITY_AFTERMATH: - if (!IsAbilityOnField(ABILITY_DAMP) - && !(gMoveResultFlags & MOVE_RESULT_NO_EFFECT) + if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT) && gBattleMons[gBattlerTarget].hp == 0 && IsBattlerAlive(gBattlerAttacker) && IsMoveMakingContact(move, gBattlerAttacker)) { - gBattleMoveDamage = gBattleMons[gBattlerAttacker].maxHP / 4; - if (gBattleMoveDamage == 0) - gBattleMoveDamage = 1; - BattleScriptPushCursor(); - gBattlescriptCurrInstr = BattleScript_AftermathDmg; + u8 battler; + if ((battler = IsAbilityOnField(ABILITY_DAMP))) + { + gBattleScripting.battler = battler - 1; + BattleScriptPushCursor(); + gBattlescriptCurrInstr = BattleScript_DampPreventsAftermath; + } + else + { + gBattleMoveDamage = gBattleMons[gBattlerAttacker].maxHP / 4; + if (gBattleMoveDamage == 0) + gBattleMoveDamage = 1; + BattleScriptPushCursor(); + gBattlescriptCurrInstr = BattleScript_AftermathDmg; + } effect++; } break;