Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Secondary/primary effects overhaul #3577

Merged
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
41202a9
Initial struct change + paralysis test
cfmnephrite Nov 18, 2023
45d8491
Fixed macro + implemented working Mortal Spin
cfmnephrite Nov 18, 2023
1dadc79
Triple Arrows redo
cfmnephrite Nov 20, 2023
ba6d223
matcha gotcha
AlexOn1ine Nov 19, 2023
7fb811d
burn_hit -> move_effect_burn
AlexOn1ine Nov 19, 2023
ffe89c7
Redid Fang Moves
cfmnephrite Nov 22, 2023
27c32f1
Fixed compatibilty with current move effect system and other moves
cfmnephrite Nov 23, 2023
d9f64b7
Fixed seteffectwithchance
cfmnephrite Nov 23, 2023
bec0fea
Flinching moves
cfmnephrite Nov 23, 2023
d81bf6a
EFFECT_POISON_HIT
cfmnephrite Nov 23, 2023
b7d77ad
Confusion moves
cfmnephrite Nov 23, 2023
5eae07e
Jaw Lock, Axe Kick, Spin Out
cfmnephrite Nov 23, 2023
98b2c93
Freeze/frostbite causing moves
cfmnephrite Nov 25, 2023
0e23160
Fixed macro + Jaw Lock test
cfmnephrite Nov 25, 2023
4058d16
2-Turn moves + unique moves with secondary effects
cfmnephrite Nov 25, 2023
2d0ec53
Misc moves + cmd_seteffectwithchance fix
cfmnephrite Nov 26, 2023
a1a62f4
More moves
cfmnephrite Nov 27, 2023
460eeff
All moves (I think) that hit and lower a stat
cfmnephrite Nov 28, 2023
a244d7b
Updated moves that raise the target's own stats
cfmnephrite Dec 24, 2023
a8967da
Overheat (and clones)
cfmnephrite Dec 24, 2023
e87fe53
Superpower, CC, Hammer Arm
cfmnephrite Dec 24, 2023
31b3337
Updated moves that raise the target's own stats
cfmnephrite Dec 24, 2023
cda445c
Merge remote-tracking branch 'rhh/upcoming' into secondary_effects_ov…
cfmnephrite Dec 25, 2023
f3e67cf
Removed all unused effects
cfmnephrite Dec 25, 2023
b0b9883
Removed unused effects + fixed tests + removed secondaryEffectChance
cfmnephrite Dec 25, 2023
76b4e08
Trapping moves, Secret Power, rampage moves
cfmnephrite Dec 26, 2023
c5061f0
Updated remaining moves which use secondaryEffectChance
cfmnephrite Dec 26, 2023
cd5c59a
Merge remote-tracking branch 'rhh/upcoming' into secondary_effects_ov…
cfmnephrite Dec 26, 2023
77c722e
Obsoleted 22 more effects
cfmnephrite Dec 27, 2023
417a02c
Fixed Make it Rain
cfmnephrite Dec 28, 2023
7c38056
Review fixes
cfmnephrite Dec 29, 2023
39773c0
Burn Up and Double Shock
cfmnephrite Dec 29, 2023
9d68f4a
Added Throat Chop test
cfmnephrite Dec 29, 2023
e7de08e
Unified Sonic Boom & Dragon Rage
cfmnephrite Dec 30, 2023
f5ae8e0
Rapid Spin uses additional effects + test
cfmnephrite Dec 30, 2023
b6da1a1
Tweaked helper functions
cfmnephrite Dec 30, 2023
be2e3cf
Updated primary/secondary macros
cfmnephrite Dec 30, 2023
e34373e
Renamed seteffectwithchance to setadditionaleffects
cfmnephrite Dec 30, 2023
ff51eb2
Removed unused move effects, various ids, and one script command
cfmnephrite Dec 30, 2023
60a0020
Tweaked macro to be more appealing
cfmnephrite Dec 30, 2023
9dfa0d2
Merge branch 'upcoming' into secondary_effects_overhaul
cfmnephrite Dec 30, 2023
e132f26
Merge corrections and fixes
cfmnephrite Dec 30, 2023
923d22b
Merge branch 'upcoming' of https://github.com/rh-hideout/pokeemerald-…
cfmnephrite Dec 31, 2023
0980253
Merge branch 'upcoming' into secondary_effects_overhaul
cfmnephrite Jan 1, 2024
daeba06
Fixed SetMoveEffect + Sheer Force
cfmnephrite Jan 1, 2024
4556ecc
Removed PRIMARY/SECONDARY macros; added flags
cfmnephrite Jan 2, 2024
59d76c9
A few fixes, added effects for Meteor Beam/Electro Shot
cfmnephrite Jan 2, 2024
25f0179
Review changes
cfmnephrite Jan 9, 2024
67e76f2
Some more review fixes + Fling fix
cfmnephrite Jan 10, 2024
c461673
Merge remote-tracking branch 'rhh/upcoming' into secondary_effects_ov…
cfmnephrite Jan 10, 2024
3c93f97
Apply suggestions from code review
cfmnephrite Jan 11, 2024
a76e3c7
Applied more review fixes
cfmnephrite Jan 11, 2024
baefa08
Merge remote-tracking branch 'rhh/upcoming' into secondary_effects_ov…
cfmnephrite Jan 11, 2024
f6efc75
Move functions to battle_ai_util.c
cfmnephrite Jan 11, 2024
095decb
FINAL review changes
cfmnephrite Jan 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions data/battle_scripts_1.s
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ gBattleScriptsForMoveEffects::
.4byte BattleScript_EffectOHKO @ EFFECT_OHKO
.4byte BattleScript_EffectHit @ EFFECT_FUSION_COMBO
.4byte BattleScript_EffectSuperFang @ EFFECT_SUPER_FANG
.4byte BattleScript_EffectArgFixedDamage @ EFFECT_ARG_FIXED_DAMAGE
.4byte BattleScript_EffectFixedDamageArg @ EFFECT_FIXED_DAMAGE_ARG
.4byte BattleScript_EffectHealBlock @ EFFECT_HEAL_BLOCK
.4byte BattleScript_EffectRecoilIfMiss @ EFFECT_RECOIL_IF_MISS
.4byte BattleScript_EffectMist @ EFFECT_MIST
Expand Down Expand Up @@ -1430,17 +1430,20 @@ BattleScript_FailIfNotArgType:
goto BattleScript_HitFromCritCalc

