mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 03:38:01 +00:00
MayPlay: fixed mayPlay with multiple static abilities
This commit is contained in:
@@ -177,6 +177,10 @@ public final class GameActionUtil {
|
||||
} else {
|
||||
sb.append(host);
|
||||
}
|
||||
|
||||
if (o.getAbility().hasParam("MayPlayText")) {
|
||||
sb.append(" (").append(o.getAbility().getParam("MayPlayText")).append(")");
|
||||
}
|
||||
}
|
||||
sb.append(o.toString(false));
|
||||
newSA.setDescription(sb.toString());
|
||||
|
||||
@@ -111,8 +111,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
private GameEntity mustAttackEntity = null;
|
||||
private GameEntity mustAttackEntityThisTurn = null;
|
||||
|
||||
private final Map<StaticAbility, CardPlayOption> mayPlay = Maps.newTreeMap();
|
||||
private int mayPlayTurn = 0;
|
||||
private final Map<StaticAbility, CardPlayOption> mayPlay = Maps.newHashMap();
|
||||
|
||||
// changes by AF animate and continuous static effects - timestamp is the key of maps
|
||||
private final Map<Long, CardChangedType> changedCardTypes = Maps.newTreeMap();
|
||||
@@ -2459,16 +2458,10 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
this.mayPlay.remove(sta);
|
||||
}
|
||||
|
||||
public int getMayPlayTurn() {
|
||||
return mayPlayTurn;
|
||||
}
|
||||
|
||||
public void incMayPlayTurn() {
|
||||
this.mayPlayTurn++;
|
||||
}
|
||||
|
||||
public void resetMayPlayTurn() {
|
||||
this.mayPlayTurn = 0;
|
||||
for (StaticAbility sta : getStaticAbilities()) {
|
||||
sta.resetMayPlayTurn();
|
||||
}
|
||||
}
|
||||
|
||||
public final CardCollectionView getEquippedBy(boolean allowModify) {
|
||||
|
||||
@@ -53,6 +53,7 @@ public class StaticAbility extends CardTraitBase implements Comparable<StaticAbi
|
||||
private final Set<StaticAbilityLayer> layers;
|
||||
private CardCollectionView ignoreEffectCards = new CardCollection();
|
||||
private final List<Player> ignoreEffectPlayers = Lists.newArrayList();
|
||||
private int mayPlayTurn = 0;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -724,6 +725,19 @@ public class StaticAbility extends CardTraitBase implements Comparable<StaticAbi
|
||||
return layers;
|
||||
}
|
||||
|
||||
|
||||
public int getMayPlayTurn() {
|
||||
return mayPlayTurn;
|
||||
}
|
||||
|
||||
public void incMayPlayTurn() {
|
||||
this.mayPlayTurn++;
|
||||
}
|
||||
|
||||
public void resetMayPlayTurn() {
|
||||
this.mayPlayTurn = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(StaticAbility arg0) {
|
||||
return getHostCard().compareTo(arg0.getHostCard());
|
||||
|
||||
@@ -750,7 +750,7 @@ public final class StaticAbilityContinuous {
|
||||
affectedCard.setMayLookAt(p, true);
|
||||
}
|
||||
}
|
||||
if (controllerMayPlay && (mayPlayLimit == null || hostCard.getMayPlayTurn() < mayPlayLimit)) {
|
||||
if (controllerMayPlay && (mayPlayLimit == null || stAb.getMayPlayTurn() < mayPlayLimit)) {
|
||||
Player mayPlayController = params.containsKey("MayPlayCardOwner") ? affectedCard.getOwner() : controller;
|
||||
affectedCard.setMayPlay(mayPlayController, mayPlayWithoutManaCost, mayPlayAltManaCost, mayPlayWithFlash, mayPlayGrantZonePermissions, stAb);
|
||||
}
|
||||
|
||||
@@ -457,7 +457,7 @@ public class MagicStack /* extends MyObservable */ implements Iterable<SpellAbil
|
||||
}
|
||||
|
||||
if (sp.isSpell() && sp.getMayPlay() != null) {
|
||||
sp.getMayPlay().getHostCard().incMayPlayTurn();
|
||||
sp.getMayPlay().incMayPlayTurn();
|
||||
}
|
||||
final SpellAbilityStackInstance si = new SpellAbilityStackInstance(sp);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user