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

(Baron Rivendare + Skeleton Knight / Anub'Arak issues) ReturnMinionToHandSpell should check if the minion is still on the battlefield before trying to remove it #346

Open
doctorpangloss opened this issue May 7, 2017 · 1 comment

Comments

@doctorpangloss
Copy link
Contributor

doctorpangloss commented May 7, 2017

ReturnMinionToHandSpell from deathrattles shouldn't try to getLogic().removeMinion if the minion isn't on the battlefield anymore. Otherwise, if Baron Rivendare is in play, two copies of the minion will appear in the set aside zone and glitch out effects further down the line.

I think this issue can be resolved if the second battlecry action checks that its target is still valid. This might look something like...

final EntityReference target = battlecryAction.getSpell().hasPredefinedTarget() ? battlecryAction.getSpell().getTarget() : battlecryAction.getTargetKey();
final boolean targetable = target == null || target.isTargetGroup() ||
    /* The target is still among the valid targets for the action */
    getValidTargets(playerId, battlecryAction).stream().map(EntityReference::pointTo).anyMatch(er -> er.equals(target));
if (!battlecryAction.canBeExecuted(context, player) || !targetable) {
	return;
}
@webadict
Copy link
Collaborator

That's a good call and a good issue to bring up. This is actually pretty important.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants