YEP_InstantCast - Ending an encounter with it breaks the next encounter

To reproduce this bug, have a skill that has the <Instant> tag applied to it, and deal the finishing blow onto the last enemy in an encounter. That encounter ends as normal, but start the next encounter and the battle actions menu doesn't appear, locking up the game.

1580653836587.png

^ I've made the Attack skill instant, basically just keep spamming it until the enemies die

1580653939518.png

^ This is the state the screen is in when you start the second encounter, the action menu on the left never appears

1580654014536.png

^ No other plugins being used, I would include the test project but because YEP_InstantCast is a purchasable plugin I don't want to be a point of access for people to access it freely

I'm not sure of any other information I should include, let me know if anything is not clear or if there's something else I can add
I've figure out a solution to this issue, I don't fully understand how it fixes it so I'm not sure if it introduces other problems.

In any case, the issue seems to be that on line 364: if (this.updateEventMain()) return;, that function also checks if the battle has ended, returning true if it has and thus exiting this function early. I basically moved the couple of lines below it above it and it seems like they need to be set to ensure the next battle starts properly. TLDR at line 364 in function BattleManager.endActorInstantCast change the following lines to this order:

Before:

JavaScript:
if (this.updateEventMain()) return;
Yanfly.Instant.BattleManager_endAction.call(this);
this._subject = user;
this._instantCasting = undefined;

After:
JavaScript:
Yanfly.Instant.BattleManager_endAction.call(this);
this._subject = user;
this._instantCasting = undefined;
if (this.updateEventMain()) return;

I found this bug on YEP_InstantCast version 1.12
I've figure out a solution to this issue, I don't fully understand how it fixes it so I'm not sure if it introduces other problems.

In any case, the issue seems to be that on line 364: if (this.updateEventMain()) return;, that function also checks if the battle has ended, returning true if it has and thus exiting this function early. I basically moved the couple of lines below it above it and it seems like they need to be set to ensure the next battle starts properly. TLDR at line 364 in function BattleManager.endActorInstantCast change the following lines to this order:

Before:

JavaScript:
if (this.updateEventMain()) return;
Yanfly.Instant.BattleManager_endAction.call(this);
this._subject = user;
this._instantCasting = undefined;

After:
JavaScript:
Yanfly.Instant.BattleManager_endAction.call(this);
this._subject = user;
this._instantCasting = undefined;
if (this.updateEventMain()) return;

I found this bug on YEP_InstantCast version 1.12
While it isn't expressly mentioned in the help text for that plugin, I'd suspect the bug doesn't happen at all if you use the YEP_BattleEngineCore plugin, as this is a battle plugin, and probably requires it as a dependency.

Original thread: https://forums.rpgmakerweb.com/threads/yep_instantcast-ending-an-encounter-with-it-breaks-the-next-encounter.117863/