Skip to content

Commit

Permalink
Document niche magic spell bug (#1526)
Browse files Browse the repository at this point in the history
* document magic spell bug

* Update src/overlays/actors/ovl_player_actor/z_player.c

Co-authored-by: Dragorn421 <[email protected]>

* adjust comment

* fix renamed func and reformat

---------

Co-authored-by: Dragorn421 <[email protected]>
  • Loading branch information
fig02 and Dragorn421 authored Sep 19, 2023
1 parent 5170f2d commit 83a13a6
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/overlays/actors/ovl_player_actor/z_player.c
Original file line number Diff line number Diff line change
Expand Up @@ -5239,6 +5239,14 @@ void func_8083AF44(PlayState* play, Player* this, s32 magicSpell) {
func_80835DE4(play, this, Player_Action_808507F4, 0);

this->actionVar1 = magicSpell - 3;

//! @bug `MAGIC_CONSUME_WAIT_PREVIEW` is not guaranteed to succeed.
//! Ideally, the return value of `Magic_RequestChange` should be checked before allowing the process of
//! using a spell to continue. If the magic state change request fails, `gSaveContext.magicTarget` will
//! never be set correctly.
//! When `MAGIC_STATE_CONSUME_SETUP` is set in `Player_Action_808507F4`, magic will eventually be
//! consumed to a stale target value. If that stale target value is higher than the current
//! magic value, it will be consumed to zero.
Magic_RequestChange(play, sMagicSpellCosts[magicSpell], MAGIC_CONSUME_WAIT_PREVIEW);

LinkAnimation_PlayOnceSetSpeed(play, &this->skelAnime, &gPlayerAnim_link_magic_tame, 0.83f);
Expand Down

0 comments on commit 83a13a6

Please sign in to comment.