From 8bdcbb856d1b1208340657f19f48f51d142cebc1 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada D'Ottone Date: Sat, 23 Oct 2021 11:41:31 -0300 Subject: [PATCH 1/5] Ghosts can now escape any wild battle --- src/battle_util.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/battle_util.c b/src/battle_util.c index 33dd0f5de..733cf53f7 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -621,6 +621,12 @@ bool8 TryRunFromBattle(u8 battler) gProtectStructs[battler].fleeFlag = 1; effect++; } + #if B_GHOSTS_ESCAPE >= GEN_6 + else if (IS_BATTLER_OF_TYPE(battler, TYPE_GHOST)) + { + effect++; + } + #endif else if (gBattleMons[battler].ability == ABILITY_RUN_AWAY) { if (InBattlePyramid()) From f4ff76c8ae08cb2fa5c1ba794f3eb7a9367cd4b8 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada D'Ottone Date: Sat, 23 Oct 2021 11:42:33 -0300 Subject: [PATCH 2/5] MOVE_EFFECT_MEAN_LOOK now fails on ghost types. --- data/battle_scripts_1.s | 3 +++ 1 file changed, 3 insertions(+) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index bf65bb190..3dc41b982 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -3977,6 +3977,9 @@ BattleScript_EffectMeanLook:: accuracycheck BattleScript_ButItFailed, NO_ACC_CALC_CHECK_LOCK_ON jumpifstatus2 BS_TARGET, STATUS2_ESCAPE_PREVENTION, BattleScript_ButItFailed jumpifsubstituteblocks BattleScript_ButItFailed +.if B_GHOSTS_ESCAPE >= GEN_6 + jumpiftype BS_TARGET, TYPE_GHOST, BattleScript_ButItFailed +.endif attackanimation waitanimation setmoveeffect MOVE_EFFECT_PREVENT_ESCAPE From 0f95adf77a11c4130a08b743e38321b5f24ef6d9 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada D'Ottone Date: Sat, 23 Oct 2021 11:56:56 -0300 Subject: [PATCH 3/5] Fixed AI check for Mean Look in case it's set to be GEN_5 or lower. --- src/battle_ai_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/battle_ai_main.c b/src/battle_ai_main.c index a2d97f785..b8ed21e9d 100644 --- a/src/battle_ai_main.c +++ b/src/battle_ai_main.c @@ -3335,7 +3335,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) case EFFECT_TRAP: case EFFECT_MEAN_LOOK: if (HasMoveEffect(battlerDef, EFFECT_RAPID_SPIN) - || IS_BATTLER_OF_TYPE(battlerDef, TYPE_GHOST) + || (B_GHOSTS_ESCAPE >= GEN_6 && IS_BATTLER_OF_TYPE(battlerDef, TYPE_GHOST)) || gBattleMons[battlerDef].status2 & STATUS2_WRAPPED) { break; // in this case its a bad attacking move From 9a8b88bdb3573ea07c9b2f77196696e774285eac Mon Sep 17 00:00:00 2001 From: Eduardo Quezada D'Ottone Date: Sat, 23 Oct 2021 11:59:57 -0300 Subject: [PATCH 4/5] Updated config description --- include/constants/battle_config.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/constants/battle_config.h b/include/constants/battle_config.h index 3aa9faea3..f368a12e3 100644 --- a/include/constants/battle_config.h +++ b/include/constants/battle_config.h @@ -130,7 +130,7 @@ #define B_ABILITY_WEATHER GEN_7 // In Gen6+, ability-induced weather lasts 5 turns. Before, it lasted until the battle ended or until it was changed by a move or a different weather-affecting ability. #define B_GALE_WINGS GEN_7 // In Gen7+ requires full HP to trigger. #define B_STANCE_CHANGE_FAIL GEN_7 // In Gen7+, Stance Change fails if the Pokémon is unable to use a move because of confusion, paralysis, etc. In Gen6, it doesn't. -#define B_GHOSTS_ESCAPE GEN_7 // In Gen6+, Ghost-type Pokémon can escape even when blocked by abilities such as Shadow Tag. +#define B_GHOSTS_ESCAPE GEN_7 // In Gen6+, Ghost-type Pokémon can escape even when trying to be blocked by abilities such as Shadow Tag or moves like Mean Look. They can also escape any Wild Battle. #define B_SHADOW_TAG_ESCAPE GEN_7 // In Gen4+, if both sides have a Pokémon with Shadow Tag, all battlers can escape. Before, neither side could escape this situation. #define B_MOODY_ACC_EVASION GEN_8 // In Gen8, Moody CANNOT raise Accuracy and Evasion anymore. #define B_FLASH_FIRE_FROZEN GEN_7 // In Gen5+, Flash Fire can trigger even when frozen, when it couldn't before. From d4eaa73292dcae415bf21648f2a313cdd71fa4ae Mon Sep 17 00:00:00 2001 From: Eduardo Quezada D'Ottone Date: Tue, 26 Oct 2021 20:45:59 -0300 Subject: [PATCH 5/5] Added check in IsRunningFromBattleImpossible. --- src/battle_main.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/battle_main.c b/src/battle_main.c index dddd3cc79..271e97731 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -3705,6 +3705,10 @@ u8 IsRunningFromBattleImpossible(void) if (holdEffect == HOLD_EFFECT_CAN_ALWAYS_RUN) return 0; + #if B_GHOSTS_ESCAPE >= GEN_6 + if (IS_BATTLER_OF_TYPE(gActiveBattler, TYPE_GHOST)) + return 0; + #endif if (gBattleTypeFlags & BATTLE_TYPE_LINK) return 0; if (GetBattlerAbility(gActiveBattler) == ABILITY_RUN_AWAY)