diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 01eabc6d5..2b94ffff5 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 diff --git a/include/constants/battle_config.h b/include/constants/battle_config.h index 02f873659..a3a385995 100644 --- a/include/constants/battle_config.h +++ b/include/constants/battle_config.h @@ -111,7 +111,7 @@ #define B_ROUGH_SKIN_DMG GEN_7 // In Gen4+, Rough Skin contact damage is 1/8th of max HP instead of 1/16th. This will also affect Iron Barbs. // Type settings -#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+, abilities like Shadow Tag or moves like Mean Look fail on Ghost-type Pokémon. They can also escape any Wild Battle. #define B_PARALYZE_ELECTRIC GEN_7 // In Gen6+, Electric-type Pokémon can't be paralyzed. #define B_POWDER_GRASS GEN_7 // In Gen6+, Grass-type Pokémon are immune to powder and spore moves. #define B_STEEL_RESISTANCES GEN_7 // In Gen6+, Steel-type Pokémon are no longer resistant to Dark-type and Ghost-type moves. 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 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) diff --git a/src/battle_util.c b/src/battle_util.c index 9515a1f32..275139f4f 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())