diff options
author | yenatch <yenatch@gmail.com> | 2018-04-18 22:18:34 -0400 |
---|---|---|
committer | yenatch <yenatch@gmail.com> | 2018-04-18 22:18:52 -0400 |
commit | 0a040394f34d2d4e5386277649bbff450e3b3075 (patch) | |
tree | 20794fecd9af5df292cfa1973739e54607241465 | |
parent | e0e2f0218d5d558a375ae972ab8b5eb225784051 (diff) |
physical/special type macros
-rw-r--r-- | include/battle.h | 4 | ||||
-rw-r--r-- | src/battle/battle_4.c | 4 | ||||
-rw-r--r-- | src/battle/calculate_base_damage.c | 6 |
3 files changed, 9 insertions, 5 deletions
diff --git a/include/battle.h b/include/battle.h index 02e02ca83..1a4372811 100644 --- a/include/battle.h +++ b/include/battle.h @@ -42,6 +42,10 @@ #define TYPE_FORESIGHT 0xFE #define TYPE_ENDTABLE 0xFF +// physical/special types +#define TYPE_IS_PHYSICAL(type) (type < TYPE_MYSTERY) +#define TYPE_IS_SPECIAL(type) (type > TYPE_MYSTERY) + enum { BATTLE_TERRAIN_GRASS, diff --git a/src/battle/battle_4.c b/src/battle/battle_4.c index bd72e70f3..5ea6e80b3 100644 --- a/src/battle/battle_4.c +++ b/src/battle/battle_4.c @@ -2087,7 +2087,7 @@ static void atk0C_datahpupdate(void) if (!gSpecialStatuses[gActiveBattler].moveturnLostHP && !(gHitMarker & HITMARKER_x100000)) gSpecialStatuses[gActiveBattler].moveturnLostHP = gHpDealt; - if (moveType < TYPE_MYSTERY && !(gHitMarker & HITMARKER_x100000) && gCurrentMove != MOVE_PAIN_SPLIT) + if (TYPE_IS_PHYSICAL(moveType) && !(gHitMarker & HITMARKER_x100000) && gCurrentMove != MOVE_PAIN_SPLIT) { gProtectStructs[gActiveBattler].physicalDmg = gHpDealt; gSpecialStatuses[gActiveBattler].moveturnLostHP_physical = gHpDealt; @@ -2102,7 +2102,7 @@ static void atk0C_datahpupdate(void) gSpecialStatuses[gActiveBattler].moveturnPhysicalBank = gBankTarget; } } - else if (moveType >= TYPE_MYSTERY && !(gHitMarker & HITMARKER_x100000)) + else if (!TYPE_IS_PHYSICAL(moveType) && !(gHitMarker & HITMARKER_x100000)) { gProtectStructs[gActiveBattler].specialDmg = gHpDealt; gSpecialStatuses[gActiveBattler].moveturnLostHP_special = gHpDealt; diff --git a/src/battle/calculate_base_damage.c b/src/battle/calculate_base_damage.c index 8dc4108d9..d983e47a4 100644 --- a/src/battle/calculate_base_damage.c +++ b/src/battle/calculate_base_damage.c @@ -170,7 +170,7 @@ s32 CalculateBaseDamage(struct BattlePokemon *attacker, struct BattlePokemon *de if (attackerHoldEffect == gHoldEffectToType[i][0] && type == gHoldEffectToType[i][1]) { - if (type < TYPE_MYSTERY) + if (TYPE_IS_PHYSICAL(type)) attack = (attack * (attackerHoldEffectParam + 100)) / 100; else spAttack = (spAttack * (attackerHoldEffectParam + 100)) / 100; @@ -221,7 +221,7 @@ s32 CalculateBaseDamage(struct BattlePokemon *attacker, struct BattlePokemon *de if (gBattleMoves[gCurrentMove].effect == EFFECT_EXPLOSION) defense /= 2; - if (type < TYPE_MYSTERY) // is physical + if (TYPE_IS_PHYSICAL(type)) // type < TYPE_MYSTERY { if (gCritMultiplier == 2) { @@ -271,7 +271,7 @@ s32 CalculateBaseDamage(struct BattlePokemon *attacker, struct BattlePokemon *de if (type == TYPE_MYSTERY) damage = 0; // is ??? type. does 0 damage. - if (type > TYPE_MYSTERY) // is special? + if (TYPE_IS_SPECIAL(type)) // type > TYPE_MYSTERY { if (gCritMultiplier == 2) { |