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

Fixes Photon Geyser #3807

Merged
merged 1 commit into from
Dec 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 4 additions & 4 deletions asm/macros/battle_script.inc
Original file line number Diff line number Diff line change
Expand Up @@ -1556,6 +1556,10 @@
callnative BS_TryTriggerStatusForm
.endm

.macro setphotongeysercategory
callnative BS_SetPhotonGeyserCategory
.endm

@ various command changed to more readable macros
.macro cancelmultiturnmoves battler:req
various \battler, VARIOUS_CANCEL_MULTI_TURN_MOVES
Expand Down Expand Up @@ -2124,10 +2128,6 @@
.4byte \failInstr
.endm

.macro photongeysercheck battler:req
various \battler, VARIOUS_PHOTON_GEYSER_CHECK
.endm

.macro shellsidearmcheck
various BS_ATTACKER, VARIOUS_SHELL_SIDE_ARM_CHECK
.endm
Expand Down
24 changes: 2 additions & 22 deletions data/battle_scripts_1.s
Original file line number Diff line number Diff line change
Expand Up @@ -1182,28 +1182,8 @@ BattleScript_EffectShellSideArm:
goto BattleScript_EffectHit

BattleScript_EffectPhotonGeyser:
attackcanceler
accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE
attackstring
ppreduce
critcalc
damagecalc
adjustdamage
photongeysercheck BS_ATTACKER
attackanimation
waitanimation
effectivenesssound
hitanimation BS_TARGET
waitstate
healthbarupdate BS_TARGET
datahpupdate BS_TARGET
critmessage
waitmessage B_WAIT_TIME_LONG
resultmessage
waitmessage B_WAIT_TIME_LONG
seteffectwithchance
tryfaintmon BS_TARGET
goto BattleScript_MoveEnd
setphotongeysercategory
goto BattleScript_EffectHit

BattleScript_EffectAuraWheel: @ Aura Wheel can only be used by Morpeko
jumpifspecies BS_ATTACKER, SPECIES_MORPEKO_FULL_BELLY, BattleScript_EffectSpeedUpHit
Expand Down
61 changes: 30 additions & 31 deletions include/constants/battle_script_commands.h
Original file line number Diff line number Diff line change
Expand Up @@ -210,37 +210,36 @@
#define VARIOUS_JUMP_IF_WEATHER_AFFECTED 118
#define VARIOUS_JUMP_IF_LEAF_GUARD_PROTECTED 119
#define VARIOUS_SET_ATTACKER_STICKY_WEB_USER 120
#define VARIOUS_PHOTON_GEYSER_CHECK 121
#define VARIOUS_SHELL_SIDE_ARM_CHECK 122
#define VARIOUS_TRY_NO_RETREAT 123
#define VARIOUS_TRY_TAR_SHOT 124
#define VARIOUS_CAN_TAR_SHOT_WORK 125
#define VARIOUS_CHECK_POLTERGEIST 126
#define VARIOUS_CUT_1_3_HP_RAISE_STATS 127
#define VARIOUS_TRY_END_NEUTRALIZING_GAS 128
#define VARIOUS_JUMP_IF_UNDER_200 129
#define VARIOUS_SET_SKY_DROP 130
#define VARIOUS_CLEAR_SKY_DROP 131
#define VARIOUS_SKY_DROP_YAWN 132
#define VARIOUS_JUMP_IF_HOLD_EFFECT 133
#define VARIOUS_CURE_CERTAIN_STATUSES 134
#define VARIOUS_TRY_RESET_NEGATIVE_STAT_STAGES 135
#define VARIOUS_JUMP_IF_LAST_USED_ITEM_BERRY 136
#define VARIOUS_JUMP_IF_LAST_USED_ITEM_HOLD_EFFECT 137
#define VARIOUS_SAVE_BATTLER_ITEM 138
#define VARIOUS_RESTORE_BATTLER_ITEM 139
#define VARIOUS_BATTLER_ITEM_TO_LAST_USED_ITEM 140
#define VARIOUS_SET_BEAK_BLAST 141
#define VARIOUS_SWAP_SIDE_STATUSES 142
#define VARIOUS_SWAP_STATS 143
#define VARIOUS_TEATIME_INVUL 144
#define VARIOUS_TEATIME_TARGETS 145
#define VARIOUS_TRY_WIND_RIDER_POWER 146
#define VARIOUS_ACTIVATE_WEATHER_CHANGE_ABILITIES 147
#define VARIOUS_ACTIVATE_TERRAIN_CHANGE_ABILITIES 148
#define VARIOUS_STORE_HEALING_WISH 149
#define VARIOUS_HIT_SWITCH_TARGET_FAILED 150
#define VARIOUS_TRY_REVIVAL_BLESSING 151
#define VARIOUS_SHELL_SIDE_ARM_CHECK 121
#define VARIOUS_TRY_NO_RETREAT 122
#define VARIOUS_TRY_TAR_SHOT 123
#define VARIOUS_CAN_TAR_SHOT_WORK 124
#define VARIOUS_CHECK_POLTERGEIST 125
#define VARIOUS_CUT_1_3_HP_RAISE_STATS 126
#define VARIOUS_TRY_END_NEUTRALIZING_GAS 127
#define VARIOUS_JUMP_IF_UNDER_200 128
#define VARIOUS_SET_SKY_DROP 129
#define VARIOUS_CLEAR_SKY_DROP 130
#define VARIOUS_SKY_DROP_YAWN 131
#define VARIOUS_JUMP_IF_HOLD_EFFECT 132
#define VARIOUS_CURE_CERTAIN_STATUSES 133
#define VARIOUS_TRY_RESET_NEGATIVE_STAT_STAGES 134
#define VARIOUS_JUMP_IF_LAST_USED_ITEM_BERRY 135
#define VARIOUS_JUMP_IF_LAST_USED_ITEM_HOLD_EFFECT 136
#define VARIOUS_SAVE_BATTLER_ITEM 137
#define VARIOUS_RESTORE_BATTLER_ITEM 138
#define VARIOUS_BATTLER_ITEM_TO_LAST_USED_ITEM 139
#define VARIOUS_SET_BEAK_BLAST 140
#define VARIOUS_SWAP_SIDE_STATUSES 141
#define VARIOUS_SWAP_STATS 142
#define VARIOUS_TEATIME_INVUL 143
#define VARIOUS_TEATIME_TARGETS 144
#define VARIOUS_TRY_WIND_RIDER_POWER 145
#define VARIOUS_ACTIVATE_WEATHER_CHANGE_ABILITIES 146
#define VARIOUS_ACTIVATE_TERRAIN_CHANGE_ABILITIES 147
#define VARIOUS_STORE_HEALING_WISH 148
#define VARIOUS_HIT_SWITCH_TARGET_FAILED 149
#define VARIOUS_TRY_REVIVAL_BLESSING 150

