Add stat stage constants

This commit is contained in:
GriffinR 2020-08-04 20:33:05 -04:00
parent a4e47f1201
commit 5e8ffff62f
11 changed files with 170 additions and 160 deletions

View File

@ -249,64 +249,64 @@ AI_CBM_BellyDrum: @ 82DC341
if_hp_less_than AI_USER, 51, Score_Minus10 if_hp_less_than AI_USER, 51, Score_Minus10
AI_CBM_AttackUp: @ 82DC348 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 end
AI_CBM_DefenseUp: @ 82DC351 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 end
AI_CBM_SpeedUp: @ 82DC35A 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 end
AI_CBM_SpAtkUp: @ 82DC363 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 end
AI_CBM_SpDefUp: @ 82DC36C 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 end
AI_CBM_AccUp: @ 82DC375 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 end
AI_CBM_EvasionUp: @ 82DC37E 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 end
AI_CBM_AttackDown: @ 82DC387 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 get_ability AI_TARGET
if_equal ABILITY_HYPER_CUTTER, Score_Minus10 if_equal ABILITY_HYPER_CUTTER, Score_Minus10
goto CheckIfAbilityBlocksStatChange goto CheckIfAbilityBlocksStatChange
AI_CBM_DefenseDown: @ 82DC39C 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 goto CheckIfAbilityBlocksStatChange
AI_CBM_SpeedDown: @ 82DC3A9 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 if_ability AI_TARGET, ABILITY_SPEED_BOOST, Score_Minus10
goto CheckIfAbilityBlocksStatChange goto CheckIfAbilityBlocksStatChange
AI_CBM_SpAtkDown: @ 82DC3BF 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 goto CheckIfAbilityBlocksStatChange
AI_CBM_SpDefDown: @ 82DC3CC 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 goto CheckIfAbilityBlocksStatChange
AI_CBM_AccDown: @ 82DC3D9 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 get_ability AI_TARGET
if_equal ABILITY_KEEN_EYE, Score_Minus10 if_equal ABILITY_KEEN_EYE, Score_Minus10
goto CheckIfAbilityBlocksStatChange goto CheckIfAbilityBlocksStatChange
AI_CBM_EvasionDown: @ 82DC3EE 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 CheckIfAbilityBlocksStatChange: @ 82DC3F6
get_ability AI_TARGET get_ability AI_TARGET
@ -315,20 +315,20 @@ CheckIfAbilityBlocksStatChange: @ 82DC3F6
end end
AI_CBM_Haze: @ 82DC405 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_ATK, DEFAULT_STAT_STAGE, 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_DEF, DEFAULT_STAT_STAGE, 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_SPEED, DEFAULT_STAT_STAGE, 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_SPATK, DEFAULT_STAT_STAGE, 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_SPDEF, DEFAULT_STAT_STAGE, 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_ACC, DEFAULT_STAT_STAGE, AI_CBM_Haze_End
if_stat_level_less_than AI_USER, STAT_EVASION, 6, 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, 6, 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, 6, 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, 6, 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, 6, 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, 6, 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, 6, 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, 6, AI_CBM_Haze_End if_stat_level_more_than AI_TARGET, STAT_EVASION, DEFAULT_STAT_STAGE, AI_CBM_Haze_End
goto Score_Minus10 goto Score_Minus10
AI_CBM_Haze_End: @ 82DC47A AI_CBM_Haze_End: @ 82DC47A
@ -436,8 +436,8 @@ AI_CBM_CantEscape: @ 82DC5B0
end end
AI_CBM_Curse: @ 82DC5BB AI_CBM_Curse: @ 82DC5BB
if_stat_level_equal AI_USER, STAT_ATK, 12, Score_Minus10 if_stat_level_equal AI_USER, STAT_ATK, MAX_STAT_STAGE, Score_Minus10
if_stat_level_equal AI_USER, STAT_DEF, 12, Score_Minus8 if_stat_level_equal AI_USER, STAT_DEF, MAX_STAT_STAGE, Score_Minus8
end end
AI_CBM_Spikes: @ 82DC5CC AI_CBM_Spikes: @ 82DC5CC
@ -484,8 +484,8 @@ AI_CBM_Safeguard: @ 82DC635
end end
AI_CBM_Memento: @ 82DC640 AI_CBM_Memento: @ 82DC640
if_stat_level_equal AI_TARGET, STAT_ATK, 0, Score_Minus10 if_stat_level_equal AI_TARGET, STAT_ATK, MIN_STAT_STAGE, Score_Minus10
if_stat_level_equal AI_TARGET, STAT_SPATK, 0, Score_Minus8 if_stat_level_equal AI_TARGET, STAT_SPATK, MIN_STAT_STAGE, Score_Minus8
AI_CBM_BatonPass: @ 82DC650 AI_CBM_BatonPass: @ 82DC650
count_usable_party_mons AI_USER count_usable_party_mons AI_USER
@ -574,18 +574,18 @@ AI_CBM_MudSport: @ 82DC71E
end end
AI_CBM_Tickle: @ 82DC729 AI_CBM_Tickle: @ 82DC729
if_stat_level_equal AI_TARGET, STAT_ATK, 0, Score_Minus10 if_stat_level_equal AI_TARGET, STAT_ATK, MIN_STAT_STAGE, Score_Minus10
if_stat_level_equal AI_TARGET, STAT_DEF, 0, Score_Minus8 if_stat_level_equal AI_TARGET, STAT_DEF, MIN_STAT_STAGE, Score_Minus8
end end
AI_CBM_CosmicPower: @ 82DC73A AI_CBM_CosmicPower: @ 82DC73A
if_stat_level_equal AI_USER, STAT_DEF, 12, Score_Minus10 if_stat_level_equal AI_USER, STAT_DEF, MAX_STAT_STAGE, Score_Minus10
if_stat_level_equal AI_USER, STAT_SPDEF, 12, Score_Minus8 if_stat_level_equal AI_USER, STAT_SPDEF, MAX_STAT_STAGE, Score_Minus8
end end
AI_CBM_BulkUp: @ 82DC74B AI_CBM_BulkUp: @ 82DC74B
if_stat_level_equal AI_USER, STAT_ATK, 12, Score_Minus10 if_stat_level_equal AI_USER, STAT_ATK, MAX_STAT_STAGE, Score_Minus10
if_stat_level_equal AI_USER, STAT_DEF, 12, Score_Minus8 if_stat_level_equal AI_USER, STAT_DEF, MAX_STAT_STAGE, Score_Minus8
end end
AI_CBM_WaterSport: @ 82DC75C AI_CBM_WaterSport: @ 82DC75C
@ -593,13 +593,13 @@ AI_CBM_WaterSport: @ 82DC75C
end end
AI_CBM_CalmMind: @ 82DC767 AI_CBM_CalmMind: @ 82DC767
if_stat_level_equal AI_USER, STAT_SPATK, 12, Score_Minus10 if_stat_level_equal AI_USER, STAT_SPATK, MAX_STAT_STAGE, Score_Minus10
if_stat_level_equal AI_USER, STAT_SPDEF, 12, Score_Minus8 if_stat_level_equal AI_USER, STAT_SPDEF, MAX_STAT_STAGE, Score_Minus8
end end
AI_CBM_DragonDance: @ 82DC778 AI_CBM_DragonDance: @ 82DC778
if_stat_level_equal AI_USER, STAT_ATK, 12, Score_Minus10 if_stat_level_equal AI_USER, STAT_ATK, MAX_STAT_STAGE, Score_Minus10
if_stat_level_equal AI_USER, STAT_SPEED, 12, Score_Minus8 if_stat_level_equal AI_USER, STAT_SPEED, MAX_STAT_STAGE, Score_Minus8
end end
Score_Minus1: Score_Minus1:
@ -1101,7 +1101,7 @@ AI_CV_EvasionUp7:
AI_CV_EvasionUp8: AI_CV_EvasionUp8:
if_hp_more_than AI_USER, 70, AI_CV_EvasionUp_End 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_USER, 40, AI_CV_EvasionUp_ScoreDown2
if_hp_less_than AI_TARGET, 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 if_random_less_than 70, AI_CV_EvasionUp_End
@ -1130,7 +1130,7 @@ AI_CV_AlwaysHit_End:
end end
AI_CV_AttackDown: @ 82DCDF8 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 score -1
if_hp_more_than AI_USER, 90, AI_CV_AttackDown2 if_hp_more_than AI_USER, 90, AI_CV_AttackDown2
score -1 score -1
@ -1198,7 +1198,7 @@ AI_CV_SpeedDown_End: @ 82DCE96
end end
AI_CV_SpAtkDown: 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 score -1
if_hp_more_than AI_USER, 90, AI_CV_SpAtkDown2 if_hp_more_than AI_USER, 90, AI_CV_SpAtkDown2
score -1 score -1
@ -1284,7 +1284,7 @@ AI_CV_AccuracyDown7:
AI_CV_AccuracyDown8: AI_CV_AccuracyDown8:
if_hp_more_than AI_USER, 70, AI_CV_AccuracyDown_End 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_USER, 40, AI_CV_AccuracyDown_ScoreDown2
if_hp_less_than AI_TARGET, 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 if_random_less_than 70, AI_CV_AccuracyDown_End
@ -1997,7 +1997,7 @@ AI_CV_Curse2:
score +1 score +1
AI_CV_Curse3: 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 if_random_less_than 128, AI_CV_Curse_End
score +1 score +1
goto AI_CV_Curse_End goto AI_CV_Curse_End
@ -2518,7 +2518,7 @@ AI_CV_ChangeSelfAbility_AbilitiesToEncourage:
AI_CV_Superpower: AI_CV_Superpower:
if_type_effectiveness AI_EFFECTIVENESS_x0_25, AI_CV_Superpower_ScoreDown1 if_type_effectiveness AI_EFFECTIVENESS_x0_25, AI_CV_Superpower_ScoreDown1
if_type_effectiveness AI_EFFECTIVENESS_x0_5, 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_target_faster AI_CV_Superpower2
if_hp_more_than AI_USER, 40, AI_CV_Superpower_ScoreDown1 if_hp_more_than AI_USER, 40, AI_CV_Superpower_ScoreDown1
goto AI_CV_Superpower_End goto AI_CV_Superpower_End
@ -2933,12 +2933,12 @@ sMovesTable_ProtectMoves:
AI_PreferBatonPass_EncourageIfHighStats: AI_PreferBatonPass_EncourageIfHighStats:
get_turn_count get_turn_count
if_equal 0, Score_Minus2 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, DEFAULT_STAT_STAGE + 2, Score_Plus3
if_stat_level_more_than AI_USER, STAT_ATK, 7, Score_Plus2 if_stat_level_more_than AI_USER, STAT_ATK, DEFAULT_STAT_STAGE + 1, Score_Plus2
if_stat_level_more_than AI_USER, STAT_ATK, 6, Score_Plus1 if_stat_level_more_than AI_USER, STAT_ATK, DEFAULT_STAT_STAGE, Score_Plus1
if_stat_level_more_than AI_USER, STAT_SPATK, 8, Score_Plus3 if_stat_level_more_than AI_USER, STAT_SPATK, DEFAULT_STAT_STAGE + 2, Score_Plus3
if_stat_level_more_than AI_USER, STAT_SPATK, 7, Score_Plus2 if_stat_level_more_than AI_USER, STAT_SPATK, DEFAULT_STAT_STAGE + 1, Score_Plus2
if_stat_level_more_than AI_USER, STAT_SPATK, 6, Score_Plus1 if_stat_level_more_than AI_USER, STAT_SPATK, DEFAULT_STAT_STAGE, Score_Plus1
end end
AI_PreferBatonPassEnd: AI_PreferBatonPassEnd:

