mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-27 20:24:18 +01:00
ai scoring for snow and hail relation
we generally dont want to ecourage to use snow when hail is up and vice versa to avoid looping between the two weathers if score adds up. so we return false in the ShouldSetX functions if either weather is up We also reduce score by a little as further disincentive to loop and since both effect are so similar that switching between them is usually not a good idea
This commit is contained in:
parent
a877266400
commit
74f074f5f3
@ -280,7 +280,7 @@ void Ai_InitPartyStruct(void)
|
|||||||
{
|
{
|
||||||
if (GetMonData(&gPlayerParty[i], MON_DATA_HP) == 0)
|
if (GetMonData(&gPlayerParty[i], MON_DATA_HP) == 0)
|
||||||
AI_PARTY->mons[B_SIDE_PLAYER][i].isFainted = TRUE;
|
AI_PARTY->mons[B_SIDE_PLAYER][i].isFainted = TRUE;
|
||||||
|
|
||||||
if (isOmniscient)
|
if (isOmniscient)
|
||||||
{
|
{
|
||||||
u32 j;
|
u32 j;
|
||||||
@ -1578,14 +1578,18 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score)
|
|||||||
score -= 8;
|
score -= 8;
|
||||||
break;
|
break;
|
||||||
case EFFECT_HAIL:
|
case EFFECT_HAIL:
|
||||||
if (gBattleWeather & (B_WEATHER_HAIL | B_WEATHER_PRIMAL_ANY) // should hail be discouraged if snow is up?
|
if (gBattleWeather & (B_WEATHER_HAIL | B_WEATHER_PRIMAL_ANY)
|
||||||
|| PartnerMoveEffectIsWeather(BATTLE_PARTNER(battlerAtk), AI_DATA->partnerMove))
|
|| PartnerMoveEffectIsWeather(BATTLE_PARTNER(battlerAtk), AI_DATA->partnerMove))
|
||||||
score -= 8;
|
score -= 8;
|
||||||
|
else if (gBattleWeather & B_WEATHER_SNOW)
|
||||||
|
score -= 2; // mainly to prevent looping between hail and snow
|
||||||
break;
|
break;
|
||||||
case EFFECT_SNOWSCAPE:
|
case EFFECT_SNOWSCAPE:
|
||||||
if (gBattleWeather & (B_WEATHER_SNOW | B_WEATHER_PRIMAL_ANY) // should snow be discouraged if hail is up?
|
if (gBattleWeather & (B_WEATHER_SNOW | B_WEATHER_PRIMAL_ANY)
|
||||||
|| PartnerMoveEffectIsWeather(BATTLE_PARTNER(battlerAtk), AI_DATA->partnerMove))
|
|| PartnerMoveEffectIsWeather(BATTLE_PARTNER(battlerAtk), AI_DATA->partnerMove))
|
||||||
score -= 8;
|
score -= 8;
|
||||||
|
else if (gBattleWeather & B_WEATHER_HAIL)
|
||||||
|
score -= 2; // mainly to prevent looping between hail and snow
|
||||||
break;
|
break;
|
||||||
case EFFECT_ATTRACT:
|
case EFFECT_ATTRACT:
|
||||||
if (!AI_CanBeInfatuated(battlerAtk, battlerDef, AI_DATA->abilities[battlerDef],
|
if (!AI_CanBeInfatuated(battlerAtk, battlerDef, AI_DATA->abilities[battlerDef],
|
||||||
@ -3977,7 +3981,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score)
|
|||||||
score += 2;
|
score += 2;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case EFFECT_SNOWSCAPE: // any other reasons?
|
case EFFECT_SNOWSCAPE:
|
||||||
if (ShouldSetSnow(battlerAtk, AI_DATA->abilities[battlerAtk], AI_DATA->holdEffects[battlerAtk]))
|
if (ShouldSetSnow(battlerAtk, AI_DATA->abilities[battlerAtk], AI_DATA->holdEffects[battlerAtk]))
|
||||||
{
|
{
|
||||||
if ((HasMoveEffect(battlerAtk, EFFECT_AURORA_VEIL) || HasMoveEffect(BATTLE_PARTNER(battlerAtk), EFFECT_AURORA_VEIL))
|
if ((HasMoveEffect(battlerAtk, EFFECT_AURORA_VEIL) || HasMoveEffect(BATTLE_PARTNER(battlerAtk), EFFECT_AURORA_VEIL))
|
||||||
|
@ -1580,7 +1580,7 @@ bool32 ShouldSetHail(u8 battler, u16 ability, u16 holdEffect)
|
|||||||
{
|
{
|
||||||
if (!AI_WeatherHasEffect())
|
if (!AI_WeatherHasEffect())
|
||||||
return FALSE;
|
return FALSE;
|
||||||
else if (gBattleWeather & B_WEATHER_HAIL) // dont set hail if snow is up?
|
else if (gBattleWeather & (B_WEATHER_HAIL | B_WEATHER_SNOW))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (ability == ABILITY_SNOW_CLOAK
|
if (ability == ABILITY_SNOW_CLOAK
|
||||||
@ -1650,11 +1650,11 @@ bool32 ShouldSetSun(u8 battlerAtk, u16 atkAbility, u16 holdEffect)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool32 ShouldSetSnow(u8 battler, u16 ability, u16 holdEffect) // any other reasons snow should be set?
|
bool32 ShouldSetSnow(u8 battler, u16 ability, u16 holdEffect)
|
||||||
{
|
{
|
||||||
if (!AI_WeatherHasEffect())
|
if (!AI_WeatherHasEffect())
|
||||||
return FALSE;
|
return FALSE;
|
||||||
else if (gBattleWeather & B_WEATHER_SNOW) // dont set snow if hail is up?
|
else if (gBattleWeather & (B_WEATHER_SNOW | B_WEATHER_HAIL))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (ability == ABILITY_SNOW_CLOAK
|
if (ability == ABILITY_SNOW_CLOAK
|
||||||
|
Loading…
Reference in New Issue
Block a user