Skip to content

Commit

Permalink
Merge branch '_RHH/master' into _RHH/upcoming
Browse files Browse the repository at this point in the history
  • Loading branch information
AsparagusEduardo committed Dec 28, 2024
2 parents 5900a01 + dccf263 commit 3bc4126
Show file tree
Hide file tree
Showing 46 changed files with 1,481 additions and 284 deletions.
4 changes: 2 additions & 2 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,9 @@ To compile the `modern` target with this toolchain, the subdirectories `lib`, `i

### Building with debug info

To build **pokeemerald.elf** with debug symbols under a modern toolchain:
To build **pokeemerald.elf** with debug symbols and debug-compatible optimization under a modern toolchain:
```bash
make DINFO=1
make debug
```

# Useful additional tools
Expand Down
10 changes: 0 additions & 10 deletions asm/macros/battle_script.inc
Original file line number Diff line number Diff line change
Expand Up @@ -1426,11 +1426,6 @@
callnative BS_TryRevertWeatherForm
.endm

.macro applysaltcure battler:req
callnative BS_ApplySaltCure
.byte \battler
.endm

.macro trysetoctolock battler:req, failInstr:req
callnative BS_TrySetOctolock
.byte \battler
Expand Down Expand Up @@ -2242,11 +2237,6 @@
.4byte \jumpInstr
.endm

.macro eeriespellppreduce failInstr:req
various BS_TARGET, VARIOUS_EERIE_SPELL_PP_REDUCE
.4byte \failInstr
.endm

.macro jumpifteamhealthy battler:req, jumpInstr:req
various \battler, VARIOUS_JUMP_IF_TEAM_HEALTHY
.4byte \jumpInstr
Expand Down
58 changes: 15 additions & 43 deletions data/battle_scripts_1.s
Original file line number Diff line number Diff line change
Expand Up @@ -404,16 +404,10 @@ BattleScript_EffectHit_Pledge::
tryfaintmon BS_TARGET
return

BattleScript_EffectSaltCure::
call BattleScript_EffectHit_Ret
tryfaintmon BS_TARGET
jumpiffainted BS_TARGET, TRUE, BattleScript_EffectSaltCure_End
jumpifsubstituteblocks BattleScript_EffectSaltCure_End
applysaltcure BS_TARGET
BattleScript_MoveEffectSaltCure::
printstring STRINGID_TARGETISBEINGSALTCURED
waitmessage B_WAIT_TIME_LONG
BattleScript_EffectSaltCure_End:
goto BattleScript_MoveEnd
return

BattleScript_SaltCureExtraDamage::
playanimation BS_TARGET, B_ANIM_SALT_CURE_DAMAGE, NULL
Expand Down Expand Up @@ -957,13 +951,10 @@ BattleScript_HyperspaceFuryRemoveProtect::
waitmessage B_WAIT_TIME_LONG
return

BattleScript_EffectPlasmaFists::
call BattleScript_EffectHit_Ret
tryfaintmon BS_TARGET
orword gFieldStatuses, STATUS_FIELD_ION_DELUGE
BattleScript_MoveEffectIonDeluge::
printstring STRINGID_IONDELUGEON
waitmessage B_WAIT_TIME_LONG
goto BattleScript_MoveEnd
return

BattleScript_EffectSparklySwirl::
call BattleScript_EffectHit_Ret
Expand All @@ -974,41 +965,25 @@ BattleScript_EffectSparklySwirl::
waitstate
goto BattleScript_MoveEnd

BattleScript_EffectFreezyFrost::
call BattleScript_EffectHit_Ret
tryfaintmon BS_TARGET
normalisebuffs
BattleScript_MoveEffectHaze::
printstring STRINGID_STATCHANGESGONE
waitmessage B_WAIT_TIME_LONG
goto BattleScript_MoveEnd
return

BattleScript_EffectSappySeed::
jumpifstatus3 BS_TARGET, STATUS3_LEECHSEED, BattleScript_EffectHit
call BattleScript_EffectHit_Ret
tryfaintmon BS_TARGET
jumpifhasnohp BS_TARGET, BattleScript_MoveEnd
setseeded
printfromtable gLeechSeedStringIds
BattleScript_MoveEffectLeechSeed::
printstring STRINGID_PKMNSEEDED
waitmessage B_WAIT_TIME_LONG
goto BattleScript_MoveEnd

BattleScript_EffectBaddyBad::
jumpifsideaffecting BS_ATTACKER, SIDE_STATUS_REFLECT, BattleScript_EffectHit
call BattleScript_EffectHit_Ret
tryfaintmon BS_TARGET
setreflect
BattleScript_MoveEffectReflect::
printfromtable gReflectLightScreenSafeguardStringIds
waitmessage B_WAIT_TIME_LONG
goto BattleScript_MoveEnd
return

BattleScript_EffectGlitzyGlow::
jumpifsideaffecting BS_ATTACKER, SIDE_STATUS_LIGHTSCREEN, BattleScript_EffectHit
call BattleScript_EffectHit_Ret
tryfaintmon BS_TARGET
setlightscreen
BattleScript_MoveEffectLightScreen::
printfromtable gReflectLightScreenSafeguardStringIds
waitmessage B_WAIT_TIME_LONG
goto BattleScript_MoveEnd
return

BattleScript_EffectStuffCheeks::
attackcanceler
Expand Down Expand Up @@ -4087,13 +4062,10 @@ BattleScript_EffectDestinyBond::
waitmessage B_WAIT_TIME_LONG
goto BattleScript_MoveEnd

BattleScript_EffectEerieSpell::
call BattleScript_EffectHit_Ret
tryfaintmon BS_TARGET
eeriespellppreduce BattleScript_MoveEnd
BattleScript_MoveEffectEerieSpell::
printstring STRINGID_PKMNREDUCEDPP
waitmessage B_WAIT_TIME_LONG
goto BattleScript_MoveEnd
return

BattleScript_EffectSpite::
attackcanceler
Expand Down Expand Up @@ -6747,7 +6719,7 @@ BattleScript_WishComesTrue::
playanimation BS_TARGET, B_ANIM_WISH_HEAL
printstring STRINGID_PKMNWISHCAMETRUE
waitmessage B_WAIT_TIME_LONG
orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE
orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_IGNORE_DISGUISE
healthbarupdate BS_TARGET
datahpupdate BS_TARGET
printstring STRINGID_PKMNREGAINEDHEALTH
Expand Down
Binary file modified graphics/pokemon/ariados/anim_front.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified graphics/pokemon/diggersby/anim_front.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified graphics/pokemon/diggersby/back.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion graphics/pokemon/diggersby/shiny.pal
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ JASC-PAL
120 120 112
160 160 144
8 8 8
120 120 112
84 84 78
48 48 56
232 232 232
240 152 168
Expand Down
Binary file modified graphics/pokemon/duraludon/overworld.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified graphics/pokemon/honedge/anim_front.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified graphics/pokemon/honedge/back.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 7 additions & 7 deletions graphics/pokemon/honedge/normal.pal
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ JASC-PAL
16
152 208 160
8 48 56
0 128 160
36 103 149
16 16 16
80 64 40
248 208 128
176 152 88
255 215 132
181 158 90
136 104 56
152 232 248
102 225 253
96 192 216
80 88 88
168 168 168
216 216 216
48 56 40
152 128 80
136 88 56
99 84 80
201 185 131
167 139 110
Binary file modified graphics/pokemon/maractus/back.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed graphics/pokemon/pichu/spiky_eared/front.png
Binary file not shown.
Binary file modified graphics/pokemon/pichu/spiky_eared/overworld.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified graphics/pokemon/pincurchin/anim_front.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 7 additions & 7 deletions include/battle_scripts.h
Original file line number Diff line number Diff line change
Expand Up @@ -809,18 +809,18 @@ extern const u8 BattleScript_EffectGeomancy[];
extern const u8 BattleScript_EffectFairyLock[];
extern const u8 BattleScript_EffectAllySwitch[];
extern const u8 BattleScript_EffectRelicSong[];
extern const u8 BattleScript_EffectEerieSpell[];
extern const u8 BattleScript_MoveEffectEerieSpell[];
extern const u8 BattleScript_EffectJungleHealing[];
extern const u8 BattleScript_EffectCoaching[];
extern const u8 BattleScript_EffectDecorate[];
extern const u8 BattleScript_EffectRecoilHP25[];
extern const u8 BattleScript_EffectStuffCheeks[];
extern const u8 BattleScript_EffectGlitzyGlow[];
extern const u8 BattleScript_EffectBaddyBad[];
extern const u8 BattleScript_EffectSappySeed[];
extern const u8 BattleScript_EffectFreezyFrost[];
extern const u8 BattleScript_MoveEffectLightScreen[];
extern const u8 BattleScript_MoveEffectReflect[];
extern const u8 BattleScript_MoveEffectLeechSeed[];
extern const u8 BattleScript_MoveEffectHaze[];
extern const u8 BattleScript_EffectSparklySwirl[];
extern const u8 BattleScript_EffectPlasmaFists[];
extern const u8 BattleScript_MoveEffectIonDeluge[];
extern const u8 BattleScript_EffectHyperspaceFury[];
extern const u8 BattleScript_EffectAuraWheel[];
extern const u8 BattleScript_EffectPhotonGeyser[];
Expand All @@ -843,7 +843,7 @@ extern const u8 BattleScript_EffectRevivalBlessing[];
extern const u8 BattleScript_EffectSnow[];
extern const u8 BattleScript_EffectTakeHeart[];
extern const u8 BattleScript_EffectCorrosiveGas[];
extern const u8 BattleScript_EffectSaltCure[];
extern const u8 BattleScript_MoveEffectSaltCure[];
extern const u8 BattleScript_EffectChillyReception[];
extern const u8 BattleScript_EffectMaxMove[];
extern const u8 BattleScript_EffectGlaiveRush[];
Expand Down
18 changes: 15 additions & 3 deletions include/constants/battle.h
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,11 @@
#define MOVE_EFFECT_TOXIC 6
#define MOVE_EFFECT_FROSTBITE 7
#define PRIMARY_STATUS_MOVE_EFFECT MOVE_EFFECT_FROSTBITE // All above move effects apply primary status
#define MOVE_EFFECT_FREEZE_OR_FROSTBITE (B_USE_FROSTBITE == TRUE ? MOVE_EFFECT_FROSTBITE : MOVE_EFFECT_FREEZE)
#if B_USE_FROSTBITE == TRUE
#define MOVE_EFFECT_FREEZE_OR_FROSTBITE MOVE_EFFECT_FROSTBITE
#else
#define MOVE_EFFECT_FREEZE_OR_FROSTBITE MOVE_EFFECT_FREEZE
#endif
#define MOVE_EFFECT_CONFUSION 8
#define MOVE_EFFECT_FLINCH 9
#define MOVE_EFFECT_TRI_ATTACK 10
Expand Down Expand Up @@ -405,8 +409,16 @@
#define MOVE_EFFECT_PSYCHIC_NOISE 78
#define MOVE_EFFECT_TERA_BLAST 79
#define MOVE_EFFECT_ORDER_UP 80

#define NUM_MOVE_EFFECTS 81
#define MOVE_EFFECT_ION_DELUGE 81
#define MOVE_EFFECT_AROMATHERAPY 82 // No functionality yet
#define MOVE_EFFECT_HAZE 83
#define MOVE_EFFECT_LEECH_SEED 84
#define MOVE_EFFECT_REFLECT 85
#define MOVE_EFFECT_LIGHT_SCREEN 86
#define MOVE_EFFECT_SALT_CURE 87
#define MOVE_EFFECT_EERIE_SPELL 88

#define NUM_MOVE_EFFECTS 88

#define MOVE_EFFECT_AFFECTS_USER 0x2000
#define MOVE_EFFECT_CERTAIN 0x4000
Expand Down
7 changes: 0 additions & 7 deletions include/constants/battle_move_effects.h
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,6 @@ enum {
EFFECT_ALLY_SWITCH,
EFFECT_RELIC_SONG,
EFFECT_BODY_PRESS,
EFFECT_EERIE_SPELL,
EFFECT_JUNGLE_HEALING,
EFFECT_COACHING,
EFFECT_LASH_OUT,
Expand All @@ -296,12 +295,7 @@ enum {
EFFECT_RECOIL_HP_25,
EFFECT_STUFF_CHEEKS,
EFFECT_GRAV_APPLE,
EFFECT_GLITZY_GLOW,
EFFECT_BADDY_BAD,
EFFECT_SAPPY_SEED,
EFFECT_FREEZY_FROST,
EFFECT_SPARKLY_SWIRL,
EFFECT_PLASMA_FISTS,
EFFECT_HYPERSPACE_FURY,
EFFECT_AURA_WHEEL,
EFFECT_PHOTON_GEYSER,
Expand Down Expand Up @@ -334,7 +328,6 @@ enum {
EFFECT_COLLISION_COURSE,
EFFECT_CORROSIVE_GAS,
EFFECT_POPULATION_BOMB,
EFFECT_SALT_CURE,
EFFECT_CHILLY_RECEPTION,
EFFECT_MAX_MOVE,
EFFECT_GLAIVE_RUSH,
Expand Down
1 change: 0 additions & 1 deletion include/constants/battle_script_commands.h
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,6 @@ enum CmdVarious
VARIOUS_TERRAIN_SEED,
VARIOUS_MAKE_INVISIBLE,
VARIOUS_ROOM_SERVICE,
VARIOUS_EERIE_SPELL_PP_REDUCE,
VARIOUS_JUMP_IF_TEAM_HEALTHY,
VARIOUS_TRY_HEAL_QUARTER_HP,
VARIOUS_JUMP_IF_PRANKSTER_BLOCKED,
Expand Down
11 changes: 9 additions & 2 deletions include/pokemon.h
Original file line number Diff line number Diff line change
Expand Up @@ -580,15 +580,21 @@ struct MoveInfo
#define EFFECTS_ARR(...) (const struct AdditionalEffect[]) {__VA_ARGS__}
#define ADDITIONAL_EFFECTS(...) EFFECTS_ARR( __VA_ARGS__ ), .numAdditionalEffects = ARRAY_COUNT(EFFECTS_ARR( __VA_ARGS__ ))

// Just a hack to make a move boosted by Sheer Force despite having no secondary effects affected
#define SHEER_FORCE_HACK { .moveEffect = 0, .chance = 100, }
enum SheerForceBoost
{
SHEER_FORCE_AUTO_BOOST, // This is the default state when a move has a move effect with a chance
SHEER_FORCE_BOOST, // If a move effect doesn't have an effect with a chance this can force a boost
SHEER_FORCE_NO_BOOST, // Prevents a Sheer Force boost
};

struct AdditionalEffect
{
u16 moveEffect;
u8 self:1;
u8 onlyIfTargetRaisedStats:1;
u8 onChargeTurnOnly:1;
u8 sheerForceBoost:2; // Handles edge cases for Sheer Force
u8 padding:3;
u8 chance; // 0% = effect certain, primary effect
};

Expand Down Expand Up @@ -901,6 +907,7 @@ u16 GetFormChangeTargetSpecies(struct Pokemon *mon, u16 method, u32 arg);
u16 GetFormChangeTargetSpeciesBoxMon(struct BoxPokemon *boxMon, u16 method, u32 arg);
bool32 DoesSpeciesHaveFormChangeMethod(u16 species, u16 method);
u16 MonTryLearningNewMoveEvolution(struct Pokemon *mon, bool8 firstMove);
void RemoveIVIndexFromList(u8 *ivs, u8 selectedIv);
bool32 SpeciesHasGenderDifferences(u16 species);
bool32 TryFormChange(u32 monId, u32 side, u16 method);
void TryToSetBattleFormChangeMoves(struct Pokemon *mon, u16 method);
Expand Down
11 changes: 5 additions & 6 deletions src/battle_ai_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2523,8 +2523,6 @@ static s32 AI_CheckBadMove(u32 battlerAtk, u32 battlerDef, u32 move, s32 score)
ADJUST_SCORE(-4);
break;
//TODO
//case EFFECT_PLASMA_FISTS:
//break;
//case EFFECT_SHELL_TRAP:
//break;
//case EFFECT_BEAK_BLAST:
Expand Down Expand Up @@ -4437,10 +4435,6 @@ static u32 AI_CalcMoveEffectScore(u32 battlerAtk, u32 battlerDef, u32 move)
|| gBattleMons[BATTLE_PARTNER(battlerAtk)].status1 & STATUS1_ANY)
ADJUST_SCORE(GOOD_EFFECT);
break;
case EFFECT_SALT_CURE:
if (IS_BATTLER_ANY_TYPE(battlerDef, TYPE_WATER, TYPE_STEEL))
ADJUST_SCORE(DECENT_EFFECT);
break;
} // move effect checks

// check move additional effects that are likely to happen
Expand Down Expand Up @@ -4685,6 +4679,11 @@ static u32 AI_CalcMoveEffectScore(u32 battlerAtk, u32 battlerDef, u32 move)
if (!HasMoveWithAdditionalEffect(battlerDef, MOVE_EFFECT_RAPID_SPIN) && ShouldTrap(battlerAtk, battlerDef, move))
ADJUST_SCORE(BEST_EFFECT);
break;
case MOVE_EFFECT_SALT_CURE:
if (IS_BATTLER_OF_TYPE(battlerDef, TYPE_WATER) || IS_BATTLER_OF_TYPE(battlerDef, TYPE_STEEL))
ADJUST_SCORE(DECENT_EFFECT);
break;

}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/battle_ai_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -2434,7 +2434,7 @@ bool32 HasDamagingMoveOfType(u32 battlerId, u32 type)
for (i = 0; i < MAX_MON_MOVES; i++)
{
if (moves[i] != MOVE_NONE && moves[i] != MOVE_UNAVAILABLE
&& !IS_MOVE_STATUS(moves[i]].type == type && gMovesInfo[moves[i]))
&& gMovesInfo[moves[i]].type == type && !IS_MOVE_STATUS(moves[i]))
return TRUE;
}

Expand Down
1 change: 1 addition & 0 deletions src/battle_anim_effects_1.c
Original file line number Diff line number Diff line change
Expand Up @@ -6736,6 +6736,7 @@ static void AnimTask_AllySwitchDataSwap(u8 taskId)
SwapStructData(&gSpecialStatuses[battlerAtk], &gSpecialStatuses[battlerPartner], data, sizeof(struct SpecialStatus));
SwapStructData(&gProtectStructs[battlerAtk], &gProtectStructs[battlerPartner], data, sizeof(struct ProtectStruct));
SwapStructData(&gBattleSpritesDataPtr->battlerData[battlerAtk], &gBattleSpritesDataPtr->battlerData[battlerPartner], data, sizeof(struct BattleSpriteInfo));
SwapStructData(&gBattleStruct->illusion[battlerAtk], &gBattleStruct->illusion[battlerPartner], data, sizeof(struct Illusion));

SWAP(gBattleSpritesDataPtr->battlerData[battlerAtk].invisible, gBattleSpritesDataPtr->battlerData[battlerPartner].invisible, temp);
SWAP(gTransformedPersonalities[battlerAtk], gTransformedPersonalities[battlerPartner], temp);
Expand Down
Loading

0 comments on commit 3bc4126

Please sign in to comment.