View File

@ -1504,9 +1504,9 @@ BattleScript_EffectCurse::
attackcanceler attackcanceler
attackstring attackstring
ppreduce ppreduce
jumpifstat BS_ATTACKER, CMP_GREATER_THAN, STAT_SPEED, 0x0, BattleScript_CurseTrySpeed jumpifstat BS_ATTACKER, CMP_GREATER_THAN, STAT_SPEED, MIN_STAT_STAGE, BattleScript_CurseTrySpeed
jumpifstat BS_ATTACKER, CMP_NOT_EQUAL, STAT_ATK, 0xC, BattleScript_CurseTrySpeed jumpifstat BS_ATTACKER, CMP_NOT_EQUAL, STAT_ATK, MAX_STAT_STAGE, BattleScript_CurseTrySpeed
jumpifstat BS_ATTACKER, CMP_EQUAL, STAT_DEF, 0xC, BattleScript_ButItFailed jumpifstat BS_ATTACKER, CMP_EQUAL, STAT_DEF, MAX_STAT_STAGE, BattleScript_ButItFailed
BattleScript_CurseTrySpeed:: BattleScript_CurseTrySpeed::
copybyte gBattlerTarget, gBattlerAttacker copybyte gBattlerTarget, gBattlerAttacker
setbyte sB_ANIM_TURN, 0x1 setbyte sB_ANIM_TURN, 0x1
@ -2670,8 +2670,8 @@ BattleScript_EffectTickle::
attackcanceler attackcanceler
attackstring attackstring
ppreduce ppreduce
jumpifstat BS_TARGET, CMP_GREATER_THAN, STAT_ATK, 0x0, BattleScript_TickleDoMoveAnim jumpifstat BS_TARGET, CMP_GREATER_THAN, STAT_ATK, MIN_STAT_STAGE, BattleScript_TickleDoMoveAnim
jumpifstat BS_TARGET, CMP_EQUAL, STAT_DEF, 0x0, BattleScript_CantLowerMultipleStats jumpifstat BS_TARGET, CMP_EQUAL, STAT_DEF, MIN_STAT_STAGE, BattleScript_CantLowerMultipleStats
BattleScript_TickleDoMoveAnim:: BattleScript_TickleDoMoveAnim::
accuracycheck BattleScript_ButItFailed, ACC_CURR_MOVE accuracycheck BattleScript_ButItFailed, ACC_CURR_MOVE
attackanimation attackanimation
@ -2705,8 +2705,8 @@ BattleScript_EffectCosmicPower::
attackcanceler attackcanceler
attackstring attackstring
ppreduce ppreduce
jumpifstat BS_ATTACKER, CMP_LESS_THAN, STAT_DEF, 0xC, BattleScript_CosmicPowerDoMoveAnim jumpifstat BS_ATTACKER, CMP_LESS_THAN, STAT_DEF, MAX_STAT_STAGE, BattleScript_CosmicPowerDoMoveAnim
jumpifstat BS_ATTACKER, CMP_EQUAL, STAT_SPDEF, 0xC, BattleScript_CantRaiseMultipleStats jumpifstat BS_ATTACKER, CMP_EQUAL, STAT_SPDEF, MAX_STAT_STAGE, BattleScript_CantRaiseMultipleStats
BattleScript_CosmicPowerDoMoveAnim:: BattleScript_CosmicPowerDoMoveAnim::
attackanimation attackanimation
waitanimation waitanimation
@ -2734,8 +2734,8 @@ BattleScript_EffectBulkUp::
attackcanceler attackcanceler
attackstring attackstring
ppreduce ppreduce
jumpifstat BS_ATTACKER, CMP_LESS_THAN, STAT_ATK, 0xC, BattleScript_BulkUpDoMoveAnim jumpifstat BS_ATTACKER, CMP_LESS_THAN, STAT_ATK, MAX_STAT_STAGE, BattleScript_BulkUpDoMoveAnim
jumpifstat BS_ATTACKER, CMP_EQUAL, STAT_DEF, 0xC, BattleScript_CantRaiseMultipleStats jumpifstat BS_ATTACKER, CMP_EQUAL, STAT_DEF, MAX_STAT_STAGE, BattleScript_CantRaiseMultipleStats
BattleScript_BulkUpDoMoveAnim:: BattleScript_BulkUpDoMoveAnim::
attackanimation attackanimation
waitanimation waitanimation
@ -2759,8 +2759,8 @@ BattleScript_EffectCalmMind::
attackcanceler attackcanceler
attackstring attackstring
ppreduce ppreduce
jumpifstat BS_ATTACKER, CMP_LESS_THAN, STAT_SPATK, 0xC, BattleScript_CalmMindDoMoveAnim jumpifstat BS_ATTACKER, CMP_LESS_THAN, STAT_SPATK, MAX_STAT_STAGE, BattleScript_CalmMindDoMoveAnim
jumpifstat BS_ATTACKER, CMP_EQUAL, STAT_SPDEF, 0xC, BattleScript_CantRaiseMultipleStats jumpifstat BS_ATTACKER, CMP_EQUAL, STAT_SPDEF, MAX_STAT_STAGE, BattleScript_CantRaiseMultipleStats
BattleScript_CalmMindDoMoveAnim:: BattleScript_CalmMindDoMoveAnim::
attackanimation attackanimation
waitanimation waitanimation
@ -2791,8 +2791,8 @@ BattleScript_EffectDragonDance::
attackcanceler attackcanceler
attackstring attackstring
ppreduce ppreduce
jumpifstat BS_ATTACKER, CMP_LESS_THAN, STAT_ATK, 0xC, BattleScript_DragonDanceDoMoveAnim jumpifstat BS_ATTACKER, CMP_LESS_THAN, STAT_ATK, MAX_STAT_STAGE, BattleScript_DragonDanceDoMoveAnim
jumpifstat BS_ATTACKER, CMP_EQUAL, STAT_SPEED, 0xC, BattleScript_CantRaiseMultipleStats jumpifstat BS_ATTACKER, CMP_EQUAL, STAT_SPEED, MAX_STAT_STAGE, BattleScript_CantRaiseMultipleStats
BattleScript_DragonDanceDoMoveAnim:: BattleScript_DragonDanceDoMoveAnim::
attackanimation attackanimation
waitanimation waitanimation
@ -3047,13 +3047,13 @@ BattleScript_FrontierTrainerBattleWon_LoseTexts:
trainerslidein BS_ATTACKER trainerslidein BS_ATTACKER
waitstate waitstate
printstring STRINGID_TRAINER1LOSETEXT printstring STRINGID_TRAINER1LOSETEXT
jumpifnotbattletype BATTLE_TYPE_TWO_OPPONENTS, BattleScript_82DAACB jumpifnotbattletype BATTLE_TYPE_TWO_OPPONENTS, BattleScript_TryPickUpItems
trainerslideout B_POSITION_OPPONENT_LEFT trainerslideout B_POSITION_OPPONENT_LEFT
waitstate waitstate
trainerslidein BS_FAINTED trainerslidein BS_FAINTED
waitstate waitstate
printstring STRINGID_TRAINER2LOSETEXT printstring STRINGID_TRAINER2LOSETEXT
BattleScript_82DAACB: BattleScript_TryPickUpItems:
jumpifnotbattletype BATTLE_TYPE_PYRAMID, BattleScript_FrontierTrainerBattleWon_End jumpifnotbattletype BATTLE_TYPE_PYRAMID, BattleScript_FrontierTrainerBattleWon_End
pickup pickup
BattleScript_FrontierTrainerBattleWon_End: BattleScript_FrontierTrainerBattleWon_End:
@ -3462,11 +3462,11 @@ BattleScript_PerishSongCountGoesDown::
end2 end2
BattleScript_AllStatsUp:: BattleScript_AllStatsUp::
jumpifstat BS_ATTACKER, CMP_LESS_THAN, STAT_ATK, 0xC, BattleScript_AllStatsUpAtk jumpifstat BS_ATTACKER, CMP_LESS_THAN, STAT_ATK, MAX_STAT_STAGE, BattleScript_AllStatsUpAtk
jumpifstat BS_ATTACKER, CMP_LESS_THAN, STAT_DEF, 0xC, BattleScript_AllStatsUpAtk jumpifstat BS_ATTACKER, CMP_LESS_THAN, STAT_DEF, MAX_STAT_STAGE, BattleScript_AllStatsUpAtk
jumpifstat BS_ATTACKER, CMP_LESS_THAN, STAT_SPEED, 0xC, BattleScript_AllStatsUpAtk jumpifstat BS_ATTACKER, CMP_LESS_THAN, STAT_SPEED, MAX_STAT_STAGE, BattleScript_AllStatsUpAtk
jumpifstat BS_ATTACKER, CMP_LESS_THAN, STAT_SPATK, 0xC, BattleScript_AllStatsUpAtk jumpifstat BS_ATTACKER, CMP_LESS_THAN, STAT_SPATK, MAX_STAT_STAGE, BattleScript_AllStatsUpAtk
jumpifstat BS_ATTACKER, CMP_EQUAL, STAT_SPDEF, 0xC, BattleScript_AllStatsUpRet jumpifstat BS_ATTACKER, CMP_EQUAL, STAT_SPDEF, MAX_STAT_STAGE, BattleScript_AllStatsUpRet
BattleScript_AllStatsUpAtk:: BattleScript_AllStatsUpAtk::
setbyte sSTAT_ANIM_PLAYED, FALSE setbyte sSTAT_ANIM_PLAYED, FALSE
playstatchangeanimation BS_ATTACKER, BIT_ATK | BIT_DEF | BIT_SPEED | BIT_SPATK | BIT_SPDEF, 0x0 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_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 playstatchangeanimation BS_ATTACKER, BIT_ATK, STAT_CHANGE_CANT_PREVENT | STAT_CHANGE_NEGATIVE
setstatchanger STAT_ATK, 1, TRUE setstatchanger STAT_ATK, 1, TRUE
statbuffchange MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN | STAT_BUFF_ALLOW_PTR, BattleScript_82DB144 statbuffchange MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN | STAT_BUFF_ALLOW_PTR, BattleScript_AtkDefDown_TryDef
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_82DB144 jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_AtkDefDown_TryDef
printfromtable gStatDownStringIds printfromtable gStatDownStringIds
waitmessage 0x40 waitmessage 0x40
BattleScript_82DB144:: BattleScript_AtkDefDown_TryDef::
playstatchangeanimation BS_ATTACKER, BIT_DEF, STAT_CHANGE_CANT_PREVENT | STAT_CHANGE_NEGATIVE playstatchangeanimation BS_ATTACKER, BIT_DEF, STAT_CHANGE_CANT_PREVENT | STAT_CHANGE_NEGATIVE
setstatchanger STAT_DEF, 1, TRUE setstatchanger STAT_DEF, 1, TRUE
statbuffchange MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN | STAT_BUFF_ALLOW_PTR, BattleScript_82DB167 statbuffchange MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN | STAT_BUFF_ALLOW_PTR, BattleScript_AtkDefDown_End
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_82DB167 jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_AtkDefDown_End
printfromtable gStatDownStringIds printfromtable gStatDownStringIds
waitmessage 0x40 waitmessage 0x40
BattleScript_82DB167:: BattleScript_AtkDefDown_End::
return return
BattleScript_KnockedOff:: BattleScript_KnockedOff::
@ -4017,10 +4017,10 @@ BattleScript_WeatherFormChangesLoop::
return return
BattleScript_CastformChange:: BattleScript_CastformChange::
call BattleScript_82DB4AF call BattleScript_DoCastformChange
end3 end3
BattleScript_82DB4AF:: BattleScript_DoCastformChange::
docastformchangeanimation docastformchangeanimation
waitstate waitstate
printstring STRINGID_PKMNTRANSFORMED printstring STRINGID_PKMNTRANSFORMED

