From 403843cecfa6c807594eb018de7ba0c79c61b08c Mon Sep 17 00:00:00 2001 From: Alex <93446519+AlexOn1ine@users.noreply.github.com> Date: Sun, 10 Dec 2023 00:27:05 +0100 Subject: [PATCH] Fixes Fling damage calcs (#3670) --- data/battle_scripts_1.s | 10 ++++++++-- test/battle/move_effect/fling.c | 24 +++++++++++++++++++++++- 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 7ddde66a82..bb9ef9a7b7 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -904,8 +904,7 @@ BattleScript_EffectFling: attackcanceler jumpifcantfling BS_ATTACKER, BattleScript_FailedFromAtkString setlastuseditem BS_ATTACKER - removeitem BS_ATTACKER - accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE + accuracycheck BattleScript_FlingMissed, ACC_CURR_MOVE attackstring pause B_WAIT_TIME_SHORT printstring STRINGID_PKMNFLUNG @@ -914,6 +913,7 @@ BattleScript_EffectFling: critcalc damagecalc adjustdamage + removeitem BS_ATTACKER attackanimation waitanimation effectivenesssound @@ -989,6 +989,12 @@ BattleScript_FlingWhiteHerb: swapattackerwithtarget goto BattleScript_FlingEnd +BattleScript_FlingMissed: + removeitem BS_ATTACKER + attackstring + ppreduce + goto BattleScript_MoveMissedPause + BattleScript_EffectShellSideArm: shellsidearmcheck setmoveeffect MOVE_EFFECT_POISON diff --git a/test/battle/move_effect/fling.c b/test/battle/move_effect/fling.c index 8d44d9b9f1..1c4c08eb76 100644 --- a/test/battle/move_effect/fling.c +++ b/test/battle/move_effect/fling.c @@ -273,7 +273,7 @@ SINGLE_BATTLE_TEST("Fling - thrown berry's effect activates for the target even PARAMETRIZE { item = ITEM_SALAC_BERRY; effect = HOLD_EFFECT_SPEED_UP; statId = STAT_SPEED; } GIVEN { - PLAYER(SPECIES_WOBBUFFET) { Item(item); } + PLAYER(SPECIES_WOBBUFFET) { Item(item); Attack(1); } OPPONENT(SPECIES_WOBBUFFET) { Status1(status1); HP(399); MaxHP(400); MovesWithPP({MOVE_CELEBRATE, 35}); } } WHEN { TURN { MOVE(player, MOVE_FLING); } @@ -346,3 +346,25 @@ SINGLE_BATTLE_TEST("Fling - thrown berry's effect activates for the target even } } +SINGLE_BATTLE_TEST("Fling deals damage based on items fling power") +{ + u16 item; + s16 damage[2]; + + GIVEN { + ASSUME(gBattleMoves[MOVE_CRUNCH].power == 80); + ASSUME(gItems[ITEM_VENUSAURITE].flingPower == 80); + PLAYER(SPECIES_WOBBUFFET) { Item(ITEM_VENUSAURITE); } + OPPONENT(SPECIES_REGIROCK); + } WHEN { + TURN { MOVE(player, MOVE_CRUNCH); } + TURN { MOVE(player, MOVE_FLING); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_CRUNCH, player); + HP_BAR(opponent, captureDamage: &damage[0]); + ANIMATION(ANIM_TYPE_MOVE, MOVE_FLING, player); + HP_BAR(opponent, captureDamage: &damage[1]); + } THEN { + EXPECT_EQ(damage[0], damage[1]); + } +}