diff --git a/data/battle_anim_scripts.s b/data/battle_anim_scripts.s index 23eb678f96e0..9ca1c9665510 100644 --- a/data/battle_anim_scripts.s +++ b/data/battle_anim_scripts.s @@ -1,3 +1,4 @@ +#include "config.h" #include "constants/battle.h" #include "constants/battle_anim.h" #include "constants/rgb.h" @@ -23570,26 +23571,25 @@ Move_SECRET_POWER: jumpargeq 0, BATTLE_TERRAIN_PUDDLE, Move_MUD_SHOT jumpargeq 0, BATTLE_TERRAIN_MARSH, Move_MUD_SHOT jumpargeq 0, BATTLE_TERRAIN_SWAMP, Move_MUD_SHOT -.if B_SECRET_POWER_ANIMATION >= GEN_7 - jumpargeq 0, BATTLE_TERRAIN_SNOW, Move_ICE_SHARD -.else - jumpargeq 0, BATTLE_TERRAIN_SNOW, Move_AVALANCHE -.endif jumpargeq 0, BATTLE_TERRAIN_ICE, Move_ICE_SHARD jumpargeq 0, BATTLE_TERRAIN_VOLCANO, Move_INCINERATE jumpargeq 0, BATTLE_TERRAIN_DISTORTION_WORLD, Move_POUND jumpargeq 0, BATTLE_TERRAIN_SPACE, Move_SWIFT jumpargeq 0, BATTLE_TERRAIN_ULTRA_SPACE, Move_PSYWAVE .if B_SECRET_POWER_ANIMATION >= GEN_7 + jumpargeq 0, BATTLE_TERRAIN_SNOW, Move_ICE_SHARD jumpargeq 0, BATTLE_TERRAIN_BUILDING, Move_SPIT_UP goto Move_SPIT_UP -.elseif B_SECRET_POWER_ANIMATION == GEN_6 +.elseif B_SECRET_POWER_ANIMATION >= GEN_6 + jumpargeq 0, BATTLE_TERRAIN_SNOW, Move_AVALANCHE jumpargeq 0, BATTLE_TERRAIN_BUILDING, Move_BODY_SLAM goto Move_BODY_SLAM -.elseif B_SECRET_POWER_ANIMATION == GEN_5 || B_SECRET_POWER_ANIMATION == GEN_4 +.elseif B_SECRET_POWER_ANIMATION >= GEN_4 + jumpargeq 0, BATTLE_TERRAIN_SNOW, Move_AVALANCHE jumpargeq 0, BATTLE_TERRAIN_BUILDING, Move_BODY_SLAM goto Move_MUD_SLAP .else + jumpargeq 0, BATTLE_TERRAIN_SNOW, Move_AVALANCHE jumpargeq 0, BATTLE_TERRAIN_BUILDING, Move_STRENGTH goto Move_SLAM .endif diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index e3d4c8943010..f1e72e8aa2c0 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -1,3 +1,4 @@ +#include "config.h" #include "constants/global.h" #include "constants/battle.h" #include "constants/pokemon.h" diff --git a/include/config.h b/include/config.h index d4a71c0766ba..d6c60a2fa8b7 100644 --- a/include/config.h +++ b/include/config.h @@ -44,4 +44,13 @@ #define POKEMON_EXPANSION #define ITEM_EXPANSION +// Generation constants used in configs to define behavior +#define GEN_3 0 +#define GEN_4 1 +#define GEN_5 2 +#define GEN_6 3 +#define GEN_7 4 +#define GEN_8 5 +#define GEN_LATEST GEN_8 + #endif // GUARD_CONFIG_H diff --git a/include/constants/battle_config.h b/include/constants/battle_config.h index d9e0abf104c9..6cf0753b0a6b 100644 --- a/include/constants/battle_config.h +++ b/include/constants/battle_config.h @@ -1,137 +1,127 @@ #ifndef GUARD_CONSTANTS_BATTLE_CONFIG_H #define GUARD_CONSTANTS_BATTLE_CONFIG_H -#ifndef GEN_3 - #define GEN_3 0 - #define GEN_4 1 - #define GEN_5 2 - #define GEN_6 3 - #define GEN_7 4 - #define GEN_8 5 -#endif - // Calculation settings -#define B_CRIT_CHANCE GEN_7 // Chances of a critical hit landing. See CalcCritChanceStage. Gen6+ chances guarantee that Farfetch'd and Sirfetch'd always get critical hits while holding a Leek and using high-crit ratio moves. -#define B_CRIT_MULTIPLIER GEN_7 // In Gen6+, critical hits multiply damage by 1.5 instead of 2. -#define B_PARALYSIS_SPEED GEN_7 // In Gen7+, Speed is decreased by 50% instead of 75%. -#define B_CONFUSION_SELF_DMG_CHANCE GEN_7 // In Gen7+, confusion has a 33.3% of self-damage, instead of 50%. -#define B_MULTI_HIT_CHANCE GEN_7 // In Gen5+, multi-hit moves have different %. See Cmd_setmultihitcounter for values. -#define B_WHITEOUT_MONEY GEN_7 // In Gen4+, the amount of money lost by losing a battle is determined by the amount of badges earned. Previously, it would cut the current money by half. (While this change was also in FRLG, for the sake of simplicity, setting this to GEN_3 will result in RSE behavior.) +#define B_CRIT_CHANCE GEN_LATEST // Chances of a critical hit landing. See CalcCritChanceStage. Gen6+ chances guarantee that Farfetch'd and Sirfetch'd always get critical hits while holding a Leek and using high-crit ratio moves. +#define B_CRIT_MULTIPLIER GEN_LATEST // In Gen6+, critical hits multiply damage by 1.5 instead of 2. +#define B_PARALYSIS_SPEED GEN_LATEST // In Gen7+, Speed is decreased by 50% instead of 75%. +#define B_CONFUSION_SELF_DMG_CHANCE GEN_LATEST // In Gen7+, confusion has a 33.3% of self-damage, instead of 50%. +#define B_MULTI_HIT_CHANCE GEN_LATEST // In Gen5+, multi-hit moves have different %. See Cmd_setmultihitcounter for values. +#define B_WHITEOUT_MONEY GEN_LATEST // In Gen4+, the amount of money lost by losing a battle is determined by the amount of badges earned. Previously, it would cut the current money by half. (While this change was also in FRLG, for the sake of simplicity, setting this to GEN_3 will result in RSE behavior.) // Exp and stat settings -#define B_EXP_CATCH GEN_7 // In Gen6+, Pokémon get experience from catching. -#define B_TRAINER_EXP_MULTIPLIER GEN_7 // In Gen7+, trainer battles no longer give a 1.5 multiplier to EXP gain. -#define B_SPLIT_EXP GEN_7 // In Gen6+, all participating mon get full experience. -#define B_SCALED_EXP GEN_7 // In Gen5 and Gen7+, experience is weighted by level difference. -#define B_BADGE_BOOST GEN_7 // In Gen4+, Gym Badges no longer boost a Pokémon's stats. -#define B_MAX_LEVEL_EV_GAINS GEN_7 // In Gen5+, Lv100 Pokémon can obtain Effort Values normally. -#define B_RECALCULATE_STATS GEN_7 // In Gen5+, the stats of the Pokémon who participate in battle are recalculated at the end of each battle. +#define B_EXP_CATCH GEN_LATEST // In Gen6+, Pokémon get experience from catching. +#define B_TRAINER_EXP_MULTIPLIER GEN_LATEST // In Gen7+, trainer battles no longer give a 1.5 multiplier to EXP gain. +#define B_SPLIT_EXP GEN_LATEST // In Gen6+, all participating mon get full experience. +#define B_SCALED_EXP GEN_LATEST // In Gen5 and Gen7+, experience is weighted by level difference. +#define B_BADGE_BOOST GEN_LATEST // In Gen4+, Gym Badges no longer boost a Pokémon's stats. +#define B_MAX_LEVEL_EV_GAINS GEN_LATEST // In Gen5+, Lv100 Pokémon can obtain Effort Values normally. +#define B_RECALCULATE_STATS GEN_LATEST // In Gen5+, the stats of the Pokémon who participate in battle are recalculated at the end of each battle. // Damage settings -#define B_BURN_DAMAGE GEN_7 // In Gen7+, burn damage is 1/16th of max HP instead of 1/8th. -#define B_BURN_FACADE_DMG GEN_7 // In Gen6+, burn's effect of lowering the Attack stat no longer applies to Facade. -#define B_BINDING_DAMAGE GEN_7 // In Gen6+, binding damage is 1/8 of max HP instead of 1/16. (With Binding Band, 1/6 and 1/8 respectively.) -#define B_PSYWAVE_DMG GEN_7 // Psywave's damage formula. See Cmd_psywavedamageeffect. -#define B_PAYBACK_SWITCH_BOOST GEN_7 // In Gen5+, if the opponent switches out, Payback's damage will no longer be doubled. -#define B_HIDDEN_POWER_DMG GEN_7 // In Gen6+, Hidden Power's base power was set to always be 60. Before, it was determined by the mon's IVs. -#define B_ROUGH_SKIN_DMG GEN_7 // In Gen4+, Rough Skin contact damage is 1/8th of max HP instead of 1/16th. This will also affect Iron Barbs. -#define B_KNOCK_OFF_DMG GEN_8 // In Gen6+, Knock Off deals 50% more damage when knocking off an item. -#define B_SPORT_DMG_REDUCTION GEN_7 // In Gen5+, Water/Mud Sport reduce Fire/Electric Damage by 67% instead of 50%. -#define B_EXPLOSION_DEFENSE GEN_7 // In Gen5+, Self-Destruct and Explosion don't halve the targets' defense. +#define B_BURN_DAMAGE GEN_LATEST // In Gen7+, burn damage is 1/16th of max HP instead of 1/8th. +#define B_BURN_FACADE_DMG GEN_LATEST // In Gen6+, burn's effect of lowering the Attack stat no longer applies to Facade. +#define B_BINDING_DAMAGE GEN_LATEST // In Gen6+, binding damage is 1/8 of max HP instead of 1/16. (With Binding Band, 1/6 and 1/8 respectively.) +#define B_PSYWAVE_DMG GEN_LATEST // Psywave's damage formula. See Cmd_psywavedamageeffect. +#define B_PAYBACK_SWITCH_BOOST GEN_LATEST // In Gen5+, if the opponent switches out, Payback's damage will no longer be doubled. +#define B_HIDDEN_POWER_DMG GEN_LATEST // In Gen6+, Hidden Power's base power was set to always be 60. Before, it was determined by the mon's IVs. +#define B_ROUGH_SKIN_DMG GEN_LATEST // In Gen4+, Rough Skin contact damage is 1/8th of max HP instead of 1/16th. This will also affect Iron Barbs. +#define B_KNOCK_OFF_DMG GEN_LATEST // In Gen6+, Knock Off deals 50% more damage when knocking off an item. +#define B_SPORT_DMG_REDUCTION GEN_LATEST // In Gen5+, Water/Mud Sport reduce Fire/Electric Damage by 67% instead of 50%. +#define B_EXPLOSION_DEFENSE GEN_LATEST // In Gen5+, Self-Destruct and Explosion don't halve the targets' defense. // Type settings -#define B_GHOSTS_ESCAPE GEN_7 // In Gen6+, abilities like Shadow Tag or moves like Mean Look fail on Ghost-type Pokémon. They can also escape any Wild Battle. -#define B_PARALYZE_ELECTRIC GEN_7 // In Gen6+, Electric-type Pokémon can't be paralyzed. -#define B_POWDER_GRASS GEN_7 // In Gen6+, Grass-type Pokémon are immune to powder and spore moves. -#define B_STEEL_RESISTANCES GEN_7 // In Gen6+, Steel-type Pokémon are no longer resistant to Dark-type and Ghost-type moves. -#define B_PRANKSTER_DARK_TYPES GEN_7 // In Gen7+, Prankster-elevated status moves do not affect Dark type Pokémon. -#define B_SHEER_COLD_IMMUNITY GEN_7 // In Gen7+, Ice-types are immune to Sheer Cold +#define B_GHOSTS_ESCAPE GEN_LATEST // In Gen6+, abilities like Shadow Tag or moves like Mean Look fail on Ghost-type Pokémon. They can also escape any Wild Battle. +#define B_PARALYZE_ELECTRIC GEN_LATEST // In Gen6+, Electric-type Pokémon can't be paralyzed. +#define B_POWDER_GRASS GEN_LATEST // In Gen6+, Grass-type Pokémon are immune to powder and spore moves. +#define B_STEEL_RESISTANCES GEN_LATEST // In Gen6+, Steel-type Pokémon are no longer resistant to Dark-type and Ghost-type moves. +#define B_PRANKSTER_DARK_TYPES GEN_LATEST // In Gen7+, Prankster-elevated status moves do not affect Dark type Pokémon. +#define B_SHEER_COLD_IMMUNITY GEN_LATEST // In Gen7+, Ice-types are immune to Sheer Cold // Turn settings -#define B_BINDING_TURNS GEN_7 // In Gen5+, binding moves last for 4-5 turns instead of 2-5 turns. (With Grip Claw, 7 and 5 turns respectively.) -#define B_UPROAR_TURNS GEN_7 // In Gen5+, Uproar lasts for 3 turns instead of 2-5 turns. -#define B_DISABLE_TURNS GEN_7 // Disable's turns. See Cmd_disablelastusedattack. -#define B_TAILWIND_TURNS GEN_7 // In Gen5+, Tailwind lasts 4 turns instead of 3. -#define B_SLEEP_TURNS GEN_7 // In Gen5+, sleep lasts for 1-3 turns instead of 2-5 turns. -#define B_TAUNT_TURNS GEN_7 // In Gen5+, Taunt lasts 3 turns if the user acts before the target, or 4 turns if the target acted before the user. In Gen3, taunt lasts 2 turns and in Gen 4, 3-5 turns. -#define B_SPORT_TURNS GEN_7 // In Gen6+, Water/Mud Sport last 5 turns, even if the user switches out. -#define B_MEGA_EVO_TURN_ORDER GEN_7 // In Gen7, a Pokémon's Speed after Mega Evolution is used to determine turn order, not its Speed before. -#define B_RECALC_TURN_AFTER_ACTIONS GEN_8 // In Gen8, switching/using a move affects the current turn's order of actions. -#define B_FAINT_SWITCH_IN GEN_7 // In Gen4+, sending out a new Pokémon after the previous one fainted happens at the end of the turn. Before, it would happen after each action. +#define B_BINDING_TURNS GEN_LATEST // In Gen5+, binding moves last for 4-5 turns instead of 2-5 turns. (With Grip Claw, 7 and 5 turns respectively.) +#define B_UPROAR_TURNS GEN_LATEST // In Gen5+, Uproar lasts for 3 turns instead of 2-5 turns. +#define B_DISABLE_TURNS GEN_LATEST // Disable's turns. See Cmd_disablelastusedattack. +#define B_TAILWIND_TURNS GEN_LATEST // In Gen5+, Tailwind lasts 4 turns instead of 3. +#define B_SLEEP_TURNS GEN_LATEST // In Gen5+, sleep lasts for 1-3 turns instead of 2-5 turns. +#define B_TAUNT_TURNS GEN_LATEST // In Gen5+, Taunt lasts 3 turns if the user acts before the target, or 4 turns if the target acted before the user. In Gen3, taunt lasts 2 turns and in Gen 4, 3-5 turns. +#define B_SPORT_TURNS GEN_LATEST // In Gen6+, Water/Mud Sport last 5 turns, even if the user switches out. +#define B_MEGA_EVO_TURN_ORDER GEN_LATEST // In Gen7, a Pokémon's Speed after Mega Evolution is used to determine turn order, not its Speed before. +#define B_RECALC_TURN_AFTER_ACTIONS GEN_LATEST // In Gen8, switching/using a move affects the current turn's order of actions. +#define B_FAINT_SWITCH_IN GEN_LATEST // In Gen4+, sending out a new Pokémon after the previous one fainted happens at the end of the turn. Before, it would happen after each action. // Move data settings -#define B_UPDATED_MOVE_DATA GEN_8 // Updates move data in gBattleMoves, including Power, Accuracy, PP, stat changes, targets, chances of secondary effects, etc. -#define B_PHYSICAL_SPECIAL_SPLIT GEN_7 // In Gen3, the move's type determines if it will do physical or special damage. The split icon in the summary will reflect this. -#define B_RECOIL_IF_MISS_DMG GEN_7 // In Gen5+, Jump Kick and High Jump Kick will always do half of the user's max HP when missing. -#define B_KLUTZ_FLING_INTERACTION GEN_7 // In Gen5+, Pokémon with the Klutz ability can't use Fling. -#define B_UPDATED_CONVERSION GEN_7 // In Gen6+, Conversion changes the user's type to match their first move's. Before, it would choose a move at random. -#define B_PP_REDUCED_BY_SPITE GEN_7 // In Gen4+, Spite reduces the foe's last move's PP by 4, instead of 2 to 5. +#define B_UPDATED_MOVE_DATA GEN_LATEST // Updates move data in gBattleMoves, including Power, Accuracy, PP, stat changes, targets, chances of secondary effects, etc. +#define B_PHYSICAL_SPECIAL_SPLIT GEN_LATEST // In Gen3, the move's type determines if it will do physical or special damage. The split icon in the summary will reflect this. +#define B_RECOIL_IF_MISS_DMG GEN_LATEST // In Gen5+, Jump Kick and High Jump Kick will always do half of the user's max HP when missing. +#define B_KLUTZ_FLING_INTERACTION GEN_LATEST // In Gen5+, Pokémon with the Klutz ability can't use Fling. +#define B_UPDATED_CONVERSION GEN_LATEST // In Gen6+, Conversion changes the user's type to match their first move's. Before, it would choose a move at random. +#define B_PP_REDUCED_BY_SPITE GEN_LATEST // In Gen4+, Spite reduces the foe's last move's PP by 4, instead of 2 to 5. // Move accuracy settings -#define B_TOXIC_NEVER_MISS GEN_7 // In Gen6+, if Toxic is used by a Poison-type Pokémon, it will never miss. -#define B_MINIMIZE_DMG_ACC GEN_7 // In Gen6+, moves that causes double damage to minimized Pokémon will also skip accuracy checks. -#define B_BLIZZARD_HAIL GEN_7 // In Gen4+, Blizzard bypasses accuracy checks if it's hailing. -#define B_SHEER_COLD_ACC GEN_7 // In Gen7+, Sheer Cold's base chance of hitting is reduced to 20% if the user isn't Ice-typed. +#define B_TOXIC_NEVER_MISS GEN_LATEST // In Gen6+, if Toxic is used by a Poison-type Pokémon, it will never miss. +#define B_MINIMIZE_DMG_ACC GEN_LATEST // In Gen6+, moves that causes double damage to minimized Pokémon will also skip accuracy checks. +#define B_BLIZZARD_HAIL GEN_LATEST // In Gen4+, Blizzard bypasses accuracy checks if it's hailing. +#define B_SHEER_COLD_ACC GEN_LATEST // In Gen7+, Sheer Cold's base chance of hitting is reduced to 20% if the user isn't Ice-typed. // Move stat change settings -#define B_FELL_STINGER_STAT_RAISE GEN_7 // In Gen7+, it raises Atk by 3 stages instead of 2 if it causes the target to faint. -#define B_KINGS_SHIELD_LOWER_ATK GEN_7 // In Gen7+, it lowers Atk by 1 stage instead of 2 of oponents that hit it. -#define B_SPEED_BUFFING_RAPID_SPIN GEN_8 // In Gen8, Rapid Spin raises the user's Speed by 1 stage. -#define B_CHARGE_SPDEF_RAISE GEN_7 // In Gen5+, Charge raises the user's Special Defense by 1 stage. -#define B_MINIMIZE_EVASION GEN_7 // In Gen5+, Minimize raises evasion by 2 stages instead of 1. -#define B_GROWTH_STAT_RAISE GEN_7 // In Gen5+, Growth raises Attack in addition to Special Attack by 1 stage each. Under the effects of the sun, it raises them by 2 stages each instead. +#define B_FELL_STINGER_STAT_RAISE GEN_LATEST // In Gen7+, it raises Atk by 3 stages instead of 2 if it causes the target to faint. +#define B_KINGS_SHIELD_LOWER_ATK GEN_LATEST // In Gen8+, it lowers Atk by 1 stage instead of 2 of oponents that hit it. +#define B_SPEED_BUFFING_RAPID_SPIN GEN_LATEST // In Gen8, Rapid Spin raises the user's Speed by 1 stage. +#define B_CHARGE_SPDEF_RAISE GEN_LATEST // In Gen5+, Charge raises the user's Special Defense by 1 stage. +#define B_MINIMIZE_EVASION GEN_LATEST // In Gen5+, Minimize raises evasion by 2 stages instead of 1. +#define B_GROWTH_STAT_RAISE GEN_LATEST // In Gen5+, Growth raises Attack in addition to Special Attack by 1 stage each. Under the effects of the sun, it raises them by 2 stages each instead. // Other move settings -#define B_SOUND_SUBSTITUTE GEN_7 // In Gen6+, sound moves bypass Substitute. -#define B_INCINERATE_GEMS GEN_7 // In Gen6+, Incinerate can destroy Gems. -#define B_CAN_SPITE_FAIL GEN_7 // In Gen4+, Spite can no longer fail if the foe's last move only has 1 remaining PP. -#define B_CRASH_IF_TARGET_IMMUNE GEN_7 // In Gen4+, The user of Jump Kick or High Jump Kick will "keep going and crash" if it attacks a target that is immune to the move. -#define B_MEMENTO_FAIL GEN_7 // In Gen4+, Memento fails if there is no target or if the target is protected or behind substitute. But not if Atk/Sp. Atk are at -6. -#define B_GLARE_GHOST GEN_7 // In Gen4+, Glare can hit Ghost-type Pokémon normally. -#define B_SKILL_SWAP GEN_7 // In Gen4+, Skill Swap triggers switch-in abilities after use. -#define B_BRICK_BREAK GEN_7 // In Gen4+, you can destroy your own side's screens. In Gen 5+, screens are not removed if the target is immune. -#define B_WISH_HP_SOURCE GEN_7 // In Gen5+, Wish heals half of the user's max HP instead of the target's. -#define B_RAMPAGE_CANCELLING GEN_7 // In Gen5+, a failed Thrash, etc, will cancel except on its last turn. -#define B_HEAL_BLOCKING GEN_7 // In Gen5+, Heal Block prevents healing by Black Sludge, Leftovers, Shell Bell. Affected Pokémon will not consume held HP-restoring Berries or Berry Juice. - // Draining abilities will not heal but will prevent damage. In Gen6+, Heal Block prevents the use of most HP-draining moves. -#define B_ROOTED_GROUNDING GEN_7 // In Gen4+, Ingrain causes the affected Pokémon to become grounded. +#define B_SOUND_SUBSTITUTE GEN_LATEST // In Gen6+, sound moves bypass Substitute. +#define B_INCINERATE_GEMS GEN_LATEST // In Gen6+, Incinerate can destroy Gems. +#define B_CAN_SPITE_FAIL GEN_LATEST // In Gen4+, Spite can no longer fail if the foe's last move only has 1 remaining PP. +#define B_CRASH_IF_TARGET_IMMUNE GEN_LATEST // In Gen4+, The user of Jump Kick or High Jump Kick will "keep going and crash" if it attacks a target that is immune to the move. +#define B_MEMENTO_FAIL GEN_LATEST // In Gen4+, Memento fails if there is no target or if the target is protected or behind substitute. But not if Atk/Sp. Atk are at -6. +#define B_GLARE_GHOST GEN_LATEST // In Gen4+, Glare can hit Ghost-type Pokémon normally. +#define B_SKILL_SWAP GEN_LATEST // In Gen4+, Skill Swap triggers switch-in abilities after use. +#define B_BRICK_BREAK GEN_LATEST // In Gen4+, you can destroy your own side's screens. In Gen 5+, screens are not removed if the target is immune. +#define B_WISH_HP_SOURCE GEN_LATEST // In Gen5+, Wish heals half of the user's max HP instead of the target's. +#define B_RAMPAGE_CANCELLING GEN_LATEST // In Gen5+, a failed Thrash, etc, will cancel except on its last turn. +#define B_HEAL_BLOCKING GEN_LATEST // In Gen5+, Heal Block prevents healing by Black Sludge, Leftovers, Shell Bell. Affected Pokémon will not consume held HP-restoring Berries or Berry Juice. + // Draining abilities will not heal but will prevent damage. In Gen6+, Heal Block prevents the use of most HP-draining moves. +#define B_ROOTED_GROUNDING GEN_LATEST // In Gen4+, Ingrain causes the affected Pokémon to become grounded. // Ability settings -#define B_EXPANDED_ABILITY_NAMES TRUE // If TRUE, ability names are increased from 12 characters to 16 characters. -#define B_ABILITY_WEATHER GEN_7 // In Gen6+, ability-induced weather lasts 5 turns. Before, it lasted until the battle ended or until it was changed by a move or a different weather-affecting ability. -#define B_GALE_WINGS GEN_7 // In Gen7+ requires full HP to trigger. -#define B_STANCE_CHANGE_FAIL GEN_7 // In Gen7+, Stance Change fails if the Pokémon is unable to use a move because of confusion, paralysis, etc. In Gen6, it doesn't. -#define B_SHADOW_TAG_ESCAPE GEN_7 // In Gen4+, if both sides have a Pokémon with Shadow Tag, all battlers can escape. Before, neither side could escape this situation. -#define B_MOODY_ACC_EVASION GEN_8 // In Gen8, Moody CANNOT raise Accuracy and Evasion anymore. -#define B_FLASH_FIRE_FROZEN GEN_7 // In Gen5+, Flash Fire can trigger even when frozen, when it couldn't before. -#define B_SYNCHRONIZE_NATURE GEN_8 // In Gen8, if a Pokémon with Synchronize is leading the party, it's 100% guaranteed that wild Pokémon will have the same ability, as opposed to 50% previously. -#define B_SYNCHRONIZE_TOXIC GEN_8 // In Gen5+, if a Pokémon with Synchronize is badly poisoned, the opponent will also become badly poisoned. Previously, the opponent would become regular poisoned. -#define B_UPDATED_INTIMIDATE GEN_8 // In Gen8, Intimidate doesn't work on opponents with the Inner Focus, Scrappy, Own Tempo or Oblivious abilities. It also activates Rattled. -#define B_OBLIVIOUS_TAUNT GEN_7 // In Gen6+, Pokémon with Oblivious can't be taunted. -#define B_STURDY GEN_7 // In Gen5+, Sturdy causes the Pokémon to have 1 HP remaining if another Pokémon's attack or confusion damage would have brought it from full health to 0 HP. -#define B_PLUS_MINUS_INTERACTION GEN_7 // In Gen5+, Plus and Minus can be activated with themselves and the opposite ability. Before, only the opposing ability could activate it. +#define B_EXPANDED_ABILITY_NAMES TRUE // If TRUE, ability names are increased from 12 characters to 16 characters. +#define B_ABILITY_WEATHER GEN_LATEST // In Gen6+, ability-induced weather lasts 5 turns. Before, it lasted until the battle ended or until it was changed by a move or a different weather-affecting ability. +#define B_GALE_WINGS GEN_LATEST // In Gen7+ requires full HP to trigger. +#define B_STANCE_CHANGE_FAIL GEN_LATEST // In Gen7+, Stance Change fails if the Pokémon is unable to use a move because of confusion, paralysis, etc. In Gen6, it doesn't. +#define B_SHADOW_TAG_ESCAPE GEN_LATEST // In Gen4+, if both sides have a Pokémon with Shadow Tag, all battlers can escape. Before, neither side could escape this situation. +#define B_MOODY_ACC_EVASION GEN_LATEST // In Gen8, Moody CANNOT raise Accuracy and Evasion anymore. +#define B_FLASH_FIRE_FROZEN GEN_LATEST // In Gen5+, Flash Fire can trigger even when frozen, when it couldn't before. +#define B_SYNCHRONIZE_NATURE GEN_LATEST // In Gen8, if a Pokémon with Synchronize is leading the party, it's 100% guaranteed that wild Pokémon will have the same ability, as opposed to 50% previously. +#define B_SYNCHRONIZE_TOXIC GEN_LATEST // In Gen5+, if a Pokémon with Synchronize is badly poisoned, the opponent will also become badly poisoned. Previously, the opponent would become regular poisoned. +#define B_UPDATED_INTIMIDATE GEN_LATEST // In Gen8, Intimidate doesn't work on opponents with the Inner Focus, Scrappy, Own Tempo or Oblivious abilities. It also activates Rattled. +#define B_OBLIVIOUS_TAUNT GEN_LATEST // In Gen6+, Pokémon with Oblivious can't be taunted. +#define B_STURDY GEN_LATEST // In Gen5+, Sturdy causes the Pokémon to have 1 HP remaining if another Pokémon's attack or confusion damage would have brought it from full health to 0 HP. +#define B_PLUS_MINUS_INTERACTION GEN_LATEST // In Gen5+, Plus and Minus can be activated with themselves and the opposite ability. Before, only the opposing ability could activate it. // Item settings -#define B_HP_BERRIES GEN_7 // In Gen4+, berries which restore hp activate immediately after HP drops to half. In Gen3, the effect occurs at the end of the turn. -#define B_BERRIES_INSTANT GEN_7 // In Gen4+, most berries activate on battle start/switch-in if applicable. In Gen3, they only activate either at the move end or turn end. -#define B_CONFUSE_BERRIES_HEAL GEN_8 // Before Gen7, Figy and similar berries restore 1/8th of HP and trigger at half HP. In Gen7 they restore half HP, triggering at 25% HP. In Gen8 they heal 1/3rd of HP. - // Requires using Item Expansion or manually editing the holdEffectParam of Figy, Wiki, Mago, Aguav and Iapapa berries. -#define B_X_ITEMS_BUFF GEN_7 // In Gen7+, the X Items raise a stat by 2 stages instead of 1. -#define B_MENTAL_HERB GEN_5 // In Gen5+, the Mental Herb cures Infatuation, Taunt, Encore, Torment, Heal Block, and Disable -#define B_TRAINERS_KNOCK_OFF_ITEMS TRUE // If TRUE, trainers can steal/swap your items (non-berries are restored after battle). In vanilla games trainers cannot steal items. -#define B_SOUL_DEW_BOOST GEN_7 // In Gens3-6, Soul Dew boosts Lati@s' Sp. Atk and Sp. Def. In Gen7+ it boosts the power of their Psychic and Dragon type moves instead. -#define B_NET_BALL_MODIFIER GEN_7 // In Gen7+, Net Ball's catch multiplier is x5 instead of x3. -#define B_DIVE_BALL_MODIFIER GEN_7 // In Gen4+, Dive Ball's effectiveness increases by when Surfing or Fishing. -#define B_NEST_BALL_MODIFIER GEN_7 // Nest Ball's formula varies depending on the Gen. See Cmd_handleballthrow. -#define B_REPEAT_BALL_MODIFIER GEN_7 // In Gen7+, Repeat Ball's catch multiplier is x3.5 instead of x3. -#define B_TIMER_BALL_MODIFIER GEN_7 // In Gen5+, Timer Ball's effectiveness increases by x0.3 per turn instead of x0.1 -#define B_DUSK_BALL_MODIFIER GEN_7 // In Gen7+, Dusk Ball's catch multiplier is x3 instead of x3.5. -#define B_QUICK_BALL_MODIFIER GEN_7 // In Gen5+, Quick Ball's catch multiplier is x5 instead of x4. -#define B_LURE_BALL_MODIFIER GEN_7 // In Gen7+, Lure Ball's catch multiplier is x5 instead of x3. -#define B_HEAVY_BALL_MODIFIER GEN_7 // In Gen7+, Heavy Ball's ranges change. See Cmd_handleballthrow. -#define B_DREAM_BALL_MODIFIER GEN_8 // In Gen8, Dream Ball's catch multiplier is x4 when the target is asleep or has the ability Comatose. -#define B_SPORT_BALL_MODIFIER GEN_8 // In Gen8, Sport Ball's catch multiplier was reduced from x1.5 to x1. -#define B_SERENE_GRACE_BOOST GEN_7 // In Gen5+, Serene Grace boosts the added flinch chance of King's Rock and Razor Fang. +#define B_HP_BERRIES GEN_LATEST // In Gen4+, berries which restore hp activate immediately after HP drops to half. In Gen3, the effect occurs at the end of the turn. +#define B_BERRIES_INSTANT GEN_LATEST // In Gen4+, most berries activate on battle start/switch-in if applicable. In Gen3, they only activate either at the move end or turn end. +#define B_CONFUSE_BERRIES_HEAL GEN_LATEST // Before Gen7, Figy and similar berries restore 1/8th of HP and trigger at half HP. In Gen7 they restore half HP, triggering at 25% HP. In Gen8 they heal 1/3rd of HP. +#define B_X_ITEMS_BUFF GEN_LATEST // In Gen7+, the X Items raise a stat by 2 stages instead of 1. +#define B_MENTAL_HERB GEN_LATEST // In Gen5+, the Mental Herb cures Taunt, Encore, Torment, Heal Block, and Disable in addition to Infatuation from before. +#define B_TRAINERS_KNOCK_OFF_ITEMS TRUE // If TRUE, trainers can steal/swap your items (non-berries are restored after battle). In vanilla games trainers cannot steal items. +#define B_SOUL_DEW_BOOST GEN_LATEST // In Gens3-6, Soul Dew boosts Lati@s' Sp. Atk and Sp. Def. In Gen7+ it boosts the power of their Psychic and Dragon type moves instead. +#define B_NET_BALL_MODIFIER GEN_LATEST // In Gen7+, Net Ball's catch multiplier is x5 instead of x3. +#define B_DIVE_BALL_MODIFIER GEN_LATEST // In Gen4+, Dive Ball's effectiveness increases by when Surfing or Fishing. +#define B_NEST_BALL_MODIFIER GEN_LATEST // Nest Ball's formula varies depending on the Gen. See Cmd_handleballthrow. +#define B_REPEAT_BALL_MODIFIER GEN_LATEST // In Gen7+, Repeat Ball's catch multiplier is x3.5 instead of x3. +#define B_TIMER_BALL_MODIFIER GEN_LATEST // In Gen5+, Timer Ball's effectiveness increases by x0.3 per turn instead of x0.1 +#define B_DUSK_BALL_MODIFIER GEN_LATEST // In Gen7+, Dusk Ball's catch multiplier is x3 instead of x3.5. +#define B_QUICK_BALL_MODIFIER GEN_LATEST // In Gen5+, Quick Ball's catch multiplier is x5 instead of x4. +#define B_LURE_BALL_MODIFIER GEN_LATEST // In Gen7+, Lure Ball's catch multiplier is x5 instead of x3. +#define B_HEAVY_BALL_MODIFIER GEN_LATEST // In Gen7+, Heavy Ball's ranges change. See Cmd_handleballthrow. +#define B_DREAM_BALL_MODIFIER GEN_LATEST // In Gen8, Dream Ball's catch multiplier is x4 when the target is asleep or has the ability Comatose. +#define B_SPORT_BALL_MODIFIER GEN_LATEST // In Gen8, Sport Ball's catch multiplier was reduced from x1.5 to x1. +#define B_SERENE_GRACE_BOOST GEN_LATEST // In Gen5+, Serene Grace boosts the added flinch chance of King's Rock and Razor Fang. // Flag settings // To use the following features in scripting, replace the 0s with the flag ID you're assigning it to. @@ -147,13 +137,13 @@ #define B_VAR_WILD_AI_FLAGS 0 // If not 0, you can use this var to add to default wild AI flags. NOT usable with flags above (1 << 15) // Terrain settings -#define B_TERRAIN_BG_CHANGE TRUE // If set to TRUE, terrain moves permanently change the default battle background until the effect fades. -#define B_THUNDERSTORM_TERRAIN TRUE // If TRUE, overworld Thunderstorm generates Rain and Electric Terrain as in Gen 8. -#define B_TERRAIN_TYPE_BOOST GEN_8 // In Gen8, damage is boosted by 30% instead of 50%. -#define B_SECRET_POWER_EFFECT GEN_7 // Secret Power's effects change depending on terrain and generation. See GetSecretPowerMoveEffect. -#define B_SECRET_POWER_ANIMATION GEN_7 // Secret Power's animations change depending on terrain and generation. -#define B_NATURE_POWER_MOVES GEN_8 // Nature Power calls different moves depending on terrain and generation. See sNaturePowerMoves. -#define B_CAMOUFLAGE_TYPES GEN_7 // Camouflage changes the user to different types depending on terrain and generation. See sTerrainToType. +#define B_TERRAIN_BG_CHANGE TRUE // If set to TRUE, terrain moves permanently change the default battle background until the effect fades. +#define B_THUNDERSTORM_TERRAIN TRUE // If TRUE, overworld Thunderstorm generates Rain and Electric Terrain as in Gen 8. +#define B_TERRAIN_TYPE_BOOST GEN_LATEST // In Gen8, damage is boosted by 30% instead of 50%. +#define B_SECRET_POWER_EFFECT GEN_LATEST // Secret Power's effects change depending on terrain and generation. See GetSecretPowerMoveEffect. +#define B_SECRET_POWER_ANIMATION GEN_LATEST // Secret Power's animations change depending on terrain and generation. +#define B_NATURE_POWER_MOVES GEN_LATEST // Nature Power calls different moves depending on terrain and generation. See sNaturePowerMoves. +#define B_CAMOUFLAGE_TYPES GEN_LATEST // Camouflage changes the user to different types depending on terrain and generation. See sTerrainToType. // Interface settings #define B_ABILITY_POP_UP TRUE // In Gen5+, the Pokémon abilities are displayed in a pop-up, when they activate in battle. @@ -165,18 +155,18 @@ #define B_EXPANDED_MOVE_NAMES FALSE // If set to TRUE, move names are increased from 12 characters to 16 characters. // Catching settings -#define B_SEMI_INVULNERABLE_CATCH GEN_7 // In Gen4+, you cannot throw a ball against a Pokemon that is in a semi-invulnerable state (dig/fly/etc) -#define B_CATCHING_CHARM_BOOST 20 // % boost in Critical Capture odds if player has the Catching Charm. -#define B_CRITICAL_CAPTURE TRUE // If set to TRUE, Critical Capture will be enabled. -#define B_LAST_USED_BALL TRUE // If TRUE, the "last used ball" feature from Gen 7 will be implemented -#define B_LAST_USED_BALL_BUTTON R_BUTTON // If last used ball is implemented, this button (or button combo) will trigger throwing the last used ball. +#define B_SEMI_INVULNERABLE_CATCH GEN_LATEST // In Gen4+, you cannot throw a ball against a Pokemon that is in a semi-invulnerable state (dig/fly/etc) +#define B_CATCHING_CHARM_BOOST 20 // % boost in Critical Capture odds if player has the Catching Charm. +#define B_CRITICAL_CAPTURE TRUE // If set to TRUE, Critical Capture will be enabled. +#define B_LAST_USED_BALL TRUE // If TRUE, the "last used ball" feature from Gen 7 will be implemented +#define B_LAST_USED_BALL_BUTTON R_BUTTON // If last used ball is implemented, this button (or button combo) will trigger throwing the last used ball. // Other settings -#define B_DOUBLE_WILD_CHANCE 0 // % chance of encountering two Pokémon in a Wild Encounter. -#define B_MULTI_BATTLE_WHITEOUT GEN_8 // In Gen4+, multi battles end when the Player and also their Partner don't have any more Pokémon to fight. -#define B_EVOLUTION_AFTER_WHITEOUT GEN_6 // In Gen6+, Pokemon that qualify for evolution after battle will evolve even if the player loses. -#define B_WILD_NATURAL_ENEMIES TRUE // If set to TRUE, certain wild mon species will attack other species when partnered in double wild battles (eg. Zangoose vs Seviper) -#define B_AFFECTION_MECHANICS FALSE // In Gen6+, there's a stat called affection that can trigger different effects in battle. From LGPE onwards, those effects use friendship instead. +#define B_DOUBLE_WILD_CHANCE 0 // % chance of encountering two Pokémon in a Wild Encounter. +#define B_MULTI_BATTLE_WHITEOUT GEN_LATEST // In Gen4+, multi battles end when the Player and also their Partner don't have any more Pokémon to fight. +#define B_EVOLUTION_AFTER_WHITEOUT GEN_LATEST // In Gen6+, Pokemon that qualify for evolution after battle will evolve even if the player loses. +#define B_WILD_NATURAL_ENEMIES TRUE // If set to TRUE, certain wild mon species will attack other species when partnered in double wild battles (eg. Zangoose vs Seviper) +#define B_AFFECTION_MECHANICS FALSE // In Gen6+, there's a stat called affection that can trigger different effects in battle. From LGPE onwards, those effects use friendship instead. // Animation Settings #define B_NEW_SWORD_PARTICLE FALSE // If set to TRUE, it updates Swords Dance's particle. diff --git a/include/constants/item_config.h b/include/constants/item_config.h index 70b4440c8431..9261241a5fc1 100644 --- a/include/constants/item_config.h +++ b/include/constants/item_config.h @@ -1,21 +1,12 @@ #ifndef GUARD_CONSTANTS_ITEM_CONFIG_H #define GUARD_CONSTANTS_ITEM_CONFIG_H -#ifndef GEN_3 -#define GEN_3 0 -#define GEN_4 1 -#define GEN_5 2 -#define GEN_6 3 -#define GEN_7 4 -#define GEN_8 5 -#endif - // Item config -#define I_SHINY_CHARM_REROLLS 3 // Amount of re-rolls if the player has the Shiny Charm. Set to 0 to disable Shiny Charm's effects. -#define I_KEY_FOSSILS GEN_7 // In Gen4+, all Gen 3 fossils became regular items. -#define I_KEY_ESCAPE_ROPE GEN_7 // In Gen8, Escape Rope became a Key Item. Keep in mind, this will make it free to buy in marts. -#define I_HEALTH_RECOVERY GEN_7 // In Gen7+, certain healing items recover a different amount of HP than they used to. -#define I_SITRUS_BERRY_HEAL GEN_7 // In Gen4+, Sitrus Berry was changed from healing 30 HP to healing 25% of Max HP. -#define I_VITAMIN_EV_CAP GEN_8 // In Gen8, the Vitamins no longer have a cap of 100 EV per stat. +#define I_SHINY_CHARM_REROLLS 3 // Amount of re-rolls if the player has the Shiny Charm. Set to 0 to disable Shiny Charm's effects. +#define I_KEY_FOSSILS GEN_LATEST // In Gen4+, all Gen 3 fossils became regular items. +#define I_KEY_ESCAPE_ROPE GEN_LATEST // In Gen8, Escape Rope became a Key Item. Keep in mind, this will make it free to buy in marts. +#define I_HEALTH_RECOVERY GEN_LATEST // In Gen7+, certain healing items recover a different amount of HP than they used to. +#define I_SITRUS_BERRY_HEAL GEN_LATEST // In Gen4+, Sitrus Berry was changed from healing 30 HP to healing 25% of Max HP. +#define I_VITAMIN_EV_CAP GEN_LATEST // In Gen8, the Vitamins no longer have a cap of 100 EV per stat. #endif // GUARD_CONSTANTS_ITEM_CONFIG_H diff --git a/include/constants/pokemon_config.h b/include/constants/pokemon_config.h index 879b7556414e..40acd8c808a6 100644 --- a/include/constants/pokemon_config.h +++ b/include/constants/pokemon_config.h @@ -1,26 +1,17 @@ #ifndef GUARD_CONSTANTS_POKEMON_CONFIG_H #define GUARD_CONSTANTS_POKEMON_CONFIG_H -#ifndef GEN_3 -#define GEN_3 0 -#define GEN_4 1 -#define GEN_5 2 -#define GEN_6 3 -#define GEN_7 4 -#define GEN_8 5 -#endif +#define P_UPDATED_TYPES GEN_LATEST // Since Gen 6, several Pokémon were changed to be partially or fully Fairy type. +#define P_UPDATED_STATS GEN_LATEST // Since Gen 6, Pokémon stats are updated with each passing generation. +#define P_UPDATED_ABILITIES GEN_LATEST // Since Gen 6, certain Pokémon have their abilities changed. +#define P_UPDATED_EGG_GROUPS GEN_LATEST // Since Gen 8, certain Pokémon have gained new egg groups. +#define P_SHEDINJA_BALL GEN_LATEST // Since Gen 4, Shedinja requires a Poké Ball for its evolution. In Gen 3, Shedinja inherits Nincada's Ball. +#define P_LEGENDARY_PERFECT_IVS GEN_LATEST // Since Gen 6, Legendaries, Mythicals and Ultra Beasts found in the wild or given through gifts have at least 3 perfect IVs. +#define P_KADABRA_EVERSTONE GEN_LATEST // Since Gen 4, Kadabra can evolve even when holding an Everstone. +#define P_NIDORAN_M_DITTO_BREED GEN_LATEST // Since Gen 5, when Nidoran♂ breeds with Ditto it can produce Nidoran♀ offspring. Before, it would only yield male offspring. This change also applies to Volbeat. -#define P_UPDATED_TYPES GEN_8 // Since Gen 6, several Pokémon were changed to be partially or fully Fairy type. -#define P_UPDATED_STATS GEN_8 // Since Gen 6, Pokémon stats are updated with each passing generation. -#define P_UPDATED_ABILITIES GEN_8 // Since Gen 6, certain Pokémon have their abilities changed. -#define P_UPDATED_EGG_GROUPS GEN_8 // Since Gen 8, certain Pokémon have gained new egg groups. -#define P_SHEDINJA_BALL GEN_8 // Since Gen 4, Shedinja requires a Poké Ball for its evolution. In Gen 3, Shedinja inherits Nincada's Ball. -#define P_LEGENDARY_PERFECT_IVS GEN_8 // Since Gen 6, Legendaries, Mythicals and Ultra Beasts found in the wild or given through gifts have at least 3 perfect IVs. -#define P_KADABRA_EVERSTONE GEN_8 // Since Gen 4, Kadabra can evolve even when holding an Everstone. -#define P_NIDORAN_M_DITTO_BREED GEN_8 // Since Gen 5, when Nidoran♂ breeds with Ditto it can produce Nidoran♀ offspring. Before, it would only yield male offspring. This change also applies to Volbeat. +#define P_NEW_POKEMON TRUE // Turning this to FALSE will remove all newly added Pokémon and Forms. Only Unown, Castform and Deoxys forms will remain. -#define P_NEW_POKEMON TRUE // Turning this to FALSE will remove all newly added Pokémon and Forms. Only Unown, Castform and Deoxys forms will remain. - -#define P_ENABLE_DEBUG TRUE // Enables a debug menu for pokemon sprites and icons, accessed by pressing SELECT in the summary screen. +#define P_ENABLE_DEBUG TRUE // Enables a debug menu for pokemon sprites and icons, accessed by pressing SELECT in the summary screen. #endif // GUARD_CONSTANTS_POKEMON_CONFIG_H diff --git a/src/battle_ai_main.c b/src/battle_ai_main.c index 9901abbd9673..312ff853cac7 100644 --- a/src/battle_ai_main.c +++ b/src/battle_ai_main.c @@ -142,8 +142,10 @@ static u32 GetWildAiFlags(void) if (avgLevel >= 80) flags |= AI_FLAG_HP_AWARE; - if (B_VAR_WILD_AI_FLAGS != 0 && VarGet(B_VAR_WILD_AI_FLAGS) != 0) +#if B_VAR_WILD_AI_FLAGS != 0 + if (VarGet(B_VAR_WILD_AI_FLAGS) != 0) flags |= VarGet(B_VAR_WILD_AI_FLAGS); +#endif return flags; } @@ -1273,10 +1275,10 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) score -= 10; break; case EFFECT_OHKO: - if (B_SHEER_COLD_IMMUNITY >= GEN_7 - && move == MOVE_SHEER_COLD - && IS_BATTLER_OF_TYPE(battlerDef, TYPE_ICE)) + #if B_SHEER_COLD_IMMUNITY >= GEN_7 + if (move == MOVE_SHEER_COLD && IS_BATTLER_OF_TYPE(battlerDef, TYPE_ICE)) return 0; + #endif if (!ShouldTryOHKO(battlerAtk, battlerDef, AI_DATA->abilities[battlerAtk], AI_DATA->abilities[battlerDef], move)) score -= 10; break; @@ -1304,8 +1306,10 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) score -= 8; else if (AI_DATA->hpPercents[battlerAtk] <= 25) score -= 10; - else if (B_SOUND_SUBSTITUTE >= GEN_6 && TestMoveFlagsInMoveset(battlerDef, FLAG_SOUND)) + #if B_SOUND_SUBSTITUTE >= GEN_6 + else if (TestMoveFlagsInMoveset(battlerDef, FLAG_SOUND)) score -= 8; + #endif break; case EFFECT_LEECH_SEED: if (gStatuses3[battlerDef] & STATUS3_LEECHSEED @@ -1317,8 +1321,10 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) break; case EFFECT_DISABLE: if (gDisableStructs[battlerDef].disableTimer == 0 - && (B_MENTAL_HERB >= GEN_5 && AI_DATA->holdEffects[battlerDef] != HOLD_EFFECT_MENTAL_HERB) - && !PartnerHasSameMoveEffectWithoutTarget(BATTLE_PARTNER(battlerAtk), move, AI_DATA->partnerMove)) + #if B_MENTAL_HERB >= GEN_5 + && AI_DATA->holdEffects[battlerDef] != HOLD_EFFECT_MENTAL_HERB + #endif + && !PartnerHasSameMoveEffectWithoutTarget(BATTLE_PARTNER(battlerAtk), move, AI_DATA->partnerMove)) { if (AI_WhoStrikesFirst(battlerAtk, battlerDef, move) == AI_IS_FASTER) // Attacker should go first { @@ -1337,8 +1343,10 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) break; case EFFECT_ENCORE: if (gDisableStructs[battlerDef].encoreTimer == 0 - && (B_MENTAL_HERB >= GEN_5 && AI_DATA->holdEffects[battlerDef] != HOLD_EFFECT_MENTAL_HERB) - && !DoesPartnerHaveSameMoveEffect(BATTLE_PARTNER(battlerAtk), battlerDef, move, AI_DATA->partnerMove)) + #if B_MENTAL_HERB >= GEN_5 + && AI_DATA->holdEffects[battlerDef] != HOLD_EFFECT_MENTAL_HERB + #endif + && !DoesPartnerHaveSameMoveEffect(BATTLE_PARTNER(battlerAtk), battlerDef, move, AI_DATA->partnerMove)) { if (AI_WhoStrikesFirst(battlerAtk, battlerDef, move) == AI_IS_FASTER) // Attacker should go first { @@ -1570,9 +1578,10 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) score -= 10; break; } - - if (B_MENTAL_HERB >= GEN_5 && AI_DATA->holdEffects[battlerDef] == HOLD_EFFECT_MENTAL_HERB) + #if B_MENTAL_HERB >= GEN_5 + if (AI_DATA->holdEffects[battlerDef] == HOLD_EFFECT_MENTAL_HERB) score -= 6; + #endif break; case EFFECT_WILL_O_WISP: if (!AI_CanBurn(battlerAtk, battlerDef, AI_DATA->abilities[battlerDef], BATTLE_PARTNER(battlerAtk), move, AI_DATA->partnerMove)) @@ -3545,7 +3554,10 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) break; case EFFECT_DISABLE: if (gDisableStructs[battlerDef].disableTimer == 0 - && (B_MENTAL_HERB >= GEN_5 && AI_DATA->holdEffects[battlerDef] != HOLD_EFFECT_MENTAL_HERB)) // mental herb + #if B_MENTAL_HERB >= GEN_5 + && AI_DATA->holdEffects[battlerDef] != HOLD_EFFECT_MENTAL_HERB // mental herb + #endif + ) { if (AI_WhoStrikesFirst(battlerAtk, battlerDef, move) == AI_IS_FASTER) // AI goes first { @@ -3567,7 +3579,10 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) break; case EFFECT_ENCORE: if (gDisableStructs[battlerDef].encoreTimer == 0 - && (B_MENTAL_HERB >= GEN_5 && AI_DATA->holdEffects[battlerDef] != HOLD_EFFECT_MENTAL_HERB)) // mental herb + #if B_MENTAL_HERB >= GEN_5 + && AI_DATA->holdEffects[battlerDef] != HOLD_EFFECT_MENTAL_HERB // mental herb + #endif + ) { if (IsEncoreEncouragedEffect(gBattleMoves[gLastMoves[battlerDef]].effect)) score += 3; @@ -3616,7 +3631,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) { bool32 canSteal = FALSE; - #if defined B_TRAINERS_KNOCK_OFF_ITEMS && B_TRAINERS_KNOCK_OFF_ITEMS == TRUE + #if B_TRAINERS_KNOCK_OFF_ITEMS == TRUE canSteal = TRUE; #endif if (gBattleTypeFlags & BATTLE_TYPE_FRONTIER || GetBattlerSide(battlerAtk) == B_SIDE_PLAYER) diff --git a/src/battle_ai_util.c b/src/battle_ai_util.c index 98fcf948a305..75964664e33d 100644 --- a/src/battle_ai_util.c +++ b/src/battle_ai_util.c @@ -600,21 +600,25 @@ bool32 AtMaxHp(u8 battlerId) bool32 IsBattlerTrapped(u8 battler, bool8 checkSwitch) { u8 holdEffect = AI_DATA->holdEffects[battler]; - if ((B_GHOSTS_ESCAPE >= GEN_6 && IS_BATTLER_OF_TYPE(battler, TYPE_GHOST)) - || (checkSwitch && holdEffect == HOLD_EFFECT_SHED_SHELL) - || (!checkSwitch && GetBattlerAbility(battler) == ABILITY_RUN_AWAY) - || (!checkSwitch && holdEffect == HOLD_EFFECT_CAN_ALWAYS_RUN)) - { + +#if B_GHOSTS_ESCAPE >= GEN_6 + if (IS_BATTLER_OF_TYPE(battler, TYPE_GHOST)) return FALSE; - } - else - { - if (gBattleMons[battler].status2 & (STATUS2_ESCAPE_PREVENTION | STATUS2_WRAPPED) - || IsAbilityPreventingEscape(battler) - || gStatuses3[battler] & (STATUS3_ROOTED | STATUS3_SKY_DROPPED) - || (gFieldStatuses & STATUS_FIELD_FAIRY_LOCK)) - return TRUE; - } +#endif + if (checkSwitch && holdEffect == HOLD_EFFECT_SHED_SHELL) + return FALSE; + else if (!checkSwitch && GetBattlerAbility(battler) == ABILITY_RUN_AWAY) + return FALSE; + else if (!checkSwitch && holdEffect == HOLD_EFFECT_CAN_ALWAYS_RUN) + return FALSE; + else if (gBattleMons[battler].status2 & (STATUS2_ESCAPE_PREVENTION | STATUS2_WRAPPED)) + return TRUE; + else if (gStatuses3[battler] & (STATUS3_ROOTED | STATUS3_SKY_DROPPED)) + return TRUE; + else if (gFieldStatuses & STATUS_FIELD_FAIRY_LOCK) + return TRUE; + else if (IsAbilityPreventingEscape(battler)) + return TRUE; return FALSE; } @@ -647,9 +651,11 @@ bool32 IsTruantMonVulnerable(u32 battlerAI, u32 opposingBattler) // move checks bool32 IsAffectedByPowder(u8 battler, u16 ability, u16 holdEffect) { - if ((B_POWDER_GRASS >= GEN_6 && IS_BATTLER_OF_TYPE(battler, TYPE_GRASS)) - || ability == ABILITY_OVERCOAT - || holdEffect == HOLD_EFFECT_SAFETY_GOGGLES) + if (ability == ABILITY_OVERCOAT + #if B_POWDER_GRASS >= GEN_6 + || IS_BATTLER_OF_TYPE(battler, TYPE_GRASS) + #endif + || holdEffect == HOLD_EFFECT_SAFETY_GOGGLES) return FALSE; return TRUE; } @@ -1415,8 +1421,10 @@ bool32 IsMoveEncouragedToHit(u8 battlerAtk, u8 battlerDef, u16 move) if (AI_DATA->abilities[battlerDef] == ABILITY_NO_GUARD || AI_DATA->abilities[battlerAtk] == ABILITY_NO_GUARD) return TRUE; - if (B_TOXIC_NEVER_MISS >= GEN_6 && gBattleMoves[move].effect == EFFECT_TOXIC && IS_BATTLER_OF_TYPE(battlerAtk, TYPE_POISON)) +#if B_TOXIC_NEVER_MISS >= GEN_6 + if (gBattleMoves[move].effect == EFFECT_TOXIC && IS_BATTLER_OF_TYPE(battlerAtk, TYPE_POISON)) return TRUE; +#endif // discouraged from hitting if (AI_WeatherHasEffect() && (gBattleWeather & B_WEATHER_SUN) @@ -1426,10 +1434,12 @@ bool32 IsMoveEncouragedToHit(u8 battlerAtk, u8 battlerDef, u16 move) // increased accuracy but don't always hit if ((AI_WeatherHasEffect() && (((gBattleWeather & B_WEATHER_RAIN) && (gBattleMoves[move].effect == EFFECT_THUNDER || gBattleMoves[move].effect == EFFECT_HURRICANE)) - || (((gBattleWeather & B_WEATHER_HAIL) && move == MOVE_BLIZZARD)))) - || (gBattleMoves[move].effect == EFFECT_VITAL_THROW) - || (gBattleMoves[move].accuracy == 0) - || ((B_MINIMIZE_DMG_ACC >= GEN_6) && (gStatuses3[battlerDef] & STATUS3_MINIMIZED) && (gBattleMoves[move].flags & FLAG_DMG_MINIMIZE))) + || (((gBattleWeather & B_WEATHER_HAIL) && move == MOVE_BLIZZARD)))) + || (gBattleMoves[move].effect == EFFECT_VITAL_THROW) + #if B_MINIMIZE_DMG_ACC >= GEN_6 + || ((gStatuses3[battlerDef] & STATUS3_MINIMIZED) && (gBattleMoves[move].flags & FLAG_DMG_MINIMIZE)) + #endif + || (gBattleMoves[move].accuracy == 0)) { return TRUE; } @@ -1461,10 +1471,10 @@ bool32 ShouldTryOHKO(u8 battlerAtk, u8 battlerDef, u16 atkAbility, u16 defAbilit else // test the odds { u16 odds = accuracy + (gBattleMons[battlerAtk].level - gBattleMons[battlerDef].level); - #if B_SHEER_COLD_ACC >= GEN_7 - if (gCurrentMove == MOVE_SHEER_COLD && !IS_BATTLER_OF_TYPE(gBattlerAttacker, TYPE_ICE)) - odds -= 10; - #endif + #if B_SHEER_COLD_ACC >= GEN_7 + if (gCurrentMove == MOVE_SHEER_COLD && !IS_BATTLER_OF_TYPE(gBattlerAttacker, TYPE_ICE)) + odds -= 10; + #endif if (Random() % 100 + 1 < odds && gBattleMons[battlerAtk].level >= gBattleMons[battlerDef].level) return TRUE; } @@ -2240,10 +2250,15 @@ static u32 GetTrapDamage(u8 battlerId) if (gBattleMons[battlerId].status2 & STATUS2_WRAPPED) { if (holdEffect == HOLD_EFFECT_BINDING_BAND) - damage = gBattleMons[battlerId].maxHP / (B_BINDING_DAMAGE >= GEN_6) ? 6 : 8; + #if B_BINDING_DAMAGE >= GEN_6 + damage = gBattleMons[battlerId].maxHP / 6; else - damage = gBattleMons[battlerId].maxHP / (B_BINDING_DAMAGE >= GEN_6) ? 8 : 16; - + damage = gBattleMons[battlerId].maxHP / 8; + #else + damage = gBattleMons[battlerId].maxHP / 8; + else + damage = gBattleMons[battlerId].maxHP / 16; + #endif if (damage == 0) damage = 1; } @@ -2462,14 +2477,22 @@ bool32 ShouldPivot(u8 battlerAtk, u8 battlerDef, u16 defAbility, u16 move, u8 mo return PIVOT; // Won't get the two turns, pivot if (!IS_MOVE_STATUS(move) && (shouldSwitch - || (AtMaxHp(battlerDef) && (AI_DATA->holdEffects[battlerDef] == HOLD_EFFECT_FOCUS_SASH - || (defAbility == ABILITY_STURDY && B_STURDY >= GEN_5) || defAbility == ABILITY_MULTISCALE || defAbility == ABILITY_SHADOW_SHIELD)))) + || (AtMaxHp(battlerDef) && (AI_DATA->holdEffects[battlerDef] == HOLD_EFFECT_FOCUS_SASH + #if B_STURDY >= GEN_5 + || defAbility == ABILITY_STURDY + #endif + || defAbility == ABILITY_MULTISCALE + || defAbility == ABILITY_SHADOW_SHIELD)))) return PIVOT; // pivot to break sash/sturdy/multiscale } else if (!hasStatBoost) { if (!IS_MOVE_STATUS(move) && (AtMaxHp(battlerDef) && (AI_DATA->holdEffects[battlerDef] == HOLD_EFFECT_FOCUS_SASH - || (defAbility == ABILITY_STURDY && B_STURDY >= GEN_5) || defAbility == ABILITY_MULTISCALE || defAbility == ABILITY_SHADOW_SHIELD))) + #if B_STURDY >= GEN_5 + || (defAbility == ABILITY_STURDY) + #endif + || defAbility == ABILITY_MULTISCALE + || defAbility == ABILITY_SHADOW_SHIELD))) return PIVOT; // pivot to break sash/sturdy/multiscale if (shouldSwitch) @@ -2608,7 +2631,7 @@ bool32 CanKnockOffItem(u8 battler, u16 item) | BATTLE_TYPE_LINK | BATTLE_TYPE_RECORDED_LINK | BATTLE_TYPE_SECRET_BASE - #if defined B_TRAINERS_KNOCK_OFF_ITEMS + #if B_TRAINERS_KNOCK_OFF_ITEMS == TRUE | BATTLE_TYPE_TRAINER #endif )) && GetBattlerSide(battler) == B_SIDE_PLAYER) diff --git a/src/battle_anim.c b/src/battle_anim.c index f50b7e488fcc..2806160149ae 100644 --- a/src/battle_anim.c +++ b/src/battle_anim.c @@ -1266,10 +1266,10 @@ static void LoadDefaultBg(void) { if (IsContest()) LoadContestBgAfterMoveAnim(); - #if B_TERRAIN_BG_CHANGE == TRUE +#if B_TERRAIN_BG_CHANGE == TRUE else if (gFieldStatuses & STATUS_FIELD_TERRAIN_ANY) DrawTerrainTypeBattleBackground(); - #endif +#endif else DrawMainBattleBackground(); } diff --git a/src/battle_bg.c b/src/battle_bg.c index db6be8272db0..5ea08c97cc69 100644 --- a/src/battle_bg.c +++ b/src/battle_bg.c @@ -870,11 +870,11 @@ void LoadBattleTextboxAndBackground(void) CopyBgTilemapBufferToVram(0); LoadCompressedPalette(gBattleTextboxPalette, 0, 0x40); LoadBattleMenuWindowGfx(); - #if B_TERRAIN_BG_CHANGE == TRUE - DrawTerrainTypeBattleBackground(); - #else - DrawMainBattleBackground(); - #endif +#if B_TERRAIN_BG_CHANGE == TRUE + DrawTerrainTypeBattleBackground(); +#else + DrawMainBattleBackground(); +#endif } static void DrawLinkBattleParticipantPokeballs(u8 taskId, u8 multiplayerId, u8 bgId, u8 destX, u8 destY) diff --git a/src/battle_controller_opponent.c b/src/battle_controller_opponent.c index 8f02fb3e35aa..5e21232d9b15 100644 --- a/src/battle_controller_opponent.c +++ b/src/battle_controller_opponent.c @@ -1618,7 +1618,7 @@ static void OpponentHandleChooseMove(void) target = GetBattlerAtPosition(Random() & 2); } while (!CanTargetBattler(gActiveBattler, target, move)); - #if B_WILD_NATURAL_ENEMIES == TRUE + #if B_WILD_NATURAL_ENEMIES == TRUE // Don't bother to loop through table if the move can't attack ally if (!(gBattleMoves[move].target & MOVE_TARGET_BOTH)) { @@ -1650,7 +1650,7 @@ static void OpponentHandleChooseMove(void) BtlController_EmitTwoReturnValues(BUFFER_B, 10, (chosenMoveId) | (target << 8)); } else - #endif + #endif BtlController_EmitTwoReturnValues(BUFFER_B, 10, (chosenMoveId) | (target << 8)); } else diff --git a/src/battle_controller_player.c b/src/battle_controller_player.c index d95d72e55f5f..6e9cdcc25a9d 100644 --- a/src/battle_controller_player.c +++ b/src/battle_controller_player.c @@ -330,12 +330,14 @@ static void HandleInputChooseAction(void) { SwapHpBarsWithHpText(); } - else if (B_ENABLE_DEBUG && gMain.newKeys & SELECT_BUTTON) +#if B_ENABLE_DEBUG == TRUE + else if (gMain.newKeys & SELECT_BUTTON) { BtlController_EmitTwoReturnValues(BUFFER_B, B_ACTION_DEBUG, 0); PlayerBufferExecCompleted(); } - #if B_LAST_USED_BALL == TRUE +#endif +#if B_LAST_USED_BALL == TRUE else if (JOY_NEW(B_LAST_USED_BALL_BUTTON) && CanThrowLastUsedBall()) { PlaySE(SE_SELECT); @@ -343,7 +345,7 @@ static void HandleInputChooseAction(void) BtlController_EmitTwoReturnValues(BUFFER_B, B_ACTION_THROW_BALL, 0); PlayerBufferExecCompleted(); } - #endif +#endif } static void UnusedEndBounceEffect(void) @@ -652,26 +654,25 @@ static void HandleInputChooseMove(void) canSelectTarget = 0; } + #if B_SHOW_TARGETS == TRUE // Show all available targets for multi-target moves - if (B_SHOW_TARGETS) + if ((moveTarget & MOVE_TARGET_ALL_BATTLERS) == MOVE_TARGET_ALL_BATTLERS) { - if ((moveTarget & MOVE_TARGET_ALL_BATTLERS) == MOVE_TARGET_ALL_BATTLERS) - { - u32 i = 0; - for (i = 0; i < gBattlersCount; i++) - TryShowAsTarget(i); + u32 i = 0; + for (i = 0; i < gBattlersCount; i++) + TryShowAsTarget(i); - canSelectTarget = 3; - } - else if (moveTarget & (MOVE_TARGET_OPPONENTS_FIELD | MOVE_TARGET_BOTH | MOVE_TARGET_FOES_AND_ALLY)) - { - TryShowAsTarget(gMultiUsePlayerCursor); - TryShowAsTarget(BATTLE_PARTNER(gMultiUsePlayerCursor)); - if (moveTarget & MOVE_TARGET_FOES_AND_ALLY) - TryShowAsTarget(BATTLE_PARTNER(gActiveBattler)); - canSelectTarget = 2; - } + canSelectTarget = 3; + } + else if (moveTarget & (MOVE_TARGET_OPPONENTS_FIELD | MOVE_TARGET_BOTH | MOVE_TARGET_FOES_AND_ALLY)) + { + TryShowAsTarget(gMultiUsePlayerCursor); + TryShowAsTarget(BATTLE_PARTNER(gMultiUsePlayerCursor)); + if (moveTarget & MOVE_TARGET_FOES_AND_ALLY) + TryShowAsTarget(BATTLE_PARTNER(gActiveBattler)); + canSelectTarget = 2; } + #endif } switch (canSelectTarget) diff --git a/src/battle_interface.c b/src/battle_interface.c index 545808fb5c4f..5be969105f11 100644 --- a/src/battle_interface.c +++ b/src/battle_interface.c @@ -1033,10 +1033,10 @@ void UpdateOamPriorityInAllHealthboxes(u8 priority, bool32 hideHPBoxes) if (indicatorSpriteId != 0xFF) gSprites[indicatorSpriteId].oam.priority = priority; - #if B_HIDE_HEALTHBOX_IN_ANIMS + #if B_HIDE_HEALTHBOX_IN_ANIMS if (hideHPBoxes && IsBattlerAlive(i)) TryToggleHealboxVisibility(priority, healthboxLeftSpriteId, healthboxRightSpriteId, healthbarSpriteId, indicatorSpriteId); - #endif + #endif } } @@ -3119,10 +3119,11 @@ static void RestoreOverwrittenPixels(u8 *tiles) void CreateAbilityPopUp(u8 battlerId, u32 ability, bool32 isDoubleBattle) { +#if B_ABILITY_POP_UP == TRUE const s16 (*coords)[2]; u8 spriteId1, spriteId2, battlerPosition, taskId; - if (!B_ABILITY_POP_UP) + return; if (gBattleScripting.abilityPopupOverwrite != 0) @@ -3189,6 +3190,7 @@ void CreateAbilityPopUp(u8 battlerId, u32 ability, bool32 isDoubleBattle) PrintBattlerOnAbilityPopUp(battlerId, spriteId1, spriteId2); PrintAbilityOnAbilityPopUp(ability, spriteId1, spriteId2); RestoreOverwrittenPixels((void*)(OBJ_VRAM0) + (gSprites[spriteId1].oam.tileNum * 32)); +#endif } void UpdateAbilityPopup(u8 battlerId) diff --git a/src/battle_main.c b/src/battle_main.c index 603673e63482..f3dfae5ff18f 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -3362,10 +3362,11 @@ static void DoBattleIntro(void) } else // Skip party summary since it is a wild battle. { - if (B_FAST_INTRO) - *state = 7; // Don't wait for sprite, print message at the same time. - else - *state = 6; // Wait for sprite to load. + #if B_FAST_INTRO == TRUE + *state = 7; // Don't wait for sprite, print message at the same time. + #else + *state = 6; // Wait for sprite to load. + #endif } break; case 5: // draw party summary in trainer battles @@ -3434,10 +3435,11 @@ static void DoBattleIntro(void) } else { - if (B_FAST_INTRO) - *state = 15; // Wait for text to be printed. - else - *state = 14; // Wait for text and sprite. + #if B_FAST_INTRO == TRUE + *state = 15; // Wait for text to be printed. + #else + *state = 14; // Wait for text and sprite. + #endif } } break; @@ -3475,9 +3477,11 @@ static void DoBattleIntro(void) BtlController_EmitIntroTrainerBallThrow(BUFFER_A); MarkBattlerForControllerExec(gActiveBattler); } - if (B_FAST_INTRO && !(gBattleTypeFlags & (BATTLE_TYPE_RECORDED | BATTLE_TYPE_RECORDED_LINK | BATTLE_TYPE_RECORDED_IS_MASTER | BATTLE_TYPE_LINK))) + #if B_FAST_INTRO == TRUE + if (!(gBattleTypeFlags & (BATTLE_TYPE_RECORDED | BATTLE_TYPE_RECORDED_LINK | BATTLE_TYPE_RECORDED_IS_MASTER | BATTLE_TYPE_LINK))) *state = 15; // Print at the same time as trainer sends out second mon. else + #endif (*state)++; break; case 14: // wait for opponent 2 send out @@ -3497,13 +3501,14 @@ static void DoBattleIntro(void) gActiveBattler = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT); // A hack that makes fast intro work in trainer battles too. - if (B_FAST_INTRO - && gBattleTypeFlags & BATTLE_TYPE_TRAINER + #if B_FAST_INTRO == TRUE + if (gBattleTypeFlags & BATTLE_TYPE_TRAINER && !(gBattleTypeFlags & (BATTLE_TYPE_RECORDED | BATTLE_TYPE_RECORDED_LINK | BATTLE_TYPE_RECORDED_IS_MASTER | BATTLE_TYPE_LINK)) && gSprites[gHealthboxSpriteIds[gActiveBattler ^ BIT_SIDE]].callback == SpriteCallbackDummy) { return; } + #endif PrepareStringBattle(STRINGID_INTROSENDOUT, gActiveBattler); } @@ -4457,7 +4462,11 @@ u32 GetBattlerTotalSpeedStat(u8 battlerId) // paralysis drop if (gBattleMons[battlerId].status1 & STATUS1_PARALYSIS && ability != ABILITY_QUICK_FEET) - speed /= (B_PARALYSIS_SPEED >= GEN_7 ? 2 : 4); + #if B_PARALYSIS_SPEED >= GEN_7 + speed /= 2; + #else + speed /= 4; + #endif return speed; } @@ -4482,8 +4491,10 @@ s8 GetMovePriority(u32 battlerId, u16 move) priority = gBattleMoves[move].priority; if (ability == ABILITY_GALE_WINGS - && gBattleMoves[move].type == TYPE_FLYING - && (B_GALE_WINGS <= GEN_6 || BATTLER_MAX_HP(battlerId))) + #if B_GALE_WINGS >= GEN_7 + && BATTLER_MAX_HP(battlerId) + #endif + && gBattleMoves[move].type == TYPE_FLYING) { priority++; } @@ -5130,10 +5141,10 @@ static void HandleEndTurn_FinishBattle(void) RecordedBattle_SetPlaybackFinished(); BeginFastPaletteFade(3); FadeOutMapMusic(5); - #if B_TRAINERS_KNOCK_OFF_ITEMS + #if B_TRAINERS_KNOCK_OFF_ITEMS == TRUE if (gBattleTypeFlags & BATTLE_TYPE_TRAINER) TryRestoreStolenItems(); - #endif + #endif for (i = 0; i < PARTY_SIZE; i++) { UndoMegaEvolution(i); @@ -5175,7 +5186,10 @@ static void FreeResetData_ReturnToOvOrDoEvolutions(void) | BATTLE_TYPE_FRONTIER | BATTLE_TYPE_EREADER_TRAINER | BATTLE_TYPE_WALLY_TUTORIAL)) - && (B_EVOLUTION_AFTER_WHITEOUT >= GEN_6 || gBattleOutcome == B_OUTCOME_WON || gBattleOutcome == B_OUTCOME_CAUGHT)) + #if B_EVOLUTION_AFTER_WHITEOUT <= GEN_5 + && (gBattleOutcome == B_OUTCOME_WON || gBattleOutcome == B_OUTCOME_CAUGHT) + #endif + ) { gBattleMainFunc = TrySpecialEvolution; } @@ -5460,5 +5474,9 @@ void SetTotemBoost(void) bool32 IsWildMonSmart(void) { - return (B_SMART_WILD_AI_FLAG != 0 && FlagGet(B_SMART_WILD_AI_FLAG)); +#if B_SMART_WILD_AI_FLAG != 0 + return (FlagGet(B_SMART_WILD_AI_FLAG)); +#else + return FALSE; +#endif } diff --git a/src/battle_pike.c b/src/battle_pike.c index 229f6211ba14..9a0af69cce88 100644 --- a/src/battle_pike.c +++ b/src/battle_pike.c @@ -856,8 +856,10 @@ static bool8 DoesTypePreventStatus(u16 species, u32 status) break; case STATUS1_PARALYSIS: if (gBaseStats[species].type1 == TYPE_GROUND || gBaseStats[species].type2 == TYPE_GROUND - || (B_PARALYZE_ELECTRIC >= GEN_6 && - (gBaseStats[species].type1 == TYPE_ELECTRIC || gBaseStats[species].type2 == TYPE_ELECTRIC))) + #if B_PARALYZE_ELECTRIC >= GEN_6 + || gBaseStats[species].type1 == TYPE_ELECTRIC || gBaseStats[species].type2 == TYPE_ELECTRIC + #endif + ) ret = TRUE; break; case STATUS1_BURN: diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index ad0866cffb83..abcd574a5027 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -1396,10 +1396,10 @@ static void Cmd_attackcanceler(void) gBattlescriptCurrInstr = BattleScript_MoveEnd; return; } - #if (B_STANCE_CHANGE_FAIL <= GEN_6) +#if B_STANCE_CHANGE_FAIL <= GEN_6 if (TryAegiFormChange()) return; - #endif +#endif if (AtkCanceller_UnableToUseMove()) return; @@ -1431,10 +1431,10 @@ static void Cmd_attackcanceler(void) gMoveResultFlags |= MOVE_RESULT_MISSED; return; } - #if (B_STANCE_CHANGE_FAIL >= GEN_7) +#if B_STANCE_CHANGE_FAIL >= GEN_7 if (TryAegiFormChange()) return; - #endif +#endif gHitMarker &= ~HITMARKER_ALLOW_NO_PP; @@ -1601,13 +1601,13 @@ static bool32 AccuracyCalcHelper(u16 move) JumpIfMoveFailed(7, move); return TRUE; } - else if (B_TOXIC_NEVER_MISS >= GEN_6 - && gBattleMoves[move].effect == EFFECT_TOXIC - && IS_BATTLER_OF_TYPE(gBattlerAttacker, TYPE_POISON)) +#if B_TOXIC_NEVER_MISS >= GEN_6 + else if (gBattleMoves[move].effect == EFFECT_TOXIC && IS_BATTLER_OF_TYPE(gBattlerAttacker, TYPE_POISON)) { JumpIfMoveFailed(7, move); return TRUE; } +#endif // If the attacker has the ability No Guard and they aren't targeting a Pokemon involved in a Sky Drop with the move Sky Drop, move hits. else if (GetBattlerAbility(gBattlerAttacker) == ABILITY_NO_GUARD && (move != MOVE_SKY_DROP || gBattleStruct->skyDropTargets[gBattlerTarget] == 0xFF)) { @@ -1639,14 +1639,40 @@ static bool32 AccuracyCalcHelper(u16 move) return TRUE; } - if ((WEATHER_HAS_EFFECT && - ((IsBattlerWeatherAffected(gBattlerTarget, B_WEATHER_RAIN) && (gBattleMoves[move].effect == EFFECT_THUNDER || gBattleMoves[move].effect == EFFECT_HURRICANE)) - || ((B_BLIZZARD_HAIL >= GEN_4 && (gBattleWeather & B_WEATHER_HAIL) && move == MOVE_BLIZZARD)))) - || (gBattleMoves[move].effect == EFFECT_VITAL_THROW) - || (gBattleMoves[move].accuracy == 0) - || ((B_MINIMIZE_DMG_ACC >= GEN_6) && (gStatuses3[gBattlerTarget] & STATUS3_MINIMIZED) && (gBattleMoves[move].flags & FLAG_DMG_MINIMIZE))) + if (WEATHER_HAS_EFFECT) + { + if ((IsBattlerWeatherAffected(gBattlerTarget, B_WEATHER_RAIN) && (gBattleMoves[move].effect == EFFECT_THUNDER || gBattleMoves[move].effect == EFFECT_HURRICANE))) + { + // thunder/hurricane ignore acc checks in rain unless target is holding utility umbrella + JumpIfMoveFailed(7, move); + return TRUE; + } + #if B_BLIZZARD_HAIL >= GEN_4 + else if ((gBattleWeather & B_WEATHER_HAIL) && move == MOVE_BLIZZARD) + { + // thunder/hurricane ignore acc checks in rain unless target is holding utility umbrella + JumpIfMoveFailed(7, move); + return TRUE; + } + #endif + } + + if (gBattleMoves[move].effect == EFFECT_VITAL_THROW) + { + JumpIfMoveFailed(7, move); + return TRUE; + } + +#if B_MINIMIZE_DMG_ACC >= GEN_6 + if ((gStatuses3[gBattlerTarget] & STATUS3_MINIMIZED) && (gBattleMoves[move].flags & FLAG_DMG_MINIMIZE)) + { + JumpIfMoveFailed(7, move); + return TRUE; + } +#endif + + if (gBattleMoves[move].accuracy == 0) { - // thunder/hurricane ignore acc checks in rain unless target is holding utility umbrella JumpIfMoveFailed(7, move); return TRUE; } @@ -2926,7 +2952,11 @@ void SetMoveEffect(bool32 primary, u32 certain) BattleScriptPush(gBattlescriptCurrInstr + 1); if (sStatusFlagsForMoveEffects[gBattleScripting.moveEffect] == STATUS1_SLEEP) - gBattleMons[gEffectBattler].status1 |= (B_SLEEP_TURNS >= GEN_5) ? ((Random() % 3) + 2) : ((Random() % 4) + 3); + #if B_SLEEP_TURNS >= GEN_5 + gBattleMons[gEffectBattler].status1 |= ((Random() % 3) + 2); + #else + gBattleMons[gEffectBattler].status1 |= ((Random() % 4) + 3); + #endif else gBattleMons[gEffectBattler].status1 |= sStatusFlagsForMoveEffects[gBattleScripting.moveEffect]; @@ -3028,7 +3058,11 @@ void SetMoveEffect(bool32 primary, u32 certain) { gBattleMons[gEffectBattler].status2 |= STATUS2_MULTIPLETURNS; gLockedMoves[gEffectBattler] = gCurrentMove; - gBattleMons[gEffectBattler].status2 |= STATUS2_UPROAR_TURN(B_UPROAR_TURNS >= GEN_5 ? 3 : ((Random() & 3) + 2)); + #if B_UPROAR_TURNS >= GEN_5 + gBattleMons[gEffectBattler].status2 |= STATUS2_UPROAR_TURN(3); + #else + gBattleMons[gEffectBattler].status2 |= STATUS2_UPROAR_TURN((Random() & 3) + 2); + #endif BattleScriptPush(gBattlescriptCurrInstr + 1); gBattlescriptCurrInstr = sMoveEffectBS_Ptrs[gBattleScripting.moveEffect]; @@ -3083,9 +3117,15 @@ void SetMoveEffect(bool32 primary, u32 certain) { gBattleMons[gEffectBattler].status2 |= STATUS2_WRAPPED; if (GetBattlerHoldEffect(gBattlerAttacker, TRUE) == HOLD_EFFECT_GRIP_CLAW) - gDisableStructs[gEffectBattler].wrapTurns = (B_BINDING_TURNS >= GEN_5) ? 7 : 5; + #if B_BINDING_TURNS >= GEN_5 + gDisableStructs[gEffectBattler].wrapTurns = 7; + else + gDisableStructs[gEffectBattler].wrapTurns = (Random() % 2) + 4; + #else + gDisableStructs[gEffectBattler].wrapTurns = 5; else - gDisableStructs[gEffectBattler].wrapTurns = (B_BINDING_TURNS >= GEN_5) ? ((Random() % 2) + 4) : ((Random() % 4) + 2); + gDisableStructs[gEffectBattler].wrapTurns = (Random() % 4) + 2; + #endif gBattleStruct->wrappedMove[gEffectBattler] = gCurrentMove; gBattleStruct->wrappedBy[gEffectBattler] = gBattlerAttacker; @@ -3500,8 +3540,11 @@ void SetMoveEffect(bool32 primary, u32 certain) gBattlescriptCurrInstr++; break; case MOVE_EFFECT_INCINERATE: - if ((B_INCINERATE_GEMS >= GEN_6 && GetBattlerHoldEffect(gEffectBattler, FALSE) == HOLD_EFFECT_GEMS) - || (gBattleMons[gEffectBattler].item >= FIRST_BERRY_INDEX && gBattleMons[gEffectBattler].item <= LAST_BERRY_INDEX)) + if ((gBattleMons[gEffectBattler].item >= FIRST_BERRY_INDEX && gBattleMons[gEffectBattler].item <= LAST_BERRY_INDEX) + #if B_INCINERATE_GEMS >= GEN_6 + || (GetBattlerHoldEffect(gEffectBattler, FALSE) == HOLD_EFFECT_GEMS) + #endif + ) { gLastUsedItem = gBattleMons[gEffectBattler].item; gBattleMons[gEffectBattler].item = 0; @@ -4045,13 +4088,20 @@ static void Cmd_getexp(void) gBattleMoveDamage = 0; // only give exp share bonus in later gens if the mon wasn't sent out - if ((holdEffect == HOLD_EFFECT_EXP_SHARE) && ((gBattleMoveDamage == 0) || (B_SPLIT_EXP < GEN_6))) + #if B_SPLIT_EXP < GEN_6 + if (holdEffect == HOLD_EFFECT_EXP_SHARE) gBattleMoveDamage += gExpShareExp; + #else + if (holdEffect == HOLD_EFFECT_EXP_SHARE && gBattleMoveDamage == 0) + gBattleMoveDamage += gExpShareExp; + #endif if (holdEffect == HOLD_EFFECT_LUCKY_EGG) gBattleMoveDamage = (gBattleMoveDamage * 150) / 100; - if (gBattleTypeFlags & BATTLE_TYPE_TRAINER && B_TRAINER_EXP_MULTIPLIER <= GEN_7) + #if B_TRAINER_EXP_MULTIPLIER <= GEN_7 + if (gBattleTypeFlags & BATTLE_TYPE_TRAINER) gBattleMoveDamage = (gBattleMoveDamage * 150) / 100; - #if (B_SCALED_EXP >= GEN_5) && (B_SCALED_EXP != GEN_6) + #endif + #if (B_SCALED_EXP >= GEN_5) && (B_SCALED_EXP != GEN_6) { // Note: There is an edge case where if a pokemon receives a large amount of exp, it wouldn't be properly calculated // because of multiplying by scaling factor(the value would simply be larger than an u32 can hold). Hence u64 is needed. @@ -4060,7 +4110,7 @@ static void Cmd_getexp(void) value /= sExperienceScalingFactors[gBattleMons[gBattlerFainted].level + GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_LEVEL) + 10]; gBattleMoveDamage = value + 1; } - #endif + #endif #if B_AFFECTION_MECHANICS == TRUE if (GetMonFriendshipScore(&gPlayerParty[gBattleStruct->expGetterMonId]) >= FRIENDSHIP_50_TO_99) gBattleMoveDamage = (gBattleMoveDamage * 120) / 100; @@ -4765,14 +4815,14 @@ static void Cmd_playanimation(void) gActiveBattler = GetBattlerForBattleScript(gBattlescriptCurrInstr[1]); argumentPtr = T2_READ_PTR(gBattlescriptCurrInstr + 3); - #if B_TERRAIN_BG_CHANGE == FALSE +#if B_TERRAIN_BG_CHANGE == FALSE if (animId == B_ANIM_RESTORE_BG) { // workaround for .if not working gBattlescriptCurrInstr += 7; return; } - #endif +#endif if (animId == B_ANIM_STATS_CHANGE || animId == B_ANIM_SNATCH_MOVE @@ -5094,7 +5144,11 @@ static void Cmd_moveend(void) i = gBattlerAttacker; gBattlerAttacker = gBattlerTarget; gBattlerTarget = i; // gBattlerTarget and gBattlerAttacker are swapped in order to activate Defiant, if applicable - gBattleScripting.moveEffect = (B_KINGS_SHIELD_LOWER_ATK >= GEN_8) ? MOVE_EFFECT_ATK_MINUS_1 : MOVE_EFFECT_ATK_MINUS_2; + #if B_KINGS_SHIELD_LOWER_ATK >= GEN_8 + gBattleScripting.moveEffect = MOVE_EFFECT_ATK_MINUS_1; + #else + gBattleScripting.moveEffect = MOVE_EFFECT_ATK_MINUS_2; + #endif BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_KingsShieldEffect; effect = 1; @@ -5669,17 +5723,19 @@ static void Cmd_moveend(void) BattleScriptPushCursor(); if (gBattleTypeFlags & BATTLE_TYPE_TRAINER || GetBattlerSide(i) == B_SIDE_PLAYER) { - if (B_ABILITY_POP_UP) - gBattlescriptCurrInstr = BattleScript_EmergencyExit; - else - gBattlescriptCurrInstr = BattleScript_EmergencyExitNoPopUp; + #if B_ABILITY_POP_UP == TRUE + gBattlescriptCurrInstr = BattleScript_EmergencyExit; + #else + gBattlescriptCurrInstr = BattleScript_EmergencyExitNoPopUp; + #endif } else { - if (B_ABILITY_POP_UP) - gBattlescriptCurrInstr = BattleScript_EmergencyExitWild; - else - gBattlescriptCurrInstr = BattleScript_EmergencyExitWildNoPopUp; + #if B_ABILITY_POP_UP == TRUE + gBattlescriptCurrInstr = BattleScript_EmergencyExitWild; + #else + gBattlescriptCurrInstr = BattleScript_EmergencyExitWildNoPopUp; + #endif } return; } @@ -5692,12 +5748,12 @@ static void Cmd_moveend(void) if (gSpecialStatuses[gBattlerAttacker].dancerOriginalTarget) *(gBattleStruct->moveTarget + gBattlerAttacker) = gSpecialStatuses[gBattlerAttacker].dancerOriginalTarget & 0x3; - #if B_RAMPAGE_CANCELLING >= GEN_5 + #if B_RAMPAGE_CANCELLING >= GEN_5 if (gBattleMoves[gCurrentMove].effect == EFFECT_RAMPAGE // If we're rampaging && (gMoveResultFlags & MOVE_RESULT_NO_EFFECT) // And it is unusable && (gBattleMons[gBattlerAttacker].status2 & STATUS2_LOCK_CONFUSE) != STATUS2_LOCK_CONFUSE_TURN(1)) // And won't end this turn CancelMultiTurnMoves(gBattlerAttacker); // Cancel it - #endif + #endif gBattleStruct->targetsDone[gBattlerAttacker] = 0; gProtectStructs[gBattlerAttacker].usesBouncedMove = FALSE; @@ -8427,11 +8483,11 @@ static void Cmd_various(void) && !NoAliveMonsForEitherParty() && CompareStat(gBattlerAttacker, STAT_ATK, MAX_STAT_STAGE, CMP_LESS_THAN)) { - if (B_FELL_STINGER_STAT_RAISE >= GEN_7) - SET_STATCHANGER(STAT_ATK, 3, FALSE); - else - SET_STATCHANGER(STAT_ATK, 2, FALSE); - + #if B_FELL_STINGER_STAT_RAISE >= GEN_7 + SET_STATCHANGER(STAT_ATK, 3, FALSE); + #else + SET_STATCHANGER(STAT_ATK, 2, FALSE); + #endif PREPARE_STAT_BUFFER(gBattleTextBuff1, STAT_ATK); BattleScriptPush(gBattlescriptCurrInstr + 3); gBattlescriptCurrInstr = BattleScript_FellStingerRaisesStat; @@ -9996,13 +10052,16 @@ static void Cmd_manipulatedamage(void) gBattleMoveDamage *= -1; break; case DMG_RECOIL_FROM_MISS: + #if B_RECOIL_IF_MISS_DMG >= GEN_5 + gBattleMoveDamage = gBattleMons[gBattlerAttacker].maxHP / 2; + #elif B_RECOIL_IF_MISS_DMG == GEN_4 + if ((gBattleMons[gBattlerTarget].maxHP / 2) < gBattleMoveDamage) + gBattleMoveDamage = gBattleMons[gBattlerTarget].maxHP / 2; + #else gBattleMoveDamage /= 2; + #endif if (gBattleMoveDamage == 0) gBattleMoveDamage = 1; - if (B_RECOIL_IF_MISS_DMG >= GEN_5) - gBattleMoveDamage = gBattleMons[gBattlerAttacker].maxHP / 2; - if ((B_RECOIL_IF_MISS_DMG <= GEN_4) && ((gBattleMons[gBattlerTarget].maxHP / 2) < gBattleMoveDamage)) - gBattleMoveDamage = gBattleMons[gBattlerTarget].maxHP / 2; break; case DMG_DOUBLED: gBattleMoveDamage *= 2; @@ -10621,8 +10680,9 @@ static void Cmd_setmultihitcounter(void) { gMultiHitCounter = 5; } - else if (B_MULTI_HIT_CHANCE >= GEN_5) + else { + #if B_MULTI_HIT_CHANCE >= GEN_5 // Based on Gen 5's odds // 35% for 2 hits // 35% for 3 hits @@ -10637,9 +10697,7 @@ static void Cmd_setmultihitcounter(void) gMultiHitCounter = 4; else gMultiHitCounter = 5; - } - else - { + #else // 2 and 3 hits: 37.5% // 4 and 5 hits: 12.5% gMultiHitCounter = Random() % 4; @@ -10647,6 +10705,7 @@ static void Cmd_setmultihitcounter(void) gMultiHitCounter = (Random() % 4) + 2; else gMultiHitCounter += 2; + #endif } } @@ -11040,10 +11099,10 @@ static void Cmd_tryKO(void) else { u16 odds = gBattleMoves[gCurrentMove].accuracy + (gBattleMons[gBattlerAttacker].level - gBattleMons[gBattlerTarget].level); - #if B_SHEER_COLD_ACC >= GEN_7 - if (gCurrentMove == MOVE_SHEER_COLD && !IS_BATTLER_OF_TYPE(gBattlerAttacker, TYPE_ICE)) - odds -= 10; - #endif + #if B_SHEER_COLD_ACC >= GEN_7 + if (gCurrentMove == MOVE_SHEER_COLD && !IS_BATTLER_OF_TYPE(gBattlerAttacker, TYPE_ICE)) + odds -= 10; + #endif if (Random() % 100 + 1 < odds && gBattleMons[gBattlerAttacker].level >= gBattleMons[gBattlerTarget].level) lands = TRUE; } @@ -11414,10 +11473,11 @@ static void Cmd_dmgtolevel(void) static void Cmd_psywavedamageeffect(void) { s32 randDamage; - if (B_PSYWAVE_DMG >= GEN_6) - randDamage = (Random() % 101); - else - randDamage = (Random() % 11) * 10; +#if B_PSYWAVE_DMG >= GEN_6 + randDamage = (Random() % 101); +#else + randDamage = (Random() % 11) * 10; +#endif gBattleMoveDamage = gBattleMons[gBattlerAttacker].level * (randDamage + 50) / 100; gBattlescriptCurrInstr++; } @@ -11488,12 +11548,13 @@ static void Cmd_disablelastusedattack(void) PREPARE_MOVE_BUFFER(gBattleTextBuff1, gBattleMons[gBattlerTarget].moves[i]) gDisableStructs[gBattlerTarget].disabledMove = gBattleMons[gBattlerTarget].moves[i]; - if (B_DISABLE_TURNS == GEN_3) - gDisableStructs[gBattlerTarget].disableTimer = (Random() & 3) + 2; - else if (B_DISABLE_TURNS == GEN_4) - gDisableStructs[gBattlerTarget].disableTimer = (Random() & 3) + 4; - else - gDisableStructs[gBattlerTarget].disableTimer = 4; + #if B_DISABLE_TURNS == GEN_3 + gDisableStructs[gBattlerTarget].disableTimer = (Random() & 3) + 2; + #elif B_DISABLE_TURNS == GEN_4 + gDisableStructs[gBattlerTarget].disableTimer = (Random() & 3) + 4; + #else + gDisableStructs[gBattlerTarget].disableTimer = 4; + #endif gDisableStructs[gBattlerTarget].disableTimerStartValue = gDisableStructs[gBattlerTarget].disableTimer; // used to save the random amount of turns? gBattlescriptCurrInstr += 5; } @@ -11771,7 +11832,11 @@ static void Cmd_settailwind(void) { gSideStatuses[side] |= SIDE_STATUS_TAILWIND; gSideTimers[side].tailwindBattlerId = gBattlerAttacker; - gSideTimers[side].tailwindTimer = (B_TAILWIND_TURNS >= GEN_5) ? 4 : 3; + #if B_TAILWIND_TURNS >= GEN_5 + gSideTimers[side].tailwindTimer = 4; + #else + gSideTimers[side].tailwindTimer = 3; + #endif gBattlescriptCurrInstr += 5; } else @@ -12694,7 +12759,7 @@ static void Cmd_tryswapitems(void) | BATTLE_TYPE_FRONTIER | BATTLE_TYPE_SECRET_BASE | BATTLE_TYPE_RECORDED_LINK - #if B_TRAINERS_KNOCK_OFF_ITEMS + #if B_TRAINERS_KNOCK_OFF_ITEMS == TRUE | BATTLE_TYPE_TRAINER #endif )))) @@ -12833,14 +12898,14 @@ static void Cmd_trywish(void) break; case 1: // heal effect PREPARE_MON_NICK_WITH_PREFIX_BUFFER(gBattleTextBuff1, gBattlerTarget, gWishFutureKnock.wishPartyId[gBattlerTarget]) - #if B_WISH_HP_SOURCE >= GEN_5 - if (GetBattlerSide(gBattlerTarget) == B_SIDE_PLAYER) - gBattleMoveDamage = max(1, GetMonData(&gPlayerParty[gWishFutureKnock.wishPartyId[gBattlerTarget]], MON_DATA_MAX_HP) / 2); - else - gBattleMoveDamage = max(1, GetMonData(&gEnemyParty[gWishFutureKnock.wishPartyId[gBattlerTarget]], MON_DATA_MAX_HP) / 2); - #else - gBattleMoveDamage = max(1, gBattleMons[gBattlerTarget].maxHP / 2); - #endif + #if B_WISH_HP_SOURCE >= GEN_5 + if (GetBattlerSide(gBattlerTarget) == B_SIDE_PLAYER) + gBattleMoveDamage = max(1, GetMonData(&gPlayerParty[gWishFutureKnock.wishPartyId[gBattlerTarget]], MON_DATA_MAX_HP) / 2); + else + gBattleMoveDamage = max(1, GetMonData(&gEnemyParty[gWishFutureKnock.wishPartyId[gBattlerTarget]], MON_DATA_MAX_HP) / 2); + #else + gBattleMoveDamage = max(1, gBattleMons[gBattlerTarget].maxHP / 2); + #endif gBattleMoveDamage *= -1; if (gBattleMons[gBattlerTarget].hp == gBattleMons[gBattlerTarget].maxHP) @@ -13240,45 +13305,40 @@ u16 GetSecretPowerMoveEffect(void) { switch (gBattleTerrain) { - case BATTLE_TERRAIN_GRASS: - #if B_SECRET_POWER_EFFECT >= GEN_4 - moveEffect = MOVE_EFFECT_SLEEP; - #else - moveEffect = MOVE_EFFECT_POISON; - #endif - break; + #if B_SECRET_POWER_EFFECT >= GEN_6 + case BATTLE_TERRAIN_GRASS: moveEffect = MOVE_EFFECT_SLEEP; break; + case BATTLE_TERRAIN_UNDERWATER: moveEffect = MOVE_EFFECT_ATK_MINUS_1; break; + case BATTLE_TERRAIN_POND: moveEffect = MOVE_EFFECT_ATK_MINUS_1; break; + case BATTLE_TERRAIN_MOUNTAIN: moveEffect = MOVE_EFFECT_ACC_MINUS_1; break; + case BATTLE_TERRAIN_PUDDLE: moveEffect = MOVE_EFFECT_SPD_MINUS_1; break; + #elif B_SECRET_POWER_EFFECT >= GEN_5 + case BATTLE_TERRAIN_GRASS: moveEffect = MOVE_EFFECT_SLEEP; break; + case BATTLE_TERRAIN_UNDERWATER: moveEffect = MOVE_EFFECT_DEF_MINUS_1; break; + case BATTLE_TERRAIN_POND: moveEffect = MOVE_EFFECT_ATK_MINUS_1; break; + case BATTLE_TERRAIN_MOUNTAIN: moveEffect = MOVE_EFFECT_ACC_MINUS_1; break; + case BATTLE_TERRAIN_PUDDLE: moveEffect = MOVE_EFFECT_SPD_MINUS_1; break; + #elif B_SECRET_POWER_EFFECT >= GEN_4 + case BATTLE_TERRAIN_GRASS: moveEffect = MOVE_EFFECT_SLEEP; break; + case BATTLE_TERRAIN_UNDERWATER: moveEffect = MOVE_EFFECT_DEF_MINUS_1; break; + case BATTLE_TERRAIN_POND: moveEffect = MOVE_EFFECT_ATK_MINUS_1; break; + case BATTLE_TERRAIN_MOUNTAIN: moveEffect = MOVE_EFFECT_FLINCH; break; + case BATTLE_TERRAIN_PUDDLE: moveEffect = MOVE_EFFECT_ACC_MINUS_1; break; + #else + case BATTLE_TERRAIN_GRASS: moveEffect = MOVE_EFFECT_POISON; break; + case BATTLE_TERRAIN_UNDERWATER: moveEffect = MOVE_EFFECT_DEF_MINUS_1; break; + case BATTLE_TERRAIN_POND: moveEffect = MOVE_EFFECT_SPD_MINUS_1; break; + case BATTLE_TERRAIN_MOUNTAIN: moveEffect = MOVE_EFFECT_CONFUSION; break; + case BATTLE_TERRAIN_PUDDLE: moveEffect = MOVE_EFFECT_ACC_MINUS_1; break; + #endif case BATTLE_TERRAIN_LONG_GRASS: moveEffect = MOVE_EFFECT_SLEEP; break; case BATTLE_TERRAIN_SAND: moveEffect = MOVE_EFFECT_ACC_MINUS_1; break; - case BATTLE_TERRAIN_UNDERWATER: - #if B_SECRET_POWER_EFFECT >= GEN_6 - moveEffect = MOVE_EFFECT_ATK_MINUS_1; - #else - moveEffect = MOVE_EFFECT_DEF_MINUS_1; - #endif - break; case BATTLE_TERRAIN_WATER: moveEffect = MOVE_EFFECT_ATK_MINUS_1; break; - case BATTLE_TERRAIN_POND: - #if B_SECRET_POWER_EFFECT >= GEN_4 - moveEffect = MOVE_EFFECT_ATK_MINUS_1; - #else - moveEffect = MOVE_EFFECT_SPD_MINUS_1; - #endif - break; - case BATTLE_TERRAIN_MOUNTAIN: - #if B_SECRET_POWER_EFFECT >= GEN_5 - moveEffect = MOVE_EFFECT_ACC_MINUS_1; - #elif B_SECRET_POWER_EFFECT == GEN_4 - moveEffect = MOVE_EFFECT_FLINCH; - #else - moveEffect = MOVE_EFFECT_CONFUSION; - #endif - break; case BATTLE_TERRAIN_CAVE: case BATTLE_TERRAIN_BURIAL_GROUND: case BATTLE_TERRAIN_SPACE: @@ -13290,13 +13350,6 @@ u16 GetSecretPowerMoveEffect(void) case BATTLE_TERRAIN_SWAMP: moveEffect = MOVE_EFFECT_SPD_MINUS_1; break; - case BATTLE_TERRAIN_PUDDLE: - #if B_SECRET_POWER_EFFECT >= GEN_5 - moveEffect = MOVE_EFFECT_SPD_MINUS_1; - #else - moveEffect = MOVE_EFFECT_ACC_MINUS_1; - #endif - break; case BATTLE_TERRAIN_SNOW: case BATTLE_TERRAIN_ICE: moveEffect = MOVE_EFFECT_FREEZE; @@ -13493,12 +13546,14 @@ bool32 DoesSubstituteBlockMove(u8 battlerAtk, u8 battlerDef, u32 move) { if (!(gBattleMons[battlerDef].status2 & STATUS2_SUBSTITUTE)) return FALSE; - else if (gBattleMoves[move].flags & FLAG_SOUND && B_SOUND_SUBSTITUTE >= GEN_6) - return FALSE; - else if (GetBattlerAbility(battlerAtk) == ABILITY_INFILTRATOR) +#if B_SOUND_SUBSTITUTE >= GEN_6 + else if (gBattleMoves[move].flags & FLAG_SOUND) return FALSE; +#endif else if (gBattleMoves[move].flags & FLAG_HIT_IN_SUBSTITUTE) return FALSE; + else if (GetBattlerAbility(battlerAtk) == ABILITY_INFILTRATOR) + return FALSE; else return TRUE; } @@ -13630,18 +13685,18 @@ static void Cmd_removelightscreenreflect(void) u8 side; bool32 failed; - #if B_BRICK_BREAK >= GEN_4 - // From Gen 4 onwards, Brick Break can remove screens on the user's side if used on an ally - side = GetBattlerSide(gBattlerTarget); - #else - side = GetBattlerSide(gBattlerAttacker) ^ BIT_SIDE; - #endif +#if B_BRICK_BREAK >= GEN_4 +// From Gen 4 onwards, Brick Break can remove screens on the user's side if used on an ally + side = GetBattlerSide(gBattlerTarget); +#else + side = GetBattlerSide(gBattlerAttacker) ^ BIT_SIDE; +#endif - #if B_BRICK_BREAK >= GEN_5 - failed = (gMoveResultFlags & MOVE_RESULT_NO_EFFECT); - #else - failed = FALSE; - #endif +#if B_BRICK_BREAK >= GEN_5 + failed = (gMoveResultFlags & MOVE_RESULT_NO_EFFECT); +#else + failed = FALSE; +#endif if (!failed && (gSideTimers[side].reflectTimer @@ -13731,73 +13786,72 @@ static void Cmd_handleballthrow(void) break; case ITEM_NET_BALL: if (IS_BATTLER_OF_TYPE(gBattlerTarget, TYPE_WATER) || IS_BATTLER_OF_TYPE(gBattlerTarget, TYPE_BUG)) - #if B_NET_BALL_MODIFIER >= GEN_7 - ballMultiplier = 35; - #else - ballMultiplier = 30; - #endif + #if B_NET_BALL_MODIFIER >= GEN_7 + ballMultiplier = 35; + #else + ballMultiplier = 30; + #endif break; case ITEM_DIVE_BALL: + if (GetCurrentMapType() == MAP_TYPE_UNDERWATER #if B_DIVE_BALL_MODIFIER >= GEN_4 - if (GetCurrentMapType() == MAP_TYPE_UNDERWATER || gIsFishingEncounter || gIsSurfingEncounter) - ballMultiplier = 35; - #else - if (GetCurrentMapType() == MAP_TYPE_UNDERWATER) - ballMultiplier = 35; + || gIsFishingEncounter || gIsSurfingEncounter #endif + ) + ballMultiplier = 35; break; case ITEM_NEST_BALL: - #if B_NEST_BALL_MODIFIER >= GEN_6 - //((41 - Pokémon's level) ÷ 10)× if Pokémon's level is between 1 and 29, 1× otherwise. - if (gBattleMons[gBattlerTarget].level < 30) - ballMultiplier = 41 - gBattleMons[gBattlerTarget].level; - #elif B_NEST_BALL_MODIFIER == GEN_5 - //((41 - Pokémon's level) ÷ 10)×, minimum 1× - if (gBattleMons[gBattlerTarget].level < 31) - ballMultiplier = 41 - gBattleMons[gBattlerTarget].level; - #else - //((40 - Pokémon's level) ÷ 10)×, minimum 1× - if (gBattleMons[gBattlerTarget].level < 40) - { - ballMultiplier = 40 - gBattleMons[gBattlerTarget].level; - if (ballMultiplier <= 9) - ballMultiplier = 10; - } - #endif + #if B_NEST_BALL_MODIFIER >= GEN_6 + //((41 - Pokémon's level) ÷ 10)× if Pokémon's level is between 1 and 29, 1× otherwise. + if (gBattleMons[gBattlerTarget].level < 30) + ballMultiplier = 41 - gBattleMons[gBattlerTarget].level; + #elif B_NEST_BALL_MODIFIER == GEN_5 + //((41 - Pokémon's level) ÷ 10)×, minimum 1× + if (gBattleMons[gBattlerTarget].level < 31) + ballMultiplier = 41 - gBattleMons[gBattlerTarget].level; + #else + //((40 - Pokémon's level) ÷ 10)×, minimum 1× + if (gBattleMons[gBattlerTarget].level < 40) + { + ballMultiplier = 40 - gBattleMons[gBattlerTarget].level; + if (ballMultiplier <= 9) + ballMultiplier = 10; + } + #endif break; case ITEM_REPEAT_BALL: - if (GetSetPokedexFlag(SpeciesToNationalPokedexNum(gBattleMons[gBattlerTarget].species), FLAG_GET_CAUGHT)) - #if B_REPEAT_BALL_MODIFIER >= GEN_7 - ballMultiplier = 35; - #else - ballMultiplier = 30; - #endif - break; - case ITEM_TIMER_BALL: - #if B_TIMER_BALL_MODIFIER >= GEN_5 - ballMultiplier = (gBattleResults.battleTurnCounter * 3) + 10; + if (GetSetPokedexFlag(SpeciesToNationalPokedexNum(gBattleMons[gBattlerTarget].species), FLAG_GET_CAUGHT)) + #if B_REPEAT_BALL_MODIFIER >= GEN_7 + ballMultiplier = 35; #else - ballMultiplier = gBattleResults.battleTurnCounter + 10; + ballMultiplier = 30; #endif + break; + case ITEM_TIMER_BALL: + #if B_TIMER_BALL_MODIFIER >= GEN_5 + ballMultiplier = (gBattleResults.battleTurnCounter * 3) + 10; + #else + ballMultiplier = gBattleResults.battleTurnCounter + 10; + #endif if (ballMultiplier > 40) ballMultiplier = 40; break; case ITEM_DUSK_BALL: RtcCalcLocalTime(); if ((gLocalTime.hours >= 20 && gLocalTime.hours <= 3) || gMapHeader.cave || gMapHeader.mapType == MAP_TYPE_UNDERGROUND) - #if B_DUSK_BALL_MODIFIER >= GEN_7 - ballMultiplier = 30; - #else - ballMultiplier = 35; - #endif + #if B_DUSK_BALL_MODIFIER >= GEN_7 + ballMultiplier = 30; + #else + ballMultiplier = 35; + #endif break; case ITEM_QUICK_BALL: if (gBattleResults.battleTurnCounter == 0) - #if B_QUICK_BALL_MODIFIER >= GEN_5 - ballMultiplier = 50; - #else - ballMultiplier = 40; - #endif + #if B_QUICK_BALL_MODIFIER >= GEN_5 + ballMultiplier = 50; + #else + ballMultiplier = 40; + #endif break; case ITEM_LEVEL_BALL: if (gBattleMons[gBattlerAttacker].level >= 4 * gBattleMons[gBattlerTarget].level) @@ -13809,11 +13863,11 @@ static void Cmd_handleballthrow(void) break; case ITEM_LURE_BALL: if (gIsFishingEncounter) - #if B_LURE_BALL_MODIFIER >= GEN_7 - ballMultiplier = 50; - #else - ballMultiplier = 30; - #endif + #if B_LURE_BALL_MODIFIER >= GEN_7 + ballMultiplier = 50; + #else + ballMultiplier = 30; + #endif break; case ITEM_MOON_BALL: for (i = 0; i < EVOS_PER_MON; i++) @@ -13839,44 +13893,44 @@ static void Cmd_handleballthrow(void) break; case ITEM_HEAVY_BALL: i = GetPokedexHeightWeight(SpeciesToNationalPokedexNum(gBattleMons[gBattlerTarget].species), 1); - #if B_HEAVY_BALL_MODIFIER >= GEN_7 - if (i < 1000) - ballAddition = -20; - else if (i < 2000) - ballAddition = 0; - else if (i < 3000) - ballAddition = 20; - else - ballAddition = 30; - #elif B_HEAVY_BALL_MODIFIER >= GEN_4 - if (i < 2048) - ballAddition = -20; - else if (i < 3072) - ballAddition = 20; - else if (i < 4096) - ballAddition = 30; - else - ballAddition = 40; - #else - if (i < 1024) - ballAddition = -20; - else if (i < 2048) - ballAddition = 0; - else if (i < 3072) - ballAddition = 20; - else if (i < 4096) - ballAddition = 30; - else - ballAddition = 40; - #endif + #if B_HEAVY_BALL_MODIFIER >= GEN_7 + if (i < 1000) + ballAddition = -20; + else if (i < 2000) + ballAddition = 0; + else if (i < 3000) + ballAddition = 20; + else + ballAddition = 30; + #elif B_HEAVY_BALL_MODIFIER >= GEN_4 + if (i < 2048) + ballAddition = -20; + else if (i < 3072) + ballAddition = 20; + else if (i < 4096) + ballAddition = 30; + else + ballAddition = 40; + #else + if (i < 1024) + ballAddition = -20; + else if (i < 2048) + ballAddition = 0; + else if (i < 3072) + ballAddition = 20; + else if (i < 4096) + ballAddition = 30; + else + ballAddition = 40; + #endif break; case ITEM_DREAM_BALL: - #if B_DREAM_BALL_MODIFIER >= GEN_8 - if (gBattleMons[gBattlerTarget].status1 & STATUS1_SLEEP || GetBattlerAbility(gBattlerTarget) == ABILITY_COMATOSE) - ballMultiplier = 40; - #else - ballMultiplier = 10; - #endif + #if B_DREAM_BALL_MODIFIER >= GEN_8 + if (gBattleMons[gBattlerTarget].status1 & STATUS1_SLEEP || GetBattlerAbility(gBattlerTarget) == ABILITY_COMATOSE) + ballMultiplier = 40; + #else + ballMultiplier = 10; + #endif break; case ITEM_BEAST_BALL: ballMultiplier = 1; @@ -14268,13 +14322,11 @@ static const u16 sTelekinesisBanList[] = { SPECIES_DIGLETT, SPECIES_DUGTRIO, -// #ifdef NEW_POKEMON SPECIES_DIGLETT_ALOLAN, SPECIES_DUGTRIO_ALOLAN, SPECIES_SANDYGAST, SPECIES_PALOSSAND, SPECIES_GENGAR_MEGA, -// #endif }; bool32 IsTelekinesisBannedSpecies(u16 species) @@ -14412,33 +14464,33 @@ static void Cmd_metalburstdamagecalculator(void) static bool32 CriticalCapture(u32 odds) { - #if B_CRITICAL_CAPTURE == TRUE - u32 numCaught = GetNationalPokedexCount(FLAG_GET_CAUGHT); - - if (numCaught <= (NATIONAL_DEX_COUNT * 30) / 650) - odds = 0; - else if (numCaught <= (NATIONAL_DEX_COUNT * 150) / 650) - odds /= 2; - else if (numCaught <= (NATIONAL_DEX_COUNT * 300) / 650) - ; // odds = (odds * 100) / 100; - else if (numCaught <= (NATIONAL_DEX_COUNT * 450) / 650) - odds = (odds * 150) / 100; - else if (numCaught <= (NATIONAL_DEX_COUNT * 600) / 650) - odds *= 2; - else - odds = (odds * 250) / 100; - - #ifdef ITEM_CATCHING_CHARM - if (CheckBagHasItem(ITEM_CATCHING_CHARM, 1)) - odds = (odds * (100 + B_CATCHING_CHARM_BOOST)) / 100; - #endif +#if B_CRITICAL_CAPTURE == TRUE + u32 numCaught = GetNationalPokedexCount(FLAG_GET_CAUGHT); + + if (numCaught <= (NATIONAL_DEX_COUNT * 30) / 650) + odds = 0; + else if (numCaught <= (NATIONAL_DEX_COUNT * 150) / 650) + odds /= 2; + else if (numCaught <= (NATIONAL_DEX_COUNT * 300) / 650) + ; // odds = (odds * 100) / 100; + else if (numCaught <= (NATIONAL_DEX_COUNT * 450) / 650) + odds = (odds * 150) / 100; + else if (numCaught <= (NATIONAL_DEX_COUNT * 600) / 650) + odds *= 2; + else + odds = (odds * 250) / 100; + + #ifdef ITEM_CATCHING_CHARM + if (CheckBagHasItem(ITEM_CATCHING_CHARM, 1)) + odds = (odds * (100 + B_CATCHING_CHARM_BOOST)) / 100; + #endif - odds /= 6; - if ((Random() % 255) < odds) - return TRUE; + odds /= 6; + if ((Random() % 255) < odds) + return TRUE; - return FALSE; - #else - return FALSE; - #endif + return FALSE; +#else + return FALSE; +#endif } diff --git a/src/battle_util.c b/src/battle_util.c index 98e7c86dee43..07f71c3bcf34 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -58,6 +58,7 @@ functions instead of at the top of the file with the other declarations. static bool32 TryRemoveScreens(u8 battler); static bool32 IsUnnerveAbilityOnOpposingSide(u8 battlerId); +static u8 GetFlingPowerFromItemId(u16 itemId); extern const u8 *const gBattleScriptsForMoveEffects[]; extern const u8 *const gBattlescriptsForRunningByItem[]; @@ -2829,8 +2830,11 @@ u8 DoBattlerEndTurnEffects(void) && gBattleMons[gActiveBattler].hp != 0) { MAGIC_GUARD_CHECK; - - gBattleMoveDamage = gBattleMons[gActiveBattler].maxHP / (B_BURN_DAMAGE >= GEN_7 ? 16 : 8); + #if B_BURN_DAMAGE >= GEN_7 + gBattleMoveDamage = gBattleMons[gActiveBattler].maxHP / 16; + #else + gBattleMoveDamage = gBattleMons[gActiveBattler].maxHP / 8; + #endif if (ability == ABILITY_HEATPROOF) { if (gBattleMoveDamage > (gBattleMoveDamage / 2) + 1) // Record ability if the burn takes less damage than it normally would. @@ -2891,9 +2895,15 @@ u8 DoBattlerEndTurnEffects(void) PREPARE_MOVE_BUFFER(gBattleTextBuff1, gBattleStruct->wrappedMove[gActiveBattler]); gBattlescriptCurrInstr = BattleScript_WrapTurnDmg; if (GetBattlerHoldEffect(gBattleStruct->wrappedBy[gActiveBattler], TRUE) == HOLD_EFFECT_BINDING_BAND) - gBattleMoveDamage = gBattleMons[gActiveBattler].maxHP / ((B_BINDING_DAMAGE >= GEN_6) ? 6 : 8); + #if B_BINDING_DAMAGE >= GEN_6 + gBattleMoveDamage = gBattleMons[gActiveBattler].maxHP / 6; else - gBattleMoveDamage = gBattleMons[gActiveBattler].maxHP / ((B_BINDING_DAMAGE >= GEN_6) ? 8 : 16); + gBattleMoveDamage = gBattleMons[gActiveBattler].maxHP / 8; + #else + gBattleMoveDamage = gBattleMons[gActiveBattler].maxHP / 8; + else + gBattleMoveDamage = gBattleMons[gActiveBattler].maxHP / 16; + #endif if (gBattleMoveDamage == 0) gBattleMoveDamage = 1; @@ -3084,7 +3094,11 @@ u8 DoBattlerEndTurnEffects(void) } else { - gBattleMons[gActiveBattler].status1 |= (B_SLEEP_TURNS >= GEN_5) ? ((Random() % 3) + 2) : ((Random() % 4) + 3); + #if B_SLEEP_TURNS >= GEN_5 + gBattleMons[gActiveBattler].status1 |= ((Random() % 3) + 2); + #else + gBattleMons[gActiveBattler].status1 |= ((Random() % 4) + 3); + #endif BtlController_EmitSetMonData(BUFFER_A, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[gActiveBattler].status1); MarkBattlerForControllerExec(gActiveBattler); BattleScriptExecute(BattleScript_YawnMakesAsleep); @@ -3349,7 +3363,7 @@ bool8 HandleFaintedMonActions(void) gBattleStruct->faintedActionsState = 3; else gBattleStruct->faintedActionsState = 1; - #if B_FAINT_SWITCH_IN >= GEN_4 + #if B_FAINT_SWITCH_IN >= GEN_4 // Don't switch mons until all pokemon performed their actions or the battle's over. if (gBattleOutcome == 0 && !NoAliveMonsForEitherParty() @@ -3358,10 +3372,10 @@ bool8 HandleFaintedMonActions(void) gAbsentBattlerFlags |= gBitTable[gBattlerFainted]; return FALSE; } - #endif + #endif break; case 3: - #if B_FAINT_SWITCH_IN >= GEN_4 + #if B_FAINT_SWITCH_IN >= GEN_4 // Don't switch mons until all pokemon performed their actions or the battle's over. if (gBattleOutcome == 0 && !NoAliveMonsForEitherParty() @@ -3369,7 +3383,7 @@ bool8 HandleFaintedMonActions(void) { return FALSE; } - #endif + #endif gBattleStruct->faintedActionsBattlerId = 0; gBattleStruct->faintedActionsState++; // fall through @@ -3631,7 +3645,12 @@ u8 AtkCanceller_UnableToUseMove(void) gBattleMons[gBattlerAttacker].status2 -= STATUS2_CONFUSION_TURN(1); if (gBattleMons[gBattlerAttacker].status2 & STATUS2_CONFUSION) { - if (Random() % ((B_CONFUSION_SELF_DMG_CHANCE >= GEN_7) ? 3 : 2) == 0) // confusion dmg + // confusion dmg + #if B_CONFUSION_SELF_DMG_CHANCE >= GEN_7 + if (Random() % 3 == 0) + #else + if (Random() % 2 == 0) + #endif { gBattleCommunication[MULTISTRING_CHOOSER] = TRUE; gBattlerTarget = gBattlerAttacker; @@ -3734,8 +3753,11 @@ u8 AtkCanceller_UnableToUseMove(void) case CANCELLER_POWDER_MOVE: if ((gBattleMoves[gCurrentMove].flags & FLAG_POWDER) && (gBattlerAttacker != gBattlerTarget)) { - if ((B_POWDER_GRASS >= GEN_6 && IS_BATTLER_OF_TYPE(gBattlerTarget, TYPE_GRASS)) - || GetBattlerAbility(gBattlerTarget) == ABILITY_OVERCOAT) + #if B_POWDER_GRASS >= GEN_6 + if (IS_BATTLER_OF_TYPE(gBattlerTarget, TYPE_GRASS) || GetBattlerAbility(gBattlerTarget) == ABILITY_OVERCOAT) + #else + if (GetBattlerAbility(gBattlerTarget) == ABILITY_OVERCOAT) + #endif { gBattlerAbility = gBattlerTarget; effect = 1; @@ -4062,19 +4084,20 @@ bool32 TryChangeBattleWeather(u8 battler, u32 weatherEnumId, bool32 viaAbility) { u16 battlerAbility = GetBattlerAbility(battler); - if (viaAbility && B_ABILITY_WEATHER <= GEN_5 - && !(gBattleWeather & sWeatherFlagsInfo[weatherEnumId][1])) + if (gBattleWeather & B_WEATHER_PRIMAL_ANY + && battlerAbility != ABILITY_DESOLATE_LAND + && battlerAbility != ABILITY_PRIMORDIAL_SEA + && battlerAbility != ABILITY_DELTA_STREAM) { - gBattleWeather = (sWeatherFlagsInfo[weatherEnumId][0] | sWeatherFlagsInfo[weatherEnumId][1]); - return TRUE; + return FALSE; } - else if (gBattleWeather & B_WEATHER_PRIMAL_ANY - && battlerAbility != ABILITY_DESOLATE_LAND - && battlerAbility != ABILITY_PRIMORDIAL_SEA - && battlerAbility != ABILITY_DELTA_STREAM) +#if B_ABILITY_WEATHER <= GEN_5 + else if (viaAbility && !(gBattleWeather & sWeatherFlagsInfo[weatherEnumId][1])) { - return FALSE; + gBattleWeather = (sWeatherFlagsInfo[weatherEnumId][0] | sWeatherFlagsInfo[weatherEnumId][1]); + return TRUE; } +#endif else if (!(gBattleWeather & (sWeatherFlagsInfo[weatherEnumId][0] | sWeatherFlagsInfo[weatherEnumId][1]))) { gBattleWeather = (sWeatherFlagsInfo[weatherEnumId][0]); @@ -4273,7 +4296,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move BattleScriptPushCursorAndCallback(BattleScript_OverworldTerrain); effect++; } - #if B_THUNDERSTORM_TERRAIN == TRUE + #if B_THUNDERSTORM_TERRAIN == TRUE else if (GetCurrentWeather() == WEATHER_RAIN_THUNDERSTORM && !(gFieldStatuses & STATUS_FIELD_ELECTRIC_TERRAIN)) { // overworld weather started rain, so just do electric terrain anim @@ -4282,7 +4305,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move BattleScriptPushCursorAndCallback(BattleScript_OverworldTerrain); effect++; } - #endif + #endif break; case ABILITYEFFECT_SWITCH_IN_WEATHER: if (!(gBattleTypeFlags & BATTLE_TYPE_RECORDED)) @@ -4804,7 +4827,11 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move if (gDisableStructs[battler].isFirstTurn != 2) { u32 validToRaise = 0, validToLower = 0; - u32 statsNum = (B_MOODY_ACC_EVASION != GEN_8) ? NUM_BATTLE_STATS : NUM_STATS; + #if B_MOODY_ACC_EVASION < GEN_8 + u32 statsNum = NUM_BATTLE_STATS; + #else + u32 statsNum = NUM_STATS; + #endif for (i = STAT_ATK; i < statsNum; i++) { @@ -4991,7 +5018,11 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move effect = 2, statId = STAT_ATK; break; case ABILITY_FLASH_FIRE: - if (moveType == TYPE_FIRE && !((gBattleMons[battler].status1 & STATUS1_FREEZE) && B_FLASH_FIRE_FROZEN <= GEN_4)) + if (moveType == TYPE_FIRE + #if B_FLASH_FIRE_FROZEN <= GEN_4 + && !(gBattleMons[battler].status1 & STATUS1_FREEZE) + #endif + ) { if (!(gBattleResources->flags->flags[battler] & RESOURCE_FLAG_FLASH_FIRE)) { @@ -6017,15 +6048,15 @@ u32 IsAbilityOnFieldExcept(u32 battlerId, u32 ability) u32 IsAbilityPreventingEscape(u32 battlerId) { u32 id; - #if B_GHOSTS_ESCAPE >= GEN_6 - if (IS_BATTLER_OF_TYPE(battlerId, TYPE_GHOST)) - return 0; - #endif - #if B_SHADOW_TAG_ESCAPE >= GEN_4 - if ((id = IsAbilityOnOpposingSide(battlerId, ABILITY_SHADOW_TAG)) && GetBattlerAbility(battlerId) != ABILITY_SHADOW_TAG) - #else - if (id = IsAbilityOnOpposingSide(battlerId, ABILITY_SHADOW_TAG)) - #endif +#if B_GHOSTS_ESCAPE >= GEN_6 + if (IS_BATTLER_OF_TYPE(battlerId, TYPE_GHOST)) + return 0; +#endif +#if B_SHADOW_TAG_ESCAPE >= GEN_4 + if ((id = IsAbilityOnOpposingSide(battlerId, ABILITY_SHADOW_TAG)) && GetBattlerAbility(battlerId) != ABILITY_SHADOW_TAG) +#else + if ((id = IsAbilityOnOpposingSide(battlerId, ABILITY_SHADOW_TAG))) +#endif return id; if ((id = IsAbilityOnOpposingSide(battlerId, ABILITY_ARENA_TRAP)) && IsBattlerGrounded(battlerId)) return id; @@ -6039,7 +6070,11 @@ bool32 CanBattlerEscape(u32 battlerId) // no ability check { if (GetBattlerHoldEffect(battlerId, TRUE) == HOLD_EFFECT_SHED_SHELL) return TRUE; - else if ((B_GHOSTS_ESCAPE >= GEN_6 && !IS_BATTLER_OF_TYPE(battlerId, TYPE_GHOST)) && gBattleMons[battlerId].status2 & (STATUS2_ESCAPE_PREVENTION | STATUS2_WRAPPED)) +#if B_GHOSTS_ESCAPE >= GEN_6 + else if (IS_BATTLER_OF_TYPE(battlerId, TYPE_GHOST)) + return TRUE; +#endif + else if (gBattleMons[battlerId].status2 & (STATUS2_ESCAPE_PREVENTION | STATUS2_WRAPPED)) return FALSE; else if (gStatuses3[battlerId] & STATUS3_ROOTED) return FALSE; @@ -6137,13 +6172,16 @@ bool32 CanBeBurned(u8 battlerId) bool32 CanBeParalyzed(u8 battlerId) { u16 ability = GetBattlerAbility(battlerId); - if ((B_PARALYZE_ELECTRIC >= GEN_6 && IS_BATTLER_OF_TYPE(battlerId, TYPE_ELECTRIC)) - || gSideStatuses[GetBattlerSide(battlerId)] & SIDE_STATUS_SAFEGUARD - || ability == ABILITY_LIMBER - || ability == ABILITY_COMATOSE - || gBattleMons[battlerId].status1 & STATUS1_ANY - || IsAbilityStatusProtected(battlerId) - || IsBattlerTerrainAffected(battlerId, STATUS_FIELD_MISTY_TERRAIN)) + if ( + #if B_PARALYZE_ELECTRIC >= GEN_6 + IS_BATTLER_OF_TYPE(battlerId, TYPE_ELECTRIC) || + #endif + gSideStatuses[GetBattlerSide(battlerId)] & SIDE_STATUS_SAFEGUARD + || ability == ABILITY_LIMBER + || ability == ABILITY_COMATOSE + || gBattleMons[battlerId].status1 & STATUS1_ANY + || IsAbilityStatusProtected(battlerId) + || IsBattlerTerrainAffected(battlerId, STATUS_FIELD_MISTY_TERRAIN)) return FALSE; return TRUE; } @@ -6205,11 +6243,11 @@ bool32 HasEnoughHpToEatBerry(u32 battlerId, u32 hpFraction, u32 itemId) static u8 HealConfuseBerry(u32 battlerId, u32 itemId, u8 flavorId, bool32 end2) { + if (HasEnoughHpToEatBerry(battlerId, CONFUSE_BERRY_HP_FRACTION, itemId) #if B_HEAL_BLOCKING >= GEN_5 - if (HasEnoughHpToEatBerry(battlerId, CONFUSE_BERRY_HP_FRACTION, itemId) && !(gStatuses3[battlerId] & STATUS3_HEAL_BLOCK)) -#else - if (HasEnoughHpToEatBerry(battlerId, CONFUSE_BERRY_HP_FRACTION, itemId)) + && !(gStatuses3[battlerId] & STATUS3_HEAL_BLOCK) #endif + ) { PREPARE_FLAVOR_BUFFER(gBattleTextBuff1, flavorId); @@ -6397,12 +6435,11 @@ u8 TryHandleSeed(u8 battler, u32 terrainFlag, u8 statId, u16 itemId, bool32 exec static u8 ItemHealHp(u32 battlerId, u32 itemId, bool32 end2, bool32 percentHeal) { -#if B_HEAL_BLOCKING >= GEN_5 - if (HasEnoughHpToEatBerry(battlerId, 2, itemId) && !(gStatuses3[battlerId] & STATUS3_HEAL_BLOCK) -#else - if (HasEnoughHpToEatBerry(battlerId, 2, itemId) -#endif - && !(gBattleScripting.overrideBerryRequirements && gBattleMons[battlerId].hp == gBattleMons[battlerId].maxHP)) + if (!(gBattleScripting.overrideBerryRequirements && gBattleMons[battlerId].hp == gBattleMons[battlerId].maxHP) + #if B_HEAL_BLOCKING >= GEN_5 + && !(gStatuses3[battlerId] & STATUS3_HEAL_BLOCK) + #endif + && HasEnoughHpToEatBerry(battlerId, 2, itemId)) { if (percentHeal) gBattleMoveDamage = (gBattleMons[battlerId].maxHP * GetBattlerHoldEffectParam(battlerId) / 100) * -1; @@ -6447,46 +6484,46 @@ static bool32 GetMentalHerbEffect(u8 battlerId) StringCopy(gBattleTextBuff1, gStatusConditionString_LoveJpn); ret = TRUE; } - #if B_MENTAL_HERB >= GEN_5 - // Check taunt - if (gDisableStructs[battlerId].tauntTimer != 0) - { - gDisableStructs[battlerId].tauntTimer = gDisableStructs[battlerId].tauntTimer2 = 0; - gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_MENTALHERBCURE_TAUNT; - PREPARE_MOVE_BUFFER(gBattleTextBuff1, MOVE_TAUNT); - ret = TRUE; - } - // Check encore - if (gDisableStructs[battlerId].encoreTimer != 0) - { - gDisableStructs[battlerId].encoredMove = 0; - gDisableStructs[battlerId].encoreTimerStartValue = gDisableStructs[battlerId].encoreTimer = 0; - gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_MENTALHERBCURE_ENCORE; // STRINGID_PKMNENCOREENDED - ret = TRUE; - } - // Check torment - if (gBattleMons[battlerId].status2 & STATUS2_TORMENT) - { - gBattleMons[battlerId].status2 &= ~STATUS2_TORMENT; - gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_MENTALHERBCURE_TORMENT; - ret = TRUE; - } - // Check heal block - if (gStatuses3[battlerId] & STATUS3_HEAL_BLOCK) - { - gStatuses3[battlerId] &= ~STATUS3_HEAL_BLOCK; - gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_MENTALHERBCURE_HEALBLOCK; - ret = TRUE; - } - // Check disable - if (gDisableStructs[battlerId].disableTimer != 0) - { - gDisableStructs[battlerId].disableTimer = gDisableStructs[battlerId].disableTimerStartValue = 0; - gDisableStructs[battlerId].disabledMove = 0; - gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_MENTALHERBCURE_DISABLE; - ret = TRUE; - } - #endif +#if B_MENTAL_HERB >= GEN_5 + // Check taunt + if (gDisableStructs[battlerId].tauntTimer != 0) + { + gDisableStructs[battlerId].tauntTimer = gDisableStructs[battlerId].tauntTimer2 = 0; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_MENTALHERBCURE_TAUNT; + PREPARE_MOVE_BUFFER(gBattleTextBuff1, MOVE_TAUNT); + ret = TRUE; + } + // Check encore + if (gDisableStructs[battlerId].encoreTimer != 0) + { + gDisableStructs[battlerId].encoredMove = 0; + gDisableStructs[battlerId].encoreTimerStartValue = gDisableStructs[battlerId].encoreTimer = 0; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_MENTALHERBCURE_ENCORE; // STRINGID_PKMNENCOREENDED + ret = TRUE; + } + // Check torment + if (gBattleMons[battlerId].status2 & STATUS2_TORMENT) + { + gBattleMons[battlerId].status2 &= ~STATUS2_TORMENT; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_MENTALHERBCURE_TORMENT; + ret = TRUE; + } + // Check heal block + if (gStatuses3[battlerId] & STATUS3_HEAL_BLOCK) + { + gStatuses3[battlerId] &= ~STATUS3_HEAL_BLOCK; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_MENTALHERBCURE_HEALBLOCK; + ret = TRUE; + } + // Check disable + if (gDisableStructs[battlerId].disableTimer != 0) + { + gDisableStructs[battlerId].disableTimer = gDisableStructs[battlerId].disableTimerStartValue = 0; + gDisableStructs[battlerId].disabledMove = 0; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_MENTALHERBCURE_DISABLE; + ret = TRUE; + } +#endif return ret; } @@ -6537,48 +6574,39 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) BattleScriptExecute(BattleScript_WhiteHerbEnd2); } break; + #if B_BERRIES_INSTANT >= GEN_4 case HOLD_EFFECT_CONFUSE_SPICY: - if (B_BERRIES_INSTANT >= GEN_4) - effect = HealConfuseBerry(battlerId, gLastUsedItem, FLAVOR_SPICY, TRUE); + effect = HealConfuseBerry(battlerId, gLastUsedItem, FLAVOR_SPICY, TRUE); break; case HOLD_EFFECT_CONFUSE_DRY: - if (B_BERRIES_INSTANT >= GEN_4) - effect = HealConfuseBerry(battlerId, gLastUsedItem, FLAVOR_DRY, TRUE); + effect = HealConfuseBerry(battlerId, gLastUsedItem, FLAVOR_DRY, TRUE); break; case HOLD_EFFECT_CONFUSE_SWEET: - if (B_BERRIES_INSTANT >= GEN_4) - effect = HealConfuseBerry(battlerId, gLastUsedItem, FLAVOR_SWEET, TRUE); + effect = HealConfuseBerry(battlerId, gLastUsedItem, FLAVOR_SWEET, TRUE); break; case HOLD_EFFECT_CONFUSE_BITTER: - if (B_BERRIES_INSTANT >= GEN_4) - effect = HealConfuseBerry(battlerId, gLastUsedItem, FLAVOR_BITTER, TRUE); + effect = HealConfuseBerry(battlerId, gLastUsedItem, FLAVOR_BITTER, TRUE); break; case HOLD_EFFECT_CONFUSE_SOUR: - if (B_BERRIES_INSTANT >= GEN_4) - effect = HealConfuseBerry(battlerId, gLastUsedItem, FLAVOR_SOUR, TRUE); + effect = HealConfuseBerry(battlerId, gLastUsedItem, FLAVOR_SOUR, TRUE); break; case HOLD_EFFECT_ATTACK_UP: - if (B_BERRIES_INSTANT >= GEN_4) - effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_ATK, TRUE); + effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_ATK, TRUE); break; case HOLD_EFFECT_DEFENSE_UP: - if (B_BERRIES_INSTANT >= GEN_4) - effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_DEF, TRUE); + effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_DEF, TRUE); break; case HOLD_EFFECT_SPEED_UP: - if (B_BERRIES_INSTANT >= GEN_4) - effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_SPEED, TRUE); + effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_SPEED, TRUE); break; case HOLD_EFFECT_SP_ATTACK_UP: - if (B_BERRIES_INSTANT >= GEN_4) - effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_SPATK, TRUE); + effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_SPATK, TRUE); break; case HOLD_EFFECT_SP_DEFENSE_UP: - if (B_BERRIES_INSTANT >= GEN_4) - effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_SPDEF, TRUE); + effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_SPDEF, TRUE); break; case HOLD_EFFECT_CRITICAL_UP: - if (B_BERRIES_INSTANT >= GEN_4 && !(gBattleMons[battlerId].status2 & STATUS2_FOCUS_ENERGY) && HasEnoughHpToEatBerry(battlerId, GetBattlerHoldEffectParam(battlerId), gLastUsedItem)) + if (!(gBattleMons[battlerId].status2 & STATUS2_FOCUS_ENERGY) && HasEnoughHpToEatBerry(battlerId, GetBattlerHoldEffectParam(battlerId), gLastUsedItem)) { gBattleMons[battlerId].status2 |= STATUS2_FOCUS_ENERGY; BattleScriptExecute(BattleScript_BerryFocusEnergyEnd2); @@ -6586,11 +6614,10 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) } break; case HOLD_EFFECT_RANDOM_STAT_UP: - if (B_BERRIES_INSTANT >= GEN_4) - effect = RandomStatRaiseBerry(battlerId, gLastUsedItem, TRUE); + effect = RandomStatRaiseBerry(battlerId, gLastUsedItem, TRUE); break; case HOLD_EFFECT_CURE_PAR: - if (B_BERRIES_INSTANT >= GEN_4 && gBattleMons[battlerId].status1 & STATUS1_PARALYSIS && !UnnerveOn(battlerId, gLastUsedItem)) + if (gBattleMons[battlerId].status1 & STATUS1_PARALYSIS && !UnnerveOn(battlerId, gLastUsedItem)) { gBattleMons[battlerId].status1 &= ~STATUS1_PARALYSIS; BattleScriptExecute(BattleScript_BerryCurePrlzEnd2); @@ -6598,7 +6625,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) } break; case HOLD_EFFECT_CURE_PSN: - if (B_BERRIES_INSTANT >= GEN_4 && gBattleMons[battlerId].status1 & STATUS1_PSN_ANY && !UnnerveOn(battlerId, gLastUsedItem)) + if (gBattleMons[battlerId].status1 & STATUS1_PSN_ANY && !UnnerveOn(battlerId, gLastUsedItem)) { gBattleMons[battlerId].status1 &= ~(STATUS1_PSN_ANY | STATUS1_TOXIC_COUNTER); BattleScriptExecute(BattleScript_BerryCurePsnEnd2); @@ -6606,7 +6633,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) } break; case HOLD_EFFECT_CURE_BRN: - if (B_BERRIES_INSTANT >= GEN_4 && gBattleMons[battlerId].status1 & STATUS1_BURN && !UnnerveOn(battlerId, gLastUsedItem)) + if (gBattleMons[battlerId].status1 & STATUS1_BURN && !UnnerveOn(battlerId, gLastUsedItem)) { gBattleMons[battlerId].status1 &= ~STATUS1_BURN; BattleScriptExecute(BattleScript_BerryCureBrnEnd2); @@ -6614,7 +6641,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) } break; case HOLD_EFFECT_CURE_FRZ: - if (B_BERRIES_INSTANT >= GEN_4 && gBattleMons[battlerId].status1 & STATUS1_FREEZE && !UnnerveOn(battlerId, gLastUsedItem)) + if (gBattleMons[battlerId].status1 & STATUS1_FREEZE && !UnnerveOn(battlerId, gLastUsedItem)) { gBattleMons[battlerId].status1 &= ~STATUS1_FREEZE; BattleScriptExecute(BattleScript_BerryCureFrzEnd2); @@ -6622,7 +6649,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) } break; case HOLD_EFFECT_CURE_SLP: - if (B_BERRIES_INSTANT >= GEN_4 && gBattleMons[battlerId].status1 & STATUS1_SLEEP && !UnnerveOn(battlerId, gLastUsedItem)) + if (gBattleMons[battlerId].status1 & STATUS1_SLEEP && !UnnerveOn(battlerId, gLastUsedItem)) { gBattleMons[battlerId].status1 &= ~STATUS1_SLEEP; gBattleMons[battlerId].status2 &= ~STATUS2_NIGHTMARE; @@ -6631,7 +6658,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) } break; case HOLD_EFFECT_CURE_STATUS: - if (B_BERRIES_INSTANT >= GEN_4 && (gBattleMons[battlerId].status1 & STATUS1_ANY || gBattleMons[battlerId].status2 & STATUS2_CONFUSION) && !UnnerveOn(battlerId, gLastUsedItem)) + if ((gBattleMons[battlerId].status1 & STATUS1_ANY || gBattleMons[battlerId].status2 & STATUS2_CONFUSION) && !UnnerveOn(battlerId, gLastUsedItem)) { i = 0; if (gBattleMons[battlerId].status1 & STATUS1_PSN_ANY) @@ -6676,13 +6703,12 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) } break; case HOLD_EFFECT_RESTORE_HP: - if (B_BERRIES_INSTANT >= GEN_4) - effect = ItemHealHp(battlerId, gLastUsedItem, TRUE, FALSE); + effect = ItemHealHp(battlerId, gLastUsedItem, TRUE, FALSE); break; case HOLD_EFFECT_RESTORE_PCT_HP: - if (B_BERRIES_INSTANT >= GEN_4) - effect = ItemHealHp(battlerId, gLastUsedItem, TRUE, TRUE); + effect = ItemHealHp(battlerId, gLastUsedItem, TRUE, TRUE); break; + #endif case HOLD_EFFECT_AIR_BALLOON: effect = ITEM_EFFECT_OTHER; gBattleScripting.battler = battlerId; @@ -7043,62 +7069,52 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) DO_ITEMEFFECT_MOVE_END: switch (battlerHoldEffect) { + #if B_HP_BERRIES >= GEN_4 case HOLD_EFFECT_MICLE_BERRY: - if (B_HP_BERRIES >= GEN_4) - effect = TrySetMicleBerry(battlerId, gLastUsedItem, FALSE); + effect = TrySetMicleBerry(battlerId, gLastUsedItem, FALSE); break; case HOLD_EFFECT_RESTORE_HP: - if (B_HP_BERRIES >= GEN_4) - effect = ItemHealHp(battlerId, gLastUsedItem, FALSE, FALSE); + effect = ItemHealHp(battlerId, gLastUsedItem, FALSE, FALSE); break; + #endif + #if B_BERRIES_INSTANT >= GEN_4 case HOLD_EFFECT_RESTORE_PCT_HP: - if (B_BERRIES_INSTANT >= GEN_4) - effect = ItemHealHp(battlerId, gLastUsedItem, FALSE, TRUE); + effect = ItemHealHp(battlerId, gLastUsedItem, FALSE, TRUE); break; case HOLD_EFFECT_CONFUSE_SPICY: - if (B_BERRIES_INSTANT >= GEN_4) - effect = HealConfuseBerry(battlerId, gLastUsedItem, FLAVOR_SPICY, FALSE); + effect = HealConfuseBerry(battlerId, gLastUsedItem, FLAVOR_SPICY, FALSE); break; case HOLD_EFFECT_CONFUSE_DRY: - if (B_BERRIES_INSTANT >= GEN_4) - effect = HealConfuseBerry(battlerId, gLastUsedItem, FLAVOR_DRY, FALSE); + effect = HealConfuseBerry(battlerId, gLastUsedItem, FLAVOR_DRY, FALSE); break; case HOLD_EFFECT_CONFUSE_SWEET: - if (B_BERRIES_INSTANT >= GEN_4) - effect = HealConfuseBerry(battlerId, gLastUsedItem, FLAVOR_SWEET, FALSE); + effect = HealConfuseBerry(battlerId, gLastUsedItem, FLAVOR_SWEET, FALSE); break; case HOLD_EFFECT_CONFUSE_BITTER: - if (B_BERRIES_INSTANT >= GEN_4) - effect = HealConfuseBerry(battlerId, gLastUsedItem, FLAVOR_BITTER, FALSE); + effect = HealConfuseBerry(battlerId, gLastUsedItem, FLAVOR_BITTER, FALSE); break; case HOLD_EFFECT_CONFUSE_SOUR: - if (B_BERRIES_INSTANT >= GEN_4) - effect = HealConfuseBerry(battlerId, gLastUsedItem, FLAVOR_SOUR, FALSE); + effect = HealConfuseBerry(battlerId, gLastUsedItem, FLAVOR_SOUR, FALSE); break; case HOLD_EFFECT_ATTACK_UP: - if (B_BERRIES_INSTANT >= GEN_4) - effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_ATK, FALSE); + effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_ATK, FALSE); break; case HOLD_EFFECT_DEFENSE_UP: - if (B_BERRIES_INSTANT >= GEN_4) - effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_DEF, FALSE); + effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_DEF, FALSE); break; case HOLD_EFFECT_SPEED_UP: - if (B_BERRIES_INSTANT >= GEN_4) - effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_SPEED, FALSE); + effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_SPEED, FALSE); break; case HOLD_EFFECT_SP_ATTACK_UP: - if (B_BERRIES_INSTANT >= GEN_4) - effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_SPATK, FALSE); + effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_SPATK, FALSE); break; case HOLD_EFFECT_SP_DEFENSE_UP: - if (B_BERRIES_INSTANT >= GEN_4) - effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_SPDEF, FALSE); + effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_SPDEF, FALSE); break; case HOLD_EFFECT_RANDOM_STAT_UP: - if (B_BERRIES_INSTANT >= GEN_4) - effect = RandomStatRaiseBerry(battlerId, gLastUsedItem, FALSE); + effect = RandomStatRaiseBerry(battlerId, gLastUsedItem, FALSE); break; + #endif case HOLD_EFFECT_CURE_PAR: if (gBattleMons[battlerId].status1 & STATUS1_PARALYSIS && !UnnerveOn(battlerId, gLastUsedItem)) { @@ -7232,10 +7248,10 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) switch (atkHoldEffect) { case HOLD_EFFECT_FLINCH: - #if B_SERENE_GRACE_BOOST >= GEN_5 - if (GetBattlerAbility(gBattlerAttacker) == ABILITY_SERENE_GRACE) - atkHoldEffectParam *= 2; - #endif + #if B_SERENE_GRACE_BOOST >= GEN_5 + if (GetBattlerAbility(gBattlerAttacker) == ABILITY_SERENE_GRACE) + atkHoldEffectParam *= 2; + #endif if (gBattleMoveDamage != 0 // Need to have done damage && !(gMoveResultFlags & MOVE_RESULT_NO_EFFECT) && TARGET_TURN_DAMAGED @@ -7781,9 +7797,12 @@ u32 GetBattlerHoldEffect(u8 battlerId, bool32 checkNegating) gPotentialItemEffectBattler = battlerId; - if (B_ENABLE_DEBUG && gBattleStruct->debugHoldEffects[battlerId] != 0 && gBattleMons[battlerId].item) +#if B_ENABLE_DEBUG == TRUE + if (gBattleStruct->debugHoldEffects[battlerId] != 0 && gBattleMons[battlerId].item) return gBattleStruct->debugHoldEffects[battlerId]; - else if (gBattleMons[battlerId].item == ITEM_ENIGMA_BERRY) + else +#endif + if (gBattleMons[battlerId].item == ITEM_ENIGMA_BERRY) return gEnigmaBerries[battlerId].holdEffect; else return ItemId_GetHoldEffect(gBattleMons[battlerId].item); @@ -8117,7 +8136,7 @@ static u16 CalcMoveBasePower(u16 move, u8 battlerAtk, u8 battlerDef) // todo break; case EFFECT_FLING: - basePower = ItemId_GetFlingPower(gBattleMons[battlerAtk].item); + basePower = GetFlingPowerFromItemId(gBattleMons[battlerAtk].item); break; case EFFECT_ERUPTION: basePower = gBattleMons[battlerAtk].hp * basePower / gBattleMons[battlerAtk].maxHP; @@ -8261,7 +8280,10 @@ static u16 CalcMoveBasePower(u16 move, u8 battlerAtk, u8 battlerDef) break; case EFFECT_PAYBACK: if (GetBattlerTurnOrderNum(battlerAtk) > GetBattlerTurnOrderNum(battlerDef) - && (gDisableStructs[battlerDef].isFirstTurn != 2 || B_PAYBACK_SWITCH_BOOST < GEN_5)) + #if B_PAYBACK_SWITCH_BOOST >= GEN_5 + && (gDisableStructs[battlerDef].isFirstTurn != 2) + #endif + ) basePower *= 2; break; case EFFECT_BOLT_BEAK: @@ -8547,11 +8569,11 @@ static u32 CalcMoveBasePowerAfterModifiers(u16 move, u8 battlerAtk, u8 battlerDe MulModifier(&modifier, holdEffectModifier); break; case HOLD_EFFECT_SOUL_DEW: - #if B_SOUL_DEW_BOOST >= GEN_7 + #if B_SOUL_DEW_BOOST >= GEN_7 if ((gBattleMons[battlerAtk].species == SPECIES_LATIAS || gBattleMons[battlerAtk].species == SPECIES_LATIOS) && (moveType == TYPE_PSYCHIC || moveType == TYPE_DRAGON)) - #else + #else if ((gBattleMons[battlerAtk].species == SPECIES_LATIAS || gBattleMons[battlerAtk].species == SPECIES_LATIOS) && !(gBattleTypeFlags & BATTLE_TYPE_FRONTIER) && IS_MOVE_SPECIAL(move)) - #endif + #endif MulModifier(&modifier, holdEffectModifier); break; case HOLD_EFFECT_GEMS: @@ -8634,6 +8656,12 @@ static u32 CalcMoveBasePowerAfterModifiers(u16 move, u8 battlerAtk, u8 battlerDe break; } +#if B_TERRAIN_TYPE_BOOST >= GEN_8 + #define TERRAIN_TYPE_BOOST UQ_4_12(1.3) +#else + #define TERRAIN_TYPE_BOOST UQ_4_12(1.5) +#endif + // various effecs if (gProtectStructs[battlerAtk].helpingHand) MulModifier(&modifier, UQ_4_12(1.5)); @@ -8642,24 +8670,28 @@ static u32 CalcMoveBasePowerAfterModifiers(u16 move, u8 battlerAtk, u8 battlerDe if (gStatuses3[battlerAtk] & STATUS3_ME_FIRST) MulModifier(&modifier, UQ_4_12(1.5)); if (gFieldStatuses & STATUS_FIELD_GRASSY_TERRAIN && moveType == TYPE_GRASS && IsBattlerGrounded(battlerAtk) && !(gStatuses3[battlerAtk] & STATUS3_SEMI_INVULNERABLE)) - MulModifier(&modifier, (B_TERRAIN_TYPE_BOOST >= GEN_8) ? UQ_4_12(1.3) : UQ_4_12(1.5)); + MulModifier(&modifier, TERRAIN_TYPE_BOOST); if (gFieldStatuses & STATUS_FIELD_MISTY_TERRAIN && moveType == TYPE_DRAGON && IsBattlerGrounded(battlerDef) && !(gStatuses3[battlerDef] & STATUS3_SEMI_INVULNERABLE)) MulModifier(&modifier, UQ_4_12(0.5)); if (gFieldStatuses & STATUS_FIELD_ELECTRIC_TERRAIN && moveType == TYPE_ELECTRIC && IsBattlerGrounded(battlerAtk) && !(gStatuses3[battlerAtk] & STATUS3_SEMI_INVULNERABLE)) - MulModifier(&modifier, (B_TERRAIN_TYPE_BOOST >= GEN_8) ? UQ_4_12(1.3) : UQ_4_12(1.5)); + MulModifier(&modifier, TERRAIN_TYPE_BOOST); if (gFieldStatuses & STATUS_FIELD_PSYCHIC_TERRAIN && moveType == TYPE_PSYCHIC && IsBattlerGrounded(battlerAtk) && !(gStatuses3[battlerAtk] & STATUS3_SEMI_INVULNERABLE)) - MulModifier(&modifier, (B_TERRAIN_TYPE_BOOST >= GEN_8) ? UQ_4_12(1.3) : UQ_4_12(1.5)); + MulModifier(&modifier, TERRAIN_TYPE_BOOST); #if B_SPORT_TURNS >= GEN_6 - if ((gFieldStatuses & STATUS_FIELD_MUDSPORT && moveType == TYPE_ELECTRIC) - || (gFieldStatuses & STATUS_FIELD_WATERSPORT && moveType == TYPE_FIRE)) - MulModifier(&modifier, (B_SPORT_DMG_REDUCTION >= GEN_5) ? UQ_4_12(0.23) : UQ_4_12(0.5)); + if ((moveType == TYPE_ELECTRIC && gFieldStatuses & STATUS_FIELD_MUDSPORT) + || (moveType == TYPE_FIRE && gFieldStatuses & STATUS_FIELD_WATERSPORT)) #else if ((moveType == TYPE_ELECTRIC && AbilityBattleEffects(ABILITYEFFECT_FIELD_SPORT, 0, 0, ABILITYEFFECT_MUD_SPORT, 0)) - || (moveType == TYPE_FIRE && AbilityBattleEffects(ABILITYEFFECT_FIELD_SPORT, 0, 0, ABILITYEFFECT_WATER_SPORT, 0))) - MulModifier(&modifier, (B_SPORT_DMG_REDUCTION >= GEN_5) ? UQ_4_12(0.23) : UQ_4_12(0.5)); + || (moveType == TYPE_FIRE && AbilityBattleEffects(ABILITYEFFECT_FIELD_SPORT, 0, 0, ABILITYEFFECT_WATER_SPORT, 0))) + #endif + #if B_SPORT_DMG_REDUCTION >= GEN_5 + MulModifier(&modifier, UQ_4_12(0.23)); + #else + MulModifier(&modifier, UQ_4_12(0.5)); #endif return ApplyModifier(modifier, basePower); } +#undef TERRAIN_TYPE_BOOST static u32 CalcAttackStat(u16 move, u8 battlerAtk, u8 battlerDef, u8 moveType, bool32 isCrit, bool32 updateFlags) { @@ -9035,11 +9067,17 @@ static u32 CalcFinalDmg(u32 dmg, u16 move, u8 battlerAtk, u8 battlerDef, u8 move // check crit if (isCrit) - dmg = ApplyModifier((B_CRIT_MULTIPLIER >= GEN_6 ? UQ_4_12(1.5) : UQ_4_12(2.0)), dmg); + #if B_CRIT_MULTIPLIER >= GEN_6 + dmg = ApplyModifier(UQ_4_12(1.5), dmg); + #else + dmg = ApplyModifier(UQ_4_12(2.0), dmg); + #endif // check burn if (gBattleMons[battlerAtk].status1 & STATUS1_BURN && IS_MOVE_PHYSICAL(move) - && (gBattleMoves[move].effect != EFFECT_FACADE || B_BURN_FACADE_DMG < GEN_6) + #if B_BURN_FACADE_DMG >= GEN_6 + && gBattleMoves[move].effect != EFFECT_FACADE + #endif && abilityAtk != ABILITY_GUTS) dmg = ApplyModifier(UQ_4_12(0.5), dmg); @@ -9313,14 +9351,18 @@ static u16 CalcTypeEffectivenessMultiplierInternal(u16 move, u8 moveType, u8 bat RecordAbilityBattle(battlerDef, ABILITY_LEVITATE); } } - else if (B_SHEER_COLD_IMMUNITY >= GEN_7 && move == MOVE_SHEER_COLD && IS_BATTLER_OF_TYPE(battlerDef, TYPE_ICE)) +#if B_SHEER_COLD_IMMUNITY >= GEN_7 + else if (move == MOVE_SHEER_COLD && IS_BATTLER_OF_TYPE(battlerDef, TYPE_ICE)) { modifier = UQ_4_12(0.0); } - else if (B_GLARE_GHOST >= GEN_4 && move == MOVE_GLARE && IS_BATTLER_OF_TYPE(battlerDef, TYPE_GHOST)) +#endif +#if B_GLARE_GHOST >= GEN_4 + else if (move == MOVE_GLARE && IS_BATTLER_OF_TYPE(battlerDef, TYPE_GHOST)) { modifier = UQ_4_12(1.0); } +#endif // Thousand Arrows ignores type modifiers for flying mons if (!IsBattlerGrounded(battlerDef) && (gBattleMoves[move].flags & FLAG_DMG_UNGROUNDED_IGNORE_TYPE_IF_FLYING) @@ -9386,10 +9428,11 @@ u16 CalcPartyMonTypeEffectivenessMultiplier(u16 move, u16 speciesDef, u16 abilit u16 GetTypeModifier(u8 atkType, u8 defType) { - if (B_FLAG_INVERSE_BATTLE != 0 && FlagGet(B_FLAG_INVERSE_BATTLE)) +#if B_FLAG_INVERSE_BATTLE != 0 + if (FlagGet(B_FLAG_INVERSE_BATTLE)) return sInverseTypeEffectivenessTable[atkType][defType]; - else - return sTypeEffectivenessTable[atkType][defType]; +#endif + return sTypeEffectivenessTable[atkType][defType]; } s32 GetStealthHazardDamage(u8 hazardType, u8 battlerId) @@ -9535,9 +9578,12 @@ bool32 CanMegaEvolve(u8 battlerId) // Check if there is an entry in the evolution table for regular Mega Evolution. if (GetMegaEvolutionSpecies(species, itemId) != SPECIES_NONE) { + #if B_ENABLE_DEBUG == TRUE if (B_ENABLE_DEBUG && gBattleStruct->debugHoldEffects[battlerId]) holdEffect = gBattleStruct->debugHoldEffects[battlerId]; - else if (itemId == ITEM_ENIGMA_BERRY_E_READER) + else + #endif + if (itemId == ITEM_ENIGMA_BERRY_E_READER) holdEffect = gEnigmaBerries[battlerId].holdEffect; else holdEffect = ItemId_GetHoldEffect(itemId); @@ -9738,9 +9784,8 @@ bool32 SetIllusionMon(struct Pokemon *mon, u32 battlerId) bool8 ShouldGetStatBadgeBoost(u16 badgeFlag, u8 battlerId) { - if (B_BADGE_BOOST != GEN_3) - return FALSE; - else if (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_EREADER_TRAINER | BATTLE_TYPE_RECORDED_LINK | BATTLE_TYPE_FRONTIER)) +#if B_BADGE_BOOST != GEN_3 + if (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_EREADER_TRAINER | BATTLE_TYPE_RECORDED_LINK | BATTLE_TYPE_FRONTIER)) return FALSE; else if (GetBattlerSide(battlerId) != B_SIDE_PLAYER) return FALSE; @@ -9748,8 +9793,8 @@ bool8 ShouldGetStatBadgeBoost(u16 badgeFlag, u8 battlerId) return FALSE; else if (FlagGet(badgeFlag)) return TRUE; - else - return FALSE; +#endif + return FALSE; } u8 GetBattleMoveSplit(u32 moveId) @@ -9758,12 +9803,17 @@ u8 GetBattleMoveSplit(u32 moveId) return gBattleStruct->zmove.activeSplit; if (gBattleStruct != NULL && gBattleStruct->swapDamageCategory) // Photon Geyser, Shell Side Arm, Light That Burns the Sky return SPLIT_PHYSICAL; - else if (IS_MOVE_STATUS(moveId) || B_PHYSICAL_SPECIAL_SPLIT >= GEN_4) - return gBattleMoves[moveId].split; + +#if B_PHYSICAL_SPECIAL_SPLIT >= GEN_4 + return gBattleMoves[moveId].split; +#else + if (IS_MOVE_STATUS(moveId)) + return SPLIT_STATUS; else if (gBattleMoves[moveId].type < TYPE_MYSTERY) return SPLIT_PHYSICAL; else return SPLIT_SPECIAL; +#endif } static bool32 TryRemoveScreens(u8 battler) @@ -9840,6 +9890,19 @@ struct Pokemon *GetBattlerPartyData(u8 battlerId) return mon; } +static u8 GetFlingPowerFromItemId(u16 itemId) +{ + if (itemId >= ITEM_TM01 && itemId <= ITEM_HM08) + { + u8 power = gBattleMoves[ItemIdToBattleMoveId(itemId)].power; + if (power > 1) + return power; + return 10; // Status moves and moves with variable power always return 10 power. + } + else + return ItemId_GetFlingPower(itemId); +} + // Make sure the input bank is any bank on the specific mon's side bool32 CanFling(u8 battlerId) { @@ -9852,7 +9915,7 @@ bool32 CanFling(u8 battlerId) #endif || gFieldStatuses & STATUS_FIELD_MAGIC_ROOM || gDisableStructs[battlerId].embargoTimer != 0 - || ItemId_GetFlingPower(item) != 0 + || GetFlingPowerFromItemId(item) != 0 || !CanBattlerGetOrLoseItem(battlerId, item)) return FALSE; @@ -10008,7 +10071,7 @@ bool32 CanStealItem(u8 battlerStealing, u8 battlerItem, u16 item) | BATTLE_TYPE_LINK | BATTLE_TYPE_RECORDED_LINK | BATTLE_TYPE_SECRET_BASE - #if B_TRAINERS_KNOCK_OFF_ITEMS + #if B_TRAINERS_KNOCK_OFF_ITEMS == TRUE | BATTLE_TYPE_TRAINER #endif ))) @@ -10037,14 +10100,14 @@ void TrySaveExchangedItem(u8 battlerId, u16 stolenItem) { // Because BtlController_EmitSetMonData does SetMonData, we need to save the stolen item only if it matches the battler's original // So, if the player steals an item during battle and has it stolen from it, it will not end the battle with it (naturally) - #if B_TRAINERS_KNOCK_OFF_ITEMS == TRUE +#if B_TRAINERS_KNOCK_OFF_ITEMS == TRUE // If regular trainer battle and mon's original item matches what is being stolen, save it to be restored at end of battle if (gBattleTypeFlags & BATTLE_TYPE_TRAINER && !(gBattleTypeFlags & BATTLE_TYPE_FRONTIER) && GetBattlerSide(battlerId) == B_SIDE_PLAYER && stolenItem == gBattleStruct->itemStolen[gBattlerPartyIndexes[battlerId]].originalItem) gBattleStruct->itemStolen[gBattlerPartyIndexes[battlerId]].stolen = TRUE; - #endif +#endif } bool32 IsBattlerAffectedByHazards(u8 battlerId, bool32 toxicSpikes) diff --git a/src/battle_z_move.c b/src/battle_z_move.c index efa1e6e18cb3..d41e28ac23ad 100644 --- a/src/battle_z_move.c +++ b/src/battle_z_move.c @@ -58,7 +58,6 @@ static u8 GetZMoveScore(u8 battlerAtk, u8 battlerDef, u16 baseMove, u16 zMove); // Const Data static const struct SignatureZMove sSignatureZMoves[] = { -// #ifdef NEW_POKEMON {SPECIES_PIKACHU_COSPLAY, ITEM_PIKANIUM_Z, MOVE_VOLT_TACKLE, MOVE_CATASTROPIKA}, {SPECIES_PIKACHU_ROCK_STAR, ITEM_PIKANIUM_Z, MOVE_VOLT_TACKLE, MOVE_CATASTROPIKA}, {SPECIES_PIKACHU_BELLE, ITEM_PIKANIUM_Z, MOVE_VOLT_TACKLE, MOVE_CATASTROPIKA}, @@ -95,7 +94,6 @@ static const struct SignatureZMove sSignatureZMoves[] = {SPECIES_TAPU_LELE, ITEM_TAPUNIUM_Z, MOVE_NATURES_MADNESS, MOVE_GUARDIAN_OF_ALOLA}, {SPECIES_TAPU_FINI, ITEM_TAPUNIUM_Z, MOVE_NATURES_MADNESS, MOVE_GUARDIAN_OF_ALOLA}, {SPECIES_NECROZMA_ULTRA, ITEM_ULTRANECROZIUM_Z, MOVE_PHOTON_GEYSER, MOVE_LIGHT_THAT_BURNS_THE_SKY}, -// #endif {SPECIES_MEW, ITEM_MEWNIUM_Z, MOVE_PSYCHIC, MOVE_GENESIS_SUPERNOVA}, {SPECIES_PIKACHU, ITEM_PIKANIUM_Z, MOVE_VOLT_TACKLE, MOVE_CATASTROPIKA}, {SPECIES_EEVEE, ITEM_EEVIUM_Z, MOVE_LAST_RESORT, MOVE_EXTREME_EVOBOOST}, @@ -189,10 +187,13 @@ bool32 IsViableZMove(u8 battlerId, u16 move) if (IsPartnerMonFromSameTrainer(battlerId) && (mega->alreadyEvolved[partnerPosition] || (mega->toEvolve & gBitTable[BATTLE_PARTNER(battlerId)]))) return FALSE; // Partner has mega evolved or is about to mega evolve } - - if (B_ENABLE_DEBUG && gBattleStruct->debugHoldEffects[battlerId]) + +#if B_ENABLE_DEBUG == TRUE + if (gBattleStruct->debugHoldEffects[battlerId]) holdEffect = gBattleStruct->debugHoldEffects[battlerId]; - else if (item == ITEM_ENIGMA_BERRY) + else +#endif + if (item == ITEM_ENIGMA_BERRY) return FALSE; // HoldEffect = gEnigmaBerries[battlerId].holdEffect; else holdEffect = ItemId_GetHoldEffect(item); diff --git a/src/data/battle_anim.h b/src/data/battle_anim.h index 62f3802a5c82..b8fb8c0378d8 100644 --- a/src/data/battle_anim.h +++ b/src/data/battle_anim.h @@ -1014,16 +1014,16 @@ const struct CompressedSpriteSheet gBattleAnimPicTable[] = {gBattleAnimSpriteGfx_Pencil, 0x0200, ANIM_TAG_PENCIL}, {gBattleAnimSpriteGfx_AirWave, 0x0100, ANIM_TAG_AIR_WAVE}, {gBattleAnimSpriteGfx_Orb, 0x0200, ANIM_TAG_ORB}, - #if B_NEW_SWORD_PARTICLE +#if B_NEW_SWORD_PARTICLE {gBattleAnimSpriteGfx_NewSword, 0x0400, ANIM_TAG_SWORD}, - #else +#else {gBattleAnimSpriteGfx_Sword, 0x0400, ANIM_TAG_SWORD}, - #endif - #if B_NEW_LEECH_SEED_PARTICLE +#endif +#if B_NEW_LEECH_SEED_PARTICLE {gBattleAnimSpriteGfx_NewLeechSeed, 0x0180, ANIM_TAG_SEED}, - #else +#else {gBattleAnimSpriteGfx_Seed, 0x0180, ANIM_TAG_SEED}, - #endif +#endif {gBattleAnimSpriteGfx_Explosion6, 0x0800, ANIM_TAG_EXPLOSION_6}, {gBattleAnimSpriteGfx_PinkOrb, 0x0020, ANIM_TAG_PINK_ORB}, {gBattleAnimSpriteGfx_Gust, 0x0400, ANIM_TAG_GUST}, @@ -1046,11 +1046,11 @@ const struct CompressedSpriteSheet gBattleAnimPicTable[] = {gBattleAnimSpriteGfx_HitDuplicate, 0x0A00, ANIM_TAG_HIT_DUPLICATE}, {gBattleAnimSpriteGfx_Leer, 0x0A00, ANIM_TAG_LEER}, {gBattleAnimSpriteGfx_BlueBurst, 0x0A00, ANIM_TAG_BLUE_BURST}, - #if B_NEW_EMBER_PARTICLES +#if B_NEW_EMBER_PARTICLES {gBattleAnimSpriteGfx_NewEmbers, 0x0A00, ANIM_TAG_SMALL_EMBER}, - #else +#else {gBattleAnimSpriteGfx_SmallEmber, 0x0A00, ANIM_TAG_SMALL_EMBER}, - #endif +#endif {gBattleAnimSpriteGfx_GraySmoke, 0x0A00, ANIM_TAG_GRAY_SMOKE}, {gBattleAnimSpriteGfx_BlueStar, 0x0E00, ANIM_TAG_BLUE_STAR}, {gBattleAnimSpriteGfx_BubbleBurst, 0x0380, ANIM_TAG_BUBBLE_BURST}, @@ -1079,20 +1079,20 @@ const struct CompressedSpriteSheet gBattleAnimPicTable[] = {gBattleAnimSpriteGfx_RedFist, 0x0200, ANIM_TAG_RED_FIST}, {gBattleAnimSpriteGfx_SlamHit, 0x1000, ANIM_TAG_SLAM_HIT}, {gBattleAnimSpriteGfx_Ring, 0x0180, ANIM_TAG_RING}, - #if NEW_ROCKS_PARTICLE +#if NEW_ROCKS_PARTICLE {gBattleAnimSpriteGfx_NewRocks, 0x0C00, ANIM_TAG_ROCKS}, - #else +#else {gBattleAnimSpriteGfx_Rocks, 0x0C00, ANIM_TAG_ROCKS}, - #endif +#endif {gBattleAnimSpriteGfx_Z, 0x0100, ANIM_TAG_Z}, {gBattleAnimSpriteGfx_YellowUnk2, 0x0040, ANIM_TAG_YELLOW_UNK_2}, {gBattleAnimSpriteGfx_AirSlash, 0x0180, ANIM_TAG_AIR_SLASH}, {gBattleAnimSpriteGfx_SpinningGreenOrbs, 0x0800, ANIM_TAG_SPINNING_GREEN_ORBS}, - #if B_NEW_LEAF_PARTICLE +#if B_NEW_LEAF_PARTICLE {gBattleAnimSpriteGfx_NewLeaf, 0x0480, ANIM_TAG_LEAF}, - #else +#else {gBattleAnimSpriteGfx_Leaf, 0x0480, ANIM_TAG_LEAF}, - #endif +#endif {gBattleAnimSpriteGfx_Finger, 0x0200, ANIM_TAG_FINGER}, {gBattleAnimSpriteGfx_PoisonPowder, 0x0200, ANIM_TAG_POISON_POWDER}, {gBattleAnimSpriteGfx_BrownTriangle, 0x0100, ANIM_TAG_BROWN_TRIANGLE}, @@ -1156,11 +1156,11 @@ const struct CompressedSpriteSheet gBattleAnimPicTable[] = {gBattleAnimSpriteGfx_Shock2, 0x0600, ANIM_TAG_SHOCK_2}, {gBattleAnimSpriteGfx_ClosingEye2, 0x0200, ANIM_TAG_CLOSING_EYE_2}, {gBattleAnimSpriteGfx_MetalBall, 0x0080, ANIM_TAG_METAL_BALL}, - #if NEW_SUBSTITUTE_PARTICLE +#if NEW_SUBSTITUTE_PARTICLE {gBattleAnimSpriteGfx_NewSubstituteFront, 0x0200, ANIM_TAG_MONSTER_DOLL}, - #else +#else {gBattleAnimSpriteGfx_MonsterDoll, 0x0200, ANIM_TAG_MONSTER_DOLL}, - #endif +#endif {gBattleAnimSpriteGfx_Whirlwind, 0x0800, ANIM_TAG_WHIRLWIND}, {gBattleAnimSpriteGfx_Whirlwind2, 0x0080, ANIM_TAG_WHIRLWIND_2}, {gBattleAnimSpriteGfx_Explosion4, 0x0a00, ANIM_TAG_EXPLOSION_4}, @@ -1172,19 +1172,19 @@ const struct CompressedSpriteSheet gBattleAnimPicTable[] = {gBattleAnimSpriteGfx_CircleImpact, 0x0020, ANIM_TAG_CIRCLE_IMPACT}, {gBattleAnimSpriteGfx_Scratch, 0x0a00, ANIM_TAG_SCRATCH}, {gBattleAnimSpriteGfx_Cut, 0x0800, ANIM_TAG_CUT}, - #if B_NEW_TEETH_PARTICLE +#if B_NEW_TEETH_PARTICLE {gBattleAnimSpriteGfx_NewTeeth, 0x0800, ANIM_TAG_SHARP_TEETH}, - #else +#else {gBattleAnimSpriteGfx_SharpTeeth, 0x0800, ANIM_TAG_SHARP_TEETH}, - #endif +#endif {gBattleAnimSpriteGfx_RainbowRings, 0x00c0, ANIM_TAG_RAINBOW_RINGS}, {gBattleAnimSpriteGfx_IceCrystals, 0x01c0, ANIM_TAG_ICE_CRYSTALS}, {gBattleAnimSpriteGfx_IceSpikes, 0x0100, ANIM_TAG_ICE_SPIKES}, - #if B_NEW_HANDS_FEET_PARTICLE +#if B_NEW_HANDS_FEET_PARTICLE {gBattleAnimSpriteGfx_NewHandsAndFeet, 0x0800, ANIM_TAG_HANDS_AND_FEET}, - #else +#else {gBattleAnimSpriteGfx_HandsAndFeet, 0x0800, ANIM_TAG_HANDS_AND_FEET}, - #endif +#endif {gBattleAnimSpriteGfx_MistCloud, 0x0200, ANIM_TAG_MIST_CLOUD}, {gBattleAnimSpriteGfx_Clamp, 0x0800, ANIM_TAG_CLAMP}, {gBattleAnimSpriteGfx_Bubble, 0x0180, ANIM_TAG_BUBBLE}, @@ -1193,19 +1193,19 @@ const struct CompressedSpriteSheet gBattleAnimPicTable[] = {gBattleAnimSpriteGfx_WaterOrb, 0x0200, ANIM_TAG_WATER_ORB}, {gBattleAnimSpriteGfx_PoisonBubble, 0x0180, ANIM_TAG_POISON_BUBBLE}, {gBattleAnimSpriteGfx_ToxicBubble, 0x0400, ANIM_TAG_TOXIC_BUBBLE}, - #if B_NEW_SPIKES_PARTICLE +#if B_NEW_SPIKES_PARTICLE {gBattleAnimSpriteGfx_NewSpikes, 0x0080, ANIM_TAG_SPIKES}, - #else +#else {gBattleAnimSpriteGfx_Spikes, 0x0080, ANIM_TAG_SPIKES}, - #endif +#endif {gBattleAnimSpriteGfx_HornHit2, 0x0100, ANIM_TAG_HORN_HIT_2}, {gBattleAnimSpriteGfx_AirWave2, 0x0100, ANIM_TAG_AIR_WAVE_2}, {gBattleAnimSpriteGfx_SmallBubbles, 0x0140, ANIM_TAG_SMALL_BUBBLES}, - #if B_NEW_FLY_BUBBLE_PARTICLE +#if B_NEW_FLY_BUBBLE_PARTICLE {gBattleAnimSpriteGfx_NewFly, 0x0800, ANIM_TAG_ROUND_SHADOW}, - #else +#else {gBattleAnimSpriteGfx_RoundShadow, 0x0800, ANIM_TAG_ROUND_SHADOW}, - #endif +#endif {gBattleAnimSpriteGfx_Sunlight, 0x0200, ANIM_TAG_SUNLIGHT}, {gBattleAnimSpriteGfx_Spore, 0x0100, ANIM_TAG_SPORE}, {gBattleAnimSpriteGfx_Flower, 0x00a0, ANIM_TAG_FLOWER}, @@ -1236,11 +1236,11 @@ const struct CompressedSpriteSheet gBattleAnimPicTable[] = {gBattleAnimSpriteGfx_FocusEnergy, 0x0400, ANIM_TAG_FOCUS_ENERGY}, {gBattleAnimSpriteGfx_SphereToCube, 0x0a00, ANIM_TAG_SPHERE_TO_CUBE}, {gBattleAnimSpriteGfx_Tendrils, 0x1000, ANIM_TAG_TENDRILS}, - #if B_NEW_MEAN_LOOK_PARTICLE +#if B_NEW_MEAN_LOOK_PARTICLE {gBattleAnimSpriteGfx_NewEye, 0x0800, ANIM_TAG_EYE}, - #else +#else {gBattleAnimSpriteGfx_Eye, 0x0800, ANIM_TAG_EYE}, - #endif +#endif {gBattleAnimSpriteGfx_WhiteShadow, 0x0400, ANIM_TAG_WHITE_SHADOW}, {gBattleAnimSpriteGfx_TealAlert, 0x0200, ANIM_TAG_TEAL_ALERT}, {gBattleAnimSpriteGfx_OpeningEye, 0x0800, ANIM_TAG_OPENING_EYE}, @@ -1252,11 +1252,11 @@ const struct CompressedSpriteSheet gBattleAnimPicTable[] = {gBattleAnimSpriteGfx_Spiral, 0x0800, ANIM_TAG_SPIRAL}, {gBattleAnimSpriteGfx_SnoreZ, 0x0200, ANIM_TAG_SNORE_Z}, {gBattleAnimSpriteGfx_Explosion, 0x0800, ANIM_TAG_EXPLOSION}, - #if B_NEW_CURSE_NAIL_PARTICLE +#if B_NEW_CURSE_NAIL_PARTICLE {gBattleAnimSpriteGfx_NewNail, 0x0400, ANIM_TAG_NAIL}, - #else +#else {gBattleAnimSpriteGfx_Nail, 0x0400, ANIM_TAG_NAIL}, - #endif +#endif {gBattleAnimSpriteGfx_GhostlySpirit, 0x0200, ANIM_TAG_GHOSTLY_SPIRIT}, {gBattleAnimSpriteGfx_WarmRock, 0x0a80, ANIM_TAG_WARM_ROCK}, {gBattleAnimSpriteGfx_BreakingEgg, 0x0600, ANIM_TAG_BREAKING_EGG}, @@ -1283,11 +1283,11 @@ const struct CompressedSpriteSheet gBattleAnimPicTable[] = {gBattleAnimSpriteGfx_Roots, 0x0800, ANIM_TAG_ROOTS}, {gBattleAnimSpriteGfx_ItemBag, 0x0200, ANIM_TAG_ITEM_BAG}, {gBattleAnimSpriteGfx_JaggedMusicNote, 0x0400, ANIM_TAG_JAGGED_MUSIC_NOTE}, - #if B_NEW_BATON_PASS_BALL_PARTICLE +#if B_NEW_BATON_PASS_BALL_PARTICLE {gBattleAnimSpriteGfx_NewPokeball, 0x0080, ANIM_TAG_POKEBALL}, - #else +#else {gBattleAnimSpriteGfx_Pokeball, 0x0080, ANIM_TAG_POKEBALL}, - #endif +#endif {gBattleAnimSpriteGfx_Spotlight, 0x0800, ANIM_TAG_SPOTLIGHT}, {gBattleAnimSpriteGfx_LetterZ, 0x0200, ANIM_TAG_LETTER_Z}, {gBattleAnimSpriteGfx_RapidSpin, 0x0300, ANIM_TAG_RAPID_SPIN}, @@ -1302,11 +1302,11 @@ const struct CompressedSpriteSheet gBattleAnimPicTable[] = {gBattleAnimSpriteGfx_PinkPetal, 0x0080, ANIM_TAG_PINK_PETAL}, {gBattleAnimSpriteGfx_PainSplit, 0x0180, ANIM_TAG_PAIN_SPLIT}, {gBattleAnimSpriteGfx_Confetti, 0x0180, ANIM_TAG_CONFETTI}, - #if B_NEW_MORNING_SUN_STAR_PARTICLE +#if B_NEW_MORNING_SUN_STAR_PARTICLE {gBattleAnimSpriteGfx_NewGreenStar, 0x0200, ANIM_TAG_GREEN_STAR}, - #else +#else {gBattleAnimSpriteGfx_GreenStar, 0x0200, ANIM_TAG_GREEN_STAR}, - #endif +#endif {gBattleAnimSpriteGfx_PinkCloud, 0x0200, ANIM_TAG_PINK_CLOUD}, {gBattleAnimSpriteGfx_SweatDrop, 0x0020, ANIM_TAG_SWEAT_DROP}, {gBattleAnimSpriteGfx_GuardRing, 0x0400, ANIM_TAG_GUARD_RING}, @@ -1461,16 +1461,16 @@ const struct CompressedSpritePalette gBattleAnimPaletteTable[] = {gBattleAnimSpritePal_Pencil, ANIM_TAG_PENCIL}, {gBattleAnimSpritePal_AirWave, ANIM_TAG_AIR_WAVE}, {gBattleAnimSpritePal_Orb, ANIM_TAG_ORB}, - #if B_NEW_SWORD_PARTICLE +#if B_NEW_SWORD_PARTICLE {gBattleAnimSpritePal_NewSword, ANIM_TAG_SWORD}, - #else +#else {gBattleAnimSpritePal_Sword, ANIM_TAG_SWORD}, - #endif - #if B_NEW_LEECH_SEED_PARTICLE +#endif +#if B_NEW_LEECH_SEED_PARTICLE {gBattleAnimSpritePal_NewLeechSeed, ANIM_TAG_SEED}, - #else +#else {gBattleAnimSpritePal_Seed, ANIM_TAG_SEED}, - #endif +#endif {gBattleAnimSpritePal_Explosion6, ANIM_TAG_EXPLOSION_6}, {gBattleAnimSpritePal_PinkOrb, ANIM_TAG_PINK_ORB}, {gBattleAnimSpritePal_Gust, ANIM_TAG_GUST}, @@ -1484,11 +1484,11 @@ const struct CompressedSpritePalette gBattleAnimPaletteTable[] = {gBattleAnimSpritePal_BlackSmoke, ANIM_TAG_BLACK_BALL}, {gBattleAnimSpritePal_Conversion, ANIM_TAG_CONVERSION}, {gBattleAnimSpritePal_Glass, ANIM_TAG_GLASS}, - #if B_NEW_HORN_ATTACK_PARTICLE +#if B_NEW_HORN_ATTACK_PARTICLE {gBattleAnimSpritePal_NewHornHit, ANIM_TAG_HORN_HIT}, - #else +#else {gBattleAnimSpritePal_HornHit, ANIM_TAG_HORN_HIT}, - #endif +#endif {gBattleAnimSpritePal_Hit, ANIM_TAG_HIT}, {gBattleAnimSpritePal_Hit2, ANIM_TAG_HIT_2}, {gBattleAnimSpritePal_BlueShards, ANIM_TAG_BLUE_SHARDS}, @@ -1497,11 +1497,11 @@ const struct CompressedSpritePalette gBattleAnimPaletteTable[] = {gBattleAnimSpritePal_HitDuplicate, ANIM_TAG_HIT_DUPLICATE}, {gBattleAnimSpritePal_Leer, ANIM_TAG_LEER}, {gBattleAnimSpritePal_BlueBurst, ANIM_TAG_BLUE_BURST}, - #if B_NEW_EMBER_PARTICLES +#if B_NEW_EMBER_PARTICLES {gBattleAnimSpritePal_NewEmbers, ANIM_TAG_SMALL_EMBER}, - #else +#else {gBattleAnimSpritePal_SmallEmber, ANIM_TAG_SMALL_EMBER}, - #endif +#endif {gBattleAnimSpritePal_GraySmoke, ANIM_TAG_GRAY_SMOKE}, {gBattleAnimSpritePal_BlueStar, ANIM_TAG_BLUE_STAR}, {gBattleAnimSpritePal_BubbleBurst, ANIM_TAG_BUBBLE_BURST}, @@ -1530,20 +1530,20 @@ const struct CompressedSpritePalette gBattleAnimPaletteTable[] = {gBattleAnimSpritePal_HumanoidFoot, ANIM_TAG_RED_FIST}, {gBattleAnimSpritePal_SlamHit, ANIM_TAG_SLAM_HIT}, {gBattleAnimSpritePal_Ring, ANIM_TAG_RING}, - #if NEW_ROCKS_PARTICLE +#if NEW_ROCKS_PARTICLE {gBattleAnimSpritePal_NewRocks, ANIM_TAG_ROCKS}, - #else +#else {gBattleAnimSpritePal_Rocks, ANIM_TAG_ROCKS}, - #endif +#endif {gBattleAnimSpritePal_Z, ANIM_TAG_Z}, {gBattleAnimSpritePal_YellowUnk2, ANIM_TAG_YELLOW_UNK_2}, {gBattleAnimSpritePal_AirSlash, ANIM_TAG_AIR_SLASH}, {gBattleAnimSpritePal_SpinningGreenOrbs, ANIM_TAG_SPINNING_GREEN_ORBS}, - #if B_NEW_LEAF_PARTICLE +#if B_NEW_LEAF_PARTICLE {gBattleAnimSpritePal_NewLeaf, ANIM_TAG_LEAF}, - #else +#else {gBattleAnimSpritePal_Leaf, ANIM_TAG_LEAF}, - #endif +#endif {gBattleAnimSpritePal_Finger, ANIM_TAG_FINGER}, {gBattleAnimSpritePal_PoisonPowder, ANIM_TAG_POISON_POWDER}, {gBattleAnimSpritePal_BrownTriangle, ANIM_TAG_BROWN_TRIANGLE}, @@ -1607,11 +1607,11 @@ const struct CompressedSpritePalette gBattleAnimPaletteTable[] = {gBattleAnimSpritePal_Shock2, ANIM_TAG_SHOCK_2}, {gBattleAnimSpritePal_ClosingEye2, ANIM_TAG_CLOSING_EYE_2}, {gBattleAnimSpritePal_MetalBall, ANIM_TAG_METAL_BALL}, - #if NEW_SUBSTITUTE_PARTICLE +#if NEW_SUBSTITUTE_PARTICLE {gBattleAnimSpritePal_NewSubstituteFront, ANIM_TAG_MONSTER_DOLL}, - #else +#else {gBattleAnimSpritePal_MonsterDoll, ANIM_TAG_MONSTER_DOLL}, - #endif +#endif {gBattleAnimSpritePal_Whirlwind, ANIM_TAG_WHIRLWIND}, {gBattleAnimSpritePal_Whirlwind, ANIM_TAG_WHIRLWIND_2}, {gBattleAnimSpritePal_Explosion4, ANIM_TAG_EXPLOSION_4}, @@ -1619,27 +1619,27 @@ const struct CompressedSpritePalette gBattleAnimPaletteTable[] = {gBattleAnimSpritePal_Tongue, ANIM_TAG_TONGUE}, {gBattleAnimSpritePal_Smoke, ANIM_TAG_SMOKE}, {gBattleAnimSpritePal_Smoke, ANIM_TAG_SMOKE_2}, - #if B_NEW_IMPACT_PALETTE +#if B_NEW_IMPACT_PALETTE {gBattleAnimSpritePal_NewImpact, ANIM_TAG_IMPACT}, - #else +#else {gBattleAnimSpritePal_Impact, ANIM_TAG_IMPACT}, - #endif +#endif {gBattleAnimSpritePal_CircleImpact, ANIM_TAG_CIRCLE_IMPACT}, {gBattleAnimSpritePal_Impact, ANIM_TAG_SCRATCH}, {gBattleAnimSpritePal_Impact, ANIM_TAG_CUT}, - #if B_NEW_TEETH_PARTICLE +#if B_NEW_TEETH_PARTICLE {gBattleAnimSpritePal_NewTeeth, ANIM_TAG_SHARP_TEETH}, - #else +#else {gBattleAnimSpritePal_SharpTeeth, ANIM_TAG_SHARP_TEETH}, - #endif +#endif {gBattleAnimSpritePal_RainbowRings, ANIM_TAG_RAINBOW_RINGS}, {gBattleAnimSpritePal_IceCrystals, ANIM_TAG_ICE_CRYSTALS}, {gBattleAnimSpritePal_IceCrystals, ANIM_TAG_ICE_SPIKES}, - #if B_NEW_HANDS_FEET_PARTICLE +#if B_NEW_HANDS_FEET_PARTICLE {gBattleAnimSpritePal_NewHandsAndFeet, ANIM_TAG_HANDS_AND_FEET}, - #else +#else {gBattleAnimSpritePal_HandsAndFeet, ANIM_TAG_HANDS_AND_FEET}, - #endif +#endif {gBattleAnimSpritePal_MistCloud, ANIM_TAG_MIST_CLOUD}, {gBattleAnimSpritePal_SharpTeeth, ANIM_TAG_CLAMP}, {gBattleAnimSpritePal_RainDrops, ANIM_TAG_BUBBLE}, @@ -1648,19 +1648,19 @@ const struct CompressedSpritePalette gBattleAnimPaletteTable[] = {gBattleAnimSpritePal_WaterImpact, ANIM_TAG_WATER_ORB}, {gBattleAnimSpritePal_PoisonBubble, ANIM_TAG_POISON_BUBBLE}, {gBattleAnimSpritePal_PoisonBubble, ANIM_TAG_TOXIC_BUBBLE}, - #if B_NEW_SPIKES_PARTICLE +#if B_NEW_SPIKES_PARTICLE {gBattleAnimSpritePal_NewSpikes, ANIM_TAG_SPIKES}, - #else +#else {gBattleAnimSpritePal_Spikes, ANIM_TAG_SPIKES}, - #endif +#endif {gBattleAnimSpritePal_HornHit2, ANIM_TAG_HORN_HIT_2}, {gBattleAnimSpritePal_AirWave2, ANIM_TAG_AIR_WAVE_2}, {gBattleAnimSpritePal_SmallBubbles, ANIM_TAG_SMALL_BUBBLES}, - #if B_NEW_FLY_BUBBLE_PARTICLE +#if B_NEW_FLY_BUBBLE_PARTICLE {gBattleAnimSpritePal_NewFly, ANIM_TAG_ROUND_SHADOW}, - #else +#else {gBattleAnimSpritePal_RoundShadow, ANIM_TAG_ROUND_SHADOW}, - #endif +#endif {gBattleAnimSpritePal_Sunlight, ANIM_TAG_SUNLIGHT}, {gBattleAnimSpritePal_Spore, ANIM_TAG_SPORE}, {gBattleAnimSpritePal_Flower, ANIM_TAG_FLOWER}, @@ -1691,11 +1691,11 @@ const struct CompressedSpritePalette gBattleAnimPaletteTable[] = {gBattleAnimSpritePal_FocusEnergy, ANIM_TAG_FOCUS_ENERGY}, {gBattleAnimSpritePal_SphereToCube, ANIM_TAG_SPHERE_TO_CUBE}, {gBattleAnimSpritePal_Tendrils, ANIM_TAG_TENDRILS}, - #if B_NEW_MEAN_LOOK_PARTICLE +#if B_NEW_MEAN_LOOK_PARTICLE {gBattleAnimSpritePal_NewEye, ANIM_TAG_EYE}, - #else +#else {gBattleAnimSpritePal_Eye, ANIM_TAG_EYE}, - #endif +#endif {gBattleAnimSpritePal_WhiteShadow, ANIM_TAG_WHITE_SHADOW}, {gBattleAnimSpritePal_TealAlert, ANIM_TAG_TEAL_ALERT}, {gBattleAnimSpritePal_OpeningEye, ANIM_TAG_OPENING_EYE}, @@ -1734,11 +1734,11 @@ const struct CompressedSpritePalette gBattleAnimPaletteTable[] = {gBattleAnimSpritePal_Roots, ANIM_TAG_ROOTS}, {gBattleAnimSpritePal_ItemBag, ANIM_TAG_ITEM_BAG}, {gBattleAnimSpritePal_JaggedMusicNote, ANIM_TAG_JAGGED_MUSIC_NOTE}, - #if B_NEW_BATON_PASS_BALL_PARTICLE +#if B_NEW_BATON_PASS_BALL_PARTICLE {gBattleAnimSpritePal_NewPokeball, ANIM_TAG_POKEBALL}, - #else +#else {gBattleAnimSpritePal_Pokeball, ANIM_TAG_POKEBALL}, - #endif +#endif {gBattleAnimSpritePal_Pokeball, ANIM_TAG_SPOTLIGHT}, {gBattleAnimSpritePal_LetterZ, ANIM_TAG_LETTER_Z}, {gBattleAnimSpritePal_RapidSpin, ANIM_TAG_RAPID_SPIN}, @@ -1753,11 +1753,11 @@ const struct CompressedSpritePalette gBattleAnimPaletteTable[] = {gBattleAnimSpritePal_PinkPetal, ANIM_TAG_PINK_PETAL}, {gBattleAnimSpritePal_PainSplit, ANIM_TAG_PAIN_SPLIT}, {gBattleAnimSpritePal_Confetti, ANIM_TAG_CONFETTI}, - #if B_NEW_MORNING_SUN_STAR_PARTICLE +#if B_NEW_MORNING_SUN_STAR_PARTICLE {gBattleAnimSpritePal_NewGreenStar, ANIM_TAG_GREEN_STAR}, - #else +#else {gBattleAnimSpritePal_GreenStar, ANIM_TAG_GREEN_STAR}, - #endif +#endif {gBattleAnimSpritePal_PinkCloud, ANIM_TAG_PINK_CLOUD}, {gBattleAnimSpritePal_SweatDrop, ANIM_TAG_SWEAT_DROP}, {gBattleAnimSpritePal_GuardRing, ANIM_TAG_GUARD_RING}, diff --git a/src/data/items.h b/src/data/items.h index 4e45e943d975..08060db77399 100644 --- a/src/data/items.h +++ b/src/data/items.h @@ -7799,7 +7799,7 @@ const struct Item gItems[] = .flingPower = 10, }, -// TMs/HMs +// TMs/HMs. They don't have a set flingPower, as that's handled by GetFlingPowerFromItemId. [ITEM_TM01_FOCUS_PUNCH] = { @@ -7810,7 +7810,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 150, }, [ITEM_TM02_DRAGON_CLAW] = @@ -7822,7 +7821,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 80, }, [ITEM_TM03_WATER_PULSE] = @@ -7834,7 +7832,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 60, }, [ITEM_TM04_CALM_MIND] = @@ -7846,7 +7843,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 10, }, [ITEM_TM05_ROAR] = @@ -7858,7 +7854,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 10, }, [ITEM_TM06_TOXIC] = @@ -7870,7 +7865,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 10, }, [ITEM_TM07_HAIL] = @@ -7882,7 +7876,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 10, }, [ITEM_TM08_BULK_UP] = @@ -7894,7 +7887,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 10, }, [ITEM_TM09_BULLET_SEED] = @@ -7906,11 +7898,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - #if B_UPDATED_MOVE_DATA >= GEN_5 - .flingPower = 25, - #else - .flingPower = 10, - #endif }, [ITEM_TM10_HIDDEN_POWER] = @@ -7922,11 +7909,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - #if B_UPDATED_MOVE_DATA >= GEN_6 - .flingPower = 60, - #else - .flingPower = 10, - #endif }, [ITEM_TM11_SUNNY_DAY] = @@ -7938,7 +7920,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 10, }, [ITEM_TM12_TAUNT] = @@ -7950,7 +7931,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 10, }, [ITEM_TM13_ICE_BEAM] = @@ -7962,11 +7942,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - #if B_UPDATED_MOVE_DATA >= GEN_6 - .flingPower = 90, - #else - .flingPower = 95, - #endif }, [ITEM_TM14_BLIZZARD] = @@ -7978,11 +7953,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - #if B_UPDATED_MOVE_DATA >= GEN_6 - .flingPower = 110, - #else - .flingPower = 120, - #endif }, [ITEM_TM15_HYPER_BEAM] = @@ -7994,7 +7964,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 150, }, [ITEM_TM16_LIGHT_SCREEN] = @@ -8006,7 +7975,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 10, }, [ITEM_TM17_PROTECT] = @@ -8018,7 +7986,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 10, }, [ITEM_TM18_RAIN_DANCE] = @@ -8030,7 +7997,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 10, }, [ITEM_TM19_GIGA_DRAIN] = @@ -8042,11 +8008,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - #if B_UPDATED_MOVE_DATA >= GEN_5 - .flingPower = 75, - #else - .flingPower = 60, - #endif }, [ITEM_TM20_SAFEGUARD] = @@ -8058,7 +8019,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 10, }, [ITEM_TM21_FRUSTRATION] = @@ -8070,7 +8030,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 10, }, [ITEM_TM22_SOLAR_BEAM] = @@ -8082,7 +8041,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 120, }, [ITEM_TM23_IRON_TAIL] = @@ -8094,7 +8052,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 100, }, [ITEM_TM24_THUNDERBOLT] = @@ -8106,11 +8063,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - #if B_UPDATED_MOVE_DATA >= GEN_6 - .flingPower = 90, - #else - .flingPower = 95, - #endif }, [ITEM_TM25_THUNDER] = @@ -8122,11 +8074,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - #if B_UPDATED_MOVE_DATA >= GEN_6 - .flingPower = 110, - #else - .flingPower = 120, - #endif }, [ITEM_TM26_EARTHQUAKE] = @@ -8138,7 +8085,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 100, }, [ITEM_TM27_RETURN] = @@ -8150,7 +8096,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 10, }, [ITEM_TM28_DIG] = @@ -8162,11 +8107,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - #if B_UPDATED_MOVE_DATA >= GEN_4 - .flingPower = 80, - #else - .flingPower = 60, - #endif }, [ITEM_TM29_PSYCHIC] = @@ -8178,7 +8118,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 90, }, [ITEM_TM30_SHADOW_BALL] = @@ -8190,7 +8129,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 80, }, [ITEM_TM31_BRICK_BREAK] = @@ -8202,7 +8140,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 75, }, [ITEM_TM32_DOUBLE_TEAM] = @@ -8214,7 +8151,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 10, }, [ITEM_TM33_REFLECT] = @@ -8226,7 +8162,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 10, }, [ITEM_TM34_SHOCK_WAVE] = @@ -8238,7 +8173,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 60, }, [ITEM_TM35_FLAMETHROWER] = @@ -8250,11 +8184,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - #if B_UPDATED_MOVE_DATA >= GEN_6 - .flingPower = 90, - #else - .flingPower = 95, - #endif }, [ITEM_TM36_SLUDGE_BOMB] = @@ -8266,7 +8195,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 90, }, [ITEM_TM37_SANDSTORM] = @@ -8278,7 +8206,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 10, }, [ITEM_TM38_FIRE_BLAST] = @@ -8290,11 +8217,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - #if B_UPDATED_MOVE_DATA >= GEN_6 - .flingPower = 110, - #else - .flingPower = 120, - #endif }, [ITEM_TM39_ROCK_TOMB] = @@ -8306,11 +8228,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - #if B_UPDATED_MOVE_DATA >= GEN_6 - .flingPower = 60, - #else - .flingPower = 50, - #endif }, [ITEM_TM40_AERIAL_ACE] = @@ -8322,7 +8239,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 60, }, [ITEM_TM41_TORMENT] = @@ -8334,7 +8250,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 10, }, [ITEM_TM42_FACADE] = @@ -8346,7 +8261,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 10, }, [ITEM_TM43_SECRET_POWER] = @@ -8358,7 +8272,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 70, }, [ITEM_TM44_REST] = @@ -8370,7 +8283,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 10, }, [ITEM_TM45_ATTRACT] = @@ -8382,7 +8294,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 10, }, [ITEM_TM46_THIEF] = @@ -8394,11 +8305,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - #if B_UPDATED_MOVE_DATA >= GEN_6 - .flingPower = 60, - #else - .flingPower = 40, - #endif }, [ITEM_TM47_STEEL_WING] = @@ -8410,7 +8316,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 70, }, [ITEM_TM48_SKILL_SWAP] = @@ -8422,7 +8327,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 10, }, [ITEM_TM49_SNATCH] = @@ -8434,7 +8338,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 10, }, [ITEM_TM50_OVERHEAT] = @@ -8446,11 +8349,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - #if B_UPDATED_MOVE_DATA >= GEN_6 - .flingPower = 130, - #else - .flingPower = 140, - #endif }, [ITEM_TM51] = @@ -9013,7 +8911,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 50, }, [ITEM_HM02_FLY] = @@ -9026,11 +8923,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - #if B_UPDATED_MOVE_DATA >= GEN_4 - .flingPower = 90, - #else - .flingPower = 70, - #endif }, [ITEM_HM03_SURF] = @@ -9043,11 +8935,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - #if B_UPDATED_MOVE_DATA >= GEN_6 - .flingPower = 90, - #else - .flingPower = 95, - #endif }, [ITEM_HM04_STRENGTH] = @@ -9060,7 +8947,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 80, }, [ITEM_HM05_FLASH] = @@ -9073,7 +8959,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 10, }, [ITEM_HM06_ROCK_SMASH] = @@ -9086,11 +8971,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - #if B_UPDATED_MOVE_DATA >= GEN_4 - .flingPower = 20, - #else - .flingPower = 40, - #endif }, [ITEM_HM07_WATERFALL] = @@ -9103,7 +8983,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .flingPower = 80, }, [ITEM_HM08_DIVE] = @@ -9116,11 +8995,6 @@ const struct Item gItems[] = .pocket = POCKET_TM_HM, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - #if B_UPDATED_MOVE_DATA >= GEN_4 - .flingPower = 80, - #else - .flingPower = 60, - #endif }, diff --git a/src/data/text/move_descriptions.h b/src/data/text/move_descriptions.h index 06c50f36d4f3..1275fa4c7bf3 100644 --- a/src/data/text/move_descriptions.h +++ b/src/data/text/move_descriptions.h @@ -1,3 +1,10 @@ + +#if B_BINDING_TURNS >= GEN_5 +#define BINDING_TURNS "4 or 5" +#else +#define BINDING_TURNS "2 to 5" +#endif + static const u8 sNullDescription[] = _( ""); @@ -79,11 +86,7 @@ static const u8 sFlyDescription[] = _( static const u8 sBindDescription[] = _( "Binds and squeezes the foe\n" -#if B_BINDING_TURNS >= GEN_5 - "for 4 or 5 turns."); -#else - "for 2 to 5 turns."); -#endif + "for "BINDING_TURNS" turns."); static const u8 sSlamDescription[] = _( "Slams the foe with a long\n" @@ -143,11 +146,7 @@ static const u8 sBodySlamDescription[] = _( static const u8 sWrapDescription[] = _( "Wraps and squeezes the foe\n" -#if B_BINDING_TURNS >= GEN_5 - "4 or 5 times with vines, etc."); -#else - "2 to 5 times with vines, etc."); -#endif + BINDING_TURNS" times with vines, etc."); static const u8 sTakeDownDescription[] = _( "A reckless charge attack\n" @@ -339,11 +338,7 @@ static const u8 sDragonRageDescription[] = _( static const u8 sFireSpinDescription[] = _( "Traps the foe in a ring of\n" -#if B_BINDING_TURNS >= GEN_5 - "fire for 4 or 5 turns."); -#else - "fire for 2 to 5 turns."); -#endif + "fire for "BINDING_TURNS" turns."); static const u8 sThunderShockDescription[] = _( "An electrical attack that\n" @@ -523,11 +518,7 @@ static const u8 sWaterfallDescription[] = _( static const u8 sClampDescription[] = _( "Traps and squeezes the\n" -#if B_BINDING_TURNS >= GEN_5 - "foe for 4 or 5 turns."); -#else - "foe for 2 to 5 turns."); -#endif + "foe for "BINDING_TURNS" turns."); static const u8 sSwiftDescription[] = _( "Sprays star-shaped rays\n" @@ -1015,11 +1006,7 @@ static const u8 sRockSmashDescription[] = _( static const u8 sWhirlpoolDescription[] = _( "Traps and hurts the foe in\n" -#if B_BINDING_TURNS >= GEN_5 - "a whirlpool for 4 or 5 turns."); -#else - "a whirlpool for 2 to 5 turns."); -#endif + "a whirlpool for "BINDING_TURNS" turns."); static const u8 sBeatUpDescription[] = _( "Summons party Pokémon to\n" @@ -1030,7 +1017,11 @@ static const u8 sFakeOutDescription[] = _( "that causes flinching."); static const u8 sUproarDescription[] = _( +#if B_UPROAR_TURNS >= GEN_5 "Causes an uproar for 2 to 5\n" +#else + "Causes an uproar for 3\n" +#endif "turns and prevents sleep."); static const u8 sStockpileDescription[] = _( @@ -1331,11 +1322,7 @@ static const u8 sSkyUppercutDescription[] = _( static const u8 sSandTombDescription[] = _( "Traps and hurts the foe in\n" -#if B_BINDING_TURNS >= GEN_5 - "quicksand for 4 or 5 turns."); -#else - "quicksand for 2 to 5 turns."); -#endif + "quicksand for "BINDING_TURNS" turns."); static const u8 sSheerColdDescription[] = _( "A chilling attack that\n" @@ -1839,11 +1826,7 @@ static const u8 sSpacialRendDescription[] = _( static const u8 sMagmaStormDescription[] = _( "Traps the foe in a vortex\n" -#if B_BINDING_TURNS >= GEN_5 - "of fire for 4 or 5 turns."); -#else - "of fire for 2 to 5 turns."); -#endif + "of fire for "BINDING_TURNS" turns."); static const u8 sDarkVoidDescription[] = _( "Drags the foe into total\n" @@ -2395,11 +2378,7 @@ static const u8 sNuzzleDescription[] = _( static const u8 sInfestationDescription[] = _( "The foe is infested and\n" -#if B_BINDING_TURNS >= GEN_5 - "attacked for 4 or 5 turns."); -#else - "attacked for 2 to 5 turns."); -#endif + "attacked for "BINDING_TURNS" turns."); static const u8 sPowerUpPunchDescription[] = _( "A hard punch that raises\n" @@ -2944,11 +2923,7 @@ static const u8 sSurgingStrikesDescription[] = _( static const u8 sThunderCageDescription[] = _( "Traps the foe in a cage of\n" -#if B_BINDING_TURNS >= GEN_5 - "electricity for 4 or 5 turns."); -#else - "electricity for 2 to 5 turns."); -#endif + "electricity for "BINDING_TURNS" turns."); static const u8 sDragonEnergyDescription[] = _( "The higher the user's HP\n" @@ -3078,6 +3053,8 @@ const u8 gNotDoneYetDescription[] = _( "This move can't be used. Its\n" "effect is in development."); +#undef BINDING_TURNS + // MOVE_NONE is ignored in this table. Make sure to always subtract 1 before getting the right pointer. const u8 *const gMoveDescriptionPointers[MOVES_COUNT - 1] = { diff --git a/src/daycare.c b/src/daycare.c index ad599d9af373..6108c6daa820 100644 --- a/src/daycare.c +++ b/src/daycare.c @@ -820,12 +820,12 @@ static u16 DetermineEggSpeciesAndParentSlots(struct DayCare *daycare, u8 *parent eggSpecies = SPECIES_NIDORAN_M; else if (eggSpecies == SPECIES_ILLUMISE && daycare->offspringPersonality & EGG_GENDER_MALE) eggSpecies = SPECIES_VOLBEAT; - #if P_NIDORAN_M_DITTO_BREED >= GEN_5 - else if (eggSpecies == SPECIES_NIDORAN_M && !(daycare->offspringPersonality & EGG_GENDER_MALE)) - eggSpecies = SPECIES_NIDORAN_F; - else if (eggSpecies == SPECIES_VOLBEAT && !(daycare->offspringPersonality & EGG_GENDER_MALE)) - eggSpecies = SPECIES_ILLUMISE; - #endif +#if P_NIDORAN_M_DITTO_BREED >= GEN_5 + else if (eggSpecies == SPECIES_NIDORAN_M && !(daycare->offspringPersonality & EGG_GENDER_MALE)) + eggSpecies = SPECIES_NIDORAN_F; + else if (eggSpecies == SPECIES_VOLBEAT && !(daycare->offspringPersonality & EGG_GENDER_MALE)) + eggSpecies = SPECIES_ILLUMISE; +#endif else if (eggSpecies == SPECIES_MANAPHY) eggSpecies = SPECIES_PHIONE; else if (eggSpecies == SPECIES_SINISTEA_ANTIQUE) diff --git a/src/evolution_scene.c b/src/evolution_scene.c index c9c2641c6712..91a312222617 100644 --- a/src/evolution_scene.c +++ b/src/evolution_scene.c @@ -551,7 +551,10 @@ static void CreateShedinja(u16 preEvoSpecies, struct Pokemon *mon) u32 data = 0; u16 ball = ITEM_POKE_BALL; if (gEvolutionTable[preEvoSpecies][0].method == EVO_LEVEL_NINJASK && gPlayerPartyCount < PARTY_SIZE - && (P_SHEDINJA_BALL == GEN_3 || CheckBagHasItem(ball, 1))) + #if P_SHEDINJA_BALL >= GEN_4 + && (CheckBagHasItem(ball, 1)) + #endif + ) { s32 i; struct Pokemon *shedinja = &gPlayerParty[gPlayerPartyCount]; @@ -563,10 +566,10 @@ static void CreateShedinja(u16 preEvoSpecies, struct Pokemon *mon) SetMonData(&gPlayerParty[gPlayerPartyCount], MON_DATA_MARKINGS, &data); SetMonData(&gPlayerParty[gPlayerPartyCount], MON_DATA_ENCRYPT_SEPARATOR, &data); - #if P_SHEDINJA_BALL >= GEN_4 + #if P_SHEDINJA_BALL >= GEN_4 SetMonData(&gPlayerParty[gPlayerPartyCount], MON_DATA_POKEBALL, &ball); RemoveBagItem(ball, 1); - #endif + #endif for (i = MON_DATA_COOL_RIBBON; i < MON_DATA_COOL_RIBBON + CONTEST_CATEGORIES_COUNT; i++) SetMonData(&gPlayerParty[gPlayerPartyCount], i, &data); diff --git a/src/item_use.c b/src/item_use.c index 16ff1b85c949..bcc869c7a5cb 100755 --- a/src/item_use.c +++ b/src/item_use.c @@ -1003,14 +1003,14 @@ void ItemUseInBattle_PokeBall(u8 taskId) else DisplayItemMessageInBattlePyramid(taskId, gText_BoxFull, Task_CloseBattlePyramidBagMessage); break; - #if B_SEMI_INVULNERABLE_CATCH >= GEN_4 +#if B_SEMI_INVULNERABLE_CATCH >= GEN_4 case BALL_THROW_UNABLE_SEMI_INVULNERABLE: if (!InBattlePyramid()) DisplayItemMessage(taskId, FONT_NORMAL, sText_CantThrowPokeBall_SemiInvulnerable, CloseItemMessage); else DisplayItemMessageInBattlePyramid(taskId, sText_CantThrowPokeBall_SemiInvulnerable, Task_CloseBattlePyramidBagMessage); break; - #endif +#endif } } diff --git a/src/overworld.c b/src/overworld.c index 5f9111e4c9b8..54cdb3d1dd44 100644 --- a/src/overworld.c +++ b/src/overworld.c @@ -409,9 +409,9 @@ static void Overworld_ResetStateAfterWhiteOut(void) FlagClear(FLAG_SYS_SAFARI_MODE); FlagClear(FLAG_SYS_USE_STRENGTH); FlagClear(FLAG_SYS_USE_FLASH); - #if VAR_TERRAIN != 0 - VarSet(VAR_TERRAIN, 0); - #endif +#if VAR_TERRAIN != 0 + VarSet(VAR_TERRAIN, 0); +#endif // If you were defeated by Kyogre/Groudon and the step counter has // maxed out, end the abnormal weather. if (VarGet(VAR_SHOULD_END_ABNORMAL_WEATHER) == 1) diff --git a/src/pokemon.c b/src/pokemon.c index 2ab646c1d5e5..3311ef6822bd 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -3370,49 +3370,49 @@ void CreateBoxMon(struct BoxPokemon *boxMon, u16 species, u8 level, u8 fixedIV, iv = (value & (MAX_IV_MASK << 10)) >> 10; SetBoxMonData(boxMon, MON_DATA_SPDEF_IV, &iv); - #if P_LEGENDARY_PERFECT_IVS >= GEN_6 - if (gBaseStats[species].flags & (FLAG_LEGENDARY | FLAG_MYTHICAL | FLAG_ULTRA_BEAST)) + #if P_LEGENDARY_PERFECT_IVS >= GEN_6 + if (gBaseStats[species].flags & (FLAG_LEGENDARY | FLAG_MYTHICAL | FLAG_ULTRA_BEAST)) + { + iv = MAX_PER_STAT_IVS; + // Initialize a list of IV indices. + for (i = 0; i < NUM_STATS; i++) { - iv = MAX_PER_STAT_IVS; - // Initialize a list of IV indices. - for (i = 0; i < NUM_STATS; i++) - { - availableIVs[i] = i; - } + availableIVs[i] = i; + } - // Select the 3 IVs that will be perfected. - for (i = 0; i < LEGENDARY_PERFECT_IV_COUNT; i++) - { - u8 index = Random() % (NUM_STATS - i); - selectedIvs[i] = availableIVs[index]; - RemoveIVIndexFromList(availableIVs, index); - } - for (i = 0; i < LEGENDARY_PERFECT_IV_COUNT; i++) + // Select the 3 IVs that will be perfected. + for (i = 0; i < LEGENDARY_PERFECT_IV_COUNT; i++) + { + u8 index = Random() % (NUM_STATS - i); + selectedIvs[i] = availableIVs[index]; + RemoveIVIndexFromList(availableIVs, index); + } + for (i = 0; i < LEGENDARY_PERFECT_IV_COUNT; i++) + { + switch (selectedIvs[i]) { - switch (selectedIvs[i]) - { - case STAT_HP: - SetBoxMonData(boxMon, MON_DATA_HP_IV, &iv); - break; - case STAT_ATK: - SetBoxMonData(boxMon, MON_DATA_ATK_IV, &iv); - break; - case STAT_DEF: - SetBoxMonData(boxMon, MON_DATA_DEF_IV, &iv); - break; - case STAT_SPEED: - SetBoxMonData(boxMon, MON_DATA_SPEED_IV, &iv); - break; - case STAT_SPATK: - SetBoxMonData(boxMon, MON_DATA_SPATK_IV, &iv); - break; - case STAT_SPDEF: - SetBoxMonData(boxMon, MON_DATA_SPDEF_IV, &iv); - break; - } + case STAT_HP: + SetBoxMonData(boxMon, MON_DATA_HP_IV, &iv); + break; + case STAT_ATK: + SetBoxMonData(boxMon, MON_DATA_ATK_IV, &iv); + break; + case STAT_DEF: + SetBoxMonData(boxMon, MON_DATA_DEF_IV, &iv); + break; + case STAT_SPEED: + SetBoxMonData(boxMon, MON_DATA_SPEED_IV, &iv); + break; + case STAT_SPATK: + SetBoxMonData(boxMon, MON_DATA_SPATK_IV, &iv); + break; + case STAT_SPDEF: + SetBoxMonData(boxMon, MON_DATA_SPDEF_IV, &iv); + break; } } - #endif + } + #endif } @@ -5506,6 +5506,12 @@ bool8 ExecuteTableBasedItemEffect(struct Pokemon *mon, u16 item, u8 partyIndex, } \ } +#if B_X_ITEMS_BUFF >= GEN_7 + #define X_ITEM_STAGES 2 +#else + #define X_ITEM_STAGES 1 +#endif + // EXP candies store an index for this table in their holdEffectParam. static const u32 sExpCandyExperienceTable[] = { [EXP_100 - 1] = 100, @@ -5621,10 +5627,7 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov if ((itemEffect[i] & ITEM1_X_ATTACK) && gBattleMons[gActiveBattler].statStages[STAT_ATK] < MAX_STAT_STAGE) { - if (B_X_ITEMS_BUFF >= GEN_7) - gBattleMons[gActiveBattler].statStages[STAT_ATK] += 2; - else - gBattleMons[gActiveBattler].statStages[STAT_ATK] += 1; + gBattleMons[gActiveBattler].statStages[STAT_ATK] += X_ITEM_STAGES; if (gBattleMons[gActiveBattler].statStages[STAT_ATK] > MAX_STAT_STAGE) gBattleMons[gActiveBattler].statStages[STAT_ATK] = MAX_STAT_STAGE; retVal = FALSE; @@ -5634,10 +5637,7 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov if ((itemEffect[i] & ITEM1_X_DEFENSE) && gBattleMons[gActiveBattler].statStages[STAT_DEF] < MAX_STAT_STAGE) { - if (B_X_ITEMS_BUFF >= GEN_7) - gBattleMons[gActiveBattler].statStages[STAT_DEF] += 2; - else - gBattleMons[gActiveBattler].statStages[STAT_DEF] += 1; + gBattleMons[gActiveBattler].statStages[STAT_DEF] += X_ITEM_STAGES; if (gBattleMons[gActiveBattler].statStages[STAT_DEF] > MAX_STAT_STAGE) gBattleMons[gActiveBattler].statStages[STAT_DEF] = MAX_STAT_STAGE; retVal = FALSE; @@ -5647,10 +5647,7 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov if ((itemEffect[i] & ITEM1_X_SPEED) && gBattleMons[gActiveBattler].statStages[STAT_SPEED] < MAX_STAT_STAGE) { - if (B_X_ITEMS_BUFF >= GEN_7) - gBattleMons[gActiveBattler].statStages[STAT_SPEED] += 2; - else - gBattleMons[gActiveBattler].statStages[STAT_SPEED] += 1; + gBattleMons[gActiveBattler].statStages[STAT_SPEED] += X_ITEM_STAGES; if (gBattleMons[gActiveBattler].statStages[STAT_SPEED] > MAX_STAT_STAGE) gBattleMons[gActiveBattler].statStages[STAT_SPEED] = MAX_STAT_STAGE; retVal = FALSE; @@ -5660,10 +5657,7 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov if ((itemEffect[i] & ITEM1_X_SPATK) && gBattleMons[gActiveBattler].statStages[STAT_SPATK] < MAX_STAT_STAGE) { - if (B_X_ITEMS_BUFF >= GEN_7) - gBattleMons[gActiveBattler].statStages[STAT_SPATK] += 2; - else - gBattleMons[gActiveBattler].statStages[STAT_SPATK] += 1; + gBattleMons[gActiveBattler].statStages[STAT_SPATK] += X_ITEM_STAGES; if (gBattleMons[gActiveBattler].statStages[STAT_SPATK] > MAX_STAT_STAGE) gBattleMons[gActiveBattler].statStages[STAT_SPATK] = MAX_STAT_STAGE; retVal = FALSE; @@ -5673,10 +5667,7 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov if ((itemEffect[i] & ITEM1_X_SPDEF) && gBattleMons[gActiveBattler].statStages[STAT_SPDEF] < MAX_STAT_STAGE) { - if (B_X_ITEMS_BUFF >= GEN_7) - gBattleMons[gActiveBattler].statStages[STAT_SPDEF] += 2; - else - gBattleMons[gActiveBattler].statStages[STAT_SPDEF] += 1; + gBattleMons[gActiveBattler].statStages[STAT_SPDEF] += X_ITEM_STAGES; if (gBattleMons[gActiveBattler].statStages[STAT_SPDEF] > MAX_STAT_STAGE) gBattleMons[gActiveBattler].statStages[STAT_SPDEF] = MAX_STAT_STAGE; retVal = FALSE; @@ -5686,10 +5677,7 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov if ((itemEffect[i] & ITEM1_X_ACCURACY) && gBattleMons[gActiveBattler].statStages[STAT_ACC] < MAX_STAT_STAGE) { - if (B_X_ITEMS_BUFF >= GEN_7) - gBattleMons[gActiveBattler].statStages[STAT_ACC] += 2; - else - gBattleMons[gActiveBattler].statStages[STAT_ACC] += 1; + gBattleMons[gActiveBattler].statStages[STAT_ACC] += X_ITEM_STAGES; if (gBattleMons[gActiveBattler].statStages[STAT_ACC] > MAX_STAT_STAGE) gBattleMons[gActiveBattler].statStages[STAT_ACC] = MAX_STAT_STAGE; retVal = FALSE; @@ -6260,15 +6248,12 @@ static void BufferStatRoseMessage(s32 statIdx) { gBattlerTarget = gBattlerInMenuId; StringCopy(gBattleTextBuff1, gStatNamesTable[sStatsToRaise[statIdx]]); - if (B_X_ITEMS_BUFF >= GEN_7) - { - StringCopy(gBattleTextBuff2, gText_StatSharply); - StringAppend(gBattleTextBuff2, gText_StatRose); - } - else - { - StringCopy(gBattleTextBuff2, gText_StatRose); - } +#if B_X_ITEMS_BUFF >= GEN_7 + StringCopy(gBattleTextBuff2, gText_StatSharply); + StringAppend(gBattleTextBuff2, gText_StatRose); +#else + StringCopy(gBattleTextBuff2, gText_StatRose); +#endif BattleStringExpandPlaceholdersToDisplayedString(gText_DefendersStatRose); } @@ -6380,7 +6365,10 @@ u16 GetEvolutionTargetSpecies(struct Pokemon *mon, u8 mode, u16 evolutionItem, s // Prevent evolution with Everstone, unless we're just viewing the party menu with an evolution item if (holdEffect == HOLD_EFFECT_PREVENT_EVOLVE && mode != EVO_MODE_ITEM_CHECK - && (P_KADABRA_EVERSTONE < GEN_4 || species != SPECIES_KADABRA)) + #if P_KADABRA_EVERSTONE >= GEN_4 + && species != SPECIES_KADABRA + #endif + ) return SPECIES_NONE; switch (mode) diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index 784f9ef75805..66bfa817cc9e 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -3738,8 +3738,9 @@ static void PrintMoveDetails(u16 move) if (sMonSummaryScreen->currPageIndex == PSS_PAGE_BATTLE_MOVES) { moveEffect = gBattleMoves[move].effect; - if (B_SHOW_SPLIT_ICON == TRUE) - ShowSplitIcon(GetBattleMoveSplit(move)); + #if B_SHOW_SPLIT_ICON == TRUE + ShowSplitIcon(GetBattleMoveSplit(move)); + #endif PrintMovePowerAndAccuracy(move); if (moveEffect != EFFECT_PLACEHOLDER) diff --git a/src/wild_encounter.c b/src/wild_encounter.c index 8e197d547eab..e49d09f54dbe 100644 --- a/src/wild_encounter.c +++ b/src/wild_encounter.c @@ -367,7 +367,10 @@ static u8 PickWildMonNature(void) // check synchronize for a pokemon with the same ability if (!GetMonData(&gPlayerParty[0], MON_DATA_SANITY_IS_EGG) && GetMonAbility(&gPlayerParty[0]) == ABILITY_SYNCHRONIZE - && ((B_SYNCHRONIZE_NATURE >= GEN_8) || Random() % 2 == 0)) + #if B_SYNCHRONIZE_NATURE <= GEN_7 + && (Random() % 2 == 0) + #endif + ) { return GetMonData(&gPlayerParty[0], MON_DATA_PERSONALITY) % NUM_NATURES; } @@ -1003,11 +1006,13 @@ bool8 TryDoDoubleWildBattle(void) { if (GetSafariZoneFlag() || GetMonsStateToDoubles() != PLAYER_HAS_TWO_USABLE_MONS) return FALSE; - else if (B_FLAG_FORCE_DOUBLE_WILD != 0 && FlagGet(B_FLAG_FORCE_DOUBLE_WILD)) +#if B_FLAG_FORCE_DOUBLE_WILD != 0 + else if (FlagGet(B_FLAG_FORCE_DOUBLE_WILD)) return TRUE; - #if B_DOUBLE_WILD_CHANCE != 0 +#endif +#if B_DOUBLE_WILD_CHANCE != 0 else if ((Random() % 100) + 1 < B_DOUBLE_WILD_CHANCE) return TRUE; - #endif +#endif return FALSE; }