View File

@ -84,6 +84,10 @@
#define NUM_NATURE_STATS NUM_STATS - 1 // excludes HP #define NUM_NATURE_STATS NUM_STATS - 1 // excludes HP
#define NUM_BATTLE_STATS NUM_STATS + 2 // includes Accuracy and Evasion #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 // Shiny odds
#define SHINY_ODDS 8 // Actual probability is SHINY_ODDS/65536 #define SHINY_ODDS 8 // Actual probability is SHINY_ODDS/65536

View File

@ -254,7 +254,7 @@ extern const u16 *const gLevelUpLearnsets[];
extern const u8 gPPUpGetMask[]; extern const u8 gPPUpGetMask[];
extern const u8 gPPUpSetMask[]; extern const u8 gPPUpSetMask[];
extern const u8 gPPUpAddMask[]; extern const u8 gPPUpAddMask[];
extern const u8 gStatStageRatios[][2]; extern const u8 gStatStageRatios[MAX_STAT_STAGE + 1][2];
extern const u16 gLinkPlayerFacilityClasses[]; extern const u16 gLinkPlayerFacilityClasses[];
extern const struct SpriteTemplate gUnknown_08329D98[]; extern const struct SpriteTemplate gUnknown_08329D98[];
extern const s8 gNatureStatTable[][5]; extern const s8 gNatureStatTable[][5];

