From a9d5c2cd289e6ad4aca2f541982da5fb940a7e6f Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Mon, 11 Aug 2025 10:06:58 -0400 Subject: [PATCH] Updated Dream Eater/Liquid Ooze's interaction to Gen 5 standards (#7528) --- data/battle_scripts_1.s | 51 +++--------------------- docs/tutorials/how_to_testing_system.md | 2 +- include/battle_scripts.h | 2 +- include/config/battle.h | 3 +- include/constants/battle_move_effects.h | 2 +- include/constants/battle_string_ids.h | 1 - include/constants/generational_changes.h | 1 + include/generational_changes.h | 1 + include/test/battle.h | 2 +- src/battle_message.c | 1 - src/battle_script_commands.c | 14 ++++--- src/battle_util.c | 4 +- test/battle/ability/liquid_ooze.c | 3 +- test/battle/move_effect/dream_eater.c | 4 +- 14 files changed, 27 insertions(+), 64 deletions(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 53f6697aef..248d79714d 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -2835,13 +2835,6 @@ BattleScript_AlreadyAsleep:: setmoveresultflags MOVE_RESULT_FAILED goto BattleScript_MoveEnd -BattleScript_WasntAffected:: - pause B_WAIT_TIME_SHORT - printstring STRINGID_PKMNWASNTAFFECTED - waitmessage B_WAIT_TIME_LONG - setmoveresultflags MOVE_RESULT_FAILED - goto BattleScript_MoveEnd - BattleScript_CantMakeAsleep:: pause B_WAIT_TIME_SHORT printfromtable gUproarAwakeStringIds @@ -2886,44 +2879,10 @@ BattleScript_MaxHp50Recoil:: BattleScript_EffectDreamEater:: attackcanceler - jumpifsubstituteblocks BattleScript_DreamEaterNoEffect - jumpifstatus BS_TARGET, STATUS1_SLEEP, BattleScript_DreamEaterWorked - jumpifability BS_TARGET, ABILITY_COMATOSE, BattleScript_DreamEaterWorked -BattleScript_DreamEaterNoEffect: - attackstring - ppreduce - waitmessage B_WAIT_TIME_LONG - goto BattleScript_WasntAffected -BattleScript_DreamEaterWorked: - accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE - attackstring - ppreduce - critcalc - damagecalc - adjustdamage - attackanimation - waitanimation - effectivenesssound - hitanimation BS_TARGET - waitstate - healthbarupdate BS_TARGET - datahpupdate BS_TARGET - critmessage - waitmessage B_WAIT_TIME_LONG - resultmessage - waitmessage B_WAIT_TIME_LONG - jumpifstatus3 BS_ATTACKER, STATUS3_HEAL_BLOCK, BattleScript_DreamEaterTryFaintEnd - setdrainedhp - manipulatedamage DMG_BIG_ROOT - orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE - healthbarupdate BS_ATTACKER - datahpupdate BS_ATTACKER - jumpifmovehadnoeffect BattleScript_DreamEaterTryFaintEnd - printstring STRINGID_PKMNENERGYDRAINED - waitmessage B_WAIT_TIME_LONG -BattleScript_DreamEaterTryFaintEnd: - tryfaintmon BS_TARGET - goto BattleScript_MoveEnd + jumpifsubstituteblocks BattleScript_DoesntAffectTargetAtkString + jumpifstatus BS_TARGET, STATUS1_SLEEP, BattleScript_HitFromAccCheck + jumpifability BS_TARGET, ABILITY_COMATOSE, BattleScript_HitFromAccCheck + goto BattleScript_DoesntAffectTargetAtkString BattleScript_EffectMirrorMove:: attackcanceler @@ -9168,7 +9127,7 @@ BattleScript_EjectPackActivates:: jumpifcantswitch BS_SCRIPTING, BattleScript_EjectButtonEnd goto BattleScript_EjectPackActivate_Ret -BattleScript_DarkTypePreventsPrankster:: +BattleScript_DoesntAffectTargetAtkString:: attackstring ppreduce pause B_WAIT_TIME_SHORT diff --git a/docs/tutorials/how_to_testing_system.md b/docs/tutorials/how_to_testing_system.md index c5fbb945aa..b663ad54b4 100644 --- a/docs/tutorials/how_to_testing_system.md +++ b/docs/tutorials/how_to_testing_system.md @@ -428,7 +428,7 @@ Spaces in pattern match newlines (\n, \l, and \p) in the message. Often used to check that a battler took its turn but it failed, e.g.: ``` MESSAGE("Wobbuffet used Dream Eater!"); - MESSAGE("The opposing Wobbuffet wasn't affected!"); + MESSAGE("It doesn't affect the opposing Wobbuffet…"); ``` ### `STATUS_ICON` diff --git a/include/battle_scripts.h b/include/battle_scripts.h index ef6206cf45..46326a42df 100644 --- a/include/battle_scripts.h +++ b/include/battle_scripts.h @@ -426,7 +426,7 @@ extern const u8 BattleScript_MentalHerbCureEnd2[]; extern const u8 BattleScript_TerrainPreventsEnd2[]; extern const u8 BattleScript_MistyTerrainPrevents[]; extern const u8 BattleScript_ElectricTerrainPrevents[]; -extern const u8 BattleScript_DarkTypePreventsPrankster[]; +extern const u8 BattleScript_DoesntAffectTargetAtkString[]; extern const u8 BattleScript_GulpMissileGorging[]; extern const u8 BattleScript_GulpMissileGulping[]; extern const u8 BattleScript_GulpMissileFormChange[]; diff --git a/include/config/battle.h b/include/config/battle.h index d09698c634..3cfd319304 100644 --- a/include/config/battle.h +++ b/include/config/battle.h @@ -131,7 +131,8 @@ #define B_SKIP_RECHARGE GEN_LATEST // In Gen1, recharging moves such as Hyper Beam skip the recharge if the target gets KO'd #define B_ENCORE_TARGET GEN_LATEST // In Gen5+, encored moves are allowed to choose a target #define B_TIME_OF_DAY_HEALING_MOVES GEN_LATEST // In Gen2, Morning Sun, Moonlight, and Synthesis heal twice as much HP based off the time of day. Also changes how much they heal. Evening affects Moonlight. - // If OW_TIMES_OF_DAY is set to Gen 3, then Morning Sun is boosted during the day. + // If OW_TIMES_OF_DAY is set to Gen 3, then Morning Sun is boosted during the day. +#define B_DREAM_EATER_LIQUID_OOZE GEN_LATEST // In Gen5+, Dream Eater is affected by Liquid Ooze. // Ability settings #define B_GALE_WINGS GEN_LATEST // In Gen7+ requires full HP to trigger. diff --git a/include/constants/battle_move_effects.h b/include/constants/battle_move_effects.h index 53c9843d5b..2ddb75adf6 100644 --- a/include/constants/battle_move_effects.h +++ b/include/constants/battle_move_effects.h @@ -9,7 +9,7 @@ enum __attribute__((packed)) BattleMoveEffects EFFECT_ABSORB, EFFECT_EXPLOSION, EFFECT_MISTY_EXPLOSION, // Same as EFFECT_EXPLOSION but it's boosted on Misty Terrain - EFFECT_DREAM_EATER, + EFFECT_DREAM_EATER, // Same as EFFECT_ABSORB but it can only be used on sleeping targets EFFECT_MIRROR_MOVE, EFFECT_ATTACK_UP, EFFECT_DEFENSE_UP, diff --git a/include/constants/battle_string_ids.h b/include/constants/battle_string_ids.h index df7b5e6232..3343a449e7 100644 --- a/include/constants/battle_string_ids.h +++ b/include/constants/battle_string_ids.h @@ -41,7 +41,6 @@ enum StringID STRINGID_PKMNMADESLEEP, STRINGID_PKMNALREADYASLEEP, STRINGID_PKMNALREADYASLEEP2, - STRINGID_PKMNWASNTAFFECTED, STRINGID_PKMNWASPOISONED, STRINGID_PKMNPOISONEDBY, STRINGID_PKMNHURTBYPOISON, diff --git a/include/constants/generational_changes.h b/include/constants/generational_changes.h index 6892f70ee2..e51d57915c 100644 --- a/include/constants/generational_changes.h +++ b/include/constants/generational_changes.h @@ -28,6 +28,7 @@ enum GenConfigTag GEN_STEAL_WILD_ITEMS, GEN_SNOW_WARNING, GEN_ALLY_SWITCH_FAIL_CHANCE, + GEN_DREAM_EATER_LIQUID_OOZE, GEN_CONFIG_COUNT }; diff --git a/include/generational_changes.h b/include/generational_changes.h index 9c24608e63..53991bab1f 100644 --- a/include/generational_changes.h +++ b/include/generational_changes.h @@ -31,6 +31,7 @@ static const u8 sGenerationalChanges[GEN_CONFIG_COUNT] = [GEN_STEAL_WILD_ITEMS] = B_STEAL_WILD_ITEMS, [GEN_SNOW_WARNING] = B_SNOW_WARNING, [GEN_ALLY_SWITCH_FAIL_CHANCE] = B_ALLY_SWITCH_FAIL_CHANCE, + [GEN_DREAM_EATER_LIQUID_OOZE] = B_DREAM_EATER_LIQUID_OOZE, }; #if TESTING diff --git a/include/test/battle.h b/include/test/battle.h index 2ec2b1da0a..b95038b09e 100644 --- a/include/test/battle.h +++ b/include/test/battle.h @@ -434,7 +434,7 @@ * Spaces in pattern match newlines (\n, \l, and \p) in the message. * Often used to check that a battler took its turn but it failed, e.g.: * MESSAGE("Wobbuffet used Dream Eater!"); - * MESSAGE("The opposing Wobbuffet wasn't affected!"); + * MESSAGE("It doesn't affect the opposing Wobbuffet…"); * * STATUS_ICON(battler, status1 | none: | sleep: | poison: | burn: | freeze: | paralysis:, badPoison:) * Causes the test to fail if the battler's status is not changed to the diff --git a/src/battle_message.c b/src/battle_message.c index d49b96b8be..132cfa66f0 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -200,7 +200,6 @@ const u8 *const gBattleStringsTable[STRINGID_COUNT] = [STRINGID_PKMNMADESLEEP] = COMPOUND_STRING("{B_SCR_NAME_WITH_PREFIX}'s {B_BUFF1} made {B_EFF_NAME_WITH_PREFIX2} sleep!"), //not in gen 5+, ability popup [STRINGID_PKMNALREADYASLEEP] = COMPOUND_STRING("{B_DEF_NAME_WITH_PREFIX} is already asleep!"), [STRINGID_PKMNALREADYASLEEP2] = COMPOUND_STRING("{B_ATK_NAME_WITH_PREFIX} is already asleep!"), - [STRINGID_PKMNWASNTAFFECTED] = COMPOUND_STRING("{B_DEF_NAME_WITH_PREFIX} wasn't affected!"), //not in gen 5+, ability popup [STRINGID_PKMNWASPOISONED] = COMPOUND_STRING("{B_EFF_NAME_WITH_PREFIX} was poisoned!"), [STRINGID_PKMNPOISONEDBY] = COMPOUND_STRING("{B_EFF_NAME_WITH_PREFIX} was poisoned by {B_SCR_NAME_WITH_PREFIX2}'s {B_BUFF1}!"), //not in gen 5+, ability popup [STRINGID_PKMNHURTBYPOISON] = COMPOUND_STRING("{B_ATK_NAME_WITH_PREFIX} was hurt by its poisoning!"), diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 109f044f2c..8bd6d3ab6a 100755 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -6066,6 +6066,7 @@ static void Cmd_moveend(void) switch (moveEffect) { case EFFECT_ABSORB: + case EFFECT_DREAM_EATER: if (!(gStatuses3[gBattlerAttacker] & STATUS3_HEAL_BLOCK) && gBattleStruct->moveDamage[gBattlerTarget] > 0 && IsBattlerAlive(gBattlerAttacker)) @@ -6075,18 +6076,19 @@ static void Cmd_moveend(void) gHitMarker |= HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_IGNORE_DISGUISE; effect = TRUE; - if (GetBattlerAbility(gBattlerTarget) == ABILITY_LIQUID_OOZE) + if ((moveEffect == EFFECT_DREAM_EATER && GetGenConfig(GEN_DREAM_EATER_LIQUID_OOZE) < GEN_5) + || GetBattlerAbility(gBattlerTarget) != ABILITY_LIQUID_OOZE) + { + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_ABSORB; + BattleScriptCall(BattleScript_EffectAbsorb); + } + else { gBattleStruct->moveDamage[gBattlerAttacker] *= -1; gHitMarker |= HITMARKER_PASSIVE_DAMAGE; gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_ABSORB_OOZE; BattleScriptCall(BattleScript_EffectAbsorbLiquidOoze); } - else - { - gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_ABSORB; - BattleScriptCall(BattleScript_EffectAbsorb); - } } break; case EFFECT_FINAL_GAMBIT: diff --git a/src/battle_util.c b/src/battle_util.c index 97753232c6..13f830d953 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -1194,7 +1194,7 @@ void PrepareStringBattle(enum StringID stringId, u32 battler) SET_STATCHANGER(STAT_SPEED, 1, FALSE); } - if ((stringId == STRINGID_ITDOESNTAFFECT || stringId == STRINGID_PKMNWASNTAFFECTED || stringId == STRINGID_PKMNUNAFFECTED)) + if ((stringId == STRINGID_ITDOESNTAFFECT || stringId == STRINGID_PKMNUNAFFECTED)) TryInitializeTrainerSlideEnemyMonUnaffected(gBattlerTarget); BtlController_EmitPrintString(battler, B_COMM_TO_CONTROLLER, stringId); @@ -3046,7 +3046,7 @@ bool32 CanAbilityBlockMove(u32 battlerAtk, u32 battlerDef, u32 abilityAtk, u32 a if (option == RUN_SCRIPT && !IsSpreadMove(GetBattlerMoveTargetType(battlerAtk, move))) CancelMultiTurnMoves(battlerAtk, SKY_DROP_ATTACKCANCELLER_CHECK); // Don't cancel moves that can hit two targets bc one target might not be protected - battleScriptBlocksMove = BattleScript_DarkTypePreventsPrankster; + battleScriptBlocksMove = BattleScript_DoesntAffectTargetAtkString; } // Check def partner ability diff --git a/test/battle/ability/liquid_ooze.c b/test/battle/ability/liquid_ooze.c index 1bd3cbbdf8..2c89702911 100644 --- a/test/battle/ability/liquid_ooze.c +++ b/test/battle/ability/liquid_ooze.c @@ -140,9 +140,9 @@ SINGLE_BATTLE_TEST("Liquid Ooze causes leech seed victim to faint before seeder" SINGLE_BATTLE_TEST("Liquid Ooze causes Dream Eater users to lose HP instead of heal (Gen 5+)") { - KNOWN_FAILING; s16 damage; GIVEN { + WITH_CONFIG(GEN_DREAM_EATER_LIQUID_OOZE, GEN_5); ASSUME(GetMoveEffect(MOVE_SPORE) == EFFECT_NON_VOLATILE_STATUS); ASSUME(GetMoveNonVolatileStatus(MOVE_SPORE) == MOVE_EFFECT_SLEEP); ASSUME(GetMoveEffect(MOVE_DREAM_EATER) == EFFECT_DREAM_EATER); @@ -167,6 +167,7 @@ SINGLE_BATTLE_TEST("Liquid Ooze does not cause Dream Eater users to lose HP inst { s16 damage; GIVEN { + WITH_CONFIG(GEN_DREAM_EATER_LIQUID_OOZE, GEN_3); ASSUME(GetMoveEffect(MOVE_SPORE) == EFFECT_NON_VOLATILE_STATUS); ASSUME(GetMoveNonVolatileStatus(MOVE_SPORE) == MOVE_EFFECT_SLEEP); ASSUME(GetMoveEffect(MOVE_DREAM_EATER) == EFFECT_DREAM_EATER); diff --git a/test/battle/move_effect/dream_eater.c b/test/battle/move_effect/dream_eater.c index caa365a17a..baefd2e4ff 100644 --- a/test/battle/move_effect/dream_eater.c +++ b/test/battle/move_effect/dream_eater.c @@ -33,7 +33,7 @@ SINGLE_BATTLE_TEST("Dream Eater fails on awake targets") TURN { MOVE(player, MOVE_DREAM_EATER); } } SCENE { MESSAGE("Wobbuffet used Dream Eater!"); - MESSAGE("The opposing Wobbuffet wasn't affected!"); + MESSAGE("It doesn't affect the opposing Wobbuffet…"); } } @@ -88,7 +88,7 @@ SINGLE_BATTLE_TEST("Dream Eater fails if the target is behind a Substitute (Gen TURN { MOVE(opponent, MOVE_DREAM_EATER); } } SCENE { MESSAGE("The opposing Wobbuffet used Dream Eater!"); - MESSAGE("Wobbuffet wasn't affected!"); + MESSAGE("It doesn't affect Wobbuffet…"); } } #else