mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-26 03:34:15 +01:00
Resolved review suggestions for upstream Battle Engine sync.
This commit is contained in:
parent
7369f60c06
commit
a5afdac0ae
@ -449,7 +449,7 @@
|
||||
moveend 2, \to
|
||||
.endm
|
||||
|
||||
.macro sethealblock ptr
|
||||
.macro sethealblock ptr:req
|
||||
.byte 0x4a
|
||||
.4byte \ptr
|
||||
.endm
|
||||
@ -607,7 +607,7 @@
|
||||
.byte 0x68
|
||||
.endm
|
||||
|
||||
.macro setgravity ptr
|
||||
.macro setgravity ptr:req
|
||||
.byte 0x69
|
||||
.4byte \ptr
|
||||
.endm
|
||||
@ -726,7 +726,7 @@
|
||||
.4byte \ptr
|
||||
.endm
|
||||
|
||||
.macro setmiracleeye ptr
|
||||
.macro setmiracleeye ptr:req
|
||||
.byte 0x83
|
||||
.4byte \ptr
|
||||
.endm
|
||||
@ -959,7 +959,7 @@
|
||||
.byte 0xb5
|
||||
.endm
|
||||
|
||||
.macro setembargo ptr
|
||||
.macro setembargo ptr:req
|
||||
.byte 0xb6
|
||||
.4byte \ptr
|
||||
.endm
|
||||
@ -1008,7 +1008,7 @@
|
||||
.4byte \ptr
|
||||
.endm
|
||||
|
||||
.macro setstickyweb ptr
|
||||
.macro setstickyweb ptr:req
|
||||
.byte 0xc1
|
||||
.4byte \ptr
|
||||
.endm
|
||||
@ -1107,7 +1107,7 @@
|
||||
.4byte \ptr
|
||||
.endm
|
||||
|
||||
.macro setgastroacid ptr
|
||||
.macro setgastroacid ptr:req
|
||||
.byte 0xd6
|
||||
.4byte \ptr
|
||||
.endm
|
||||
@ -1141,7 +1141,7 @@
|
||||
.4byte \ptr
|
||||
.endm
|
||||
|
||||
.macro setuserstatus3 flags ptr
|
||||
.macro setuserstatus3 flags:req, ptr:req
|
||||
.byte 0xdd
|
||||
.4byte \flags
|
||||
.4byte \ptr
|
||||
@ -1199,7 +1199,7 @@
|
||||
.4byte \ptr
|
||||
.endm
|
||||
|
||||
.macro jumpifsubstituteblocks ptr
|
||||
.macro jumpifsubstituteblocks ptr:req
|
||||
.byte 0xe9
|
||||
.4byte \ptr
|
||||
.endm
|
||||
@ -1884,7 +1884,7 @@
|
||||
.2byte \species
|
||||
.4byte \ptr
|
||||
.endm
|
||||
|
||||
|
||||
.macro tryendneutralizinggas battler:req
|
||||
various \battler, VARIOUS_TRY_END_NEUTRALIZING_GAS
|
||||
.endm
|
||||
@ -1994,7 +1994,7 @@
|
||||
jumpifhalfword CMP_NOT_EQUAL, gChosenMove, \move, \jumpptr
|
||||
.endm
|
||||
|
||||
.macro jumpifstatus3 battler, status:req, jumpptr:req
|
||||
.macro jumpifstatus3 battler:req, status:req, jumpptr:req
|
||||
jumpifstatus3condition \battler, \status, FALSE, \jumpptr
|
||||
.endm
|
||||
|
||||
|
@ -4858,7 +4858,7 @@ Move_FLAME_BURST:
|
||||
|
||||
Move_SLUDGE_WAVE:
|
||||
panse SE_M_WHIRLPOOL, SOUND_PAN_ATTACKER, SOUND_PAN_TARGET, 0x2, 0x0
|
||||
createvisualtask AnimTask_CreateSurfWave, 0x2, ANIM_SURF_PAL_SLUDGE_WAVE
|
||||
createvisualtask AnimTask_CreateSurfWave, 2, ANIM_SURF_PAL_SLUDGE_WAVE
|
||||
waitforvisualfinish
|
||||
end
|
||||
|
||||
|
@ -270,7 +270,7 @@
|
||||
#define B_WEATHER_SUN (B_WEATHER_SUN_TEMPORARY | B_WEATHER_SUN_PERMANENT | B_WEATHER_SUN_PRIMAL)
|
||||
#define B_WEATHER_HAIL_TEMPORARY (1 << 9)
|
||||
#define B_WEATHER_HAIL_PERMANENT (1 << 10)
|
||||
#define B_WEATHER_HAIL (B_WEATHER_HAIL_TEMPORARY| B_WEATHER_HAIL_PERMANENT)
|
||||
#define B_WEATHER_HAIL (B_WEATHER_HAIL_TEMPORARY | B_WEATHER_HAIL_PERMANENT)
|
||||
#define B_WEATHER_STRONG_WINDS (1 << 11)
|
||||
#define B_WEATHER_ANY (B_WEATHER_RAIN | B_WEATHER_SANDSTORM | B_WEATHER_SUN | B_WEATHER_HAIL | B_WEATHER_STRONG_WINDS)
|
||||
#define B_WEATHER_PRIMAL_ANY (B_WEATHER_RAIN_PRIMAL | B_WEATHER_SUN_PRIMAL | B_WEATHER_STRONG_WINDS)
|
||||
@ -395,6 +395,9 @@
|
||||
#define B_WAIT_TIME_MED 48
|
||||
#define B_WAIT_TIME_SHORT 32
|
||||
|
||||
#define CHERRIM_OVERCAST 0
|
||||
#define CHERRIM_SUNSHINE 1
|
||||
|
||||
#define CASTFORM_NORMAL 0
|
||||
#define CASTFORM_FIRE 1
|
||||
#define CASTFORM_WATER 2
|
||||
|
@ -659,7 +659,7 @@ bool32 MovesWithSplitUnusable(u32 attacker, u32 target, u32 split)
|
||||
{
|
||||
s32 i, moveType;
|
||||
u32 usable = 0;
|
||||
u32 unusable = CheckMoveLimitations(attacker, 0, 0xFF);
|
||||
u32 unusable = CheckMoveLimitations(attacker, 0, MOVE_LIMITATIONS_ALL);
|
||||
u16 *moves = GetMovesArray(attacker);
|
||||
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
@ -1033,7 +1033,7 @@ u8 AI_WhoStrikesFirst(u8 battlerAI, u8 battler2)
|
||||
bool32 CanTargetFaintAi(u8 battlerDef, u8 battlerAtk)
|
||||
{
|
||||
s32 i, dmg;
|
||||
u32 unusable = CheckMoveLimitations(battlerDef, 0, 0xFF);
|
||||
u32 unusable = CheckMoveLimitations(battlerDef, 0, MOVE_LIMITATIONS_ALL);
|
||||
u16 *moves = gBattleResources->battleHistory->usedMoves[battlerDef];
|
||||
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
@ -1053,7 +1053,7 @@ bool32 CanTargetFaintAi(u8 battlerDef, u8 battlerAtk)
|
||||
bool32 CanAIFaintTarget(u8 battlerAtk, u8 battlerDef, u8 numHits)
|
||||
{
|
||||
s32 i, dmg;
|
||||
u32 moveLimitations = CheckMoveLimitations(battlerAtk, 0, 0xFF);
|
||||
u32 moveLimitations = CheckMoveLimitations(battlerAtk, 0, MOVE_LIMITATIONS_ALL);
|
||||
u16 *moves = gBattleMons[battlerAtk].moves;
|
||||
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
@ -1077,7 +1077,7 @@ bool32 CanAIFaintTarget(u8 battlerAtk, u8 battlerDef, u8 numHits)
|
||||
bool32 CanMoveFaintBattler(u16 move, u8 battlerDef, u8 battlerAtk, u8 nHits)
|
||||
{
|
||||
s32 i, dmg;
|
||||
u32 unusable = CheckMoveLimitations(battlerDef, 0, 0xFF);
|
||||
u32 unusable = CheckMoveLimitations(battlerDef, 0, MOVE_LIMITATIONS_ALL);
|
||||
|
||||
if (move != MOVE_NONE && move != 0xFFFF && !(unusable & gBitTable[i]) && AI_CalcDamage(move, battlerDef, battlerAtk) >= gBattleMons[battlerAtk].hp)
|
||||
return TRUE;
|
||||
@ -1089,7 +1089,7 @@ bool32 CanMoveFaintBattler(u16 move, u8 battlerDef, u8 battlerAtk, u8 nHits)
|
||||
bool32 CanTargetFaintAiWithMod(u8 battlerDef, u8 battlerAtk, s32 hpMod, s32 dmgMod)
|
||||
{
|
||||
u32 i;
|
||||
u32 unusable = CheckMoveLimitations(battlerDef, 0, 0xFF);
|
||||
u32 unusable = CheckMoveLimitations(battlerDef, 0, MOVE_LIMITATIONS_ALL);
|
||||
s32 dmg;
|
||||
u16 *moves = gBattleResources->battleHistory->usedMoves[battlerDef];
|
||||
u32 hpCheck = gBattleMons[battlerAtk].hp + hpMod;
|
||||
@ -1909,7 +1909,7 @@ bool32 HasMoveWithLowAccuracy(u8 battlerAtk, u8 battlerDef, u8 accCheck, bool32
|
||||
{
|
||||
s32 i;
|
||||
u16 *moves = GetMovesArray(battlerAtk);
|
||||
u8 moveLimitations = CheckMoveLimitations(battlerAtk, 0, 0xFF);
|
||||
u8 moveLimitations = CheckMoveLimitations(battlerAtk, 0, MOVE_LIMITATIONS_ALL);
|
||||
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
@ -1934,7 +1934,7 @@ bool32 HasMoveWithLowAccuracy(u8 battlerAtk, u8 battlerDef, u8 accCheck, bool32
|
||||
|
||||
bool32 HasSleepMoveWithLowAccuracy(u8 battlerAtk, u8 battlerDef)
|
||||
{
|
||||
u8 moveLimitations = CheckMoveLimitations(battlerAtk, 0, 0xFF);
|
||||
u8 moveLimitations = CheckMoveLimitations(battlerAtk, 0, MOVE_LIMITATIONS_ALL);
|
||||
u32 i;
|
||||
u16 *moves = GetMovesArray(battlerAtk);
|
||||
|
||||
|
@ -1325,10 +1325,10 @@ static void PrintSecondaryEntries(struct BattleDebugMenu *data)
|
||||
{
|
||||
u8 *txtPtr = StringCopy(text, gStatNamesTable[STAT_ATK + i]);
|
||||
txtPtr[0] = CHAR_SPACE;
|
||||
if (gBattleMons[data->battlerId].statStages[STAT_ATK + i] >= 6)
|
||||
if (gBattleMons[data->battlerId].statStages[STAT_ATK + i] >= DEFAULT_STAT_STAGE)
|
||||
{
|
||||
txtPtr[1] = CHAR_PLUS;
|
||||
txtPtr[2] = CHAR_0 + (gBattleMons[data->battlerId].statStages[STAT_ATK + i] - 6);
|
||||
txtPtr[2] = CHAR_0 + (gBattleMons[data->battlerId].statStages[STAT_ATK + i] - DEFAULT_STAT_STAGE);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -3271,7 +3271,7 @@ static void DoBattleIntro(void)
|
||||
gBattleStruct->hpOnSwitchout[GetBattlerSide(gActiveBattler)] = gBattleMons[gActiveBattler].hp;
|
||||
gBattleMons[gActiveBattler].status2 = 0;
|
||||
for (i = 0; i < NUM_BATTLE_STATS; i++)
|
||||
gBattleMons[gActiveBattler].statStages[i] = 6;
|
||||
gBattleMons[gActiveBattler].statStages[i] = DEFAULT_STAT_STAGE;
|
||||
}
|
||||
|
||||
// Draw sprite.
|
||||
|
@ -1323,7 +1323,7 @@ static const u8 sBattlePalaceNatureToFlavorTextId[NUM_NATURES] =
|
||||
static bool32 NoTargetPresent(u32 move)
|
||||
{
|
||||
if (!IsBattlerAlive(gBattlerTarget))
|
||||
gBattlerTarget = GetMoveTarget(move, 0);
|
||||
gBattlerTarget = GetMoveTarget(move, NO_TARGET_OVERRIDE);
|
||||
|
||||
switch (gBattleMoves[move].target)
|
||||
{
|
||||
@ -1673,16 +1673,16 @@ u32 GetTotalAccuracy(u32 battlerAtk, u32 battlerDef, u32 move)
|
||||
accStage = gBattleMons[battlerAtk].statStages[STAT_ACC];
|
||||
evasionStage = gBattleMons[battlerDef].statStages[STAT_EVASION];
|
||||
if (atkAbility == ABILITY_UNAWARE || atkAbility == ABILITY_KEEN_EYE)
|
||||
evasionStage = DEFAULT_STAT_STAGE ;
|
||||
evasionStage = DEFAULT_STAT_STAGE;
|
||||
if (gBattleMoves[move].flags & FLAG_STAT_STAGES_IGNORED)
|
||||
evasionStage = DEFAULT_STAT_STAGE ;
|
||||
evasionStage = DEFAULT_STAT_STAGE;
|
||||
if (defAbility == ABILITY_UNAWARE)
|
||||
accStage = DEFAULT_STAT_STAGE ;
|
||||
accStage = DEFAULT_STAT_STAGE;
|
||||
|
||||
if (gBattleMons[battlerDef].status2 & STATUS2_FORESIGHT || gStatuses3[battlerDef] & STATUS3_MIRACLE_EYED)
|
||||
buff = accStage;
|
||||
else
|
||||
buff = accStage + DEFAULT_STAT_STAGE - evasionStage;
|
||||
buff = accStage + DEFAULT_STAT_STAGE - evasionStage;
|
||||
|
||||
if (buff < MIN_STAT_STAGE)
|
||||
buff = MIN_STAT_STAGE;
|
||||
@ -3318,13 +3318,13 @@ void SetMoveEffect(bool32 primary, u32 certain)
|
||||
case MOVE_EFFECT_CLEAR_SMOG:
|
||||
for (i = 0; i < NUM_BATTLE_STATS; i++)
|
||||
{
|
||||
if (gBattleMons[gEffectBattler].statStages[i] != 6)
|
||||
if (gBattleMons[gEffectBattler].statStages[i] != DEFAULT_STAT_STAGE)
|
||||
break;
|
||||
}
|
||||
if ((gSpecialStatuses[gEffectBattler].physicalDmg || gSpecialStatuses[gEffectBattler].specialDmg) && i != NUM_BATTLE_STATS)
|
||||
{
|
||||
for (i = 0; i < NUM_BATTLE_STATS; i++)
|
||||
gBattleMons[gEffectBattler].statStages[i] = 6;
|
||||
gBattleMons[gEffectBattler].statStages[i] = DEFAULT_STAT_STAGE;
|
||||
BattleScriptPush(gBattlescriptCurrInstr + 1);
|
||||
gBattlescriptCurrInstr = BattleScript_MoveEffectClearSmog;
|
||||
}
|
||||
@ -3377,14 +3377,14 @@ void SetMoveEffect(bool32 primary, u32 certain)
|
||||
gBattleScripting.animArg1 = 0;
|
||||
for (i = STAT_ATK; i < NUM_BATTLE_STATS; i++)
|
||||
{
|
||||
if (gBattleMons[gBattlerTarget].statStages[i] > 6 && gBattleMons[gBattlerAttacker].statStages[i] != 12)
|
||||
if (gBattleMons[gBattlerTarget].statStages[i] > DEFAULT_STAT_STAGE && gBattleMons[gBattlerAttacker].statStages[i] != MAX_STAT_STAGE)
|
||||
{
|
||||
gBattleStruct->stolenStats[0] |= gBitTable[i];
|
||||
// Store by how many stages to raise the stat.
|
||||
gBattleStruct->stolenStats[i] = gBattleMons[gBattlerTarget].statStages[i] - 6;
|
||||
while (gBattleMons[gBattlerAttacker].statStages[i] + gBattleStruct->stolenStats[i] > 12)
|
||||
gBattleStruct->stolenStats[i] = gBattleMons[gBattlerTarget].statStages[i] - DEFAULT_STAT_STAGE;
|
||||
while (gBattleMons[gBattlerAttacker].statStages[i] + gBattleStruct->stolenStats[i] > MAX_STAT_STAGE)
|
||||
gBattleStruct->stolenStats[i]--;
|
||||
gBattleMons[gBattlerTarget].statStages[i] = 6;
|
||||
gBattleMons[gBattlerTarget].statStages[i] = DEFAULT_STAT_STAGE;
|
||||
|
||||
if (gBattleStruct->stolenStats[i] >= 2)
|
||||
byTwo++;
|
||||
@ -8194,10 +8194,10 @@ static void Cmd_various(void)
|
||||
case VARIOUS_INVERT_STAT_STAGES:
|
||||
for (i = 0; i < NUM_BATTLE_STATS; i++)
|
||||
{
|
||||
if (gBattleMons[gActiveBattler].statStages[i] < 6) // Negative becomes positive.
|
||||
gBattleMons[gActiveBattler].statStages[i] = 6 + (6 - gBattleMons[gActiveBattler].statStages[i]);
|
||||
else if (gBattleMons[gActiveBattler].statStages[i] > 6) // Positive becomes negative.
|
||||
gBattleMons[gActiveBattler].statStages[i] = 6 - (gBattleMons[gActiveBattler].statStages[i] - 6);
|
||||
if (gBattleMons[gActiveBattler].statStages[i] < DEFAULT_STAT_STAGE) // Negative becomes positive.
|
||||
gBattleMons[gActiveBattler].statStages[i] = DEFAULT_STAT_STAGE + (DEFAULT_STAT_STAGE - gBattleMons[gActiveBattler].statStages[i]);
|
||||
else if (gBattleMons[gActiveBattler].statStages[i] > DEFAULT_STAT_STAGE) // Positive becomes negative.
|
||||
gBattleMons[gActiveBattler].statStages[i] = DEFAULT_STAT_STAGE - (gBattleMons[gActiveBattler].statStages[i] - DEFAULT_STAT_STAGE);
|
||||
}
|
||||
break;
|
||||
case VARIOUS_SET_TERRAIN:
|
||||
@ -8227,7 +8227,7 @@ static void Cmd_various(void)
|
||||
default:
|
||||
gCalledMove = move;
|
||||
gHitMarker &= ~HITMARKER_ATTACKSTRING_PRINTED;
|
||||
gBattlerTarget = GetMoveTarget(gCalledMove, 0);
|
||||
gBattlerTarget = GetMoveTarget(gCalledMove, NO_TARGET_OVERRIDE);
|
||||
gStatuses3[gBattlerAttacker] |= STATUS3_ME_FIRST;
|
||||
gBattlescriptCurrInstr += 7;
|
||||
break;
|
||||
@ -8478,7 +8478,7 @@ static void Cmd_various(void)
|
||||
{
|
||||
gCalledMove = gLastUsedMove;
|
||||
gHitMarker &= ~HITMARKER_ATTACKSTRING_PRINTED;
|
||||
gBattlerTarget = GetMoveTarget(gCalledMove, 0);
|
||||
gBattlerTarget = GetMoveTarget(gCalledMove, NO_TARGET_OVERRIDE);
|
||||
gBattlescriptCurrInstr += 7;
|
||||
}
|
||||
return;
|
||||
@ -8836,7 +8836,7 @@ static void Cmd_various(void)
|
||||
}
|
||||
return;
|
||||
case VARIOUS_MOVEEND_ITEM_EFFECTS:
|
||||
if (ItemBattleEffects(1, gActiveBattler, FALSE))
|
||||
if (ItemBattleEffects(ITEMEFFECT_NORMAL, gActiveBattler, FALSE))
|
||||
return;
|
||||
break;
|
||||
case VARIOUS_ROOM_SERVICE:
|
||||
|
@ -1768,7 +1768,7 @@ u8 TrySetCantSelectMoveBattleScript(void)
|
||||
limitations++;
|
||||
}
|
||||
}
|
||||
if ((GetBattlerAbility(gActiveBattler) == ABILITY_GORILLA_TACTICS) && *choicedMove != MOVE_NONE
|
||||
if ((GetBattlerAbility(gActiveBattler) == ABILITY_GORILLA_TACTICS) && *choicedMove != MOVE_NONE
|
||||
&& *choicedMove != 0xFFFF && *choicedMove != move)
|
||||
{
|
||||
gCurrentMove = *choicedMove;
|
||||
@ -3764,46 +3764,46 @@ u8 TryWeatherFormChange(u8 battler)
|
||||
{
|
||||
if (GetBattlerAbility(battler) != ABILITY_FORECAST || gBattleMons[battler].hp == 0)
|
||||
{
|
||||
ret = 0;
|
||||
ret = 0; // No change
|
||||
}
|
||||
else if (!weatherEffect && !IS_BATTLER_OF_TYPE(battler, TYPE_NORMAL))
|
||||
{
|
||||
SET_BATTLER_TYPE(battler, TYPE_NORMAL);
|
||||
ret = 1;
|
||||
ret = CASTFORM_NORMAL + 1;
|
||||
}
|
||||
else if (!weatherEffect)
|
||||
{
|
||||
ret = 0;
|
||||
ret = 0; // No change
|
||||
}
|
||||
else if (holdEffect == HOLD_EFFECT_UTILITY_UMBRELLA || (!(gBattleWeather & (B_WEATHER_RAIN | B_WEATHER_SUN | B_WEATHER_HAIL)) && !IS_BATTLER_OF_TYPE(battler, TYPE_NORMAL)))
|
||||
{
|
||||
SET_BATTLER_TYPE(battler, TYPE_NORMAL);
|
||||
ret = 1;
|
||||
ret = CASTFORM_NORMAL + 1;
|
||||
}
|
||||
else if (gBattleWeather & B_WEATHER_SUN && holdEffect != HOLD_EFFECT_UTILITY_UMBRELLA && !IS_BATTLER_OF_TYPE(battler, TYPE_FIRE))
|
||||
{
|
||||
SET_BATTLER_TYPE(battler, TYPE_FIRE);
|
||||
ret = 2;
|
||||
ret = CASTFORM_FIRE + 1;
|
||||
}
|
||||
else if (gBattleWeather & B_WEATHER_RAIN && holdEffect != HOLD_EFFECT_UTILITY_UMBRELLA && !IS_BATTLER_OF_TYPE(battler, TYPE_WATER))
|
||||
{
|
||||
SET_BATTLER_TYPE(battler, TYPE_WATER);
|
||||
ret = 3;
|
||||
ret = CASTFORM_WATER + 1;
|
||||
}
|
||||
else if (gBattleWeather & B_WEATHER_HAIL && !IS_BATTLER_OF_TYPE(battler, TYPE_ICE))
|
||||
{
|
||||
SET_BATTLER_TYPE(battler, TYPE_ICE);
|
||||
ret = 4;
|
||||
ret = CASTFORM_ICE + 1;
|
||||
}
|
||||
}
|
||||
else if (gBattleMons[battler].species == SPECIES_CHERRIM)
|
||||
{
|
||||
if (GetBattlerAbility(battler) != ABILITY_FLOWER_GIFT || gBattleMons[battler].hp == 0)
|
||||
ret = 0;
|
||||
ret = 0; // No change
|
||||
else if (gBattleMonForms[battler] == 0 && weatherEffect && holdEffect != HOLD_EFFECT_UTILITY_UMBRELLA && gBattleWeather & B_WEATHER_SUN)
|
||||
ret = 2;
|
||||
ret = CHERRIM_SUNSHINE + 1;
|
||||
else if (gBattleMonForms[battler] != 0 && (!weatherEffect || holdEffect == HOLD_EFFECT_UTILITY_UMBRELLA || !(gBattleWeather & B_WEATHER_SUN)))
|
||||
ret = 1;
|
||||
ret = CHERRIM_OVERCAST + 1;
|
||||
}
|
||||
|
||||
return ret;
|
||||
@ -4166,7 +4166,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SWITCHIN_PASTEL_VEIL;
|
||||
BattleScriptPushCursorAndCallback(BattleScript_PastelVeilActivates);
|
||||
effect++;
|
||||
gSpecialStatuses[battler].switchInAbilityDone = 1;
|
||||
gSpecialStatuses[battler].switchInAbilityDone = TRUE;
|
||||
}
|
||||
break;
|
||||
case ABILITY_ANTICIPATION:
|
||||
|
@ -4338,7 +4338,7 @@ void PokemonToBattleMon(struct Pokemon *src, struct BattlePokemon *dst)
|
||||
GetMonData(src, MON_DATA_OT_NAME, dst->otName);
|
||||
|
||||
for (i = 0; i < NUM_BATTLE_STATS; i++)
|
||||
dst->statStages[i] = 6;
|
||||
dst->statStages[i] = DEFAULT_STAT_STAGE;
|
||||
|
||||
dst->status2 = 0;
|
||||
}
|
||||
@ -6398,64 +6398,64 @@ static s32 GetWildMonTableIdInAlteringCave(u16 species)
|
||||
|
||||
void SetWildMonHeldItem(void)
|
||||
{
|
||||
u16 rnd, species, chanceNoItem, chanceCommon, i, count;
|
||||
if (gBattleTypeFlags & (BATTLE_TYPE_LEGENDARY | BATTLE_TYPE_TRAINER | BATTLE_TYPE_PYRAMID | BATTLE_TYPE_PIKE))
|
||||
return;
|
||||
if (!(gBattleTypeFlags & (BATTLE_TYPE_LEGENDARY | BATTLE_TYPE_TRAINER | BATTLE_TYPE_PYRAMID | BATTLE_TYPE_PIKE)))
|
||||
{
|
||||
u16 rnd;
|
||||
u16 species;
|
||||
u16 chanceNoItem = 45;
|
||||
u16 chanceCommon = 95;
|
||||
u16 count = (WILD_DOUBLE_BATTLE) ? 2 : 1;
|
||||
u16 i;
|
||||
|
||||
count = (WILD_DOUBLE_BATTLE) ? 2 : 1;
|
||||
if (!GetMonData(&gPlayerParty[0], MON_DATA_SANITY_IS_EGG, 0)
|
||||
&& (GetMonAbility(&gPlayerParty[0]) == ABILITY_COMPOUND_EYES
|
||||
|| GetMonAbility(&gPlayerParty[0]) == ABILITY_SUPER_LUCK))
|
||||
{
|
||||
chanceNoItem = 20;
|
||||
chanceCommon = 80;
|
||||
}
|
||||
else
|
||||
{
|
||||
chanceNoItem = 45;
|
||||
chanceCommon = 95;
|
||||
}
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
rnd = Random() % 100;
|
||||
species = GetMonData(&gEnemyParty[i], MON_DATA_SPECIES, 0);
|
||||
if (gMapHeader.mapLayoutId == LAYOUT_ALTERING_CAVE)
|
||||
if (!GetMonData(&gPlayerParty[0], MON_DATA_SANITY_IS_EGG, 0)
|
||||
&& (GetMonAbility(&gPlayerParty[0]) == ABILITY_COMPOUND_EYES
|
||||
|| GetMonAbility(&gPlayerParty[0]) == ABILITY_SUPER_LUCK))
|
||||
{
|
||||
s32 alteringCaveId = GetWildMonTableIdInAlteringCave(species);
|
||||
if (alteringCaveId != 0)
|
||||
{
|
||||
// In active Altering Cave, use special item list
|
||||
if (rnd < chanceCommon)
|
||||
continue;
|
||||
SetMonData(&gEnemyParty[i], MON_DATA_HELD_ITEM, &sAlteringCaveWildMonHeldItems[alteringCaveId].item);
|
||||
}
|
||||
else
|
||||
{
|
||||
// In inactive Altering Cave, use normal items
|
||||
if (rnd < chanceNoItem)
|
||||
continue;
|
||||
if (rnd < chanceCommon)
|
||||
SetMonData(&gEnemyParty[i], MON_DATA_HELD_ITEM, &gBaseStats[species].item1);
|
||||
else
|
||||
SetMonData(&gEnemyParty[i], MON_DATA_HELD_ITEM, &gBaseStats[species].item2);
|
||||
}
|
||||
chanceNoItem = 20;
|
||||
chanceCommon = 80;
|
||||
}
|
||||
else
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
if (gBaseStats[species].item1 == gBaseStats[species].item2 && gBaseStats[species].item1 != ITEM_NONE)
|
||||
rnd = Random() % 100;
|
||||
species = GetMonData(&gEnemyParty[i], MON_DATA_SPECIES, 0);
|
||||
if (gMapHeader.mapLayoutId == LAYOUT_ALTERING_CAVE)
|
||||
{
|
||||
// Both held items are the same, 100% chance to hold item
|
||||
SetMonData(&gEnemyParty[i], MON_DATA_HELD_ITEM, &gBaseStats[species].item1);
|
||||
s32 alteringCaveId = GetWildMonTableIdInAlteringCave(species);
|
||||
if (alteringCaveId != 0)
|
||||
{
|
||||
// In active Altering Cave, use special item list
|
||||
if (rnd < chanceCommon)
|
||||
continue;
|
||||
SetMonData(&gEnemyParty[i], MON_DATA_HELD_ITEM, &sAlteringCaveWildMonHeldItems[alteringCaveId].item);
|
||||
}
|
||||
else
|
||||
{
|
||||
// In inactive Altering Cave, use normal items
|
||||
if (rnd < chanceNoItem)
|
||||
continue;
|
||||
if (rnd < chanceCommon)
|
||||
SetMonData(&gEnemyParty[i], MON_DATA_HELD_ITEM, &gBaseStats[species].item1);
|
||||
else
|
||||
SetMonData(&gEnemyParty[i], MON_DATA_HELD_ITEM, &gBaseStats[species].item2);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (rnd < chanceNoItem)
|
||||
continue;
|
||||
if (rnd < chanceCommon)
|
||||
if (gBaseStats[species].item1 == gBaseStats[species].item2 && gBaseStats[species].item1 != ITEM_NONE)
|
||||
{
|
||||
// Both held items are the same, 100% chance to hold item
|
||||
SetMonData(&gEnemyParty[i], MON_DATA_HELD_ITEM, &gBaseStats[species].item1);
|
||||
}
|
||||
else
|
||||
SetMonData(&gEnemyParty[i], MON_DATA_HELD_ITEM, &gBaseStats[species].item2);
|
||||
{
|
||||
if (rnd < chanceNoItem)
|
||||
continue;
|
||||
if (rnd < chanceCommon)
|
||||
SetMonData(&gEnemyParty[i], MON_DATA_HELD_ITEM, &gBaseStats[species].item1);
|
||||
else
|
||||
SetMonData(&gEnemyParty[i], MON_DATA_HELD_ITEM, &gBaseStats[species].item2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user