BattleScript_RemoveFireType::
losetype BS_ATTACKER, TYPE_FIRE
printstring STRINGID_ATTACKERLOSTFIRETYPE
waitmessage B_WAIT_TIME_LONG
return

BattleScript_RemoveElectricType::
losetype BS_ATTACKER, TYPE_ELECTRIC
printstring STRINGID_ATTACKERLOSTELECTRICTYPE
waitmessage B_WAIT_TIME_LONG
return

BattleScript_RemoveGenericType::
printstring STRINGID_ATTACKERLOSTITSTYPE
waitmessage B_WAIT_TIME_LONG
return

BattleScript_DefDown::
modifybattlerstatstage BS_TARGET, STAT_DEF, DECREASE, 1, BattleScript_DefDown_Ret, ANIM_ON
BattleScript_DefDown_Ret:
Expand Down Expand Up @@ -4816,7 +4819,7 @@ BattleScript_EffectBatonPass::
switchineffects BS_ATTACKER
goto BattleScript_MoveEnd

BattleScript_EffectArgFixedDamage::
BattleScript_EffectFixedDamageArg::
attackcanceler
accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE
attackstring
Expand Down
4 changes: 4 additions & 0 deletions include/battle_ai_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -190,5 +190,9 @@ void IncreaseConfusionScore(u32 battlerAtk, u32 battlerDef, u32 move, s32 *score
void IncreaseFrostbiteScore(u32 battlerAtk, u32 battlerDef, u32 move, s32 *score);

s32 AI_CalcPartyMonDamage(u32 move, u32 battlerAtk, u32 battlerDef, struct BattlePokemon switchinCandidate, bool8 isPartyMonAttacker);
s32 AI_CheckMoveEffects(u32 battlerAtk, u32 battlerDef, u32 move, s32 score, struct AiLogicData *aiData, u32 predictedMove, bool32 isDoubleBattle);
s32 AI_TryToClearStats(u32 battlerAtk, u32 battlerDef, bool32 isDoubleBattle);
bool32 AI_ShouldCopyStatChanges(u32 battlerAtk, u32 battlerDef);
s32 AI_ShouldSetUpHazards(u32 battlerAtk, u32 battlerDef, struct AiLogicData *aiData);

#endif //GUARD_BATTLE_AI_UTIL_H
1 change: 1 addition & 0 deletions include/battle_scripts.h
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,7 @@ extern const u8 BattleScript_EffectRaiseCritAlliesAnim[];
extern const u8 BattleScript_EffectHealOneSixthAllies[];
extern const u8 BattleScript_EffectCureStatusAllies[];
extern const u8 BattleScript_EffectRecycleBerriesAllies[];
extern const u8 BattleScript_RemoveGenericType[];

// dynamax and max raids
extern const u8 BattleScript_DynamaxBegins[];
Expand Down
1 change: 1 addition & 0 deletions include/battle_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -247,5 +247,6 @@ bool32 MoveEffectIsGuaranteed(u32 battler, u32 battlerAbility, const struct Addi
u8 GetBattlerType(u32 battler, u8 typeIndex);
bool8 CanMonParticipateInSkyBattle(struct Pokemon *mon);
bool8 IsMonBannedFromSkyBattles(u16 species);
void RemoveBattlerType(u32 battler, u8 type);

#endif // GUARD_BATTLE_UTIL_H
2 changes: 1 addition & 1 deletion include/config/battle.h
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@
#define B_THUNDERSTORM_TERRAIN TRUE // If TRUE, overworld Thunderstorm generates Rain and Electric Terrain as in Gen 8.
#define B_FOG_TERRAIN TRUE // If TRUE, overworld Fog generates Misty Terrain as in Gen 8.
#define B_TERRAIN_TYPE_BOOST GEN_LATEST // In Gen8, damage is boosted by 30% instead of 50%.
#define B_SECRET_POWER_EFFECT GEN_LATEST // Secret Power's effects change depending on terrain and generation. See MOVE_EFFECT_SECRET_POWER.
#define B_SECRET_POWER_EFFECT GEN_LATEST // Secret Power's effects change depending on terrain and generation. See MOVE_EFFECT_SECRET_POWER's case in `SetMoveEffect`.
#define B_SECRET_POWER_ANIMATION GEN_LATEST // Secret Power's animations change depending on terrain and generation.
#define B_NATURE_POWER_MOVES GEN_LATEST // Nature Power calls different moves depending on terrain and generation. See sNaturePowerMoves.
#define B_CAMOUFLAGE_TYPES GEN_LATEST // Camouflage changes the user to different types depending on terrain and generation. See sTerrainToType.
Expand Down
2 changes: 1 addition & 1 deletion include/constants/battle_move_effects.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
#define EFFECT_OHKO 30
#define EFFECT_FUSION_COMBO 31
#define EFFECT_SUPER_FANG 32
#define EFFECT_ARG_FIXED_DAMAGE 33
#define EFFECT_FIXED_DAMAGE_ARG 33
#define EFFECT_HEAL_BLOCK 34
#define EFFECT_RECOIL_IF_MISS 35
#define EFFECT_MIST 36
Expand Down
3 changes: 2 additions & 1 deletion include/constants/battle_string_ids.h
Original file line number Diff line number Diff line change
Expand Up @@ -699,8 +699,9 @@
#define STRINGID_HOSPITALITYRESTORATION 697
#define STRINGID_ELECTROSHOCKCHARGING 698
#define STRINGID_ITEMWASUSEDUP 699
#define STRINGID_ATTACKERLOSTITSTYPE 700

#define BATTLESTRINGS_COUNT 700
#define BATTLESTRINGS_COUNT 701

// This is the string id that gBattleStringsTable starts with.
// String ids before this (e.g. STRINGID_INTROMSG) are not in the table,
Expand Down
9 changes: 4 additions & 5 deletions include/pokemon.h
cfmnephrite marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -451,8 +451,9 @@ struct BattleMove
u16 accuracy:7;
u16 recoil:7;
u16 criticalHitStage:2;
u8 padding:6; // coming soon...
u8 numAdditionalEffects:2; // limited to 3 - don't want to get too crazy
u8 pp;
u8 secondaryEffectChance;

u16 target;
s8 priority;
Expand Down Expand Up @@ -507,17 +508,15 @@ struct BattleMove
u32 parentalBondBanned:1;
u32 skyBattleBanned:1;
u32 sketchBanned:1;
u32 numAdditionalEffects:2; // limited to 3 - don't want to get too crazy

u16 argument;
u32 argument; // also coming soon

// primary/secondary effects
const struct AdditionalEffect *additionalEffects;
};

#define ADDITIONAL_EFFECTS(...) EFFECTS_ARR( __VA_ARGS__ ), .numAdditionalEffects = ARRAY_COUNT(EFFECTS_ARR( __VA_ARGS__ ))

#define EFFECTS_ARR(...) (const struct AdditionalEffect[]) {__VA_ARGS__}
#define ADDITIONAL_EFFECTS(...) EFFECTS_ARR( __VA_ARGS__ ), .numAdditionalEffects = ARRAY_COUNT(EFFECTS_ARR( __VA_ARGS__ ))

struct AdditionalEffect
{
Expand Down
Loading
Loading