Merge branch 'RHH/upcoming' into RHH/pr/upcoming/dynamax
# Conflicts: # include/battle.h # include/constants/battle_move_effects.h # include/constants/battle_string_ids.h # src/battle_main.c # src/battle_message.c # src/battle_script_commands.c # src/battle_util.c
This commit is contained in:
commit
c0540a3559
2
Makefile
2
Makefile
@ -119,7 +119,7 @@ LIBPATH := -L ../../tools/agbcc/lib
|
||||
LIB := $(LIBPATH) -lgcc -lc -L../../libagbsyscall -lagbsyscall
|
||||
else
|
||||
CC1 = $(shell $(PATH_MODERNCC) --print-prog-name=cc1) -quiet
|
||||
override CFLAGS += -mthumb -mthumb-interwork -O2 -mabi=apcs-gnu -mtune=arm7tdmi -march=armv4t -fno-toplevel-reorder -Wno-pointer-to-int-cast -std=gnu17
|
||||
override CFLAGS += -mthumb -mthumb-interwork -O2 -mabi=apcs-gnu -mtune=arm7tdmi -march=armv4t -fno-toplevel-reorder -Wno-pointer-to-int-cast -std=gnu17 -Werror -Wall -Wno-strict-aliasing -Wno-attribute-alias
|
||||
ifeq ($(ANALYZE),1)
|
||||
override CFLAGS += -fanalyzer
|
||||
endif
|
||||
|
||||
@ -19482,8 +19482,8 @@ Move_MILK_DRINK:
|
||||
Move_MAGNITUDE:
|
||||
createvisualtask AnimTask_IsPowerOver99, 2
|
||||
waitforvisualfinish
|
||||
jumpargeq 15, FALSE, MagnitudeRegular
|
||||
jumpargeq 15, TRUE, MagnitudeIntense
|
||||
jumpreteq FALSE, MagnitudeRegular
|
||||
jumpreteq TRUE, MagnitudeIntense
|
||||
MagnitudeEnd:
|
||||
end
|
||||
MagnitudeRegular:
|
||||
|
||||
@ -439,8 +439,51 @@ gBattleScriptsForMoveEffects::
|
||||
.4byte BattleScript_EffectSaltCure @ EFFECT_SALT_CURE
|
||||
.4byte BattleScript_EffectMaxMove @ EFFECT_MAX_MOVE
|
||||
|
||||
.4byte BattleScript_EffectMatchaGotcha @ EFFECT_MATCHA_GOTCHA
|
||||
.4byte BattleScript_EffectSyrupBomb @ EFFECT_SYRUP_BOMB
|
||||
.4byte BattleScript_EffectHit @ EFFECT_IVY_CUDGEL
|
||||
|
||||
BattleScript_EffectSyrupBomb::
|
||||
setmoveeffect MOVE_EFFECT_SYRUP_BOMB
|
||||
call BattleScript_EffectHit_Ret
|
||||
seteffectwithchance
|
||||
tryfaintmon BS_TARGET
|
||||
printstring STRINGID_TARGETCOVEREDINSTICKYCANDYSYRUP
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
goto BattleScript_MoveEnd
|
||||
|
||||
BattleScript_SyrupBombEndTurn::
|
||||
setbyte sSTAT_ANIM_PLAYED, FALSE
|
||||
copybyte sBATTLER, gBattlerTarget
|
||||
jumpifholdeffect BS_TARGET, HOLD_EFFECT_CLEAR_AMULET, BattleScript_SyrupBombItemNoStatLoss
|
||||
jumpifability BS_TARGET, ABILITY_CLEAR_BODY, BattleScript_SyrupBombAbilityNoStatLoss
|
||||
jumpifability BS_TARGET, ABILITY_FULL_METAL_BODY, BattleScript_SyrupBombAbilityNoStatLoss
|
||||
jumpifability BS_TARGET, ABILITY_WHITE_SMOKE, BattleScript_SyrupBombAbilityNoStatLoss
|
||||
jumpifstat BS_TARGET, CMP_GREATER_THAN, BIT_SPEED, MIN_STAT_STAGE, BattleScript_SyrupBombLowerSpeed
|
||||
goto BattleScript_SyrupBombEnd2
|
||||
BattleScript_SyrupBombLowerSpeed:
|
||||
playstatchangeanimation BS_ATTACKER, BIT_SPEED, STAT_CHANGE_NEGATIVE
|
||||
setbyte sSTAT_ANIM_PLAYED, TRUE
|
||||
setstatchanger STAT_SPEED, 1, TRUE
|
||||
statbuffchange STAT_CHANGE_ALLOW_PTR, BattleScript_SyrupBombEnd2
|
||||
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, B_MSG_STAT_WONT_DECREASE, BattleScript_SyrupBombEnd2
|
||||
printfromtable gStatDownStringIds
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
BattleScript_SyrupBombItemNoStatLoss::
|
||||
call BattleScript_ItemNoStatLoss
|
||||
goto BattleScript_SyrupBombEnd2
|
||||
BattleScript_SyrupBombAbilityNoStatLoss::
|
||||
call BattleScript_AbilityNoStatLoss
|
||||
BattleScript_SyrupBombEnd2::
|
||||
end2
|
||||
|
||||
BattleScript_EffectMatchaGotcha::
|
||||
setmoveeffect MOVE_EFFECT_BURN
|
||||
goto BattleScript_EffectAbsorb
|
||||
|
||||
BattleScript_EffectSaltCure:
|
||||
call BattleScript_EffectHit_Ret
|
||||
tryfaintmon BS_TARGET
|
||||
jumpiffainted BS_TARGET, TRUE, BattleScript_EffectSaltCure_End
|
||||
applysaltcure BS_TARGET
|
||||
printstring STRINGID_TARGETISBEINGSALTCURED
|
||||
@ -3338,6 +3381,7 @@ BattleScript_EffectPoisonHit:
|
||||
|
||||
BattleScript_EffectAbsorb::
|
||||
call BattleScript_EffectHit_Ret
|
||||
seteffectwithchance
|
||||
jumpifstatus3 BS_ATTACKER, STATUS3_HEAL_BLOCK, BattleScript_AbsorbHealBlock
|
||||
setdrainedhp
|
||||
manipulatedamage DMG_BIG_ROOT
|
||||
@ -3864,6 +3908,7 @@ BattleScript_EffectRest::
|
||||
jumpifuproarwakes BattleScript_RestCantSleep
|
||||
jumpifability BS_TARGET, ABILITY_INSOMNIA, BattleScript_InsomniaProtects
|
||||
jumpifability BS_TARGET, ABILITY_VITAL_SPIRIT, BattleScript_InsomniaProtects
|
||||
jumpifability BS_ATTACKER, ABILITY_PURIFYING_SALT, BattleScript_InsomniaProtects
|
||||
.if B_LEAF_GUARD_PREVENTS_REST >= GEN_5
|
||||
jumpifleafguardprotected BS_TARGET, BattleScript_LeafGuardPreventsRest
|
||||
.endif
|
||||
@ -7984,9 +8029,10 @@ BattleScript_DoTurnDmgEnd:
|
||||
end2
|
||||
|
||||
BattleScript_PoisonHealActivates::
|
||||
copybyte gBattlerAbility, gBattlerAttacker
|
||||
call BattleScript_AbilityPopUp
|
||||
printstring STRINGID_POISONHEALHPUP
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
recordability BS_ATTACKER
|
||||
statusanimation BS_ATTACKER
|
||||
orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_PASSIVE_DAMAGE
|
||||
healthbarupdate BS_ATTACKER
|
||||
@ -8736,28 +8782,6 @@ BattleScript_ActivateTerrainEffects_Increment:
|
||||
restoretarget
|
||||
return
|
||||
|
||||
BattleScript_ActivateSwitchInAbilities:
|
||||
copybyte sBATTLER, gBattlerAttacker
|
||||
setbyte gBattlerAttacker, 0
|
||||
BattleScript_ActivateSwitchInAbilities_Loop:
|
||||
switchinabilities BS_ATTACKER
|
||||
BattleScript_ActivateSwitchInAbilities_Increment:
|
||||
addbyte gBattlerAttacker, 1
|
||||
jumpifbytenotequal gBattlerAttacker, gBattlersCount, BattleScript_ActivateSwitchInAbilities_Loop
|
||||
copybyte gBattlerAttacker, sBATTLER
|
||||
return
|
||||
|
||||
BattleScript_ActivateTerrainAbilities:
|
||||
savetarget
|
||||
setbyte gBattlerTarget, 0
|
||||
BattleScript_ActivateTerrainAbilities_Loop:
|
||||
activateterrainchangeabilities BS_ATTACKER
|
||||
BattleScript_ActivateTerrainAbilities_Increment:
|
||||
addbyte gBattlerTarget, 1
|
||||
jumpifbytenotequal gBattlerTarget, gBattlersCount, BattleScript_ActivateTerrainAbilities_Loop
|
||||
restoretarget
|
||||
return
|
||||
|
||||
BattleScript_ElectricSurgeActivates::
|
||||
pause B_WAIT_TIME_SHORT
|
||||
call BattleScript_AbilityPopUp
|
||||
@ -9926,6 +9950,14 @@ BattleScript_MirrorHerbCopyStatChange::
|
||||
copybyte gBattlerAttacker, sSAVED_BATTLER @ restore the original attacker just to be safe
|
||||
return
|
||||
|
||||
BattleScript_OpportunistCopyStatChange::
|
||||
call BattleScript_AbilityPopUp
|
||||
printstring STRINGID_OPPORTUNISTCOPIED
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
call BattleScript_TotemVar_Ret
|
||||
copybyte gBattlerAttacker, sSAVED_BATTLER @ restore the original attacker just to be safe
|
||||
end3
|
||||
|
||||
BattleScript_TotemVar::
|
||||
call BattleScript_TotemVar_Ret
|
||||
end2
|
||||
|
||||
@ -1,5 +1,8 @@
|
||||
#include "global.h"
|
||||
#include "malloc.h"
|
||||
#if TESTING
|
||||
#include "test/test.h"
|
||||
#endif
|
||||
|
||||
static void *sHeapStart;
|
||||
static u32 sHeapSize;
|
||||
@ -71,7 +74,27 @@ void *AllocInternal(void *heapStart, u32 size, const char *location)
|
||||
}
|
||||
|
||||
if (pos->next == head)
|
||||
{
|
||||
#if TESTING
|
||||
const struct MemBlock *head = HeapHead();
|
||||
const struct MemBlock *block = head;
|
||||
do
|
||||
{
|
||||
if (block->allocated)
|
||||
{
|
||||
const char *location = MemBlockLocation(block);
|
||||
if (location)
|
||||
MgbaPrintf_("%s: %d bytes allocated", location, block->size);
|
||||
else
|
||||
MgbaPrintf_("<unknown>: %d bytes allocated", block->size);
|
||||
}
|
||||
block = block->next;
|
||||
}
|
||||
while (block != head);
|
||||
Test_ExitWithResult(TEST_RESULT_ERROR, "%s: OOM allocating %d bytes", location, size);
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
|
||||
pos = pos->next;
|
||||
}
|
||||
|
||||
@ -324,7 +324,7 @@ void AnimateSprites(void)
|
||||
void BuildOamBuffer(void)
|
||||
{
|
||||
bool32 oamLoadDisabled;
|
||||
u32 i, stride;
|
||||
u32 i;
|
||||
u8 oamIndex;
|
||||
|
||||
// All attributes which affect sorting packed into a single u32:
|
||||
|
||||
BIN
graphics/pokemon/pikachu/world_cap/icon.png
Normal file
BIN
graphics/pokemon/pikachu/world_cap/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 370 B |
@ -105,6 +105,7 @@ struct DisableStruct
|
||||
u8 toxicSpikesDone:1;
|
||||
u8 stickyWebDone:1;
|
||||
u8 stealthRockDone:1;
|
||||
u8 syrupBombTimer;
|
||||
u8 steelSurgeDone:1;
|
||||
};
|
||||
|
||||
@ -153,6 +154,7 @@ struct ProtectStruct
|
||||
u16 maxGuarded:1;
|
||||
u16 silkTrapped:1;
|
||||
u16 eatMirrorHerb:1;
|
||||
u16 activateOpportunist:2; // 2 - to copy stats. 1 - stats copied (do not repeat). 0 - no stats to copy
|
||||
u32 physicalDmg;
|
||||
u32 specialDmg;
|
||||
u8 physicalBattlerId;
|
||||
@ -927,7 +929,7 @@ struct MonSpritesGfx
|
||||
u16 *buffer;
|
||||
};
|
||||
|
||||
struct TotemBoost
|
||||
struct QueuedStatBoost
|
||||
{
|
||||
u8 stats; // bitfield for each battle stat that is set if the stat changes
|
||||
s8 statChanges[NUM_BATTLE_STATS - 1]; // highest bit being set decreases the stat
|
||||
@ -946,7 +948,7 @@ extern u16 gBattle_WIN0H;
|
||||
extern u16 gBattle_WIN0V;
|
||||
extern u16 gBattle_WIN1H;
|
||||
extern u16 gBattle_WIN1V;
|
||||
extern u8 gDisplayedStringBattle[400];
|
||||
extern u8 gDisplayedStringBattle[425];
|
||||
extern u8 gBattleTextBuff1[TEXT_BUFF_ARRAY_COUNT];
|
||||
extern u8 gBattleTextBuff2[TEXT_BUFF_ARRAY_COUNT];
|
||||
extern u8 gBattleTextBuff3[30]; //to handle stupidly large z move names
|
||||
@ -1040,7 +1042,7 @@ extern u32 gFieldStatuses;
|
||||
extern struct FieldTimer gFieldTimers;
|
||||
extern u8 gBattlerAbility;
|
||||
extern u16 gPartnerSpriteId;
|
||||
extern struct TotemBoost gTotemBoosts[MAX_BATTLERS_COUNT];
|
||||
extern struct QueuedStatBoost gQueuedStatBoosts[MAX_BATTLERS_COUNT];
|
||||
|
||||
extern void (*gPreBattleCallback1)(void);
|
||||
extern void (*gBattleMainFunc)(void);
|
||||
|
||||
@ -24,6 +24,13 @@
|
||||
score += val; \
|
||||
} while (0) \
|
||||
|
||||
#define ADJUST_SCORE_PTR(val) \
|
||||
do \
|
||||
{ \
|
||||
TestRunner_Battle_AIAdjustScore(__FILE__, __LINE__, sBattler_AI, AI_THINKING_STRUCT->movesetIndex, val); \
|
||||
(*score) += val; \
|
||||
} while (0) \
|
||||
|
||||
#define RETURN_SCORE_PLUS(val) \
|
||||
{ \
|
||||
ADJUST_SCORE(val); \
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
#ifndef GUARD_BATTLE_SCRIPTS_H
|
||||
#define GUARD_BATTLE_SCRIPTS_H
|
||||
|
||||
extern const u8 BattleScript_OpportunistCopyStatChange[];
|
||||
extern const u8 BattleScript_MirrorHerbCopyStatChange[];
|
||||
extern const u8 BattleScript_MirrorHerbCopyStatChangeEnd2[];
|
||||
extern const u8 BattleScript_NotAffected[];
|
||||
@ -479,6 +480,7 @@ extern const u8 BattleScript_UltraBurst[];
|
||||
extern const u8 BattleScript_SelectingNotAllowedCurrentMove[];
|
||||
extern const u8 BattleScript_SelectingNotAllowedCurrentMoveInPalace[];
|
||||
extern const u8 BattleScript_SaltCureExtraDamage[];
|
||||
extern const u8 BattleScript_SyrupBombEndTurn[];
|
||||
|
||||
// zmoves
|
||||
extern const u8 BattleScript_ZMoveActivateDamaging[];
|
||||
|
||||
@ -33,14 +33,15 @@
|
||||
#define ABILITYEFFECT_TRACE2 10
|
||||
#define ABILITYEFFECT_MOVE_END_OTHER 11
|
||||
#define ABILITYEFFECT_NEUTRALIZINGGAS 12
|
||||
#define ABILITYEFFECT_FIELD_SPORT 13 // Only used if B_SPORT_TURNS < GEN_6
|
||||
#define ABILITYEFFECT_FIELD_SPORT 13 // Only used if B_SPORT_TURNS >= GEN_6
|
||||
#define ABILITYEFFECT_ON_WEATHER 14
|
||||
#define ABILITYEFFECT_ON_TERRAIN 15
|
||||
#define ABILITYEFFECT_SWITCH_IN_TERRAIN 16
|
||||
#define ABILITYEFFECT_SWITCH_IN_WEATHER 17
|
||||
#define ABILITYEFFECT_OPPORTUNIST 18
|
||||
// Special cases
|
||||
#define ABILITYEFFECT_MUD_SPORT 252 // Only used if B_SPORT_TURNS < GEN_6
|
||||
#define ABILITYEFFECT_WATER_SPORT 253 // Only used if B_SPORT_TURNS < GEN_6
|
||||
#define ABILITYEFFECT_MUD_SPORT 252 // Only used if B_SPORT_TURNS >= GEN_6
|
||||
#define ABILITYEFFECT_WATER_SPORT 253 // Only used if B_SPORT_TURNS >= GEN_6
|
||||
|
||||
// For the first argument of ItemBattleEffects, to deteremine which block of item effects to try
|
||||
#define ITEMEFFECT_ON_SWITCH_IN 0
|
||||
@ -248,6 +249,7 @@ bool32 ChangeTypeBasedOnTerrain(u32 battler);
|
||||
void RemoveConfusionStatus(u32 battler);
|
||||
u8 GetBattlerGender(u32 battler);
|
||||
bool32 AreBattlersOfOppositeGender(u32 battler1, u32 battler2);
|
||||
bool32 AreBattlersOfSameGender(u32 battler1, u32 battler2);
|
||||
u32 CalcSecondaryEffectChance(u32 battler, u8 secondaryEffectChance);
|
||||
u8 GetBattlerType(u32 battler, u8 typeIndex);
|
||||
|
||||
|
||||
@ -25,7 +25,7 @@
|
||||
#define B_RECALCULATE_STATS GEN_LATEST // In Gen5+, the stats of the Pokémon who participate in battle are recalculated at the end of each battle.
|
||||
|
||||
// Damage settings
|
||||
#define B_BURN_DAMAGE GEN_LATEST // In Gen7+, burn damage is 1/16th of max HP instead of 1/8th.
|
||||
#define B_BURN_DAMAGE GEN_LATEST // In Gen7+, burn damage is 1/16th of max HP instead of 1/8th. Also applies to Frostbite.
|
||||
#define B_BURN_FACADE_DMG GEN_LATEST // In Gen6+, burn's effect of lowering the Attack stat no longer applies to Facade.
|
||||
#define B_BINDING_DAMAGE GEN_LATEST // In Gen6+, binding damage is 1/8 of max HP instead of 1/16. (With Binding Band, 1/6 and 1/8 respectively.)
|
||||
#define B_PSYWAVE_DMG GEN_LATEST // Psywave's damage formula. See Cmd_psywavedamageeffect.
|
||||
@ -128,16 +128,17 @@
|
||||
#define B_ABSORBING_ABILITY_STRING GEN_LATEST // In Gen5+, the abilities that absorb moves of a certain type use a generic string for stat increases and decreases.
|
||||
#define B_LEAF_GUARD_PREVENTS_REST GEN_LATEST // In Gen5+, Leaf Guard prevents the use of Rest in harsh sunlight.
|
||||
#define B_SNOW_WARNING GEN_LATEST // In Gen9+, Snow Warning will summon snow instead of hail.
|
||||
#define B_TRANSISTOR_BOOST GEN_LATEST // In Gen9+, Transistor will only boost Electric-type moves by 1.3x as opposed to 1.5x.
|
||||
|
||||
// Item settings
|
||||
#define B_HP_BERRIES GEN_LATEST // In Gen4+, berries which restore hp activate immediately after HP drops to half. In Gen3, the effect occurs at the end of the turn.
|
||||
#define B_HP_BERRIES GEN_LATEST // In Gen4+, berries which restore HP activate immediately after HP drops to half. In Gen3, the effect occurs at the end of the turn.
|
||||
#define B_BERRIES_INSTANT GEN_LATEST // In Gen4+, most berries activate on battle start/switch-in if applicable. In Gen3, they only activate either at the move end or turn end.
|
||||
#define B_CONFUSE_BERRIES_HEAL GEN_LATEST // Before Gen7, Figy and similar berries restore 1/8th of HP and trigger at half HP. In Gen7 they restore half HP, triggering at 25% HP. In Gen8 they heal 1/3rd of HP.
|
||||
#define B_X_ITEMS_BUFF GEN_LATEST // In Gen7+, the X Items raise a stat by 2 stages instead of 1.
|
||||
#define B_MENTAL_HERB GEN_LATEST // In Gen5+, the Mental Herb cures Taunt, Encore, Torment, Heal Block, and Disable in addition to Infatuation from before.
|
||||
#define B_TRAINERS_KNOCK_OFF_ITEMS TRUE // If TRUE, trainers can steal/swap your items (non-berries are restored after battle). In vanilla games trainers cannot steal items.
|
||||
#define B_RESTORE_HELD_BATTLE_ITEMS TRUE // In Gen9 all non berry items are restored after battle.
|
||||
#define B_SOUL_DEW_BOOST GEN_LATEST // In Gens3-6, Soul Dew boosts Lati@s' Sp. Atk and Sp. Def. In Gen7+ it boosts the power of their Psychic and Dragon type moves instead.
|
||||
#define B_SOUL_DEW_BOOST GEN_LATEST // In Gens3-6, Soul Dew boosts Latis' Sp. Atk and Sp. Def. In Gen7+ it boosts the power of their Psychic and Dragon type moves instead.
|
||||
#define B_NET_BALL_MODIFIER GEN_LATEST // In Gen7+, Net Ball's catch multiplier is x5 instead of x3.
|
||||
#define B_DIVE_BALL_MODIFIER GEN_LATEST // In Gen4+, Dive Ball's effectiveness increases by when Surfing or Fishing.
|
||||
#define B_NEST_BALL_MODIFIER GEN_LATEST // Nest Ball's formula varies depending on the Gen. See Cmd_handleballthrow.
|
||||
|
||||
@ -19,6 +19,8 @@
|
||||
#define I_REUSABLE_TMS FALSE // In Gen5-8, TMs are reusable. Setting this to TRUE will make all vanilla TMs reusable, though they can also be cherry-picked by setting their importance to 1.
|
||||
|
||||
// Exp. Share config
|
||||
// To use this feature, replace the 0 with the flag ID you're assigning it to.
|
||||
// Eg: Replace with FLAG_UNUSED_0x264 so you can use that flag to toggle the feature.
|
||||
#define I_EXP_SHARE_FLAG 0 // If this flag is set, every Pokémon in the party will gain experience, regardless if they participated in the battle or not.
|
||||
#define I_EXP_SHARE_ITEM GEN_5 // In Gen6+, the Exp. Share was changed from a held item to a Key item that toggles the effect described above.
|
||||
|
||||
|
||||
@ -188,6 +188,7 @@
|
||||
#define STATUS4_WATER_SPORT (1 << 3) // Only used if B_SPORT_TURNS < GEN_6
|
||||
#define STATUS4_INFINITE_CONFUSION (1 << 4) // Used for Berserk Gene
|
||||
#define STATUS4_SALT_CURE (1 << 5)
|
||||
#define STATUS4_SYRUP_BOMB (1 << 6)
|
||||
|
||||
#define HITMARKER_WAKE_UP_CLEAR (1 << 4) // Cleared when waking up. Never set or checked.
|
||||
#define HITMARKER_SKIP_DMG_TRACK (1 << 5)
|
||||
@ -386,8 +387,9 @@
|
||||
#define MOVE_EFFECT_STEALTH_ROCK 76
|
||||
#define MOVE_EFFECT_SPIKES 77
|
||||
#define MOVE_EFFECT_TRIPLE_ARROWS 78
|
||||
#define MOVE_EFFECT_SYRUP_BOMB 79
|
||||
|
||||
#define NUM_MOVE_EFFECTS 79
|
||||
#define NUM_MOVE_EFFECTS 80
|
||||
|
||||
#define MOVE_EFFECT_AFFECTS_USER 0x4000
|
||||
#define MOVE_EFFECT_CERTAIN 0x8000
|
||||
|
||||
@ -414,8 +414,11 @@
|
||||
#define EFFECT_MORTAL_SPIN 408
|
||||
#define EFFECT_GIGATON_HAMMER 409
|
||||
#define EFFECT_SALT_CURE 410
|
||||
#define EFFECT_MAX_MOVE 411
|
||||
#define EFFECT_MATCHA_GOTCHA 411
|
||||
#define EFFECT_SYRUP_BOMB 412
|
||||
#define EFFECT_IVY_CUDGEL 413
|
||||
#define EFFECT_MAX_MOVE 414
|
||||
|
||||
#define NUM_BATTLE_MOVE_EFFECTS 412
|
||||
#define NUM_BATTLE_MOVE_EFFECTS 415
|
||||
|
||||
#endif // GUARD_CONSTANTS_BATTLE_MOVE_EFFECTS_H
|
||||
|
||||
@ -323,8 +323,9 @@
|
||||
#define MOVEEND_DANCER 31
|
||||
#define MOVEEND_EMERGENCY_EXIT 32
|
||||
#define MOVEEND_SYMBIOSIS 33
|
||||
#define MOVEEND_CLEAR_BITS 34
|
||||
#define MOVEEND_COUNT 35
|
||||
#define MOVEEND_OPPORTUNIST 34 // Occurs after other stat change items/abilities to try and copy the boosts
|
||||
#define MOVEEND_CLEAR_BITS 35
|
||||
#define MOVEEND_COUNT 36
|
||||
|
||||
// switch cases
|
||||
#define B_SWITCH_NORMAL 0
|
||||
|
||||
@ -670,21 +670,23 @@
|
||||
#define STRINGID_CURRENTMOVECANTSELECT 668
|
||||
#define STRINGID_TARGETISBEINGSALTCURED 669
|
||||
#define STRINGID_TARGETISHURTBYSALTCURE 670
|
||||
#define STRINGID_SHARPSTEELFLOATS 671
|
||||
#define STRINGID_SHARPSTEELDMG 672
|
||||
#define STRINGID_PKMNBLEWAWAYSHARPSTEEL 673
|
||||
#define STRINGID_SHARPSTEELDISAPPEAREDFROMTEAM 674
|
||||
#define STRINGID_TEAMTRAPPEDWITHVINES 675
|
||||
#define STRINGID_PKMNHURTBYVINES 676
|
||||
#define STRINGID_TEAMCAUGHTINVORTEX 677
|
||||
#define STRINGID_PKMNHURTBYVORTEX 678
|
||||
#define STRINGID_TEAMSURROUNDEDBYFIRE 679
|
||||
#define STRINGID_PKMNBURNINGUP 680
|
||||
#define STRINGID_TEAMSURROUNDEDBYROCKS 681
|
||||
#define STRINGID_PKMNHURTBYROCKSTHROWN 682
|
||||
#define STRINGID_MOVEBLOCKEDBYDYNAMAX 683
|
||||
#define STRINGID_OPPORTUNISTCOPIED 671
|
||||
#define STRINGID_TARGETCOVEREDINSTICKYCANDYSYRUP 672
|
||||
#define STRINGID_SHARPSTEELFLOATS 673
|
||||
#define STRINGID_SHARPSTEELDMG 674
|
||||
#define STRINGID_PKMNBLEWAWAYSHARPSTEEL 675
|
||||
#define STRINGID_SHARPSTEELDISAPPEAREDFROMTEAM 676
|
||||
#define STRINGID_TEAMTRAPPEDWITHVINES 677
|
||||
#define STRINGID_PKMNHURTBYVINES 678
|
||||
#define STRINGID_TEAMCAUGHTINVORTEX 679
|
||||
#define STRINGID_PKMNHURTBYVORTEX 680
|
||||
#define STRINGID_TEAMSURROUNDEDBYFIRE 681
|
||||
#define STRINGID_PKMNBURNINGUP 682
|
||||
#define STRINGID_TEAMSURROUNDEDBYROCKS 683
|
||||
#define STRINGID_PKMNHURTBYROCKSTHROWN 684
|
||||
#define STRINGID_MOVEBLOCKEDBYDYNAMAX 685
|
||||
|
||||
#define BATTLESTRINGS_COUNT 684
|
||||
#define BATTLESTRINGS_COUNT 686
|
||||
|
||||
// This is the string id that gBattleStringsTable starts with.
|
||||
// String ids before this (e.g. STRINGID_INTROMSG) are not in the table,
|
||||
|
||||
@ -160,9 +160,10 @@
|
||||
#define HOLD_EFFECT_COVERT_CLOAK 179
|
||||
#define HOLD_EFFECT_LOADED_DICE 180
|
||||
#define HOLD_EFFECT_BOOSTER_ENERGY 181 // Not implemented.
|
||||
#define HOLD_EFFECT_MASK 183
|
||||
|
||||
// Gen2 hold effect
|
||||
#define HOLD_EFFECT_BERSERK_GENE 182
|
||||
#define HOLD_EFFECT_BERSERK_GENE 184
|
||||
|
||||
#define HOLD_EFFECT_CHOICE(holdEffect)((holdEffect == HOLD_EFFECT_CHOICE_BAND || holdEffect == HOLD_EFFECT_CHOICE_SCARF || holdEffect == HOLD_EFFECT_CHOICE_SPECS))
|
||||
|
||||
|
||||
@ -163,7 +163,7 @@
|
||||
|
||||
#define LEVEL_UP_MOVE_ID 0x01FF
|
||||
#define LEVEL_UP_MOVE_LV 0xFE00
|
||||
#define LEVEL_UP_END 0xFFFF
|
||||
#define LEVEL_UP_MOVE_END 0xFFFF
|
||||
|
||||
#define MAX_LEVEL_UP_MOVES 20
|
||||
|
||||
|
||||
@ -132,7 +132,7 @@ struct Weather
|
||||
s16 droughtTimer;
|
||||
s16 droughtState;
|
||||
u8 droughtUnused[9];
|
||||
s8 loadDroughtPalsIndex;
|
||||
u8 loadDroughtPalsIndex;
|
||||
u8 loadDroughtPalsOffset;
|
||||
};
|
||||
|
||||
|
||||
@ -22,6 +22,7 @@
|
||||
#include "main.h"
|
||||
|
||||
extern struct BackupMapLayout gBackupMapLayout;
|
||||
extern u16 ALIGNED(4) sBackupMapData[MAX_MAP_DATA_SIZE];
|
||||
|
||||
u32 MapGridGetMetatileIdAt(int, int);
|
||||
u32 MapGridGetMetatileBehaviorAt(int, int);
|
||||
|
||||
@ -6257,6 +6257,7 @@ extern const u8 gMonIcon_PikachuUnovaCap[];
|
||||
extern const u8 gMonIcon_PikachuKalosCap[];
|
||||
extern const u8 gMonIcon_PikachuAlolaCap[];
|
||||
extern const u8 gMonIcon_PikachuPartnerCap[];
|
||||
extern const u8 gMonIcon_PikachuWorldCap[];
|
||||
extern const u8 gMonIcon_PichuSpikyEared[];
|
||||
extern const u8 gMonIcon_UnownB[];
|
||||
extern const u8 gMonIcon_UnownC[];
|
||||
|
||||
@ -96,6 +96,7 @@ enum RandomTag
|
||||
RNG_TRI_ATTACK,
|
||||
RNG_TRIPLE_ARROWS_DEFENSE_DOWN,
|
||||
RNG_TRIPLE_ARROWS_FLINCH,
|
||||
RNG_QUICK_DRAW,
|
||||
};
|
||||
|
||||
#define RandomWeighted(tag, ...) \
|
||||
|
||||
@ -504,8 +504,8 @@
|
||||
|
||||
enum { BATTLE_TEST_SINGLES, BATTLE_TEST_DOUBLES, BATTLE_TEST_WILD, BATTLE_TEST_AI_SINGLES, BATTLE_TEST_AI_DOUBLES };
|
||||
|
||||
typedef void (*SingleBattleTestFunction)(void *, u32, struct BattlePokemon *, struct BattlePokemon *);
|
||||
typedef void (*DoubleBattleTestFunction)(void *, u32, struct BattlePokemon *, struct BattlePokemon *, struct BattlePokemon *, struct BattlePokemon *);
|
||||
typedef void (*SingleBattleTestFunction)(void *, const u32, struct BattlePokemon *, struct BattlePokemon *);
|
||||
typedef void (*DoubleBattleTestFunction)(void *, const u32, struct BattlePokemon *, struct BattlePokemon *, struct BattlePokemon *, struct BattlePokemon *);
|
||||
|
||||
struct BattleTest
|
||||
{
|
||||
@ -712,7 +712,7 @@ struct BattleTestRunnerState
|
||||
};
|
||||
|
||||
extern const struct TestRunner gBattleTestRunner;
|
||||
extern struct BattleTestRunnerState *gBattleTestRunnerState;
|
||||
extern struct BattleTestRunnerState *const gBattleTestRunnerState;
|
||||
|
||||
#define MEMBERS(...) VARARG_8(MEMBERS_, __VA_ARGS__)
|
||||
#define MEMBERS_0()
|
||||
@ -746,7 +746,7 @@ extern struct BattleTestRunnerState *gBattleTestRunnerState;
|
||||
|
||||
#define BATTLE_TEST_ARGS_SINGLE(_name, _type, ...) \
|
||||
struct CAT(Result, __LINE__) { MEMBERS(__VA_ARGS__) }; \
|
||||
static void CAT(Test, __LINE__)(struct CAT(Result, __LINE__) *, u32, struct BattlePokemon *, struct BattlePokemon *); \
|
||||
static void CAT(Test, __LINE__)(struct CAT(Result, __LINE__) *, const u32, struct BattlePokemon *, struct BattlePokemon *); \
|
||||
__attribute__((section(".tests"))) static const struct Test CAT(sTest, __LINE__) = \
|
||||
{ \
|
||||
.name = _name, \
|
||||
@ -760,11 +760,11 @@ extern struct BattleTestRunnerState *gBattleTestRunnerState;
|
||||
.resultsSize = sizeof(struct CAT(Result, __LINE__)), \
|
||||
}, \
|
||||
}; \
|
||||
static void CAT(Test, __LINE__)(struct CAT(Result, __LINE__) *results, u32 i, struct BattlePokemon *player, struct BattlePokemon *opponent)
|
||||
static void CAT(Test, __LINE__)(struct CAT(Result, __LINE__) *results, const u32 i, struct BattlePokemon *player, struct BattlePokemon *opponent)
|
||||
|
||||
#define BATTLE_TEST_ARGS_DOUBLE(_name, _type, ...) \
|
||||
struct CAT(Result, __LINE__) { MEMBERS(__VA_ARGS__) }; \
|
||||
static void CAT(Test, __LINE__)(struct CAT(Result, __LINE__) *, u32, struct BattlePokemon *, struct BattlePokemon *, struct BattlePokemon *, struct BattlePokemon *); \
|
||||
static void CAT(Test, __LINE__)(struct CAT(Result, __LINE__) *, const u32, struct BattlePokemon *, struct BattlePokemon *, struct BattlePokemon *, struct BattlePokemon *); \
|
||||
__attribute__((section(".tests"))) static const struct Test CAT(sTest, __LINE__) = \
|
||||
{ \
|
||||
.name = _name, \
|
||||
@ -778,7 +778,7 @@ extern struct BattleTestRunnerState *gBattleTestRunnerState;
|
||||
.resultsSize = sizeof(struct CAT(Result, __LINE__)), \
|
||||
}, \
|
||||
}; \
|
||||
static void CAT(Test, __LINE__)(struct CAT(Result, __LINE__) *results, u32 i, struct BattlePokemon *playerLeft, struct BattlePokemon *opponentLeft, struct BattlePokemon *playerRight, struct BattlePokemon *opponentRight)
|
||||
static void CAT(Test, __LINE__)(struct CAT(Result, __LINE__) *results, const u32 i, struct BattlePokemon *playerLeft, struct BattlePokemon *opponentLeft, struct BattlePokemon *playerRight, struct BattlePokemon *opponentRight)
|
||||
|
||||
|
||||
#define SINGLE_BATTLE_TEST(_name, ...) BATTLE_TEST_ARGS_SINGLE(_name, BATTLE_TEST_SINGLES, __VA_ARGS__)
|
||||
@ -894,8 +894,8 @@ enum { TURN_CLOSED, TURN_OPEN, TURN_CLOSING };
|
||||
|
||||
#define EXPECT_MOVE(battler, ...) ExpectMove(__LINE__, battler, (struct MoveContext) { APPEND_TRUE(__VA_ARGS__) })
|
||||
#define NOT_EXPECT_MOVE(battler, _move) ExpectMove(__LINE__, battler, (struct MoveContext) { .move = _move, .explicitMove = TRUE, .notExpected = TRUE, .explicitNotExpected = TRUE, })
|
||||
#define EXPECT_MOVES(battler, ...) ExpectMoves(__LINE__, battler, FALSE, (struct FourMoves) { __VA_ARGS__ })
|
||||
#define NOT_EXPECT_MOVES(battler, ...) ExpectMoves(__LINE__, battler, TRUE, (struct FourMoves) { __VA_ARGS__ })
|
||||
#define EXPECT_MOVES(battler, ...) ExpectMoves(__LINE__, battler, FALSE, (struct FourMoves) {{ __VA_ARGS__ }})
|
||||
#define NOT_EXPECT_MOVES(battler, ...) ExpectMoves(__LINE__, battler, TRUE, (struct FourMoves) {{ __VA_ARGS__ }})
|
||||
#define EXPECT_SEND_OUT(battler, partyIndex) ExpectSendOut(__LINE__, battler, partyIndex)
|
||||
#define EXPECT_SWITCH(battler, partyIndex) ExpectSwitch(__LINE__, battler, partyIndex)
|
||||
#define SCORE_EQ(battler, ...) Score(__LINE__, battler, CMP_EQUAL, FALSE, (struct TestAIScoreStruct) { APPEND_TRUE(__VA_ARGS__) } )
|
||||
|
||||
@ -351,7 +351,7 @@ static u16 GetRandomAlternateMove(u8 monId)
|
||||
else // == APPRENTICE_LVL_MODE_OPEN
|
||||
level = 60; // Despite being open level, level up moves are only read up to level 60
|
||||
|
||||
for (j = 0; learnset[j].move != LEVEL_UP_END; j++)
|
||||
for (j = 0; learnset[j].move != LEVEL_UP_MOVE_END; j++)
|
||||
{
|
||||
if (learnset[j].level > level)
|
||||
break;
|
||||
@ -468,7 +468,7 @@ static void GetLatestLearnedMoves(u16 species, u16 *moves)
|
||||
level = 60;
|
||||
|
||||
learnset = gLevelUpLearnsets[species];
|
||||
for (i = 0; learnset[i].move != LEVEL_UP_END; i++)
|
||||
for (i = 0; learnset[i].move != LEVEL_UP_MOVE_END; i++)
|
||||
{
|
||||
if (learnset[i].level > level)
|
||||
break;
|
||||
|
||||
@ -118,7 +118,7 @@ void BattleAI_SetupItems(void)
|
||||
static u32 GetWildAiFlags(void)
|
||||
{
|
||||
u32 avgLevel = GetMonData(&gEnemyParty[0], MON_DATA_LEVEL);
|
||||
u32 flags;
|
||||
u32 flags = 0;
|
||||
|
||||
if (IsDoubleBattle())
|
||||
avgLevel = (GetMonData(&gEnemyParty[0], MON_DATA_LEVEL) + GetMonData(&gEnemyParty[1], MON_DATA_LEVEL)) / 2;
|
||||
@ -174,7 +174,7 @@ void BattleAI_SetupFlags(void)
|
||||
// sBattler_AI set in ComputeBattleAiScores
|
||||
void BattleAI_SetupAIData(u8 defaultScoreMoves, u32 battler)
|
||||
{
|
||||
s32 i, move, dmg;
|
||||
s32 i;
|
||||
u8 moveLimitations;
|
||||
|
||||
// Clear AI data but preserve the flags.
|
||||
@ -492,7 +492,7 @@ static u32 ChooseMoveOrAction_Singles(u32 battlerAi)
|
||||
u8 currentMoveArray[MAX_MON_MOVES];
|
||||
u8 consideredMoveArray[MAX_MON_MOVES];
|
||||
u32 numOfBestMoves;
|
||||
s32 i, id;
|
||||
s32 i;
|
||||
u32 flags = AI_THINKING_STRUCT->aiFlags;
|
||||
|
||||
AI_DATA->partnerMove = 0; // no ally
|
||||
@ -721,7 +721,6 @@ static s32 AI_CheckBadMove(u32 battlerAtk, u32 battlerDef, u32 move, s32 score)
|
||||
u32 moveEffect = gBattleMoves[move].effect;
|
||||
s32 moveType;
|
||||
u32 moveTarget = AI_GetBattlerMoveTargetType(battlerAtk, move);
|
||||
u32 accuracy = AI_DATA->moveAccuracy[battlerAtk][battlerDef][AI_THINKING_STRUCT->movesetIndex];
|
||||
struct AiLogicData *aiData = AI_DATA;
|
||||
u32 effectiveness = aiData->effectiveness[battlerAtk][battlerDef][AI_THINKING_STRUCT->movesetIndex];
|
||||
bool32 isDoubleBattle = IsValidDoubleBattle(battlerAtk);
|
||||
@ -938,11 +937,10 @@ static s32 AI_CheckBadMove(u32 battlerAtk, u32 battlerDef, u32 move, s32 score)
|
||||
} // ignore def ability check
|
||||
|
||||
// gen7+ dark type mons immune to priority->elevated moves from prankster
|
||||
#if B_PRANKSTER_DARK_TYPES >= GEN_7
|
||||
if (aiData->abilities[battlerAtk] == ABILITY_PRANKSTER && IS_BATTLER_OF_TYPE(battlerDef, TYPE_DARK) && IS_MOVE_STATUS(move)
|
||||
if (B_PRANKSTER_DARK_TYPES >= GEN_7 && IS_BATTLER_OF_TYPE(battlerDef, TYPE_DARK)
|
||||
&& aiData->abilities[battlerAtk] == ABILITY_PRANKSTER && IS_MOVE_STATUS(move)
|
||||
&& !(moveTarget & (MOVE_TARGET_OPPONENTS_FIELD | MOVE_TARGET_USER)))
|
||||
RETURN_SCORE_MINUS(10);
|
||||
#endif
|
||||
|
||||
// terrain & effect checks
|
||||
if (AI_IsTerrainAffected(battlerDef, STATUS_FIELD_ELECTRIC_TERRAIN))
|
||||
@ -1126,10 +1124,9 @@ static s32 AI_CheckBadMove(u32 battlerAtk, u32 battlerDef, u32 move, s32 score)
|
||||
ADJUST_SCORE(-20);
|
||||
else if (!HasMoveWithType(battlerAtk, TYPE_ELECTRIC))
|
||||
ADJUST_SCORE(-10);
|
||||
#if B_CHARGE_SPDEF_RAISE >= GEN_5
|
||||
else if (!BattlerStatCanRise(battlerAtk, aiData->abilities[battlerAtk], STAT_SPDEF))
|
||||
else if (B_CHARGE_SPDEF_RAISE >= GEN_5
|
||||
&& !BattlerStatCanRise(battlerAtk, aiData->abilities[battlerAtk], STAT_SPDEF))
|
||||
ADJUST_SCORE(-5);
|
||||
#endif
|
||||
break;
|
||||
case EFFECT_QUIVER_DANCE:
|
||||
case EFFECT_GEOMANCY:
|
||||
@ -1416,10 +1413,8 @@ static s32 AI_CheckBadMove(u32 battlerAtk, u32 battlerDef, u32 move, s32 score)
|
||||
ADJUST_SCORE(-10);
|
||||
break;
|
||||
case EFFECT_OHKO:
|
||||
#if B_SHEER_COLD_IMMUNITY >= GEN_7
|
||||
if (move == MOVE_SHEER_COLD && IS_BATTLER_OF_TYPE(battlerDef, TYPE_ICE))
|
||||
if (B_SHEER_COLD_IMMUNITY >= GEN_7 && move == MOVE_SHEER_COLD && IS_BATTLER_OF_TYPE(battlerDef, TYPE_ICE))
|
||||
return 0;
|
||||
#endif
|
||||
if (!ShouldTryOHKO(battlerAtk, battlerDef, aiData->abilities[battlerAtk], aiData->abilities[battlerDef], move))
|
||||
ADJUST_SCORE(-10);
|
||||
break;
|
||||
@ -1447,10 +1442,8 @@ static s32 AI_CheckBadMove(u32 battlerAtk, u32 battlerDef, u32 move, s32 score)
|
||||
ADJUST_SCORE(-8);
|
||||
else if (aiData->hpPercents[battlerAtk] <= 25)
|
||||
ADJUST_SCORE(-10);
|
||||
#if B_SOUND_SUBSTITUTE >= GEN_6
|
||||
else if (HasSoundMove(battlerDef))
|
||||
else if (B_SOUND_SUBSTITUTE >= GEN_6 && HasSoundMove(battlerDef))
|
||||
ADJUST_SCORE(-8);
|
||||
#endif
|
||||
break;
|
||||
case EFFECT_LEECH_SEED:
|
||||
if (gStatuses3[battlerDef] & STATUS3_LEECHSEED
|
||||
@ -1462,9 +1455,7 @@ static s32 AI_CheckBadMove(u32 battlerAtk, u32 battlerDef, u32 move, s32 score)
|
||||
break;
|
||||
case EFFECT_DISABLE:
|
||||
if (gDisableStructs[battlerDef].disableTimer == 0
|
||||
#if B_MENTAL_HERB >= GEN_5
|
||||
&& aiData->holdEffects[battlerDef] != HOLD_EFFECT_MENTAL_HERB
|
||||
#endif
|
||||
&& (B_MENTAL_HERB < GEN_5 || aiData->holdEffects[battlerDef] != HOLD_EFFECT_MENTAL_HERB)
|
||||
&& !PartnerHasSameMoveEffectWithoutTarget(BATTLE_PARTNER(battlerAtk), move, aiData->partnerMove))
|
||||
{
|
||||
if (AI_WhoStrikesFirst(battlerAtk, battlerDef, move) == AI_IS_FASTER) // Attacker should go first
|
||||
@ -1484,9 +1475,7 @@ static s32 AI_CheckBadMove(u32 battlerAtk, u32 battlerDef, u32 move, s32 score)
|
||||
break;
|
||||
case EFFECT_ENCORE:
|
||||
if (gDisableStructs[battlerDef].encoreTimer == 0
|
||||
#if B_MENTAL_HERB >= GEN_5
|
||||
&& aiData->holdEffects[battlerDef] != HOLD_EFFECT_MENTAL_HERB
|
||||
#endif
|
||||
&& (B_MENTAL_HERB < GEN_5 || aiData->holdEffects[battlerDef] != HOLD_EFFECT_MENTAL_HERB)
|
||||
&& !DoesPartnerHaveSameMoveEffect(BATTLE_PARTNER(battlerAtk), battlerDef, move, aiData->partnerMove))
|
||||
{
|
||||
if (AI_WhoStrikesFirst(battlerAtk, battlerDef, move) == AI_IS_FASTER) // Attacker should go first
|
||||
@ -1715,10 +1704,8 @@ static s32 AI_CheckBadMove(u32 battlerAtk, u32 battlerDef, u32 move, s32 score)
|
||||
ADJUST_SCORE(-10);
|
||||
break;
|
||||
}
|
||||
#if B_MENTAL_HERB >= GEN_5
|
||||
if (aiData->holdEffects[battlerDef] == HOLD_EFFECT_MENTAL_HERB)
|
||||
if (B_MENTAL_HERB >= GEN_5 && aiData->holdEffects[battlerDef] == HOLD_EFFECT_MENTAL_HERB)
|
||||
ADJUST_SCORE(-6);
|
||||
#endif
|
||||
break;
|
||||
case EFFECT_WILL_O_WISP:
|
||||
if (!AI_CanBurn(battlerAtk, battlerDef, aiData->abilities[battlerDef], BATTLE_PARTNER(battlerAtk), move, aiData->partnerMove))
|
||||
@ -3153,26 +3140,13 @@ static u32 CompareMoveAccuracies(u32 battlerAtk, u32 battlerDef, u32 moveSlot1,
|
||||
return 2;
|
||||
}
|
||||
|
||||
static u32 GetAIMostDamagingMoveId(u32 battlerAtk, u32 battlerDef)
|
||||
{
|
||||
u32 i, id = 0;
|
||||
u32 mostDmg = 0;
|
||||
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
if (AI_DATA->simulatedDmg[battlerAtk][battlerDef][i] > mostDmg)
|
||||
id = i, mostDmg = AI_DATA->simulatedDmg[battlerAtk][battlerDef][i];
|
||||
}
|
||||
return id;
|
||||
}
|
||||
|
||||
static s32 AI_CompareDamagingMoves(u32 battlerAtk, u32 battlerDef, u32 currId)
|
||||
{
|
||||
u32 i;
|
||||
bool32 multipleBestMoves = FALSE;
|
||||
s32 noOfHits[MAX_MON_MOVES];
|
||||
s32 score = 0;
|
||||
s32 leastHits = 1000, leastHitsId = 0;
|
||||
s32 leastHits = 1000;
|
||||
u16 *moves = GetMovesArray(battlerAtk);
|
||||
bool8 isPowerfulIgnoredEffect[MAX_MON_MOVES];
|
||||
|
||||
@ -3184,7 +3158,6 @@ static s32 AI_CompareDamagingMoves(u32 battlerAtk, u32 battlerDef, u32 currId)
|
||||
if (noOfHits[i] < leastHits)
|
||||
{
|
||||
leastHits = noOfHits[i];
|
||||
leastHitsId = i;
|
||||
}
|
||||
isPowerfulIgnoredEffect[i] = IsInIgnoredPowerfulMoveEffects(gBattleMoves[moves[i]].effect);
|
||||
}
|
||||
@ -3832,10 +3805,7 @@ static s32 AI_CheckViability(u32 battlerAtk, u32 battlerDef, u32 move, s32 score
|
||||
break;
|
||||
case EFFECT_DISABLE:
|
||||
if (gDisableStructs[battlerDef].disableTimer == 0
|
||||
#if B_MENTAL_HERB >= GEN_5
|
||||
&& aiData->holdEffects[battlerDef] != HOLD_EFFECT_MENTAL_HERB // mental herb
|
||||
#endif
|
||||
)
|
||||
&& (B_MENTAL_HERB < GEN_5 || aiData->holdEffects[battlerDef] != HOLD_EFFECT_MENTAL_HERB))
|
||||
{
|
||||
if (AI_WhoStrikesFirst(battlerAtk, battlerDef, move) == AI_IS_FASTER) // AI goes first
|
||||
{
|
||||
@ -3856,10 +3826,7 @@ static s32 AI_CheckViability(u32 battlerAtk, u32 battlerDef, u32 move, s32 score
|
||||
break;
|
||||
case EFFECT_ENCORE:
|
||||
if (gDisableStructs[battlerDef].encoreTimer == 0
|
||||
#if B_MENTAL_HERB >= GEN_5
|
||||
&& aiData->holdEffects[battlerDef] != HOLD_EFFECT_MENTAL_HERB // mental herb
|
||||
#endif
|
||||
)
|
||||
&& (B_MENTAL_HERB < GEN_5 || aiData->holdEffects[battlerDef] != HOLD_EFFECT_MENTAL_HERB))
|
||||
{
|
||||
if (IsEncoreEncouragedEffect(gBattleMoves[gLastMoves[battlerDef]].effect))
|
||||
ADJUST_SCORE(3);
|
||||
@ -3908,9 +3875,8 @@ static s32 AI_CheckViability(u32 battlerAtk, u32 battlerDef, u32 move, s32 score
|
||||
{
|
||||
bool32 canSteal = FALSE;
|
||||
|
||||
#if B_TRAINERS_KNOCK_OFF_ITEMS == TRUE
|
||||
if (B_TRAINERS_KNOCK_OFF_ITEMS == TRUE)
|
||||
canSteal = TRUE;
|
||||
#endif
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_FRONTIER || GetBattlerSide(battlerAtk) == B_SIDE_PLAYER)
|
||||
canSteal = TRUE;
|
||||
|
||||
@ -4366,9 +4332,8 @@ static s32 AI_CheckViability(u32 battlerAtk, u32 battlerDef, u32 move, s32 score
|
||||
case EFFECT_CHARGE:
|
||||
if (HasDamagingMoveOfType(battlerAtk, TYPE_ELECTRIC))
|
||||
ADJUST_SCORE(2);
|
||||
#if B_CHARGE_SPDEF_RAISE >= GEN_5
|
||||
if (B_CHARGE_SPDEF_RAISE >= GEN_5)
|
||||
IncreaseStatUpScore(battlerAtk, battlerDef, STAT_SPDEF, &score);
|
||||
#endif
|
||||
break;
|
||||
case EFFECT_TAUNT:
|
||||
if (IS_MOVE_STATUS(predictedMove))
|
||||
|
||||
@ -420,7 +420,6 @@ static bool8 ShouldSwitchIfGameStatePrompt(u32 battler)
|
||||
|
||||
static bool8 ShouldSwitchIfAbilityBenefit(u32 battler)
|
||||
{
|
||||
s32 monToSwitchId;
|
||||
s32 moduloChance = 4; //25% Chance Default
|
||||
s32 chanceReducer = 1; //No Reduce default. Increase to reduce
|
||||
|
||||
@ -894,7 +893,7 @@ static u32 GetBestMonTypeMatchup(struct Pokemon *party, int firstId, int lastId,
|
||||
|
||||
static u32 GetBestMonDmg(struct Pokemon *party, int firstId, int lastId, u8 invalidMons, u32 battler, u32 opposingBattler)
|
||||
{
|
||||
int i, j;
|
||||
int i;
|
||||
int dmg, bestDmg = 0;
|
||||
int bestMonId = PARTY_SIZE;
|
||||
|
||||
@ -926,7 +925,7 @@ u8 GetMostSuitableMonToSwitchInto(u32 battler)
|
||||
s32 firstId = 0;
|
||||
s32 lastId = 0; // + 1
|
||||
struct Pokemon *party;
|
||||
s32 i, j, aliveCount = 0;
|
||||
s32 i, aliveCount = 0;
|
||||
u32 invalidMons = 0, aceMonId = PARTY_SIZE;
|
||||
|
||||
if (*(gBattleStruct->monToSwitchIntoId + battler) != PARTY_SIZE)
|
||||
@ -1004,8 +1003,6 @@ u8 GetMostSuitableMonToSwitchInto(u32 battler)
|
||||
|
||||
static bool32 AiExpectsToFaintPlayer(u32 battler)
|
||||
{
|
||||
bool32 canFaintPlayer;
|
||||
u32 i;
|
||||
u8 target = gBattleStruct->aiChosenTarget[battler];
|
||||
|
||||
if (gBattleStruct->aiMoveOrAction[battler] > 3)
|
||||
@ -1059,7 +1056,6 @@ static bool8 ShouldUseItem(u32 battler)
|
||||
{
|
||||
u16 item;
|
||||
const u8 *itemEffects;
|
||||
u8 paramOffset;
|
||||
u8 battlerSide;
|
||||
|
||||
item = gBattleResources->battleHistory->trainerItems[i];
|
||||
|
||||
@ -616,10 +616,8 @@ bool32 IsBattlerTrapped(u32 battler, bool32 checkSwitch)
|
||||
{
|
||||
u32 holdEffect = AI_DATA->holdEffects[battler];
|
||||
|
||||
#if B_GHOSTS_ESCAPE >= GEN_6
|
||||
if (IS_BATTLER_OF_TYPE(battler, TYPE_GHOST))
|
||||
if (B_GHOSTS_ESCAPE >= GEN_6 && IS_BATTLER_OF_TYPE(battler, TYPE_GHOST))
|
||||
return FALSE;
|
||||
#endif
|
||||
if (checkSwitch && holdEffect == HOLD_EFFECT_SHED_SHELL)
|
||||
return FALSE;
|
||||
else if (!checkSwitch && GetBattlerAbility(battler) == ABILITY_RUN_AWAY)
|
||||
@ -667,9 +665,7 @@ bool32 IsTruantMonVulnerable(u32 battlerAI, u32 opposingBattler)
|
||||
bool32 IsAffectedByPowder(u32 battler, u32 ability, u32 holdEffect)
|
||||
{
|
||||
if (ability == ABILITY_OVERCOAT
|
||||
#if B_POWDER_GRASS >= GEN_6
|
||||
|| IS_BATTLER_OF_TYPE(battler, TYPE_GRASS)
|
||||
#endif
|
||||
|| (B_POWDER_GRASS >= GEN_6 && IS_BATTLER_OF_TYPE(battler, TYPE_GRASS))
|
||||
|| holdEffect == HOLD_EFFECT_SAFETY_GOGGLES)
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
@ -706,7 +702,7 @@ s32 AI_CalcDamageSaveBattlers(u32 move, u32 battlerAtk, u32 battlerDef, u8 *type
|
||||
{
|
||||
SaveBattlerData(battlerAtk);
|
||||
SaveBattlerData(battlerDef);
|
||||
AI_CalcDamage(move, battlerAtk, battlerDef, typeEffectiveness, considerZPower, AI_GetWeather(AI_DATA));
|
||||
return AI_CalcDamage(move, battlerAtk, battlerDef, typeEffectiveness, considerZPower, AI_GetWeather(AI_DATA));
|
||||
}
|
||||
|
||||
static inline s32 LowestRollDmg(s32 dmg)
|
||||
@ -811,8 +807,8 @@ s32 AI_CalcDamage(u32 move, u32 battlerAtk, u32 battlerDef, u8 *typeEffectivenes
|
||||
case EFFECT_FINAL_GAMBIT:
|
||||
dmg = gBattleMons[battlerAtk].hp;
|
||||
break;
|
||||
#if B_BEAT_UP >= GEN_5
|
||||
case EFFECT_BEAT_UP:
|
||||
if (B_BEAT_UP >= GEN_5)
|
||||
{
|
||||
u32 partyCount = CalculatePartyCount(GetBattlerParty(battlerAtk));
|
||||
u32 i;
|
||||
@ -824,7 +820,6 @@ s32 AI_CalcDamage(u32 move, u32 battlerAtk, u32 battlerDef, u8 *typeEffectivenes
|
||||
gBattleStruct->beatUpSlot = 0;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
// Handle other multi-strike moves
|
||||
@ -1230,7 +1225,6 @@ u32 AI_WhoStrikesFirst(u32 battlerAI, u32 battler2, u32 moveConsidered)
|
||||
{
|
||||
u32 fasterAI = 0, fasterPlayer = 0, i;
|
||||
s8 prioAI = 0;
|
||||
s8 prioPlayer = 0;
|
||||
s8 prioBattler2 = 0;
|
||||
u16 *battler2Moves = GetMovesArray(battler2);
|
||||
|
||||
@ -1276,7 +1270,7 @@ u32 AI_WhoStrikesFirst(u32 battlerAI, u32 battler2, u32 moveConsidered)
|
||||
// Check if target has means to faint ai mon.
|
||||
bool32 CanTargetFaintAi(u32 battlerDef, u32 battlerAtk)
|
||||
{
|
||||
s32 i, dmg;
|
||||
s32 i;
|
||||
u32 unusable = AI_DATA->moveLimitations[battlerDef];
|
||||
u16 *moves = GetMovesArray(battlerDef);
|
||||
|
||||
@ -1465,8 +1459,6 @@ bool32 AI_IsBattlerGrounded(u32 battlerId)
|
||||
|
||||
bool32 DoesBattlerIgnoreAbilityChecks(u32 atkAbility, u32 move)
|
||||
{
|
||||
u32 i;
|
||||
|
||||
if (AI_THINKING_STRUCT->aiFlags & AI_FLAG_NEGATE_UNAWARE)
|
||||
return FALSE; // AI handicap flag: doesn't understand ability suppression concept
|
||||
|
||||
@ -1495,8 +1487,6 @@ u32 AI_GetWeather(struct AiLogicData *aiData)
|
||||
|
||||
u32 AI_GetBattlerMoveTargetType(u32 battlerId, u32 move)
|
||||
{
|
||||
u32 target;
|
||||
|
||||
if (gBattleMoves[move].effect == EFFECT_EXPANDING_FORCE && AI_IsTerrainAffected(battlerId, STATUS_FIELD_PSYCHIC_TERRAIN))
|
||||
return MOVE_TARGET_BOTH;
|
||||
else
|
||||
@ -1505,8 +1495,6 @@ u32 AI_GetBattlerMoveTargetType(u32 battlerId, u32 move)
|
||||
|
||||
bool32 IsAromaVeilProtectedMove(u32 move)
|
||||
{
|
||||
u32 i;
|
||||
|
||||
switch (move)
|
||||
{
|
||||
case MOVE_DISABLE:
|
||||
@ -1631,10 +1619,8 @@ bool32 IsMoveEncouragedToHit(u32 battlerAtk, u32 battlerDef, u32 move)
|
||||
if (AI_DATA->abilities[battlerDef] == ABILITY_NO_GUARD || AI_DATA->abilities[battlerAtk] == ABILITY_NO_GUARD)
|
||||
return TRUE;
|
||||
|
||||
#if B_TOXIC_NEVER_MISS >= GEN_6
|
||||
if (gBattleMoves[move].effect == EFFECT_TOXIC && IS_BATTLER_OF_TYPE(battlerAtk, TYPE_POISON))
|
||||
if (B_TOXIC_NEVER_MISS >= GEN_6 && gBattleMoves[move].effect == EFFECT_TOXIC && IS_BATTLER_OF_TYPE(battlerAtk, TYPE_POISON))
|
||||
return TRUE;
|
||||
#endif
|
||||
|
||||
// discouraged from hitting
|
||||
weather = AI_GetWeather(AI_DATA);
|
||||
@ -1646,9 +1632,7 @@ bool32 IsMoveEncouragedToHit(u32 battlerAtk, u32 battlerDef, u32 move)
|
||||
if ((((weather & B_WEATHER_RAIN) && (gBattleMoves[move].effect == EFFECT_THUNDER || gBattleMoves[move].effect == EFFECT_HURRICANE))
|
||||
|| (((weather & (B_WEATHER_HAIL | B_WEATHER_SNOW)) && move == MOVE_BLIZZARD)))
|
||||
|| (gBattleMoves[move].effect == EFFECT_VITAL_THROW)
|
||||
#if B_MINIMIZE_DMG_ACC >= GEN_6
|
||||
|| ((gStatuses3[battlerDef] & STATUS3_MINIMIZED) && gBattleMoves[move].minimizeDoubleDamage)
|
||||
#endif
|
||||
|| (B_MINIMIZE_DMG_ACC >= GEN_6 && (gStatuses3[battlerDef] & STATUS3_MINIMIZED) && gBattleMoves[move].minimizeDoubleDamage)
|
||||
|| (gBattleMoves[move].accuracy == 0))
|
||||
{
|
||||
return TRUE;
|
||||
@ -1681,10 +1665,8 @@ bool32 ShouldTryOHKO(u32 battlerAtk, u32 battlerDef, u32 atkAbility, u32 defAbil
|
||||
else // test the odds
|
||||
{
|
||||
u32 odds = accuracy + (gBattleMons[battlerAtk].level - gBattleMons[battlerDef].level);
|
||||
#if B_SHEER_COLD_ACC >= GEN_7
|
||||
if (move == MOVE_SHEER_COLD && !IS_BATTLER_OF_TYPE(gBattlerAttacker, TYPE_ICE))
|
||||
if (B_SHEER_COLD_ACC >= GEN_7 && move == MOVE_SHEER_COLD && !IS_BATTLER_OF_TYPE(gBattlerAttacker, TYPE_ICE))
|
||||
odds -= 10;
|
||||
#endif
|
||||
if (Random() % 100 + 1 < odds && gBattleMons[battlerAtk].level >= gBattleMons[battlerDef].level)
|
||||
return TRUE;
|
||||
}
|
||||
@ -1808,42 +1790,40 @@ bool32 ShouldSetSnow(u32 battler, u32 ability, u32 holdEffect)
|
||||
void ProtectChecks(u32 battlerAtk, u32 battlerDef, u32 move, u32 predictedMove, s32 *score)
|
||||
{
|
||||
// TODO more sophisticated logic
|
||||
u32 predictedEffect = gBattleMoves[predictedMove].effect;
|
||||
u32 defAbility = AI_DATA->abilities[battlerDef];
|
||||
u32 uses = gDisableStructs[battlerAtk].protectUses;
|
||||
|
||||
/*if (GetMoveResultFlags(predictedMove) & (MOVE_RESULT_NO_EFFECT | MOVE_RESULT_MISSED))
|
||||
{
|
||||
(*score) -= 5;
|
||||
ADJUST_SCORE_PTR(-5);
|
||||
return;
|
||||
}*/
|
||||
|
||||
if (uses == 0)
|
||||
{
|
||||
if (predictedMove != MOVE_NONE && predictedMove != 0xFFFF && !IS_MOVE_STATUS(predictedMove))
|
||||
(*score) += 2;
|
||||
ADJUST_SCORE_PTR(2);
|
||||
else if (Random() % 256 < 100)
|
||||
(*score)++;
|
||||
ADJUST_SCORE_PTR(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (IsDoubleBattle())
|
||||
(*score) -= 2 * min(uses, 3);
|
||||
ADJUST_SCORE_PTR(-(2 * min(uses, 3)));
|
||||
else
|
||||
(*score) -= min(uses, 3);
|
||||
ADJUST_SCORE_PTR(-(min(uses, 3)));
|
||||
}
|
||||
|
||||
if (gBattleMons[battlerAtk].status1 & (STATUS1_PSN_ANY | STATUS1_BURN | STATUS1_FROSTBITE)
|
||||
|| gBattleMons[battlerAtk].status2 & (STATUS2_CURSED | STATUS2_INFATUATION)
|
||||
|| gStatuses3[battlerAtk] & (STATUS3_PERISH_SONG | STATUS3_LEECHSEED | STATUS3_YAWN))
|
||||
{
|
||||
(*score)--;
|
||||
ADJUST_SCORE_PTR(-1);
|
||||
}
|
||||
|
||||
if (gBattleMons[battlerDef].status1 & STATUS1_TOXIC_POISON
|
||||
|| gBattleMons[battlerDef].status2 & (STATUS2_CURSED | STATUS2_INFATUATION)
|
||||
|| gStatuses3[battlerDef] & (STATUS3_PERISH_SONG | STATUS3_LEECHSEED | STATUS3_YAWN))
|
||||
(*score) += 2;
|
||||
ADJUST_SCORE_PTR(2);
|
||||
}
|
||||
|
||||
// stat stages
|
||||
@ -2299,9 +2279,6 @@ bool32 IsStatRaisingEffect(u32 effect)
|
||||
case EFFECT_EVASION_UP_2:
|
||||
case EFFECT_MINIMIZE:
|
||||
case EFFECT_DEFENSE_CURL:
|
||||
#if B_CHARGE_SPDEF_RAISE >= GEN_5
|
||||
case EFFECT_CHARGE:
|
||||
#endif
|
||||
case EFFECT_CALM_MIND:
|
||||
case EFFECT_COSMIC_POWER:
|
||||
case EFFECT_DRAGON_DANCE:
|
||||
@ -2318,6 +2295,8 @@ bool32 IsStatRaisingEffect(u32 effect)
|
||||
case EFFECT_STOCKPILE:
|
||||
case EFFECT_VICTORY_DANCE:
|
||||
return TRUE;
|
||||
case EFFECT_CHARGE:
|
||||
return B_CHARGE_SPDEF_RAISE >= GEN_5;
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
@ -2457,15 +2436,10 @@ static u32 GetTrapDamage(u32 battlerId)
|
||||
if (gBattleMons[battlerId].status2 & STATUS2_WRAPPED)
|
||||
{
|
||||
if (holdEffect == HOLD_EFFECT_BINDING_BAND)
|
||||
#if B_BINDING_DAMAGE >= GEN_6
|
||||
damage = gBattleMons[battlerId].maxHP / 6;
|
||||
damage = gBattleMons[battlerId].maxHP / (B_BINDING_DAMAGE >= GEN_6 ? 6 : 8);
|
||||
else
|
||||
damage = gBattleMons[battlerId].maxHP / 8;
|
||||
#else
|
||||
damage = gBattleMons[battlerId].maxHP / 8;
|
||||
else
|
||||
damage = gBattleMons[battlerId].maxHP / 16;
|
||||
#endif
|
||||
damage = gBattleMons[battlerId].maxHP / (B_BINDING_DAMAGE >= GEN_6 ? 8 : 16);
|
||||
|
||||
if (damage == 0)
|
||||
damage = 1;
|
||||
}
|
||||
@ -2705,9 +2679,7 @@ bool32 ShouldPivot(u32 battlerAtk, u32 battlerDef, u32 defAbility, u32 move, u32
|
||||
|
||||
if (!IS_MOVE_STATUS(move) && (shouldSwitch
|
||||
|| (AtMaxHp(battlerDef) && (AI_DATA->holdEffects[battlerDef] == HOLD_EFFECT_FOCUS_SASH
|
||||
#if B_STURDY >= GEN_5
|
||||
|| defAbility == ABILITY_STURDY
|
||||
#endif
|
||||
|| (B_STURDY >= GEN_5 && defAbility == ABILITY_STURDY)
|
||||
|| defAbility == ABILITY_MULTISCALE
|
||||
|| defAbility == ABILITY_SHADOW_SHIELD))))
|
||||
return PIVOT; // pivot to break sash/sturdy/multiscale
|
||||
@ -2715,9 +2687,7 @@ bool32 ShouldPivot(u32 battlerAtk, u32 battlerDef, u32 defAbility, u32 move, u32
|
||||
else if (!hasStatBoost)
|
||||
{
|
||||
if (!IS_MOVE_STATUS(move) && (AtMaxHp(battlerDef) && (AI_DATA->holdEffects[battlerDef] == HOLD_EFFECT_FOCUS_SASH
|
||||
#if B_STURDY >= GEN_5
|
||||
|| (defAbility == ABILITY_STURDY)
|
||||
#endif
|
||||
|| (B_STURDY >= GEN_5 && defAbility == ABILITY_STURDY)
|
||||
|| defAbility == ABILITY_MULTISCALE
|
||||
|| defAbility == ABILITY_SHADOW_SHIELD)))
|
||||
return PIVOT; // pivot to break sash/sturdy/multiscale
|
||||
@ -2858,9 +2828,7 @@ bool32 CanKnockOffItem(u32 battler, u32 item)
|
||||
| BATTLE_TYPE_LINK
|
||||
| BATTLE_TYPE_RECORDED_LINK
|
||||
| BATTLE_TYPE_SECRET_BASE
|
||||
#if B_TRAINERS_KNOCK_OFF_ITEMS == TRUE
|
||||
| BATTLE_TYPE_TRAINER
|
||||
#endif
|
||||
| (B_TRAINERS_KNOCK_OFF_ITEMS == TRUE ? BATTLE_TYPE_TRAINER : 0)
|
||||
)) && GetBattlerSide(battler) == B_SIDE_PLAYER)
|
||||
return FALSE;
|
||||
|
||||
@ -3411,7 +3379,7 @@ bool32 PartnerMoveIsSameNoTarget(u32 battlerAtkPartner, u32 move, u32 partnerMov
|
||||
bool32 ShouldUseWishAromatherapy(u32 battlerAtk, u32 battlerDef, u32 move)
|
||||
{
|
||||
u32 i;
|
||||
u32 firstId, lastId;
|
||||
s32 firstId, lastId;
|
||||
struct Pokemon* party;
|
||||
bool32 hasStatus = FALSE;
|
||||
bool32 needHealing = FALSE;
|
||||
@ -3494,7 +3462,7 @@ void FreeRestoreBattleMons(struct BattlePokemon *savedBattleMons)
|
||||
// party logic
|
||||
s32 AI_CalcPartyMonBestMoveDamage(u32 battlerAtk, u32 battlerDef, struct Pokemon *attackerMon, struct Pokemon *targetMon)
|
||||
{
|
||||
s32 i, move, bestDmg, dmg;
|
||||
s32 i, move, bestDmg, dmg = 0;
|
||||
u8 effectiveness;
|
||||
struct BattlePokemon *savedBattleMons = AllocSaveBattleMons();
|
||||
|
||||
@ -3582,7 +3550,6 @@ bool32 IsPartyFullyHealedExceptBattler(u32 battlerId)
|
||||
|
||||
bool32 PartyHasMoveSplit(u32 battlerId, u32 split)
|
||||
{
|
||||
u32 firstId, lastId;
|
||||
struct Pokemon *party = GetBattlerParty(battlerId);
|
||||
u32 i, j;
|
||||
|
||||
@ -3718,39 +3685,39 @@ void IncreaseStatUpScore(u32 battlerAtk, u32 battlerDef, u32 statId, s32 *score)
|
||||
if (HasMoveWithSplit(battlerAtk, SPLIT_PHYSICAL) && AI_DATA->hpPercents[battlerAtk] > 40)
|
||||
{
|
||||
if (gBattleMons[battlerAtk].statStages[STAT_ATK] < STAT_UP_2_STAGE)
|
||||
*score += 2;
|
||||
ADJUST_SCORE_PTR(2);
|
||||
else if (gBattleMons[battlerAtk].statStages[STAT_ATK] < STAT_UP_STAGE)
|
||||
*(score)++;
|
||||
ADJUST_SCORE_PTR(1);
|
||||
}
|
||||
if (HasMoveEffect(battlerAtk, EFFECT_FOUL_PLAY))
|
||||
*(score)++;
|
||||
ADJUST_SCORE_PTR(1);
|
||||
break;
|
||||
case STAT_DEF:
|
||||
if ((HasMoveWithSplit(battlerDef, SPLIT_PHYSICAL)|| IS_MOVE_PHYSICAL(gLastMoves[battlerDef]))
|
||||
&& AI_DATA->hpPercents[battlerAtk] > 70)
|
||||
{
|
||||
if (gBattleMons[battlerAtk].statStages[STAT_DEF] < STAT_UP_2_STAGE)
|
||||
*score += 2; // seems better to raise def at higher HP
|
||||
ADJUST_SCORE_PTR(2); // seems better to raise def at higher HP
|
||||
else if (gBattleMons[battlerAtk].statStages[STAT_DEF] < STAT_UP_STAGE)
|
||||
*(score)++;
|
||||
ADJUST_SCORE_PTR(1);
|
||||
}
|
||||
break;
|
||||
case STAT_SPEED:
|
||||
if (!AI_STRIKES_FIRST(battlerAtk, battlerDef, AI_THINKING_STRUCT->moveConsidered))
|
||||
{
|
||||
if (gBattleMons[battlerAtk].statStages[STAT_SPEED] < STAT_UP_2_STAGE)
|
||||
*score += 2;
|
||||
ADJUST_SCORE_PTR(2);
|
||||
else if (gBattleMons[battlerAtk].statStages[STAT_SPEED] < STAT_UP_STAGE)
|
||||
*(score)++;
|
||||
ADJUST_SCORE_PTR(1);
|
||||
}
|
||||
break;
|
||||
case STAT_SPATK:
|
||||
if (HasMoveWithSplit(battlerAtk, SPLIT_SPECIAL) && AI_DATA->hpPercents[battlerAtk] > 40)
|
||||
{
|
||||
if (gBattleMons[battlerAtk].statStages[STAT_SPATK] < STAT_UP_2_STAGE)
|
||||
*score += 2;
|
||||
ADJUST_SCORE_PTR(2);
|
||||
else if (gBattleMons[battlerAtk].statStages[STAT_SPATK] < STAT_UP_STAGE)
|
||||
*(score)++;
|
||||
ADJUST_SCORE_PTR(1);
|
||||
}
|
||||
break;
|
||||
case STAT_SPDEF:
|
||||
@ -3758,24 +3725,24 @@ void IncreaseStatUpScore(u32 battlerAtk, u32 battlerDef, u32 statId, s32 *score)
|
||||
&& AI_DATA->hpPercents[battlerAtk] > 70)
|
||||
{
|
||||
if (gBattleMons[battlerAtk].statStages[STAT_SPDEF] < STAT_UP_2_STAGE)
|
||||
*score += 2; // seems better to raise spdef at higher HP
|
||||
ADJUST_SCORE_PTR(2); // seems better to raise spdef at higher HP
|
||||
else if (gBattleMons[battlerAtk].statStages[STAT_SPDEF] < STAT_UP_STAGE)
|
||||
*(score)++;
|
||||
ADJUST_SCORE_PTR(1);
|
||||
}
|
||||
break;
|
||||
case STAT_ACC:
|
||||
if (HasMoveWithLowAccuracy(battlerAtk, battlerDef, 80, TRUE, AI_DATA->abilities[battlerAtk], AI_DATA->abilities[battlerDef], AI_DATA->holdEffects[battlerAtk], AI_DATA->holdEffects[battlerDef]))
|
||||
*score += 2; // has moves with less than 80% accuracy
|
||||
ADJUST_SCORE_PTR(2); // has moves with less than 80% accuracy
|
||||
else if (HasMoveWithLowAccuracy(battlerAtk, battlerDef, 90, TRUE, AI_DATA->abilities[battlerAtk], AI_DATA->abilities[battlerDef], AI_DATA->holdEffects[battlerAtk], AI_DATA->holdEffects[battlerDef]))
|
||||
*(score)++;
|
||||
ADJUST_SCORE_PTR(1);
|
||||
break;
|
||||
case STAT_EVASION:
|
||||
if (!BattlerWillFaintFromWeather(battlerAtk, AI_DATA->abilities[battlerAtk]))
|
||||
{
|
||||
if (!GetBattlerSecondaryDamage(battlerAtk) && !(gStatuses3[battlerAtk] & STATUS3_ROOTED))
|
||||
*score += 2;
|
||||
ADJUST_SCORE_PTR(2);
|
||||
else
|
||||
*(score)++;
|
||||
ADJUST_SCORE_PTR(1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -3790,18 +3757,18 @@ void IncreasePoisonScore(u32 battlerAtk, u32 battlerDef, u32 move, s32 *score)
|
||||
if (AI_CanPoison(battlerAtk, battlerDef, AI_DATA->abilities[battlerDef], move, AI_DATA->partnerMove) && AI_DATA->hpPercents[battlerDef] > 20)
|
||||
{
|
||||
if (!HasDamagingMove(battlerDef))
|
||||
*score += 2;
|
||||
ADJUST_SCORE_PTR(2);
|
||||
|
||||
if (AI_THINKING_STRUCT->aiFlags & AI_FLAG_STALL && HasMoveEffect(battlerAtk, EFFECT_PROTECT))
|
||||
(*score)++; // stall tactic
|
||||
ADJUST_SCORE_PTR(1); // stall tactic
|
||||
|
||||
if (HasMoveEffect(battlerAtk, EFFECT_VENOSHOCK)
|
||||
|| HasMoveEffect(battlerAtk, EFFECT_HEX)
|
||||
|| HasMoveEffect(battlerAtk, EFFECT_VENOM_DRENCH)
|
||||
|| AI_DATA->abilities[battlerAtk] == ABILITY_MERCILESS)
|
||||
*(score) += 2;
|
||||
ADJUST_SCORE_PTR(2);
|
||||
else
|
||||
*(score)++;
|
||||
ADJUST_SCORE_PTR(1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3813,15 +3780,15 @@ void IncreaseBurnScore(u32 battlerAtk, u32 battlerDef, u32 move, s32 *score)
|
||||
|
||||
if (AI_CanBurn(battlerAtk, battlerDef, AI_DATA->abilities[battlerDef], BATTLE_PARTNER(battlerAtk), move, AI_DATA->partnerMove))
|
||||
{
|
||||
(*score)++; // burning is good
|
||||
ADJUST_SCORE_PTR(1); // burning is good
|
||||
if (HasMoveWithSplit(battlerDef, SPLIT_PHYSICAL))
|
||||
{
|
||||
if (CanTargetFaintAi(battlerDef, battlerAtk))
|
||||
*score += 2; // burning the target to stay alive is cool
|
||||
ADJUST_SCORE_PTR(2); // burning the target to stay alive is cool
|
||||
}
|
||||
|
||||
if (HasMoveEffect(battlerAtk, EFFECT_HEX) || HasMoveEffect(BATTLE_PARTNER(battlerAtk), EFFECT_HEX))
|
||||
(*score)++;
|
||||
ADJUST_SCORE_PTR(1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3841,9 +3808,9 @@ void IncreaseParalyzeScore(u32 battlerAtk, u32 battlerDef, u32 move, s32 *score)
|
||||
|| HasMoveEffect(battlerAtk, EFFECT_FLINCH_HIT)
|
||||
|| gBattleMons[battlerDef].status2 & STATUS2_INFATUATION
|
||||
|| gBattleMons[battlerDef].status2 & STATUS2_CONFUSION)
|
||||
*score += 4;
|
||||
ADJUST_SCORE_PTR(4);
|
||||
else
|
||||
*score += 2;
|
||||
ADJUST_SCORE_PTR(2);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3854,16 +3821,16 @@ void IncreaseSleepScore(u32 battlerAtk, u32 battlerDef, u32 move, s32 *score)
|
||||
return;
|
||||
|
||||
if (AI_CanPutToSleep(battlerAtk, battlerDef, AI_DATA->abilities[battlerDef], move, AI_DATA->partnerMove))
|
||||
*score += 2;
|
||||
ADJUST_SCORE_PTR(2);
|
||||
else
|
||||
return;
|
||||
|
||||
if ((HasMoveEffect(battlerAtk, EFFECT_DREAM_EATER) || HasMoveEffect(battlerAtk, EFFECT_NIGHTMARE))
|
||||
&& !(HasMoveEffect(battlerDef, EFFECT_SNORE) || HasMoveEffect(battlerDef, EFFECT_SLEEP_TALK)))
|
||||
(*score)++;
|
||||
ADJUST_SCORE_PTR(1);
|
||||
|
||||
if (HasMoveEffect(battlerAtk, EFFECT_HEX) || HasMoveEffect(BATTLE_PARTNER(battlerAtk), EFFECT_HEX))
|
||||
(*score)++;
|
||||
ADJUST_SCORE_PTR(1);
|
||||
}
|
||||
|
||||
void IncreaseConfusionScore(u32 battlerAtk, u32 battlerDef, u32 move, s32 *score)
|
||||
@ -3879,9 +3846,9 @@ void IncreaseConfusionScore(u32 battlerAtk, u32 battlerDef, u32 move, s32 *score
|
||||
if (gBattleMons[battlerDef].status1 & STATUS1_PARALYSIS
|
||||
|| gBattleMons[battlerDef].status2 & STATUS2_INFATUATION
|
||||
|| (AI_DATA->abilities[battlerAtk] == ABILITY_SERENE_GRACE && HasMoveEffect(battlerAtk, EFFECT_FLINCH_HIT)))
|
||||
*score += 3;
|
||||
ADJUST_SCORE_PTR(3);
|
||||
else
|
||||
*score += 2;
|
||||
ADJUST_SCORE_PTR(2);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3892,15 +3859,15 @@ void IncreaseFrostbiteScore(u32 battlerAtk, u32 battlerDef, u32 move, s32 *score
|
||||
|
||||
if (AI_CanGiveFrostbite(battlerAtk, battlerDef, AI_DATA->abilities[battlerDef], BATTLE_PARTNER(battlerAtk), move, AI_DATA->partnerMove))
|
||||
{
|
||||
(*score)++; // frostbite is good
|
||||
ADJUST_SCORE_PTR(1); // frostbite is good
|
||||
if (HasMoveWithSplit(battlerDef, SPLIT_SPECIAL))
|
||||
{
|
||||
if (CanTargetFaintAi(battlerDef, battlerAtk))
|
||||
*score += 2; // frostbiting the target to stay alive is cool
|
||||
ADJUST_SCORE_PTR(2); // frostbiting the target to stay alive is cool
|
||||
}
|
||||
|
||||
if (HasMoveEffect(battlerAtk, EFFECT_HEX) || HasMoveEffect(BATTLE_PARTNER(battlerAtk), EFFECT_HEX))
|
||||
(*score)++;
|
||||
ADJUST_SCORE_PTR(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -248,6 +248,7 @@ void LaunchBattleAnimation(u32 animType, u32 animId)
|
||||
switch (animType)
|
||||
{
|
||||
case ANIM_TYPE_GENERAL:
|
||||
default:
|
||||
animsTable = gBattleAnims_General;
|
||||
break;
|
||||
case ANIM_TYPE_MOVE:
|
||||
@ -1468,10 +1469,8 @@ static void LoadDefaultBg(void)
|
||||
{
|
||||
if (IsContest())
|
||||
LoadContestBgAfterMoveAnim();
|
||||
#if B_TERRAIN_BG_CHANGE == TRUE
|
||||
else if (gFieldStatuses & STATUS_FIELD_TERRAIN_ANY)
|
||||
else if (B_TERRAIN_BG_CHANGE == TRUE && gFieldStatuses & STATUS_FIELD_TERRAIN_ANY)
|
||||
DrawTerrainTypeBattleBackground();
|
||||
#endif
|
||||
else
|
||||
DrawMainBattleBackground();
|
||||
}
|
||||
|
||||
2
src/battle_anim_effects_3.c
Executable file → Normal file
2
src/battle_anim_effects_3.c
Executable file → Normal file
@ -721,8 +721,6 @@ const struct SpriteTemplate gSweetScentPetalSpriteTemplate =
|
||||
.callback = AnimSweetScentPetal,
|
||||
};
|
||||
|
||||
static const u16 sUnusedPalette[] = INCBIN_U16("graphics/battle_anims/unused/unknown.gbapal");
|
||||
|
||||
const union AnimCmd gPainSplitAnimCmds[] =
|
||||
{
|
||||
ANIMCMD_FRAME(0, 5),
|
||||
|
||||
@ -1447,7 +1447,6 @@ static void AnimPoltergeistItem(struct Sprite *sprite)
|
||||
void AnimTask_PulverizingPancakeWhiteShadow(u8 taskId)
|
||||
{
|
||||
struct Task *task;
|
||||
s16 battler;
|
||||
u8 spriteId;
|
||||
s16 baseX, baseY;
|
||||
s16 x, y;
|
||||
|
||||
@ -750,7 +750,7 @@ static void SetBattlersXOffsetForShake(struct Task *task)
|
||||
|
||||
void AnimTask_IsPowerOver99(u8 taskId)
|
||||
{
|
||||
gBattleAnimArgs[15] = gAnimMovePower > 99;
|
||||
gBattleAnimArgs[ARG_RET_ID] = gAnimMovePower > 99;
|
||||
DestroyAnimVisualTask(taskId);
|
||||
}
|
||||
|
||||
|
||||
@ -81,8 +81,6 @@ static void SpriteCB_HorizontalSliceStep(struct Sprite *sprite);
|
||||
static void SpriteCB_HorizontalSlice(struct Sprite *sprite);
|
||||
static void SpriteCB_LashOutStrike(struct Sprite* sprite);
|
||||
static void AnimTask_TwinkleTackleLaunchStep(u8 taskId);
|
||||
static void SpriteCB_ShellSmashShell(struct Sprite* sprite);
|
||||
static void SpriteCB_ShellSmashShell_DestroyDuringFadeOut(struct Sprite* sprite);
|
||||
static void SpriteCB_AnimSpriteOnTargetSideCentre(struct Sprite *sprite);
|
||||
static void SpriteCB_SpriteOnMonUntilAffineAnimEnds(struct Sprite* sprite);
|
||||
static void SpriteCB_MoveSpriteUpwardsForDurationStep(struct Sprite* sprite);
|
||||
@ -8726,6 +8724,7 @@ static void SpriteCB_LashOutStrike(struct Sprite* sprite)
|
||||
sprite->callback = AnimKnockOffStrike_Step;
|
||||
}
|
||||
|
||||
/* TODO - Use the ShellSmash Anim
|
||||
//Moves the shells towards the attacker and leaves them there until they fade out
|
||||
//arg 0: Initial x-pos
|
||||
//arg 1: Final x-pos
|
||||
@ -8753,6 +8752,7 @@ static void SpriteCB_ShellSmashShell_DestroyDuringFadeOut(struct Sprite* sprite)
|
||||
if (GetGpuReg(REG_OFFSET_BLDALPHA) >= BLDALPHA_BLEND(0, 8)) //Fade out 1/2 done
|
||||
DestroyAnimSprite(sprite);
|
||||
}
|
||||
*/
|
||||
|
||||
static void SpriteCB_AnimSpriteOnTargetSideCentre(struct Sprite *sprite)
|
||||
{
|
||||
|
||||
@ -351,8 +351,7 @@ const struct SpriteTemplate gSeedFlareGreenWavesTemplate =
|
||||
|
||||
static void AnimStealthRock(struct Sprite *sprite)
|
||||
{
|
||||
u16 x;
|
||||
u16 y;
|
||||
s16 x, y;
|
||||
|
||||
InitSpritePosToAnimAttacker(sprite, TRUE);
|
||||
SetAverageBattlerPositions(gBattleAnimTarget, FALSE, &x, &y);
|
||||
|
||||
@ -57,9 +57,6 @@ static void AnimAquaTail(struct Sprite *sprite);
|
||||
static void AnimKnockOffAquaTail(struct Sprite *sprite);
|
||||
static void AnimKnockOffAquaTailStep(struct Sprite *sprite);
|
||||
|
||||
static const u8 sUnusedWater_Gfx[] = INCBIN_U8("graphics/battle_anims/unused/water_gfx.4bpp");
|
||||
static const u8 sUnusedWater[] = INCBIN_U8("graphics/battle_anims/unused/water.bin");
|
||||
|
||||
static const union AnimCmd sAnim_RainDrop[] =
|
||||
{
|
||||
ANIMCMD_FRAME(0, 2),
|
||||
|
||||
@ -859,11 +859,10 @@ void LoadBattleTextboxAndBackground(void)
|
||||
CopyBgTilemapBufferToVram(0);
|
||||
LoadCompressedPalette(gBattleTextboxPalette, BG_PLTT_ID(0), 2 * PLTT_SIZE_4BPP);
|
||||
LoadBattleMenuWindowGfx();
|
||||
#if B_TERRAIN_BG_CHANGE == TRUE
|
||||
if (B_TERRAIN_BG_CHANGE == TRUE)
|
||||
DrawTerrainTypeBattleBackground();
|
||||
#else
|
||||
else
|
||||
DrawMainBattleBackground();
|
||||
#endif
|
||||
}
|
||||
|
||||
static void DrawLinkBattleParticipantPokeballs(u8 taskId, u8 multiplayerId, u8 bgId, u8 destX, u8 destY)
|
||||
|
||||
@ -595,9 +595,8 @@ static void OpponentHandleChooseMove(u32 battler)
|
||||
target = GetBattlerAtPosition(Random() & 2);
|
||||
} while (!CanTargetBattler(battler, target, move));
|
||||
|
||||
#if B_WILD_NATURAL_ENEMIES == TRUE
|
||||
// Don't bother to loop through table if the move can't attack ally
|
||||
if (!(gBattleMoves[move].target & MOVE_TARGET_BOTH))
|
||||
if (B_WILD_NATURAL_ENEMIES == TRUE && !(gBattleMoves[move].target & MOVE_TARGET_BOTH))
|
||||
{
|
||||
u16 i, speciesAttacker, speciesTarget, isPartnerEnemy = FALSE;
|
||||
static const u16 naturalEnemies[][2] =
|
||||
@ -627,9 +626,10 @@ static void OpponentHandleChooseMove(u32 battler)
|
||||
BtlController_EmitTwoReturnValues(battler, BUFFER_B, 10, (chosenMoveId) | (target << 8));
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
BtlController_EmitTwoReturnValues(battler, BUFFER_B, 10, (chosenMoveId) | (target << 8));
|
||||
}
|
||||
}
|
||||
else
|
||||
BtlController_EmitTwoReturnValues(battler, BUFFER_B, 10, (chosenMoveId) | (GetBattlerAtPosition(B_POSITION_PLAYER_LEFT) << 8));
|
||||
|
||||
|
||||
@ -202,7 +202,7 @@ static void CompleteOnBattlerSpritePosX_0(u32 battler)
|
||||
static u16 GetPrevBall(u16 ballId)
|
||||
{
|
||||
u16 ballPrev;
|
||||
u32 i, j;
|
||||
s32 i, j;
|
||||
CompactItemsInBagPocket(&gBagPockets[BALLS_POCKET]);
|
||||
for (i = 0; i < gBagPockets[BALLS_POCKET].capacity; i++)
|
||||
{
|
||||
@ -218,29 +218,30 @@ static u16 GetPrevBall(u16 ballId)
|
||||
}
|
||||
}
|
||||
i--;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return gBagPockets[BALLS_POCKET].itemSlots[i].itemId;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static u16 GetNextBall(u16 ballId)
|
||||
{
|
||||
u16 ballNext;
|
||||
u32 i;
|
||||
u16 ballNext = 0;
|
||||
s32 i;
|
||||
CompactItemsInBagPocket(&gBagPockets[BALLS_POCKET]);
|
||||
for (i = 0; i < gBagPockets[BALLS_POCKET].capacity; i++)
|
||||
{
|
||||
if (ballId == gBagPockets[BALLS_POCKET].itemSlots[i].itemId)
|
||||
{
|
||||
i++;
|
||||
ballNext = gBagPockets[BALLS_POCKET].itemSlots[i].itemId;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (ballNext == ITEM_NONE)
|
||||
return gBagPockets[BALLS_POCKET].itemSlots[0].itemId; // Zeroth slot
|
||||
else
|
||||
return ballNext;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void HandleInputChooseAction(u32 battler)
|
||||
{
|
||||
@ -729,7 +730,8 @@ static void HandleInputChooseMove(u32 battler)
|
||||
canSelectTarget = 0;
|
||||
}
|
||||
|
||||
#if B_SHOW_TARGETS == TRUE
|
||||
if (B_SHOW_TARGETS == TRUE)
|
||||
{
|
||||
// Show all available targets for multi-target moves
|
||||
if ((moveTarget & MOVE_TARGET_ALL_BATTLERS) == MOVE_TARGET_ALL_BATTLERS)
|
||||
{
|
||||
@ -747,7 +749,7 @@ static void HandleInputChooseMove(u32 battler)
|
||||
TryShowAsTarget(BATTLE_PARTNER(battler));
|
||||
canSelectTarget = 2;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
switch (canSelectTarget)
|
||||
@ -1839,7 +1841,7 @@ static void PlayerHandleDrawTrainerPic(u32 battler)
|
||||
{
|
||||
bool32 isFrontPic;
|
||||
s16 xPos, yPos;
|
||||
u32 trainerPicId, gender;
|
||||
u32 trainerPicId;
|
||||
|
||||
trainerPicId = PlayerGetTrainerBackPicId();
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_MULTI)
|
||||
|
||||
@ -844,7 +844,7 @@ static const u8 *const sAiInfoItemNames[] =
|
||||
|
||||
static void PutAiInfoText(struct BattleDebugMenu *data)
|
||||
{
|
||||
u32 i, j, count;
|
||||
u32 i;
|
||||
u8 *text = Alloc(0x50);
|
||||
|
||||
FillWindowPixelBuffer(data->aiMovesWindowId, 0x11);
|
||||
|
||||
@ -2796,7 +2796,6 @@ static int SelectOpponentMonsFromParty(int *partyMovePoints, bool8 allowRandom)
|
||||
static int GetTypeEffectivenessPoints(int move, int targetSpecies, int mode)
|
||||
{
|
||||
int defType1, defType2, defAbility, moveType;
|
||||
int i = 0;
|
||||
int typePower = TYPE_x1;
|
||||
|
||||
if (move == MOVE_NONE || move == MOVE_UNAVAILABLE || IS_MOVE_STATUS(move))
|
||||
|
||||
@ -591,13 +591,16 @@ void BattleLoadMonSpriteGfx(struct Pokemon *mon, u32 battler)
|
||||
else
|
||||
{
|
||||
species = gBattleSpritesDataPtr->battlerData[battler].transformSpecies;
|
||||
#if B_TRANSFORM_SHINY >= GEN_4
|
||||
if (B_TRANSFORM_SHINY >= GEN_4)
|
||||
{
|
||||
currentPersonality = gTransformedPersonalities[battler];
|
||||
currentOtId = gTransformedOtIds[battler];
|
||||
#else
|
||||
}
|
||||
else
|
||||
{
|
||||
currentPersonality = monsPersonality;
|
||||
currentOtId = otId;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
position = GetBattlerPosition(battler);
|
||||
@ -894,14 +897,12 @@ void HandleSpeciesGfxDataChange(u8 battlerAtk, u8 battlerDef, bool32 megaEvo, bo
|
||||
|
||||
if (GetBattlerSide(battlerAtk) == B_SIDE_PLAYER)
|
||||
{
|
||||
#if B_TRANSFORM_SHINY >= GEN_4
|
||||
if (trackEnemyPersonality)
|
||||
if (B_TRANSFORM_SHINY >= GEN_4 && trackEnemyPersonality)
|
||||
{
|
||||
personalityValue = GetMonData(&gEnemyParty[gBattlerPartyIndexes[battlerAtk]], MON_DATA_PERSONALITY);
|
||||
otId = GetMonData(&gEnemyParty[gBattlerPartyIndexes[battlerAtk]], MON_DATA_OT_ID);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
personalityValue = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerAtk]], MON_DATA_PERSONALITY);
|
||||
otId = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerAtk]], MON_DATA_OT_ID);
|
||||
@ -915,15 +916,13 @@ void HandleSpeciesGfxDataChange(u8 battlerAtk, u8 battlerDef, bool32 megaEvo, bo
|
||||
}
|
||||
else
|
||||
{
|
||||
#if B_TRANSFORM_SHINY >= GEN_4
|
||||
if (trackEnemyPersonality)
|
||||
if (B_TRANSFORM_SHINY >= GEN_4 && trackEnemyPersonality)
|
||||
{
|
||||
personalityValue = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerAtk]], MON_DATA_PERSONALITY);
|
||||
otId = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerAtk]], MON_DATA_OT_ID);
|
||||
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
personalityValue = GetMonData(&gEnemyParty[gBattlerPartyIndexes[battlerAtk]], MON_DATA_PERSONALITY);
|
||||
otId = GetMonData(&gEnemyParty[gBattlerPartyIndexes[battlerAtk]], MON_DATA_OT_ID);
|
||||
|
||||
@ -754,12 +754,6 @@ static const struct SpriteTemplate sSpriteTemplate_BurstTrigger =
|
||||
#define hBar_HealthBoxSpriteId data[5]
|
||||
#define hBar_Data6 data[6]
|
||||
|
||||
static void InitLastUsedBallAssets(void)
|
||||
{
|
||||
gBattleStruct->ballSpriteIds[0] = MAX_SPRITES;
|
||||
gBattleStruct->ballSpriteIds[1] = MAX_SPRITES;
|
||||
}
|
||||
|
||||
// This function is here to cover a specific case - one player's mon in a 2 vs 1 double battle. In this scenario - display singles layout.
|
||||
// The same goes for a 2 vs 1 where opponent has only one pokemon.
|
||||
u32 WhichBattleCoords(u32 battlerId) // 0 - singles, 1 - doubles
|
||||
@ -780,7 +774,7 @@ u8 CreateBattlerHealthboxSprites(u8 battlerId)
|
||||
{
|
||||
s16 data6 = 0;
|
||||
u8 healthboxLeftSpriteId, healthboxRightSpriteId;
|
||||
u8 healthbarSpriteId, megaIndicatorSpriteId;
|
||||
u8 healthbarSpriteId;
|
||||
struct Sprite *healthBarSpritePtr;
|
||||
|
||||
if (WhichBattleCoords(battlerId) == 0) // Singles
|
||||
@ -1002,10 +996,8 @@ void UpdateOamPriorityInAllHealthboxes(u8 priority, bool32 hideHPBoxes)
|
||||
MegaIndicator_UpdateOamPriority(healthboxLeftSpriteId, priority);
|
||||
DynamaxIndicator_UpdateOamPriority(healthboxLeftSpriteId, priority);
|
||||
|
||||
#if B_HIDE_HEALTHBOX_IN_ANIMS
|
||||
if (hideHPBoxes && IsBattlerAlive(i))
|
||||
if (B_HIDE_HEALTHBOX_IN_ANIMS == TRUE && hideHPBoxes && IsBattlerAlive(i))
|
||||
TryToggleHealboxVisibility(priority, healthboxLeftSpriteId, healthboxRightSpriteId, healthbarSpriteId);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@ -1099,7 +1091,7 @@ static void UpdateLvlInHealthbox(u8 healthboxSpriteId, u8 lvl)
|
||||
static void PrintHpOnHealthbox(u32 spriteId, s16 currHp, s16 maxHp, u32 bgColor, u32 rightTile, u32 leftTile)
|
||||
{
|
||||
u8 *windowTileData;
|
||||
u32 windowId, tilesCount, x, healthboxTileNum;
|
||||
u32 windowId, tilesCount, x;
|
||||
u8 text[28], *txtPtr;
|
||||
void *objVram = (void *)(OBJ_VRAM0) + gSprites[spriteId].oam.tileNum * TILE_SIZE_4BPP;
|
||||
|
||||
@ -1702,7 +1694,6 @@ void MegaIndicator_LoadSpritesGfx(void)
|
||||
|
||||
static bool32 MegaIndicator_ShouldBeInvisible(u32 battlerId, struct Sprite *sprite)
|
||||
{
|
||||
u32 side = GetBattlerSide(battlerId);
|
||||
bool32 megaEvolved = IsBattlerMegaEvolved(battlerId);
|
||||
bool32 primalReverted = IsBattlerPrimalReverted(battlerId);
|
||||
|
||||
@ -1749,7 +1740,6 @@ static void MegaIndicator_UpdateOamPriority(u32 healthboxId, u32 oamPriority)
|
||||
|
||||
static void MegaIndicator_UpdateLevel(u32 healthboxId, u32 level)
|
||||
{
|
||||
u32 i;
|
||||
s16 xDelta = 0;
|
||||
u8 *spriteId = MegaIndicator_GetSpriteId(healthboxId);
|
||||
|
||||
@ -1764,7 +1754,7 @@ static void MegaIndicator_UpdateLevel(u32 healthboxId, u32 level)
|
||||
static void MegaIndicator_CreateSprite(u32 battlerId, u32 healthboxSpriteId)
|
||||
{
|
||||
struct SpriteTemplate sprTemplate;
|
||||
u32 position, level;
|
||||
u32 position;
|
||||
u8 *spriteId;
|
||||
s16 xHealthbox = 0, y = 0;
|
||||
s32 x = 0;
|
||||
@ -2624,15 +2614,12 @@ s32 MoveBattleBar(u8 battlerId, u8 healthboxSpriteId, u8 whichBar, u8 unused)
|
||||
|
||||
if (whichBar == HEALTH_BAR) // health bar
|
||||
{
|
||||
u16 hpFraction = B_FAST_HP_DRAIN == FALSE ? 1 : max(gBattleSpritesDataPtr->battleBars[battlerId].maxValue / B_HEALTHBAR_PIXELS, 1);
|
||||
currentBarValue = CalcNewBarValue(gBattleSpritesDataPtr->battleBars[battlerId].maxValue,
|
||||
gBattleSpritesDataPtr->battleBars[battlerId].oldValue,
|
||||
gBattleSpritesDataPtr->battleBars[battlerId].receivedValue,
|
||||
&gBattleSpritesDataPtr->battleBars[battlerId].currValue,
|
||||
#if B_FAST_HP_DRAIN == TRUE
|
||||
B_HEALTHBAR_PIXELS / 8, max(gBattleSpritesDataPtr->battleBars[battlerId].maxValue / B_HEALTHBAR_PIXELS, 1));
|
||||
#else
|
||||
B_HEALTHBAR_PIXELS / 8, 1);
|
||||
#endif
|
||||
B_HEALTHBAR_PIXELS / 8, hpFraction);
|
||||
}
|
||||
else // exp bar
|
||||
{
|
||||
@ -3249,10 +3236,12 @@ static void RestoreOverwrittenPixels(u8 *tiles)
|
||||
|
||||
void CreateAbilityPopUp(u8 battlerId, u32 ability, bool32 isDoubleBattle)
|
||||
{
|
||||
#if B_ABILITY_POP_UP == TRUE
|
||||
const s16 (*coords)[2];
|
||||
u8 spriteId1, spriteId2, battlerPosition, taskId;
|
||||
|
||||
if (B_ABILITY_POP_UP == FALSE)
|
||||
return;
|
||||
|
||||
if (gTestRunnerEnabled)
|
||||
{
|
||||
TestRunner_Battle_RecordAbilityPopUp(battlerId, ability);
|
||||
@ -3322,7 +3311,6 @@ void CreateAbilityPopUp(u8 battlerId, u32 ability, bool32 isDoubleBattle)
|
||||
PrintBattlerOnAbilityPopUp(battlerId, spriteId1, spriteId2);
|
||||
PrintAbilityOnAbilityPopUp(ability, spriteId1, spriteId2);
|
||||
RestoreOverwrittenPixels((void*)(OBJ_VRAM0) + (gSprites[spriteId1].oam.tileNum * 32));
|
||||
#endif
|
||||
}
|
||||
|
||||
void UpdateAbilityPopup(u8 battlerId)
|
||||
@ -3405,18 +3393,10 @@ static const struct OamData sOamData_LastUsedBall =
|
||||
.objMode = 0,
|
||||
.mosaic = 0,
|
||||
.bpp = 0,
|
||||
#if B_LAST_USED_BALL_CYCLE == TRUE
|
||||
.shape = SPRITE_SHAPE(32x64),
|
||||
#else
|
||||
.shape = SPRITE_SHAPE(32x32),
|
||||
#endif
|
||||
.shape = (B_LAST_USED_BALL_CYCLE == TRUE ? SPRITE_SHAPE(32x64) : SPRITE_SHAPE(32x32)),
|
||||
.x = 0,
|
||||
.matrixNum = 0,
|
||||
#if B_LAST_USED_BALL_CYCLE == TRUE
|
||||
.size = SPRITE_SIZE(32x64),
|
||||
#else
|
||||
.size = SPRITE_SIZE(32x32),
|
||||
#endif
|
||||
.size = (B_LAST_USED_BALL_CYCLE == TRUE ? SPRITE_SIZE(32x64) : SPRITE_SIZE(32x32)),
|
||||
.tileNum = 0,
|
||||
.priority = 1,
|
||||
.paletteNum = 0,
|
||||
@ -3467,9 +3447,8 @@ static const struct SpriteSheet sSpriteSheet_LastUsedBallWindow =
|
||||
|
||||
bool32 CanThrowLastUsedBall(void)
|
||||
{
|
||||
#if B_LAST_USED_BALL == FALSE
|
||||
if (B_LAST_USED_BALL == FALSE)
|
||||
return FALSE;
|
||||
#else
|
||||
if (!CanThrowBall())
|
||||
return FALSE;
|
||||
if (gBattleTypeFlags & (BATTLE_TYPE_TRAINER | BATTLE_TYPE_FRONTIER))
|
||||
@ -3478,12 +3457,12 @@ bool32 CanThrowLastUsedBall(void)
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
#endif
|
||||
}
|
||||
|
||||
void TryAddLastUsedBallItemSprites(void)
|
||||
{
|
||||
#if B_LAST_USED_BALL == TRUE
|
||||
if (B_LAST_USED_BALL == FALSE)
|
||||
return;
|
||||
if (gLastThrownBall == 0
|
||||
|| (gLastThrownBall != 0 && !CheckBagHasItem(gLastThrownBall, 1)))
|
||||
{
|
||||
@ -3520,10 +3499,8 @@ void TryAddLastUsedBallItemSprites(void)
|
||||
gSprites[gBattleStruct->ballSpriteIds[1]].sHide = FALSE; // restore
|
||||
gLastUsedBallMenuPresent = TRUE;
|
||||
}
|
||||
#if B_LAST_USED_BALL_CYCLE == TRUE
|
||||
if (B_LAST_USED_BALL_CYCLE == TRUE)
|
||||
ArrowsChangeColorLastBallCycle(0); //Default the arrows to be invisible
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
static void DestroyLastUsedBallWinGfx(struct Sprite *sprite)
|
||||
@ -3581,7 +3558,8 @@ static void SpriteCB_LastUsedBall(struct Sprite *sprite)
|
||||
|
||||
static void TryHideOrRestoreLastUsedBall(u8 caseId)
|
||||
{
|
||||
#if B_LAST_USED_BALL == TRUE
|
||||
if (B_LAST_USED_BALL == FALSE)
|
||||
return;
|
||||
if (gBattleStruct->ballSpriteIds[0] == MAX_SPRITES)
|
||||
return;
|
||||
|
||||
@ -3602,27 +3580,25 @@ static void TryHideOrRestoreLastUsedBall(u8 caseId)
|
||||
gLastUsedBallMenuPresent = TRUE;
|
||||
break;
|
||||
}
|
||||
#if B_LAST_USED_BALL_CYCLE == TRUE
|
||||
if (B_LAST_USED_BALL_CYCLE == TRUE)
|
||||
ArrowsChangeColorLastBallCycle(0); //Default the arrows to be invisible
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void TryHideLastUsedBall(void)
|
||||
{
|
||||
#if B_LAST_USED_BALL == TRUE
|
||||
if (B_LAST_USED_BALL == TRUE)
|
||||
TryHideOrRestoreLastUsedBall(0);
|
||||
#endif
|
||||
}
|
||||
|
||||
void TryRestoreLastUsedBall(void)
|
||||
{
|
||||
#if B_LAST_USED_BALL == TRUE
|
||||
if (B_LAST_USED_BALL == FALSE)
|
||||
return;
|
||||
|
||||
if (gBattleStruct->ballSpriteIds[0] != MAX_SPRITES)
|
||||
TryHideOrRestoreLastUsedBall(1);
|
||||
else
|
||||
TryAddLastUsedBallItemSprites();
|
||||
#endif
|
||||
}
|
||||
|
||||
static void SpriteCB_LastUsedBallBounce(struct Sprite *sprite)
|
||||
|
||||
@ -587,7 +587,6 @@ static void BattleIntroSlidePartner(u8 taskId)
|
||||
void DrawBattlerOnBg(int bgId, u8 x, u8 y, u8 battlerPosition, u8 paletteId, u8 *tiles, u16 *tilemap, u16 tilesOffset)
|
||||
{
|
||||
int i, j;
|
||||
u8 battler = GetBattlerAtPosition(battlerPosition);
|
||||
int offset = tilesOffset;
|
||||
CpuCopy16(gMonSpritesGfxPtr->sprites.ptr[battlerPosition], tiles, BG_SCREEN_SIZE);
|
||||
LoadBgTiles(bgId, tiles, 0x1000, tilesOffset);
|
||||
|
||||
@ -87,7 +87,6 @@ static void AskRecordBattle(void);
|
||||
static void SpriteCB_MoveWildMonToRight(struct Sprite *sprite);
|
||||
static void SpriteCB_WildMonShowHealthbox(struct Sprite *sprite);
|
||||
static void SpriteCB_WildMonAnimate(struct Sprite *sprite);
|
||||
static void SpriteCB_Flicker(struct Sprite *sprite);
|
||||
static void SpriteCB_AnimFaintOpponent(struct Sprite *sprite);
|
||||
static void SpriteCB_BlinkVisible(struct Sprite *sprite);
|
||||
static void SpriteCB_Idle(struct Sprite *sprite);
|
||||
@ -103,7 +102,6 @@ static void SetActionsAndBattlersTurnOrder(void);
|
||||
static void UpdateBattlerPartyOrdersOnSwitch(u32 battler);
|
||||
static bool8 AllAtActionConfirmed(void);
|
||||
static void TryChangeTurnOrder(void);
|
||||
static void CheckChosenMoveForEffectsBeforeTurnStarts(void);
|
||||
static void CheckQuickClaw_CustapBerryActivation(void);
|
||||
static void FreeResetData_ReturnToOvOrDoEvolutions(void);
|
||||
static void ReturnFromBattleToOverworld(void);
|
||||
@ -133,16 +131,10 @@ EWRAM_DATA u16 gBattle_WIN0H = 0;
|
||||
EWRAM_DATA u16 gBattle_WIN0V = 0;
|
||||
EWRAM_DATA u16 gBattle_WIN1H = 0;
|
||||
EWRAM_DATA u16 gBattle_WIN1V = 0;
|
||||
EWRAM_DATA u8 gDisplayedStringBattle[400] = {0};
|
||||
EWRAM_DATA u8 gDisplayedStringBattle[425] = {0}; // Increased in size to fit Juan's defeat text (SootopolisCity_Gym_1F_Text_JuanDefeat)
|
||||
EWRAM_DATA u8 gBattleTextBuff1[TEXT_BUFF_ARRAY_COUNT] = {0};
|
||||
EWRAM_DATA u8 gBattleTextBuff2[TEXT_BUFF_ARRAY_COUNT] = {0};
|
||||
EWRAM_DATA u8 gBattleTextBuff3[30] = {0}; //expanded for stupidly long z move names
|
||||
// The below array is never intentionally used. However, Juan's
|
||||
// defeat text (SootopolisCity_Gym_1F_Text_JuanDefeat) is too long
|
||||
// for gDisplayedStringBattle and overflows into this array. If it
|
||||
// is removed (and none of the buffers above are increased in size)
|
||||
// it will instead overflow into useful data.
|
||||
EWRAM_DATA static u32 sFlickerArray[25] = {0};
|
||||
EWRAM_DATA u8 gBattleTextBuff3[TEXT_BUFF_ARRAY_COUNT + 13] = {0}; // expanded for stupidly long z move names
|
||||
EWRAM_DATA u32 gBattleTypeFlags = 0;
|
||||
EWRAM_DATA u8 gBattleTerrain = 0;
|
||||
EWRAM_DATA u32 gUnusedFirstBattleVar1 = 0; // Never read
|
||||
@ -235,7 +227,7 @@ EWRAM_DATA u32 gFieldStatuses = 0;
|
||||
EWRAM_DATA struct FieldTimer gFieldTimers = {0};
|
||||
EWRAM_DATA u8 gBattlerAbility = 0;
|
||||
EWRAM_DATA u16 gPartnerSpriteId = 0;
|
||||
EWRAM_DATA struct TotemBoost gTotemBoosts[MAX_BATTLERS_COUNT] = {0};
|
||||
EWRAM_DATA struct QueuedStatBoost gQueuedStatBoosts[MAX_BATTLERS_COUNT] = {0};
|
||||
EWRAM_DATA bool8 gHasFetchedBall = FALSE;
|
||||
EWRAM_DATA u8 gLastUsedBall = 0;
|
||||
EWRAM_DATA u16 gLastThrownBall = 0;
|
||||
@ -508,7 +500,6 @@ void CB2_InitBattle(void)
|
||||
static void CB2_InitBattleInternal(void)
|
||||
{
|
||||
s32 i;
|
||||
u16 targetSpecies;
|
||||
|
||||
SetHBlankCallback(NULL);
|
||||
SetVBlankCallback(NULL);
|
||||
@ -605,14 +596,11 @@ static void CB2_InitBattleInternal(void)
|
||||
gSaveBlock2Ptr->frontier.disableRecordBattle = FALSE;
|
||||
|
||||
for (i = 0; i < PARTY_SIZE; i++)
|
||||
{
|
||||
AdjustFriendship(&gPlayerParty[i], FRIENDSHIP_EVENT_LEAGUE_BATTLE);
|
||||
|
||||
// Apply party-wide start-of-battle form changes
|
||||
for (i = 0; i < PARTY_SIZE; i++)
|
||||
{
|
||||
// Player's side
|
||||
// Apply party-wide start-of-battle form changes for both sides.
|
||||
TryFormChange(i, B_SIDE_PLAYER, FORM_CHANGE_BEGIN_BATTLE);
|
||||
// Opponent's side
|
||||
TryFormChange(i, B_SIDE_OPPONENT, FORM_CHANGE_BEGIN_BATTLE);
|
||||
}
|
||||
|
||||
@ -1940,7 +1928,6 @@ void CustomTrainerPartyAssignMoves(struct Pokemon *mon, const struct TrainerMon
|
||||
u8 CreateNPCTrainerPartyFromTrainer(struct Pokemon *party, const struct Trainer *trainer, bool32 firstTrainer, u32 battleTypeFlags)
|
||||
{
|
||||
u32 personalityValue;
|
||||
u8 fixedIV;
|
||||
s32 i, j;
|
||||
u8 monsCount;
|
||||
if (battleTypeFlags & BATTLE_TYPE_TRAINER && !(battleTypeFlags & (BATTLE_TYPE_FRONTIER
|
||||
@ -2696,29 +2683,6 @@ void SpriteCallbackDummy_2(struct Sprite *sprite)
|
||||
|
||||
}
|
||||
|
||||
#define sNumFlickers data[3]
|
||||
#define sDelay data[4]
|
||||
|
||||
static void SpriteCB_Flicker(struct Sprite *sprite)
|
||||
{
|
||||
sprite->sDelay--;
|
||||
if (sprite->sDelay == 0)
|
||||
{
|
||||
sprite->sDelay = 8;
|
||||
sprite->invisible ^= 1;
|
||||
sprite->sNumFlickers--;
|
||||
if (sprite->sNumFlickers == 0)
|
||||
{
|
||||
sprite->invisible = FALSE;
|
||||
sprite->callback = SpriteCallbackDummy_2;
|
||||
// sFlickerArray[0] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#undef sNumFlickers
|
||||
#undef sDelay
|
||||
|
||||
extern const struct MonCoords gMonFrontPicCoords[];
|
||||
|
||||
void SpriteCB_FaintOpponentMon(struct Sprite *sprite)
|
||||
@ -3249,6 +3213,7 @@ void SwitchInClearSetData(u32 battler)
|
||||
gSelectedMonPartyId = PARTY_SIZE;
|
||||
|
||||
// Allow for illegal abilities within tests.
|
||||
#if TESTING
|
||||
if (gTestRunnerEnabled)
|
||||
{
|
||||
u32 side = GetBattlerSide(battler);
|
||||
@ -3256,6 +3221,7 @@ void SwitchInClearSetData(u32 battler)
|
||||
if (TestRunner_Battle_GetForcedAbility(side, partyIndex))
|
||||
gBattleMons[i].ability = gBattleStruct->overwrittenAbilities[i] = TestRunner_Battle_GetForcedAbility(side, partyIndex);
|
||||
}
|
||||
#endif // TESTING
|
||||
|
||||
Ai_UpdateSwitchInData(battler);
|
||||
}
|
||||
@ -3521,11 +3487,10 @@ static void DoBattleIntro(void)
|
||||
}
|
||||
else // Skip party summary since it is a wild battle.
|
||||
{
|
||||
#if B_FAST_INTRO == TRUE
|
||||
if (B_FAST_INTRO == TRUE)
|
||||
*state = 7; // Don't wait for sprite, print message at the same time.
|
||||
#else
|
||||
else
|
||||
*state = 6; // Wait for sprite to load.
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
case 5: // draw party summary in trainer battles
|
||||
@ -3594,11 +3559,10 @@ static void DoBattleIntro(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
#if B_FAST_INTRO == TRUE
|
||||
if (B_FAST_INTRO == TRUE)
|
||||
*state = 15; // Wait for text to be printed.
|
||||
#else
|
||||
else
|
||||
*state = 14; // Wait for text and sprite.
|
||||
#endif
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -3636,11 +3600,10 @@ static void DoBattleIntro(void)
|
||||
BtlController_EmitIntroTrainerBallThrow(battler, BUFFER_A);
|
||||
MarkBattlerForControllerExec(battler);
|
||||
}
|
||||
#if B_FAST_INTRO == TRUE
|
||||
if (!(gBattleTypeFlags & (BATTLE_TYPE_RECORDED | BATTLE_TYPE_RECORDED_LINK | BATTLE_TYPE_RECORDED_IS_MASTER | BATTLE_TYPE_LINK)))
|
||||
if (B_FAST_INTRO == TRUE
|
||||
&& !(gBattleTypeFlags & (BATTLE_TYPE_RECORDED | BATTLE_TYPE_RECORDED_LINK | BATTLE_TYPE_RECORDED_IS_MASTER | BATTLE_TYPE_LINK)))
|
||||
*state = 15; // Print at the same time as trainer sends out second mon.
|
||||
else
|
||||
#endif
|
||||
(*state)++;
|
||||
break;
|
||||
case 14: // wait for opponent 2 send out
|
||||
@ -3660,14 +3623,13 @@ static void DoBattleIntro(void)
|
||||
battler = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT);
|
||||
|
||||
// A hack that makes fast intro work in trainer battles too.
|
||||
#if B_FAST_INTRO == TRUE
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_TRAINER
|
||||
if (B_FAST_INTRO == TRUE
|
||||
&& gBattleTypeFlags & BATTLE_TYPE_TRAINER
|
||||
&& !(gBattleTypeFlags & (BATTLE_TYPE_RECORDED | BATTLE_TYPE_RECORDED_LINK | BATTLE_TYPE_RECORDED_IS_MASTER | BATTLE_TYPE_LINK))
|
||||
&& gSprites[gHealthboxSpriteIds[battler ^ BIT_SIDE]].callback == SpriteCallbackDummy)
|
||||
{
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
PrepareStringBattle(STRINGID_INTROSENDOUT, battler);
|
||||
}
|
||||
@ -3755,6 +3717,7 @@ static void TryDoEventsBeforeFirstTurn(void)
|
||||
}
|
||||
|
||||
// Allow for illegal abilities within tests.
|
||||
#if TESTING
|
||||
if (gTestRunnerEnabled && gBattleStruct->switchInAbilitiesCounter == 0)
|
||||
{
|
||||
for (i = 0; i < gBattlersCount; ++i)
|
||||
@ -3765,6 +3728,7 @@ static void TryDoEventsBeforeFirstTurn(void)
|
||||
gBattleMons[i].ability = gBattleStruct->overwrittenAbilities[i] = TestRunner_Battle_GetForcedAbility(side, partyIndex);
|
||||
}
|
||||
}
|
||||
#endif // TESTING
|
||||
|
||||
if (gBattleStruct->switchInAbilitiesCounter == 0)
|
||||
{
|
||||
@ -3795,14 +3759,13 @@ static void TryDoEventsBeforeFirstTurn(void)
|
||||
// Totem boosts
|
||||
for (i = 0; i < gBattlersCount; i++)
|
||||
{
|
||||
if (gTotemBoosts[i].stats != 0)
|
||||
if (gQueuedStatBoosts[i].stats != 0 && !gProtectStructs[i].eatMirrorHerb && gProtectStructs[i].activateOpportunist == 0)
|
||||
{
|
||||
gBattlerAttacker = i;
|
||||
BattleScriptExecute(BattleScript_TotemVar);
|
||||
return;
|
||||
}
|
||||
}
|
||||
memset(gTotemBoosts, 0, sizeof(gTotemBoosts)); // erase all totem boosts just to be safe
|
||||
|
||||
// Check neutralizing gas
|
||||
if (AbilityBattleEffects(ABILITYEFFECT_NEUTRALIZINGGAS, 0, 0, 0, 0) != 0)
|
||||
@ -3827,6 +3790,9 @@ static void TryDoEventsBeforeFirstTurn(void)
|
||||
return;
|
||||
}
|
||||
|
||||
if (AbilityBattleEffects(ABILITYEFFECT_OPPORTUNIST, 0, 0, 0, 0))
|
||||
return;
|
||||
|
||||
for (i = 0; i < MAX_BATTLERS_COUNT; i++)
|
||||
{
|
||||
*(gBattleStruct->monToSwitchIntoId + i) = PARTY_SIZE;
|
||||
@ -3860,6 +3826,8 @@ static void TryDoEventsBeforeFirstTurn(void)
|
||||
|
||||
gRandomTurnNumber = Random();
|
||||
|
||||
memset(gQueuedStatBoosts, 0, sizeof(gQueuedStatBoosts)); // erase all totem boosts just to be safe
|
||||
|
||||
SetAiLogicDataForTurn(AI_DATA); // get assumed abilities, hold effects, etc of all battlers
|
||||
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_ARENA)
|
||||
@ -3999,10 +3967,8 @@ u8 IsRunningFromBattleImpossible(u32 battler)
|
||||
|
||||
if (holdEffect == HOLD_EFFECT_CAN_ALWAYS_RUN)
|
||||
return BATTLE_RUN_SUCCESS;
|
||||
#if B_GHOSTS_ESCAPE >= GEN_6
|
||||
if (IS_BATTLER_OF_TYPE(battler, TYPE_GHOST))
|
||||
if (B_GHOSTS_ESCAPE >= GEN_6 && IS_BATTLER_OF_TYPE(battler, TYPE_GHOST))
|
||||
return BATTLE_RUN_SUCCESS;
|
||||
#endif
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_LINK)
|
||||
return BATTLE_RUN_SUCCESS;
|
||||
if (GetBattlerAbility(battler) == ABILITY_RUN_AWAY)
|
||||
@ -4680,11 +4646,7 @@ u32 GetBattlerTotalSpeedStatArgs(u32 battler, u32 ability, u32 holdEffect)
|
||||
|
||||
// paralysis drop
|
||||
if (gBattleMons[battler].status1 & STATUS1_PARALYSIS && ability != ABILITY_QUICK_FEET)
|
||||
#if B_PARALYSIS_SPEED >= GEN_7
|
||||
speed /= 2;
|
||||
#else
|
||||
speed /= 4;
|
||||
#endif
|
||||
speed /= B_PARALYSIS_SPEED >= GEN_7 ? 2 : 4;
|
||||
|
||||
return speed;
|
||||
}
|
||||
@ -4721,9 +4683,7 @@ s8 GetMovePriority(u32 battler, u16 move)
|
||||
return gBattleMoves[MOVE_MAX_GUARD].priority;
|
||||
|
||||
if (ability == ABILITY_GALE_WINGS
|
||||
#if B_GALE_WINGS >= GEN_7
|
||||
&& BATTLER_MAX_HP(battler)
|
||||
#endif
|
||||
&& (B_GALE_WINGS < GEN_7 || BATTLER_MAX_HP(battler))
|
||||
&& gBattleMoves[move].type == TYPE_FLYING)
|
||||
{
|
||||
priority++;
|
||||
@ -4773,7 +4733,7 @@ u32 GetWhichBattlerFasterArgs(u32 battler1, u32 battler2, bool32 ignoreChosenMov
|
||||
|
||||
// Battler 1
|
||||
// Quick Draw
|
||||
if (!ignoreChosenMoves && ability1 == ABILITY_QUICK_DRAW && !IS_MOVE_STATUS(gChosenMoveByBattler[battler1]) && Random() % 100 < 30)
|
||||
if (!ignoreChosenMoves && ability1 == ABILITY_QUICK_DRAW && !IS_MOVE_STATUS(gChosenMoveByBattler[battler1]) && RandomPercentage(RNG_QUICK_DRAW, 30))
|
||||
gProtectStructs[battler1].quickDraw = TRUE;
|
||||
// Quick Claw and Custap Berry
|
||||
if (!gProtectStructs[battler1].quickDraw
|
||||
@ -4783,7 +4743,7 @@ u32 GetWhichBattlerFasterArgs(u32 battler1, u32 battler2, bool32 ignoreChosenMov
|
||||
|
||||
// Battler 2
|
||||
// Quick Draw
|
||||
if (!ignoreChosenMoves && ability2 == ABILITY_QUICK_DRAW && !IS_MOVE_STATUS(gChosenMoveByBattler[battler2]) && Random() % 100 < 30)
|
||||
if (!ignoreChosenMoves && ability2 == ABILITY_QUICK_DRAW && !IS_MOVE_STATUS(gChosenMoveByBattler[battler2]) && RandomPercentage(RNG_QUICK_DRAW, 30))
|
||||
gProtectStructs[battler2].quickDraw = TRUE;
|
||||
// Quick Claw and Custap Berry
|
||||
if (!gProtectStructs[battler2].quickDraw
|
||||
@ -4992,6 +4952,7 @@ static void TurnValuesCleanUp(bool8 var0)
|
||||
gProtectStructs[i].kingsShielded = FALSE;
|
||||
gProtectStructs[i].banefulBunkered = FALSE;
|
||||
gProtectStructs[i].quash = FALSE;
|
||||
gProtectStructs[i].usedCustapBerry = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -5038,8 +4999,6 @@ static bool32 TryDoGimmicksBeforeMoves(void)
|
||||
&& (gBattleStruct->mega.toEvolve || gBattleStruct->burst.toBurst || gBattleStruct->dynamax.toDynamax))
|
||||
{
|
||||
u32 i, battler;
|
||||
struct Pokemon *party;
|
||||
struct Pokemon *mon;
|
||||
u8 order[MAX_BATTLERS_COUNT];
|
||||
|
||||
PopulateArrayWithBattlers(order);
|
||||
@ -5063,8 +5022,6 @@ static bool32 TryDoGimmicksBeforeMoves(void)
|
||||
gBattlerAttacker = order[i];
|
||||
gBattleStruct->mega.toEvolve &= ~(gBitTable[gBattlerAttacker]);
|
||||
gLastUsedItem = gBattleMons[gBattlerAttacker].item;
|
||||
party = GetBattlerParty(gBattlerAttacker);
|
||||
mon = &party[gBattlerPartyIndexes[gBattlerAttacker]];
|
||||
if (GetBattleFormChangeTargetSpecies(gBattlerAttacker, FORM_CHANGE_BATTLE_MEGA_EVOLUTION_MOVE) != SPECIES_NONE)
|
||||
BattleScriptExecute(BattleScript_WishMegaEvolution);
|
||||
else
|
||||
@ -5078,17 +5035,14 @@ static bool32 TryDoGimmicksBeforeMoves(void)
|
||||
battler = gBattlerAttacker = order[i];
|
||||
gBattleStruct->burst.toBurst &= ~(gBitTable[battler]);
|
||||
gLastUsedItem = gBattleMons[battler].item;
|
||||
party = GetBattlerParty(battler);
|
||||
mon = &party[gBattlerPartyIndexes[battler]];
|
||||
BattleScriptExecute(BattleScript_UltraBurst);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if B_MEGA_EVO_TURN_ORDER >= GEN_7
|
||||
if (B_MEGA_EVO_TURN_ORDER >= GEN_7)
|
||||
TryChangeTurnOrder(); // This will just do nothing if no mon has mega evolved.
|
||||
#endif
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -5097,7 +5051,6 @@ static bool32 TryDoMoveEffectsBeforeMoves(void)
|
||||
if (!(gHitMarker & HITMARKER_RUN))
|
||||
{
|
||||
u32 i;
|
||||
struct Pokemon *mon;
|
||||
u8 battlers[MAX_BATTLERS_COUNT];
|
||||
|
||||
PopulateArrayWithBattlers(battlers);
|
||||
@ -5170,7 +5123,6 @@ static void CheckQuickClaw_CustapBerryActivation(void)
|
||||
{
|
||||
if (gProtectStructs[battler].usedCustapBerry)
|
||||
{
|
||||
gProtectStructs[battler].usedCustapBerry = FALSE;
|
||||
gLastUsedItem = gBattleMons[battler].item;
|
||||
PREPARE_ITEM_BUFFER(gBattleTextBuff1, gLastUsedItem);
|
||||
if (GetBattlerHoldEffect(battler, FALSE) == HOLD_EFFECT_CUSTAP_BERRY)
|
||||
@ -5440,14 +5392,15 @@ static void HandleEndTurn_FinishBattle(void)
|
||||
TestRunner_Battle_AfterLastTurn();
|
||||
BeginFastPaletteFade(3);
|
||||
FadeOutMapMusic(5);
|
||||
#if B_TRAINERS_KNOCK_OFF_ITEMS == TRUE || B_RESTORE_HELD_BATTLE_ITEMS == TRUE
|
||||
if (B_TRAINERS_KNOCK_OFF_ITEMS == TRUE || B_RESTORE_HELD_BATTLE_ITEMS == TRUE)
|
||||
TryRestoreHeldItems();
|
||||
#endif
|
||||
|
||||
// Undo Dynamax HP multiplier before recalculating stats.
|
||||
for (i = 0; i < gBattlersCount; ++i)
|
||||
{
|
||||
if (IsDynamaxed(i))
|
||||
UndoDynamax(i);
|
||||
}
|
||||
|
||||
for (i = 0; i < PARTY_SIZE; i++)
|
||||
{
|
||||
@ -5464,11 +5417,9 @@ static void HandleEndTurn_FinishBattle(void)
|
||||
gBattleStruct->changedSpecies[B_SIDE_PLAYER][i] = SPECIES_NONE;
|
||||
gBattleStruct->changedSpecies[B_SIDE_OPPONENT][i] = SPECIES_NONE;
|
||||
|
||||
#if B_RECALCULATE_STATS >= GEN_5
|
||||
// Recalculate the stats of every party member before the end
|
||||
if (!changedForm)
|
||||
if (!changedForm && B_RECALCULATE_STATS >= GEN_5)
|
||||
CalculateMonStats(&gPlayerParty[i]);
|
||||
#endif
|
||||
}
|
||||
// Clear battle mon species to avoid a bug on the next battle that causes
|
||||
// healthboxes loading incorrectly due to it trying to create a Mega Indicator
|
||||
@ -5501,10 +5452,9 @@ static void FreeResetData_ReturnToOvOrDoEvolutions(void)
|
||||
| BATTLE_TYPE_FRONTIER
|
||||
| BATTLE_TYPE_EREADER_TRAINER
|
||||
| BATTLE_TYPE_WALLY_TUTORIAL))
|
||||
#if B_EVOLUTION_AFTER_WHITEOUT <= GEN_5
|
||||
&& (gBattleOutcome == B_OUTCOME_WON || gBattleOutcome == B_OUTCOME_CAUGHT)
|
||||
#endif
|
||||
)
|
||||
&& (B_EVOLUTION_AFTER_WHITEOUT >= GEN_6
|
||||
|| gBattleOutcome == B_OUTCOME_WON
|
||||
|| gBattleOutcome == B_OUTCOME_CAUGHT))
|
||||
{
|
||||
gBattleMainFunc = TrySpecialEvolution;
|
||||
}
|
||||
@ -5682,6 +5632,10 @@ void SetTypeBeforeUsingMove(u32 move, u32 battlerAtk)
|
||||
if (holdEffect == gBattleMoves[move].argument)
|
||||
gBattleStruct->dynamicMoveType = ItemId_GetSecondaryId(gBattleMons[battlerAtk].item) | F_DYNAMIC_TYPE_2;
|
||||
}
|
||||
else if (gBattleMoves[move].effect == EFFECT_IVY_CUDGEL && holdEffect == HOLD_EFFECT_MASK)
|
||||
{
|
||||
gBattleStruct->dynamicMoveType = ItemId_GetSecondaryId(gBattleMons[battlerAtk].item) | F_DYNAMIC_TYPE_2;
|
||||
}
|
||||
else if (gBattleMoves[move].effect == EFFECT_REVELATION_DANCE)
|
||||
{
|
||||
if (gBattleMons[battlerAtk].type1 != TYPE_MYSTERY)
|
||||
@ -5781,9 +5735,9 @@ void SetTotemBoost(void)
|
||||
{
|
||||
if (*(&gSpecialVar_0x8001 + i))
|
||||
{
|
||||
gTotemBoosts[battler].stats |= (1 << i);
|
||||
gTotemBoosts[battler].statChanges[i] = *(&gSpecialVar_0x8001 + i);
|
||||
gTotemBoosts[battler].stats |= 0x80; // used as a flag for the "totem flared to life" script
|
||||
gQueuedStatBoosts[battler].stats |= (1 << i);
|
||||
gQueuedStatBoosts[battler].statChanges[i] = *(&gSpecialVar_0x8001 + i);
|
||||
gQueuedStatBoosts[battler].stats |= 0x80; // used as a flag for the "totem flared to life" script
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -532,12 +532,12 @@ static const u8 sText_TwoInGameTrainersDefeated[];
|
||||
static const u8 sText_Trainer2LoseText[];
|
||||
|
||||
// New battle strings.
|
||||
static const s8 sText_EnduredViaSturdy[] = _("{B_DEF_NAME_WITH_PREFIX} endured\nthe hit using {B_DEF_ABILITY}!");
|
||||
static const s8 sText_PowerHerbActivation[] = _("{B_ATK_NAME_WITH_PREFIX} became fully charged\ndue to its {B_LAST_ITEM}!");
|
||||
static const s8 sText_HurtByItem[] = _("{B_ATK_NAME_WITH_PREFIX} was hurt\nby its {B_LAST_ITEM}!");
|
||||
static const s8 sText_BadlyPoisonedByItem[] = _("{B_EFF_NAME_WITH_PREFIX} was badly\npoisoned by the {B_LAST_ITEM}!");
|
||||
static const s8 sText_BurnedByItem[] = _("{B_EFF_NAME_WITH_PREFIX} was burned\nby the {B_LAST_ITEM}!");
|
||||
static const s8 sText_TargetAbilityActivates[] = _("{B_DEF_NAME_WITH_PREFIX}'s {B_DEF_ABILITY} activates!");
|
||||
static const u8 sText_EnduredViaSturdy[] = _("{B_DEF_NAME_WITH_PREFIX} endured\nthe hit using {B_DEF_ABILITY}!");
|
||||
static const u8 sText_PowerHerbActivation[] = _("{B_ATK_NAME_WITH_PREFIX} became fully charged\ndue to its {B_LAST_ITEM}!");
|
||||
static const u8 sText_HurtByItem[] = _("{B_ATK_NAME_WITH_PREFIX} was hurt\nby its {B_LAST_ITEM}!");
|
||||
static const u8 sText_BadlyPoisonedByItem[] = _("{B_EFF_NAME_WITH_PREFIX} was badly\npoisoned by the {B_LAST_ITEM}!");
|
||||
static const u8 sText_BurnedByItem[] = _("{B_EFF_NAME_WITH_PREFIX} was burned\nby the {B_LAST_ITEM}!");
|
||||
static const u8 sText_TargetAbilityActivates[] = _("{B_DEF_NAME_WITH_PREFIX}'s {B_DEF_ABILITY} activates!");
|
||||
static const u8 sText_GravityIntensified[] = _("Gravity intensified!");
|
||||
static const u8 sText_TargetIdentified[] = _("{B_DEF_NAME_WITH_PREFIX} was\nidentified!");
|
||||
static const u8 sText_TargetWokeUp[] = _("{B_DEF_NAME_WITH_PREFIX} woke up!");
|
||||
@ -820,10 +820,13 @@ static const u8 sText_TeamGainedEXP[] = _("The rest of your team gained EXP.\nPo
|
||||
static const u8 sText_CurrentMoveCantSelect[] = _("{B_BUFF1} cannot be used!\p");
|
||||
static const u8 sText_TargetIsBeingSaltCured[] = _("{B_DEF_NAME_WITH_PREFIX} is being salt cured!");
|
||||
static const u8 sText_TargetIsHurtBySaltCure[] = _("{B_DEF_NAME_WITH_PREFIX} is hurt by {B_BUFF1}!");
|
||||
static const u8 sText_OpportunistCopied[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX} copied its\nopponent's stat changes!");
|
||||
static const u8 sText_TargetCoveredInStickyCandySyrup[] = _("{B_DEF_NAME_WITH_PREFIX} got covered\nin sticky syrup!");
|
||||
|
||||
const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] =
|
||||
{
|
||||
[STRINGID_MOVEBLOCKEDBYDYNAMAX - BATTLESTRINGS_TABLE_START] = sText_MoveBlockedByDynamax,
|
||||
[STRINGID_OPPORTUNISTCOPIED - BATTLESTRINGS_TABLE_START] = sText_OpportunistCopied,
|
||||
[STRINGID_TARGETISHURTBYSALTCURE - BATTLESTRINGS_TABLE_START] = sText_TargetIsHurtBySaltCure,
|
||||
[STRINGID_TARGETISBEINGSALTCURED - BATTLESTRINGS_TABLE_START] = sText_TargetIsBeingSaltCured,
|
||||
[STRINGID_CURRENTMOVECANTSELECT - BATTLESTRINGS_TABLE_START] = sText_CurrentMoveCantSelect,
|
||||
@ -1495,6 +1498,7 @@ const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] =
|
||||
[STRINGID_ULTRABURSTREACTING - BATTLESTRINGS_TABLE_START] = sText_UltraBurstReacting,
|
||||
[STRINGID_ULTRABURSTCOMPLETED - BATTLESTRINGS_TABLE_START] = sText_UltraBurstCompleted,
|
||||
[STRINGID_TEAMGAINEDEXP - BATTLESTRINGS_TABLE_START] = sText_TeamGainedEXP,
|
||||
[STRINGID_TARGETCOVEREDINSTICKYCANDYSYRUP - BATTLESTRINGS_TABLE_START] = sText_TargetCoveredInStickyCandySyrup,
|
||||
};
|
||||
|
||||
const u16 gTrainerUsedItemStringIds[] =
|
||||
@ -1878,11 +1882,7 @@ const u16 gWeatherStartsStringIds[] =
|
||||
[WEATHER_SUNNY_CLOUDS] = STRINGID_ITISRAINING,
|
||||
[WEATHER_SUNNY] = STRINGID_ITISRAINING,
|
||||
[WEATHER_RAIN] = STRINGID_ITISRAINING,
|
||||
#if B_OVERWORLD_SNOW >= GEN_9
|
||||
[WEATHER_SNOW] = STRINGID_STARTEDSNOW,
|
||||
#else
|
||||
[WEATHER_SNOW] = STRINGID_STARTEDHAIL,
|
||||
#endif
|
||||
[WEATHER_SNOW] = (B_OVERWORLD_SNOW >= GEN_9 ? STRINGID_STARTEDSNOW : STRINGID_STARTEDHAIL),
|
||||
[WEATHER_RAIN_THUNDERSTORM] = STRINGID_ITISRAINING,
|
||||
[WEATHER_FOG_HORIZONTAL] = STRINGID_ITISRAINING,
|
||||
[WEATHER_VOLCANIC_ASH] = STRINGID_ITISRAINING,
|
||||
@ -2999,7 +2999,7 @@ void BufferStringBattle(u16 stringID, u32 battler)
|
||||
|
||||
u32 BattleStringExpandPlaceholdersToDisplayedString(const u8 *src)
|
||||
{
|
||||
BattleStringExpandPlaceholders(src, gDisplayedStringBattle);
|
||||
return BattleStringExpandPlaceholders(src, gDisplayedStringBattle);
|
||||
}
|
||||
|
||||
static const u8 *TryGetStatusString(u8 *src)
|
||||
@ -3067,7 +3067,7 @@ static void GetBattlerNick(u32 battler, u8 *dst)
|
||||
|
||||
static const u8 *BattleStringGetOpponentNameByTrainerId(u16 trainerId, u8 *text, u8 multiplayerId, u8 battler)
|
||||
{
|
||||
const u8 *toCpy;
|
||||
const u8 *toCpy = NULL;
|
||||
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_SECRET_BASE)
|
||||
{
|
||||
@ -3119,7 +3119,7 @@ static const u8 *BattleStringGetOpponentNameByTrainerId(u16 trainerId, u8 *text,
|
||||
|
||||
static const u8 *BattleStringGetOpponentName(u8 *text, u8 multiplayerId, u8 battler)
|
||||
{
|
||||
const u8 *toCpy;
|
||||
const u8 *toCpy = NULL;
|
||||
|
||||
switch (GetBattlerPosition(battler))
|
||||
{
|
||||
@ -3139,7 +3139,7 @@ static const u8 *BattleStringGetOpponentName(u8 *text, u8 multiplayerId, u8 batt
|
||||
|
||||
static const u8 *BattleStringGetPlayerName(u8 *text, u8 battler)
|
||||
{
|
||||
const u8 *toCpy;
|
||||
const u8 *toCpy = NULL;
|
||||
|
||||
switch (GetBattlerPosition(battler))
|
||||
{
|
||||
@ -3215,7 +3215,6 @@ u32 BattleStringExpandPlaceholders(const u8 *src, u8 *dst)
|
||||
// This buffer may hold either the name of a trainer, pokemon, or item.
|
||||
u8 text[max(max(max(32, TRAINER_NAME_LENGTH + 1), POKEMON_NAME_LENGTH + 1), ITEM_NAME_LENGTH)];
|
||||
u8 multiplayerId;
|
||||
s32 i;
|
||||
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_RECORDED_LINK)
|
||||
multiplayerId = gRecordedBattleMultiplayerId;
|
||||
@ -3796,7 +3795,7 @@ void ExpandBattleTextBuffPlaceholders(const u8 *src, u8 *dst)
|
||||
// unused, since the value loaded into the buffer is not read; it loaded one of
|
||||
// two particles (either "?" or "?") which works in tandem with ChooseTypeOfMoveUsedString
|
||||
// below to effect changes in the meaning of the line.
|
||||
static void ChooseMoveUsedParticle(u8 *textBuff)
|
||||
static void UNUSED ChooseMoveUsedParticle(u8 *textBuff)
|
||||
{
|
||||
s32 counter = 0;
|
||||
u32 i = 0;
|
||||
@ -3836,7 +3835,7 @@ static void ChooseMoveUsedParticle(u8 *textBuff)
|
||||
//
|
||||
// sText_ExclamationMark5 was " ????!" This resulted in a translation of
|
||||
// "<NAME>'s <ATTACK> attack!".
|
||||
static void ChooseTypeOfMoveUsedString(u8 *dst)
|
||||
static void UNUSED ChooseTypeOfMoveUsedString(u8 *dst)
|
||||
{
|
||||
s32 counter = 0;
|
||||
s32 i = 0;
|
||||
@ -4079,9 +4078,8 @@ u32 BattlerHPPercentage(u32 battler, u32 operation, u32 threshold)
|
||||
case GREATER_THAN_OR_EQUAL:
|
||||
return gBattleMons[battler].hp >= (gBattleMons[battler].maxHP / threshold);
|
||||
case NOT_EQUAL:
|
||||
return gBattleMons[battler].hp != (gBattleMons[battler].maxHP / threshold);
|
||||
default:
|
||||
break;
|
||||
return gBattleMons[battler].hp != (gBattleMons[battler].maxHP / threshold);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -861,10 +861,7 @@ static bool8 DoesTypePreventStatus(u16 species, u32 status)
|
||||
break;
|
||||
case STATUS1_PARALYSIS:
|
||||
if (gSpeciesInfo[species].types[0] == TYPE_GROUND || gSpeciesInfo[species].types[1] == TYPE_GROUND
|
||||
#if B_PARALYZE_ELECTRIC >= GEN_6
|
||||
|| gSpeciesInfo[species].types[0] == TYPE_ELECTRIC || gSpeciesInfo[species].types[1] == TYPE_ELECTRIC
|
||||
#endif
|
||||
)
|
||||
|| (B_PARALYZE_ELECTRIC >= GEN_6 && (gSpeciesInfo[species].types[0] == TYPE_ELECTRIC || gSpeciesInfo[species].types[1] == TYPE_ELECTRIC)))
|
||||
ret = TRUE;
|
||||
break;
|
||||
case STATUS1_BURN:
|
||||
@ -916,11 +913,7 @@ static bool8 TryInflictRandomStatus(void)
|
||||
if (rand < 35)
|
||||
sStatusFlags = STATUS1_TOXIC_POISON;
|
||||
else if (rand < 60)
|
||||
#if B_USE_FROSTBITE == TRUE
|
||||
sStatusFlags = STATUS1_FROSTBITE;
|
||||
#else
|
||||
sStatusFlags = STATUS1_FREEZE;
|
||||
#endif
|
||||
sStatusFlags = B_USE_FROSTBITE ? STATUS1_FROSTBITE : STATUS1_FREEZE;
|
||||
else if (rand < 80)
|
||||
sStatusFlags = STATUS1_PARALYSIS;
|
||||
else if (rand < 90)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -3004,7 +3004,7 @@ void TryHideBattleTowerReporter(void)
|
||||
static void FillPartnerParty(u16 trainerId)
|
||||
{
|
||||
s32 i, j;
|
||||
u32 ivs, level;
|
||||
u32 ivs, level, personality;
|
||||
u32 friendship;
|
||||
u16 monId;
|
||||
u32 otID;
|
||||
@ -3054,22 +3054,22 @@ static void FillPartnerParty(u16 trainerId)
|
||||
u32 otIdType = OT_ID_RANDOM_NO_SHINY;
|
||||
do
|
||||
{
|
||||
j = Random32();
|
||||
} while (IsShinyOtIdPersonality(otID, j));
|
||||
personality = Random32();
|
||||
} while (IsShinyOtIdPersonality(otID, personality));
|
||||
|
||||
if (partyData[i].gender == TRAINER_MON_MALE)
|
||||
j = (j & 0xFFFFFF00) | GeneratePersonalityForGender(MON_MALE, partyData[i].species);
|
||||
personality = (personality & 0xFFFFFF00) | GeneratePersonalityForGender(MON_MALE, partyData[i].species);
|
||||
else if (partyData[i].gender == TRAINER_MON_FEMALE)
|
||||
j = (j & 0xFFFFFF00) | GeneratePersonalityForGender(MON_FEMALE, partyData[i].species);
|
||||
personality = (personality & 0xFFFFFF00) | GeneratePersonalityForGender(MON_FEMALE, partyData[i].species);
|
||||
if (partyData[i].nature != 0)
|
||||
ModifyPersonalityForNature(&j, partyData[i].nature - 1);
|
||||
ModifyPersonalityForNature(&personality, partyData[i].nature - 1);
|
||||
if (partyData[i].isShiny)
|
||||
{
|
||||
otIdType = OT_ID_PRESET;
|
||||
otID = HIHALF(j) ^ LOHALF(j);
|
||||
otID = HIHALF(personality) ^ LOHALF(personality);
|
||||
}
|
||||
|
||||
CreateMon(&gPlayerParty[i + 3], partyData[i].species, partyData[i].lvl, 0, TRUE, j, otIdType, otID);
|
||||
CreateMon(&gPlayerParty[i + 3], partyData[i].species, partyData[i].lvl, 0, TRUE, personality, otIdType, otID);
|
||||
SetMonData(&gPlayerParty[i + 3], MON_DATA_HELD_ITEM, &partyData[i].heldItem);
|
||||
CustomTrainerPartyAssignMoves(&gPlayerParty[i+3], &partyData[i]);
|
||||
|
||||
|
||||
@ -1196,7 +1196,7 @@ static bool8 Swirl_Init(struct Task *task)
|
||||
InitTransitionData();
|
||||
ScanlineEffect_Clear();
|
||||
BeginNormalPaletteFade(PALETTES_ALL, 4, 0, 16, RGB_BLACK);
|
||||
SetSinWave(gScanlineEffectRegBuffers[1], sTransitionData->cameraX, 0, 2, 0, DISPLAY_HEIGHT);
|
||||
SetSinWave((s16*)gScanlineEffectRegBuffers[1], sTransitionData->cameraX, 0, 2, 0, DISPLAY_HEIGHT);
|
||||
|
||||
SetVBlankCallback(VBlankCB_Swirl);
|
||||
SetHBlankCallback(HBlankCB_Swirl);
|
||||
@ -1213,7 +1213,7 @@ static bool8 Swirl_End(struct Task *task)
|
||||
task->tSinIndex += 4;
|
||||
task->tAmplitude += 8;
|
||||
|
||||
SetSinWave(gScanlineEffectRegBuffers[0], sTransitionData->cameraX, task->tSinIndex, 2, task->tAmplitude, DISPLAY_HEIGHT);
|
||||
SetSinWave((s16*)gScanlineEffectRegBuffers[0], sTransitionData->cameraX, task->tSinIndex, 2, task->tAmplitude, DISPLAY_HEIGHT);
|
||||
|
||||
if (!gPaletteFade.active)
|
||||
{
|
||||
@ -1468,7 +1468,7 @@ static bool8 BigPokeball_SetGfx(struct Task *task)
|
||||
SET_TILE(tilemap, i, j, *bigPokeballMap);
|
||||
}
|
||||
|
||||
SetSinWave(gScanlineEffectRegBuffers[0], 0, task->tSinIndex, 132, task->tAmplitude, DISPLAY_HEIGHT);
|
||||
SetSinWave((s16*)gScanlineEffectRegBuffers[0], 0, task->tSinIndex, 132, task->tAmplitude, DISPLAY_HEIGHT);
|
||||
|
||||
task->tState++;
|
||||
return TRUE;
|
||||
@ -1480,7 +1480,7 @@ static bool8 Aqua_SetGfx(struct Task *task)
|
||||
|
||||
GetBg0TilesDst(&tilemap, &tileset);
|
||||
LZ77UnCompVram(sTeamAqua_Tilemap, tilemap);
|
||||
SetSinWave(gScanlineEffectRegBuffers[0], 0, task->tSinIndex, 132, task->tAmplitude, DISPLAY_HEIGHT);
|
||||
SetSinWave((s16*)gScanlineEffectRegBuffers[0], 0, task->tSinIndex, 132, task->tAmplitude, DISPLAY_HEIGHT);
|
||||
|
||||
task->tState++;
|
||||
return FALSE;
|
||||
@ -1492,7 +1492,7 @@ static bool8 Magma_SetGfx(struct Task *task)
|
||||
|
||||
GetBg0TilesDst(&tilemap, &tileset);
|
||||
LZ77UnCompVram(sTeamMagma_Tilemap, tilemap);
|
||||
SetSinWave(gScanlineEffectRegBuffers[0], 0, task->tSinIndex, 132, task->tAmplitude, DISPLAY_HEIGHT);
|
||||
SetSinWave((s16*)gScanlineEffectRegBuffers[0], 0, task->tSinIndex, 132, task->tAmplitude, DISPLAY_HEIGHT);
|
||||
|
||||
task->tState++;
|
||||
return FALSE;
|
||||
@ -1505,7 +1505,7 @@ static bool8 Regice_SetGfx(struct Task *task)
|
||||
GetBg0TilesDst(&tilemap, &tileset);
|
||||
LoadPalette(sRegice_Palette, BG_PLTT_ID(15), sizeof(sRegice_Palette));
|
||||
CpuCopy16(sRegice_Tilemap, tilemap, 0x500);
|
||||
SetSinWave(gScanlineEffectRegBuffers[0], 0, task->tSinIndex, 132, task->tAmplitude, DISPLAY_HEIGHT);
|
||||
SetSinWave((s16*)gScanlineEffectRegBuffers[0], 0, task->tSinIndex, 132, task->tAmplitude, DISPLAY_HEIGHT);
|
||||
|
||||
task->tState++;
|
||||
return FALSE;
|
||||
@ -1518,7 +1518,7 @@ static bool8 Registeel_SetGfx(struct Task *task)
|
||||
GetBg0TilesDst(&tilemap, &tileset);
|
||||
LoadPalette(sRegisteel_Palette, BG_PLTT_ID(15), sizeof(sRegisteel_Palette));
|
||||
CpuCopy16(sRegisteel_Tilemap, tilemap, 0x500);
|
||||
SetSinWave(gScanlineEffectRegBuffers[0], 0, task->tSinIndex, 132, task->tAmplitude, DISPLAY_HEIGHT);
|
||||
SetSinWave((s16*)gScanlineEffectRegBuffers[0], 0, task->tSinIndex, 132, task->tAmplitude, DISPLAY_HEIGHT);
|
||||
|
||||
task->tState++;
|
||||
return FALSE;
|
||||
@ -1531,7 +1531,7 @@ static bool8 Regirock_SetGfx(struct Task *task)
|
||||
GetBg0TilesDst(&tilemap, &tileset);
|
||||
LoadPalette(sRegirock_Palette, BG_PLTT_ID(15), sizeof(sRegirock_Palette));
|
||||
CpuCopy16(sRegirock_Tilemap, tilemap, 0x500);
|
||||
SetSinWave(gScanlineEffectRegBuffers[0], 0, task->tSinIndex, 132, task->tAmplitude, DISPLAY_HEIGHT);
|
||||
SetSinWave((s16*)gScanlineEffectRegBuffers[0], 0, task->tSinIndex, 132, task->tAmplitude, DISPLAY_HEIGHT);
|
||||
|
||||
task->tState++;
|
||||
return FALSE;
|
||||
@ -1623,7 +1623,7 @@ static bool8 PatternWeave_Blend1(struct Task *task)
|
||||
task->tSinIndex += 8;
|
||||
task->tAmplitude -= 256;
|
||||
|
||||
SetSinWave(gScanlineEffectRegBuffers[0], 0, task->tSinIndex, 132, task->tAmplitude >> 8, DISPLAY_HEIGHT);
|
||||
SetSinWave((s16*)gScanlineEffectRegBuffers[0], 0, task->tSinIndex, 132, task->tAmplitude >> 8, DISPLAY_HEIGHT);
|
||||
|
||||
sTransitionData->VBlank_DMA++;
|
||||
return FALSE;
|
||||
@ -1643,7 +1643,7 @@ static bool8 PatternWeave_Blend2(struct Task *task)
|
||||
task->tSinIndex += 8;
|
||||
task->tAmplitude -= 256;
|
||||
|
||||
SetSinWave(gScanlineEffectRegBuffers[0], 0, task->tSinIndex, 132, task->tAmplitude >> 8, DISPLAY_HEIGHT);
|
||||
SetSinWave((s16*)gScanlineEffectRegBuffers[0], 0, task->tSinIndex, 132, task->tAmplitude >> 8, DISPLAY_HEIGHT);
|
||||
|
||||
sTransitionData->VBlank_DMA++;
|
||||
return FALSE;
|
||||
@ -1655,7 +1655,7 @@ static bool8 PatternWeave_FinishAppear(struct Task *task)
|
||||
task->tSinIndex += 8;
|
||||
task->tAmplitude -= 256;
|
||||
|
||||
SetSinWave(gScanlineEffectRegBuffers[0], 0, task->tSinIndex, 132, task->tAmplitude >> 8, DISPLAY_HEIGHT);
|
||||
SetSinWave((s16*)gScanlineEffectRegBuffers[0], 0, task->tSinIndex, 132, task->tAmplitude >> 8, DISPLAY_HEIGHT);
|
||||
|
||||
if (task->tAmplitude <= 0)
|
||||
{
|
||||
@ -4253,7 +4253,7 @@ static bool8 FrontierLogoWiggle_SetGfx(struct Task *task)
|
||||
|
||||
GetBg0TilesDst(&tilemap, &tileset);
|
||||
LZ77UnCompVram(sFrontierLogo_Tilemap, tilemap);
|
||||
SetSinWave(gScanlineEffectRegBuffers[0], 0, task->tSinIndex, 132, task->tAmplitude, DISPLAY_HEIGHT);
|
||||
SetSinWave((s16*)gScanlineEffectRegBuffers[0], 0, task->tSinIndex, 132, task->tAmplitude, DISPLAY_HEIGHT);
|
||||
|
||||
task->tState++;
|
||||
return TRUE;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -52,7 +52,6 @@ static void ZMoveSelectionDisplayPpNumber(u32 battler);
|
||||
static void ZMoveSelectionDisplayPower(u16 move, u16 zMove);
|
||||
static void ShowZMoveTriggerSprite(u8 battleId);
|
||||
static bool32 AreStatsMaxed(u8 battler, u8 n);
|
||||
static u8 GetZMoveScore(u8 battlerAtk, u8 battlerDef, u16 baseMove, u16 zMove);
|
||||
static void ZMoveSelectionDisplayMoveType(u16 zMove, u32 battler);
|
||||
|
||||
// Const Data
|
||||
@ -158,15 +157,10 @@ void QueueZMove(u8 battler, u16 baseMove)
|
||||
|
||||
bool32 IsViableZMove(u8 battler, u16 move)
|
||||
{
|
||||
struct Pokemon *mon;
|
||||
u8 battlerPosition = GetBattlerPosition(battler);
|
||||
u8 partnerPosition = GetBattlerPosition(BATTLE_PARTNER(battler));
|
||||
u32 item;
|
||||
u16 holdEffect;
|
||||
u16 species;
|
||||
int moveSlotIndex;
|
||||
|
||||
species = gBattleMons[battler].species;
|
||||
item = gBattleMons[battler].item;
|
||||
|
||||
for (moveSlotIndex = 0; moveSlotIndex < MAX_MON_MOVES; moveSlotIndex++)
|
||||
@ -236,6 +230,8 @@ bool32 TryChangeZIndicator(u8 battler, u8 moveIndex)
|
||||
HideZMoveTriggerSprite(); // Was a viable z move, now is not -> slide out
|
||||
else if (!gBattleStruct->zmove.viable && viableZMove)
|
||||
ShowZMoveTriggerSprite(battler); // Was not a viable z move, now is -> slide back in
|
||||
|
||||
return viableZMove;
|
||||
}
|
||||
|
||||
#define SINGLES_Z_TRIGGER_POS_X_OPTIMAL (29)
|
||||
@ -267,7 +263,7 @@ void CreateZMoveTriggerSprite(u8 battler, bool8 viable)
|
||||
else
|
||||
{
|
||||
x = gSprites[gHealthboxSpriteIds[battler]].x - SINGLES_Z_TRIGGER_POS_X_SLIDE;
|
||||
y = gSprites[gHealthboxSpriteIds[battler]].y - SINGLES_Z_TRIGGER_POS_Y_DIFF, 0;
|
||||
y = gSprites[gHealthboxSpriteIds[battler]].y - SINGLES_Z_TRIGGER_POS_Y_DIFF;
|
||||
}
|
||||
|
||||
if (gBattleStruct->zmove.triggerSpriteId == 0xFF)
|
||||
@ -350,7 +346,6 @@ void HideZMoveTriggerSprite(void)
|
||||
|
||||
static void ShowZMoveTriggerSprite(u8 battler)
|
||||
{
|
||||
struct Sprite *sprite = &gSprites[gBattleStruct->zmove.triggerSpriteId];
|
||||
gBattleStruct->zmove.viable = TRUE;
|
||||
CreateZMoveTriggerSprite(battler, TRUE);
|
||||
}
|
||||
@ -535,13 +530,11 @@ static void ZMoveSelectionDisplayPower(u16 move, u16 zMove)
|
||||
static void ZMoveSelectionDisplayPpNumber(u32 battler)
|
||||
{
|
||||
u8 *txtPtr;
|
||||
struct ChooseMoveStruct *moveInfo;
|
||||
|
||||
if (gBattleResources->bufferA[battler][2] == TRUE) // Check if we didn't want to display pp number
|
||||
return;
|
||||
|
||||
SetPpNumbersPaletteInMoveSelection(battler);
|
||||
moveInfo = (struct ChooseMoveStruct *)(&gBattleResources->bufferA[battler][4]);
|
||||
txtPtr = ConvertIntToDecimalStringN(gDisplayedStringBattle, 1, STR_CONV_MODE_RIGHT_ALIGN, 2);
|
||||
*(txtPtr)++ = CHAR_SLASH;
|
||||
ConvertIntToDecimalStringN(txtPtr, 1, STR_CONV_MODE_RIGHT_ALIGN, 2);
|
||||
@ -551,7 +544,6 @@ static void ZMoveSelectionDisplayPpNumber(u32 battler)
|
||||
static void ZMoveSelectionDisplayMoveType(u16 zMove, u32 battler)
|
||||
{
|
||||
u8 *txtPtr;
|
||||
struct ChooseMoveStruct *moveInfo = (struct ChooseMoveStruct *)(&gBattleResources->bufferA[battler][4]);
|
||||
u8 zMoveType;
|
||||
|
||||
GET_MOVE_TYPE(zMove, zMoveType);
|
||||
|
||||
10
src/berry.c
10
src/berry.c
@ -1825,8 +1825,8 @@ bool8 PlayerHasBerries(void)
|
||||
// For all berry trees on screen, allow normal growth
|
||||
void SetBerryTreesSeen(void)
|
||||
{
|
||||
s16 cam_left;
|
||||
s16 cam_top;
|
||||
u16 cam_left;
|
||||
u16 cam_top;
|
||||
s16 left;
|
||||
s16 top;
|
||||
s16 right;
|
||||
@ -1842,9 +1842,9 @@ void SetBerryTreesSeen(void)
|
||||
{
|
||||
if (gObjectEvents[i].active && gObjectEvents[i].movementType == MOVEMENT_TYPE_BERRY_TREE_GROWTH)
|
||||
{
|
||||
cam_left = gObjectEvents[i].currentCoords.x;
|
||||
cam_top = gObjectEvents[i].currentCoords.y;
|
||||
if (left <= cam_left && cam_left <= right && top <= cam_top && cam_top <= bottom)
|
||||
s16 x = gObjectEvents[i].currentCoords.x;
|
||||
s16 y = gObjectEvents[i].currentCoords.y;
|
||||
if (left <= x && x <= right && top <= y && y <= bottom)
|
||||
AllowBerryTreeGrowth(gObjectEvents[i].trainerRange_berryTreeId);
|
||||
}
|
||||
}
|
||||
|
||||
@ -174,8 +174,8 @@ struct BerryBlender
|
||||
u16 progressBarValue;
|
||||
u16 maxProgressBarValue;
|
||||
u16 centerScale;
|
||||
u16 bg_X;
|
||||
u16 bg_Y;
|
||||
s16 bg_X;
|
||||
s16 bg_Y;
|
||||
u8 opponentTaskIds[BLENDER_MAX_PLAYERS - 1];
|
||||
u8 perfectOpponents; // for debugging, NPCs will always hit Best
|
||||
u16 scores[BLENDER_MAX_PLAYERS][NUM_SCORE_TYPES];
|
||||
|
||||
@ -5296,7 +5296,6 @@ static u16 SanitizeSpecies(u16 species)
|
||||
|
||||
static void SetMoveSpecificAnimData(u8 contestant)
|
||||
{
|
||||
s32 i;
|
||||
u16 move = SanitizeMove(eContestantStatus[contestant].currMove);
|
||||
u16 species = SanitizeSpecies(gContestMons[contestant].species);
|
||||
u8 targetContestant;
|
||||
|
||||
@ -4078,11 +4078,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_DYNAMAX] =
|
||||
|
||||
[MOVE_HIDDEN_POWER] =
|
||||
{
|
||||
#if B_HIDDEN_POWER_DMG >= GEN_6
|
||||
.power = 60,
|
||||
#else
|
||||
.power = 1,
|
||||
#endif
|
||||
.power = B_HIDDEN_POWER_DMG >= GEN_6 ? 60 : 1,
|
||||
.effect = EFFECT_HIDDEN_POWER,
|
||||
.type = TYPE_NORMAL,
|
||||
.accuracy = 100,
|
||||
@ -13829,12 +13825,12 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_DYNAMAX] =
|
||||
|
||||
[MOVE_MATCHA_GOTCHA] =
|
||||
{
|
||||
.effect = EFFECT_PLACEHOLDER, // EFFECT_MATCHA_GOTCHA
|
||||
.effect = EFFECT_MATCHA_GOTCHA,
|
||||
.power = 80,
|
||||
.type = TYPE_GRASS,
|
||||
.accuracy = 90,
|
||||
.pp = 15,
|
||||
.secondaryEffectChance = 20, //burn
|
||||
.secondaryEffectChance = 20,
|
||||
.target = MOVE_TARGET_BOTH,
|
||||
.priority = 0,
|
||||
.split = SPLIT_SPECIAL,
|
||||
@ -13845,7 +13841,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_DYNAMAX] =
|
||||
|
||||
[MOVE_SYRUP_BOMB] =
|
||||
{
|
||||
.effect = EFFECT_PLACEHOLDER, // EFFECT_SYRUP_BOMB
|
||||
.effect = EFFECT_SYRUP_BOMB,
|
||||
.power = 60,
|
||||
.type = TYPE_GRASS,
|
||||
.accuracy = 85,
|
||||
@ -13861,7 +13857,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_DYNAMAX] =
|
||||
|
||||
[MOVE_IVY_CUDGEL] =
|
||||
{
|
||||
.effect = EFFECT_PLACEHOLDER, // EFFECT_IVY_CUDGEL
|
||||
.effect = EFFECT_IVY_CUDGEL,
|
||||
.power = 100,
|
||||
.type = TYPE_GRASS,
|
||||
.accuracy = 100,
|
||||
|
||||
@ -6221,6 +6221,7 @@ const u8 gMonIcon_PikachuUnovaCap[] = INCBIN_U8("graphics/pokemon/pikachu/unova_
|
||||
const u8 gMonIcon_PikachuKalosCap[] = INCBIN_U8("graphics/pokemon/pikachu/kalos_cap/icon.4bpp");
|
||||
const u8 gMonIcon_PikachuAlolaCap[] = INCBIN_U8("graphics/pokemon/pikachu/alola_cap/icon.4bpp");
|
||||
const u8 gMonIcon_PikachuPartnerCap[] = INCBIN_U8("graphics/pokemon/pikachu/partner_cap/icon.4bpp");
|
||||
const u8 gMonIcon_PikachuWorldCap[] = INCBIN_U8("graphics/pokemon/pikachu/world_cap/icon.4bpp");
|
||||
const u8 gMonIcon_PichuSpikyEared[] = INCBIN_U8("graphics/pokemon/pichu/spiky_eared/icon.4bpp");
|
||||
const u8 gMonIcon_UnownB[] = INCBIN_U8("graphics/pokemon/unown/b/icon.4bpp");
|
||||
const u8 gMonIcon_UnownC[] = INCBIN_U8("graphics/pokemon/unown/c/icon.4bpp");
|
||||
|
||||
@ -4844,11 +4844,7 @@ const struct Item gItems[] =
|
||||
.name = _("Soul Dew"),
|
||||
.price = 0,
|
||||
.holdEffect = HOLD_EFFECT_SOUL_DEW,
|
||||
#if B_SOUL_DEW_BOOST >= GEN_7
|
||||
.holdEffectParam = 20,
|
||||
#else
|
||||
.holdEffectParam = 50,
|
||||
#endif
|
||||
.holdEffectParam = B_SOUL_DEW_BOOST >= GEN_7 ? 20 : 50,
|
||||
.description = sSoulDewDesc,
|
||||
.pocket = POCKET_ITEMS,
|
||||
.type = ITEM_USE_BAG_MENU,
|
||||
@ -9700,30 +9696,36 @@ const struct Item gItems[] =
|
||||
{
|
||||
.name = _("CornrstneMask"),
|
||||
.price = 0,
|
||||
.holdEffect = HOLD_EFFECT_MASK,
|
||||
.description = sCornerstoneMaskDesc,
|
||||
.pocket = POCKET_ITEMS,
|
||||
.type = ITEM_USE_BAG_MENU,
|
||||
.fieldUseFunc = ItemUseOutOfBattle_CannotUse,
|
||||
.secondaryId = TYPE_ROCK,
|
||||
},
|
||||
|
||||
[ITEM_WELLSPRING_MASK] =
|
||||
{
|
||||
.name = _("WellsprngMask"),
|
||||
.price = 0,
|
||||
.holdEffect = HOLD_EFFECT_MASK,
|
||||
.description = sWellspringMaskDesc,
|
||||
.pocket = POCKET_ITEMS,
|
||||
.type = ITEM_USE_BAG_MENU,
|
||||
.fieldUseFunc = ItemUseOutOfBattle_CannotUse,
|
||||
.secondaryId = TYPE_WATER,
|
||||
},
|
||||
|
||||
[ITEM_HEARTHFLAME_MASK] =
|
||||
{
|
||||
.name = _("HrthflameMask"),
|
||||
.price = 0,
|
||||
.holdEffect = HOLD_EFFECT_MASK,
|
||||
.description = sHearthflameMaskDesc,
|
||||
.pocket = POCKET_ITEMS,
|
||||
.type = ITEM_USE_BAG_MENU,
|
||||
.fieldUseFunc = ItemUseOutOfBattle_CannotUse,
|
||||
.secondaryId = TYPE_FIRE,
|
||||
},
|
||||
|
||||
[ITEM_HEALTH_MOCHI] =
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
#define LEVEL_UP_MOVE(lvl, moveLearned) {.move = moveLearned, .level = lvl}
|
||||
#define LEVEL_UP_END {.move = LEVEL_UP_MOVE_END, .level = 0}
|
||||
|
||||
static const struct LevelUpMove sBulbasaurLevelUpLearnset[] = {
|
||||
LEVEL_UP_MOVE( 1, MOVE_TACKLE),
|
||||
|
||||
@ -12452,10 +12452,10 @@ const struct SpeciesInfo gSpeciesInfo[] =
|
||||
{
|
||||
.baseHP = 120,
|
||||
.baseAttack = 70,
|
||||
.baseDefense = 120,
|
||||
.baseDefense = P_UPDATED_STATS >= GEN_9 ? 110 : 120,
|
||||
.baseSpeed = 85,
|
||||
.baseSpAttack = 75,
|
||||
.baseSpDefense = 130,
|
||||
.baseSpDefense = P_UPDATED_STATS >= GEN_9 ? 120 : 130,
|
||||
.types = { TYPE_PSYCHIC, TYPE_PSYCHIC},
|
||||
.catchRate = 3,
|
||||
.expYield = 270,
|
||||
@ -17369,9 +17369,9 @@ const struct SpeciesInfo gSpeciesInfo[] =
|
||||
.friendship = STANDARD_FRIENDSHIP,
|
||||
.growthRate = GROWTH_MEDIUM_FAST,
|
||||
#if P_UPDATED_EGG_GROUPS >= GEN_8
|
||||
.eggGroups = { EGG_GROUP_MONSTER, EGG_GROUP_MONSTER},
|
||||
#else
|
||||
.eggGroups = { EGG_GROUP_MONSTER, EGG_GROUP_MINERAL},
|
||||
#else
|
||||
.eggGroups = { EGG_GROUP_MONSTER, EGG_GROUP_MONSTER},
|
||||
#endif
|
||||
.abilities = {ABILITY_OWN_TEMPO, ABILITY_ICE_BODY, ABILITY_STURDY},
|
||||
.bodyColor = BODY_COLOR_BLUE,
|
||||
@ -17395,9 +17395,9 @@ const struct SpeciesInfo gSpeciesInfo[] =
|
||||
.friendship = STANDARD_FRIENDSHIP,
|
||||
.growthRate = GROWTH_MEDIUM_FAST,
|
||||
#if P_UPDATED_EGG_GROUPS >= GEN_8
|
||||
.eggGroups = { EGG_GROUP_MONSTER, EGG_GROUP_MONSTER},
|
||||
#else
|
||||
.eggGroups = { EGG_GROUP_MONSTER, EGG_GROUP_MINERAL},
|
||||
#else
|
||||
.eggGroups = { EGG_GROUP_MONSTER, EGG_GROUP_MONSTER},
|
||||
#endif
|
||||
.abilities = {ABILITY_OWN_TEMPO, ABILITY_ICE_BODY, ABILITY_STURDY},
|
||||
.bodyColor = BODY_COLOR_BLUE,
|
||||
@ -20778,7 +20778,7 @@ const struct SpeciesInfo gSpeciesInfo[] =
|
||||
[SPECIES_ZACIAN] =
|
||||
{
|
||||
.baseHP = 92,
|
||||
.baseAttack = 130,
|
||||
.baseAttack = P_UPDATED_STATS >= GEN_9 ? 120 : 130,
|
||||
.baseDefense = 115,
|
||||
.baseSpeed = 138,
|
||||
.baseSpAttack = 80,
|
||||
@ -20801,7 +20801,7 @@ const struct SpeciesInfo gSpeciesInfo[] =
|
||||
[SPECIES_ZAMAZENTA] =
|
||||
{
|
||||
.baseHP = 92,
|
||||
.baseAttack = 130,
|
||||
.baseAttack = P_UPDATED_STATS >= GEN_9 ? 120 : 130,
|
||||
.baseDefense = 115,
|
||||
.baseSpeed = 138,
|
||||
.baseSpAttack = 80,
|
||||
@ -21025,7 +21025,7 @@ const struct SpeciesInfo gSpeciesInfo[] =
|
||||
.friendship = STANDARD_FRIENDSHIP,
|
||||
.growthRate = GROWTH_MEDIUM_FAST,
|
||||
.eggGroups = { EGG_GROUP_BUG, EGG_GROUP_BUG},
|
||||
.abilities = {ABILITY_SWARM, ABILITY_SHEER_FORCE, ABILITY_STEADFAST},
|
||||
.abilities = {ABILITY_SWARM, ABILITY_SHEER_FORCE, ABILITY_SHARPNESS},
|
||||
.bodyColor = BODY_COLOR_BROWN,
|
||||
.noFlip = FALSE,
|
||||
},
|
||||
@ -21114,7 +21114,7 @@ const struct SpeciesInfo gSpeciesInfo[] =
|
||||
.friendship = 35,
|
||||
.growthRate = GROWTH_MEDIUM_SLOW,
|
||||
.eggGroups = { EGG_GROUP_FIELD, EGG_GROUP_FIELD},
|
||||
.abilities = {ABILITY_PRESSURE, ABILITY_NONE, ABILITY_POISON_TOUCH},
|
||||
.abilities = {ABILITY_PRESSURE, ABILITY_UNBURDEN, ABILITY_POISON_TOUCH},
|
||||
.bodyColor = BODY_COLOR_BLUE,
|
||||
.noFlip = FALSE,
|
||||
},
|
||||
@ -23371,7 +23371,7 @@ const struct SpeciesInfo gSpeciesInfo[] =
|
||||
.friendship = 35,
|
||||
.growthRate = GROWTH_MEDIUM_SLOW,
|
||||
.eggGroups = { EGG_GROUP_FIELD, EGG_GROUP_FIELD},
|
||||
.abilities = {ABILITY_INNER_FOCUS, ABILITY_KEEN_EYE, ABILITY_POISON_TOUCH},
|
||||
.abilities = {ABILITY_INNER_FOCUS, ABILITY_KEEN_EYE, ABILITY_PICKPOCKET},
|
||||
.bodyColor = BODY_COLOR_BLACK,
|
||||
.noFlip = TRUE,
|
||||
.flags = SPECIES_FLAG_HISUIAN_FORM,
|
||||
@ -24693,7 +24693,7 @@ const struct SpeciesInfo gSpeciesInfo[] =
|
||||
[SPECIES_ZACIAN_CROWNED_SWORD] =
|
||||
{
|
||||
.baseHP = 92,
|
||||
.baseAttack = 170,
|
||||
.baseAttack = P_UPDATED_STATS >= GEN_9 ? 150 : 170,
|
||||
.baseDefense = 115,
|
||||
.baseSpeed = 148,
|
||||
.baseSpAttack = 80,
|
||||
@ -24716,11 +24716,11 @@ const struct SpeciesInfo gSpeciesInfo[] =
|
||||
[SPECIES_ZAMAZENTA_CROWNED_SHIELD] =
|
||||
{
|
||||
.baseHP = 92,
|
||||
.baseAttack = 130,
|
||||
.baseDefense = 145,
|
||||
.baseAttack = P_UPDATED_STATS >= GEN_9 ? 120 : 130,
|
||||
.baseDefense = P_UPDATED_STATS >= GEN_9 ? 140 : 145,
|
||||
.baseSpeed = 128,
|
||||
.baseSpAttack = 80,
|
||||
.baseSpDefense = 145,
|
||||
.baseSpDefense = P_UPDATED_STATS >= GEN_9 ? 140 : 145,
|
||||
.types = { TYPE_FIGHTING, TYPE_STEEL},
|
||||
.catchRate = 10,
|
||||
.expYield = 360,
|
||||
|
||||
@ -952,11 +952,12 @@ void RejectEggFromDayCare(void)
|
||||
RemoveEggFromDayCare(&gSaveBlock1Ptr->daycare);
|
||||
}
|
||||
|
||||
|
||||
static const struct {
|
||||
u16 currSpecies;
|
||||
u16 item;
|
||||
u16 babySpecies;
|
||||
} IncenseBabyTable[][3] =
|
||||
} sIncenseBabyTable[] =
|
||||
{
|
||||
// Regular offspring, Item, Incense Offspring
|
||||
{ SPECIES_WOBBUFFET, ITEM_LAX_INCENSE, SPECIES_WYNAUT },
|
||||
@ -970,6 +971,7 @@ static const struct {
|
||||
{ SPECIES_MANTINE, ITEM_WAVE_INCENSE, SPECIES_MANTYKE },
|
||||
};
|
||||
|
||||
#if P_INCENSE_BREEDING < GEN_9
|
||||
static void AlterEggSpeciesWithIncenseItem(u16 *species, struct DayCare *daycare)
|
||||
{
|
||||
u32 i;
|
||||
@ -977,21 +979,22 @@ static void AlterEggSpeciesWithIncenseItem(u16 *species, struct DayCare *daycare
|
||||
motherItem = GetBoxMonData(&daycare->mons[0].mon, MON_DATA_HELD_ITEM);
|
||||
fatherItem = GetBoxMonData(&daycare->mons[1].mon, MON_DATA_HELD_ITEM);
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(IncenseBabyTable); i++)
|
||||
for (i = 0; i < ARRAY_COUNT(sIncenseBabyTable); i++)
|
||||
{
|
||||
if (IncenseBabyTable[i]->babySpecies == *species && motherItem != IncenseBabyTable[i]->item && fatherItem != IncenseBabyTable[i]->item)
|
||||
if (sIncenseBabyTable[i].babySpecies == *species && motherItem != sIncenseBabyTable[i].item && fatherItem != sIncenseBabyTable[i].item)
|
||||
{
|
||||
*species = IncenseBabyTable[i]->currSpecies;
|
||||
*species = sIncenseBabyTable[i].currSpecies;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static const struct {
|
||||
u16 offspring;
|
||||
u16 item;
|
||||
u16 move;
|
||||
} BreedingSpecialMoveItemTable[][3] =
|
||||
} sBreedingSpecialMoveItemTable[] =
|
||||
{
|
||||
// Offspring, Item, Move
|
||||
{ SPECIES_PICHU, ITEM_LIGHT_BALL, MOVE_VOLT_TACKLE },
|
||||
@ -1003,14 +1006,14 @@ static void GiveMoveIfItem(struct Pokemon *mon, struct DayCare *daycare)
|
||||
u32 motherItem = GetBoxMonData(&daycare->mons[0].mon, MON_DATA_HELD_ITEM);
|
||||
u32 fatherItem = GetBoxMonData(&daycare->mons[1].mon, MON_DATA_HELD_ITEM);
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(BreedingSpecialMoveItemTable); i++)
|
||||
for (i = 0; i < ARRAY_COUNT(sBreedingSpecialMoveItemTable); i++)
|
||||
{
|
||||
if (BreedingSpecialMoveItemTable[i]->offspring == species
|
||||
&& (motherItem == BreedingSpecialMoveItemTable[i]->item ||
|
||||
fatherItem == BreedingSpecialMoveItemTable[i]->item))
|
||||
if (sBreedingSpecialMoveItemTable[i].offspring == species
|
||||
&& (motherItem == sBreedingSpecialMoveItemTable[i].item ||
|
||||
fatherItem == sBreedingSpecialMoveItemTable[i].item))
|
||||
{
|
||||
if (GiveMoveToMon(mon, BreedingSpecialMoveItemTable[i]->move) == MON_HAS_MAX_MOVES)
|
||||
DeleteFirstMoveAndGiveMoveToMon(mon, BreedingSpecialMoveItemTable[i]->move);
|
||||
if (GiveMoveToMon(mon, sBreedingSpecialMoveItemTable[i].move) == MON_HAS_MAX_MOVES)
|
||||
DeleteFirstMoveAndGiveMoveToMon(mon, sBreedingSpecialMoveItemTable[i].move);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
25
src/debug.c
25
src/debug.c
@ -260,12 +260,10 @@ EWRAM_DATA u32 gDebugAIFlags = 0;
|
||||
// Define functions
|
||||
static void Debug_ReShowMainMenu(void);
|
||||
static void Debug_ShowMenu(void (*HandleInput)(u8), struct ListMenuTemplate LMtemplate);
|
||||
static void Debug_ShowMenuDynamic(u8 taskId);
|
||||
static void Debug_DestroyMenu(u8 taskId);
|
||||
static void Debug_DestroyMenu_Full(u8 taskId);
|
||||
static void DebugAction_Cancel(u8 taskId);
|
||||
static void DebugAction_DestroyExtraWindow(u8 taskId);
|
||||
static void DebugTask_HandleMenuInput(u8 taskId, void (*HandleInput)(u8));
|
||||
static void Debug_InitDebugBattleData(void);
|
||||
static void Debug_RefreshListMenu(u8 taskId);
|
||||
static void Debug_RedrawListMenu(u8 taskId);
|
||||
@ -282,7 +280,6 @@ static void DebugAction_Util_Script_8(u8 taskId);
|
||||
static void DebugAction_OpenUtilitiesMenu(u8 taskId);
|
||||
static void DebugAction_OpenScriptsMenu(u8 taskId);
|
||||
static void DebugAction_OpenFlagsVarsMenu(u8 taskId);
|
||||
static void DebugAction_OpenBattleMenu(u8 taskId);
|
||||
static void DebugAction_OpenGiveMenu(u8 taskId);
|
||||
static void DebugAction_OpenFillMenu(u8 taskId);
|
||||
static void DebugAction_OpenSoundMenu(u8 taskId);
|
||||
@ -970,7 +967,6 @@ static void Debug_ShowMenu(void (*HandleInput)(u8), struct ListMenuTemplate LMte
|
||||
gTasks[inputTaskId].data[2] = 0;
|
||||
|
||||
Debug_RefreshListMenu(inputTaskId);
|
||||
//Debug_ShowMenuDynamic(inputTaskId);
|
||||
|
||||
// draw everything
|
||||
CopyWindowToVram(windowId, 3);
|
||||
@ -1122,10 +1118,8 @@ static void Debug_RefreshListMenu(u8 taskId)
|
||||
u16 i;
|
||||
const u8 sColor_Red[] = _("{COLOR RED}");
|
||||
const u8 sColor_Green[] = _("{COLOR GREEN}");
|
||||
u8 listTaskId = gTasks[taskId].data[0];
|
||||
struct ListMenu *list = (void*) gTasks[listTaskId].data;
|
||||
u8 totalItems, flagResult;
|
||||
u8 const * name;
|
||||
u8 totalItems = 0, flagResult = 0;
|
||||
u8 const *name = NULL;
|
||||
|
||||
if (sDebugMenuListData->listId == 0)
|
||||
{
|
||||
@ -1179,7 +1173,7 @@ static void Debug_RefreshListMenu(u8 taskId)
|
||||
{
|
||||
flagResult = sDebugBattleData->aiFlags[i];
|
||||
if (i == totalItems - 1)
|
||||
flagResult == 0xFF;
|
||||
flagResult = 0xFF;
|
||||
name = sDebugMenu_Items_Battle_1[i].name;
|
||||
}
|
||||
|
||||
@ -1347,10 +1341,9 @@ static void DebugTask_HandleBattleMenuReDraw(u8 taskId)
|
||||
}
|
||||
static void DebugTask_HandleMenuInput_Battle(u8 taskId)
|
||||
{
|
||||
void (*func)(u8);
|
||||
u8 listTaskId = gTasks[taskId].data[0];
|
||||
u32 input = ListMenu_ProcessInput(listTaskId);
|
||||
u16 idx;
|
||||
u8 listTaskId = gTasks[taskId].data[0];
|
||||
ListMenu_ProcessInput(listTaskId);
|
||||
|
||||
ListMenuGetCurrentItemArrayId(listTaskId, &idx);
|
||||
|
||||
@ -1549,12 +1542,6 @@ static void DebugAction_OpenFlagsVarsMenu(u8 taskId)
|
||||
Debug_ShowMenu(DebugTask_HandleMenuInput_FlagsVars, gMultiuseListMenuTemplate);
|
||||
}
|
||||
|
||||
static void DebugAction_OpenBattleMenu(u8 taskId)
|
||||
{
|
||||
Debug_DestroyMenu(taskId);
|
||||
sDebugMenuListData->listId = 1;
|
||||
Debug_ShowMenu(DebugTask_HandleMenuInput_Battle, sDebugMenu_ListTemplate_Battle_0);
|
||||
}
|
||||
|
||||
static void DebugAction_OpenGiveMenu(u8 taskId)
|
||||
{
|
||||
@ -1950,7 +1937,6 @@ static void DebugAction_Util_SetWallClock(u8 taskId)
|
||||
}
|
||||
static void DebugAction_Util_WatchCredits(u8 taskId)
|
||||
{
|
||||
struct Task* task = &gTasks[taskId];
|
||||
Debug_DestroyMenu_Full(taskId);
|
||||
SetMainCallback2(CB2_StartCreditsSequence);
|
||||
}
|
||||
@ -3518,7 +3504,6 @@ static void DebugAction_Fill_PCBoxes_Fast(u8 taskId) //Credit: Sierraffinity
|
||||
static void DebugAction_Fill_PCBoxes_Slow(u8 taskId)
|
||||
{
|
||||
int boxId, boxPosition;
|
||||
u32 personality;
|
||||
struct BoxPokemon boxMon;
|
||||
u32 species = SPECIES_BULBASAUR;
|
||||
bool8 spaceAvailable = FALSE;
|
||||
|
||||
@ -360,7 +360,6 @@ static void AddHatchedMonToParty(u8 id)
|
||||
u8 isEgg = 0x46; // ?
|
||||
u16 species;
|
||||
u8 name[POKEMON_NAME_LENGTH + 1];
|
||||
u16 ball;
|
||||
u16 metLevel;
|
||||
u8 metLocation;
|
||||
struct Pokemon *mon = &gPlayerParty[id];
|
||||
|
||||
@ -8883,7 +8883,7 @@ static void CreateLevitateMovementTask(struct ObjectEvent *objectEvent)
|
||||
u8 taskId = CreateTask(ApplyLevitateMovement, 0xFF);
|
||||
struct Task *task = &gTasks[taskId];
|
||||
|
||||
StoreWordInTwoHalfwords(&task->data[0], (u32)objectEvent);
|
||||
StoreWordInTwoHalfwords((u16*) &task->data[0], (u32)objectEvent);
|
||||
objectEvent->warpArrowSpriteId = taskId;
|
||||
task->data[3] = 0xFFFF;
|
||||
}
|
||||
@ -8894,7 +8894,7 @@ static void ApplyLevitateMovement(u8 taskId)
|
||||
struct Sprite *sprite;
|
||||
struct Task *task = &gTasks[taskId];
|
||||
|
||||
LoadWordFromTwoHalfwords(&task->data[0], (u32 *)&objectEvent); // load the map object pointer.
|
||||
LoadWordFromTwoHalfwords((u16*) &task->data[0], (u32 *)&objectEvent); // load the map object pointer.
|
||||
sprite = &gSprites[objectEvent->spriteId];
|
||||
|
||||
if(!(task->data[2] & 3))
|
||||
@ -8911,7 +8911,7 @@ static void DestroyLevitateMovementTask(u8 taskId)
|
||||
struct ObjectEvent *objectEvent;
|
||||
struct Task *task = &gTasks[taskId];
|
||||
|
||||
LoadWordFromTwoHalfwords(&task->data[0], (u32 *)&objectEvent); // unused objectEvent
|
||||
LoadWordFromTwoHalfwords((u16*) &task->data[0], (u32 *)&objectEvent); // unused objectEvent
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
|
||||
|
||||
@ -68,7 +68,9 @@ static bool8 TryStartWarpEventScript(struct MapPosition *, u16);
|
||||
static bool8 TryStartMiscWalkingScripts(u16);
|
||||
static bool8 TryStartStepCountScript(u16);
|
||||
static void UpdateFriendshipStepCounter(void);
|
||||
#if OW_POISON_DAMAGE < GEN_5
|
||||
static bool8 UpdatePoisonStepCounter(void);
|
||||
#endif // OW_POISON_DAMAGE
|
||||
|
||||
void FieldClearPlayerInput(struct FieldInput *input)
|
||||
{
|
||||
@ -655,6 +657,7 @@ void ClearPoisonStepCounter(void)
|
||||
VarSet(VAR_POISON_STEP_COUNTER, 0);
|
||||
}
|
||||
|
||||
#if OW_POISON_DAMAGE < GEN_5
|
||||
static bool8 UpdatePoisonStepCounter(void)
|
||||
{
|
||||
u16 *ptr;
|
||||
@ -679,6 +682,7 @@ static bool8 UpdatePoisonStepCounter(void)
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
#endif // OW_POISON_DAMAGE
|
||||
|
||||
void RestartWildEncounterImmunitySteps(void)
|
||||
{
|
||||
|
||||
@ -412,7 +412,7 @@ static void Task_AnimateDoor(u8 taskId)
|
||||
struct DoorAnimFrame *frames = (struct DoorAnimFrame *)(tFramesHi << 16 | tFramesLo);
|
||||
struct DoorGraphics *gfx = (struct DoorGraphics *)(tGfxHi << 16 | tGfxLo);
|
||||
|
||||
if (AnimateDoorFrame(gfx, frames, data) == FALSE)
|
||||
if (AnimateDoorFrame(gfx, frames, gTasks[taskId].data) == FALSE)
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
|
||||
|
||||
@ -964,8 +964,8 @@ void FieldShowRegionMap(void)
|
||||
|
||||
static bool8 IsPlayerInFrontOfPC(void)
|
||||
{
|
||||
u16 x, y;
|
||||
u16 tileInFront;
|
||||
s16 x, y;
|
||||
u32 tileInFront;
|
||||
|
||||
GetXYCoordsOneStepInFrontOfPlayer(&x, &y);
|
||||
tileInFront = MapGridGetMetatileIdAt(x, y);
|
||||
|
||||
@ -938,7 +938,7 @@ static void InitSnowflakeSpriteMovement(struct Sprite *sprite)
|
||||
sprite->tFallCounter = 0;
|
||||
}
|
||||
|
||||
static void WaitSnowflakeSprite(struct Sprite *sprite)
|
||||
static void UNUSED WaitSnowflakeSprite(struct Sprite *sprite)
|
||||
{
|
||||
if (++gWeatherPtr->snowflakeTimer > 18)
|
||||
{
|
||||
@ -953,7 +953,6 @@ static void WaitSnowflakeSprite(struct Sprite *sprite)
|
||||
static void UpdateSnowflakeSprite(struct Sprite *sprite)
|
||||
{
|
||||
s16 x;
|
||||
s16 y;
|
||||
|
||||
sprite->tPosY += sprite->tDeltaY;
|
||||
sprite->y = sprite->tPosY >> 7;
|
||||
|
||||
@ -25,7 +25,7 @@ struct ConnectionFlags
|
||||
u8 east:1;
|
||||
};
|
||||
|
||||
EWRAM_DATA static u16 ALIGNED(4) sBackupMapData[MAX_MAP_DATA_SIZE] = {0};
|
||||
EWRAM_DATA u16 ALIGNED(4) sBackupMapData[MAX_MAP_DATA_SIZE] = {0};
|
||||
EWRAM_DATA struct MapHeader gMapHeader = {0};
|
||||
EWRAM_DATA struct Camera gCamera = {0};
|
||||
EWRAM_DATA static struct ConnectionFlags sMapConnectionFlags = {0};
|
||||
@ -48,16 +48,12 @@ static const struct MapConnection *GetIncomingConnection(u8 direction, int x, in
|
||||
static bool8 IsPosInIncomingConnectingMap(u8 direction, int x, int y, const struct MapConnection *connection);
|
||||
static bool8 IsCoordInIncomingConnectingMap(int coord, int srcMax, int destMax, int offset);
|
||||
|
||||
#define GetBorderBlockAt(x, y)({ \
|
||||
u16 block; \
|
||||
int i; \
|
||||
const u16 *border = gMapHeader.mapLayout->border; /* Unused, they read it again below */ \
|
||||
\
|
||||
i = (x + 1) & 1; \
|
||||
i += ((y + 1) & 1) * 2; \
|
||||
\
|
||||
block = gMapHeader.mapLayout->border[i] | MAPGRID_COLLISION_MASK; \
|
||||
})
|
||||
static inline u16 GetBorderBlockAt(int x, int y)
|
||||
{
|
||||
int i = (x + 1) & 1;
|
||||
i += ((y + 1) & 1) * 2;
|
||||
return gMapHeader.mapLayout->border[i] | MAPGRID_COLLISION_MASK;
|
||||
}
|
||||
|
||||
#define AreCoordsWithinMapGridBounds(x, y) (x >= 0 && x < gBackupMapLayout.width && y >= 0 && y < gBackupMapLayout.height)
|
||||
|
||||
|
||||
@ -1478,7 +1478,7 @@ static void UpdateDomeConfetti(struct ConfettiUtil *util)
|
||||
static void Task_DoDomeConfetti(u8 taskId)
|
||||
{
|
||||
u32 id = 0;
|
||||
u16 *data = gTasks[taskId].data;
|
||||
s16 *data = gTasks[taskId].data;
|
||||
|
||||
switch (tState)
|
||||
{
|
||||
|
||||
@ -1057,10 +1057,8 @@ static u32 GetBallThrowableState(void)
|
||||
return BALL_THROW_UNABLE_TWO_MONS;
|
||||
else if (IsPlayerPartyAndPokemonStorageFull() == TRUE)
|
||||
return BALL_THROW_UNABLE_NO_ROOM;
|
||||
#if B_SEMI_INVULNERABLE_CATCH >= GEN_4
|
||||
else if (gStatuses3[GetCatchingBattler()] & STATUS3_SEMI_INVULNERABLE)
|
||||
else if (B_SEMI_INVULNERABLE_CATCH >= GEN_4 && (gStatuses3[GetCatchingBattler()] & STATUS3_SEMI_INVULNERABLE))
|
||||
return BALL_THROW_UNABLE_SEMI_INVULNERABLE;
|
||||
#endif
|
||||
else if (FlagGet(B_FLAG_NO_CATCHING))
|
||||
return BALL_THROW_UNABLE_DISABLED_FLAG;
|
||||
|
||||
@ -1099,14 +1097,12 @@ void ItemUseInBattle_PokeBall(u8 taskId)
|
||||
else
|
||||
DisplayItemMessageInBattlePyramid(taskId, gText_BoxFull, Task_CloseBattlePyramidBagMessage);
|
||||
break;
|
||||
#if B_SEMI_INVULNERABLE_CATCH >= GEN_4
|
||||
case BALL_THROW_UNABLE_SEMI_INVULNERABLE:
|
||||
if (!InBattlePyramid())
|
||||
DisplayItemMessage(taskId, FONT_NORMAL, sText_CantThrowPokeBall_SemiInvulnerable, CloseItemMessage);
|
||||
else
|
||||
DisplayItemMessageInBattlePyramid(taskId, sText_CantThrowPokeBall_SemiInvulnerable, Task_CloseBattlePyramidBagMessage);
|
||||
break;
|
||||
#endif
|
||||
case BALL_THROW_UNABLE_DISABLED_FLAG:
|
||||
if (!InBattlePyramid())
|
||||
DisplayItemMessage(taskId, FONT_NORMAL, sText_CantThrowPokeBall_Disabled, CloseItemMessage);
|
||||
@ -1116,30 +1112,6 @@ void ItemUseInBattle_PokeBall(u8 taskId)
|
||||
}
|
||||
}
|
||||
|
||||
static void Task_CloseStatIncreaseMessage(u8 taskId)
|
||||
{
|
||||
if (JOY_NEW(A_BUTTON | B_BUTTON))
|
||||
{
|
||||
if (!InBattlePyramid())
|
||||
Task_FadeAndCloseBagMenu(taskId);
|
||||
else
|
||||
CloseBattlePyramidBag(taskId);
|
||||
}
|
||||
}
|
||||
|
||||
static void Task_UseStatIncreaseItem(u8 taskId)
|
||||
{
|
||||
if(++gTasks[taskId].data[8] > 7)
|
||||
{
|
||||
PlaySE(SE_USE_ITEM);
|
||||
RemoveBagItem(gSpecialVar_ItemId, 1);
|
||||
if (!InBattlePyramid())
|
||||
DisplayItemMessage(taskId, FONT_NORMAL, UseStatIncreaseItem(gSpecialVar_ItemId), Task_CloseStatIncreaseMessage);
|
||||
else
|
||||
DisplayItemMessageInBattlePyramid(taskId, UseStatIncreaseItem(gSpecialVar_ItemId), Task_CloseStatIncreaseMessage);
|
||||
}
|
||||
}
|
||||
|
||||
static void ItemUseInBattle_ShowPartyMenu(u8 taskId)
|
||||
{
|
||||
if (!InBattlePyramid())
|
||||
@ -1216,12 +1188,10 @@ static bool32 CannotUseBagBattleItem(u16 itemId)
|
||||
failStr = gText_BoxFull;
|
||||
cannotUse++;
|
||||
break;
|
||||
#if B_SEMI_INVULNERABLE_CATCH >= GEN_4
|
||||
case BALL_THROW_UNABLE_SEMI_INVULNERABLE:
|
||||
failStr = sText_CantThrowPokeBall_SemiInvulnerable;
|
||||
cannotUse++;
|
||||
break;
|
||||
#endif
|
||||
case BALL_THROW_UNABLE_DISABLED_FLAG:
|
||||
failStr = sText_CantThrowPokeBall_Disabled;
|
||||
cannotUse++;
|
||||
|
||||
@ -134,8 +134,6 @@ static const char str_checkMbootLL[] = "RFU-MBOOT";
|
||||
u16 rfu_initializeAPI(u32 *APIBuffer, u16 buffByteSize, IntrFunc *sioIntrTable_p, bool8 copyInterruptToRam)
|
||||
{
|
||||
u16 i;
|
||||
u16 *dst;
|
||||
const u16 *src;
|
||||
u16 buffByteSizeMax;
|
||||
|
||||
// is in EWRAM?
|
||||
@ -182,11 +180,13 @@ u16 rfu_initializeAPI(u32 *APIBuffer, u16 buffByteSize, IntrFunc *sioIntrTable_p
|
||||
}
|
||||
// rfu_REQ_changeMasterSlave is the function next to rfu_STC_fastCopy
|
||||
#if LIBRFU_VERSION < 1026
|
||||
src = (const u16 *)((uintptr_t)&rfu_STC_fastCopy & ~1);
|
||||
dst = gRfuFixed->fastCopyBuffer;
|
||||
{
|
||||
const u16 *src = (const u16 *)((uintptr_t)&rfu_STC_fastCopy & ~1);
|
||||
u16 *dst = gRfuFixed->fastCopyBuffer;
|
||||
buffByteSizeMax = ((void *)rfu_REQ_changeMasterSlave - (void *)rfu_STC_fastCopy) / sizeof(u16);
|
||||
while (buffByteSizeMax-- != 0)
|
||||
*dst++ = *src++;
|
||||
}
|
||||
#else
|
||||
COPY(
|
||||
(uintptr_t)&rfu_STC_fastCopy & ~1,
|
||||
@ -591,19 +591,17 @@ static void rfu_CB_pollAndEndSearchChild(u8 reqCommand, u16 reqResult)
|
||||
|
||||
static void rfu_STC_readChildList(void)
|
||||
{
|
||||
u32 stwiParam;
|
||||
u8 numSlots = gRfuFixed->STWIBuffer->rxPacketAlloc.rfuPacket8.data[1];
|
||||
u8 *data_p;
|
||||
u8 i;
|
||||
u8 bm_slot_id;
|
||||
#if LIBRFU_VERSION < 1026
|
||||
u8 true_slots[RFU_CHILD_MAX];
|
||||
#endif
|
||||
|
||||
#if LIBRFU_VERSION < 1026
|
||||
u8 true_slots[RFU_CHILD_MAX];
|
||||
|
||||
if (numSlots != 0)
|
||||
{
|
||||
stwiParam = gRfuFixed->STWIBuffer->rxPacketAlloc.rfuPacket32.data[0];
|
||||
u8 i;
|
||||
u32 stwiParam = gRfuFixed->STWIBuffer->rxPacketAlloc.rfuPacket32.data[0];
|
||||
STWI_set_Callback_M(rfu_CB_defaultCallback);
|
||||
STWI_send_LinkStatusREQ();
|
||||
if (STWI_poll_CommandEnd() == 0)
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
#include <string.h>
|
||||
#include "gba/m4a_internal.h"
|
||||
#include "global.h"
|
||||
|
||||
extern const u8 gCgb3Vol[];
|
||||
|
||||
|
||||
@ -67,7 +67,6 @@ static EWRAM_DATA u16 sTileNum = 0;
|
||||
static EWRAM_DATA u8 sPaletteNum = 0;
|
||||
static EWRAM_DATA u8 sYesNoWindowId = 0;
|
||||
static EWRAM_DATA u8 sHofPCTopBarWindowId = 0;
|
||||
static EWRAM_DATA u16 sFiller = 0; // needed to align
|
||||
static EWRAM_DATA bool8 sScheduledBgCopiesToVram[4] = {FALSE};
|
||||
static EWRAM_DATA u16 sTempTileDataBufferIdx = 0;
|
||||
static EWRAM_DATA void *sTempTileDataBuffer[0x20] = {NULL};
|
||||
|
||||
@ -131,7 +131,7 @@ static void UpdateAllLinkPlayers(u16 *, s32);
|
||||
static u8 FlipVerticalAndClearForced(u8, u8);
|
||||
static u8 LinkPlayerGetCollision(u8, u8, s16, s16);
|
||||
static void CreateLinkPlayerSprite(u8, u8);
|
||||
static void GetLinkPlayerCoords(u8, u16 *, u16 *);
|
||||
static void GetLinkPlayerCoords(u8, s16 *, s16 *);
|
||||
static u8 GetLinkPlayerFacingDirection(u8);
|
||||
static u8 GetLinkPlayerElevation(u8);
|
||||
static u8 GetLinkPlayerIdAt(s16, s16);
|
||||
@ -358,9 +358,8 @@ static void (*const sMovementStatusHandler[])(struct LinkPlayerObjectEvent *, st
|
||||
void DoWhiteOut(void)
|
||||
{
|
||||
RunScriptImmediately(EventScript_WhiteOut);
|
||||
#if B_WHITEOUT_MONEY == GEN_3
|
||||
if (B_WHITEOUT_MONEY == GEN_3)
|
||||
SetMoney(&gSaveBlock1Ptr->money, GetMoney(&gSaveBlock1Ptr->money) / 2);
|
||||
#endif
|
||||
HealPlayerParty();
|
||||
Overworld_ResetStateAfterWhiteOut();
|
||||
SetWarpDestinationToLastHealLocation();
|
||||
@ -425,9 +424,8 @@ static void Overworld_ResetStateAfterWhiteOut(void)
|
||||
FlagClear(FLAG_SYS_SAFARI_MODE);
|
||||
FlagClear(FLAG_SYS_USE_STRENGTH);
|
||||
FlagClear(FLAG_SYS_USE_FLASH);
|
||||
#if B_RESET_FLAGS_VARS_AFTER_WHITEOUT == TRUE
|
||||
if (B_RESET_FLAGS_VARS_AFTER_WHITEOUT == TRUE)
|
||||
Overworld_ResetBattleFlagsAndVars();
|
||||
#endif
|
||||
// If you were defeated by Kyogre/Groudon and the step counter has
|
||||
// maxed out, end the abnormal weather.
|
||||
if (VarGet(VAR_SHOULD_END_ABNORMAL_WEATHER) == 1)
|
||||
@ -3016,7 +3014,7 @@ static u8 GetSpriteForLinkedPlayer(u8 linkPlayerId)
|
||||
return objEvent->spriteId;
|
||||
}
|
||||
|
||||
static void GetLinkPlayerCoords(u8 linkPlayerId, u16 *x, u16 *y)
|
||||
static void GetLinkPlayerCoords(u8 linkPlayerId, s16 *x, s16 *y)
|
||||
{
|
||||
u8 objEventId = gLinkPlayerObjectEvents[linkPlayerId].objEventId;
|
||||
struct ObjectEvent *objEvent = &gObjectEvents[objEventId];
|
||||
|
||||
@ -62,7 +62,6 @@ ALIGNED(4) EWRAM_DATA u16 gPlttBufferUnfaded[PLTT_BUFFER_SIZE] = {0};
|
||||
ALIGNED(4) EWRAM_DATA u16 gPlttBufferFaded[PLTT_BUFFER_SIZE] = {0};
|
||||
static EWRAM_DATA struct PaletteStruct sPaletteStructs[NUM_PALETTE_STRUCTS] = {0};
|
||||
EWRAM_DATA struct PaletteFadeControl gPaletteFade = {0};
|
||||
static EWRAM_DATA u32 sFiller = 0;
|
||||
static EWRAM_DATA u32 sPlttBufferTransferPending = 0;
|
||||
EWRAM_DATA u8 ALIGNED(2) gPaletteDecompressionBuffer[PLTT_SIZE] = {0};
|
||||
|
||||
|
||||
7
src/party_menu.c
Executable file → Normal file
7
src/party_menu.c
Executable file → Normal file
@ -228,7 +228,6 @@ static EWRAM_DATA u16 *sSlot1TilemapBuffer = 0; // for switching party slots
|
||||
static EWRAM_DATA u16 *sSlot2TilemapBuffer = 0; //
|
||||
EWRAM_DATA u8 gSelectedOrderFromParty[MAX_FRONTIER_PARTY_SIZE] = {0};
|
||||
static EWRAM_DATA u16 sPartyMenuItemId = 0;
|
||||
static EWRAM_DATA u16 sUnused = 0;
|
||||
EWRAM_DATA u8 gBattlePartyCurrentOrder[PARTY_SIZE / 2] = {0}; // bits 0-3 are the current pos of Slot 1, 4-7 are Slot 2, and so on
|
||||
static EWRAM_DATA u8 sInitialLevel = 0;
|
||||
static EWRAM_DATA u8 sFinalLevel = 0;
|
||||
@ -5297,7 +5296,7 @@ static void Task_TryLearningNextMoveAfterText(u8 taskId)
|
||||
Task_TryLearningNextMove(taskId);
|
||||
}
|
||||
|
||||
static void DisplayExpPoints(u8 taskId, TaskFunc task, u8 holdEffectParam)
|
||||
static void UNUSED DisplayExpPoints(u8 taskId, TaskFunc task, u8 holdEffectParam)
|
||||
{
|
||||
PlaySE(SE_USE_ITEM);
|
||||
ConvertIntToDecimalStringN(gStringVar2, sExpCandyExperienceTable[holdEffectParam], STR_CONV_MODE_LEFT_ALIGN, 3);
|
||||
@ -5430,7 +5429,7 @@ static void Task_DisplayLevelUpStatsPg2(u8 taskId)
|
||||
|
||||
static void DisplayLevelUpStatsPg1(u8 taskId)
|
||||
{
|
||||
s16 *arrayPtr = sPartyMenuInternal->data;
|
||||
u16 *arrayPtr = (u16*) sPartyMenuInternal->data;
|
||||
|
||||
arrayPtr[12] = CreateLevelUpStatsWindow();
|
||||
DrawLevelUpWindowPg1(arrayPtr[12], arrayPtr, &arrayPtr[6], TEXT_COLOR_WHITE, TEXT_COLOR_DARK_GRAY, TEXT_COLOR_LIGHT_GRAY);
|
||||
@ -5440,7 +5439,7 @@ static void DisplayLevelUpStatsPg1(u8 taskId)
|
||||
|
||||
static void DisplayLevelUpStatsPg2(u8 taskId)
|
||||
{
|
||||
s16 *arrayPtr = sPartyMenuInternal->data;
|
||||
u16 *arrayPtr = (u16*) sPartyMenuInternal->data;
|
||||
|
||||
DrawLevelUpWindowPg2(arrayPtr[12], &arrayPtr[6], TEXT_COLOR_WHITE, TEXT_COLOR_DARK_GRAY, TEXT_COLOR_LIGHT_GRAY);
|
||||
CopyWindowToVram(arrayPtr[12], COPYWIN_GFX);
|
||||
|
||||
@ -388,7 +388,7 @@ void PlayerPC(void)
|
||||
|
||||
static void InitPlayerPCMenu(u8 taskId)
|
||||
{
|
||||
u16 *data;
|
||||
s16 *data;
|
||||
struct WindowTemplate windowTemplate;
|
||||
data = gTasks[taskId].data;
|
||||
|
||||
@ -408,7 +408,7 @@ static void InitPlayerPCMenu(u8 taskId)
|
||||
|
||||
static void PlayerPCProcessMenuInput(u8 taskId)
|
||||
{
|
||||
u16 *data;
|
||||
s16 *data;
|
||||
s8 inputOptionId;
|
||||
|
||||
data = gTasks[taskId].data;
|
||||
@ -503,7 +503,7 @@ static void PlayerPC_TurnOff(u8 taskId)
|
||||
|
||||
static void InitItemStorageMenu(u8 taskId, u8 var)
|
||||
{
|
||||
u16 *data;
|
||||
s16 *data;
|
||||
struct WindowTemplate windowTemplate;
|
||||
|
||||
data = gTasks[taskId].data;
|
||||
@ -621,7 +621,7 @@ static void ItemStorage_Toss(u8 taskId)
|
||||
|
||||
static void ItemStorage_Enter(u8 taskId, bool8 toss)
|
||||
{
|
||||
u16 *data = gTasks[taskId].data;
|
||||
s16 *data = gTasks[taskId].data;
|
||||
|
||||
tInTossMenu = toss;
|
||||
ItemStorage_EraseMainMenu(taskId);
|
||||
@ -654,7 +654,7 @@ static void SetPlayerPCListCount(u8 taskId)
|
||||
|
||||
static void ItemStorage_EraseMainMenu(u8 taskId)
|
||||
{
|
||||
u16 *data = gTasks[taskId].data;
|
||||
s16 *data = gTasks[taskId].data;
|
||||
ClearStdWindowAndFrameToTransparent(tWindowId, FALSE);
|
||||
ClearWindowTilemap(tWindowId);
|
||||
RemoveWindow(tWindowId);
|
||||
@ -700,7 +700,7 @@ static void Mailbox_DrawMailboxMenu(u8 taskId)
|
||||
|
||||
static void Mailbox_ProcessInput(u8 taskId)
|
||||
{
|
||||
u16 *data = gTasks[taskId].data;
|
||||
s16 *data = gTasks[taskId].data;
|
||||
|
||||
if (!gPaletteFade.active)
|
||||
{
|
||||
@ -1488,7 +1488,6 @@ static void ItemStorage_HandleRemoveItem(u8 taskId)
|
||||
|
||||
static void ItemStorage_HandleErrorMessageInput(u8 taskId)
|
||||
{
|
||||
s16 *data = gTasks[taskId].data;
|
||||
if (JOY_NEW(A_BUTTON | B_BUTTON))
|
||||
{
|
||||
ItemStorage_PrintMessage(ItemStorage_GetMessage(gSaveBlock1Ptr->pcItems[gPlayerPCItemPageInfo.itemsAbove + gPlayerPCItemPageInfo.cursorPos].itemId));
|
||||
|
||||
@ -3943,11 +3943,12 @@ static void HighlightSubmenuScreenSelectBarItem(u8 a, u16 b)
|
||||
|
||||
u8 DisplayCaughtMonDexPage(u16 dexNum, u32 otId, u32 personality)
|
||||
{
|
||||
#if POKEDEX_PLUS_HGSS == TRUE
|
||||
u8 taskId = CreateTask(Task_DisplayCaughtMonDexPageHGSS, 0);
|
||||
u8 taskId = 0;
|
||||
#if POKEDEX_PLUS_HGSS
|
||||
taskId = CreateTask(Task_DisplayCaughtMonDexPageHGSS, 0);
|
||||
#else
|
||||
u8 taskId = CreateTask(Task_DisplayCaughtMonDexPage, 0);
|
||||
#endif
|
||||
taskId = CreateTask(Task_DisplayCaughtMonDexPage, 0);
|
||||
#endif // POKEDEX_PLUS_HGSS
|
||||
|
||||
gTasks[taskId].tState = 0;
|
||||
gTasks[taskId].tDexNum = dexNum;
|
||||
@ -5103,8 +5104,8 @@ static void Task_SearchCompleteWaitForInput(u8 taskId)
|
||||
static void Task_SelectSearchMenuItem(u8 taskId)
|
||||
{
|
||||
u8 menuItem;
|
||||
u16 *cursorPos;
|
||||
u16 *scrollOffset;
|
||||
s16 *cursorPos;
|
||||
s16 *scrollOffset;
|
||||
|
||||
DrawOrEraseSearchParameterBox(FALSE);
|
||||
menuItem = gTasks[taskId].tMenuItem;
|
||||
@ -5124,8 +5125,8 @@ static void Task_HandleSearchParameterInput(u8 taskId)
|
||||
{
|
||||
u8 menuItem;
|
||||
const struct SearchOptionText *texts;
|
||||
u16 *cursorPos;
|
||||
u16 *scrollOffset;
|
||||
s16 *cursorPos;
|
||||
s16 *scrollOffset;
|
||||
u16 maxOption;
|
||||
bool8 moved;
|
||||
|
||||
@ -5442,8 +5443,8 @@ static void DrawOrEraseSearchParameterBox(bool8 erase)
|
||||
static void PrintSearchParameterText(u8 taskId)
|
||||
{
|
||||
const struct SearchOptionText *texts = sSearchOptions[gTasks[taskId].tMenuItem].texts;
|
||||
const u16 *cursorPos = &gTasks[taskId].data[sSearchOptions[gTasks[taskId].tMenuItem].taskDataCursorPos];
|
||||
const u16 *scrollOffset = &gTasks[taskId].data[sSearchOptions[gTasks[taskId].tMenuItem].taskDataScrollOffset];
|
||||
const s16 *cursorPos = &gTasks[taskId].data[sSearchOptions[gTasks[taskId].tMenuItem].taskDataCursorPos];
|
||||
const s16 *scrollOffset = &gTasks[taskId].data[sSearchOptions[gTasks[taskId].tMenuItem].taskDataScrollOffset];
|
||||
u16 i;
|
||||
u16 j;
|
||||
|
||||
@ -5457,8 +5458,8 @@ static void PrintSearchParameterText(u8 taskId)
|
||||
|
||||
static u8 GetSearchModeSelection(u8 taskId, u8 option)
|
||||
{
|
||||
const u16 *cursorPos = &gTasks[taskId].data[sSearchOptions[option].taskDataCursorPos];
|
||||
const u16 *scrollOffset = &gTasks[taskId].data[sSearchOptions[option].taskDataScrollOffset];
|
||||
const s16 *cursorPos = &gTasks[taskId].data[sSearchOptions[option].taskDataCursorPos];
|
||||
const s16 *scrollOffset = &gTasks[taskId].data[sSearchOptions[option].taskDataScrollOffset];
|
||||
u16 id = *cursorPos + *scrollOffset;
|
||||
|
||||
switch (option)
|
||||
@ -5529,7 +5530,7 @@ static void SetDefaultSearchModeAndOrder(u8 taskId)
|
||||
static bool8 SearchParamCantScrollUp(u8 taskId)
|
||||
{
|
||||
u8 menuItem = gTasks[taskId].tMenuItem;
|
||||
const u16 *scrollOffset = &gTasks[taskId].data[sSearchOptions[menuItem].taskDataScrollOffset];
|
||||
const s16 *scrollOffset = &gTasks[taskId].data[sSearchOptions[menuItem].taskDataScrollOffset];
|
||||
u16 lastOption = sSearchOptions[menuItem].numOptions - 1;
|
||||
|
||||
if (lastOption > MAX_SEARCH_PARAM_CURSOR_POS && *scrollOffset != 0)
|
||||
@ -5541,7 +5542,7 @@ static bool8 SearchParamCantScrollUp(u8 taskId)
|
||||
static bool8 SearchParamCantScrollDown(u8 taskId)
|
||||
{
|
||||
u8 menuItem = gTasks[taskId].tMenuItem;
|
||||
const u16 *scrollOffset = &gTasks[taskId].data[sSearchOptions[menuItem].taskDataScrollOffset];
|
||||
const s16 *scrollOffset = &gTasks[taskId].data[sSearchOptions[menuItem].taskDataScrollOffset];
|
||||
u16 lastOption = sSearchOptions[menuItem].numOptions - 1;
|
||||
|
||||
if (lastOption > MAX_SEARCH_PARAM_CURSOR_POS && *scrollOffset < lastOption - MAX_SEARCH_PARAM_CURSOR_POS)
|
||||
|
||||
@ -2994,7 +2994,6 @@ static void CreateInterfaceSprites(u8 page)
|
||||
{
|
||||
u8 spriteId;
|
||||
u16 digitNum;
|
||||
u8 color[3];
|
||||
bool32 drawNextDigit;
|
||||
|
||||
// Scroll arrows
|
||||
@ -3906,7 +3905,7 @@ static void LoadScreenSelectBarSubmenu(u16 unused)
|
||||
CopyBgTilemapBufferToVram(1);
|
||||
}
|
||||
|
||||
static void HighlightScreenSelectBarItem(u8 selectedScreen, u16 unused)
|
||||
static void UNUSED HighlightScreenSelectBarItem(u8 selectedScreen, u16 unused)
|
||||
{
|
||||
u8 i;
|
||||
u8 j;
|
||||
@ -3933,7 +3932,7 @@ static void HighlightScreenSelectBarItem(u8 selectedScreen, u16 unused)
|
||||
CopyBgTilemapBufferToVram(1);
|
||||
}
|
||||
|
||||
static void HighlightSubmenuScreenSelectBarItem(u8 a, u16 b)
|
||||
static void UNUSED HighlightSubmenuScreenSelectBarItem(u8 a, u16 b)
|
||||
{
|
||||
u8 i;
|
||||
u8 j;
|
||||
@ -4178,7 +4177,7 @@ static void PrintInfoScreenTextSmall(const u8* str, u8 left, u8 top)
|
||||
|
||||
AddTextPrinterParameterized4(0, 0, left, top, 0, 0, color, 0, str);
|
||||
}
|
||||
static void PrintInfoScreenTextSmallWhite(const u8* str, u8 left, u8 top)
|
||||
static void UNUSED PrintInfoScreenTextSmallWhite(const u8* str, u8 left, u8 top)
|
||||
{
|
||||
u8 color[3];
|
||||
color[0] = TEXT_COLOR_TRANSPARENT;
|
||||
@ -4256,14 +4255,11 @@ static void SetTypeIconPosAndPal(u8 typeId, u8 x, u8 y, u8 spriteArrayId)
|
||||
}
|
||||
static void PrintCurrentSpeciesTypeInfo(u8 newEntry, u16 species)
|
||||
{
|
||||
u32 i;
|
||||
u16 dexNum = SpeciesToNationalPokedexNum(species);
|
||||
u8 type1, type2;
|
||||
|
||||
if (!newEntry)
|
||||
{
|
||||
species = NationalPokedexNumToSpeciesHGSS(sPokedexListItem->dexNum);
|
||||
dexNum = SpeciesToNationalPokedexNum(species);
|
||||
}
|
||||
//type icon(s)
|
||||
#ifdef TX_RANDOMIZER_AND_CHALLENGES
|
||||
@ -4454,7 +4450,7 @@ static void PrintMonWeight(u16 weight, u8 left, u8 top)
|
||||
}
|
||||
|
||||
// Unused in the English version, used to print height/weight in versions which use metric system.
|
||||
static void PrintDecimalNum(u8 windowId, u16 num, u8 left, u8 top)
|
||||
static void UNUSED PrintDecimalNum(u8 windowId, u16 num, u8 left, u8 top)
|
||||
{
|
||||
u8 str[6];
|
||||
bool8 outputted = FALSE;
|
||||
@ -4646,7 +4642,7 @@ static u16 GetNextPosition(u8 direction, u16 position, u16 min, u16 max)
|
||||
|
||||
// Unown and Spinda use the personality of the first seen individual of that species
|
||||
// All others use personality 0
|
||||
static u32 GetPokedexMonPersonality(u16 species)
|
||||
static UNUSED u32 GetPokedexMonPersonality(u16 species)
|
||||
{
|
||||
if (species == SPECIES_UNOWN || species == SPECIES_SPINDA)
|
||||
{
|
||||
@ -4670,8 +4666,6 @@ static u32 GetPokedexMonPersonality(u16 species)
|
||||
//************************************
|
||||
u16 NationalPokedexNumToSpeciesHGSS(u16 nationalNum)
|
||||
{
|
||||
u16 species;
|
||||
|
||||
if (!nationalNum)
|
||||
return 0;
|
||||
|
||||
@ -4785,8 +4779,8 @@ static void ResetStatsWindows(void)
|
||||
static void SaveMonDataInStruct(void)
|
||||
{
|
||||
u16 species = NationalPokedexNumToSpeciesHGSS(sPokedexListItem->dexNum);
|
||||
u8 EVs[6] = {gSpeciesInfo[species].evYield_HP, gSpeciesInfo[species].evYield_Speed, gSpeciesInfo[species].evYield_Attack, gSpeciesInfo[species].evYield_SpAttack, gSpeciesInfo[species].evYield_Defense, gSpeciesInfo[species].evYield_SpDefense};
|
||||
u8 differentEVs;
|
||||
u8 evs[6] = {gSpeciesInfo[species].evYield_HP, gSpeciesInfo[species].evYield_Speed, gSpeciesInfo[species].evYield_Attack, gSpeciesInfo[species].evYield_SpAttack, gSpeciesInfo[species].evYield_Defense, gSpeciesInfo[species].evYield_SpDefense};
|
||||
u8 differentEVs = 0;
|
||||
u8 i;
|
||||
|
||||
//Count how many different EVs
|
||||
@ -4948,7 +4942,7 @@ static void Task_LoadStatsScreen(u8 taskId)
|
||||
}
|
||||
}
|
||||
|
||||
static void FreeStatsScreenWindowAndBgBuffers(void)
|
||||
static void UNUSED FreeStatsScreenWindowAndBgBuffers(void)
|
||||
{
|
||||
void *tilemapBuffer;
|
||||
|
||||
@ -5070,7 +5064,6 @@ static bool8 CalculateMoves(void)
|
||||
|
||||
u16 statsMovesEgg[EGG_MOVES_ARRAY_COUNT] = {0};
|
||||
u16 statsMovesLevelUp[MAX_LEVEL_UP_MOVES] = {0};
|
||||
u16 statsMovesTMHM[NUM_TECHNICAL_MACHINES + NUM_HIDDEN_MACHINES] = {0};
|
||||
u16 move;
|
||||
|
||||
u8 numEggMoves = 0;
|
||||
@ -5310,14 +5303,7 @@ static void PrintStatsScreen_Moves_Bottom(u8 taskId)
|
||||
static void PrintStatsScreen_NameGender(u8 taskId, u32 num, u32 value)
|
||||
{
|
||||
u8 str[16];
|
||||
u8 str2[32];
|
||||
u8 strEV[25];
|
||||
u16 species = NationalPokedexNumToSpeciesHGSS(sPokedexListItem->dexNum);
|
||||
u16 natNum;
|
||||
u8 evVal;
|
||||
const u8 *category;
|
||||
const u8 *description;
|
||||
const u8 *strEVtype;
|
||||
|
||||
u8 base_x = 38;
|
||||
u8 base_y = 0;
|
||||
@ -5403,7 +5389,6 @@ static void PrintStatsScreen_Left(u8 taskId)
|
||||
{
|
||||
u8 base_x = 8;
|
||||
u8 x_offset_column = 43;
|
||||
u8 x_offset_value = 26;
|
||||
u8 column = 0;
|
||||
u8 base_x_offset = 70;
|
||||
u8 base_x_first_row = 23;
|
||||
@ -5417,7 +5402,6 @@ static void PrintStatsScreen_Left(u8 taskId)
|
||||
u8 strBase[14];
|
||||
u8 EVs[6] = {sPokedexView->sPokemonStats.evYield_HP, sPokedexView->sPokemonStats.evYield_Speed, sPokedexView->sPokemonStats.evYield_Attack, sPokedexView->sPokemonStats.evYield_SpAttack, sPokedexView->sPokemonStats.evYield_Defense, sPokedexView->sPokemonStats.evYield_SpDefense};
|
||||
u8 differentEVs = 0;
|
||||
u8 i;
|
||||
|
||||
//Base stats
|
||||
if (gTasks[taskId].data[5] == 0)
|
||||
@ -5816,7 +5800,6 @@ static void PrintStatsScreen_Left(u8 taskId)
|
||||
|
||||
static void PrintStatsScreen_Abilities(u8 taskId)
|
||||
{
|
||||
u16 species = NationalPokedexNumToSpeciesHGSS(sPokedexListItem->dexNum);
|
||||
u8 abilities_x = 5;
|
||||
u8 abilities_y = 3;
|
||||
u16 ability0;
|
||||
@ -6096,7 +6079,6 @@ static void Task_HandleEvolutionScreenInput(u8 taskId)
|
||||
|
||||
if (sPokedexView->sEvoScreenData.numAllEvolutions != 0 && sPokedexView->sEvoScreenData.numSeen != 0)
|
||||
{
|
||||
u8 i;
|
||||
u8 base_y = 58;
|
||||
u8 base_y_offset = 9;
|
||||
u8 pos = sPokedexView->sEvoScreenData.menuPos;
|
||||
@ -6263,8 +6245,6 @@ static u8 PrintPreEvolutions(u8 taskId, u16 species)
|
||||
u8 base_x = 13+8;
|
||||
u8 base_y = 51;
|
||||
u8 base_y_offset = 9;
|
||||
u8 base_i = 0;
|
||||
u8 depth_x = 16;
|
||||
|
||||
u16 preEvolutionOne = 0;
|
||||
u16 preEvolutionTwo = 0;
|
||||
@ -6355,7 +6335,6 @@ static u8 PrintPreEvolutions(u8 taskId, u16 species)
|
||||
static u8 PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species, u8 depth, u8 depth_i)
|
||||
{
|
||||
u16 i;
|
||||
u16 j;
|
||||
const struct MapHeader *mapHeader;
|
||||
u16 targetSpecies = 0;
|
||||
u16 previousTargetSpecies = 0;
|
||||
@ -6852,13 +6831,9 @@ static void PrintForms(u8 taskId, u16 species)
|
||||
u8 j = 1;
|
||||
u16 speciesForm;
|
||||
|
||||
|
||||
bool8 left = TRUE;
|
||||
u8 base_x = 5;
|
||||
u8 base_x_offset = 54;
|
||||
u8 base_y = 52;
|
||||
u8 base_y_offset = 9;
|
||||
u8 base_i = 0;
|
||||
u8 times = 0;
|
||||
u8 y_offset_icons = 0; //For unown only
|
||||
|
||||
@ -6886,10 +6861,13 @@ static void PrintForms(u8 taskId, u16 species)
|
||||
gTasks[taskId].data[4+times] = CreateMonIcon(speciesForm, SpriteCB_MonIcon, 52 + 34*(times-1), 31, 4, 0); //Create pokemon sprite
|
||||
else if (times < 14)
|
||||
gTasks[taskId].data[4+times] = CreateMonIcon(speciesForm, SpriteCB_MonIcon, 18 + 34*(times-7), 70 - y_offset_icons, 4, 0); //Create pokemon sprite
|
||||
// Can't print any more forms, because we're going out of bounds for task data.
|
||||
/*
|
||||
else if (times < 21)
|
||||
gTasks[taskId].data[4+times] = CreateMonIcon(speciesForm, SpriteCB_MonIcon, 18 + 34*(times-14), 104 - y_offset_icons, 4, 0); //Create pokemon sprite
|
||||
else
|
||||
gTasks[taskId].data[4+times] = CreateMonIcon(speciesForm, SpriteCB_MonIcon, 18 + 34*(times-21), 138 - y_offset_icons, 4, 0); //Create pokemon sprite
|
||||
*/
|
||||
gSprites[gTasks[taskId].data[4+times]].oam.priority = 0;
|
||||
}
|
||||
}
|
||||
@ -7550,7 +7528,7 @@ static void Task_ClosePokedexFromSearchResultsStartMenu(u8 taskId)
|
||||
static int DoPokedexSearch(u8 dexMode, u8 order, u8 abcGroup, u8 bodyColor, u8 type1, u8 type2)
|
||||
{
|
||||
u16 species;
|
||||
u16 i,j;
|
||||
u16 i;
|
||||
u16 resultsCount;
|
||||
u8 types[2];
|
||||
|
||||
@ -8014,8 +7992,8 @@ static void Task_SearchCompleteWaitForInput(u8 taskId)
|
||||
static void Task_SelectSearchMenuItem(u8 taskId)
|
||||
{
|
||||
u8 menuItem;
|
||||
u16 *cursorPos;
|
||||
u16 *scrollOffset;
|
||||
s16 *cursorPos;
|
||||
s16 *scrollOffset;
|
||||
|
||||
DrawOrEraseSearchParameterBox(FALSE);
|
||||
menuItem = gTasks[taskId].tMenuItem;
|
||||
@ -8035,8 +8013,8 @@ static void Task_HandleSearchParameterInput(u8 taskId)
|
||||
{
|
||||
u8 menuItem;
|
||||
const struct SearchOptionText *texts;
|
||||
u16 *cursorPos;
|
||||
u16 *scrollOffset;
|
||||
s16 *cursorPos;
|
||||
s16 *scrollOffset;
|
||||
u16 maxOption;
|
||||
bool8 moved;
|
||||
|
||||
@ -8354,8 +8332,8 @@ static void DrawOrEraseSearchParameterBox(bool8 erase)
|
||||
static void PrintSearchParameterText(u8 taskId)
|
||||
{
|
||||
const struct SearchOptionText *texts = sSearchOptions[gTasks[taskId].tMenuItem].texts;
|
||||
const u16 *cursorPos = &gTasks[taskId].data[sSearchOptions[gTasks[taskId].tMenuItem].taskDataCursorPos];
|
||||
const u16 *scrollOffset = &gTasks[taskId].data[sSearchOptions[gTasks[taskId].tMenuItem].taskDataScrollOffset];
|
||||
const s16 *cursorPos = &gTasks[taskId].data[sSearchOptions[gTasks[taskId].tMenuItem].taskDataCursorPos];
|
||||
const s16 *scrollOffset = &gTasks[taskId].data[sSearchOptions[gTasks[taskId].tMenuItem].taskDataScrollOffset];
|
||||
u16 i;
|
||||
u16 j;
|
||||
|
||||
@ -8369,8 +8347,8 @@ static void PrintSearchParameterText(u8 taskId)
|
||||
|
||||
static u8 GetSearchModeSelection(u8 taskId, u8 option)
|
||||
{
|
||||
const u16 *cursorPos = &gTasks[taskId].data[sSearchOptions[option].taskDataCursorPos];
|
||||
const u16 *scrollOffset = &gTasks[taskId].data[sSearchOptions[option].taskDataScrollOffset];
|
||||
const s16 *cursorPos = &gTasks[taskId].data[sSearchOptions[option].taskDataCursorPos];
|
||||
const s16 *scrollOffset = &gTasks[taskId].data[sSearchOptions[option].taskDataScrollOffset];
|
||||
u16 id = *cursorPos + *scrollOffset;
|
||||
|
||||
switch (option)
|
||||
@ -8441,7 +8419,7 @@ static void SetDefaultSearchModeAndOrder(u8 taskId)
|
||||
static bool8 SearchParamCantScrollUp(u8 taskId)
|
||||
{
|
||||
u8 menuItem = gTasks[taskId].tMenuItem;
|
||||
const u16 *scrollOffset = &gTasks[taskId].data[sSearchOptions[menuItem].taskDataScrollOffset];
|
||||
const s16 *scrollOffset = &gTasks[taskId].data[sSearchOptions[menuItem].taskDataScrollOffset];
|
||||
u16 lastOption = sSearchOptions[menuItem].numOptions - 1;
|
||||
|
||||
if (lastOption > MAX_SEARCH_PARAM_CURSOR_POS && *scrollOffset != 0)
|
||||
@ -8453,7 +8431,7 @@ static bool8 SearchParamCantScrollUp(u8 taskId)
|
||||
static bool8 SearchParamCantScrollDown(u8 taskId)
|
||||
{
|
||||
u8 menuItem = gTasks[taskId].tMenuItem;
|
||||
const u16 *scrollOffset = &gTasks[taskId].data[sSearchOptions[menuItem].taskDataScrollOffset];
|
||||
const s16 *scrollOffset = &gTasks[taskId].data[sSearchOptions[menuItem].taskDataScrollOffset];
|
||||
u16 lastOption = sSearchOptions[menuItem].numOptions - 1;
|
||||
|
||||
if (lastOption > MAX_SEARCH_PARAM_CURSOR_POS && *scrollOffset < lastOption - MAX_SEARCH_PARAM_CURSOR_POS)
|
||||
|
||||
@ -4125,19 +4125,14 @@ static u16 CalculateBoxMonChecksum(struct BoxPokemon *boxMon)
|
||||
return checksum;
|
||||
}
|
||||
|
||||
#if B_FRIENDSHIP_BOOST == TRUE
|
||||
#define CALC_FRIENDSHIP_BOOST() n = n + ((n * 10 * friendship) / (MAX_FRIENDSHIP * 100));
|
||||
#else
|
||||
#define CALC_FRIENDSHIP_BOOST()
|
||||
#endif
|
||||
|
||||
#define CALC_STAT(base, iv, ev, statIndex, field) \
|
||||
{ \
|
||||
u8 baseStat = gSpeciesInfo[species].base; \
|
||||
s32 n = (((2 * baseStat + iv + ev / 4) * level) / 100) + 5; \
|
||||
u8 nature = GetNature(mon); \
|
||||
n = ModifyStatByNature(nature, n, statIndex); \
|
||||
CALC_FRIENDSHIP_BOOST() \
|
||||
if (B_FRIENDSHIP_BOOST == TRUE) \
|
||||
n = n + ((n * 10 * friendship) / (MAX_FRIENDSHIP * 100));\
|
||||
SetMonData(mon, field, &n); \
|
||||
}
|
||||
|
||||
@ -4323,7 +4318,7 @@ void GiveBoxMonInitialMoveset(struct BoxPokemon *boxMon)
|
||||
s32 level = GetLevelFromBoxMonExp(boxMon);
|
||||
s32 i;
|
||||
|
||||
for (i = 0; gLevelUpLearnsets[species][i].move != LEVEL_UP_END; i++)
|
||||
for (i = 0; gLevelUpLearnsets[species][i].move != LEVEL_UP_MOVE_END; i++)
|
||||
{
|
||||
if (gLevelUpLearnsets[species][i].level > level)
|
||||
break;
|
||||
@ -4343,12 +4338,12 @@ void GiveBoxMonInitialMoveset_Fast(struct BoxPokemon *boxMon) //Credit: Asparagu
|
||||
{
|
||||
u16 species = GetBoxMonData(boxMon, MON_DATA_SPECIES, NULL);
|
||||
s32 level = GetLevelFromBoxMonExp(boxMon);
|
||||
s32 i, j;
|
||||
s32 i;
|
||||
u16 levelMoveCount = 0;
|
||||
u16 moves[MAX_MON_MOVES] = {0};
|
||||
u8 addedMoves = 0;
|
||||
|
||||
for (i = 0; gLevelUpLearnsets[species][i].move != LEVEL_UP_END; i++)
|
||||
for (i = 0; gLevelUpLearnsets[species][i].move != LEVEL_UP_MOVE_END; i++)
|
||||
levelMoveCount++;
|
||||
|
||||
for (i = levelMoveCount; (i >= 0 && addedMoves < MAX_MON_MOVES); i--)
|
||||
@ -4385,7 +4380,7 @@ u16 MonTryLearningNewMove(struct Pokemon *mon, bool8 firstMove)
|
||||
while (gLevelUpLearnsets[species][sLearningMoveTableID].level != level)
|
||||
{
|
||||
sLearningMoveTableID++;
|
||||
if (gLevelUpLearnsets[species][sLearningMoveTableID].move == LEVEL_UP_END)
|
||||
if (gLevelUpLearnsets[species][sLearningMoveTableID].move == LEVEL_UP_MOVE_END)
|
||||
return MOVE_NONE;
|
||||
}
|
||||
}
|
||||
@ -4642,44 +4637,20 @@ static void DecryptBoxMon(struct BoxPokemon *boxMon)
|
||||
#define SUBSTRUCT_CASE(n, v1, v2, v3, v4) \
|
||||
case n: \
|
||||
{ \
|
||||
union PokemonSubstruct *substructs0 = boxMon->secure.substructs; \
|
||||
union PokemonSubstruct *substructs1 = boxMon->secure.substructs; \
|
||||
union PokemonSubstruct *substructs2 = boxMon->secure.substructs; \
|
||||
union PokemonSubstruct *substructs3 = boxMon->secure.substructs; \
|
||||
union PokemonSubstruct *substructs4 = boxMon->secure.substructs; \
|
||||
union PokemonSubstruct *substructs5 = boxMon->secure.substructs; \
|
||||
union PokemonSubstruct *substructs6 = boxMon->secure.substructs; \
|
||||
union PokemonSubstruct *substructs7 = boxMon->secure.substructs; \
|
||||
union PokemonSubstruct *substructs8 = boxMon->secure.substructs; \
|
||||
union PokemonSubstruct *substructs9 = boxMon->secure.substructs; \
|
||||
union PokemonSubstruct *substructs10 = boxMon->secure.substructs; \
|
||||
union PokemonSubstruct *substructs11 = boxMon->secure.substructs; \
|
||||
union PokemonSubstruct *substructs12 = boxMon->secure.substructs; \
|
||||
union PokemonSubstruct *substructs13 = boxMon->secure.substructs; \
|
||||
union PokemonSubstruct *substructs14 = boxMon->secure.substructs; \
|
||||
union PokemonSubstruct *substructs15 = boxMon->secure.substructs; \
|
||||
union PokemonSubstruct *substructs16 = boxMon->secure.substructs; \
|
||||
union PokemonSubstruct *substructs17 = boxMon->secure.substructs; \
|
||||
union PokemonSubstruct *substructs18 = boxMon->secure.substructs; \
|
||||
union PokemonSubstruct *substructs19 = boxMon->secure.substructs; \
|
||||
union PokemonSubstruct *substructs20 = boxMon->secure.substructs; \
|
||||
union PokemonSubstruct *substructs21 = boxMon->secure.substructs; \
|
||||
union PokemonSubstruct *substructs22 = boxMon->secure.substructs; \
|
||||
union PokemonSubstruct *substructs23 = boxMon->secure.substructs; \
|
||||
\
|
||||
switch (substructType) \
|
||||
{ \
|
||||
case 0: \
|
||||
substruct = &substructs ## n [v1]; \
|
||||
substruct = &boxMon->secure.substructs[v1]; \
|
||||
break; \
|
||||
case 1: \
|
||||
substruct = &substructs ## n [v2]; \
|
||||
substruct = &boxMon->secure.substructs[v2]; \
|
||||
break; \
|
||||
case 2: \
|
||||
substruct = &substructs ## n [v3]; \
|
||||
substruct = &boxMon->secure.substructs[v3]; \
|
||||
break; \
|
||||
case 3: \
|
||||
substruct = &substructs ## n [v4]; \
|
||||
substruct = &boxMon->secure.substructs[v4]; \
|
||||
break; \
|
||||
} \
|
||||
break; \
|
||||
@ -4783,7 +4754,10 @@ u32 GetMonData3(struct Pokemon *mon, s32 field, u8 *data)
|
||||
return ret;
|
||||
}
|
||||
|
||||
u32 GetMonData2(struct Pokemon *mon, s32 field) __attribute__((alias("GetMonData3")));
|
||||
u32 GetMonData2(struct Pokemon *mon, s32 field)
|
||||
{
|
||||
return GetMonData3(mon, field, NULL);
|
||||
}
|
||||
|
||||
/* GameFreak called GetBoxMonData with either 2 or 3 arguments, for type
|
||||
* safety we have a GetBoxMonData macro (in include/pokemon.h) which
|
||||
@ -5153,7 +5127,10 @@ u32 GetBoxMonData3(struct BoxPokemon *boxMon, s32 field, u8 *data)
|
||||
return retVal;
|
||||
}
|
||||
|
||||
u32 GetBoxMonData2(struct BoxPokemon *boxMon, s32 field) __attribute__((alias("GetBoxMonData3")));
|
||||
u32 GetBoxMonData2(struct BoxPokemon *boxMon, s32 field)
|
||||
{
|
||||
return GetBoxMonData3(boxMon, field, NULL);
|
||||
}
|
||||
|
||||
#define SET8(lhs) (lhs) = *data
|
||||
#define SET16(lhs) (lhs) = data[0] + (data[1] << 8)
|
||||
@ -5816,12 +5793,6 @@ bool8 ExecuteTableBasedItemEffect(struct Pokemon *mon, u16 item, u8 partyIndex,
|
||||
} \
|
||||
}
|
||||
|
||||
#if B_X_ITEMS_BUFF >= GEN_7
|
||||
#define X_ITEM_STAGES 2
|
||||
#else
|
||||
#define X_ITEM_STAGES 1
|
||||
#endif
|
||||
|
||||
// EXP candies store an index for this table in their holdEffectParam.
|
||||
const u32 sExpCandyExperienceTable[] = {
|
||||
[EXP_100 - 1] = 100,
|
||||
@ -6394,18 +6365,20 @@ static void BufferStatRoseMessage(s32 statIdx)
|
||||
{
|
||||
gBattlerTarget = gBattlerInMenuId;
|
||||
StringCopy(gBattleTextBuff1, gStatNamesTable[sStatsToRaise[statIdx]]);
|
||||
#if B_X_ITEMS_BUFF >= GEN_7
|
||||
if (B_X_ITEMS_BUFF >= GEN_7)
|
||||
{
|
||||
StringCopy(gBattleTextBuff2, gText_StatSharply);
|
||||
StringAppend(gBattleTextBuff2, gText_StatRose);
|
||||
#else
|
||||
}
|
||||
else
|
||||
{
|
||||
StringCopy(gBattleTextBuff2, gText_StatRose);
|
||||
#endif
|
||||
}
|
||||
BattleStringExpandPlaceholdersToDisplayedString(gText_DefendersStatRose);
|
||||
}
|
||||
|
||||
u8 *UseStatIncreaseItem(u16 itemId)
|
||||
{
|
||||
int i;
|
||||
const u8 *itemEffect;
|
||||
|
||||
if (itemId == ITEM_ENIGMA_BERRY_E_READER)
|
||||
@ -7540,7 +7513,7 @@ u8 GetMoveRelearnerMoves(struct Pokemon *mon, u16 *moves)
|
||||
{
|
||||
u16 moveLevel;
|
||||
|
||||
if (gLevelUpLearnsets[species][i].move == LEVEL_UP_END)
|
||||
if (gLevelUpLearnsets[species][i].move == LEVEL_UP_MOVE_END)
|
||||
break;
|
||||
|
||||
moveLevel = gLevelUpLearnsets[species][i].level;
|
||||
@ -7569,7 +7542,7 @@ u8 GetLevelUpMovesBySpecies(u16 species, u16 *moves)
|
||||
u8 numMoves = 0;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < MAX_LEVEL_UP_MOVES && gLevelUpLearnsets[species][i].move != LEVEL_UP_END; i++)
|
||||
for (i = 0; i < MAX_LEVEL_UP_MOVES && gLevelUpLearnsets[species][i].move != LEVEL_UP_MOVE_END; i++)
|
||||
moves[numMoves++] = gLevelUpLearnsets[species][i].move;
|
||||
|
||||
return numMoves;
|
||||
@ -7594,7 +7567,7 @@ u8 GetNumberOfRelearnableMoves(struct Pokemon *mon)
|
||||
{
|
||||
u16 moveLevel;
|
||||
|
||||
if (gLevelUpLearnsets[species][i].move == LEVEL_UP_END)
|
||||
if (gLevelUpLearnsets[species][i].move == LEVEL_UP_MOVE_END)
|
||||
break;
|
||||
|
||||
moveLevel = gLevelUpLearnsets[species][i].level;
|
||||
@ -8479,7 +8452,7 @@ u16 GetFormChangeTargetSpecies(struct Pokemon *mon, u16 method, u32 arg)
|
||||
// Returns SPECIES_NONE if no form change is possible
|
||||
u16 GetFormChangeTargetSpeciesBoxMon(struct BoxPokemon *boxMon, u16 method, u32 arg)
|
||||
{
|
||||
u32 i, j;
|
||||
u32 i;
|
||||
u16 targetSpecies = SPECIES_NONE;
|
||||
u16 species = GetBoxMonData(boxMon, MON_DATA_SPECIES, NULL);
|
||||
const struct FormChange *formChanges = gFormChangeTablePointers[species];
|
||||
@ -8550,7 +8523,7 @@ u16 GetFormChangeTargetSpeciesBoxMon(struct BoxPokemon *boxMon, u16 method, u32
|
||||
|
||||
bool32 DoesSpeciesHaveFormChangeMethod(u16 species, u16 method)
|
||||
{
|
||||
u32 i, j;
|
||||
u32 i;
|
||||
const struct FormChange *formChanges = gFormChangeTablePointers[species];
|
||||
|
||||
if (formChanges != NULL)
|
||||
@ -8578,7 +8551,7 @@ u16 MonTryLearningNewMoveEvolution(struct Pokemon *mon, bool8 firstMove)
|
||||
{
|
||||
sLearningMoveTableID = 0;
|
||||
}
|
||||
while(gLevelUpLearnsets[species][sLearningMoveTableID].move != LEVEL_UP_END)
|
||||
while(gLevelUpLearnsets[species][sLearningMoveTableID].move != LEVEL_UP_MOVE_END)
|
||||
{
|
||||
while (gLevelUpLearnsets[species][sLearningMoveTableID].level == 0 || gLevelUpLearnsets[species][sLearningMoveTableID].level == level)
|
||||
{
|
||||
|
||||
@ -378,7 +378,7 @@ static void ReloadPokemonSprites(struct PokemonDebugMenu *data);
|
||||
static void Exit_Debug_Pokemon(u8);
|
||||
|
||||
//Text handling functions
|
||||
static void PadString(const u8 *src, u8 *dst)
|
||||
static void UNUSED PadString(const u8 *src, u8 *dst)
|
||||
{
|
||||
u32 i;
|
||||
|
||||
@ -542,7 +542,6 @@ static void ValueToCharDigits(u8 *charDigits, u32 newValue, u8 maxDigits)
|
||||
|
||||
static void SetArrowInvisibility(struct PokemonDebugMenu *data)
|
||||
{
|
||||
bool8 invisible = data->currentSubmenu;
|
||||
switch (data->currentSubmenu)
|
||||
{
|
||||
case 0:
|
||||
@ -672,7 +671,6 @@ static bool32 TryMoveDigit(struct PokemonDebugModifyArrows *modArrows, bool32 mo
|
||||
|
||||
static void UpdateBattlerValue(struct PokemonDebugMenu *data)
|
||||
{
|
||||
u32 i;
|
||||
switch (data->modifyArrows.typeOfVal)
|
||||
{
|
||||
case VAL_U16:
|
||||
@ -706,13 +704,8 @@ static const struct CompressedSpritePalette *GetMonSpritePalStructCustom(u16 spe
|
||||
|
||||
static void BattleLoadOpponentMonSpriteGfxCustom(u16 species, bool8 isFemale, bool8 isShiny, u8 battlerId)
|
||||
{
|
||||
u16 paletteOffset;
|
||||
const void *lzPaletteData;
|
||||
const struct CompressedSpritePalette *palette;
|
||||
|
||||
paletteOffset = 0x100 + battlerId * 16;
|
||||
|
||||
palette = GetMonSpritePalStructCustom(species, isFemale, isShiny);
|
||||
u16 paletteOffset = 0x100 + battlerId * 16;;
|
||||
|
||||
if (isShiny)
|
||||
{
|
||||
@ -1109,9 +1102,7 @@ void CB2_Debug_Pokemon(void)
|
||||
|
||||
FillBgTilemapBufferRect(0, 0, 0, 0, 32, 20, 15);
|
||||
InitBgsFromTemplates(0, sBgTemplates, ARRAY_COUNT(sBgTemplates));
|
||||
data->battleBgType = 0;
|
||||
data->battleTerrain = 0;
|
||||
LoadBattleBg(data->battleBgType , data->battleTerrain);
|
||||
LoadBattleBg(0, BATTLE_TERRAIN_GRASS);
|
||||
|
||||
gMain.state++;
|
||||
break;
|
||||
|
||||
@ -1072,7 +1072,7 @@ const u8 *const gMonIconTable[NUM_SPECIES + 1] =
|
||||
[SPECIES_PIKACHU_KALOS_CAP] = gMonIcon_PikachuKalosCap,
|
||||
[SPECIES_PIKACHU_ALOLA_CAP] = gMonIcon_PikachuAlolaCap,
|
||||
[SPECIES_PIKACHU_PARTNER_CAP] = gMonIcon_PikachuPartnerCap,
|
||||
[SPECIES_PIKACHU_WORLD_CAP] = gMonIcon_QuestionMark,
|
||||
[SPECIES_PIKACHU_WORLD_CAP] = gMonIcon_PikachuWorldCap,
|
||||
[SPECIES_PICHU_SPIKY_EARED] = gMonIcon_PichuSpikyEared,
|
||||
[SPECIES_UNOWN_B] = gMonIcon_UnownB,
|
||||
[SPECIES_UNOWN_C] = gMonIcon_UnownC,
|
||||
|
||||
@ -3750,9 +3750,8 @@ static void PrintMoveDetails(u16 move)
|
||||
if (sMonSummaryScreen->currPageIndex == PSS_PAGE_BATTLE_MOVES)
|
||||
{
|
||||
moveEffect = gBattleMoves[move].effect;
|
||||
#if B_SHOW_SPLIT_ICON == TRUE
|
||||
if (B_SHOW_SPLIT_ICON == TRUE)
|
||||
ShowSplitIcon(GetBattleMoveSplit(move));
|
||||
#endif
|
||||
PrintMovePowerAndAccuracy(move);
|
||||
|
||||
if (moveEffect != EFFECT_PLACEHOLDER)
|
||||
|
||||
@ -460,20 +460,20 @@ static void Task_MixingRecordsRecv(u8 taskId)
|
||||
task->func = Task_SendPacket;
|
||||
if (Link_AnyPartnersPlayingRubyOrSapphire())
|
||||
{
|
||||
StorePtrInTaskData(sSentRecord, &task->tSentRecord);
|
||||
StorePtrInTaskData(sSentRecord, (u16*) &task->tSentRecord);
|
||||
subTaskId = CreateTask(Task_CopyReceiveBuffer, 80);
|
||||
task->tCopyTaskId = subTaskId;
|
||||
gTasks[subTaskId].tParentTaskId = taskId;
|
||||
StorePtrInTaskData(sReceivedRecords, &gTasks[subTaskId].tRecvRecords);
|
||||
StorePtrInTaskData(sReceivedRecords, (u16*) &gTasks[subTaskId].tRecvRecords);
|
||||
sRecordStructSize = sizeof(struct PlayerRecordRS);
|
||||
}
|
||||
else
|
||||
{
|
||||
StorePtrInTaskData(sSentRecord, &task->tSentRecord);
|
||||
StorePtrInTaskData(sSentRecord, (u16*) &task->tSentRecord);
|
||||
subTaskId = CreateTask(Task_CopyReceiveBuffer, 80);
|
||||
task->tCopyTaskId = subTaskId;
|
||||
gTasks[subTaskId].tParentTaskId = taskId;
|
||||
StorePtrInTaskData(sReceivedRecords, &gTasks[subTaskId].tRecvRecords);
|
||||
StorePtrInTaskData(sReceivedRecords,(u16*) &gTasks[subTaskId].tRecvRecords);
|
||||
sRecordStructSize = sizeof(struct PlayerRecordEmerald);
|
||||
}
|
||||
}
|
||||
@ -495,7 +495,7 @@ static void Task_SendPacket(u8 taskId)
|
||||
{
|
||||
case 0: // Copy record data chunk to send buffer
|
||||
{
|
||||
void *recordData = LoadPtrFromTaskData(&task->tSentRecord) + task->tNumChunksSent * BUFFER_CHUNK_SIZE;
|
||||
void *recordData = LoadPtrFromTaskData((u16*)&task->tSentRecord) + task->tNumChunksSent * BUFFER_CHUNK_SIZE;
|
||||
|
||||
memcpy(gBlockSendBuffer, recordData, BUFFER_CHUNK_SIZE);
|
||||
task->tState++;
|
||||
@ -537,7 +537,7 @@ static void Task_CopyReceiveBuffer(u8 taskId)
|
||||
{
|
||||
if ((status >> i) & 1)
|
||||
{
|
||||
void *dest = LoadPtrFromTaskData(&task->tRecvRecords) + task->tNumChunksRecv(i) * BUFFER_CHUNK_SIZE + sRecordStructSize * i;
|
||||
void *dest = LoadPtrFromTaskData((u16*) &task->tRecvRecords) + task->tNumChunksRecv(i) * BUFFER_CHUNK_SIZE + sRecordStructSize * i;
|
||||
void *src = GetPlayerRecvBuffer(i);
|
||||
if ((task->tNumChunksRecv(i) + 1) * BUFFER_CHUNK_SIZE > sRecordStructSize)
|
||||
memcpy(dest, src, sRecordStructSize - task->tNumChunksRecv(i) * BUFFER_CHUNK_SIZE);
|
||||
@ -765,9 +765,6 @@ static void ReceiveDaycareMailData(struct RecordMixingDaycareMail *records, size
|
||||
struct RecordMixingDaycareMail *mixMail;
|
||||
u8 playerSlot1, playerSlot2;
|
||||
void *ptr;
|
||||
u8 unusedArr1[MAX_LINK_PLAYERS];
|
||||
u8 unusedArr2[MAX_LINK_PLAYERS];
|
||||
struct RecordMixingDaycareMail *unusedMixMail[MAX_LINK_PLAYERS];
|
||||
bool8 canHoldItem[MAX_LINK_PLAYERS][DAYCARE_MON_COUNT];
|
||||
u8 idxs[MAX_LINK_PLAYERS][2];
|
||||
u8 numDaycareCanHold;
|
||||
@ -782,8 +779,6 @@ static void ReceiveDaycareMailData(struct RecordMixingDaycareMail *records, size
|
||||
linkPlayerCount = GetLinkPlayerCount();
|
||||
for (i = 0; i < MAX_LINK_PLAYERS; i++)
|
||||
{
|
||||
unusedArr1[i] = 0xFF;
|
||||
unusedArr2[i] = 0;
|
||||
canHoldItem[i][0] = FALSE;
|
||||
canHoldItem[i][1] = FALSE;
|
||||
}
|
||||
@ -924,7 +919,6 @@ static void ReceiveDaycareMailData(struct RecordMixingDaycareMail *records, size
|
||||
for (i = 0; i < MAX_LINK_PLAYERS; i++)
|
||||
{
|
||||
mixMail = &records[multiplayerId * recordSize];
|
||||
unusedMixMail[i] = mixMail;
|
||||
}
|
||||
|
||||
// Choose a random table id to determine who will
|
||||
|
||||
@ -1124,8 +1124,8 @@ static void RegionMap_InitializeStateBasedOnSSTidalLocation(void)
|
||||
{
|
||||
u16 y;
|
||||
u16 x;
|
||||
u8 mapGroup;
|
||||
u8 mapNum;
|
||||
s8 mapGroup;
|
||||
s8 mapNum;
|
||||
u16 dimensionScale;
|
||||
s16 xOnMap;
|
||||
s16 yOnMap;
|
||||
|
||||
@ -94,7 +94,6 @@ u16 gSaveUnusedVar2;
|
||||
u16 gSaveAttemptStatus;
|
||||
|
||||
EWRAM_DATA struct SaveSector gSaveDataBuffer = {0}; // Buffer used for reading/writing sectors
|
||||
EWRAM_DATA static u8 sUnusedVar = 0;
|
||||
|
||||
void ClearSaveData(void)
|
||||
{
|
||||
|
||||
@ -41,9 +41,7 @@ enum
|
||||
|
||||
static EWRAM_DATA u16 sSaveFailedType = {0};
|
||||
static EWRAM_DATA u16 sClockInfo[2] = {0};
|
||||
static EWRAM_DATA u8 sUnused1[12] = {0};
|
||||
static EWRAM_DATA u8 sWindowIds[2] = {0};
|
||||
static EWRAM_DATA u8 sUnused2[4] = {0};
|
||||
|
||||
static const struct OamData sClockOamData =
|
||||
{
|
||||
|
||||
40
src/scrcmd.c
40
src/scrcmd.c
@ -783,8 +783,8 @@ bool8 ScrCmd_warphole(struct ScriptContext *ctx)
|
||||
{
|
||||
u8 mapGroup = ScriptReadByte(ctx);
|
||||
u8 mapNum = ScriptReadByte(ctx);
|
||||
u16 x;
|
||||
u16 y;
|
||||
s16 x;
|
||||
s16 y;
|
||||
|
||||
PlayerGetDestCoords(&x, &y);
|
||||
if (mapGroup == MAP_GROUP(UNDEFINED) && mapNum == MAP_NUM(UNDEFINED))
|
||||
@ -1420,10 +1420,10 @@ bool8 ScrCmd_multichoicegrid(struct ScriptContext *ctx)
|
||||
|
||||
bool8 ScrCmd_erasebox(struct ScriptContext *ctx)
|
||||
{
|
||||
u8 left = ScriptReadByte(ctx);
|
||||
u8 top = ScriptReadByte(ctx);
|
||||
u8 right = ScriptReadByte(ctx);
|
||||
u8 bottom = ScriptReadByte(ctx);
|
||||
u8 UNUSED left = ScriptReadByte(ctx);
|
||||
u8 UNUSED top = ScriptReadByte(ctx);
|
||||
u8 UNUSED right = ScriptReadByte(ctx);
|
||||
u8 UNUSED bottom = ScriptReadByte(ctx);
|
||||
|
||||
// Menu_EraseWindowRect(left, top, right, bottom);
|
||||
return FALSE;
|
||||
@ -1431,10 +1431,10 @@ bool8 ScrCmd_erasebox(struct ScriptContext *ctx)
|
||||
|
||||
bool8 ScrCmd_drawboxtext(struct ScriptContext *ctx)
|
||||
{
|
||||
u8 left = ScriptReadByte(ctx);
|
||||
u8 top = ScriptReadByte(ctx);
|
||||
u8 multichoiceId = ScriptReadByte(ctx);
|
||||
bool8 ignoreBPress = ScriptReadByte(ctx);
|
||||
u8 UNUSED left = ScriptReadByte(ctx);
|
||||
u8 UNUSED top = ScriptReadByte(ctx);
|
||||
u8 UNUSED multichoiceId = ScriptReadByte(ctx);
|
||||
bool8 UNUSED ignoreBPress = ScriptReadByte(ctx);
|
||||
|
||||
/*if (Multichoice(left, top, multichoiceId, ignoreBPress) == TRUE)
|
||||
{
|
||||
@ -1783,8 +1783,8 @@ bool8 ScrCmd_hidemoneybox(struct ScriptContext *ctx)
|
||||
|
||||
bool8 ScrCmd_updatemoneybox(struct ScriptContext *ctx)
|
||||
{
|
||||
u8 x = ScriptReadByte(ctx);
|
||||
u8 y = ScriptReadByte(ctx);
|
||||
u8 UNUSED x = ScriptReadByte(ctx);
|
||||
u8 UNUSED y = ScriptReadByte(ctx);
|
||||
u8 ignore = ScriptReadByte(ctx);
|
||||
|
||||
if (!ignore)
|
||||
@ -1803,8 +1803,8 @@ bool8 ScrCmd_showcoinsbox(struct ScriptContext *ctx)
|
||||
|
||||
bool8 ScrCmd_hidecoinsbox(struct ScriptContext *ctx)
|
||||
{
|
||||
u8 x = ScriptReadByte(ctx);
|
||||
u8 y = ScriptReadByte(ctx);
|
||||
u8 UNUSED x = ScriptReadByte(ctx);
|
||||
u8 UNUSED y = ScriptReadByte(ctx);
|
||||
|
||||
HideCoinsWindow();
|
||||
return FALSE;
|
||||
@ -1812,8 +1812,8 @@ bool8 ScrCmd_hidecoinsbox(struct ScriptContext *ctx)
|
||||
|
||||
bool8 ScrCmd_updatecoinsbox(struct ScriptContext *ctx)
|
||||
{
|
||||
u8 x = ScriptReadByte(ctx);
|
||||
u8 y = ScriptReadByte(ctx);
|
||||
u8 UNUSED x = ScriptReadByte(ctx);
|
||||
u8 UNUSED y = ScriptReadByte(ctx);
|
||||
|
||||
PrintCoinsString(GetCoins());
|
||||
return FALSE;
|
||||
@ -2128,10 +2128,10 @@ bool8 ScrCmd_setdoorclosed(struct ScriptContext *ctx)
|
||||
// Below two are functions for elevators in RS, do nothing in Emerald
|
||||
bool8 ScrCmd_addelevmenuitem(struct ScriptContext *ctx)
|
||||
{
|
||||
u8 v3 = ScriptReadByte(ctx);
|
||||
u16 v5 = VarGet(ScriptReadHalfword(ctx));
|
||||
u16 v7 = VarGet(ScriptReadHalfword(ctx));
|
||||
u16 v9 = VarGet(ScriptReadHalfword(ctx));
|
||||
u8 UNUSED v3 = ScriptReadByte(ctx);
|
||||
u16 UNUSED v5 = VarGet(ScriptReadHalfword(ctx));
|
||||
u16 UNUSED v7 = VarGet(ScriptReadHalfword(ctx));
|
||||
u16 UNUSED v9 = VarGet(ScriptReadHalfword(ctx));
|
||||
|
||||
//ScriptAddElevatorMenuItem(v3, v5, v7, v9);
|
||||
return FALSE;
|
||||
|
||||
@ -273,8 +273,6 @@ static void Task_HandleMultichoiceInput(u8 taskId)
|
||||
|
||||
bool8 ScriptMenu_YesNo(u8 left, u8 top)
|
||||
{
|
||||
u8 taskId;
|
||||
|
||||
if (FuncIsActiveTask(Task_HandleYesNoInput) == TRUE)
|
||||
{
|
||||
return FALSE;
|
||||
@ -283,7 +281,7 @@ bool8 ScriptMenu_YesNo(u8 left, u8 top)
|
||||
{
|
||||
gSpecialVar_Result = 0xFF;
|
||||
DisplayYesNoMenuDefaultYes();
|
||||
taskId = CreateTask(Task_HandleYesNoInput, 0x50);
|
||||
CreateTask(Task_HandleYesNoInput, 0x50);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
@ -519,7 +519,7 @@ bool8 CurMapIsSecretBase(void)
|
||||
void InitSecretBaseAppearance(bool8 hidePC)
|
||||
{
|
||||
u16 secretBaseIdx;
|
||||
u16 x, y;
|
||||
s16 x, y;
|
||||
u8 *decorations;
|
||||
u8 *decorPos;
|
||||
|
||||
@ -915,7 +915,7 @@ void ShowSecretBaseRegistryMenu(void)
|
||||
|
||||
static void Task_ShowSecretBaseRegistryMenu(u8 taskId)
|
||||
{
|
||||
s16 *data = gTasks[taskId].data;
|
||||
u16 *data = (u16*) gTasks[taskId].data;
|
||||
LockPlayerFieldControls();
|
||||
tNumBases = GetNumRegisteredSecretBases();
|
||||
if (tNumBases != 0)
|
||||
@ -977,7 +977,7 @@ static void RegistryMenu_OnCursorMove(s32 unused, bool8 flag, struct ListMenu *m
|
||||
|
||||
static void FinalizeRegistryMenu(u8 taskId)
|
||||
{
|
||||
s16 *data = gTasks[taskId].data;
|
||||
u16 *data = (u16*) gTasks[taskId].data;
|
||||
SetStandardWindowBorderStyle(tMainWindowId, FALSE);
|
||||
tListTaskId = ListMenuInit(&gMultiuseListMenuTemplate, tScrollOffset, tSelectedRow);
|
||||
AddRegistryMenuScrollArrows(taskId);
|
||||
@ -986,13 +986,13 @@ static void FinalizeRegistryMenu(u8 taskId)
|
||||
|
||||
static void AddRegistryMenuScrollArrows(u8 taskId)
|
||||
{
|
||||
s16 *data = gTasks[taskId].data;
|
||||
u16 *data = (u16*) gTasks[taskId].data;
|
||||
tArrowTaskId = AddScrollIndicatorArrowPairParameterized(SCROLL_ARROW_UP, 188, 12, 148, tNumBases - tMaxShownItems, TAG_SCROLL_ARROW, TAG_SCROLL_ARROW, &tScrollOffset);
|
||||
}
|
||||
|
||||
static void HandleRegistryMenuInput(u8 taskId)
|
||||
{
|
||||
s16 *data = gTasks[taskId].data;
|
||||
u16 *data = (u16*) gTasks[taskId].data;
|
||||
s32 input = ListMenu_ProcessInput(tListTaskId);
|
||||
ListMenuGetScrollAndRow(tListTaskId, &tScrollOffset, &tSelectedRow);
|
||||
|
||||
@ -1022,7 +1022,7 @@ static void HandleRegistryMenuInput(u8 taskId)
|
||||
static void ShowRegistryMenuActions(u8 taskId)
|
||||
{
|
||||
struct WindowTemplate template;
|
||||
s16 *data = gTasks[taskId].data;
|
||||
u16 *data = (u16*) gTasks[taskId].data;
|
||||
RemoveScrollIndicatorArrowPair(tArrowTaskId);
|
||||
template = sRegistryWindowTemplates[1];
|
||||
template.width = GetMaxWidthInMenuTable(sRegistryMenuActions, 2);
|
||||
@ -1054,7 +1054,7 @@ static void HandleRegistryMenuActionsInput(u8 taskId)
|
||||
|
||||
static void ShowRegistryMenuDeleteConfirmation(u8 taskId)
|
||||
{
|
||||
s16 *data = gTasks[taskId].data;
|
||||
u16 *data = (u16*) gTasks[taskId].data;
|
||||
ClearStdWindowAndFrame(tMainWindowId, FALSE);
|
||||
ClearStdWindowAndFrame(tActionWindowId, FALSE);
|
||||
ClearWindowTilemap(tMainWindowId);
|
||||
@ -1074,7 +1074,7 @@ static void ShowRegistryMenuDeleteYesNo(u8 taskId)
|
||||
|
||||
void DeleteRegistry_Yes_Callback(u8 taskId)
|
||||
{
|
||||
s16 *data = gTasks[taskId].data;
|
||||
u16 *data = (u16*) gTasks[taskId].data;
|
||||
ClearDialogWindowAndFrame(0, FALSE);
|
||||
DestroyListMenuTask(tListTaskId, &tScrollOffset, &tSelectedRow);
|
||||
gSaveBlock1Ptr->secretBases[tSelectedBaseId].registryStatus = UNREGISTERED;
|
||||
@ -1091,7 +1091,7 @@ static void DeleteRegistry_Yes(u8 taskId)
|
||||
|
||||
static void DeleteRegistry_No(u8 taskId)
|
||||
{
|
||||
s16 *data = gTasks[taskId].data;
|
||||
u16 *data = (u16*) gTasks[taskId].data;
|
||||
ClearDialogWindowAndFrame(0, FALSE);
|
||||
DestroyListMenuTask(tListTaskId, &tScrollOffset, &tSelectedRow);
|
||||
FinalizeRegistryMenu(taskId);
|
||||
@ -1100,7 +1100,7 @@ static void DeleteRegistry_No(u8 taskId)
|
||||
|
||||
static void ReturnToMainRegistryMenu(u8 taskId)
|
||||
{
|
||||
s16 *data = gTasks[taskId].data;
|
||||
u16 *data = (u16*) gTasks[taskId].data;
|
||||
AddRegistryMenuScrollArrows(taskId);
|
||||
ClearStdWindowAndFrame(tActionWindowId, FALSE);
|
||||
ClearWindowTilemap(tActionWindowId);
|
||||
|
||||
@ -66,7 +66,6 @@
|
||||
|
||||
extern vu16 GPIOPortDirection;
|
||||
|
||||
static u16 sDummy; // unused variable
|
||||
static bool8 sLocked;
|
||||
|
||||
static int WriteCommand(u8 value);
|
||||
|
||||
@ -1116,7 +1116,7 @@ static void PlaySlotMachine_Internal(u8 machineId, MainCallback exitCallback)
|
||||
{
|
||||
struct Task *task = &gTasks[CreateTask(SlotMachineDummyTask, 0xFF)];
|
||||
task->tMachineId = machineId;
|
||||
StoreWordInTwoHalfwords(&task->tExitCallback, (intptr_t)exitCallback);
|
||||
StoreWordInTwoHalfwords((u16*) &task->tExitCallback, (intptr_t)exitCallback);
|
||||
}
|
||||
|
||||
// Extracts and assigns machineId and exit callback from task.
|
||||
|
||||
@ -311,11 +311,10 @@ static void BuildStartMenuActions(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
#if DEBUG_OVERWORLD_MENU == TRUE && DEBUG_OVERWORLD_IN_MENU == TRUE
|
||||
if (DEBUG_OVERWORLD_MENU == TRUE && DEBUG_OVERWORLD_IN_MENU == TRUE)
|
||||
BuildDebugStartMenu();
|
||||
#else
|
||||
else
|
||||
BuildNormalStartMenu();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
7
src/tv.c
7
src/tv.c
@ -128,7 +128,6 @@ static void TVShowDone(void);
|
||||
static void InterviewAfter_FanClubLetter(void);
|
||||
static void InterviewAfter_RecentHappenings(void);
|
||||
static void InterviewAfter_PkmnFanClubOpinions(void);
|
||||
static void InterviewAfter_Dummy(void);
|
||||
static void InterviewAfter_BravoTrainerPokemonProfile(void);
|
||||
static void InterviewAfter_BravoTrainerBattleTowerProfile(void);
|
||||
static void InterviewAfter_ContestLiveUpdates(void);
|
||||
@ -1078,7 +1077,6 @@ void InterviewAfter(void)
|
||||
InterviewAfter_PkmnFanClubOpinions();
|
||||
break;
|
||||
case TVSHOW_DUMMY:
|
||||
InterviewAfter_Dummy();
|
||||
break;
|
||||
case TVSHOW_BRAVO_TRAINER_POKEMON_PROFILE:
|
||||
InterviewAfter_BravoTrainerPokemonProfile();
|
||||
@ -1620,11 +1618,6 @@ static void InterviewAfter_PkmnFanClubOpinions(void)
|
||||
show->fanclubOpinions.pokemonNameLanguage = GetMonData(&gPlayerParty[GetLeadMonIndex()], MON_DATA_LANGUAGE);
|
||||
}
|
||||
|
||||
static void InterviewAfter_Dummy(void)
|
||||
{
|
||||
TVShow *show = &gSaveBlock1Ptr->tvShows[sCurTVShowSlot];
|
||||
}
|
||||
|
||||
static void TryStartRandomMassOutbreak(void)
|
||||
{
|
||||
u8 i;
|
||||
|
||||
@ -203,7 +203,6 @@ static EWRAM_DATA union
|
||||
struct WirelessLink_Group *group;
|
||||
struct WirelessLink_URoom *uRoom;
|
||||
} sWirelessLinkMain = {};
|
||||
static EWRAM_DATA u32 sUnused = 0;
|
||||
EWRAM_DATA struct RfuGameCompatibilityData gRfuPartnerCompatibilityData = {};
|
||||
EWRAM_DATA u16 gUnionRoomOfferedSpecies = 0;
|
||||
EWRAM_DATA u8 gUnionRoomRequestedMonType = 0;
|
||||
@ -4066,7 +4065,7 @@ static s32 UnionRoomGetPlayerInteractionResponse(struct RfuPlayerList *list, boo
|
||||
CopyAndTranslatePlayerName(gStringVar1, player);
|
||||
if (overrideGender)
|
||||
{
|
||||
playerGender = (player->rfu.data.compatibility.playerTrainerId[overrideGender + 1] >> 3) & 1;
|
||||
playerGender = (player->rfu.data.compatibility.playerTrainerId[overrideGender - 1] >> 3) & 1;
|
||||
}
|
||||
switch (player->rfu.data.activity & 0x3F)
|
||||
{
|
||||
|
||||
@ -1953,7 +1953,7 @@ static u8 *GetLimitedMessageStartPtr(void)
|
||||
for (i = 0; i < numChars; i++)
|
||||
{
|
||||
if (*str == CHAR_EXTRA_SYMBOL)
|
||||
*str++;
|
||||
str++;
|
||||
|
||||
str++;
|
||||
}
|
||||
@ -3115,9 +3115,6 @@ static void DrawKeyboardWindow(void)
|
||||
static void LoadTextEntryWindow(void)
|
||||
{
|
||||
int i;
|
||||
u8 unused[2];
|
||||
unused[0] = 0;
|
||||
unused[1] = 0xFF;
|
||||
|
||||
// Pointless, cleared below. The tiles are nonsense anyway, see LoadChatWindowGfx.
|
||||
for (i = 0; i < MAX_MESSAGE_LENGTH; i++)
|
||||
|
||||
@ -418,10 +418,7 @@ static u8 PickWildMonNature(void)
|
||||
// check synchronize for a pokemon with the same ability
|
||||
if (!GetMonData(&gPlayerParty[0], MON_DATA_SANITY_IS_EGG)
|
||||
&& GetMonAbility(&gPlayerParty[0]) == ABILITY_SYNCHRONIZE
|
||||
#if B_SYNCHRONIZE_NATURE <= GEN_7
|
||||
&& (Random() % 2 == 0)
|
||||
#endif
|
||||
)
|
||||
&& (B_SYNCHRONIZE_NATURE >= GEN_8 || Random() % 2 == 0))
|
||||
{
|
||||
return GetMonData(&gPlayerParty[0], MON_DATA_PERSONALITY) % NUM_NATURES;
|
||||
}
|
||||
@ -1114,20 +1111,13 @@ static void ApplyCleanseTagEncounterRateMod(u32 *encRate)
|
||||
|
||||
bool8 TryDoDoubleWildBattle(void)
|
||||
{
|
||||
#if B_DOUBLE_WILD_REQUIRE_2_MONS == TRUE
|
||||
if (GetSafariZoneFlag() || GetMonsStateToDoubles() != PLAYER_HAS_TWO_USABLE_MONS)
|
||||
#else
|
||||
if (GetSafariZoneFlag())
|
||||
#endif
|
||||
if (GetSafariZoneFlag()
|
||||
|| (B_DOUBLE_WILD_REQUIRE_2_MONS == TRUE && GetMonsStateToDoubles() != PLAYER_HAS_TWO_USABLE_MONS))
|
||||
return FALSE;
|
||||
#if B_FLAG_FORCE_DOUBLE_WILD != 0
|
||||
else if (FlagGet(B_FLAG_FORCE_DOUBLE_WILD))
|
||||
else if (B_FLAG_FORCE_DOUBLE_WILD != 0 && FlagGet(B_FLAG_FORCE_DOUBLE_WILD))
|
||||
return TRUE;
|
||||
#endif
|
||||
#if B_DOUBLE_WILD_CHANCE != 0
|
||||
else if ((Random() % 100) + 1 <= B_DOUBLE_WILD_CHANCE)
|
||||
else if (B_DOUBLE_WILD_CHANCE != 0 && ((Random() % 100) + 1 <= B_DOUBLE_WILD_CHANCE))
|
||||
return TRUE;
|
||||
#endif
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
43
test/battle/ability/beast_boost.c
Normal file
43
test/battle/ability/beast_boost.c
Normal file
@ -0,0 +1,43 @@
|
||||
#include "global.h"
|
||||
#include "test/battle.h"
|
||||
|
||||
ASSUMPTIONS
|
||||
{
|
||||
ASSUME(P_GEN_7_POKEMON == TRUE); // Because only Ultra Beasts have this ability
|
||||
}
|
||||
|
||||
SINGLE_BATTLE_TEST("Beast Boost boosts the most proficient stat when knocking out a target")
|
||||
{
|
||||
u8 stats[] = {1, 1, 1, 1, 1};
|
||||
PARAMETRIZE { stats[0] = 255; }
|
||||
PARAMETRIZE { stats[1] = 255; }
|
||||
PARAMETRIZE { stats[2] = 255; }
|
||||
PARAMETRIZE { stats[3] = 255; }
|
||||
PARAMETRIZE { stats[4] = 255; }
|
||||
GIVEN {
|
||||
PLAYER(SPECIES_NIHILEGO) { Ability(ABILITY_BEAST_BOOST); Attack(stats[0]); Defense(stats[1]); SpAttack(stats[2]); SpDefense(stats[3]); Speed(stats[4]); }
|
||||
OPPONENT(SPECIES_WOBBUFFET) { HP(1); Speed(1); }
|
||||
OPPONENT(SPECIES_WOBBUFFET) { Speed(1); }
|
||||
} WHEN {
|
||||
TURN { MOVE(player, MOVE_TACKLE); SEND_OUT(opponent, 1); }
|
||||
} SCENE {
|
||||
ABILITY_POPUP(player, ABILITY_BEAST_BOOST);
|
||||
switch(i) {
|
||||
case 0:
|
||||
MESSAGE("Nihilego's Beast Boost raised its Attack!");
|
||||
break;
|
||||
case 1:
|
||||
MESSAGE("Nihilego's Beast Boost raised its Defense!");
|
||||
break;
|
||||
case 2:
|
||||
MESSAGE("Nihilego's Beast Boost raised its Sp. Atk!");
|
||||
break;
|
||||
case 3:
|
||||
MESSAGE("Nihilego's Beast Boost raised its Sp. Def!");
|
||||
break;
|
||||
case 4:
|
||||
MESSAGE("Nihilego's Beast Boost raised its Speed!");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
46
test/battle/ability/defeatist.c
Normal file
46
test/battle/ability/defeatist.c
Normal file
@ -0,0 +1,46 @@
|
||||
#include "global.h"
|
||||
#include "test/battle.h"
|
||||
|
||||
ASSUMPTIONS
|
||||
{
|
||||
ASSUME(gBattleMoves[MOVE_TACKLE].split == SPLIT_PHYSICAL);
|
||||
ASSUME(gBattleMoves[MOVE_ECHOED_VOICE].split == SPLIT_SPECIAL);
|
||||
}
|
||||
|
||||
SINGLE_BATTLE_TEST("Defeatist halves Attack when HP <= 50%", s16 damage)
|
||||
{
|
||||
u32 hp;
|
||||
PARAMETRIZE { hp = 400; }
|
||||
PARAMETRIZE { hp = 200; }
|
||||
GIVEN {
|
||||
PLAYER(SPECIES_ARCHEN) { Ability(ABILITY_DEFEATIST); HP(hp), MaxHP(400);}
|
||||
OPPONENT(SPECIES_WOBBUFFET);
|
||||
} WHEN {
|
||||
TURN { MOVE(player, MOVE_TACKLE); MOVE(opponent, MOVE_CELEBRATE); }
|
||||
} SCENE {
|
||||
ANIMATION(ANIM_TYPE_MOVE, MOVE_TACKLE, player);
|
||||
HP_BAR(opponent, captureDamage: &results[i].damage);
|
||||
ANIMATION(ANIM_TYPE_MOVE, MOVE_CELEBRATE, opponent);
|
||||
} FINALLY {
|
||||
EXPECT_MUL_EQ(results[0].damage, Q_4_12(0.5), results[1].damage);
|
||||
}
|
||||
}
|
||||
|
||||
SINGLE_BATTLE_TEST("Defeatist halves Special Attack when HP <= 50%", s16 damage)
|
||||
{
|
||||
u32 hp;
|
||||
PARAMETRIZE { hp = 400; }
|
||||
PARAMETRIZE { hp = 200; }
|
||||
GIVEN {
|
||||
PLAYER(SPECIES_ARCHEN) { Ability(ABILITY_DEFEATIST); HP(hp), MaxHP(400);}
|
||||
OPPONENT(SPECIES_WOBBUFFET);
|
||||
} WHEN {
|
||||
TURN { MOVE(player, MOVE_ECHOED_VOICE); MOVE(opponent, MOVE_CELEBRATE); }
|
||||
} SCENE {
|
||||
ANIMATION(ANIM_TYPE_MOVE, MOVE_ECHOED_VOICE, player);
|
||||
HP_BAR(opponent, captureDamage: &results[i].damage);
|
||||
ANIMATION(ANIM_TYPE_MOVE, MOVE_CELEBRATE, opponent);
|
||||
} FINALLY {
|
||||
EXPECT_MUL_EQ(results[0].damage, Q_4_12(0.5), results[1].damage);
|
||||
}
|
||||
}
|
||||
33
test/battle/ability/dragons_maw.c
Normal file
33
test/battle/ability/dragons_maw.c
Normal file
@ -0,0 +1,33 @@
|
||||
#include "global.h"
|
||||
#include "test/battle.h"
|
||||
|
||||
SINGLE_BATTLE_TEST("Dragon's Maw increases Dragon-type move damage", s16 damage)
|
||||
{
|
||||
u32 move;
|
||||
u16 ability;
|
||||
|
||||
PARAMETRIZE { move = MOVE_TACKLE; ability = ABILITY_KLUTZ; }
|
||||
PARAMETRIZE { move = MOVE_TACKLE; ability = ABILITY_DRAGONS_MAW; }
|
||||
PARAMETRIZE { move = MOVE_DRAGON_CLAW; ability = ABILITY_KLUTZ; }
|
||||
PARAMETRIZE { move = MOVE_DRAGON_CLAW; ability = ABILITY_DRAGONS_MAW; }
|
||||
PARAMETRIZE { move = MOVE_DRAGON_BREATH; ability = ABILITY_KLUTZ; }
|
||||
PARAMETRIZE { move = MOVE_DRAGON_BREATH; ability = ABILITY_DRAGONS_MAW; }
|
||||
|
||||
GIVEN {
|
||||
ASSUME(gBattleMoves[MOVE_TACKLE].type != TYPE_DRAGON);
|
||||
ASSUME(gBattleMoves[MOVE_DRAGON_CLAW].type == TYPE_DRAGON);
|
||||
ASSUME(gBattleMoves[MOVE_DRAGON_BREATH].type == TYPE_DRAGON);
|
||||
ASSUME(gBattleMoves[MOVE_DRAGON_CLAW].split == SPLIT_PHYSICAL);
|
||||
ASSUME(gBattleMoves[MOVE_DRAGON_BREATH].split == SPLIT_SPECIAL);
|
||||
PLAYER(SPECIES_REGIDRAGO) { Ability(ability); }
|
||||
OPPONENT(SPECIES_WOBBUFFET);
|
||||
} WHEN {
|
||||
TURN { MOVE(player, move); }
|
||||
} SCENE {
|
||||
HP_BAR(opponent, captureDamage: &results[i].damage);
|
||||
} FINALLY {
|
||||
EXPECT_EQ(results[0].damage, results[1].damage); // Tackle should be unaffected
|
||||
EXPECT_MUL_EQ(results[2].damage, Q_4_12(1.5), results[3].damage); // Dragon Claw should be affected
|
||||
EXPECT_MUL_EQ(results[4].damage, Q_4_12(1.5), results[5].damage); // Dragon Breath should be affected
|
||||
}
|
||||
}
|
||||
46
test/battle/ability/earth_eater.c
Normal file
46
test/battle/ability/earth_eater.c
Normal file
@ -0,0 +1,46 @@
|
||||
#include "global.h"
|
||||
#include "test/battle.h"
|
||||
|
||||
SINGLE_BATTLE_TEST("Earth Eater heals 25% when hit by ground type moves")
|
||||
{
|
||||
GIVEN {
|
||||
ASSUME(gBattleMoves[MOVE_MUD_SLAP].type == TYPE_GROUND);
|
||||
PLAYER(SPECIES_WOBBUFFET) { Ability(ABILITY_EARTH_EATER); HP(1); MaxHP(100); }
|
||||
OPPONENT(SPECIES_WOBBUFFET);
|
||||
} WHEN {
|
||||
TURN { MOVE(opponent, MOVE_MUD_SLAP); }
|
||||
} SCENE {
|
||||
ABILITY_POPUP(player, ABILITY_EARTH_EATER);
|
||||
HP_BAR(player, damage: -25);
|
||||
MESSAGE("Wobbuffet restored HP using its Earth Eater!");
|
||||
}
|
||||
}
|
||||
|
||||
SINGLE_BATTLE_TEST("Earth Eater does not activate if protected")
|
||||
{
|
||||
GIVEN {
|
||||
ASSUME(gBattleMoves[MOVE_MUD_SLAP].type == TYPE_GROUND);
|
||||
PLAYER(SPECIES_WOBBUFFET) { Ability(ABILITY_EARTH_EATER); HP(1); MaxHP(100); }
|
||||
OPPONENT(SPECIES_WOBBUFFET);
|
||||
} WHEN {
|
||||
TURN { MOVE(player, MOVE_PROTECT); MOVE(opponent, MOVE_MUD_SLAP); }
|
||||
} SCENE {
|
||||
NONE_OF { ABILITY_POPUP(player, ABILITY_EARTH_EATER); HP_BAR(player); MESSAGE("Wobbuffet restored HP using its Earth Eater!"); }
|
||||
}
|
||||
}
|
||||
|
||||
SINGLE_BATTLE_TEST("Earth Eater activates on status moves")
|
||||
{
|
||||
GIVEN {
|
||||
ASSUME(gBattleMoves[MOVE_SAND_ATTACK].type == TYPE_GROUND);
|
||||
ASSUME(gBattleMoves[MOVE_SAND_ATTACK].split == SPLIT_STATUS);
|
||||
PLAYER(SPECIES_WOBBUFFET) { Ability(ABILITY_EARTH_EATER); HP(1); MaxHP(100); }
|
||||
OPPONENT(SPECIES_WOBBUFFET);
|
||||
} WHEN {
|
||||
TURN { MOVE(opponent, MOVE_SAND_ATTACK); }
|
||||
} SCENE {
|
||||
ABILITY_POPUP(player, ABILITY_EARTH_EATER);
|
||||
HP_BAR(player, damage: -25);
|
||||
MESSAGE("Wobbuffet restored HP using its Earth Eater!");
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user