View File

@ -314,8 +314,8 @@ static bool8 AreStatsRaised(void)
for (i = 0; i < NUM_BATTLE_STATS; i++) for (i = 0; i < NUM_BATTLE_STATS; i++)
{ {
if (gBattleMons[gActiveBattler].statStages[i] > 6) if (gBattleMons[gActiveBattler].statStages[i] > DEFAULT_STAT_STAGE)
buffedStatsValue += gBattleMons[gActiveBattler].statStages[i] - 6; buffedStatsValue += gBattleMons[gActiveBattler].statStages[i] - DEFAULT_STAT_STAGE;
} }
return (buffedStatsValue > 3); return (buffedStatsValue > 3);

View File

@ -3135,7 +3135,7 @@ void SwitchInClearSetData(void)
if (gBattleMoves[gCurrentMove].effect != EFFECT_BATON_PASS) if (gBattleMoves[gCurrentMove].effect != EFFECT_BATON_PASS)
{ {
for (i = 0; i < NUM_BATTLE_STATS; i++) 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++) for (i = 0; i < gBattlersCount; i++)
{ {
if ((gBattleMons[i].status2 & STATUS2_ESCAPE_PREVENTION) && gDisableStructs[i].battlerPreventingEscape == gActiveBattler) if ((gBattleMons[i].status2 & STATUS2_ESCAPE_PREVENTION) && gDisableStructs[i].battlerPreventingEscape == gActiveBattler)
@ -3244,7 +3244,7 @@ void FaintClearSetData(void)
u8 *ptr; u8 *ptr;
for (i = 0; i < NUM_BATTLE_STATS; i++) for (i = 0; i < NUM_BATTLE_STATS; i++)
gBattleMons[gActiveBattler].statStages[i] = 6; gBattleMons[gActiveBattler].statStages[i] = DEFAULT_STAT_STAGE;
gBattleMons[gActiveBattler].status2 = 0; gBattleMons[gActiveBattler].status2 = 0;
gStatuses3[gActiveBattler] = 0; gStatuses3[gActiveBattler] = 0;
@ -3398,7 +3398,7 @@ static void BattleIntroDrawTrainersOrMonsSprites(void)
hpOnSwitchout = &gBattleStruct->hpOnSwitchout[GetBattlerSide(gActiveBattler)]; hpOnSwitchout = &gBattleStruct->hpOnSwitchout[GetBattlerSide(gActiveBattler)];
*hpOnSwitchout = gBattleMons[gActiveBattler].hp; *hpOnSwitchout = gBattleMons[gActiveBattler].hp;
for (i = 0; i < NUM_BATTLE_STATS; i++) for (i = 0; i < NUM_BATTLE_STATS; i++)
gBattleMons[gActiveBattler].statStages[i] = 6; gBattleMons[gActiveBattler].statStages[i] = DEFAULT_STAT_STAGE;
gBattleMons[gActiveBattler].status2 = 0; gBattleMons[gActiveBattler].status2 = 0;
} }

View File

@ -445,7 +445,7 @@ const u8 * const gStatNamesTable[NUM_BATTLE_STATS] =
[STAT_SPATK] = sText_SpAtk2, [STAT_SPATK] = sText_SpAtk2,
[STAT_SPDEF] = sText_SpDef2, [STAT_SPDEF] = sText_SpDef2,
[STAT_ACC] = sText_Accuracy, [STAT_ACC] = sText_Accuracy,
[STAT_EVASION] = sText_Evasiveness [STAT_EVASION] = sText_Evasiveness,
}; };
static const u8 sText_PokeblockWasTooSpicy[] = _("was too spicy!"); static const u8 sText_PokeblockWasTooSpicy[] = _("was too spicy!");

