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,9 +27,11 @@
|
|||
*/
|
||||
package mage.abilities.condition.common;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.abilities.keyword.SurgeAbility;
|
||||
import mage.constants.AbilityType;
|
||||
import mage.game.Game;
|
||||
|
||||
/**
|
||||
|
|
@ -52,7 +54,15 @@ public class SurgedCondition implements Condition {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
// if surge is used for permanents we have to chnage implementation
|
||||
return source instanceof SurgeAbility;
|
||||
if (source.getAbilityType().equals(AbilityType.TRIGGERED)) {
|
||||
@SuppressWarnings("unchecked")
|
||||
ArrayList<Integer> surgeActivations = (ArrayList) game.getState().getValue(SurgeAbility.SURGE_ACTIVATION_VALUE_KEY + source.getSourceId());
|
||||
if (surgeActivations != null) {
|
||||
return surgeActivations.contains(game.getState().getZoneChangeCounter(source.getSourceId()) - 1);
|
||||
}
|
||||
return false;
|
||||
} else {
|
||||
return source instanceof SurgeAbility;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue