diff --git a/data/battle_ai_scripts.s b/data/battle_ai_scripts.s index e33ba431d..1c7bff51c 100644 --- a/data/battle_ai_scripts.s +++ b/data/battle_ai_scripts.s @@ -249,64 +249,64 @@ AI_CBM_BellyDrum: @ 82DC341 if_hp_less_than AI_USER, 51, Score_Minus10 AI_CBM_AttackUp: @ 82DC348 - if_stat_level_equal AI_USER, STAT_ATK, 12, Score_Minus10 + if_stat_level_equal AI_USER, STAT_ATK, MAX_STAT_STAGE, Score_Minus10 end AI_CBM_DefenseUp: @ 82DC351 - if_stat_level_equal AI_USER, STAT_DEF, 12, Score_Minus10 + if_stat_level_equal AI_USER, STAT_DEF, MAX_STAT_STAGE, Score_Minus10 end AI_CBM_SpeedUp: @ 82DC35A - if_stat_level_equal AI_USER, STAT_SPEED, 12, Score_Minus10 + if_stat_level_equal AI_USER, STAT_SPEED, MAX_STAT_STAGE, Score_Minus10 end AI_CBM_SpAtkUp: @ 82DC363 - if_stat_level_equal AI_USER, STAT_SPATK, 12, Score_Minus10 + if_stat_level_equal AI_USER, STAT_SPATK, MAX_STAT_STAGE, Score_Minus10 end AI_CBM_SpDefUp: @ 82DC36C - if_stat_level_equal AI_USER, STAT_SPDEF, 12, Score_Minus10 + if_stat_level_equal AI_USER, STAT_SPDEF, MAX_STAT_STAGE, Score_Minus10 end AI_CBM_AccUp: @ 82DC375 - if_stat_level_equal AI_USER, STAT_ACC, 12, Score_Minus10 + if_stat_level_equal AI_USER, STAT_ACC, MAX_STAT_STAGE, Score_Minus10 end AI_CBM_EvasionUp: @ 82DC37E - if_stat_level_equal AI_USER, STAT_EVASION, 12, Score_Minus10 + if_stat_level_equal AI_USER, STAT_EVASION, MAX_STAT_STAGE, Score_Minus10 end AI_CBM_AttackDown: @ 82DC387 - if_stat_level_equal AI_TARGET, STAT_ATK, 0, Score_Minus10 + if_stat_level_equal AI_TARGET, STAT_ATK, MIN_STAT_STAGE, Score_Minus10 get_ability AI_TARGET if_equal ABILITY_HYPER_CUTTER, Score_Minus10 goto CheckIfAbilityBlocksStatChange AI_CBM_DefenseDown: @ 82DC39C - if_stat_level_equal AI_TARGET, STAT_DEF, 0, Score_Minus10 + if_stat_level_equal AI_TARGET, STAT_DEF, MIN_STAT_STAGE, Score_Minus10 goto CheckIfAbilityBlocksStatChange AI_CBM_SpeedDown: @ 82DC3A9 - if_stat_level_equal AI_TARGET, STAT_SPEED, 0, Score_Minus10 + if_stat_level_equal AI_TARGET, STAT_SPEED, MIN_STAT_STAGE, Score_Minus10 if_ability AI_TARGET, ABILITY_SPEED_BOOST, Score_Minus10 goto CheckIfAbilityBlocksStatChange AI_CBM_SpAtkDown: @ 82DC3BF - if_stat_level_equal AI_TARGET, STAT_SPATK, 0, Score_Minus10 + if_stat_level_equal AI_TARGET, STAT_SPATK, MIN_STAT_STAGE, Score_Minus10 goto CheckIfAbilityBlocksStatChange AI_CBM_SpDefDown: @ 82DC3CC - if_stat_level_equal AI_TARGET, STAT_SPDEF, 0, Score_Minus10 + if_stat_level_equal AI_TARGET, STAT_SPDEF, MIN_STAT_STAGE, Score_Minus10 goto CheckIfAbilityBlocksStatChange AI_CBM_AccDown: @ 82DC3D9 - if_stat_level_equal AI_TARGET, STAT_ACC, 0, Score_Minus10 + if_stat_level_equal AI_TARGET, STAT_ACC, MIN_STAT_STAGE, Score_Minus10 get_ability AI_TARGET if_equal ABILITY_KEEN_EYE, Score_Minus10 goto CheckIfAbilityBlocksStatChange AI_CBM_EvasionDown: @ 82DC3EE - if_stat_level_equal AI_TARGET, STAT_EVASION, 0, Score_Minus10 + if_stat_level_equal AI_TARGET, STAT_EVASION, MIN_STAT_STAGE, Score_Minus10 CheckIfAbilityBlocksStatChange: @ 82DC3F6 get_ability AI_TARGET @@ -315,20 +315,20 @@ CheckIfAbilityBlocksStatChange: @ 82DC3F6 end AI_CBM_Haze: @ 82DC405 - if_stat_level_less_than AI_USER, STAT_ATK, 6, AI_CBM_Haze_End - if_stat_level_less_than AI_USER, STAT_DEF, 6, AI_CBM_Haze_End - if_stat_level_less_than AI_USER, STAT_SPEED, 6, AI_CBM_Haze_End - if_stat_level_less_than AI_USER, STAT_SPATK, 6, AI_CBM_Haze_End - if_stat_level_less_than AI_USER, STAT_SPDEF, 6, AI_CBM_Haze_End - if_stat_level_less_than AI_USER, STAT_ACC, 6, AI_CBM_Haze_End - if_stat_level_less_than AI_USER, STAT_EVASION, 6, AI_CBM_Haze_End - if_stat_level_more_than AI_TARGET, STAT_ATK, 6, AI_CBM_Haze_End - if_stat_level_more_than AI_TARGET, STAT_DEF, 6, AI_CBM_Haze_End - if_stat_level_more_than AI_TARGET, STAT_SPEED, 6, AI_CBM_Haze_End - if_stat_level_more_than AI_TARGET, STAT_SPATK, 6, AI_CBM_Haze_End - if_stat_level_more_than AI_TARGET, STAT_SPDEF, 6, AI_CBM_Haze_End - if_stat_level_more_than AI_TARGET, STAT_ACC, 6, AI_CBM_Haze_End - if_stat_level_more_than AI_TARGET, STAT_EVASION, 6, AI_CBM_Haze_End + if_stat_level_less_than AI_USER, STAT_ATK, DEFAULT_STAT_STAGE, AI_CBM_Haze_End + if_stat_level_less_than AI_USER, STAT_DEF, DEFAULT_STAT_STAGE, AI_CBM_Haze_End + if_stat_level_less_than AI_USER, STAT_SPEED, DEFAULT_STAT_STAGE, AI_CBM_Haze_End + if_stat_level_less_than AI_USER, STAT_SPATK, DEFAULT_STAT_STAGE, AI_CBM_Haze_End + if_stat_level_less_than AI_USER, STAT_SPDEF, DEFAULT_STAT_STAGE, AI_CBM_Haze_End + if_stat_level_less_than AI_USER, STAT_ACC, DEFAULT_STAT_STAGE, AI_CBM_Haze_End + if_stat_level_less_than AI_USER, STAT_EVASION, DEFAULT_STAT_STAGE, AI_CBM_Haze_End + if_stat_level_more_than AI_TARGET, STAT_ATK, DEFAULT_STAT_STAGE, AI_CBM_Haze_End + if_stat_level_more_than AI_TARGET, STAT_DEF, DEFAULT_STAT_STAGE, AI_CBM_Haze_End + if_stat_level_more_than AI_TARGET, STAT_SPEED, DEFAULT_STAT_STAGE, AI_CBM_Haze_End + if_stat_level_more_than AI_TARGET, STAT_SPATK, DEFAULT_STAT_STAGE, AI_CBM_Haze_End + if_stat_level_more_than AI_TARGET, STAT_SPDEF, DEFAULT_STAT_STAGE, AI_CBM_Haze_End + if_stat_level_more_than AI_TARGET, STAT_ACC, DEFAULT_STAT_STAGE, AI_CBM_Haze_End + if_stat_level_more_than AI_TARGET, STAT_EVASION, DEFAULT_STAT_STAGE, AI_CBM_Haze_End goto Score_Minus10 AI_CBM_Haze_End: @ 82DC47A @@ -436,8 +436,8 @@ AI_CBM_CantEscape: @ 82DC5B0 end AI_CBM_Curse: @ 82DC5BB - if_stat_level_equal AI_USER, STAT_ATK, 12, Score_Minus10 - if_stat_level_equal AI_USER, STAT_DEF, 12, Score_Minus8 + if_stat_level_equal AI_USER, STAT_ATK, MAX_STAT_STAGE, Score_Minus10 + if_stat_level_equal AI_USER, STAT_DEF, MAX_STAT_STAGE, Score_Minus8 end AI_CBM_Spikes: @ 82DC5CC @@ -484,8 +484,8 @@ AI_CBM_Safeguard: @ 82DC635 end AI_CBM_Memento: @ 82DC640 - if_stat_level_equal AI_TARGET, STAT_ATK, 0, Score_Minus10 - if_stat_level_equal AI_TARGET, STAT_SPATK, 0, Score_Minus8 + if_stat_level_equal AI_TARGET, STAT_ATK, MIN_STAT_STAGE, Score_Minus10 + if_stat_level_equal AI_TARGET, STAT_SPATK, MIN_STAT_STAGE, Score_Minus8 AI_CBM_BatonPass: @ 82DC650 count_usable_party_mons AI_USER @@ -574,18 +574,18 @@ AI_CBM_MudSport: @ 82DC71E end AI_CBM_Tickle: @ 82DC729 - if_stat_level_equal AI_TARGET, STAT_ATK, 0, Score_Minus10 - if_stat_level_equal AI_TARGET, STAT_DEF, 0, Score_Minus8 + if_stat_level_equal AI_TARGET, STAT_ATK, MIN_STAT_STAGE, Score_Minus10 + if_stat_level_equal AI_TARGET, STAT_DEF, MIN_STAT_STAGE, Score_Minus8 end AI_CBM_CosmicPower: @ 82DC73A - if_stat_level_equal AI_USER, STAT_DEF, 12, Score_Minus10 - if_stat_level_equal AI_USER, STAT_SPDEF, 12, Score_Minus8 + if_stat_level_equal AI_USER, STAT_DEF, MAX_STAT_STAGE, Score_Minus10 + if_stat_level_equal AI_USER, STAT_SPDEF, MAX_STAT_STAGE, Score_Minus8 end AI_CBM_BulkUp: @ 82DC74B - if_stat_level_equal AI_USER, STAT_ATK, 12, Score_Minus10 - if_stat_level_equal AI_USER, STAT_DEF, 12, Score_Minus8 + if_stat_level_equal AI_USER, STAT_ATK, MAX_STAT_STAGE, Score_Minus10 + if_stat_level_equal AI_USER, STAT_DEF, MAX_STAT_STAGE, Score_Minus8 end AI_CBM_WaterSport: @ 82DC75C @@ -593,13 +593,13 @@ AI_CBM_WaterSport: @ 82DC75C end AI_CBM_CalmMind: @ 82DC767 - if_stat_level_equal AI_USER, STAT_SPATK, 12, Score_Minus10 - if_stat_level_equal AI_USER, STAT_SPDEF, 12, Score_Minus8 + if_stat_level_equal AI_USER, STAT_SPATK, MAX_STAT_STAGE, Score_Minus10 + if_stat_level_equal AI_USER, STAT_SPDEF, MAX_STAT_STAGE, Score_Minus8 end AI_CBM_DragonDance: @ 82DC778 - if_stat_level_equal AI_USER, STAT_ATK, 12, Score_Minus10 - if_stat_level_equal AI_USER, STAT_SPEED, 12, Score_Minus8 + if_stat_level_equal AI_USER, STAT_ATK, MAX_STAT_STAGE, Score_Minus10 + if_stat_level_equal AI_USER, STAT_SPEED, MAX_STAT_STAGE, Score_Minus8 end Score_Minus1: @@ -1101,7 +1101,7 @@ AI_CV_EvasionUp7: AI_CV_EvasionUp8: if_hp_more_than AI_USER, 70, AI_CV_EvasionUp_End - if_stat_level_equal AI_USER, STAT_EVASION, 6, AI_CV_EvasionUp_End + if_stat_level_equal AI_USER, STAT_EVASION, DEFAULT_STAT_STAGE, AI_CV_EvasionUp_End if_hp_less_than AI_USER, 40, AI_CV_EvasionUp_ScoreDown2 if_hp_less_than AI_TARGET, 40, AI_CV_EvasionUp_ScoreDown2 if_random_less_than 70, AI_CV_EvasionUp_End @@ -1130,7 +1130,7 @@ AI_CV_AlwaysHit_End: end AI_CV_AttackDown: @ 82DCDF8 - if_stat_level_equal AI_TARGET, STAT_ATK, 6, AI_CV_AttackDown3 + if_stat_level_equal AI_TARGET, STAT_ATK, DEFAULT_STAT_STAGE, AI_CV_AttackDown3 score -1 if_hp_more_than AI_USER, 90, AI_CV_AttackDown2 score -1 @@ -1198,7 +1198,7 @@ AI_CV_SpeedDown_End: @ 82DCE96 end AI_CV_SpAtkDown: - if_stat_level_equal AI_TARGET, STAT_ATK, 6, AI_CV_SpAtkDown3 + if_stat_level_equal AI_TARGET, STAT_ATK, DEFAULT_STAT_STAGE, AI_CV_SpAtkDown3 score -1 if_hp_more_than AI_USER, 90, AI_CV_SpAtkDown2 score -1 @@ -1284,7 +1284,7 @@ AI_CV_AccuracyDown7: AI_CV_AccuracyDown8: if_hp_more_than AI_USER, 70, AI_CV_AccuracyDown_End - if_stat_level_equal AI_TARGET, STAT_ACC, 6, AI_CV_AccuracyDown_End + if_stat_level_equal AI_TARGET, STAT_ACC, DEFAULT_STAT_STAGE, AI_CV_AccuracyDown_End if_hp_less_than AI_USER, 40, AI_CV_AccuracyDown_ScoreDown2 if_hp_less_than AI_TARGET, 40, AI_CV_AccuracyDown_ScoreDown2 if_random_less_than 70, AI_CV_AccuracyDown_End @@ -1997,7 +1997,7 @@ AI_CV_Curse2: score +1 AI_CV_Curse3: - if_stat_level_more_than AI_USER, STAT_DEF, 6, AI_CV_Curse_End + if_stat_level_more_than AI_USER, STAT_DEF, DEFAULT_STAT_STAGE, AI_CV_Curse_End if_random_less_than 128, AI_CV_Curse_End score +1 goto AI_CV_Curse_End @@ -2518,7 +2518,7 @@ AI_CV_ChangeSelfAbility_AbilitiesToEncourage: AI_CV_Superpower: if_type_effectiveness AI_EFFECTIVENESS_x0_25, AI_CV_Superpower_ScoreDown1 if_type_effectiveness AI_EFFECTIVENESS_x0_5, AI_CV_Superpower_ScoreDown1 - if_stat_level_less_than AI_USER, STAT_ATK, 6, AI_CV_Superpower_ScoreDown1 + if_stat_level_less_than AI_USER, STAT_ATK, DEFAULT_STAT_STAGE, AI_CV_Superpower_ScoreDown1 if_target_faster AI_CV_Superpower2 if_hp_more_than AI_USER, 40, AI_CV_Superpower_ScoreDown1 goto AI_CV_Superpower_End @@ -2933,12 +2933,12 @@ sMovesTable_ProtectMoves: AI_PreferBatonPass_EncourageIfHighStats: get_turn_count if_equal 0, Score_Minus2 - if_stat_level_more_than AI_USER, STAT_ATK, 8, Score_Plus3 - if_stat_level_more_than AI_USER, STAT_ATK, 7, Score_Plus2 - if_stat_level_more_than AI_USER, STAT_ATK, 6, Score_Plus1 - if_stat_level_more_than AI_USER, STAT_SPATK, 8, Score_Plus3 - if_stat_level_more_than AI_USER, STAT_SPATK, 7, Score_Plus2 - if_stat_level_more_than AI_USER, STAT_SPATK, 6, Score_Plus1 + if_stat_level_more_than AI_USER, STAT_ATK, DEFAULT_STAT_STAGE + 2, Score_Plus3 + if_stat_level_more_than AI_USER, STAT_ATK, DEFAULT_STAT_STAGE + 1, Score_Plus2 + if_stat_level_more_than AI_USER, STAT_ATK, DEFAULT_STAT_STAGE, Score_Plus1 + if_stat_level_more_than AI_USER, STAT_SPATK, DEFAULT_STAT_STAGE + 2, Score_Plus3 + if_stat_level_more_than AI_USER, STAT_SPATK, DEFAULT_STAT_STAGE + 1, Score_Plus2 + if_stat_level_more_than AI_USER, STAT_SPATK, DEFAULT_STAT_STAGE, Score_Plus1 end AI_PreferBatonPassEnd: diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 273b3d028..f0c0a7ea8 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -1504,9 +1504,9 @@ BattleScript_EffectCurse:: attackcanceler attackstring ppreduce - jumpifstat BS_ATTACKER, CMP_GREATER_THAN, STAT_SPEED, 0x0, BattleScript_CurseTrySpeed - jumpifstat BS_ATTACKER, CMP_NOT_EQUAL, STAT_ATK, 0xC, BattleScript_CurseTrySpeed - jumpifstat BS_ATTACKER, CMP_EQUAL, STAT_DEF, 0xC, BattleScript_ButItFailed + jumpifstat BS_ATTACKER, CMP_GREATER_THAN, STAT_SPEED, MIN_STAT_STAGE, BattleScript_CurseTrySpeed + jumpifstat BS_ATTACKER, CMP_NOT_EQUAL, STAT_ATK, MAX_STAT_STAGE, BattleScript_CurseTrySpeed + jumpifstat BS_ATTACKER, CMP_EQUAL, STAT_DEF, MAX_STAT_STAGE, BattleScript_ButItFailed BattleScript_CurseTrySpeed:: copybyte gBattlerTarget, gBattlerAttacker setbyte sB_ANIM_TURN, 0x1 @@ -2670,8 +2670,8 @@ BattleScript_EffectTickle:: attackcanceler attackstring ppreduce - jumpifstat BS_TARGET, CMP_GREATER_THAN, STAT_ATK, 0x0, BattleScript_TickleDoMoveAnim - jumpifstat BS_TARGET, CMP_EQUAL, STAT_DEF, 0x0, BattleScript_CantLowerMultipleStats + jumpifstat BS_TARGET, CMP_GREATER_THAN, STAT_ATK, MIN_STAT_STAGE, BattleScript_TickleDoMoveAnim + jumpifstat BS_TARGET, CMP_EQUAL, STAT_DEF, MIN_STAT_STAGE, BattleScript_CantLowerMultipleStats BattleScript_TickleDoMoveAnim:: accuracycheck BattleScript_ButItFailed, ACC_CURR_MOVE attackanimation @@ -2705,8 +2705,8 @@ BattleScript_EffectCosmicPower:: attackcanceler attackstring ppreduce - jumpifstat BS_ATTACKER, CMP_LESS_THAN, STAT_DEF, 0xC, BattleScript_CosmicPowerDoMoveAnim - jumpifstat BS_ATTACKER, CMP_EQUAL, STAT_SPDEF, 0xC, BattleScript_CantRaiseMultipleStats + jumpifstat BS_ATTACKER, CMP_LESS_THAN, STAT_DEF, MAX_STAT_STAGE, BattleScript_CosmicPowerDoMoveAnim + jumpifstat BS_ATTACKER, CMP_EQUAL, STAT_SPDEF, MAX_STAT_STAGE, BattleScript_CantRaiseMultipleStats BattleScript_CosmicPowerDoMoveAnim:: attackanimation waitanimation @@ -2734,8 +2734,8 @@ BattleScript_EffectBulkUp:: attackcanceler attackstring ppreduce - jumpifstat BS_ATTACKER, CMP_LESS_THAN, STAT_ATK, 0xC, BattleScript_BulkUpDoMoveAnim - jumpifstat BS_ATTACKER, CMP_EQUAL, STAT_DEF, 0xC, BattleScript_CantRaiseMultipleStats + jumpifstat BS_ATTACKER, CMP_LESS_THAN, STAT_ATK, MAX_STAT_STAGE, BattleScript_BulkUpDoMoveAnim + jumpifstat BS_ATTACKER, CMP_EQUAL, STAT_DEF, MAX_STAT_STAGE, BattleScript_CantRaiseMultipleStats BattleScript_BulkUpDoMoveAnim:: attackanimation waitanimation @@ -2759,8 +2759,8 @@ BattleScript_EffectCalmMind:: attackcanceler attackstring ppreduce - jumpifstat BS_ATTACKER, CMP_LESS_THAN, STAT_SPATK, 0xC, BattleScript_CalmMindDoMoveAnim - jumpifstat BS_ATTACKER, CMP_EQUAL, STAT_SPDEF, 0xC, BattleScript_CantRaiseMultipleStats + jumpifstat BS_ATTACKER, CMP_LESS_THAN, STAT_SPATK, MAX_STAT_STAGE, BattleScript_CalmMindDoMoveAnim + jumpifstat BS_ATTACKER, CMP_EQUAL, STAT_SPDEF, MAX_STAT_STAGE, BattleScript_CantRaiseMultipleStats BattleScript_CalmMindDoMoveAnim:: attackanimation waitanimation @@ -2791,8 +2791,8 @@ BattleScript_EffectDragonDance:: attackcanceler attackstring ppreduce - jumpifstat BS_ATTACKER, CMP_LESS_THAN, STAT_ATK, 0xC, BattleScript_DragonDanceDoMoveAnim - jumpifstat BS_ATTACKER, CMP_EQUAL, STAT_SPEED, 0xC, BattleScript_CantRaiseMultipleStats + jumpifstat BS_ATTACKER, CMP_LESS_THAN, STAT_ATK, MAX_STAT_STAGE, BattleScript_DragonDanceDoMoveAnim + jumpifstat BS_ATTACKER, CMP_EQUAL, STAT_SPEED, MAX_STAT_STAGE, BattleScript_CantRaiseMultipleStats BattleScript_DragonDanceDoMoveAnim:: attackanimation waitanimation @@ -3047,13 +3047,13 @@ BattleScript_FrontierTrainerBattleWon_LoseTexts: trainerslidein BS_ATTACKER waitstate printstring STRINGID_TRAINER1LOSETEXT - jumpifnotbattletype BATTLE_TYPE_TWO_OPPONENTS, BattleScript_82DAACB + jumpifnotbattletype BATTLE_TYPE_TWO_OPPONENTS, BattleScript_TryPickUpItems trainerslideout B_POSITION_OPPONENT_LEFT waitstate trainerslidein BS_FAINTED waitstate printstring STRINGID_TRAINER2LOSETEXT -BattleScript_82DAACB: +BattleScript_TryPickUpItems: jumpifnotbattletype BATTLE_TYPE_PYRAMID, BattleScript_FrontierTrainerBattleWon_End pickup BattleScript_FrontierTrainerBattleWon_End: @@ -3462,11 +3462,11 @@ BattleScript_PerishSongCountGoesDown:: end2 BattleScript_AllStatsUp:: - jumpifstat BS_ATTACKER, CMP_LESS_THAN, STAT_ATK, 0xC, BattleScript_AllStatsUpAtk - jumpifstat BS_ATTACKER, CMP_LESS_THAN, STAT_DEF, 0xC, BattleScript_AllStatsUpAtk - jumpifstat BS_ATTACKER, CMP_LESS_THAN, STAT_SPEED, 0xC, BattleScript_AllStatsUpAtk - jumpifstat BS_ATTACKER, CMP_LESS_THAN, STAT_SPATK, 0xC, BattleScript_AllStatsUpAtk - jumpifstat BS_ATTACKER, CMP_EQUAL, STAT_SPDEF, 0xC, BattleScript_AllStatsUpRet + jumpifstat BS_ATTACKER, CMP_LESS_THAN, STAT_ATK, MAX_STAT_STAGE, BattleScript_AllStatsUpAtk + jumpifstat BS_ATTACKER, CMP_LESS_THAN, STAT_DEF, MAX_STAT_STAGE, BattleScript_AllStatsUpAtk + jumpifstat BS_ATTACKER, CMP_LESS_THAN, STAT_SPEED, MAX_STAT_STAGE, BattleScript_AllStatsUpAtk + jumpifstat BS_ATTACKER, CMP_LESS_THAN, STAT_SPATK, MAX_STAT_STAGE, BattleScript_AllStatsUpAtk + jumpifstat BS_ATTACKER, CMP_EQUAL, STAT_SPDEF, MAX_STAT_STAGE, BattleScript_AllStatsUpRet BattleScript_AllStatsUpAtk:: setbyte sSTAT_ANIM_PLAYED, FALSE playstatchangeanimation BS_ATTACKER, BIT_ATK | BIT_DEF | BIT_SPEED | BIT_SPATK | BIT_SPDEF, 0x0 @@ -3638,18 +3638,18 @@ BattleScript_AtkDefDown:: playstatchangeanimation BS_ATTACKER, BIT_DEF | BIT_ATK, STAT_CHANGE_CANT_PREVENT | STAT_CHANGE_NEGATIVE | STAT_CHANGE_MULTIPLE_STATS playstatchangeanimation BS_ATTACKER, BIT_ATK, STAT_CHANGE_CANT_PREVENT | STAT_CHANGE_NEGATIVE setstatchanger STAT_ATK, 1, TRUE - statbuffchange MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN | STAT_BUFF_ALLOW_PTR, BattleScript_82DB144 - jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_82DB144 + statbuffchange MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN | STAT_BUFF_ALLOW_PTR, BattleScript_AtkDefDown_TryDef + jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_AtkDefDown_TryDef printfromtable gStatDownStringIds waitmessage 0x40 -BattleScript_82DB144:: +BattleScript_AtkDefDown_TryDef:: playstatchangeanimation BS_ATTACKER, BIT_DEF, STAT_CHANGE_CANT_PREVENT | STAT_CHANGE_NEGATIVE setstatchanger STAT_DEF, 1, TRUE - statbuffchange MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN | STAT_BUFF_ALLOW_PTR, BattleScript_82DB167 - jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_82DB167 + statbuffchange MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN | STAT_BUFF_ALLOW_PTR, BattleScript_AtkDefDown_End + jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_AtkDefDown_End printfromtable gStatDownStringIds waitmessage 0x40 -BattleScript_82DB167:: +BattleScript_AtkDefDown_End:: return BattleScript_KnockedOff:: @@ -4017,10 +4017,10 @@ BattleScript_WeatherFormChangesLoop:: return BattleScript_CastformChange:: - call BattleScript_82DB4AF + call BattleScript_DoCastformChange end3 -BattleScript_82DB4AF:: +BattleScript_DoCastformChange:: docastformchangeanimation waitstate printstring STRINGID_PKMNTRANSFORMED diff --git a/include/constants/pokemon.h b/include/constants/pokemon.h index 0d8fc6a57..286726838 100644 --- a/include/constants/pokemon.h +++ b/include/constants/pokemon.h @@ -84,6 +84,10 @@ #define NUM_NATURE_STATS NUM_STATS - 1 // excludes HP #define NUM_BATTLE_STATS NUM_STATS + 2 // includes Accuracy and Evasion +#define MIN_STAT_STAGE 0 +#define DEFAULT_STAT_STAGE 6 +#define MAX_STAT_STAGE 12 + // Shiny odds #define SHINY_ODDS 8 // Actual probability is SHINY_ODDS/65536 diff --git a/include/pokemon.h b/include/pokemon.h index 69ef7a142..d75ec94f3 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -254,7 +254,7 @@ extern const u16 *const gLevelUpLearnsets[]; extern const u8 gPPUpGetMask[]; extern const u8 gPPUpSetMask[]; extern const u8 gPPUpAddMask[]; -extern const u8 gStatStageRatios[][2]; +extern const u8 gStatStageRatios[MAX_STAT_STAGE + 1][2]; extern const u16 gLinkPlayerFacilityClasses[]; extern const struct SpriteTemplate gUnknown_08329D98[]; extern const s8 gNatureStatTable[][5]; diff --git a/src/battle_ai_switch_items.c b/src/battle_ai_switch_items.c index 32f9620b7..2a5a83e0d 100644 --- a/src/battle_ai_switch_items.c +++ b/src/battle_ai_switch_items.c @@ -314,8 +314,8 @@ static bool8 AreStatsRaised(void) for (i = 0; i < NUM_BATTLE_STATS; i++) { - if (gBattleMons[gActiveBattler].statStages[i] > 6) - buffedStatsValue += gBattleMons[gActiveBattler].statStages[i] - 6; + if (gBattleMons[gActiveBattler].statStages[i] > DEFAULT_STAT_STAGE) + buffedStatsValue += gBattleMons[gActiveBattler].statStages[i] - DEFAULT_STAT_STAGE; } return (buffedStatsValue > 3); diff --git a/src/battle_main.c b/src/battle_main.c index 1d8aeab53..b8ebda9e4 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -3135,7 +3135,7 @@ void SwitchInClearSetData(void) if (gBattleMoves[gCurrentMove].effect != EFFECT_BATON_PASS) { for (i = 0; i < NUM_BATTLE_STATS; i++) - gBattleMons[gActiveBattler].statStages[i] = 6; + gBattleMons[gActiveBattler].statStages[i] = DEFAULT_STAT_STAGE; for (i = 0; i < gBattlersCount; i++) { if ((gBattleMons[i].status2 & STATUS2_ESCAPE_PREVENTION) && gDisableStructs[i].battlerPreventingEscape == gActiveBattler) @@ -3244,7 +3244,7 @@ void FaintClearSetData(void) u8 *ptr; for (i = 0; i < NUM_BATTLE_STATS; i++) - gBattleMons[gActiveBattler].statStages[i] = 6; + gBattleMons[gActiveBattler].statStages[i] = DEFAULT_STAT_STAGE; gBattleMons[gActiveBattler].status2 = 0; gStatuses3[gActiveBattler] = 0; @@ -3398,7 +3398,7 @@ static void BattleIntroDrawTrainersOrMonsSprites(void) hpOnSwitchout = &gBattleStruct->hpOnSwitchout[GetBattlerSide(gActiveBattler)]; *hpOnSwitchout = gBattleMons[gActiveBattler].hp; for (i = 0; i < NUM_BATTLE_STATS; i++) - gBattleMons[gActiveBattler].statStages[i] = 6; + gBattleMons[gActiveBattler].statStages[i] = DEFAULT_STAT_STAGE; gBattleMons[gActiveBattler].status2 = 0; } diff --git a/src/battle_message.c b/src/battle_message.c index cc43d1656..2fba578dc 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -438,14 +438,14 @@ static const u8 sText_Evasiveness[] = _("evasiveness"); const u8 * const gStatNamesTable[NUM_BATTLE_STATS] = { - [STAT_HP] = sText_HP2, - [STAT_ATK] = sText_Attack2, + [STAT_HP] = sText_HP2, + [STAT_ATK] = sText_Attack2, [STAT_DEF] = sText_Defense2, - [STAT_SPEED] = sText_Speed, - [STAT_SPATK] = sText_SpAtk2, + [STAT_SPEED] = sText_Speed, + [STAT_SPATK] = sText_SpAtk2, [STAT_SPDEF] = sText_SpDef2, - [STAT_ACC] = sText_Accuracy, - [STAT_EVASION] = sText_Evasiveness + [STAT_ACC] = sText_Accuracy, + [STAT_EVASION] = sText_Evasiveness, }; static const u8 sText_PokeblockWasTooSpicy[] = _("was too spicy!"); @@ -456,9 +456,9 @@ static const u8 sText_PokeblockWasTooSour[] = _("was too sour!"); const u8 * const gPokeblockWasTooXStringTable[FLAVOR_COUNT] = { - [FLAVOR_SPICY] = sText_PokeblockWasTooSpicy, + [FLAVOR_SPICY] = sText_PokeblockWasTooSpicy, [FLAVOR_DRY] = sText_PokeblockWasTooDry, - [FLAVOR_SWEET] = sText_PokeblockWasTooSweet, + [FLAVOR_SWEET] = sText_PokeblockWasTooSweet, [FLAVOR_BITTER] = sText_PokeblockWasTooBitter, [FLAVOR_SOUR] = sText_PokeblockWasTooSour }; diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 4e0e087b6..c9c785773 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -1128,13 +1128,13 @@ static void Cmd_accuracycheck(void) else { u8 acc = gBattleMons[gBattlerAttacker].statStages[STAT_ACC]; - buff = acc + 6 - gBattleMons[gBattlerTarget].statStages[STAT_EVASION]; + buff = acc + DEFAULT_STAT_STAGE - gBattleMons[gBattlerTarget].statStages[STAT_EVASION]; } - if (buff < 0) - buff = 0; - if (buff > 0xC) - buff = 0xC; + if (buff < MIN_STAT_STAGE) + buff = MIN_STAT_STAGE; + if (buff > MAX_STAT_STAGE) + buff = MAX_STAT_STAGE; moveAcc = gBattleMoves[move].accuracy; // check Thunder on sunny weather @@ -3500,7 +3500,7 @@ static void Cmd_unknown_24(void) if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER && gPartnerTrainerId == TRAINER_STEVEN_PARTNER) { - for (i = 0; i < 3; i++) + for (i = 0; i < MULTI_PARTY_SIZE; i++) { if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES) && !GetMonData(&gPlayerParty[i], MON_DATA_IS_EGG)) HP_count += GetMonData(&gPlayerParty[i], MON_DATA_HP); @@ -4385,7 +4385,7 @@ static void Cmd_playstatchangeanimation(void) { if (gBattlescriptCurrInstr[3] & STAT_CHANGE_CANT_PREVENT) { - if (gBattleMons[gActiveBattler].statStages[currStat] > 0) + if (gBattleMons[gActiveBattler].statStages[currStat] > MIN_STAT_STAGE) { statAnimId = startingStatAnimId + currStat; changeableStatsCount++; @@ -4397,7 +4397,7 @@ static void Cmd_playstatchangeanimation(void) && !(gBattleMons[gActiveBattler].ability == ABILITY_KEEN_EYE && currStat == STAT_ACC) && !(gBattleMons[gActiveBattler].ability == ABILITY_HYPER_CUTTER && currStat == STAT_ATK)) { - if (gBattleMons[gActiveBattler].statStages[currStat] > 0) + if (gBattleMons[gActiveBattler].statStages[currStat] > MIN_STAT_STAGE) { statAnimId = startingStatAnimId + currStat; changeableStatsCount++; @@ -4425,7 +4425,7 @@ static void Cmd_playstatchangeanimation(void) while (statsToCheck != 0) { - if (statsToCheck & 1 && gBattleMons[gActiveBattler].statStages[currStat] < 0xC) + if (statsToCheck & 1 && gBattleMons[gActiveBattler].statStages[currStat] < MAX_STAT_STAGE) { statAnimId = startingStatAnimId + currStat; changeableStatsCount++; @@ -4495,7 +4495,7 @@ static void Cmd_moveend(void) && gBattleMons[gBattlerTarget].hp != 0 && gBattlerAttacker != gBattlerTarget && GetBattlerSide(gBattlerAttacker) != GetBattlerSide(gBattlerTarget) && !(gMoveResultFlags & MOVE_RESULT_NO_EFFECT) && TARGET_TURN_DAMAGED - && gBattleMoves[gCurrentMove].power && gBattleMons[gBattlerTarget].statStages[STAT_ATK] <= 0xB) + && gBattleMoves[gCurrentMove].power && gBattleMons[gBattlerTarget].statStages[STAT_ATK] < MAX_STAT_STAGE) { gBattleMons[gBattlerTarget].statStages[STAT_ATK]++; BattleScriptPushCursor(); @@ -7288,7 +7288,7 @@ static u8 ChangeStatBuffs(s8 statValue, u8 statId, u8 flags, const u8 *BS_ptr) index++; gBattleTextBuff2[index] = B_BUFF_EOS; - if (gBattleMons[gActiveBattler].statStages[statId] == 0) + if (gBattleMons[gActiveBattler].statStages[statId] == MIN_STAT_STAGE) gBattleCommunication[MULTISTRING_CHOOSER] = 2; else gBattleCommunication[MULTISTRING_CHOOSER] = (gBattlerTarget == gActiveBattler); @@ -7315,17 +7315,17 @@ static u8 ChangeStatBuffs(s8 statValue, u8 statId, u8 flags, const u8 *BS_ptr) index++; gBattleTextBuff2[index] = B_BUFF_EOS; - if (gBattleMons[gActiveBattler].statStages[statId] == 0xC) + if (gBattleMons[gActiveBattler].statStages[statId] == MAX_STAT_STAGE) gBattleCommunication[MULTISTRING_CHOOSER] = 2; else gBattleCommunication[MULTISTRING_CHOOSER] = (gBattlerTarget == gActiveBattler); } gBattleMons[gActiveBattler].statStages[statId] += statValue; - if (gBattleMons[gActiveBattler].statStages[statId] < 0) - gBattleMons[gActiveBattler].statStages[statId] = 0; - if (gBattleMons[gActiveBattler].statStages[statId] > 0xC) - gBattleMons[gActiveBattler].statStages[statId] = 0xC; + if (gBattleMons[gActiveBattler].statStages[statId] < MIN_STAT_STAGE) + gBattleMons[gActiveBattler].statStages[statId] = MIN_STAT_STAGE; + if (gBattleMons[gActiveBattler].statStages[statId] > MAX_STAT_STAGE) + gBattleMons[gActiveBattler].statStages[statId] = MAX_STAT_STAGE; if (gBattleCommunication[MULTISTRING_CHOOSER] == 2 && flags & STAT_BUFF_ALLOW_PTR) gMoveResultFlags |= MOVE_RESULT_MISSED; @@ -7350,7 +7350,7 @@ static void Cmd_normalisebuffs(void) // haze for (i = 0; i < gBattlersCount; i++) { for (j = 0; j < NUM_BATTLE_STATS; j++) - gBattleMons[i].statStages[j] = 6; + gBattleMons[i].statStages[j] = DEFAULT_STAT_STAGE; } gBattlescriptCurrInstr++; @@ -8750,7 +8750,7 @@ static void Cmd_rolloutdamagecalculation(void) static void Cmd_jumpifconfusedandstatmaxed(void) { if (gBattleMons[gBattlerTarget].status2 & STATUS2_CONFUSION - && gBattleMons[gBattlerTarget].statStages[gBattlescriptCurrInstr[1]] == 0xC) + && gBattleMons[gBattlerTarget].statStages[gBattlescriptCurrInstr[1]] == MAX_STAT_STAGE) gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 2); else gBattlescriptCurrInstr += 6; @@ -8957,10 +8957,10 @@ static void Cmd_maxattackhalvehp(void) // belly drum if (!(gBattleMons[gBattlerAttacker].maxHP / 2)) halfHp = 1; - if (gBattleMons[gBattlerAttacker].statStages[STAT_ATK] < 12 + if (gBattleMons[gBattlerAttacker].statStages[STAT_ATK] < MAX_STAT_STAGE && gBattleMons[gBattlerAttacker].hp > halfHp) { - gBattleMons[gBattlerAttacker].statStages[STAT_ATK] = 12; + gBattleMons[gBattlerAttacker].statStages[STAT_ATK] = MAX_STAT_STAGE; gBattleMoveDamage = gBattleMons[gBattlerAttacker].maxHP / 2; if (gBattleMoveDamage == 0) gBattleMoveDamage = 1; @@ -9234,8 +9234,8 @@ static void Cmd_sethail(void) static void Cmd_jumpifattackandspecialattackcannotfall(void) // memento { - if (gBattleMons[gBattlerTarget].statStages[STAT_ATK] == 0 - && gBattleMons[gBattlerTarget].statStages[STAT_SPATK] == 0 + if (gBattleMons[gBattlerTarget].statStages[STAT_ATK] == MIN_STAT_STAGE + && gBattleMons[gBattlerTarget].statStages[STAT_SPATK] == MIN_STAT_STAGE && gBattleCommunication[6] != 1) { gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 1); diff --git a/src/battle_tv.c b/src/battle_tv.c index 26df08786..c84ae827b 100644 --- a/src/battle_tv.c +++ b/src/battle_tv.c @@ -1398,9 +1398,9 @@ static void TrySetBattleSeminarShow(void) return; else if (GetBattlerSide(gBattlerAttacker) == B_SIDE_OPPONENT) return; - else if (gBattleMons[gBattlerAttacker].statStages[STAT_ACC] <= 5) + else if (gBattleMons[gBattlerAttacker].statStages[STAT_ACC] < DEFAULT_STAT_STAGE) return; - else if (gBattleMons[gBattlerTarget].statStages[STAT_EVASION] > 6) + else if (gBattleMons[gBattlerTarget].statStages[STAT_EVASION] > DEFAULT_STAT_STAGE) return; else if (gCurrentMove == MOVE_HIDDEN_POWER || gCurrentMove == MOVE_WEATHER_BALL) return; diff --git a/src/battle_util.c b/src/battle_util.c index 9cc2252b6..38d6fb18a 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -1978,7 +1978,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA } break; case ABILITY_SPEED_BOOST: - if (gBattleMons[battler].statStages[STAT_SPEED] < 0xC && gDisableStructs[battler].isFirstTurn != 2) + if (gBattleMons[battler].statStages[STAT_SPEED] < MAX_STAT_STAGE && gDisableStructs[battler].isFirstTurn != 2) { gBattleMons[battler].statStages[STAT_SPEED]++; gBattleScripting.animArg1 = 0x11; @@ -2619,9 +2619,9 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) case HOLD_EFFECT_RESTORE_STATS: for (i = 0; i < NUM_BATTLE_STATS; i++) { - if (gBattleMons[battlerId].statStages[i] < 6) + if (gBattleMons[battlerId].statStages[i] < DEFAULT_STAT_STAGE) { - gBattleMons[battlerId].statStages[i] = 6; + gBattleMons[battlerId].statStages[i] = DEFAULT_STAT_STAGE; effect = ITEM_STATS_CHANGE; } } @@ -2690,9 +2690,9 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) case HOLD_EFFECT_RESTORE_STATS: for (i = 0; i < NUM_BATTLE_STATS; i++) { - if (gBattleMons[battlerId].statStages[i] < 6) + if (gBattleMons[battlerId].statStages[i] < DEFAULT_STAT_STAGE) { - gBattleMons[battlerId].statStages[i] = 6; + gBattleMons[battlerId].statStages[i] = DEFAULT_STAT_STAGE; effect = ITEM_STATS_CHANGE; } } @@ -2811,7 +2811,8 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) break; // copy/paste again, smh case HOLD_EFFECT_ATTACK_UP: - if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / battlerHoldEffectParam && !moveTurn && gBattleMons[battlerId].statStages[STAT_ATK] < 0xC) + if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / battlerHoldEffectParam + && !moveTurn && gBattleMons[battlerId].statStages[STAT_ATK] < MAX_STAT_STAGE) { PREPARE_STAT_BUFFER(gBattleTextBuff1, STAT_ATK); PREPARE_STRING_BUFFER(gBattleTextBuff2, STRINGID_STATROSE); @@ -2825,7 +2826,8 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) } break; case HOLD_EFFECT_DEFENSE_UP: - if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / battlerHoldEffectParam && !moveTurn && gBattleMons[battlerId].statStages[STAT_DEF] < 0xC) + if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / battlerHoldEffectParam && !moveTurn + && gBattleMons[battlerId].statStages[STAT_DEF] < MAX_STAT_STAGE) { PREPARE_STAT_BUFFER(gBattleTextBuff1, STAT_DEF); @@ -2838,7 +2840,8 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) } break; case HOLD_EFFECT_SPEED_UP: - if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / battlerHoldEffectParam && !moveTurn && gBattleMons[battlerId].statStages[STAT_SPEED] < 0xC) + if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / battlerHoldEffectParam && !moveTurn + && gBattleMons[battlerId].statStages[STAT_SPEED] < MAX_STAT_STAGE) { PREPARE_STAT_BUFFER(gBattleTextBuff1, STAT_SPEED); @@ -2851,7 +2854,8 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) } break; case HOLD_EFFECT_SP_ATTACK_UP: - if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / battlerHoldEffectParam && !moveTurn && gBattleMons[battlerId].statStages[STAT_SPATK] < 0xC) + if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / battlerHoldEffectParam && !moveTurn + && gBattleMons[battlerId].statStages[STAT_SPATK] < MAX_STAT_STAGE) { PREPARE_STAT_BUFFER(gBattleTextBuff1, STAT_SPATK); @@ -2864,7 +2868,8 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) } break; case HOLD_EFFECT_SP_DEFENSE_UP: - if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / battlerHoldEffectParam && !moveTurn && gBattleMons[battlerId].statStages[STAT_SPDEF] < 0xC) + if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / battlerHoldEffectParam && !moveTurn + && gBattleMons[battlerId].statStages[STAT_SPDEF] < MAX_STAT_STAGE) { PREPARE_STAT_BUFFER(gBattleTextBuff1, STAT_SPDEF); @@ -2877,7 +2882,8 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) } break; case HOLD_EFFECT_CRITICAL_UP: - if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / battlerHoldEffectParam && !moveTurn && !(gBattleMons[battlerId].status2 & STATUS2_FOCUS_ENERGY)) + if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / battlerHoldEffectParam && !moveTurn + && !(gBattleMons[battlerId].status2 & STATUS2_FOCUS_ENERGY)) { gBattleMons[battlerId].status2 |= STATUS2_FOCUS_ENERGY; BattleScriptExecute(BattleScript_BerryFocusEnergyEnd2); @@ -2889,7 +2895,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) { for (i = 0; i < 5; i++) { - if (gBattleMons[battlerId].statStages[STAT_ATK + i] < 0xC) + if (gBattleMons[battlerId].statStages[STAT_ATK + i] < MAX_STAT_STAGE) break; } if (i != 5) @@ -2897,7 +2903,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) do { i = Random() % 5; - } while (gBattleMons[battlerId].statStages[STAT_ATK + i] == 0xC); + } while (gBattleMons[battlerId].statStages[STAT_ATK + i] == MAX_STAT_STAGE); PREPARE_STAT_BUFFER(gBattleTextBuff1, i + 1); @@ -3166,9 +3172,9 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) case HOLD_EFFECT_RESTORE_STATS: for (i = 0; i < NUM_BATTLE_STATS; i++) { - if (gBattleMons[battlerId].statStages[i] < 6) + if (gBattleMons[battlerId].statStages[i] < DEFAULT_STAT_STAGE) { - gBattleMons[battlerId].statStages[i] = 6; + gBattleMons[battlerId].statStages[i] = DEFAULT_STAT_STAGE; effect = ITEM_STATS_CHANGE; } } diff --git a/src/pokemon.c b/src/pokemon.c index 80e93c568..6561e653b 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -1868,21 +1868,21 @@ const u8 gPPUpGetMask[] = {0x03, 0x0c, 0x30, 0xc0}; // Masks for getting PP Up c const u8 gPPUpSetMask[] = {0xfc, 0xf3, 0xcf, 0x3f}; // Masks for setting PP Up count const u8 gPPUpAddMask[] = {0x01, 0x04, 0x10, 0x40}; // Values added to PP Up count -const u8 gStatStageRatios[][2] = +const u8 gStatStageRatios[MAX_STAT_STAGE + 1][2] = { - {10, 40}, // -6 + {10, 40}, // -6, MIN_STAT_STAGE {10, 35}, // -5 {10, 30}, // -4 {10, 25}, // -3 {10, 20}, // -2 {10, 15}, // -1 - {10, 10}, // 0 + {10, 10}, // 0, DEFAULT_STAT_STAGE {15, 10}, // +1 {20, 10}, // +2 {25, 10}, // +3 {30, 10}, // +4 {35, 10}, // +5 - {40, 10}, // +6 + {40, 10}, // +6, MAX_STAT_STAGE }; static const u16 sDeoxysBaseStats[] = @@ -3199,7 +3199,7 @@ s32 CalculateBaseDamage(struct BattlePokemon *attacker, struct BattlePokemon *de { if (gCritMultiplier == 2) { - if (attacker->statStages[STAT_ATK] > 6) + if (attacker->statStages[STAT_ATK] > DEFAULT_STAT_STAGE) APPLY_STAT_MOD(damage, attacker, attack, STAT_ATK) else damage = attack; @@ -3212,7 +3212,7 @@ s32 CalculateBaseDamage(struct BattlePokemon *attacker, struct BattlePokemon *de if (gCritMultiplier == 2) { - if (defender->statStages[STAT_DEF] < 6) + if (defender->statStages[STAT_DEF] < DEFAULT_STAT_STAGE) APPLY_STAT_MOD(damageHelper, defender, defense, STAT_DEF) else damageHelper = defense; @@ -3249,7 +3249,7 @@ s32 CalculateBaseDamage(struct BattlePokemon *attacker, struct BattlePokemon *de { if (gCritMultiplier == 2) { - if (attacker->statStages[STAT_SPATK] > 6) + if (attacker->statStages[STAT_SPATK] > DEFAULT_STAT_STAGE) APPLY_STAT_MOD(damage, attacker, spAttack, STAT_SPATK) else damage = spAttack; @@ -3262,7 +3262,7 @@ s32 CalculateBaseDamage(struct BattlePokemon *attacker, struct BattlePokemon *de if (gCritMultiplier == 2) { - if (defender->statStages[STAT_SPDEF] < 6) + if (defender->statStages[STAT_SPDEF] < DEFAULT_STAT_STAGE) APPLY_STAT_MOD(damageHelper, defender, spDefense, STAT_SPDEF) else damageHelper = spDefense; @@ -4624,8 +4624,8 @@ void CopyPlayerPartyMonToBattleData(u8 battlerId, u8 partyIndex) hpSwitchout = &gBattleStruct->hpOnSwitchout[GetBattlerSide(battlerId)]; *hpSwitchout = gBattleMons[battlerId].hp; - for (i = 0; i < 8; i++) - gBattleMons[battlerId].statStages[i] = 6; + for (i = 0; i < NUM_BATTLE_STATS; i++) + gBattleMons[battlerId].statStages[i] = DEFAULT_STAT_STAGE; gBattleMons[battlerId].status2 = 0; sub_803FA70(battlerId); @@ -4728,49 +4728,49 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov retVal = FALSE; } if ((itemEffect[cmdIndex] & ITEM0_X_ATTACK) - && gBattleMons[gActiveBattler].statStages[STAT_ATK] < 12) + && gBattleMons[gActiveBattler].statStages[STAT_ATK] < MAX_STAT_STAGE) { gBattleMons[gActiveBattler].statStages[STAT_ATK] += itemEffect[cmdIndex] & ITEM0_X_ATTACK; - if (gBattleMons[gActiveBattler].statStages[STAT_ATK] > 12) - gBattleMons[gActiveBattler].statStages[STAT_ATK] = 12; + if (gBattleMons[gActiveBattler].statStages[STAT_ATK] > MAX_STAT_STAGE) + gBattleMons[gActiveBattler].statStages[STAT_ATK] = MAX_STAT_STAGE; retVal = FALSE; } break; // in-battle stat boosting effects case 1: if ((itemEffect[cmdIndex] & ITEM1_X_DEFEND) - && gBattleMons[gActiveBattler].statStages[STAT_DEF] < 12) + && gBattleMons[gActiveBattler].statStages[STAT_DEF] < MAX_STAT_STAGE) { gBattleMons[gActiveBattler].statStages[STAT_DEF] += (itemEffect[cmdIndex] & ITEM1_X_DEFEND) >> 4; - if (gBattleMons[gActiveBattler].statStages[STAT_DEF] > 12) - gBattleMons[gActiveBattler].statStages[STAT_DEF] = 12; + if (gBattleMons[gActiveBattler].statStages[STAT_DEF] > MAX_STAT_STAGE) + gBattleMons[gActiveBattler].statStages[STAT_DEF] = MAX_STAT_STAGE; retVal = FALSE; } if ((itemEffect[cmdIndex] & ITEM1_X_SPEED) - && gBattleMons[gActiveBattler].statStages[STAT_SPEED] < 12) + && gBattleMons[gActiveBattler].statStages[STAT_SPEED] < MAX_STAT_STAGE) { gBattleMons[gActiveBattler].statStages[STAT_SPEED] += itemEffect[cmdIndex] & ITEM1_X_SPEED; - if (gBattleMons[gActiveBattler].statStages[STAT_SPEED] > 12) - gBattleMons[gActiveBattler].statStages[STAT_SPEED] = 12; + if (gBattleMons[gActiveBattler].statStages[STAT_SPEED] > MAX_STAT_STAGE) + gBattleMons[gActiveBattler].statStages[STAT_SPEED] = MAX_STAT_STAGE; retVal = FALSE; } break; // more stat boosting effects case 2: if ((itemEffect[cmdIndex] & ITEM2_X_ACCURACY) - && gBattleMons[gActiveBattler].statStages[STAT_ACC] < 12) + && gBattleMons[gActiveBattler].statStages[STAT_ACC] < MAX_STAT_STAGE) { gBattleMons[gActiveBattler].statStages[STAT_ACC] += (itemEffect[cmdIndex] & ITEM2_X_ACCURACY) >> 4; - if (gBattleMons[gActiveBattler].statStages[STAT_ACC] > 12) - gBattleMons[gActiveBattler].statStages[STAT_ACC] = 12; + if (gBattleMons[gActiveBattler].statStages[STAT_ACC] > MAX_STAT_STAGE) + gBattleMons[gActiveBattler].statStages[STAT_ACC] = MAX_STAT_STAGE; retVal = FALSE; } if ((itemEffect[cmdIndex] & ITEM2_X_SPATK) - && gBattleMons[gActiveBattler].statStages[STAT_SPATK] < 12) + && gBattleMons[gActiveBattler].statStages[STAT_SPATK] < MAX_STAT_STAGE) { gBattleMons[gActiveBattler].statStages[STAT_SPATK] += itemEffect[cmdIndex] & ITEM2_X_SPATK; - if (gBattleMons[gActiveBattler].statStages[STAT_SPATK] > 12) - gBattleMons[gActiveBattler].statStages[STAT_SPATK] = 12; + if (gBattleMons[gActiveBattler].statStages[STAT_SPATK] > MAX_STAT_STAGE) + gBattleMons[gActiveBattler].statStages[STAT_SPATK] = MAX_STAT_STAGE; retVal = FALSE; } break;