View File

@ -1128,13 +1128,13 @@ static void Cmd_accuracycheck(void)
else else
{ {
u8 acc = gBattleMons[gBattlerAttacker].statStages[STAT_ACC]; 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) if (buff < MIN_STAT_STAGE)
buff = 0; buff = MIN_STAT_STAGE;
if (buff > 0xC) if (buff > MAX_STAT_STAGE)
buff = 0xC; buff = MAX_STAT_STAGE;
moveAcc = gBattleMoves[move].accuracy; moveAcc = gBattleMoves[move].accuracy;
// check Thunder on sunny weather // 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) 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)) if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES) && !GetMonData(&gPlayerParty[i], MON_DATA_IS_EGG))
HP_count += GetMonData(&gPlayerParty[i], MON_DATA_HP); 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 (gBattlescriptCurrInstr[3] & STAT_CHANGE_CANT_PREVENT)
{ {
if (gBattleMons[gActiveBattler].statStages[currStat] > 0) if (gBattleMons[gActiveBattler].statStages[currStat] > MIN_STAT_STAGE)
{ {
statAnimId = startingStatAnimId + currStat; statAnimId = startingStatAnimId + currStat;
changeableStatsCount++; changeableStatsCount++;
@ -4397,7 +4397,7 @@ static void Cmd_playstatchangeanimation(void)
&& !(gBattleMons[gActiveBattler].ability == ABILITY_KEEN_EYE && currStat == STAT_ACC) && !(gBattleMons[gActiveBattler].ability == ABILITY_KEEN_EYE && currStat == STAT_ACC)
&& !(gBattleMons[gActiveBattler].ability == ABILITY_HYPER_CUTTER && currStat == STAT_ATK)) && !(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; statAnimId = startingStatAnimId + currStat;
changeableStatsCount++; changeableStatsCount++;
@ -4425,7 +4425,7 @@ static void Cmd_playstatchangeanimation(void)
while (statsToCheck != 0) while (statsToCheck != 0)
{ {
if (statsToCheck & 1 && gBattleMons[gActiveBattler].statStages[currStat] < 0xC) if (statsToCheck & 1 && gBattleMons[gActiveBattler].statStages[currStat] < MAX_STAT_STAGE)
{ {
statAnimId = startingStatAnimId + currStat; statAnimId = startingStatAnimId + currStat;
changeableStatsCount++; changeableStatsCount++;
@ -4495,7 +4495,7 @@ static void Cmd_moveend(void)
&& gBattleMons[gBattlerTarget].hp != 0 && gBattlerAttacker != gBattlerTarget && gBattleMons[gBattlerTarget].hp != 0 && gBattlerAttacker != gBattlerTarget
&& GetBattlerSide(gBattlerAttacker) != GetBattlerSide(gBattlerTarget) && GetBattlerSide(gBattlerAttacker) != GetBattlerSide(gBattlerTarget)
&& !(gMoveResultFlags & MOVE_RESULT_NO_EFFECT) && TARGET_TURN_DAMAGED && !(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]++; gBattleMons[gBattlerTarget].statStages[STAT_ATK]++;
BattleScriptPushCursor(); BattleScriptPushCursor();
@ -7288,7 +7288,7 @@ static u8 ChangeStatBuffs(s8 statValue, u8 statId, u8 flags, const u8 *BS_ptr)
index++; index++;
gBattleTextBuff2[index] = B_BUFF_EOS; gBattleTextBuff2[index] = B_BUFF_EOS;
if (gBattleMons[gActiveBattler].statStages[statId] == 0) if (gBattleMons[gActiveBattler].statStages[statId] == MIN_STAT_STAGE)
gBattleCommunication[MULTISTRING_CHOOSER] = 2; gBattleCommunication[MULTISTRING_CHOOSER] = 2;
else else
gBattleCommunication[MULTISTRING_CHOOSER] = (gBattlerTarget == gActiveBattler); gBattleCommunication[MULTISTRING_CHOOSER] = (gBattlerTarget == gActiveBattler);
@ -7315,17 +7315,17 @@ static u8 ChangeStatBuffs(s8 statValue, u8 statId, u8 flags, const u8 *BS_ptr)
index++; index++;
gBattleTextBuff2[index] = B_BUFF_EOS; gBattleTextBuff2[index] = B_BUFF_EOS;
if (gBattleMons[gActiveBattler].statStages[statId] == 0xC) if (gBattleMons[gActiveBattler].statStages[statId] == MAX_STAT_STAGE)
gBattleCommunication[MULTISTRING_CHOOSER] = 2; gBattleCommunication[MULTISTRING_CHOOSER] = 2;
else else
gBattleCommunication[MULTISTRING_CHOOSER] = (gBattlerTarget == gActiveBattler); gBattleCommunication[MULTISTRING_CHOOSER] = (gBattlerTarget == gActiveBattler);
} }
gBattleMons[gActiveBattler].statStages[statId] += statValue; gBattleMons[gActiveBattler].statStages[statId] += statValue;
if (gBattleMons[gActiveBattler].statStages[statId] < 0) if (gBattleMons[gActiveBattler].statStages[statId] < MIN_STAT_STAGE)
gBattleMons[gActiveBattler].statStages[statId] = 0; gBattleMons[gActiveBattler].statStages[statId] = MIN_STAT_STAGE;
if (gBattleMons[gActiveBattler].statStages[statId] > 0xC) if (gBattleMons[gActiveBattler].statStages[statId] > MAX_STAT_STAGE)
gBattleMons[gActiveBattler].statStages[statId] = 0xC; gBattleMons[gActiveBattler].statStages[statId] = MAX_STAT_STAGE;
if (gBattleCommunication[MULTISTRING_CHOOSER] == 2 && flags & STAT_BUFF_ALLOW_PTR) if (gBattleCommunication[MULTISTRING_CHOOSER] == 2 && flags & STAT_BUFF_ALLOW_PTR)
gMoveResultFlags |= MOVE_RESULT_MISSED; gMoveResultFlags |= MOVE_RESULT_MISSED;
@ -7350,7 +7350,7 @@ static void Cmd_normalisebuffs(void) // haze
for (i = 0; i < gBattlersCount; i++) for (i = 0; i < gBattlersCount; i++)
{ {
for (j = 0; j < NUM_BATTLE_STATS; j++) for (j = 0; j < NUM_BATTLE_STATS; j++)
gBattleMons[i].statStages[j] = 6; gBattleMons[i].statStages[j] = DEFAULT_STAT_STAGE;
} }
gBattlescriptCurrInstr++; gBattlescriptCurrInstr++;
@ -8750,7 +8750,7 @@ static void Cmd_rolloutdamagecalculation(void)
static void Cmd_jumpifconfusedandstatmaxed(void) static void Cmd_jumpifconfusedandstatmaxed(void)
{ {
if (gBattleMons[gBattlerTarget].status2 & STATUS2_CONFUSION 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); gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 2);
else else
gBattlescriptCurrInstr += 6; gBattlescriptCurrInstr += 6;
@ -8957,10 +8957,10 @@ static void Cmd_maxattackhalvehp(void) // belly drum
if (!(gBattleMons[gBattlerAttacker].maxHP / 2)) if (!(gBattleMons[gBattlerAttacker].maxHP / 2))
halfHp = 1; halfHp = 1;
if (gBattleMons[gBattlerAttacker].statStages[STAT_ATK] < 12 if (gBattleMons[gBattlerAttacker].statStages[STAT_ATK] < MAX_STAT_STAGE
&& gBattleMons[gBattlerAttacker].hp > halfHp) && gBattleMons[gBattlerAttacker].hp > halfHp)
{ {
gBattleMons[gBattlerAttacker].statStages[STAT_ATK] = 12; gBattleMons[gBattlerAttacker].statStages[STAT_ATK] = MAX_STAT_STAGE;
gBattleMoveDamage = gBattleMons[gBattlerAttacker].maxHP / 2; gBattleMoveDamage = gBattleMons[gBattlerAttacker].maxHP / 2;
if (gBattleMoveDamage == 0) if (gBattleMoveDamage == 0)
gBattleMoveDamage = 1; gBattleMoveDamage = 1;
@ -9234,8 +9234,8 @@ static void Cmd_sethail(void)
static void Cmd_jumpifattackandspecialattackcannotfall(void) // memento static void Cmd_jumpifattackandspecialattackcannotfall(void) // memento
{ {
if (gBattleMons[gBattlerTarget].statStages[STAT_ATK] == 0 if (gBattleMons[gBattlerTarget].statStages[STAT_ATK] == MIN_STAT_STAGE
&& gBattleMons[gBattlerTarget].statStages[STAT_SPATK] == 0 && gBattleMons[gBattlerTarget].statStages[STAT_SPATK] == MIN_STAT_STAGE
&& gBattleCommunication[6] != 1) && gBattleCommunication[6] != 1)
{ {
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 1); gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 1);

View File

@ -1398,9 +1398,9 @@ static void TrySetBattleSeminarShow(void)
return; return;
else if (GetBattlerSide(gBattlerAttacker) == B_SIDE_OPPONENT) else if (GetBattlerSide(gBattlerAttacker) == B_SIDE_OPPONENT)
return; return;
else if (gBattleMons[gBattlerAttacker].statStages[STAT_ACC] <= 5) else if (gBattleMons[gBattlerAttacker].statStages[STAT_ACC] < DEFAULT_STAT_STAGE)
return; return;
else if (gBattleMons[gBattlerTarget].statStages[STAT_EVASION] > 6) else if (gBattleMons[gBattlerTarget].statStages[STAT_EVASION] > DEFAULT_STAT_STAGE)
return; return;
else if (gCurrentMove == MOVE_HIDDEN_POWER || gCurrentMove == MOVE_WEATHER_BALL) else if (gCurrentMove == MOVE_HIDDEN_POWER || gCurrentMove == MOVE_WEATHER_BALL)
return; return;

View File

@ -1978,7 +1978,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA
} }
break; break;
case ABILITY_SPEED_BOOST: 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]++; gBattleMons[battler].statStages[STAT_SPEED]++;
gBattleScripting.animArg1 = 0x11; gBattleScripting.animArg1 = 0x11;
@ -2619,9 +2619,9 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
case HOLD_EFFECT_RESTORE_STATS: case HOLD_EFFECT_RESTORE_STATS:
for (i = 0; i < NUM_BATTLE_STATS; i++) 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; effect = ITEM_STATS_CHANGE;
} }
} }
@ -2690,9 +2690,9 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
case HOLD_EFFECT_RESTORE_STATS: case HOLD_EFFECT_RESTORE_STATS:
for (i = 0; i < NUM_BATTLE_STATS; i++) 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; effect = ITEM_STATS_CHANGE;
} }
} }
@ -2811,7 +2811,8 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
break; break;
// copy/paste again, smh // copy/paste again, smh
case HOLD_EFFECT_ATTACK_UP: 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_STAT_BUFFER(gBattleTextBuff1, STAT_ATK);
PREPARE_STRING_BUFFER(gBattleTextBuff2, STRINGID_STATROSE); PREPARE_STRING_BUFFER(gBattleTextBuff2, STRINGID_STATROSE);
@ -2825,7 +2826,8 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
} }
break; break;
case HOLD_EFFECT_DEFENSE_UP: 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); PREPARE_STAT_BUFFER(gBattleTextBuff1, STAT_DEF);
@ -2838,7 +2840,8 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
} }
break; break;
case HOLD_EFFECT_SPEED_UP: 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); PREPARE_STAT_BUFFER(gBattleTextBuff1, STAT_SPEED);
@ -2851,7 +2854,8 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
} }
break; break;
case HOLD_EFFECT_SP_ATTACK_UP: 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); PREPARE_STAT_BUFFER(gBattleTextBuff1, STAT_SPATK);
@ -2864,7 +2868,8 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
} }
break; break;
case HOLD_EFFECT_SP_DEFENSE_UP: 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); PREPARE_STAT_BUFFER(gBattleTextBuff1, STAT_SPDEF);
@ -2877,7 +2882,8 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
} }
break; break;
case HOLD_EFFECT_CRITICAL_UP: 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; gBattleMons[battlerId].status2 |= STATUS2_FOCUS_ENERGY;
BattleScriptExecute(BattleScript_BerryFocusEnergyEnd2); BattleScriptExecute(BattleScript_BerryFocusEnergyEnd2);
@ -2889,7 +2895,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
{ {
for (i = 0; i < 5; i++) 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; break;
} }
if (i != 5) if (i != 5)
@ -2897,7 +2903,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
do do
{ {
i = Random() % 5; 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); PREPARE_STAT_BUFFER(gBattleTextBuff1, i + 1);
@ -3166,9 +3172,9 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
case HOLD_EFFECT_RESTORE_STATS: case HOLD_EFFECT_RESTORE_STATS:
for (i = 0; i < NUM_BATTLE_STATS; i++) 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; effect = ITEM_STATS_CHANGE;
} }
} }

