From a04035036e3300b4548caadb3217eb78907d3436 Mon Sep 17 00:00:00 2001 From: jeffwadsworth Date: Thu, 9 Sep 2021 09:39:33 -0500 Subject: [PATCH] - Fixed #8230 --- .../java/mage/abilities/keyword/DashAbility.java | 13 +++++++++---- .../java/mage/abilities/keyword/EvokeAbility.java | 15 ++++++++++----- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/Mage/src/main/java/mage/abilities/keyword/DashAbility.java b/Mage/src/main/java/mage/abilities/keyword/DashAbility.java index a1bc09999ad..5794a1a05b3 100644 --- a/Mage/src/main/java/mage/abilities/keyword/DashAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/DashAbility.java @@ -37,7 +37,9 @@ import mage.target.targetpointer.FixedTarget; public class DashAbility extends StaticAbility implements AlternativeSourceCosts { protected static final String KEYWORD = "Dash"; - protected static final String REMINDER_TEXT = "(You may cast this spell for its dash cost. If you do, it gains haste, and it's returned from the battlefield to its owner's hand at the beginning of the next end step.)"; + protected static final String REMINDER_TEXT = "(You may cast this spell for its dash cost. " + + "If you do, it gains haste, and it's returned from the battlefield to its owner's " + + "hand at the beginning of the next end step.)"; protected List alternativeSourceCosts = new LinkedList<>(); @@ -84,7 +86,8 @@ public class DashAbility extends StaticAbility implements AlternativeSourceCosts @Override public boolean isActivated(Ability ability, Game game) { Card card = game.getCard(sourceId); - if (card != null && card.getZoneChangeCounter(game) <= zoneChangeCounter + 1) { + if (card != null + && card.getZoneChangeCounter(game) <= zoneChangeCounter + 1) { for (AlternativeCost2 cost : alternativeSourceCosts) { if (cost.isActivated(game)) { return true; @@ -102,12 +105,14 @@ public class DashAbility extends StaticAbility implements AlternativeSourceCosts @Override public boolean askToActivateAlternativeCosts(Ability ability, Game game) { if (ability instanceof SpellAbility) { - Player player = game.getPlayer(controllerId); + // we must use the controller of the ability here IE: Hedonist's Trove (play from not own hand when you aren't the owner) + Player player = game.getPlayer(ability.getControllerId()); if (player != null) { this.resetDash(); for (AlternativeCost2 dashCost : alternativeSourceCosts) { if (dashCost.canPay(ability, this, controllerId, game) - && player.chooseUse(Outcome.Benefit, KEYWORD + " the creature for " + dashCost.getText(true) + " ?", ability, game)) { + && player.chooseUse(Outcome.Benefit, KEYWORD + + " the creature for " + dashCost.getText(true) + " ?", ability, game)) { activateDash(dashCost, game); ability.getManaCostsToPay().clear(); ability.getCosts().clear(); diff --git a/Mage/src/main/java/mage/abilities/keyword/EvokeAbility.java b/Mage/src/main/java/mage/abilities/keyword/EvokeAbility.java index 0b2631ffb09..8c7eaa72afd 100644 --- a/Mage/src/main/java/mage/abilities/keyword/EvokeAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/EvokeAbility.java @@ -25,7 +25,8 @@ import java.util.List; public class EvokeAbility extends StaticAbility implements AlternativeSourceCosts { protected static final String EVOKE_KEYWORD = "Evoke"; - protected static final String REMINDER_TEXT = "(You may cast this spell for its evoke cost. If you do, it's sacrificed when it enters the battlefield.)"; + protected static final String REMINDER_TEXT = "(You may cast this spell for its evoke cost. " + + "If you do, it's sacrificed when it enters the battlefield.)"; protected List evokeCosts = new LinkedList<>(); @@ -40,7 +41,9 @@ public class EvokeAbility extends StaticAbility implements AlternativeSourceCost super(Zone.ALL, null); name = EVOKE_KEYWORD; this.addEvokeCost(cost); - Ability ability = new ConditionalInterveningIfTriggeredAbility(new EntersBattlefieldTriggeredAbility(new SacrificeSourceEffect()), EvokedCondition.instance, "Sacrifice {this} when it enters the battlefield and was evoked."); + Ability ability = new ConditionalInterveningIfTriggeredAbility( + new EntersBattlefieldTriggeredAbility(new SacrificeSourceEffect()), + EvokedCondition.instance, "Sacrifice {this} when it enters the battlefield and was evoked."); ability.setRuleVisible(false); addSubAbility(ability); } @@ -72,7 +75,8 @@ public class EvokeAbility extends StaticAbility implements AlternativeSourceCost @Override public boolean isActivated(Ability ability, Game game) { Card card = game.getCard(sourceId); - if (card != null && card.getZoneChangeCounter(game) <= zoneChangeCounter + 1) { + if (card != null + && card.getZoneChangeCounter(game) <= zoneChangeCounter + 1) { for (AlternativeCost2 cost : evokeCosts) { if (cost.isActivated(game)) { return true; @@ -90,7 +94,8 @@ public class EvokeAbility extends StaticAbility implements AlternativeSourceCost @Override public boolean askToActivateAlternativeCosts(Ability ability, Game game) { if (ability instanceof SpellAbility) { - Player player = game.getPlayer(controllerId); + // we must use the controller of the ability here IE: Hedonist's Trove (play from not own hand when you aren't the owner) + Player player = game.getPlayer(ability.getControllerId()); if (player != null) { this.resetEvoke(); for (AlternativeCost2 evokeCost : evokeCosts) { @@ -99,7 +104,7 @@ public class EvokeAbility extends StaticAbility implements AlternativeSourceCost activateEvoke(evokeCost, game); ability.getManaCostsToPay().clear(); ability.getCosts().clear(); - for (Iterator it = ((Costs) evokeCost).iterator(); it.hasNext(); ) { + for (Iterator it = ((Costs) evokeCost).iterator(); it.hasNext();) { Cost cost = (Cost) it.next(); if (cost instanceof ManaCostsImpl) { ability.getManaCostsToPay().add((ManaCostsImpl) cost.copy());