Rename Battle Weather flags

This commit is contained in:
Pokestia 2021-09-30 12:08:20 +02:00
parent e699965332
commit 38a4dea402
9 changed files with 85 additions and 85 deletions

View File

@ -1901,7 +1901,7 @@ BattleScript_EffectStomp::
BattleScript_EffectSolarbeam:: BattleScript_EffectSolarbeam::
jumpifabilitypresent ABILITY_CLOUD_NINE, BattleScript_SolarbeamDecideTurn jumpifabilitypresent ABILITY_CLOUD_NINE, BattleScript_SolarbeamDecideTurn
jumpifabilitypresent ABILITY_AIR_LOCK, BattleScript_SolarbeamDecideTurn jumpifabilitypresent ABILITY_AIR_LOCK, BattleScript_SolarbeamDecideTurn
jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_SUN_ANY, BattleScript_SolarbeamOnFirstTurn jumpifhalfword CMP_COMMON_BITS, gBattleWeather, B_WEATHER_SUN, BattleScript_SolarbeamOnFirstTurn
BattleScript_SolarbeamDecideTurn:: BattleScript_SolarbeamDecideTurn::
jumpifstatus2 BS_ATTACKER, STATUS2_MULTIPLETURNS, BattleScript_TwoTurnMovesSecondTurn jumpifstatus2 BS_ATTACKER, STATUS2_MULTIPLETURNS, BattleScript_TwoTurnMovesSecondTurn
jumpifword CMP_COMMON_BITS, gHitMarker, HITMARKER_NO_ATTACKSTRING, BattleScript_TwoTurnMovesSecondTurn jumpifword CMP_COMMON_BITS, gHitMarker, HITMARKER_NO_ATTACKSTRING, BattleScript_TwoTurnMovesSecondTurn

View File

@ -210,19 +210,19 @@
#define MOVE_RESULT_NO_EFFECT (MOVE_RESULT_MISSED | MOVE_RESULT_DOESNT_AFFECT_FOE | MOVE_RESULT_FAILED) #define MOVE_RESULT_NO_EFFECT (MOVE_RESULT_MISSED | MOVE_RESULT_DOESNT_AFFECT_FOE | MOVE_RESULT_FAILED)
// Battle Weather flags // Battle Weather flags
#define WEATHER_RAIN_TEMPORARY (1 << 0) #define B_WEATHER_RAIN_TEMPORARY (1 << 0)
#define WEATHER_RAIN_DOWNPOUR (1 << 1) // unused #define B_WEATHER_RAIN_DOWNPOUR (1 << 1) // unused
#define WEATHER_RAIN_PERMANENT (1 << 2) #define B_WEATHER_RAIN_PERMANENT (1 << 2)
#define WEATHER_RAIN_ANY (WEATHER_RAIN_TEMPORARY | WEATHER_RAIN_DOWNPOUR | WEATHER_RAIN_PERMANENT) #define B_WEATHER_RAIN (B_WEATHER_RAIN_TEMPORARY | B_WEATHER_RAIN_DOWNPOUR | B_WEATHER_RAIN_PERMANENT)
#define WEATHER_SANDSTORM_TEMPORARY (1 << 3) #define B_WEATHER_SANDSTORM_TEMPORARY (1 << 3)
#define WEATHER_SANDSTORM_PERMANENT (1 << 4) #define B_WEATHER_SANDSTORM_PERMANENT (1 << 4)
#define WEATHER_SANDSTORM_ANY (WEATHER_SANDSTORM_TEMPORARY | WEATHER_SANDSTORM_PERMANENT) #define B_WEATHER_SANDSTORM (B_WEATHER_SANDSTORM_TEMPORARY | B_WEATHER_SANDSTORM_PERMANENT)
#define WEATHER_SUN_TEMPORARY (1 << 5) #define B_WEATHER_SUN_TEMPORARY (1 << 5)
#define WEATHER_SUN_PERMANENT (1 << 6) #define B_WEATHER_SUN_PERMANENT (1 << 6)
#define WEATHER_SUN_ANY (WEATHER_SUN_TEMPORARY | WEATHER_SUN_PERMANENT) #define B_WEATHER_SUN (B_WEATHER_SUN_TEMPORARY | B_WEATHER_SUN_PERMANENT)
#define WEATHER_HAIL (1 << 7) #define B_WEATHER_HAIL_TEMPORARY (1 << 7)
#define WEATHER_HAIL_ANY (WEATHER_HAIL) #define B_WEATHER_HAIL (B_WEATHER_HAIL_TEMPORARY)
#define WEATHER_ANY (WEATHER_RAIN_ANY | WEATHER_SANDSTORM_ANY | WEATHER_SUN_ANY | WEATHER_HAIL_ANY) #define B_WEATHER_ANY (B_WEATHER_RAIN | B_WEATHER_SANDSTORM | B_WEATHER_SUN | B_WEATHER_HAIL)
// Move Effects // Move Effects
#define MOVE_EFFECT_SLEEP 1 #define MOVE_EFFECT_SLEEP 1

