mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-11-17 12:07:38 +01:00
Merge pull request #1856 from ghoulslash/be/ai_magicguard
Fix AI discouraging own magic guard
This commit is contained in:
commit
d91d6c9162
@ -578,6 +578,21 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score)
|
|||||||
{
|
{
|
||||||
switch (AI_DATA->defAbility)
|
switch (AI_DATA->defAbility)
|
||||||
{
|
{
|
||||||
|
case ABILITY_MAGIC_GUARD:
|
||||||
|
switch (moveEffect)
|
||||||
|
{
|
||||||
|
case EFFECT_POISON:
|
||||||
|
case EFFECT_WILL_O_WISP:
|
||||||
|
case EFFECT_TOXIC:
|
||||||
|
case EFFECT_LEECH_SEED:
|
||||||
|
score -= 5;
|
||||||
|
break;
|
||||||
|
case EFFECT_CURSE:
|
||||||
|
if (IS_BATTLER_OF_TYPE(battlerAtk, TYPE_GHOST)) // Don't use Curse if you're a ghost type vs a Magic Guard user, they'll take no damage.
|
||||||
|
score -= 5;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
case ABILITY_VOLT_ABSORB:
|
case ABILITY_VOLT_ABSORB:
|
||||||
case ABILITY_MOTOR_DRIVE:
|
case ABILITY_MOTOR_DRIVE:
|
||||||
case ABILITY_LIGHTNING_ROD:
|
case ABILITY_LIGHTNING_ROD:
|
||||||
@ -2949,7 +2964,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ability checks
|
// attacker ability checks
|
||||||
switch (AI_DATA->atkAbility)
|
switch (AI_DATA->atkAbility)
|
||||||
{
|
{
|
||||||
case ABILITY_MOXIE:
|
case ABILITY_MOXIE:
|
||||||
@ -2960,21 +2975,6 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score)
|
|||||||
score += 8; // prioritize killing target for stat boost
|
score += 8; // prioritize killing target for stat boost
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ABILITY_MAGIC_GUARD:
|
|
||||||
switch (moveEffect)
|
|
||||||
{
|
|
||||||
case EFFECT_POISON:
|
|
||||||
case EFFECT_WILL_O_WISP:
|
|
||||||
case EFFECT_TOXIC:
|
|
||||||
case EFFECT_LEECH_SEED:
|
|
||||||
score -= 5;
|
|
||||||
break;
|
|
||||||
case EFFECT_CURSE:
|
|
||||||
if (IS_BATTLER_OF_TYPE(battlerDef, TYPE_GHOST))
|
|
||||||
score -= 5;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
} // ability checks
|
} // ability checks
|
||||||
|
|
||||||
// move effect checks
|
// move effect checks
|
||||||
|
Loading…
Reference in New Issue
Block a user