View File

@ -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 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 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, 35}, // -5
{10, 30}, // -4 {10, 30}, // -4
{10, 25}, // -3 {10, 25}, // -3
{10, 20}, // -2 {10, 20}, // -2
{10, 15}, // -1 {10, 15}, // -1
{10, 10}, // 0 {10, 10}, // 0, DEFAULT_STAT_STAGE
{15, 10}, // +1 {15, 10}, // +1
{20, 10}, // +2 {20, 10}, // +2
{25, 10}, // +3 {25, 10}, // +3
{30, 10}, // +4 {30, 10}, // +4
{35, 10}, // +5 {35, 10}, // +5
{40, 10}, // +6 {40, 10}, // +6, MAX_STAT_STAGE
}; };
static const u16 sDeoxysBaseStats[] = static const u16 sDeoxysBaseStats[] =
@ -3199,7 +3199,7 @@ s32 CalculateBaseDamage(struct BattlePokemon *attacker, struct BattlePokemon *de
{ {
if (gCritMultiplier == 2) 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) APPLY_STAT_MOD(damage, attacker, attack, STAT_ATK)
else else
damage = attack; damage = attack;
@ -3212,7 +3212,7 @@ s32 CalculateBaseDamage(struct BattlePokemon *attacker, struct BattlePokemon *de
if (gCritMultiplier == 2) 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) APPLY_STAT_MOD(damageHelper, defender, defense, STAT_DEF)
else else
damageHelper = defense; damageHelper = defense;
@ -3249,7 +3249,7 @@ s32 CalculateBaseDamage(struct BattlePokemon *attacker, struct BattlePokemon *de
{ {
if (gCritMultiplier == 2) 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) APPLY_STAT_MOD(damage, attacker, spAttack, STAT_SPATK)
else else
damage = spAttack; damage = spAttack;
@ -3262,7 +3262,7 @@ s32 CalculateBaseDamage(struct BattlePokemon *attacker, struct BattlePokemon *de
if (gCritMultiplier == 2) 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) APPLY_STAT_MOD(damageHelper, defender, spDefense, STAT_SPDEF)
else else
damageHelper = spDefense; damageHelper = spDefense;
@ -4624,8 +4624,8 @@ void CopyPlayerPartyMonToBattleData(u8 battlerId, u8 partyIndex)
hpSwitchout = &gBattleStruct->hpOnSwitchout[GetBattlerSide(battlerId)]; hpSwitchout = &gBattleStruct->hpOnSwitchout[GetBattlerSide(battlerId)];
*hpSwitchout = gBattleMons[battlerId].hp; *hpSwitchout = gBattleMons[battlerId].hp;
for (i = 0; i < 8; i++) for (i = 0; i < NUM_BATTLE_STATS; i++)
gBattleMons[battlerId].statStages[i] = 6; gBattleMons[battlerId].statStages[i] = DEFAULT_STAT_STAGE;
gBattleMons[battlerId].status2 = 0; gBattleMons[battlerId].status2 = 0;
sub_803FA70(battlerId); sub_803FA70(battlerId);
@ -4728,49 +4728,49 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
retVal = FALSE; retVal = FALSE;
} }
if ((itemEffect[cmdIndex] & ITEM0_X_ATTACK) 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; gBattleMons[gActiveBattler].statStages[STAT_ATK] += itemEffect[cmdIndex] & ITEM0_X_ATTACK;
if (gBattleMons[gActiveBattler].statStages[STAT_ATK] > 12) if (gBattleMons[gActiveBattler].statStages[STAT_ATK] > MAX_STAT_STAGE)
gBattleMons[gActiveBattler].statStages[STAT_ATK] = 12; gBattleMons[gActiveBattler].statStages[STAT_ATK] = MAX_STAT_STAGE;
retVal = FALSE; retVal = FALSE;
} }
break; break;
// in-battle stat boosting effects // in-battle stat boosting effects
case 1: case 1:
if ((itemEffect[cmdIndex] & ITEM1_X_DEFEND) 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; gBattleMons[gActiveBattler].statStages[STAT_DEF] += (itemEffect[cmdIndex] & ITEM1_X_DEFEND) >> 4;
if (gBattleMons[gActiveBattler].statStages[STAT_DEF] > 12) if (gBattleMons[gActiveBattler].statStages[STAT_DEF] > MAX_STAT_STAGE)
gBattleMons[gActiveBattler].statStages[STAT_DEF] = 12; gBattleMons[gActiveBattler].statStages[STAT_DEF] = MAX_STAT_STAGE;
retVal = FALSE; retVal = FALSE;
} }
if ((itemEffect[cmdIndex] & ITEM1_X_SPEED) 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; gBattleMons[gActiveBattler].statStages[STAT_SPEED] += itemEffect[cmdIndex] & ITEM1_X_SPEED;
if (gBattleMons[gActiveBattler].statStages[STAT_SPEED] > 12) if (gBattleMons[gActiveBattler].statStages[STAT_SPEED] > MAX_STAT_STAGE)
gBattleMons[gActiveBattler].statStages[STAT_SPEED] = 12; gBattleMons[gActiveBattler].statStages[STAT_SPEED] = MAX_STAT_STAGE;
retVal = FALSE; retVal = FALSE;
} }
break; break;
// more stat boosting effects // more stat boosting effects
case 2: case 2:
if ((itemEffect[cmdIndex] & ITEM2_X_ACCURACY) 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; gBattleMons[gActiveBattler].statStages[STAT_ACC] += (itemEffect[cmdIndex] & ITEM2_X_ACCURACY) >> 4;
if (gBattleMons[gActiveBattler].statStages[STAT_ACC] > 12) if (gBattleMons[gActiveBattler].statStages[STAT_ACC] > MAX_STAT_STAGE)
gBattleMons[gActiveBattler].statStages[STAT_ACC] = 12; gBattleMons[gActiveBattler].statStages[STAT_ACC] = MAX_STAT_STAGE;
retVal = FALSE; retVal = FALSE;
} }
if ((itemEffect[cmdIndex] & ITEM2_X_SPATK) 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; gBattleMons[gActiveBattler].statStages[STAT_SPATK] += itemEffect[cmdIndex] & ITEM2_X_SPATK;
if (gBattleMons[gActiveBattler].statStages[STAT_SPATK] > 12) if (gBattleMons[gActiveBattler].statStages[STAT_SPATK] > MAX_STAT_STAGE)
gBattleMons[gActiveBattler].statStages[STAT_SPATK] = 12; gBattleMons[gActiveBattler].statStages[STAT_SPATK] = MAX_STAT_STAGE;
retVal = FALSE; retVal = FALSE;
} }
break; break;