View File

@ -1632,13 +1632,13 @@ static void Cmd_if_status_not_in_party(void)
static void Cmd_get_weather(void) static void Cmd_get_weather(void)
{ {
if (gBattleWeather & WEATHER_RAIN_ANY) if (gBattleWeather & B_WEATHER_RAIN)
AI_THINKING_STRUCT->funcResult = AI_WEATHER_RAIN; AI_THINKING_STRUCT->funcResult = AI_WEATHER_RAIN;
if (gBattleWeather & WEATHER_SANDSTORM_ANY) if (gBattleWeather & B_WEATHER_SANDSTORM)
AI_THINKING_STRUCT->funcResult = AI_WEATHER_SANDSTORM; AI_THINKING_STRUCT->funcResult = AI_WEATHER_SANDSTORM;
if (gBattleWeather & WEATHER_SUN_ANY) if (gBattleWeather & B_WEATHER_SUN)
AI_THINKING_STRUCT->funcResult = AI_WEATHER_SUN; AI_THINKING_STRUCT->funcResult = AI_WEATHER_SUN;
if (gBattleWeather & WEATHER_HAIL_ANY) if (gBattleWeather & B_WEATHER_HAIL)
AI_THINKING_STRUCT->funcResult = AI_WEATHER_HAIL; AI_THINKING_STRUCT->funcResult = AI_WEATHER_HAIL;
gAIScriptPtr += 1; gAIScriptPtr += 1;

View File

@ -5421,13 +5421,13 @@ static void AnimRecycle_Step(struct Sprite *sprite)
void AnimTask_GetWeather(u8 taskId) void AnimTask_GetWeather(u8 taskId)
{ {
gBattleAnimArgs[ARG_RET_ID] = ANIM_WEATHER_NONE; gBattleAnimArgs[ARG_RET_ID] = ANIM_WEATHER_NONE;
if (gWeatherMoveAnim & WEATHER_SUN_ANY) if (gWeatherMoveAnim & B_WEATHER_SUN)
gBattleAnimArgs[ARG_RET_ID] = ANIM_WEATHER_SUN; gBattleAnimArgs[ARG_RET_ID] = ANIM_WEATHER_SUN;
else if (gWeatherMoveAnim & WEATHER_RAIN_ANY) else if (gWeatherMoveAnim & B_WEATHER_RAIN)
gBattleAnimArgs[ARG_RET_ID] = ANIM_WEATHER_RAIN; gBattleAnimArgs[ARG_RET_ID] = ANIM_WEATHER_RAIN;
else if (gWeatherMoveAnim & WEATHER_SANDSTORM_ANY) else if (gWeatherMoveAnim & B_WEATHER_SANDSTORM)
gBattleAnimArgs[ARG_RET_ID] = ANIM_WEATHER_SANDSTORM; gBattleAnimArgs[ARG_RET_ID] = ANIM_WEATHER_SANDSTORM;
else if (gWeatherMoveAnim & WEATHER_HAIL_ANY) else if (gWeatherMoveAnim & B_WEATHER_HAIL)
gBattleAnimArgs[ARG_RET_ID] = ANIM_WEATHER_HAIL; gBattleAnimArgs[ARG_RET_ID] = ANIM_WEATHER_HAIL;
DestroyAnimVisualTask(taskId); DestroyAnimVisualTask(taskId);

View File

@ -4525,14 +4525,14 @@ u8 GetWhoStrikesFirst(u8 battler1, u8 battler2, bool8 ignoreChosenMoves)
if (WEATHER_HAS_EFFECT) if (WEATHER_HAS_EFFECT)
{ {
if ((gBattleMons[battler1].ability == ABILITY_SWIFT_SWIM && gBattleWeather & WEATHER_RAIN_ANY) if ((gBattleMons[battler1].ability == ABILITY_SWIFT_SWIM && gBattleWeather & B_WEATHER_RAIN)
|| (gBattleMons[battler1].ability == ABILITY_CHLOROPHYLL && gBattleWeather & WEATHER_SUN_ANY)) || (gBattleMons[battler1].ability == ABILITY_CHLOROPHYLL && gBattleWeather & B_WEATHER_SUN))
speedMultiplierBattler1 = 2; speedMultiplierBattler1 = 2;
else else
speedMultiplierBattler1 = 1; speedMultiplierBattler1 = 1;
if ((gBattleMons[battler2].ability == ABILITY_SWIFT_SWIM && gBattleWeather & WEATHER_RAIN_ANY) if ((gBattleMons[battler2].ability == ABILITY_SWIFT_SWIM && gBattleWeather & B_WEATHER_RAIN)
|| (gBattleMons[battler2].ability == ABILITY_CHLOROPHYLL && gBattleWeather & WEATHER_SUN_ANY)) || (gBattleMons[battler2].ability == ABILITY_CHLOROPHYLL && gBattleWeather & B_WEATHER_SUN))
speedMultiplierBattler2 = 2; speedMultiplierBattler2 = 2;
else else
speedMultiplierBattler2 = 1; speedMultiplierBattler2 = 1;

View File

@ -1079,7 +1079,7 @@ static bool8 AccuracyCalcHelper(u16 move)
gHitMarker &= ~HITMARKER_IGNORE_UNDERWATER; gHitMarker &= ~HITMARKER_IGNORE_UNDERWATER;
if ((WEATHER_HAS_EFFECT && (gBattleWeather & WEATHER_RAIN_ANY) && gBattleMoves[move].effect == EFFECT_THUNDER) if ((WEATHER_HAS_EFFECT && (gBattleWeather & B_WEATHER_RAIN) && gBattleMoves[move].effect == EFFECT_THUNDER)
|| (gBattleMoves[move].effect == EFFECT_ALWAYS_HIT || gBattleMoves[move].effect == EFFECT_VITAL_THROW)) || (gBattleMoves[move].effect == EFFECT_ALWAYS_HIT || gBattleMoves[move].effect == EFFECT_VITAL_THROW))
{ {
JumpIfMoveFailed(7, move); JumpIfMoveFailed(7, move);
@ -1136,7 +1136,7 @@ static void Cmd_accuracycheck(void)
moveAcc = gBattleMoves[move].accuracy; moveAcc = gBattleMoves[move].accuracy;
// check Thunder on sunny weather // check Thunder on sunny weather
if (WEATHER_HAS_EFFECT && gBattleWeather & WEATHER_SUN_ANY && gBattleMoves[move].effect == EFFECT_THUNDER) if (WEATHER_HAS_EFFECT && gBattleWeather & B_WEATHER_SUN && gBattleMoves[move].effect == EFFECT_THUNDER)
moveAcc = 50; moveAcc = 50;
calc = sAccuracyStageRatios[buff].dividend * moveAcc; calc = sAccuracyStageRatios[buff].dividend * moveAcc;
@ -1144,7 +1144,7 @@ static void Cmd_accuracycheck(void)
if (gBattleMons[gBattlerAttacker].ability == ABILITY_COMPOUND_EYES) if (gBattleMons[gBattlerAttacker].ability == ABILITY_COMPOUND_EYES)
calc = (calc * 130) / 100; // 1.3 compound eyes boost calc = (calc * 130) / 100; // 1.3 compound eyes boost
if (WEATHER_HAS_EFFECT && gBattleMons[gBattlerTarget].ability == ABILITY_SAND_VEIL && gBattleWeather & WEATHER_SANDSTORM_ANY) if (WEATHER_HAS_EFFECT && gBattleMons[gBattlerTarget].ability == ABILITY_SAND_VEIL && gBattleWeather & B_WEATHER_SANDSTORM)
calc = (calc * 80) / 100; // 1.2 sand veil loss calc = (calc * 80) / 100; // 1.2 sand veil loss
if (gBattleMons[gBattlerAttacker].ability == ABILITY_HUSTLE && IS_TYPE_PHYSICAL(type)) if (gBattleMons[gBattlerAttacker].ability == ABILITY_HUSTLE && IS_TYPE_PHYSICAL(type))
calc = (calc * 80) / 100; // 1.2 hustle loss calc = (calc * 80) / 100; // 1.2 hustle loss
@ -2342,7 +2342,7 @@ void SetMoveEffect(bool8 primary, u8 certain)
statusChanged = TRUE; statusChanged = TRUE;
break; break;
case STATUS1_FREEZE: case STATUS1_FREEZE:
if (WEATHER_HAS_EFFECT && gBattleWeather & WEATHER_SUN_ANY) if (WEATHER_HAS_EFFECT && gBattleWeather & B_WEATHER_SUN)
noSunCanFreeze = FALSE; noSunCanFreeze = FALSE;
if (IS_BATTLER_OF_TYPE(gEffectBattler, TYPE_ICE)) if (IS_BATTLER_OF_TYPE(gEffectBattler, TYPE_ICE))
break; break;
@ -6617,14 +6617,14 @@ static void Cmd_trymirrormove(void)
static void Cmd_setrain(void) static void Cmd_setrain(void)
{ {
if (gBattleWeather & WEATHER_RAIN_ANY) if (gBattleWeather & B_WEATHER_RAIN)
{ {
gMoveResultFlags |= MOVE_RESULT_MISSED; gMoveResultFlags |= MOVE_RESULT_MISSED;
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_WEATHER_FAILED; gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_WEATHER_FAILED;
} }
else else
{ {
gBattleWeather = WEATHER_RAIN_TEMPORARY; gBattleWeather = B_WEATHER_RAIN_TEMPORARY;
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_STARTED_RAIN; gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_STARTED_RAIN;
gWishFutureKnock.weatherDuration = 5; gWishFutureKnock.weatherDuration = 5;
} }
@ -7481,14 +7481,14 @@ static void Cmd_damagetohalftargethp(void) // super fang
static void Cmd_setsandstorm(void) static void Cmd_setsandstorm(void)
{ {
if (gBattleWeather & WEATHER_SANDSTORM_ANY) if (gBattleWeather & B_WEATHER_SANDSTORM)
{ {
gMoveResultFlags |= MOVE_RESULT_MISSED; gMoveResultFlags |= MOVE_RESULT_MISSED;
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_WEATHER_FAILED; gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_WEATHER_FAILED;
} }
else else
{ {
gBattleWeather = WEATHER_SANDSTORM_TEMPORARY; gBattleWeather = B_WEATHER_SANDSTORM_TEMPORARY;
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_STARTED_SANDSTORM; gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_STARTED_SANDSTORM;
gWishFutureKnock.weatherDuration = 5; gWishFutureKnock.weatherDuration = 5;
} }
@ -7499,7 +7499,7 @@ static void Cmd_weatherdamage(void)
{ {
if (WEATHER_HAS_EFFECT) if (WEATHER_HAS_EFFECT)
{ {
if (gBattleWeather & WEATHER_SANDSTORM_ANY) if (gBattleWeather & B_WEATHER_SANDSTORM)
{ {
if (gBattleMons[gBattlerAttacker].type1 != TYPE_ROCK if (gBattleMons[gBattlerAttacker].type1 != TYPE_ROCK
&& gBattleMons[gBattlerAttacker].type1 != TYPE_STEEL && gBattleMons[gBattlerAttacker].type1 != TYPE_STEEL
@ -7520,7 +7520,7 @@ static void Cmd_weatherdamage(void)
gBattleMoveDamage = 0; gBattleMoveDamage = 0;
} }
} }
if (gBattleWeather & WEATHER_HAIL_ANY) if (gBattleWeather & B_WEATHER_HAIL)
{ {
if (!IS_BATTLER_OF_TYPE(gBattlerAttacker, TYPE_ICE) if (!IS_BATTLER_OF_TYPE(gBattlerAttacker, TYPE_ICE)
&& !(gStatuses3[gBattlerAttacker] & STATUS3_UNDERGROUND) && !(gStatuses3[gBattlerAttacker] & STATUS3_UNDERGROUND)
@ -8104,7 +8104,7 @@ static u8 AttacksThisTurn(u8 battlerId, u16 move) // Note: returns 1 if it's a c
{ {
// first argument is unused // first argument is unused
if (gBattleMoves[move].effect == EFFECT_SOLARBEAM if (gBattleMoves[move].effect == EFFECT_SOLARBEAM
&& (gBattleWeather & WEATHER_SUN_ANY)) && (gBattleWeather & B_WEATHER_SUN))
return 2; return 2;
if (gBattleMoves[move].effect == EFFECT_SKULL_BASH if (gBattleMoves[move].effect == EFFECT_SKULL_BASH
@ -8638,14 +8638,14 @@ static void Cmd_jumpifnopursuitswitchdmg(void)
static void Cmd_setsunny(void) static void Cmd_setsunny(void)
{ {
if (gBattleWeather & WEATHER_SUN_ANY) if (gBattleWeather & B_WEATHER_SUN)
{ {
gMoveResultFlags |= MOVE_RESULT_MISSED; gMoveResultFlags |= MOVE_RESULT_MISSED;
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_WEATHER_FAILED; gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_WEATHER_FAILED;
} }
else else
{ {
gBattleWeather = WEATHER_SUN_TEMPORARY; gBattleWeather = B_WEATHER_SUN_TEMPORARY;
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_STARTED_SUNLIGHT; gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_STARTED_SUNLIGHT;
gWishFutureKnock.weatherDuration = 5; gWishFutureKnock.weatherDuration = 5;
} }
@ -8739,7 +8739,7 @@ static void Cmd_recoverbasedonsunlight(void)
{ {
if (gBattleWeather == 0 || !WEATHER_HAS_EFFECT) if (gBattleWeather == 0 || !WEATHER_HAS_EFFECT)
gBattleMoveDamage = gBattleMons[gBattlerAttacker].maxHP / 2; gBattleMoveDamage = gBattleMons[gBattlerAttacker].maxHP / 2;
else if (gBattleWeather & WEATHER_SUN_ANY) else if (gBattleWeather & B_WEATHER_SUN)
gBattleMoveDamage = 20 * gBattleMons[gBattlerAttacker].maxHP / 30; gBattleMoveDamage = 20 * gBattleMons[gBattlerAttacker].maxHP / 30;
else // not sunny weather else // not sunny weather
gBattleMoveDamage = gBattleMons[gBattlerAttacker].maxHP / 4; gBattleMoveDamage = gBattleMons[gBattlerAttacker].maxHP / 4;
@ -8920,14 +8920,14 @@ static void Cmd_setminimize(void)
static void Cmd_sethail(void) static void Cmd_sethail(void)
{ {
if (gBattleWeather & WEATHER_HAIL_ANY) if (gBattleWeather & B_WEATHER_HAIL)
{ {
gMoveResultFlags |= MOVE_RESULT_MISSED; gMoveResultFlags |= MOVE_RESULT_MISSED;
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_WEATHER_FAILED; gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_WEATHER_FAILED;
} }
else else
{ {
gBattleWeather = WEATHER_HAIL; gBattleWeather = B_WEATHER_HAIL_TEMPORARY;
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_STARTED_HAIL; gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_STARTED_HAIL;
gWishFutureKnock.weatherDuration = 5; gWishFutureKnock.weatherDuration = 5;
} }
@ -9640,15 +9640,15 @@ static void Cmd_setweatherballtype(void)
{ {
if (WEATHER_HAS_EFFECT) if (WEATHER_HAS_EFFECT)
{ {
if (gBattleWeather & WEATHER_ANY) if (gBattleWeather & B_WEATHER_ANY)
gBattleScripting.dmgMultiplier = 2; gBattleScripting.dmgMultiplier = 2;
if (gBattleWeather & WEATHER_RAIN_ANY) if (gBattleWeather & B_WEATHER_RAIN)
*(&gBattleStruct->dynamicMoveType) = TYPE_WATER | 0x80; *(&gBattleStruct->dynamicMoveType) = TYPE_WATER | 0x80;
else if (gBattleWeather & WEATHER_SANDSTORM_ANY) else if (gBattleWeather & B_WEATHER_SANDSTORM)
*(&gBattleStruct->dynamicMoveType) = TYPE_ROCK | 0x80; *(&gBattleStruct->dynamicMoveType) = TYPE_ROCK | 0x80;
else if (gBattleWeather & WEATHER_SUN_ANY) else if (gBattleWeather & B_WEATHER_SUN)
*(&gBattleStruct->dynamicMoveType) = TYPE_FIRE | 0x80; *(&gBattleStruct->dynamicMoveType) = TYPE_FIRE | 0x80;
else if (gBattleWeather & WEATHER_HAIL_ANY) else if (gBattleWeather & B_WEATHER_HAIL)
*(&gBattleStruct->dynamicMoveType) = TYPE_ICE | 0x80; *(&gBattleStruct->dynamicMoveType) = TYPE_ICE | 0x80;
else else
*(&gBattleStruct->dynamicMoveType) = TYPE_NORMAL | 0x80; *(&gBattleStruct->dynamicMoveType) = TYPE_NORMAL | 0x80;

View File

@ -1593,12 +1593,12 @@ u8 GetBattlerMoveSlotId(u8 battlerId, u16 moveId)
static void AddPointsBasedOnWeather(u16 weatherFlags, u16 moveId, u8 moveSlot) static void AddPointsBasedOnWeather(u16 weatherFlags, u16 moveId, u8 moveSlot)
{ {
if (weatherFlags & WEATHER_RAIN_ANY) if (weatherFlags & B_WEATHER_RAIN)
AddMovePoints(PTS_RAIN, moveId, moveSlot, 0); AddMovePoints(PTS_RAIN, moveId, moveSlot, 0);
else if (weatherFlags & WEATHER_SUN_ANY) else if (weatherFlags & B_WEATHER_SUN)
AddMovePoints(PTS_SUN, moveId, moveSlot, 0); AddMovePoints(PTS_SUN, moveId, moveSlot, 0);
else if (weatherFlags & WEATHER_SANDSTORM_ANY) else if (weatherFlags & B_WEATHER_SANDSTORM)
AddMovePoints(PTS_SANDSTORM, moveId, moveSlot, 0); AddMovePoints(PTS_SANDSTORM, moveId, moveSlot, 0);
else if (weatherFlags & WEATHER_HAIL_ANY) else if (weatherFlags & B_WEATHER_HAIL)
AddMovePoints(PTS_HAIL, moveId, moveSlot, 0); AddMovePoints(PTS_HAIL, moveId, moveSlot, 0);
} }

View File

@ -1320,22 +1320,22 @@ u8 DoFieldEndTurnEffects(void)
} }
break; break;
case ENDTURN_RAIN: case ENDTURN_RAIN:
if (gBattleWeather & WEATHER_RAIN_ANY) if (gBattleWeather & B_WEATHER_RAIN)
{ {
if (!(gBattleWeather & WEATHER_RAIN_PERMANENT)) if (!(gBattleWeather & B_WEATHER_RAIN_PERMANENT))
{ {
if (--gWishFutureKnock.weatherDuration == 0) if (--gWishFutureKnock.weatherDuration == 0)
{ {
gBattleWeather &= ~WEATHER_RAIN_TEMPORARY; gBattleWeather &= ~B_WEATHER_RAIN_TEMPORARY;
gBattleWeather &= ~WEATHER_RAIN_DOWNPOUR; gBattleWeather &= ~B_WEATHER_RAIN_DOWNPOUR;
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_RAIN_STOPPED; gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_RAIN_STOPPED;
} }
else if (gBattleWeather & WEATHER_RAIN_DOWNPOUR) else if (gBattleWeather & B_WEATHER_RAIN_DOWNPOUR)
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_DOWNPOUR_CONTINUES; gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_DOWNPOUR_CONTINUES;
else else
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_RAIN_CONTINUES; gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_RAIN_CONTINUES;
} }
else if (gBattleWeather & WEATHER_RAIN_DOWNPOUR) else if (gBattleWeather & B_WEATHER_RAIN_DOWNPOUR)
{ {
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_DOWNPOUR_CONTINUES; gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_DOWNPOUR_CONTINUES;
} }
@ -1350,11 +1350,11 @@ u8 DoFieldEndTurnEffects(void)
gBattleStruct->turnCountersTracker++; gBattleStruct->turnCountersTracker++;
break; break;
case ENDTURN_SANDSTORM: case ENDTURN_SANDSTORM:
if (gBattleWeather & WEATHER_SANDSTORM_ANY) if (gBattleWeather & B_WEATHER_SANDSTORM)
{ {
if (!(gBattleWeather & WEATHER_SANDSTORM_PERMANENT) && --gWishFutureKnock.weatherDuration == 0) if (!(gBattleWeather & B_WEATHER_SANDSTORM_PERMANENT) && --gWishFutureKnock.weatherDuration == 0)
{ {
gBattleWeather &= ~WEATHER_SANDSTORM_TEMPORARY; gBattleWeather &= ~B_WEATHER_SANDSTORM_TEMPORARY;
gBattlescriptCurrInstr = BattleScript_SandStormHailEnds; gBattlescriptCurrInstr = BattleScript_SandStormHailEnds;
} }
else else
@ -1370,11 +1370,11 @@ u8 DoFieldEndTurnEffects(void)
gBattleStruct->turnCountersTracker++; gBattleStruct->turnCountersTracker++;
break; break;
case ENDTURN_SUN: case ENDTURN_SUN:
if (gBattleWeather & WEATHER_SUN_ANY) if (gBattleWeather & B_WEATHER_SUN)
{ {
if (!(gBattleWeather & WEATHER_SUN_PERMANENT) && --gWishFutureKnock.weatherDuration == 0) if (!(gBattleWeather & B_WEATHER_SUN_PERMANENT) && --gWishFutureKnock.weatherDuration == 0)
{ {
gBattleWeather &= ~WEATHER_SUN_TEMPORARY; gBattleWeather &= ~B_WEATHER_SUN_TEMPORARY;
gBattlescriptCurrInstr = BattleScript_SunlightFaded; gBattlescriptCurrInstr = BattleScript_SunlightFaded;
} }
else else
@ -1388,11 +1388,11 @@ u8 DoFieldEndTurnEffects(void)
gBattleStruct->turnCountersTracker++; gBattleStruct->turnCountersTracker++;
break; break;
case ENDTURN_HAIL: case ENDTURN_HAIL:
if (gBattleWeather & WEATHER_HAIL_ANY) if (gBattleWeather & B_WEATHER_HAIL)
{ {
if (--gWishFutureKnock.weatherDuration == 0) if (--gWishFutureKnock.weatherDuration == 0)
{ {
gBattleWeather &= ~WEATHER_HAIL; gBattleWeather &= ~B_WEATHER_HAIL_TEMPORARY;
gBattlescriptCurrInstr = BattleScript_SandStormHailEnds; gBattlescriptCurrInstr = BattleScript_SandStormHailEnds;
} }
else else
@ -2389,22 +2389,22 @@ u8 CastformDataTypeChange(u8 battler)
} }
if (!WEATHER_HAS_EFFECT) if (!WEATHER_HAS_EFFECT)
return CASTFORM_NO_CHANGE; return CASTFORM_NO_CHANGE;
if (!(gBattleWeather & (WEATHER_RAIN_ANY | WEATHER_SUN_ANY | WEATHER_HAIL_ANY)) && !IS_BATTLER_OF_TYPE(battler, TYPE_NORMAL)) if (!(gBattleWeather & (B_WEATHER_RAIN | B_WEATHER_SUN | B_WEATHER_HAIL)) && !IS_BATTLER_OF_TYPE(battler, TYPE_NORMAL))
{ {
SET_BATTLER_TYPE(battler, TYPE_NORMAL); SET_BATTLER_TYPE(battler, TYPE_NORMAL);
formChange = CASTFORM_TO_NORMAL; formChange = CASTFORM_TO_NORMAL;
} }
if (gBattleWeather & WEATHER_SUN_ANY && !IS_BATTLER_OF_TYPE(battler, TYPE_FIRE)) if (gBattleWeather & B_WEATHER_SUN && !IS_BATTLER_OF_TYPE(battler, TYPE_FIRE))
{ {
SET_BATTLER_TYPE(battler, TYPE_FIRE); SET_BATTLER_TYPE(battler, TYPE_FIRE);
formChange = CASTFORM_TO_FIRE; formChange = CASTFORM_TO_FIRE;
} }
if (gBattleWeather & WEATHER_RAIN_ANY && !IS_BATTLER_OF_TYPE(battler, TYPE_WATER)) if (gBattleWeather & B_WEATHER_RAIN && !IS_BATTLER_OF_TYPE(battler, TYPE_WATER))
{ {
SET_BATTLER_TYPE(battler, TYPE_WATER); SET_BATTLER_TYPE(battler, TYPE_WATER);
formChange = CASTFORM_TO_WATER; formChange = CASTFORM_TO_WATER;
} }
if (gBattleWeather & WEATHER_HAIL_ANY && !IS_BATTLER_OF_TYPE(battler, TYPE_ICE)) if (gBattleWeather & B_WEATHER_HAIL && !IS_BATTLER_OF_TYPE(battler, TYPE_ICE))
{ {
SET_BATTLER_TYPE(battler, TYPE_ICE); SET_BATTLER_TYPE(battler, TYPE_ICE);
formChange = CASTFORM_TO_ICE; formChange = CASTFORM_TO_ICE;
@ -2480,27 +2480,27 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA
case WEATHER_RAIN: case WEATHER_RAIN:
case WEATHER_RAIN_THUNDERSTORM: case WEATHER_RAIN_THUNDERSTORM:
case WEATHER_DOWNPOUR: case WEATHER_DOWNPOUR:
if (!(gBattleWeather & WEATHER_RAIN_ANY)) if (!(gBattleWeather & B_WEATHER_RAIN))
{ {
gBattleWeather = (WEATHER_RAIN_TEMPORARY | WEATHER_RAIN_PERMANENT); gBattleWeather = (B_WEATHER_RAIN_TEMPORARY | B_WEATHER_RAIN_PERMANENT);
gBattleScripting.animArg1 = B_ANIM_RAIN_CONTINUES; gBattleScripting.animArg1 = B_ANIM_RAIN_CONTINUES;
gBattleScripting.battler = battler; gBattleScripting.battler = battler;
effect++; effect++;
} }
break; break;
case WEATHER_SANDSTORM: case WEATHER_SANDSTORM:
if (!(gBattleWeather & WEATHER_SANDSTORM_ANY)) if (!(gBattleWeather & B_WEATHER_SANDSTORM))
{ {
gBattleWeather = WEATHER_SANDSTORM_ANY; gBattleWeather = B_WEATHER_SANDSTORM;
gBattleScripting.animArg1 = B_ANIM_SANDSTORM_CONTINUES; gBattleScripting.animArg1 = B_ANIM_SANDSTORM_CONTINUES;
gBattleScripting.battler = battler; gBattleScripting.battler = battler;
effect++; effect++;
} }
break; break;
case WEATHER_DROUGHT: case WEATHER_DROUGHT:
if (!(gBattleWeather & WEATHER_SUN_ANY)) if (!(gBattleWeather & B_WEATHER_SUN))
{ {
gBattleWeather = WEATHER_SUN_ANY; gBattleWeather = B_WEATHER_SUN;
gBattleScripting.animArg1 = B_ANIM_SUN_CONTINUES; gBattleScripting.animArg1 = B_ANIM_SUN_CONTINUES;
gBattleScripting.battler = battler; gBattleScripting.battler = battler;
effect++; effect++;
@ -2515,27 +2515,27 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA
} }
break; break;
case ABILITY_DRIZZLE: case ABILITY_DRIZZLE:
if (!(gBattleWeather & WEATHER_RAIN_PERMANENT)) if (!(gBattleWeather & B_WEATHER_RAIN_PERMANENT))
{ {
gBattleWeather = (WEATHER_RAIN_PERMANENT | WEATHER_RAIN_TEMPORARY); gBattleWeather = (B_WEATHER_RAIN_PERMANENT | B_WEATHER_RAIN_TEMPORARY);
BattleScriptPushCursorAndCallback(BattleScript_DrizzleActivates); BattleScriptPushCursorAndCallback(BattleScript_DrizzleActivates);
gBattleScripting.battler = battler; gBattleScripting.battler = battler;
effect++; effect++;
} }
break; break;
case ABILITY_SAND_STREAM: case ABILITY_SAND_STREAM:
if (!(gBattleWeather & WEATHER_SANDSTORM_PERMANENT)) if (!(gBattleWeather & B_WEATHER_SANDSTORM_PERMANENT))
{ {
gBattleWeather = WEATHER_SANDSTORM_ANY; gBattleWeather = B_WEATHER_SANDSTORM;
BattleScriptPushCursorAndCallback(BattleScript_SandstreamActivates); BattleScriptPushCursorAndCallback(BattleScript_SandstreamActivates);
gBattleScripting.battler = battler; gBattleScripting.battler = battler;
effect++; effect++;
} }
break; break;
case ABILITY_DROUGHT: case ABILITY_DROUGHT:
if (!(gBattleWeather & WEATHER_SUN_PERMANENT)) if (!(gBattleWeather & B_WEATHER_SUN_PERMANENT))
{ {
gBattleWeather = WEATHER_SUN_ANY; gBattleWeather = B_WEATHER_SUN;
BattleScriptPushCursorAndCallback(BattleScript_DroughtActivates); BattleScriptPushCursorAndCallback(BattleScript_DroughtActivates);
gBattleScripting.battler = battler; gBattleScripting.battler = battler;
effect++; effect++;
@ -2590,7 +2590,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA
switch (gLastUsedAbility) switch (gLastUsedAbility)
{ {
case ABILITY_RAIN_DISH: case ABILITY_RAIN_DISH:
if (WEATHER_HAS_EFFECT && (gBattleWeather & WEATHER_RAIN_ANY) if (WEATHER_HAS_EFFECT && (gBattleWeather & B_WEATHER_RAIN)
&& gBattleMons[battler].maxHP > gBattleMons[battler].hp) && gBattleMons[battler].maxHP > gBattleMons[battler].hp)
{ {
gLastUsedAbility = ABILITY_RAIN_DISH; // why gLastUsedAbility = ABILITY_RAIN_DISH; // why

View File

@ -3268,7 +3268,7 @@ s32 CalculateBaseDamage(struct BattlePokemon *attacker, struct BattlePokemon *de
// are effects of weather negated with cloud nine or air lock // are effects of weather negated with cloud nine or air lock
if (WEATHER_HAS_EFFECT2) if (WEATHER_HAS_EFFECT2)
{ {
if (gBattleWeather & WEATHER_RAIN_TEMPORARY) if (gBattleWeather & B_WEATHER_RAIN_TEMPORARY)
{ {
switch (type) switch (type)
{ {
@ -3282,11 +3282,11 @@ s32 CalculateBaseDamage(struct BattlePokemon *attacker, struct BattlePokemon *de
} }
// any weather except sun weakens solar beam // any weather except sun weakens solar beam
if ((gBattleWeather & (WEATHER_RAIN_ANY | WEATHER_SANDSTORM_ANY | WEATHER_HAIL_ANY)) && gCurrentMove == MOVE_SOLAR_BEAM) if ((gBattleWeather & (B_WEATHER_RAIN | B_WEATHER_SANDSTORM | B_WEATHER_HAIL)) && gCurrentMove == MOVE_SOLAR_BEAM)
damage /= 2; damage /= 2;
// sunny // sunny
if (gBattleWeather & WEATHER_SUN_ANY) if (gBattleWeather & B_WEATHER_SUN)
{ {
switch (type) switch (type)
{ {