mirror of
https://github.com/magefree/mage.git
synced 2026-01-10 04:42:07 -08:00
* Wall of Roots - Fixed that Wall could not be used after beeing exiled and returned with Momentary Blink.
This commit is contained in:
parent
df475d8049
commit
f633d35bfd
10 changed files with 180 additions and 22 deletions
|
|
@ -92,4 +92,9 @@ public class AddManaOfAnyColorEffect extends ManaEffect {
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
public int getAmount() {
|
||||
return amount;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,8 +28,8 @@
|
|||
|
||||
package mage.abilities.effects.common;
|
||||
|
||||
import mage.constants.Outcome;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.constants.Outcome;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ import mage.game.Game;
|
|||
|
||||
public class ActivateIfConditionManaAbility extends ManaAbility {
|
||||
|
||||
private Condition condition;
|
||||
private final Condition condition;
|
||||
|
||||
public ActivateIfConditionManaAbility(Zone zone, BasicManaEffect effect, Cost cost, Condition condition) {
|
||||
super(zone, effect, cost);
|
||||
|
|
|
|||
|
|
@ -29,10 +29,12 @@
|
|||
package mage.abilities.mana;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.constants.Zone;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.effects.common.ManaEffect;
|
||||
import mage.abilities.effects.common.AddManaOfAnyColorEffect;
|
||||
import mage.abilities.effects.common.BasicManaEffect;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -40,8 +42,25 @@ import mage.game.Game;
|
|||
*/
|
||||
public class ActivateOncePerTurnManaAbility extends ManaAbility {
|
||||
|
||||
public ActivateOncePerTurnManaAbility(Zone zone, ManaEffect effect, Cost cost) {
|
||||
class ActivationInfo {
|
||||
|
||||
public int turnNum;
|
||||
public int activationCounter;
|
||||
|
||||
public ActivationInfo(int turnNum, int activationCounter) {
|
||||
this.turnNum = turnNum;
|
||||
this.activationCounter = activationCounter;
|
||||
}
|
||||
}
|
||||
|
||||
public ActivateOncePerTurnManaAbility(Zone zone, BasicManaEffect effect, Cost cost) {
|
||||
super(zone, effect, cost);
|
||||
this.netMana = effect.getMana();
|
||||
}
|
||||
|
||||
public ActivateOncePerTurnManaAbility(Zone zone, AddManaOfAnyColorEffect effect, Cost cost) {
|
||||
super(zone, effect, cost);
|
||||
this.netMana.setAny(effect.getAmount());
|
||||
}
|
||||
|
||||
public ActivateOncePerTurnManaAbility(ActivateOncePerTurnManaAbility ability) {
|
||||
|
|
@ -51,13 +70,10 @@ public class ActivateOncePerTurnManaAbility extends ManaAbility {
|
|||
@Override
|
||||
public boolean canActivate(UUID playerId, Game game) {
|
||||
if (super.canActivate(playerId, game)) {
|
||||
Boolean activated = (Boolean)game.getState().getValue(this.sourceId.toString() + "activated");
|
||||
if (activated == null) {
|
||||
ActivationInfo activationInfo = (ActivationInfo) game.getState().getValue(CardUtil.getCardZoneString("activations", sourceId, game));
|
||||
if (activationInfo == null || activationInfo.turnNum != game.getTurnNum() || activationInfo.activationCounter < 1) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return !activated;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
@ -66,18 +82,24 @@ public class ActivateOncePerTurnManaAbility extends ManaAbility {
|
|||
public boolean activate(Game game, boolean noMana) {
|
||||
if (canActivate(this.controllerId, game)) {
|
||||
if (super.activate(game, noMana)) {
|
||||
game.getState().setValue(this.sourceId.toString() + "activated", Boolean.TRUE);
|
||||
ActivationInfo activationInfo = (ActivationInfo) game.getState().getValue(CardUtil.getCardZoneString("activations", sourceId, game));
|
||||
if (activationInfo == null) {
|
||||
activationInfo = new ActivationInfo(game.getTurnNum(), 1);
|
||||
} else {
|
||||
if (activationInfo.turnNum != game.getTurnNum()) {
|
||||
activationInfo.turnNum = game.getTurnNum();
|
||||
activationInfo.activationCounter = 1;
|
||||
} else {
|
||||
activationInfo.activationCounter++;
|
||||
}
|
||||
}
|
||||
game.getState().setValue(CardUtil.getCardZoneString("activations", sourceId, game), activationInfo);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset(Game game) {
|
||||
game.getState().setValue(this.sourceId.toString() + "activated", Boolean.FALSE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean resolve(Game game) {
|
||||
if (super.resolve(game)) {
|
||||
|
|
|
|||
|
|
@ -53,8 +53,9 @@ public class ManaOptions extends ArrayList<Mana> {
|
|||
}
|
||||
|
||||
public void addMana(List<ManaAbility> abilities, Game game) {
|
||||
if (isEmpty())
|
||||
if (isEmpty()) {
|
||||
this.add(new Mana());
|
||||
}
|
||||
if (!abilities.isEmpty()) {
|
||||
if (abilities.size() == 1) {
|
||||
//if there is only one mana option available add it to all the existing options
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ package mage.util;
|
|||
|
||||
import java.util.Iterator;
|
||||
import java.util.UUID;
|
||||
import mage.MageObject;
|
||||
|
||||
import mage.Mana;
|
||||
import mage.abilities.Ability;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue