Fixes Fling damage calcs (#3670)

This commit is contained in:
Alex 2023-12-10 00:27:05 +01:00 committed by GitHub
parent d5f3df6f08
commit 403843cecf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 31 additions and 3 deletions

View file

@ -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

View file

@ -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]);
}
}