Merge pull request #1808 from AsparagusEduardo/BE_ghostEscape

Completed Ghost type trapping inmunity
This commit is contained in:
ghoulslash 2021-10-26 22:22:13 -04:00 committed by GitHub
commit 289ec6ad40
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 15 additions and 2 deletions

View File

@ -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

View File

@ -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.

View File

@ -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

View File

@ -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)

View File

@ -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())