// Cmd_manipulatedamage
#define DMG_CHANGE_SIGN 0
Expand Down
8 changes: 6 additions & 2 deletions src/battle_ai_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -709,11 +709,14 @@ s32 AI_CalcDamage(u32 move, u32 battlerAtk, u32 battlerDef, u8 *typeEffectivenes
gBattleStruct->zmove.baseMoves[battlerAtk] = move;
gBattleStruct->zmove.active = TRUE;
}
else if (gBattleMoves[move].effect == EFFECT_PHOTON_GEYSER)
gBattleStruct->swapDamageCategory = (GetSplitBasedOnStats(gBattlerAttacker) == SPLIT_PHYSICAL);

if (gBattleMoves[move].effect == EFFECT_NATURE_POWER)
move = GetNaturePowerMove();

gBattleStruct->dynamicMoveType = 0;

if (move == MOVE_NATURE_POWER)
move = GetNaturePowerMove();

SetTypeBeforeUsingMove(move, battlerAtk);
GET_MOVE_TYPE(move, moveType);
Expand Down Expand Up @@ -825,6 +828,7 @@ s32 AI_CalcDamage(u32 move, u32 battlerAtk, u32 battlerDef, u8 *typeEffectivenes
// convert multiper to AI_EFFECTIVENESS_xX
*typeEffectiveness = AI_GetEffectiveness(effectivenessMultiplier);

gBattleStruct->swapDamageCategory = FALSE;
gBattleStruct->zmove.active = FALSE;
gBattleStruct->zmove.baseMoves[battlerAtk] = MOVE_NONE;
return dmg;
Expand Down
13 changes: 7 additions & 6 deletions src/battle_script_commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -10218,12 +10218,6 @@ static void Cmd_various(void)
gBattlescriptCurrInstr = cmd->nextInstr;
return;
}
case VARIOUS_PHOTON_GEYSER_CHECK:
{
VARIOUS_ARGS();
gBattleStruct->swapDamageCategory = (GetSplitBasedOnStats(battler) == SPLIT_SPECIAL);
break;
}
case VARIOUS_SHELL_SIDE_ARM_CHECK: // 0% chance GameFreak actually checks this way according to DaWobblefet, but this is the only functional explanation at the moment
{
VARIOUS_ARGS();
Expand Down Expand Up @@ -16509,3 +16503,10 @@ void BS_TryTriggerStatusForm(void)
}
gBattlescriptCurrInstr = cmd->nextInstr;
}

void BS_SetPhotonGeyserCategory(void)
{
NATIVE_ARGS();
gBattleStruct->swapDamageCategory = (GetSplitBasedOnStats(gBattlerAttacker) == SPLIT_PHYSICAL);
gBattlescriptCurrInstr = cmd->nextInstr;
}
51 changes: 51 additions & 0 deletions test/battle/move_effect/photon_geyser.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#include "global.h"
#include "test/battle.h"

ASSUMPTIONS
{
ASSUME(gBattleMoves[MOVE_PHOTON_GEYSER].effect == EFFECT_PHOTON_GEYSER);
}

SINGLE_BATTLE_TEST("Photon Geyser can be mirror coated if it is a special move")
{
GIVEN {
PLAYER(SPECIES_WOBBUFFET) { Attack(100); SpAttack(110); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_PHOTON_GEYSER); MOVE(opponent, MOVE_MIRROR_COAT); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_PHOTON_GEYSER, player);
HP_BAR(opponent);
ANIMATION(ANIM_TYPE_MOVE, MOVE_MIRROR_COAT, opponent);
HP_BAR(player);
}
}

SINGLE_BATTLE_TEST("Photon Geyser can be countered if it is a physcal move")
{
GIVEN {
PLAYER(SPECIES_WOBBUFFET) { Attack(110); SpAttack(100); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_PHOTON_GEYSER); MOVE(opponent, MOVE_COUNTER); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_PHOTON_GEYSER, player);
HP_BAR(opponent);
ANIMATION(ANIM_TYPE_MOVE, MOVE_COUNTER, opponent);
HP_BAR(player);
}
}

SINGLE_BATTLE_TEST("Photon Geyser ignores ignorable Abilities like Battle Armor")
{
GIVEN {
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_LAPRAS) { Ability(ABILITY_SHELL_ARMOR); }
} WHEN {
TURN { MOVE(player, MOVE_PHOTON_GEYSER, criticalHit: TRUE); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_PHOTON_GEYSER, player, );
HP_BAR(opponent);
MESSAGE("A critical hit!");
}
}
Loading