more battle files cleaning
This commit is contained in:
+24
-32
@@ -23,7 +23,6 @@
|
||||
#include "link.h"
|
||||
#include "berry.h"
|
||||
|
||||
|
||||
extern u8 weather_get_current(void);
|
||||
|
||||
// rom const data
|
||||
@@ -1664,36 +1663,31 @@ u8 CastformDataTypeChange(u8 battler)
|
||||
u8 formChange = 0;
|
||||
if (gBattleMons[battler].species != SPECIES_CASTFORM || gBattleMons[battler].ability != ABILITY_FORECAST || gBattleMons[battler].hp == 0)
|
||||
return CASTFORM_NO_CHANGE;
|
||||
if (!WEATHER_HAS_EFFECT && gBattleMons[battler].type1 != TYPE_NORMAL && gBattleMons[battler].type2 != TYPE_NORMAL)
|
||||
if (!WEATHER_HAS_EFFECT && !IS_BATTLER_OF_TYPE(battler, TYPE_NORMAL))
|
||||
{
|
||||
gBattleMons[battler].type1 = TYPE_NORMAL;
|
||||
gBattleMons[battler].type2 = TYPE_NORMAL;
|
||||
SET_BATTLER_TYPE(battler, TYPE_NORMAL);
|
||||
return CASTFORM_TO_NORMAL;
|
||||
}
|
||||
if (!WEATHER_HAS_EFFECT)
|
||||
return CASTFORM_NO_CHANGE;
|
||||
if (!(gBattleWeather & (WEATHER_RAIN_ANY | WEATHER_SUN_ANY | WEATHER_HAIL)) && gBattleMons[battler].type1 != TYPE_NORMAL && gBattleMons[battler].type2 != TYPE_NORMAL)
|
||||
if (!(gBattleWeather & (WEATHER_RAIN_ANY | WEATHER_SUN_ANY | WEATHER_HAIL_ANY)) && !IS_BATTLER_OF_TYPE(battler, TYPE_NORMAL))
|
||||
{
|
||||
gBattleMons[battler].type1 = TYPE_NORMAL;
|
||||
gBattleMons[battler].type2 = TYPE_NORMAL;
|
||||
SET_BATTLER_TYPE(battler, TYPE_NORMAL);
|
||||
formChange = CASTFORM_TO_NORMAL;
|
||||
}
|
||||
if (gBattleWeather & WEATHER_SUN_ANY && gBattleMons[battler].type1 != TYPE_FIRE && gBattleMons[battler].type2 != TYPE_FIRE)
|
||||
if (gBattleWeather & WEATHER_SUN_ANY && !IS_BATTLER_OF_TYPE(battler, TYPE_FIRE))
|
||||
{
|
||||
gBattleMons[battler].type1 = TYPE_FIRE;
|
||||
gBattleMons[battler].type2 = TYPE_FIRE;
|
||||
SET_BATTLER_TYPE(battler, TYPE_FIRE);
|
||||
formChange = CASTFORM_TO_FIRE;
|
||||
}
|
||||
if (gBattleWeather & WEATHER_RAIN_ANY && gBattleMons[battler].type1 != TYPE_WATER && gBattleMons[battler].type2 != TYPE_WATER)
|
||||
if (gBattleWeather & WEATHER_RAIN_ANY && !IS_BATTLER_OF_TYPE(battler, TYPE_WATER))
|
||||
{
|
||||
gBattleMons[battler].type1 = TYPE_WATER;
|
||||
gBattleMons[battler].type2 = TYPE_WATER;
|
||||
SET_BATTLER_TYPE(battler, TYPE_WATER);
|
||||
formChange = CASTFORM_TO_WATER;
|
||||
}
|
||||
if (gBattleWeather & WEATHER_HAIL && gBattleMons[battler].type1 != TYPE_ICE && gBattleMons[battler].type2 != TYPE_ICE)
|
||||
if (gBattleWeather & WEATHER_HAIL_ANY && !IS_BATTLER_OF_TYPE(battler, TYPE_ICE))
|
||||
{
|
||||
gBattleMons[battler].type1 = TYPE_ICE;
|
||||
gBattleMons[battler].type2 = TYPE_ICE;
|
||||
SET_BATTLER_TYPE(battler, TYPE_ICE);
|
||||
formChange = CASTFORM_TO_ICE;
|
||||
}
|
||||
return formChange;
|
||||
@@ -2023,14 +2017,12 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA
|
||||
if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)
|
||||
&& move != MOVE_STRUGGLE
|
||||
&& gBattleMoves[move].power != 0
|
||||
&& (gSpecialStatuses[gBattlerTarget].physicalDmg || gSpecialStatuses[gBattlerTarget].specialDmg)
|
||||
&& gBattleMons[battler].type1 != moveType
|
||||
&& gBattleMons[battler].type2 != moveType
|
||||
&& TARGET_TURN_DAMAGED
|
||||
&& !IS_BATTLER_OF_TYPE(battler, moveType)
|
||||
&& gBattleMons[battler].hp != 0)
|
||||
{
|
||||
gBattleMons[battler].type1 = moveType;
|
||||
gBattleMons[battler].type2 = moveType;
|
||||
PREPARE_TYPE_BUFFER(gBattleTextBuff1, moveType)
|
||||
SET_BATTLER_TYPE(battler, moveType);
|
||||
PREPARE_TYPE_BUFFER(gBattleTextBuff1, moveType);
|
||||
BattleScriptPushCursor();
|
||||
gBattlescriptCurrInstr = BattleScript_ColorChangeActivates;
|
||||
effect++;
|
||||
@@ -2040,7 +2032,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA
|
||||
if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)
|
||||
&& gBattleMons[gBattlerAttacker].hp != 0
|
||||
&& !gProtectStructs[gBattlerAttacker].confusionSelfDmg
|
||||
&& (gSpecialStatuses[gBattlerTarget].physicalDmg || gSpecialStatuses[gBattlerTarget].specialDmg)
|
||||
&& TARGET_TURN_DAMAGED
|
||||
&& (gBattleMoves[move].flags & FLAG_MAKES_CONTACT))
|
||||
{
|
||||
gBattleMoveDamage = gBattleMons[gBattlerAttacker].maxHP / 16;
|
||||
@@ -2055,7 +2047,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA
|
||||
if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)
|
||||
&& gBattleMons[gBattlerAttacker].hp != 0
|
||||
&& !gProtectStructs[gBattlerAttacker].confusionSelfDmg
|
||||
&& (gSpecialStatuses[gBattlerTarget].physicalDmg || gSpecialStatuses[gBattlerTarget].specialDmg)
|
||||
&& TARGET_TURN_DAMAGED
|
||||
&& (gBattleMoves[move].flags & FLAG_MAKES_CONTACT)
|
||||
&& (Random() % 10) == 0)
|
||||
{
|
||||
@@ -2078,7 +2070,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA
|
||||
if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)
|
||||
&& gBattleMons[gBattlerAttacker].hp != 0
|
||||
&& !gProtectStructs[gBattlerAttacker].confusionSelfDmg
|
||||
&& (gSpecialStatuses[gBattlerTarget].physicalDmg || gSpecialStatuses[gBattlerTarget].specialDmg)
|
||||
&& TARGET_TURN_DAMAGED
|
||||
&& (gBattleMoves[move].flags & FLAG_MAKES_CONTACT)
|
||||
&& (Random() % 3) == 0)
|
||||
{
|
||||
@@ -2093,7 +2085,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA
|
||||
if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)
|
||||
&& gBattleMons[gBattlerAttacker].hp != 0
|
||||
&& !gProtectStructs[gBattlerAttacker].confusionSelfDmg
|
||||
&& (gSpecialStatuses[gBattlerTarget].physicalDmg || gSpecialStatuses[gBattlerTarget].specialDmg)
|
||||
&& TARGET_TURN_DAMAGED
|
||||
&& (gBattleMoves[move].flags & FLAG_MAKES_CONTACT)
|
||||
&& (Random() % 3) == 0)
|
||||
{
|
||||
@@ -2109,7 +2101,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA
|
||||
&& gBattleMons[gBattlerAttacker].hp != 0
|
||||
&& !gProtectStructs[gBattlerAttacker].confusionSelfDmg
|
||||
&& (gBattleMoves[move].flags & FLAG_MAKES_CONTACT)
|
||||
&& (gSpecialStatuses[gBattlerTarget].physicalDmg || gSpecialStatuses[gBattlerTarget].specialDmg)
|
||||
&& TARGET_TURN_DAMAGED
|
||||
&& (Random() % 3) == 0)
|
||||
{
|
||||
gBattleCommunication[MOVE_EFFECT_BYTE] = MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_BURN;
|
||||
@@ -2124,7 +2116,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA
|
||||
&& gBattleMons[gBattlerAttacker].hp != 0
|
||||
&& !gProtectStructs[gBattlerAttacker].confusionSelfDmg
|
||||
&& (gBattleMoves[move].flags & FLAG_MAKES_CONTACT)
|
||||
&& (gSpecialStatuses[gBattlerTarget].physicalDmg || gSpecialStatuses[gBattlerTarget].specialDmg)
|
||||
&& TARGET_TURN_DAMAGED
|
||||
&& gBattleMons[gBattlerTarget].hp != 0
|
||||
&& (Random() % 3) == 0
|
||||
&& gBattleMons[gBattlerAttacker].ability != ABILITY_OBLIVIOUS
|
||||
@@ -3134,7 +3126,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
|
||||
{
|
||||
case HOLD_EFFECT_FLINCH:
|
||||
if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)
|
||||
&& (gSpecialStatuses[gBattlerTarget].physicalDmg || gSpecialStatuses[gBattlerTarget].specialDmg)
|
||||
&& TARGET_TURN_DAMAGED
|
||||
&& (Random() % 100) < atkQuality
|
||||
&& gBattleMoves[gCurrentMove].flags & FLAG_KINGSROCK_AFFECTED
|
||||
&& gBattleMons[gBattlerTarget].hp)
|
||||
@@ -3186,14 +3178,14 @@ void HandleAction_RunBattleScript(void) // identical to RunBattleScriptCommands
|
||||
gBattleScriptingCommandsTable[*gBattlescriptCurrInstr]();
|
||||
}
|
||||
|
||||
u8 GetMoveTarget(u16 move, u8 useMoveTarget)
|
||||
u8 GetMoveTarget(u16 move, u8 setTarget)
|
||||
{
|
||||
u8 targetBank = 0;
|
||||
u8 moveTarget;
|
||||
u8 side;
|
||||
|
||||
if (useMoveTarget)
|
||||
moveTarget = useMoveTarget - 1;
|
||||
if (setTarget)
|
||||
moveTarget = setTarget - 1;
|
||||
else
|
||||
moveTarget = gBattleMoves[move].target;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user