mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-26 03:34:15 +01:00
Battle files - review changes
This commit is contained in:
parent
ea5ffa3375
commit
bf0178238a
@ -214,8 +214,8 @@ struct SpecialStatus
|
||||
{
|
||||
u8 statLowered:1; // 0x1
|
||||
u8 lightningRodRedirected:1; // 0x2
|
||||
u8 restoredBankSprite: 1; // 0x4
|
||||
u8 intimidatedPoke:1; // 0x8
|
||||
u8 restoredBattlerSprite: 1; // 0x4
|
||||
u8 intimidatedMon:1; // 0x8
|
||||
u8 traced:1; // 0x10
|
||||
u8 flag20:1;
|
||||
u8 flag40:1;
|
||||
@ -607,8 +607,8 @@ struct BattleScripting
|
||||
|
||||
// rom_80A5C6C
|
||||
u8 GetBattlerSide(u8 battler);
|
||||
u8 GetBattlerPosition(u8 bank);
|
||||
u8 GetBattlerAtPosition(u8 bank);
|
||||
u8 GetBattlerPosition(u8 battler);
|
||||
u8 GetBattlerAtPosition(u8 battler);
|
||||
|
||||
struct BattleSpriteInfo
|
||||
{
|
||||
|
@ -81,7 +81,7 @@ enum
|
||||
#define INSTANT_HP_BAR_DROP 32767
|
||||
|
||||
// Special return values in gBattleBufferB from Battle Controller functions.
|
||||
#define RET_VALUE_LEVELLED_UP 11
|
||||
#define RET_VALUE_LEVELED_UP 11
|
||||
|
||||
struct UnusedControllerStruct
|
||||
{
|
||||
|
@ -862,9 +862,9 @@
|
||||
// Special Trainer Ids.
|
||||
#define TRAINER_FRONTIER_BRAIN 1022
|
||||
#define TRAINER_SECRET_BASE 1024
|
||||
#define TRAINER_LINK_OPPONENT 0x800
|
||||
#define TRAINER_OPPONENT_C00 0xC00
|
||||
#define TRAINER_STEVEN_PARTNER 0xC03
|
||||
#define TRAINER_LINK_OPPONENT 2048
|
||||
#define TRAINER_OPPONENT_C00 3072
|
||||
#define TRAINER_STEVEN_PARTNER 3075
|
||||
|
||||
#define TRAINER_PIC_HIKER 0
|
||||
#define TRAINER_PIC_AQUA_GRUNT_M 1
|
||||
|
@ -582,6 +582,7 @@
|
||||
#define BLDCNT_TGT1_BG3 (1 << 3)
|
||||
#define BLDCNT_TGT1_OBJ (1 << 4)
|
||||
#define BLDCNT_TGT1_BD (1 << 5)
|
||||
#define BLDCNT_TGT1_ALL (BLDCNT_TGT1_BG0 | BLDCNT_TGT1_BG1 | BLDCNT_TGT1_BG2 | BLDCNT_TGT1_BG3 | BLDCNT_TGT1_OBJ | BLDCNT_TGT1_BD)
|
||||
// Bits 6-7 select the special effect
|
||||
#define BLDCNT_EFFECT_NONE (0 << 6) // no special effect
|
||||
#define BLDCNT_EFFECT_BLEND (1 << 6) // 1st+2nd targets mixed (controlled by BLDALPHA)
|
||||
@ -594,6 +595,7 @@
|
||||
#define BLDCNT_TGT2_BG3 (1 << 11)
|
||||
#define BLDCNT_TGT2_OBJ (1 << 12)
|
||||
#define BLDCNT_TGT2_BD (1 << 13)
|
||||
#define BLDCNT_TGT2_ALL (BLDCNT_TGT2_BG0 | BLDCNT_TGT2_BG1 | BLDCNT_TGT2_BG2 | BLDCNT_TGT2_BG3 | BLDCNT_TGT2_OBJ | BLDCNT_TGT2_BD)
|
||||
|
||||
// BLDALPHA
|
||||
#define BLDALPHA_BLEND(target1, target2) (((target2) << 8) | (target1))
|
||||
|
@ -352,7 +352,7 @@ void BattleAI_SetupAIData(u8 defaultScoreMoves)
|
||||
if (gAbsentBattlerFlags & gBitTable[gBattlerTarget])
|
||||
gBattlerTarget ^= BIT_FLANK;
|
||||
}
|
||||
// There's only one choice in signle battles.
|
||||
// There's only one choice in single battles.
|
||||
else
|
||||
{
|
||||
gBattlerTarget = sBattler_AI ^ BIT_SIDE;
|
||||
@ -774,7 +774,7 @@ static void BattleAICmd_if_status(void)
|
||||
|
||||
status = T1_READ_32(gAIScriptPtr + 2);
|
||||
|
||||
if ((gBattleMons[battlerId].status1 & status))
|
||||
if (gBattleMons[battlerId].status1 & status)
|
||||
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 6);
|
||||
else
|
||||
gAIScriptPtr += 10;
|
||||
@ -846,7 +846,7 @@ static void BattleAICmd_if_status3(void)
|
||||
|
||||
status = T1_READ_32(gAIScriptPtr + 2);
|
||||
|
||||
if ((gStatuses3[battlerId] & status))
|
||||
if (gStatuses3[battlerId] & status)
|
||||
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 6);
|
||||
else
|
||||
gAIScriptPtr += 10;
|
||||
@ -883,7 +883,7 @@ static void BattleAICmd_if_side_affecting(void)
|
||||
side = GET_BATTLER_SIDE(battlerId);
|
||||
status = T1_READ_32(gAIScriptPtr + 2);
|
||||
|
||||
if ((gSideStatuses[side] & status))
|
||||
if (gSideStatuses[side] & status)
|
||||
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 6);
|
||||
else
|
||||
gAIScriptPtr += 10;
|
||||
@ -1949,7 +1949,7 @@ static void BattleAICmd_if_curr_move_disabled_or_encored(void)
|
||||
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 2);
|
||||
else
|
||||
gAIScriptPtr += 6;
|
||||
break;;
|
||||
break;
|
||||
case 1:
|
||||
if (gDisableStructs[gActiveBattler].encoredMove == AI_THINKING_STRUCT->moveConsidered)
|
||||
gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 2);
|
||||
|
@ -1169,7 +1169,7 @@ static void Task_GiveExpToMon(u8 taskId)
|
||||
gainedExp -= nextLvlExp - currExp;
|
||||
savedActiveBattler = gActiveBattler;
|
||||
gActiveBattler = battlerId;
|
||||
BtlController_EmitTwoReturnValues(1, RET_VALUE_LEVELLED_UP, gainedExp);
|
||||
BtlController_EmitTwoReturnValues(1, RET_VALUE_LEVELED_UP, gainedExp);
|
||||
gActiveBattler = savedActiveBattler;
|
||||
|
||||
if (IsDoubleBattle() == TRUE
|
||||
@ -1248,7 +1248,7 @@ static void sub_8059400(u8 taskId)
|
||||
gainedExp -= expOnNextLvl - currExp;
|
||||
savedActiveBattler = gActiveBattler;
|
||||
gActiveBattler = battlerId;
|
||||
BtlController_EmitTwoReturnValues(1, RET_VALUE_LEVELLED_UP, gainedExp);
|
||||
BtlController_EmitTwoReturnValues(1, RET_VALUE_LEVELED_UP, gainedExp);
|
||||
gActiveBattler = savedActiveBattler;
|
||||
gTasks[taskId].func = Task_LaunchLvlUpAnim;
|
||||
}
|
||||
|
@ -345,7 +345,7 @@ static void Task_GiveExpToMon(u8 taskId)
|
||||
gainedExp -= nextLvlExp - currExp;
|
||||
savedActiveBank = gActiveBattler;
|
||||
gActiveBattler = battlerId;
|
||||
BtlController_EmitTwoReturnValues(1, RET_VALUE_LEVELLED_UP, gainedExp);
|
||||
BtlController_EmitTwoReturnValues(1, RET_VALUE_LEVELED_UP, gainedExp);
|
||||
gActiveBattler = savedActiveBank;
|
||||
|
||||
if (IsDoubleBattle() == TRUE
|
||||
@ -424,7 +424,7 @@ static void sub_81BB4E4(u8 taskId)
|
||||
gainedExp -= expOnNextLvl - currExp;
|
||||
savedActiveBank = gActiveBattler;
|
||||
gActiveBattler = battlerId;
|
||||
BtlController_EmitTwoReturnValues(1, RET_VALUE_LEVELLED_UP, gainedExp);
|
||||
BtlController_EmitTwoReturnValues(1, RET_VALUE_LEVELED_UP, gainedExp);
|
||||
gActiveBattler = savedActiveBank;
|
||||
gTasks[taskId].func = sub_81BB628;
|
||||
}
|
||||
|
@ -1710,8 +1710,8 @@ void Task_HidePartyStatusSummary(u8 taskId)
|
||||
for (i = 0; i < PARTY_SIZE; i++)
|
||||
ballIconSpriteIds[i] = gTasks[taskId].tBallIconSpriteId(i);
|
||||
|
||||
SetGpuReg(REG_OFFSET_BLDCNT, 0x3F40);
|
||||
SetGpuReg(REG_OFFSET_BLDALPHA, 0x10);
|
||||
SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT2_ALL | BLDCNT_EFFECT_BLEND);
|
||||
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(16, 0));
|
||||
|
||||
gTasks[taskId].tData15 = 16;
|
||||
|
||||
|
@ -2940,19 +2940,19 @@ static void ChooseTypeOfMoveUsedString(u8* dst)
|
||||
void BattlePutTextOnWindow(const u8 *text, u8 windowId)
|
||||
{
|
||||
const struct BattleWindowText *textInfo = sBattleTextOnWindowsInfo[gBattleScripting.windowsType];
|
||||
bool32 toVram;
|
||||
bool32 copyToVram;
|
||||
struct TextSubPrinter textSubPrinter;
|
||||
u8 speed;
|
||||
|
||||
if (windowId & 0x80)
|
||||
{
|
||||
windowId &= ~(0x80);
|
||||
toVram = FALSE;
|
||||
copyToVram = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
FillWindowPixelBuffer(windowId, textInfo[windowId].fillValue);
|
||||
toVram = TRUE;
|
||||
copyToVram = TRUE;
|
||||
}
|
||||
|
||||
textSubPrinter.current_text_offset = text;
|
||||
@ -3005,7 +3005,7 @@ void BattlePutTextOnWindow(const u8 *text, u8 windowId)
|
||||
|
||||
AddTextPrinter(&textSubPrinter, speed, NULL);
|
||||
|
||||
if (toVram)
|
||||
if (copyToVram)
|
||||
{
|
||||
PutWindowTilemap(windowId);
|
||||
CopyWindowToVram(windowId, 3);
|
||||
|
@ -3449,7 +3449,7 @@ static void atk23_getexp(void)
|
||||
if (gBattleControllerExecFlags == 0)
|
||||
{
|
||||
gActiveBattler = gBattleStruct->expGetterBattlerId;
|
||||
if (gBattleBufferB[gActiveBattler][0] == CONTROLLER_TWORETURNVALUES && gBattleBufferB[gActiveBattler][1] == RET_VALUE_LEVELLED_UP)
|
||||
if (gBattleBufferB[gActiveBattler][0] == CONTROLLER_TWORETURNVALUES && gBattleBufferB[gActiveBattler][1] == RET_VALUE_LEVELED_UP)
|
||||
{
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_TRAINER && gBattlerPartyIndexes[gActiveBattler] == gBattleStruct->expGetterMonId)
|
||||
HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler);
|
||||
@ -4649,14 +4649,14 @@ static void atk49_moveend(void)
|
||||
BtlController_EmitSpriteInvisibility(0, FALSE);
|
||||
MarkBattlerForControllerExec(gActiveBattler);
|
||||
gStatuses3[gBattlerAttacker] &= ~(STATUS3_SEMI_INVULNERABLE);
|
||||
gSpecialStatuses[gBattlerAttacker].restoredBankSprite = 1;
|
||||
gSpecialStatuses[gBattlerAttacker].restoredBattlerSprite = 1;
|
||||
gBattleScripting.atk49_state++;
|
||||
return;
|
||||
}
|
||||
gBattleScripting.atk49_state++;
|
||||
break;
|
||||
case 10: // make target sprite visible
|
||||
if (!gSpecialStatuses[gBattlerTarget].restoredBankSprite && gBattlerTarget < gBattlersCount
|
||||
if (!gSpecialStatuses[gBattlerTarget].restoredBattlerSprite && gBattlerTarget < gBattlersCount
|
||||
&& !(gStatuses3[gBattlerTarget] & STATUS3_SEMI_INVULNERABLE))
|
||||
{
|
||||
gActiveBattler = gBattlerTarget;
|
||||
@ -6632,7 +6632,7 @@ static void atk76_various(void)
|
||||
gBattleCommunication[0] = 0;
|
||||
break;
|
||||
case VARIOUS_RESET_INTIMIDATE_TRACE_BITS:
|
||||
gSpecialStatuses[gActiveBattler].intimidatedPoke = 0;
|
||||
gSpecialStatuses[gActiveBattler].intimidatedMon = 0;
|
||||
gSpecialStatuses[gActiveBattler].traced = 0;
|
||||
break;
|
||||
case VARIOUS_UPDATE_CHOICE_MOVE_ON_LVL_UP:
|
||||
|
@ -470,11 +470,11 @@ u8 GetImprisonedMovesCount(u8 battlerId, u16 move)
|
||||
{
|
||||
s32 i;
|
||||
u8 imprisionedMoves = 0;
|
||||
u8 BattlerSide = GetBattlerSide(battlerId);
|
||||
u8 battlerSide = GetBattlerSide(battlerId);
|
||||
|
||||
for (i = 0; i < gBattlersCount; i++)
|
||||
{
|
||||
if (BattlerSide != GetBattlerSide(i) && gStatuses3[i] & STATUS3_IMPRISONED_OTHERS)
|
||||
if (battlerSide != GetBattlerSide(i) && gStatuses3[i] & STATUS3_IMPRISONED_OTHERS)
|
||||
{
|
||||
s32 j;
|
||||
for (j = 0; j < 4; j++)
|
||||
@ -1840,10 +1840,10 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA
|
||||
}
|
||||
break;
|
||||
case ABILITY_INTIMIDATE:
|
||||
if (!(gSpecialStatuses[battler].intimidatedPoke))
|
||||
if (!(gSpecialStatuses[battler].intimidatedMon))
|
||||
{
|
||||
gStatuses3[battler] |= STATUS3_INTIMIDATE_POKES;
|
||||
gSpecialStatuses[battler].intimidatedPoke = 1;
|
||||
gSpecialStatuses[battler].intimidatedMon = 1;
|
||||
}
|
||||
break;
|
||||
case ABILITY_FORECAST:
|
||||
@ -2511,32 +2511,32 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
|
||||
int i = 0;
|
||||
u8 effect = ITEM_NO_EFFECT;
|
||||
u8 changedPP = 0;
|
||||
u8 BattlerHoldEffect, atkHoldEffect, defHoldEffect;
|
||||
u8 BattlerQuality, atkQuality, defQuality;
|
||||
u8 battlerHoldEffect, atkHoldEffect, defHoldEffect;
|
||||
u8 battlerHoldEffectParam, atkHoldEffectParam, defHoldEffectParam;
|
||||
u16 atkItem, defItem;
|
||||
|
||||
gLastUsedItem = gBattleMons[battlerId].item;
|
||||
if (gLastUsedItem == ITEM_ENIGMA_BERRY)
|
||||
{
|
||||
BattlerHoldEffect = gEnigmaBerries[battlerId].holdEffect;
|
||||
BattlerQuality = gEnigmaBerries[battlerId].holdEffectParam;
|
||||
battlerHoldEffect = gEnigmaBerries[battlerId].holdEffect;
|
||||
battlerHoldEffectParam = gEnigmaBerries[battlerId].holdEffectParam;
|
||||
}
|
||||
else
|
||||
{
|
||||
BattlerHoldEffect = ItemId_GetHoldEffect(gLastUsedItem);
|
||||
BattlerQuality = ItemId_GetHoldEffectParam(gLastUsedItem);
|
||||
battlerHoldEffect = ItemId_GetHoldEffect(gLastUsedItem);
|
||||
battlerHoldEffectParam = ItemId_GetHoldEffectParam(gLastUsedItem);
|
||||
}
|
||||
|
||||
atkItem = gBattleMons[gBattlerAttacker].item;
|
||||
if (atkItem == ITEM_ENIGMA_BERRY)
|
||||
{
|
||||
atkHoldEffect = gEnigmaBerries[gBattlerAttacker].holdEffect;
|
||||
atkQuality = gEnigmaBerries[gBattlerAttacker].holdEffectParam;
|
||||
atkHoldEffectParam = gEnigmaBerries[gBattlerAttacker].holdEffectParam;
|
||||
}
|
||||
else
|
||||
{
|
||||
atkHoldEffect = ItemId_GetHoldEffect(atkItem);
|
||||
atkQuality = ItemId_GetHoldEffectParam(atkItem);
|
||||
atkHoldEffectParam = ItemId_GetHoldEffectParam(atkItem);
|
||||
}
|
||||
|
||||
// def variables are unused
|
||||
@ -2544,18 +2544,18 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
|
||||
if (defItem == ITEM_ENIGMA_BERRY)
|
||||
{
|
||||
defHoldEffect = gEnigmaBerries[gBattlerTarget].holdEffect;
|
||||
defQuality = gEnigmaBerries[gBattlerTarget].holdEffectParam;
|
||||
defHoldEffectParam = gEnigmaBerries[gBattlerTarget].holdEffectParam;
|
||||
}
|
||||
else
|
||||
{
|
||||
defHoldEffect = ItemId_GetHoldEffect(defItem);
|
||||
defQuality = ItemId_GetHoldEffectParam(defItem);
|
||||
defHoldEffectParam = ItemId_GetHoldEffectParam(defItem);
|
||||
}
|
||||
|
||||
switch (caseID)
|
||||
{
|
||||
case ITEMEFFECT_ON_SWITCH_IN:
|
||||
switch (BattlerHoldEffect)
|
||||
switch (battlerHoldEffect)
|
||||
{
|
||||
case HOLD_EFFECT_DOUBLE_PRIZE:
|
||||
if (GetBattlerSide(battlerId) == B_SIDE_PLAYER)
|
||||
@ -2583,13 +2583,13 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
|
||||
case 1:
|
||||
if (gBattleMons[battlerId].hp)
|
||||
{
|
||||
switch (BattlerHoldEffect)
|
||||
switch (battlerHoldEffect)
|
||||
{
|
||||
case HOLD_EFFECT_RESTORE_HP:
|
||||
if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / 2 && !moveTurn)
|
||||
{
|
||||
gBattleMoveDamage = BattlerQuality;
|
||||
if (gBattleMons[battlerId].hp + BattlerQuality > gBattleMons[battlerId].maxHP)
|
||||
gBattleMoveDamage = battlerHoldEffectParam;
|
||||
if (gBattleMons[battlerId].hp + battlerHoldEffectParam > gBattleMons[battlerId].maxHP)
|
||||
gBattleMoveDamage = gBattleMons[battlerId].maxHP - gBattleMons[battlerId].hp;
|
||||
gBattleMoveDamage *= -1;
|
||||
BattleScriptExecute(BattleScript_ItemHealHP_RemoveItem);
|
||||
@ -2618,10 +2618,10 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
|
||||
if (i != 4)
|
||||
{
|
||||
u8 maxPP = CalculatePPWithBonus(move, ppBonuses, i);
|
||||
if (changedPP + BattlerQuality > maxPP)
|
||||
if (changedPP + battlerHoldEffectParam > maxPP)
|
||||
changedPP = maxPP;
|
||||
else
|
||||
changedPP = changedPP + BattlerQuality;
|
||||
changedPP = changedPP + battlerHoldEffectParam;
|
||||
|
||||
PREPARE_MOVE_BUFFER(gBattleTextBuff1, move);
|
||||
|
||||
@ -2660,7 +2660,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
|
||||
gBattleMoveDamage *= -1;
|
||||
BattleScriptExecute(BattleScript_ItemHealHP_End2);
|
||||
effect = ITEM_HP_CHANGE;
|
||||
RecordItemEffectBattle(battlerId, BattlerHoldEffect);
|
||||
RecordItemEffectBattle(battlerId, battlerHoldEffect);
|
||||
}
|
||||
break;
|
||||
// nice copy/paste there gamefreak, making a function for confuse berries was too much eh?
|
||||
@ -2669,7 +2669,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
|
||||
{
|
||||
PREPARE_FLAVOR_BUFFER(gBattleTextBuff1, FLAVOR_SPICY);
|
||||
|
||||
gBattleMoveDamage = gBattleMons[battlerId].maxHP / BattlerQuality;
|
||||
gBattleMoveDamage = gBattleMons[battlerId].maxHP / battlerHoldEffectParam;
|
||||
if (gBattleMoveDamage == 0)
|
||||
gBattleMoveDamage = 1;
|
||||
if (gBattleMons[battlerId].hp + gBattleMoveDamage > gBattleMons[battlerId].maxHP)
|
||||
@ -2687,7 +2687,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
|
||||
{
|
||||
PREPARE_FLAVOR_BUFFER(gBattleTextBuff1, FLAVOR_DRY);
|
||||
|
||||
gBattleMoveDamage = gBattleMons[battlerId].maxHP / BattlerQuality;
|
||||
gBattleMoveDamage = gBattleMons[battlerId].maxHP / battlerHoldEffectParam;
|
||||
if (gBattleMoveDamage == 0)
|
||||
gBattleMoveDamage = 1;
|
||||
if (gBattleMons[battlerId].hp + gBattleMoveDamage > gBattleMons[battlerId].maxHP)
|
||||
@ -2705,7 +2705,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
|
||||
{
|
||||
PREPARE_FLAVOR_BUFFER(gBattleTextBuff1, FLAVOR_SWEET);
|
||||
|
||||
gBattleMoveDamage = gBattleMons[battlerId].maxHP / BattlerQuality;
|
||||
gBattleMoveDamage = gBattleMons[battlerId].maxHP / battlerHoldEffectParam;
|
||||
if (gBattleMoveDamage == 0)
|
||||
gBattleMoveDamage = 1;
|
||||
if (gBattleMons[battlerId].hp + gBattleMoveDamage > gBattleMons[battlerId].maxHP)
|
||||
@ -2723,7 +2723,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
|
||||
{
|
||||
PREPARE_FLAVOR_BUFFER(gBattleTextBuff1, FLAVOR_BITTER);
|
||||
|
||||
gBattleMoveDamage = gBattleMons[battlerId].maxHP / BattlerQuality;
|
||||
gBattleMoveDamage = gBattleMons[battlerId].maxHP / battlerHoldEffectParam;
|
||||
if (gBattleMoveDamage == 0)
|
||||
gBattleMoveDamage = 1;
|
||||
if (gBattleMons[battlerId].hp + gBattleMoveDamage > gBattleMons[battlerId].maxHP)
|
||||
@ -2741,7 +2741,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
|
||||
{
|
||||
PREPARE_FLAVOR_BUFFER(gBattleTextBuff1, FLAVOR_SOUR);
|
||||
|
||||
gBattleMoveDamage = gBattleMons[battlerId].maxHP / BattlerQuality;
|
||||
gBattleMoveDamage = gBattleMons[battlerId].maxHP / battlerHoldEffectParam;
|
||||
if (gBattleMoveDamage == 0)
|
||||
gBattleMoveDamage = 1;
|
||||
if (gBattleMons[battlerId].hp + gBattleMoveDamage > gBattleMons[battlerId].maxHP)
|
||||
@ -2756,7 +2756,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
|
||||
break;
|
||||
// copy/paste again, smh
|
||||
case HOLD_EFFECT_ATTACK_UP:
|
||||
if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / BattlerQuality && !moveTurn && gBattleMons[battlerId].statStages[STAT_ATK] < 0xC)
|
||||
if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / battlerHoldEffectParam && !moveTurn && gBattleMons[battlerId].statStages[STAT_ATK] < 0xC)
|
||||
{
|
||||
PREPARE_STAT_BUFFER(gBattleTextBuff1, STAT_ATK);
|
||||
PREPARE_STRING_BUFFER(gBattleTextBuff2, STRINGID_STATROSE);
|
||||
@ -2770,7 +2770,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
|
||||
}
|
||||
break;
|
||||
case HOLD_EFFECT_DEFENSE_UP:
|
||||
if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / BattlerQuality && !moveTurn && gBattleMons[battlerId].statStages[STAT_DEF] < 0xC)
|
||||
if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / battlerHoldEffectParam && !moveTurn && gBattleMons[battlerId].statStages[STAT_DEF] < 0xC)
|
||||
{
|
||||
PREPARE_STAT_BUFFER(gBattleTextBuff1, STAT_DEF);
|
||||
|
||||
@ -2783,7 +2783,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
|
||||
}
|
||||
break;
|
||||
case HOLD_EFFECT_SPEED_UP:
|
||||
if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / BattlerQuality && !moveTurn && gBattleMons[battlerId].statStages[STAT_SPEED] < 0xC)
|
||||
if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / battlerHoldEffectParam && !moveTurn && gBattleMons[battlerId].statStages[STAT_SPEED] < 0xC)
|
||||
{
|
||||
PREPARE_STAT_BUFFER(gBattleTextBuff1, STAT_SPEED);
|
||||
|
||||
@ -2796,7 +2796,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
|
||||
}
|
||||
break;
|
||||
case HOLD_EFFECT_SP_ATTACK_UP:
|
||||
if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / BattlerQuality && !moveTurn && gBattleMons[battlerId].statStages[STAT_SPATK] < 0xC)
|
||||
if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / battlerHoldEffectParam && !moveTurn && gBattleMons[battlerId].statStages[STAT_SPATK] < 0xC)
|
||||
{
|
||||
PREPARE_STAT_BUFFER(gBattleTextBuff1, STAT_SPATK);
|
||||
|
||||
@ -2809,7 +2809,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
|
||||
}
|
||||
break;
|
||||
case HOLD_EFFECT_SP_DEFENSE_UP:
|
||||
if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / BattlerQuality && !moveTurn && gBattleMons[battlerId].statStages[STAT_SPDEF] < 0xC)
|
||||
if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / battlerHoldEffectParam && !moveTurn && gBattleMons[battlerId].statStages[STAT_SPDEF] < 0xC)
|
||||
{
|
||||
PREPARE_STAT_BUFFER(gBattleTextBuff1, STAT_SPDEF);
|
||||
|
||||
@ -2822,7 +2822,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
|
||||
}
|
||||
break;
|
||||
case HOLD_EFFECT_CRITICAL_UP:
|
||||
if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / BattlerQuality && !moveTurn && !(gBattleMons[battlerId].status2 & STATUS2_FOCUS_ENERGY))
|
||||
if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / battlerHoldEffectParam && !moveTurn && !(gBattleMons[battlerId].status2 & STATUS2_FOCUS_ENERGY))
|
||||
{
|
||||
gBattleMons[battlerId].status2 |= STATUS2_FOCUS_ENERGY;
|
||||
BattleScriptExecute(BattleScript_BerryFocusEnergyEnd2);
|
||||
@ -2830,7 +2830,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
|
||||
}
|
||||
break;
|
||||
case HOLD_EFFECT_RANDOM_STAT_UP:
|
||||
if (!moveTurn && gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / BattlerQuality)
|
||||
if (!moveTurn && gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / battlerHoldEffectParam)
|
||||
{
|
||||
for (i = 0; i < 5; i++)
|
||||
{
|
||||
@ -2996,15 +2996,15 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
|
||||
gLastUsedItem = gBattleMons[battlerId].item;
|
||||
if (gBattleMons[battlerId].item == ITEM_ENIGMA_BERRY)
|
||||
{
|
||||
BattlerHoldEffect = gEnigmaBerries[battlerId].holdEffect;
|
||||
BattlerQuality = gEnigmaBerries[battlerId].holdEffectParam;
|
||||
battlerHoldEffect = gEnigmaBerries[battlerId].holdEffect;
|
||||
battlerHoldEffectParam = gEnigmaBerries[battlerId].holdEffectParam;
|
||||
}
|
||||
else
|
||||
{
|
||||
BattlerHoldEffect = ItemId_GetHoldEffect(gLastUsedItem);
|
||||
BattlerQuality = ItemId_GetHoldEffectParam(gLastUsedItem);
|
||||
battlerHoldEffect = ItemId_GetHoldEffect(gLastUsedItem);
|
||||
battlerHoldEffectParam = ItemId_GetHoldEffectParam(gLastUsedItem);
|
||||
}
|
||||
switch (BattlerHoldEffect)
|
||||
switch (battlerHoldEffect)
|
||||
{
|
||||
case HOLD_EFFECT_CURE_PAR:
|
||||
if (gBattleMons[battlerId].status1 & STATUS1_PARALYSIS)
|
||||
@ -3146,7 +3146,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
|
||||
case HOLD_EFFECT_FLINCH:
|
||||
if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)
|
||||
&& TARGET_TURN_DAMAGED
|
||||
&& (Random() % 100) < atkQuality
|
||||
&& (Random() % 100) < atkHoldEffectParam
|
||||
&& gBattleMoves[gCurrentMove].flags & FLAG_KINGSROCK_AFFECTED
|
||||
&& gBattleMons[gBattlerTarget].hp)
|
||||
{
|
||||
@ -3167,7 +3167,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
|
||||
gLastUsedItem = atkItem;
|
||||
gPotentialItemEffectBattler = gBattlerAttacker;
|
||||
gBattleScripting.battler = gBattlerAttacker;
|
||||
gBattleMoveDamage = (gSpecialStatuses[gBattlerTarget].dmg / atkQuality) * -1;
|
||||
gBattleMoveDamage = (gSpecialStatuses[gBattlerTarget].dmg / atkHoldEffectParam) * -1;
|
||||
if (gBattleMoveDamage == 0)
|
||||
gBattleMoveDamage = -1;
|
||||
gSpecialStatuses[gBattlerTarget].dmg = 0;
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include "task.h"
|
||||
#include "field_effect.h"
|
||||
#include "constants/flags.h"
|
||||
#include "constants/maps.h"
|
||||
|
||||
extern void MapGridSetMetatileIdAt(s32 x, s32 y, u16 metatileId); // fieldmap
|
||||
extern void DrawWholeMapView(); // field_camera
|
||||
@ -205,14 +206,25 @@ void SealedChamberShakingEffect(u8 taskId)
|
||||
// moved later in the function because it was rewritten.
|
||||
bool8 ShouldDoBrailleStrengthEffect(void)
|
||||
{
|
||||
if (!FlagGet(FLAG_SYS_BRAILLE_STRENGTH) && (gSaveBlock1Ptr->location.mapGroup == 0x18 && gSaveBlock1Ptr->location.mapNum == 0x06))
|
||||
if (!FlagGet(FLAG_SYS_BRAILLE_STRENGTH)
|
||||
&& gSaveBlock1Ptr->location.mapGroup == MAP_GROUP(DESERT_RUINS)
|
||||
&& gSaveBlock1Ptr->location.mapNum == MAP_NUM(DESERT_RUINS))
|
||||
{
|
||||
if (gSaveBlock1Ptr->pos.x == 6 && gSaveBlock1Ptr->pos.y == 23)
|
||||
{ sBraillePuzzleCallbackFlag = STRENGTH_PUZZLE; return TRUE; }
|
||||
{
|
||||
sBraillePuzzleCallbackFlag = STRENGTH_PUZZLE;
|
||||
return TRUE;
|
||||
}
|
||||
else if (gSaveBlock1Ptr->pos.x == 5 && gSaveBlock1Ptr->pos.y == 23)
|
||||
{ sBraillePuzzleCallbackFlag = STRENGTH_PUZZLE; return TRUE; }
|
||||
{
|
||||
sBraillePuzzleCallbackFlag = STRENGTH_PUZZLE;
|
||||
return TRUE;
|
||||
}
|
||||
else if (gSaveBlock1Ptr->pos.x == 7 && gSaveBlock1Ptr->pos.y == 23)
|
||||
{ sBraillePuzzleCallbackFlag = STRENGTH_PUZZLE; return TRUE; }
|
||||
{
|
||||
sBraillePuzzleCallbackFlag = STRENGTH_PUZZLE;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
|
@ -2265,7 +2265,7 @@ s32 CalculateBaseDamage(struct BattlePokemon *attacker, struct BattlePokemon *de
|
||||
if (attackerHoldEffect == sHoldEffectToType[i][0]
|
||||
&& type == sHoldEffectToType[i][1])
|
||||
{
|
||||
if (type <= 8)
|
||||
if (IS_MOVE_PHYSICAL(type))
|
||||
attack = (attack * (attackerHoldEffectParam + 100)) / 100;
|
||||
else
|
||||
spAttack = (spAttack * (attackerHoldEffectParam + 100)) / 100;
|
||||
@ -2293,9 +2293,9 @@ s32 CalculateBaseDamage(struct BattlePokemon *attacker, struct BattlePokemon *de
|
||||
spAttack /= 2;
|
||||
if (attacker->ability == ABILITY_HUSTLE)
|
||||
attack = (150 * attack) / 100;
|
||||
if (attacker->ability == ABILITY_PLUS && AbilityBattleEffects(ABILITYEFFECT_FIELD_SPORT, 0, ABILITY_MINUS, 0, 0))
|
||||
if (attacker->ability == ABILITY_PLUS && ABILITY_ON_FIELD2(ABILITY_MINUS))
|
||||
spAttack = (150 * spAttack) / 100;
|
||||
if (attacker->ability == ABILITY_MINUS && AbilityBattleEffects(ABILITYEFFECT_FIELD_SPORT, 0, ABILITY_PLUS, 0, 0))
|
||||
if (attacker->ability == ABILITY_MINUS && ABILITY_ON_FIELD2(ABILITY_PLUS))
|
||||
spAttack = (150 * spAttack) / 100;
|
||||
if (attacker->ability == ABILITY_GUTS && attacker->status1)
|
||||
attack = (150 * attack) / 100;
|
||||
@ -2316,7 +2316,7 @@ s32 CalculateBaseDamage(struct BattlePokemon *attacker, struct BattlePokemon *de
|
||||
if (gBattleMoves[gCurrentMove].effect == EFFECT_EXPLOSION)
|
||||
defense /= 2;
|
||||
|
||||
if (type < TYPE_MYSTERY) // is physical
|
||||
if (IS_MOVE_PHYSICAL(type) && type != TYPE_MYSTERY)
|
||||
{
|
||||
if (gCritMultiplier == 2)
|
||||
{
|
||||
@ -2366,7 +2366,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 (IS_MOVE_SPECIAL(type))
|
||||
{
|
||||
if (gCritMultiplier == 2)
|
||||
{
|
||||
@ -2406,8 +2406,7 @@ s32 CalculateBaseDamage(struct BattlePokemon *attacker, struct BattlePokemon *de
|
||||
damage /= 2;
|
||||
|
||||
// are effects of weather negated with cloud nine or air lock
|
||||
if (!AbilityBattleEffects(ABILITYEFFECT_FIELD_SPORT, 0, ABILITY_CLOUD_NINE, 0, 0)
|
||||
&& !AbilityBattleEffects(ABILITYEFFECT_FIELD_SPORT, 0, ABILITY_AIR_LOCK, 0, 0))
|
||||
if (WEATHER_HAS_EFFECT2)
|
||||
{
|
||||
if (gBattleWeather & WEATHER_RAIN_TEMPORARY)
|
||||
{
|
||||
@ -4514,7 +4513,7 @@ u16 GetEvolutionTargetSpecies(struct Pokemon *mon, u8 type, u16 evolutionItem)
|
||||
holdEffect = ItemId_GetHoldEffect(heldItem);
|
||||
|
||||
if (holdEffect == HOLD_EFFECT_PREVENT_EVOLVE && type != 3)
|
||||
return 0;
|
||||
return SPECIES_NONE;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
@ -4522,7 +4521,7 @@ u16 GetEvolutionTargetSpecies(struct Pokemon *mon, u8 type, u16 evolutionItem)
|
||||
level = GetMonData(mon, MON_DATA_LEVEL, 0);
|
||||
friendship = GetMonData(mon, MON_DATA_FRIENDSHIP, 0);
|
||||
|
||||
for (i = 0; i < 5; i++)
|
||||
for (i = 0; i < EVOS_PER_MON; i++)
|
||||
{
|
||||
switch (gEvolutionTable[species][i].method)
|
||||
{
|
||||
@ -4579,7 +4578,7 @@ u16 GetEvolutionTargetSpecies(struct Pokemon *mon, u8 type, u16 evolutionItem)
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
for (i = 0; i < 5; i++)
|
||||
for (i = 0; i < EVOS_PER_MON; i++)
|
||||
{
|
||||
switch (gEvolutionTable[species][i].method)
|
||||
{
|
||||
@ -4599,7 +4598,7 @@ u16 GetEvolutionTargetSpecies(struct Pokemon *mon, u8 type, u16 evolutionItem)
|
||||
break;
|
||||
case 2:
|
||||
case 3:
|
||||
for (i = 0; i < 5; i++)
|
||||
for (i = 0; i < EVOS_PER_MON; i++)
|
||||
{
|
||||
if (gEvolutionTable[species][i].method == EVO_ITEM
|
||||
&& gEvolutionTable[species][i].param == evolutionItem)
|
||||
|
Loading…
Reference in New Issue
Block a user