forked from External/mage
[OGW] Fixed Surge to work with triggered abilities of permanents.
This commit is contained in:
parent
d4692d6371
commit
af5ff0f407
5 changed files with 60 additions and 11 deletions
|
|
@ -27,6 +27,7 @@
|
|||
*/
|
||||
package mage.abilities.keyword;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.UUID;
|
||||
import mage.abilities.SpellAbility;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
|
|
@ -43,6 +44,8 @@ import mage.watchers.common.CastSpellLastTurnWatcher;
|
|||
*/
|
||||
public class SurgeAbility extends SpellAbility {
|
||||
|
||||
public static final String SURGE_ACTIVATION_VALUE_KEY = "surgeActivation";
|
||||
|
||||
private String rule;
|
||||
|
||||
public SurgeAbility(Card card, String surgeCosts) {
|
||||
|
|
@ -81,6 +84,21 @@ public class SurgeAbility extends SpellAbility {
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public boolean activate(Game game, boolean noMana) {
|
||||
if (super.activate(game, noMana)) {
|
||||
ArrayList<Integer> surgeActivations = (ArrayList) game.getState().getValue(SURGE_ACTIVATION_VALUE_KEY + getSourceId());
|
||||
if (surgeActivations == null) {
|
||||
surgeActivations = new ArrayList<>(); // zoneChangeCounter
|
||||
game.getState().setValue(SURGE_ACTIVATION_VALUE_KEY + getSourceId(), surgeActivations);
|
||||
}
|
||||
surgeActivations.add(game.getState().getZoneChangeCounter(getSourceId()));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SurgeAbility copy() {
|
||||
return new SurgeAbility(this);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue