From 7d237d8ff695293c358d445a2291d373e261713e Mon Sep 17 00:00:00 2001 From: BuffelSaft Date: Tue, 16 Mar 2021 22:56:44 +1300 Subject: [PATCH 1/2] Implement Body Press' effect Body Press calculates damage using the user's defense stat instead of its attack. Also adds a special variant of the effect that uses the special defense stat. --- data/battle_scripts_1.s | 2 ++ include/constants/battle_move_effects.h | 3 ++- src/battle_util.c | 13 +++++++++++++ src/data/battle_moves.h | 2 +- 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 16bb6e92c..032b564f7 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -365,6 +365,7 @@ gBattleScriptsForMoveEffects:: @ 82D86A8 .4byte BattleScript_EffectFairyLock .4byte BattleScript_EffectAllySwitch .4byte BattleScript_EffectSleepHit + .4byte BattleScript_EffectBodyPress BattleScript_EffectSleepHit: setmoveeffect MOVE_EFFECT_SLEEP @@ -2049,6 +2050,7 @@ BattleScript_EffectChangeTypeOnItem: BattleScript_EffectFusionCombo: BattleScript_EffectRevelationDance: BattleScript_EffectBelch: +BattleScript_EffectBodyPress: BattleScript_HitFromAtkCanceler:: attackcanceler diff --git a/include/constants/battle_move_effects.h b/include/constants/battle_move_effects.h index 74418d2c7..4c5ada890 100644 --- a/include/constants/battle_move_effects.h +++ b/include/constants/battle_move_effects.h @@ -351,7 +351,8 @@ #define EFFECT_FAIRY_LOCK 345 #define EFFECT_ALLY_SWITCH 346 #define EFFECT_SLEEP_HIT 347 // Relic Song +#define EFFECT_BODY_PRESS 348 -#define NUM_BATTLE_MOVE_EFFECTS 348 +#define NUM_BATTLE_MOVE_EFFECTS 349 #endif // GUARD_CONSTANTS_BATTLE_MOVE_EFFECTS_H diff --git a/src/battle_util.c b/src/battle_util.c index f1f5ffd10..60c953d7e 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -7307,6 +7307,19 @@ static u32 CalcAttackStat(u16 move, u8 battlerAtk, u8 battlerDef, u8 moveType, b atkStage = gBattleMons[battlerDef].statStages[STAT_SPATK]; } } + if (gBattleMoves[move].effect == EFFECT_BODY_PRESS) + { + if (IS_MOVE_PHYSICAL(move)) + { + atkStat = gBattleMons[battlerAtk].defense; + atkStage = gBattleMons[battlerAtk].statStages[STAT_DEF]; + } + else + { + atkStat = gBattleMons[battlerAtk].spDefense; + atkStage = gBattleMons[battlerAtk].statStages[STAT_SPDEF]; + } + } else { if (IS_MOVE_PHYSICAL(move)) diff --git a/src/data/battle_moves.h b/src/data/battle_moves.h index 661af2eab..f3c5a6889 100644 --- a/src/data/battle_moves.h +++ b/src/data/battle_moves.h @@ -10828,7 +10828,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] = [MOVE_BODY_PRESS] = { - .effect = EFFECT_PLACEHOLDER, //TODO + .effect = EFFECT_BODY_PRESS, .power = 80, .type = TYPE_FIGHTING, .accuracy = 100, From 937c24ca514c409b246656fab26473525ac94496 Mon Sep 17 00:00:00 2001 From: BuffelSaft Date: Tue, 16 Mar 2021 23:37:02 +1300 Subject: [PATCH 2/2] Remove special Body Press effect Only include the official effect for Body Press to stay faithful to the gen 8 games. --- src/battle_util.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/battle_util.c b/src/battle_util.c index 60c953d7e..d8a042da0 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -7309,16 +7309,8 @@ static u32 CalcAttackStat(u16 move, u8 battlerAtk, u8 battlerDef, u8 moveType, b } if (gBattleMoves[move].effect == EFFECT_BODY_PRESS) { - if (IS_MOVE_PHYSICAL(move)) - { - atkStat = gBattleMons[battlerAtk].defense; - atkStage = gBattleMons[battlerAtk].statStages[STAT_DEF]; - } - else - { - atkStat = gBattleMons[battlerAtk].spDefense; - atkStage = gBattleMons[battlerAtk].statStages[STAT_SPDEF]; - } + atkStat = gBattleMons[battlerAtk].defense; + atkStage = gBattleMons[battlerAtk].statStages[STAT_DEF]; } else {