Changes score adjustments to tempScore increases (#4987)
This commit is contained in:
parent
2ad81d3446
commit
b21ffa1f9b
5 changed files with 92 additions and 88 deletions
|
@ -37,6 +37,7 @@ typedef s32 (*AiScoreFunc)(u32, u32, u32, s32);
|
|||
#define NO_DAMAGE_OR_FAILS -20 // Move fails or does no damage
|
||||
|
||||
// Scores given in AI_CalcMoveEffectScore
|
||||
#define NO_INCREASE 0
|
||||
#define WEAK_EFFECT 1
|
||||
#define DECENT_EFFECT 2
|
||||
#define GOOD_EFFECT 3
|
||||
|
|
|
@ -190,8 +190,8 @@ bool32 PartyHasMoveCategory(u32 battlerId, u32 category);
|
|||
bool32 SideHasMoveCategory(u32 battlerId, u32 category);
|
||||
|
||||
// score increases
|
||||
void IncreaseStatUpScore(u32 battlerAtk, u32 battlerDef, u32 statId, s32 *score);
|
||||
void IncreaseStatUpScoreContrary(u32 battlerAtk, u32 battlerDef, u32 statId, s32 *score);
|
||||
u32 IncreaseStatUpScore(u32 battlerAtk, u32 battlerDef, u32 statId);
|
||||
u32 IncreaseStatUpScoreContrary(u32 battlerAtk, u32 battlerDef, u32 statId);
|
||||
void IncreasePoisonScore(u32 battlerAtk, u32 battlerDef, u32 move, s32 *score);
|
||||
void IncreaseBurnScore(u32 battlerAtk, u32 battlerDef, u32 move, s32 *score);
|
||||
void IncreaseParalyzeScore(u32 battlerAtk, u32 battlerDef, u32 move, s32 *score);
|
||||
|
|
|
@ -182,7 +182,7 @@ static u32 GetAiFlags(u16 trainerId)
|
|||
// Automatically includes AI_FLAG_SMART_MON_CHOICES to improve smart switching
|
||||
if (flags & AI_FLAG_SMART_SWITCHING)
|
||||
flags |= AI_FLAG_SMART_MON_CHOICES;
|
||||
|
||||
|
||||
if (sDynamicAiFunc != NULL)
|
||||
flags |= AI_FLAG_DYNAMIC_FUNC;
|
||||
|
||||
|
@ -3303,44 +3303,44 @@ static u32 AI_CalcMoveEffectScore(u32 battlerAtk, u32 battlerDef, u32 move)
|
|||
break;
|
||||
case EFFECT_ATTACK_UP:
|
||||
case EFFECT_ATTACK_UP_USER_ALLY:
|
||||
IncreaseStatUpScore(battlerAtk, battlerDef, STAT_CHANGE_ATK, &score);
|
||||
ADJUST_SCORE(IncreaseStatUpScore(battlerAtk, battlerDef, STAT_CHANGE_ATK));
|
||||
break;
|
||||
case EFFECT_ATTACK_UP_2:
|
||||
IncreaseStatUpScore(battlerAtk, battlerDef, STAT_CHANGE_ATK_2, &score);
|
||||
ADJUST_SCORE(IncreaseStatUpScore(battlerAtk, battlerDef, STAT_CHANGE_ATK_2));
|
||||
break;
|
||||
case EFFECT_DEFENSE_UP:
|
||||
case EFFECT_DEFENSE_UP_3:
|
||||
IncreaseStatUpScore(battlerAtk, battlerDef, STAT_CHANGE_DEF, &score);
|
||||
ADJUST_SCORE(IncreaseStatUpScore(battlerAtk, battlerDef, STAT_CHANGE_DEF));
|
||||
break;
|
||||
case EFFECT_DEFENSE_UP_2:
|
||||
IncreaseStatUpScore(battlerAtk, battlerDef, STAT_CHANGE_DEF_2, &score);
|
||||
ADJUST_SCORE(IncreaseStatUpScore(battlerAtk, battlerDef, STAT_CHANGE_DEF_2));
|
||||
break;
|
||||
case EFFECT_SPEED_UP:
|
||||
IncreaseStatUpScore(battlerAtk, battlerDef, STAT_CHANGE_SPEED, &score);
|
||||
ADJUST_SCORE(IncreaseStatUpScore(battlerAtk, battlerDef, STAT_CHANGE_SPEED));
|
||||
break;
|
||||
case EFFECT_SPEED_UP_2:
|
||||
IncreaseStatUpScore(battlerAtk, battlerDef, STAT_CHANGE_SPEED_2, &score);
|
||||
ADJUST_SCORE(IncreaseStatUpScore(battlerAtk, battlerDef, STAT_CHANGE_SPEED_2));
|
||||
break;
|
||||
case EFFECT_SPECIAL_ATTACK_UP:
|
||||
IncreaseStatUpScore(battlerAtk, battlerDef, STAT_CHANGE_SPATK, &score);
|
||||
ADJUST_SCORE(IncreaseStatUpScore(battlerAtk, battlerDef, STAT_CHANGE_SPATK));
|
||||
break;
|
||||
case EFFECT_SPECIAL_ATTACK_UP_2:
|
||||
case EFFECT_SPECIAL_ATTACK_UP_3:
|
||||
IncreaseStatUpScore(battlerAtk, battlerDef, STAT_CHANGE_SPATK_2, &score);
|
||||
ADJUST_SCORE(IncreaseStatUpScore(battlerAtk, battlerDef, STAT_CHANGE_SPATK_2));
|
||||
break;
|
||||
case EFFECT_SPECIAL_DEFENSE_UP:
|
||||
IncreaseStatUpScore(battlerAtk, battlerDef, STAT_CHANGE_SPDEF, &score);
|
||||
ADJUST_SCORE(IncreaseStatUpScore(battlerAtk, battlerDef, STAT_CHANGE_SPDEF));
|
||||
break;
|
||||
case EFFECT_SPECIAL_DEFENSE_UP_2:
|
||||
IncreaseStatUpScore(battlerAtk, battlerDef, STAT_CHANGE_SPDEF_2, &score);
|
||||
ADJUST_SCORE(IncreaseStatUpScore(battlerAtk, battlerDef, STAT_CHANGE_SPDEF_2));
|
||||
break;
|
||||
case EFFECT_ACCURACY_UP:
|
||||
case EFFECT_ACCURACY_UP_2:
|
||||
IncreaseStatUpScore(battlerAtk, battlerDef, STAT_CHANGE_ACC, &score);
|
||||
ADJUST_SCORE(IncreaseStatUpScore(battlerAtk, battlerDef, STAT_CHANGE_ACC));
|
||||
break;
|
||||
case EFFECT_EVASION_UP:
|
||||
case EFFECT_EVASION_UP_2:
|
||||
IncreaseStatUpScore(battlerAtk, battlerDef, STAT_CHANGE_EVASION, &score);
|
||||
ADJUST_SCORE(IncreaseStatUpScore(battlerAtk, battlerDef, STAT_CHANGE_EVASION));
|
||||
break;
|
||||
case EFFECT_ATTACK_DOWN:
|
||||
case EFFECT_ATTACK_DOWN_2:
|
||||
|
@ -3437,13 +3437,13 @@ static u32 AI_CalcMoveEffectScore(u32 battlerAtk, u32 battlerDef, u32 move)
|
|||
case EFFECT_ACUPRESSURE:
|
||||
break;
|
||||
case EFFECT_ATTACK_ACCURACY_UP: // hone claws
|
||||
IncreaseStatUpScore(battlerAtk, battlerDef, STAT_CHANGE_ATK, &score);
|
||||
IncreaseStatUpScore(battlerAtk, battlerDef, STAT_CHANGE_ACC, &score);
|
||||
ADJUST_SCORE(IncreaseStatUpScore(battlerAtk, battlerDef, STAT_CHANGE_ATK));
|
||||
ADJUST_SCORE(IncreaseStatUpScore(battlerAtk, battlerDef, STAT_CHANGE_ACC));
|
||||
break;
|
||||
case EFFECT_GROWTH:
|
||||
case EFFECT_ATTACK_SPATK_UP: // work up
|
||||
IncreaseStatUpScore(battlerAtk, battlerDef, STAT_CHANGE_ATK, &score);
|
||||
IncreaseStatUpScore(battlerAtk, battlerDef, STAT_CHANGE_SPATK, &score);
|
||||
ADJUST_SCORE(IncreaseStatUpScore(battlerAtk, battlerDef, STAT_CHANGE_ATK));
|
||||
ADJUST_SCORE(IncreaseStatUpScore(battlerAtk, battlerDef, STAT_CHANGE_SPATK));
|
||||
break;
|
||||
case EFFECT_HAZE:
|
||||
if (AnyStatIsRaised(BATTLE_PARTNER(battlerAtk))
|
||||
|
@ -3572,7 +3572,7 @@ static u32 AI_CalcMoveEffectScore(u32 battlerAtk, u32 battlerDef, u32 move)
|
|||
ADJUST_SCORE(GOOD_EFFECT);
|
||||
else if (gBattleMons[battlerDef].status1 & (STATUS1_BURN | STATUS1_PSN_ANY | STATUS1_FROSTBITE))
|
||||
ADJUST_SCORE(DECENT_EFFECT);
|
||||
// TODO:
|
||||
// TODO:
|
||||
// if (IsPredictedToSwitch(battlerDef, battlerAtk)
|
||||
// ADJUST_SCORE(DECENT_EFFECT);
|
||||
if (HasMoveEffect(battlerDef, EFFECT_SLEEP)
|
||||
|
@ -3698,8 +3698,8 @@ static u32 AI_CalcMoveEffectScore(u32 battlerAtk, u32 battlerDef, u32 move)
|
|||
}
|
||||
else
|
||||
{
|
||||
IncreaseStatUpScore(battlerAtk, battlerDef, STAT_CHANGE_ATK, &score);
|
||||
IncreaseStatUpScore(battlerAtk, battlerDef, STAT_CHANGE_DEF, &score);
|
||||
ADJUST_SCORE(IncreaseStatUpScore(battlerAtk, battlerDef, STAT_CHANGE_ATK));
|
||||
ADJUST_SCORE(IncreaseStatUpScore(battlerAtk, battlerDef, STAT_CHANGE_DEF));
|
||||
}
|
||||
break;
|
||||
case EFFECT_PROTECT:
|
||||
|
@ -3887,7 +3887,7 @@ static u32 AI_CalcMoveEffectScore(u32 battlerAtk, u32 battlerDef, u32 move)
|
|||
case EFFECT_DEFENSE_CURL:
|
||||
if (HasMoveEffect(battlerAtk, EFFECT_ROLLOUT) && !(gBattleMons[battlerAtk].status2 & STATUS2_DEFENSE_CURL))
|
||||
ADJUST_SCORE(DECENT_EFFECT);
|
||||
IncreaseStatUpScore(battlerAtk, battlerDef, STAT_CHANGE_DEF, &score);
|
||||
ADJUST_SCORE(IncreaseStatUpScore(battlerAtk, battlerDef, STAT_CHANGE_DEF));
|
||||
break;
|
||||
case EFFECT_FIRST_TURN_ONLY:
|
||||
if (ShouldFakeOut(battlerAtk, battlerDef, move) && MoveHasAdditionalEffectWithChance(move, MOVE_EFFECT_FLINCH, 100))
|
||||
|
@ -3900,8 +3900,8 @@ static u32 AI_CalcMoveEffectScore(u32 battlerAtk, u32 battlerDef, u32 move)
|
|||
break;
|
||||
if (HasMoveEffect(battlerAtk, EFFECT_SWALLOW) || HasMoveEffect(battlerAtk, EFFECT_SPIT_UP))
|
||||
ADJUST_SCORE(DECENT_EFFECT);
|
||||
IncreaseStatUpScore(battlerAtk, battlerDef, STAT_CHANGE_DEF, &score);
|
||||
IncreaseStatUpScore(battlerAtk, battlerDef, STAT_CHANGE_SPDEF, &score);
|
||||
ADJUST_SCORE(IncreaseStatUpScore(battlerAtk, battlerDef, STAT_CHANGE_DEF));
|
||||
ADJUST_SCORE(IncreaseStatUpScore(battlerAtk, battlerDef, STAT_CHANGE_SPDEF));
|
||||
break;
|
||||
case EFFECT_SWAGGER:
|
||||
case EFFECT_FLATTER:
|
||||
|
@ -3981,7 +3981,7 @@ static u32 AI_CalcMoveEffectScore(u32 battlerAtk, u32 battlerDef, u32 move)
|
|||
if (HasDamagingMoveOfType(battlerAtk, TYPE_ELECTRIC))
|
||||
ADJUST_SCORE(DECENT_EFFECT);
|
||||
if (B_CHARGE_SPDEF_RAISE >= GEN_5)
|
||||
IncreaseStatUpScore(battlerAtk, battlerDef, STAT_CHANGE_SPDEF, &score);
|
||||
ADJUST_SCORE(IncreaseStatUpScore(battlerAtk, battlerDef, STAT_CHANGE_SPDEF));
|
||||
break;
|
||||
case EFFECT_TAUNT:
|
||||
if (IS_MOVE_STATUS(predictedMove))
|
||||
|
@ -4192,44 +4192,44 @@ static u32 AI_CalcMoveEffectScore(u32 battlerAtk, u32 battlerDef, u32 move)
|
|||
ADJUST_SCORE(DECENT_EFFECT);
|
||||
break;
|
||||
case EFFECT_COSMIC_POWER:
|
||||
IncreaseStatUpScore(battlerAtk, battlerDef, STAT_CHANGE_DEF, &score);
|
||||
IncreaseStatUpScore(battlerAtk, battlerDef, STAT_CHANGE_SPDEF, &score);
|
||||
ADJUST_SCORE(IncreaseStatUpScore(battlerAtk, battlerDef, STAT_CHANGE_DEF));
|
||||
ADJUST_SCORE(IncreaseStatUpScore(battlerAtk, battlerDef, STAT_CHANGE_SPDEF));
|
||||
break;
|
||||
case EFFECT_BULK_UP:
|
||||
IncreaseStatUpScore(battlerAtk, battlerDef, STAT_CHANGE_ATK, &score);
|
||||
IncreaseStatUpScore(battlerAtk, battlerDef, STAT_CHANGE_DEF, &score);
|
||||
ADJUST_SCORE(IncreaseStatUpScore(battlerAtk, battlerDef, STAT_CHANGE_ATK));
|
||||
ADJUST_SCORE(IncreaseStatUpScore(battlerAtk, battlerDef, STAT_CHANGE_DEF));
|
||||
break;
|
||||
case EFFECT_CALM_MIND:
|
||||
IncreaseStatUpScore(battlerAtk, battlerDef, STAT_CHANGE_SPATK, &score);
|
||||
IncreaseStatUpScore(battlerAtk, battlerDef, STAT_CHANGE_SPDEF, &score);
|
||||
ADJUST_SCORE(IncreaseStatUpScore(battlerAtk, battlerDef, STAT_CHANGE_SPATK));
|
||||
ADJUST_SCORE(IncreaseStatUpScore(battlerAtk, battlerDef, STAT_CHANGE_SPDEF));
|
||||
break;
|
||||
case EFFECT_GEOMANCY:
|
||||
if (aiData->holdEffects[battlerAtk] == HOLD_EFFECT_POWER_HERB)
|
||||
ADJUST_SCORE(GOOD_EFFECT);
|
||||
case EFFECT_QUIVER_DANCE:
|
||||
IncreaseStatUpScore(battlerAtk, battlerDef, STAT_CHANGE_SPEED, &score);
|
||||
IncreaseStatUpScore(battlerAtk, battlerDef, STAT_CHANGE_SPATK, &score);
|
||||
IncreaseStatUpScore(battlerAtk, battlerDef, STAT_CHANGE_SPDEF, &score);
|
||||
ADJUST_SCORE(IncreaseStatUpScore(battlerAtk, battlerDef, STAT_CHANGE_SPEED));
|
||||
ADJUST_SCORE(IncreaseStatUpScore(battlerAtk, battlerDef, STAT_CHANGE_SPATK));
|
||||
ADJUST_SCORE(IncreaseStatUpScore(battlerAtk, battlerDef, STAT_CHANGE_SPDEF));
|
||||
break;
|
||||
case EFFECT_VICTORY_DANCE:
|
||||
IncreaseStatUpScore(battlerAtk, battlerDef, STAT_CHANGE_SPEED, &score);
|
||||
IncreaseStatUpScore(battlerAtk, battlerDef, STAT_CHANGE_ATK, &score);
|
||||
IncreaseStatUpScore(battlerAtk, battlerDef, STAT_CHANGE_DEF, &score);
|
||||
ADJUST_SCORE(IncreaseStatUpScore(battlerAtk, battlerDef, STAT_CHANGE_SPEED));
|
||||
ADJUST_SCORE(IncreaseStatUpScore(battlerAtk, battlerDef, STAT_CHANGE_ATK));
|
||||
ADJUST_SCORE(IncreaseStatUpScore(battlerAtk, battlerDef, STAT_CHANGE_DEF));
|
||||
break;
|
||||
case EFFECT_SHELL_SMASH:
|
||||
if (aiData->holdEffects[battlerAtk] == HOLD_EFFECT_RESTORE_STATS)
|
||||
ADJUST_SCORE(WEAK_EFFECT);
|
||||
|
||||
IncreaseStatUpScore(battlerAtk, battlerDef, STAT_CHANGE_SPEED, &score);
|
||||
IncreaseStatUpScore(battlerAtk, battlerDef, STAT_CHANGE_SPATK, &score);
|
||||
IncreaseStatUpScore(battlerAtk, battlerDef, STAT_CHANGE_ATK, &score);
|
||||
ADJUST_SCORE(IncreaseStatUpScore(battlerAtk, battlerDef, STAT_CHANGE_SPEED));
|
||||
ADJUST_SCORE(IncreaseStatUpScore(battlerAtk, battlerDef, STAT_CHANGE_SPATK));
|
||||
ADJUST_SCORE(IncreaseStatUpScore(battlerAtk, battlerDef, STAT_CHANGE_ATK));
|
||||
break;
|
||||
case EFFECT_TIDY_UP:
|
||||
IncreaseTidyUpScore(battlerAtk, battlerDef, move, &score);
|
||||
case EFFECT_DRAGON_DANCE:
|
||||
case EFFECT_SHIFT_GEAR:
|
||||
IncreaseStatUpScore(battlerAtk, battlerDef, STAT_CHANGE_SPEED, &score);
|
||||
IncreaseStatUpScore(battlerAtk, battlerDef, STAT_CHANGE_ATK, &score);
|
||||
ADJUST_SCORE(IncreaseStatUpScore(battlerAtk, battlerDef, STAT_CHANGE_SPEED));
|
||||
ADJUST_SCORE(IncreaseStatUpScore(battlerAtk, battlerDef, STAT_CHANGE_ATK));
|
||||
break;
|
||||
case EFFECT_GUARD_SWAP:
|
||||
if (gBattleMons[battlerDef].statStages[STAT_DEF] > gBattleMons[battlerAtk].statStages[STAT_DEF]
|
||||
|
@ -4448,7 +4448,7 @@ static u32 AI_CalcMoveEffectScore(u32 battlerAtk, u32 battlerDef, u32 move)
|
|||
break;
|
||||
case EFFECT_TOXIC_THREAD:
|
||||
IncreasePoisonScore(battlerAtk, battlerDef, move, &score);
|
||||
IncreaseStatUpScore(battlerAtk, battlerDef, STAT_CHANGE_SPEED, &score);
|
||||
ADJUST_SCORE(IncreaseStatUpScore(battlerAtk, battlerDef, STAT_CHANGE_SPEED));
|
||||
break;
|
||||
case EFFECT_COUNTER:
|
||||
if ((!IsBattlerIncapacitated(battlerDef, aiData->abilities[battlerDef]) && predictedMove != MOVE_NONE)
|
||||
|
@ -4519,7 +4519,7 @@ static u32 AI_CalcMoveEffectScore(u32 battlerAtk, u32 battlerDef, u32 move)
|
|||
case MOVE_EFFECT_SP_ATK_PLUS_1:
|
||||
case MOVE_EFFECT_SP_DEF_PLUS_1:
|
||||
StageStatId = STAT_CHANGE_ATK + gMovesInfo[move].additionalEffects[i].moveEffect - MOVE_EFFECT_ATK_PLUS_1;
|
||||
IncreaseStatUpScore(battlerAtk, battlerDef, StageStatId, &score);
|
||||
ADJUST_SCORE(IncreaseStatUpScore(battlerAtk, battlerDef, StageStatId));
|
||||
break;
|
||||
case MOVE_EFFECT_ATK_PLUS_2:
|
||||
case MOVE_EFFECT_DEF_PLUS_2:
|
||||
|
@ -4527,15 +4527,15 @@ static u32 AI_CalcMoveEffectScore(u32 battlerAtk, u32 battlerDef, u32 move)
|
|||
case MOVE_EFFECT_SP_ATK_PLUS_2:
|
||||
case MOVE_EFFECT_SP_DEF_PLUS_2:
|
||||
StageStatId = STAT_CHANGE_ATK_2 + gMovesInfo[move].additionalEffects[i].moveEffect - MOVE_EFFECT_ATK_PLUS_1;
|
||||
IncreaseStatUpScore(battlerAtk, battlerDef, StageStatId, &score);
|
||||
ADJUST_SCORE(IncreaseStatUpScore(battlerAtk, battlerDef, StageStatId));
|
||||
break;
|
||||
case MOVE_EFFECT_ACC_PLUS_1:
|
||||
case MOVE_EFFECT_ACC_PLUS_2:
|
||||
IncreaseStatUpScore(battlerAtk, battlerDef, STAT_CHANGE_ACC, &score);
|
||||
ADJUST_SCORE(IncreaseStatUpScore(battlerAtk, battlerDef, STAT_CHANGE_ACC));
|
||||
break;
|
||||
case MOVE_EFFECT_EVS_PLUS_1:
|
||||
case MOVE_EFFECT_EVS_PLUS_2:
|
||||
IncreaseStatUpScore(battlerAtk, battlerDef, STAT_CHANGE_EVASION, &score);
|
||||
ADJUST_SCORE(IncreaseStatUpScore(battlerAtk, battlerDef, STAT_CHANGE_EVASION));
|
||||
break;
|
||||
case MOVE_EFFECT_RAPID_SPIN:
|
||||
if ((gSideStatuses[GetBattlerSide(battlerAtk)] & SIDE_STATUS_HAZARDS_ANY && CountUsablePartyMons(battlerAtk) != 0)
|
||||
|
@ -4554,7 +4554,7 @@ static u32 AI_CalcMoveEffectScore(u32 battlerAtk, u32 battlerDef, u32 move)
|
|||
case MOVE_EFFECT_SP_ATK_MINUS_1:
|
||||
case MOVE_EFFECT_SP_DEF_MINUS_1:
|
||||
StageStatId = STAT_CHANGE_ATK + gMovesInfo[move].additionalEffects[i].moveEffect - MOVE_EFFECT_ATK_MINUS_1;
|
||||
IncreaseStatUpScoreContrary(battlerAtk, battlerDef, StageStatId, &score);
|
||||
ADJUST_SCORE(IncreaseStatUpScoreContrary(battlerAtk, battlerDef, StageStatId));
|
||||
break;
|
||||
case MOVE_EFFECT_ATK_MINUS_2:
|
||||
case MOVE_EFFECT_DEF_MINUS_2:
|
||||
|
@ -4562,28 +4562,28 @@ static u32 AI_CalcMoveEffectScore(u32 battlerAtk, u32 battlerDef, u32 move)
|
|||
case MOVE_EFFECT_SP_ATK_MINUS_2:
|
||||
case MOVE_EFFECT_SP_DEF_MINUS_2:
|
||||
StageStatId = STAT_CHANGE_ATK + gMovesInfo[move].additionalEffects[i].moveEffect - MOVE_EFFECT_ATK_MINUS_2;
|
||||
IncreaseStatUpScoreContrary(battlerAtk, battlerDef, StageStatId, &score);
|
||||
ADJUST_SCORE(IncreaseStatUpScoreContrary(battlerAtk, battlerDef, StageStatId));
|
||||
break;
|
||||
case MOVE_EFFECT_ACC_MINUS_1:
|
||||
case MOVE_EFFECT_ACC_MINUS_2:
|
||||
IncreaseStatUpScoreContrary(battlerAtk, battlerDef, STAT_CHANGE_ACC, &score);
|
||||
ADJUST_SCORE(IncreaseStatUpScoreContrary(battlerAtk, battlerDef, STAT_CHANGE_ACC));
|
||||
break;
|
||||
case MOVE_EFFECT_EVS_MINUS_1:
|
||||
case MOVE_EFFECT_EVS_MINUS_2:
|
||||
IncreaseStatUpScoreContrary(battlerAtk, battlerDef, STAT_CHANGE_EVASION, &score);
|
||||
ADJUST_SCORE(IncreaseStatUpScoreContrary(battlerAtk, battlerDef, STAT_CHANGE_EVASION));
|
||||
break;
|
||||
case MOVE_EFFECT_DEF_SPDEF_DOWN:
|
||||
IncreaseStatUpScoreContrary(battlerAtk, battlerDef, STAT_CHANGE_DEF, &score);
|
||||
IncreaseStatUpScoreContrary(battlerAtk, battlerDef, STAT_CHANGE_SPDEF, &score);
|
||||
ADJUST_SCORE(IncreaseStatUpScoreContrary(battlerAtk, battlerDef, STAT_CHANGE_DEF));
|
||||
ADJUST_SCORE(IncreaseStatUpScoreContrary(battlerAtk, battlerDef, STAT_CHANGE_SPDEF));
|
||||
break;
|
||||
case MOVE_EFFECT_ATK_DEF_DOWN:
|
||||
IncreaseStatUpScoreContrary(battlerAtk, battlerDef, STAT_CHANGE_ATK, &score);
|
||||
IncreaseStatUpScoreContrary(battlerAtk, battlerDef, STAT_CHANGE_DEF, &score);
|
||||
ADJUST_SCORE(IncreaseStatUpScoreContrary(battlerAtk, battlerDef, STAT_CHANGE_ATK));
|
||||
ADJUST_SCORE(IncreaseStatUpScoreContrary(battlerAtk, battlerDef, STAT_CHANGE_DEF));
|
||||
break;
|
||||
case MOVE_EFFECT_V_CREATE:
|
||||
IncreaseStatUpScoreContrary(battlerAtk, battlerDef, STAT_CHANGE_DEF, &score);
|
||||
IncreaseStatUpScoreContrary(battlerAtk, battlerDef, STAT_CHANGE_SPEED, &score);
|
||||
IncreaseStatUpScoreContrary(battlerAtk, battlerDef, STAT_CHANGE_SPDEF, &score);
|
||||
ADJUST_SCORE(IncreaseStatUpScoreContrary(battlerAtk, battlerDef, STAT_CHANGE_DEF));
|
||||
ADJUST_SCORE(IncreaseStatUpScoreContrary(battlerAtk, battlerDef, STAT_CHANGE_SPEED));
|
||||
ADJUST_SCORE(IncreaseStatUpScoreContrary(battlerAtk, battlerDef, STAT_CHANGE_SPDEF));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -5376,7 +5376,7 @@ s32 AI_TagBattlePreferFoe(u32 battlerAtk, u32 battlerDef, u32 move, s32 score)
|
|||
/* attacking along the diagonal */
|
||||
ADJUST_SCORE(-20);
|
||||
}
|
||||
|
||||
|
||||
return score;
|
||||
}
|
||||
|
||||
|
|
|
@ -3581,114 +3581,117 @@ bool32 IsRecycleEncouragedItem(u32 item)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
static void IncreaseStatUpScoreInternal(u32 battlerAtk, u32 battlerDef, u32 statId, s32 *score, bool32 considerContrary)
|
||||
static u32 IncreaseStatUpScoreInternal(u32 battlerAtk, u32 battlerDef, u32 statId, bool32 considerContrary)
|
||||
{
|
||||
u32 tempScore = NO_INCREASE;
|
||||
u32 noOfHitsToFaint = NoOfHitsForTargetToFaintAI(battlerDef, battlerAtk);
|
||||
u32 aiIsFaster = AI_IsFaster(battlerAtk, battlerDef, TRUE);
|
||||
u32 shouldSetUp = ((noOfHitsToFaint >= 2 && aiIsFaster) || (noOfHitsToFaint >= 3 && !aiIsFaster) || noOfHitsToFaint == UNKNOWN_NO_OF_HITS);
|
||||
|
||||
if (considerContrary && AI_DATA->abilities[battlerAtk] == ABILITY_CONTRARY)
|
||||
return;
|
||||
return NO_INCREASE;
|
||||
|
||||
// Don't increase stat if AI is at +4
|
||||
if (gBattleMons[battlerAtk].statStages[statId] >= MAX_STAT_STAGE - 2)
|
||||
return;
|
||||
return NO_INCREASE;
|
||||
|
||||
// Don't increase stat if AI has less then 70% HP and number of hits isn't known
|
||||
if (AI_DATA->hpPercents[battlerAtk] < 70 && noOfHitsToFaint == UNKNOWN_NO_OF_HITS)
|
||||
return;
|
||||
return NO_INCREASE;
|
||||
|
||||
// Don't set up if AI is dead to residual damage from weather
|
||||
if (GetBattlerSecondaryDamage(battlerAtk) >= gBattleMons[battlerAtk].hp)
|
||||
return;
|
||||
return NO_INCREASE;
|
||||
|
||||
// Don't increase stats if opposing battler has Opportunist
|
||||
if (AI_DATA->abilities[battlerDef] == ABILITY_OPPORTUNIST)
|
||||
return;
|
||||
return NO_INCREASE;
|
||||
|
||||
switch (statId)
|
||||
{
|
||||
case STAT_CHANGE_ATK:
|
||||
if (HasMoveWithCategory(battlerAtk, DAMAGE_CATEGORY_PHYSICAL) && shouldSetUp)
|
||||
ADJUST_SCORE_PTR(DECENT_EFFECT);
|
||||
tempScore += DECENT_EFFECT;
|
||||
break;
|
||||
case STAT_CHANGE_DEF:
|
||||
if (HasMoveWithCategory(battlerDef, DAMAGE_CATEGORY_PHYSICAL) || !HasMoveWithCategory(battlerDef, DAMAGE_CATEGORY_SPECIAL))
|
||||
{
|
||||
if (AI_THINKING_STRUCT->aiFlags[battlerAtk] & AI_FLAG_STALL)
|
||||
ADJUST_SCORE_PTR(DECENT_EFFECT);
|
||||
tempScore += DECENT_EFFECT;
|
||||
else
|
||||
ADJUST_SCORE_PTR(WEAK_EFFECT);
|
||||
tempScore += WEAK_EFFECT;
|
||||
}
|
||||
break;
|
||||
case STAT_CHANGE_SPEED:
|
||||
if ((noOfHitsToFaint >= 3 && !aiIsFaster) || noOfHitsToFaint == UNKNOWN_NO_OF_HITS)
|
||||
ADJUST_SCORE_PTR(DECENT_EFFECT);
|
||||
tempScore += DECENT_EFFECT;
|
||||
break;
|
||||
case STAT_CHANGE_SPATK:
|
||||
if (HasMoveWithCategory(battlerAtk, DAMAGE_CATEGORY_SPECIAL) && shouldSetUp)
|
||||
ADJUST_SCORE_PTR(DECENT_EFFECT);
|
||||
tempScore += DECENT_EFFECT;
|
||||
break;
|
||||
case STAT_CHANGE_SPDEF:
|
||||
if (HasMoveWithCategory(battlerDef, DAMAGE_CATEGORY_SPECIAL) || !HasMoveWithCategory(battlerDef, DAMAGE_CATEGORY_PHYSICAL))
|
||||
{
|
||||
if (AI_THINKING_STRUCT->aiFlags[battlerAtk] & AI_FLAG_STALL)
|
||||
ADJUST_SCORE_PTR(DECENT_EFFECT);
|
||||
tempScore += DECENT_EFFECT;
|
||||
else
|
||||
ADJUST_SCORE_PTR(WEAK_EFFECT);
|
||||
tempScore += WEAK_EFFECT;
|
||||
}
|
||||
break;
|
||||
case STAT_CHANGE_ATK_2:
|
||||
if (HasMoveWithCategory(battlerAtk, DAMAGE_CATEGORY_PHYSICAL) && shouldSetUp)
|
||||
ADJUST_SCORE_PTR(GOOD_EFFECT);
|
||||
tempScore += GOOD_EFFECT;
|
||||
break;
|
||||
case STAT_CHANGE_DEF_2:
|
||||
if (HasMoveWithCategory(battlerDef, DAMAGE_CATEGORY_PHYSICAL) || !HasMoveWithCategory(battlerDef, DAMAGE_CATEGORY_SPECIAL))
|
||||
{
|
||||
if (AI_THINKING_STRUCT->aiFlags[battlerAtk] & AI_FLAG_STALL)
|
||||
ADJUST_SCORE_PTR(GOOD_EFFECT);
|
||||
tempScore += GOOD_EFFECT;
|
||||
else
|
||||
ADJUST_SCORE_PTR(DECENT_EFFECT);
|
||||
tempScore += DECENT_EFFECT;
|
||||
}
|
||||
break;
|
||||
case STAT_CHANGE_SPEED_2:
|
||||
if ((noOfHitsToFaint >= 3 && !aiIsFaster) || noOfHitsToFaint == UNKNOWN_NO_OF_HITS)
|
||||
ADJUST_SCORE_PTR(GOOD_EFFECT);
|
||||
tempScore += GOOD_EFFECT;
|
||||
break;
|
||||
case STAT_CHANGE_SPATK_2:
|
||||
if (HasMoveWithCategory(battlerAtk, DAMAGE_CATEGORY_SPECIAL) && shouldSetUp)
|
||||
ADJUST_SCORE_PTR(GOOD_EFFECT);
|
||||
tempScore += GOOD_EFFECT;
|
||||
break;
|
||||
case STAT_CHANGE_SPDEF_2:
|
||||
if (HasMoveWithCategory(battlerDef, DAMAGE_CATEGORY_SPECIAL) || !HasMoveWithCategory(battlerDef, DAMAGE_CATEGORY_PHYSICAL))
|
||||
{
|
||||
if (AI_THINKING_STRUCT->aiFlags[battlerAtk] & AI_FLAG_STALL)
|
||||
ADJUST_SCORE_PTR(GOOD_EFFECT);
|
||||
tempScore += GOOD_EFFECT;
|
||||
else
|
||||
ADJUST_SCORE_PTR(DECENT_EFFECT);
|
||||
tempScore += DECENT_EFFECT;
|
||||
}
|
||||
break;
|
||||
case STAT_CHANGE_ACC:
|
||||
if (gBattleMons[battlerAtk].statStages[STAT_ACC] <= 3) // Increase only if necessary
|
||||
ADJUST_SCORE_PTR(DECENT_EFFECT);
|
||||
tempScore += DECENT_EFFECT;
|
||||
break;
|
||||
case STAT_CHANGE_EVASION:
|
||||
if (noOfHitsToFaint > 3 || noOfHitsToFaint == UNKNOWN_NO_OF_HITS)
|
||||
ADJUST_SCORE_PTR(GOOD_EFFECT);
|
||||
tempScore += GOOD_EFFECT;
|
||||
else
|
||||
ADJUST_SCORE_PTR(DECENT_EFFECT);
|
||||
tempScore += DECENT_EFFECT;
|
||||
break;
|
||||
}
|
||||
|
||||
return tempScore;
|
||||
}
|
||||
|
||||
void IncreaseStatUpScore(u32 battlerAtk, u32 battlerDef, u32 statId, s32 *score)
|
||||
u32 IncreaseStatUpScore(u32 battlerAtk, u32 battlerDef, u32 statId)
|
||||
{
|
||||
IncreaseStatUpScoreInternal(battlerAtk, battlerDef, statId, score, TRUE);
|
||||
return IncreaseStatUpScoreInternal(battlerAtk, battlerDef, statId, TRUE);
|
||||
}
|
||||
|
||||
void IncreaseStatUpScoreContrary(u32 battlerAtk, u32 battlerDef, u32 statId, s32 *score)
|
||||
u32 IncreaseStatUpScoreContrary(u32 battlerAtk, u32 battlerDef, u32 statId)
|
||||
{
|
||||
IncreaseStatUpScoreInternal(battlerAtk, battlerDef, statId, score, FALSE);
|
||||
return IncreaseStatUpScoreInternal(battlerAtk, battlerDef, statId, FALSE);
|
||||
}
|
||||
|
||||
void IncreasePoisonScore(u32 battlerAtk, u32 battlerDef, u32 move, s32 *score)
|
||||
|
|
|
@ -38,7 +38,7 @@ Required fields for Pokemon:
|
|||
Both lines are valid. Gender (M) or (F) must use a capital letter.
|
||||
Nickname length is limited to 10 characters using standard letters.
|
||||
With narrow font it's increased to 12. Longer strings will be silently shortened.
|
||||
|
||||
|
||||
Optional fields for Pokemon:
|
||||
- Level (Number between 1 and 100, defaults to 100)
|
||||
- Ability (Ability Name or ABILITY_ABILITY_NAME)
|
||||
|
|
Loading…
Reference in a new issue