Merge branch 'shaileEnterUnder' into 'master'

Card: add turnInController to keep track under which control it entered

See merge request core-developers/forge!4282
This commit is contained in:
Michael Kamensky
2021-03-27 12:14:09 +00:00
5 changed files with 51 additions and 13 deletions

View File

@@ -133,7 +133,7 @@ public class GameAction {
return c;
}
if (zoneFrom == null && !c.isToken()) {
zoneTo.add(c, position);
zoneTo.add(c, position, CardUtil.getLKICopy(c));
checkStaticAbilities();
game.getTriggerHandler().registerActiveTrigger(c, true);
game.fireEvent(new GameEventCardChangeZone(c, zoneFrom, zoneTo));
@@ -471,7 +471,7 @@ public class GameAction {
if (card == c) {
zoneTo.add(copied, position, lastKnownInfo); // the modified state of the card is also reported here (e.g. for Morbid + Awaken)
} else {
zoneTo.add(card, position);
zoneTo.add(card, position, CardUtil.getLKICopy(card));
}
card.setZone(zoneTo);
}
@@ -598,8 +598,6 @@ public class GameAction {
copied.setState(CardStateName.Original, true);
}
unattachCardLeavingBattlefield(copied);
// Remove all changed keywords
copied.removeAllChangedText(game.getNextTimestamp());
} else if (toBattlefield) {
// reset timestamp in changezone effects so they have same timestamp if ETB simutaneously
copied.setTimestamp(game.getNextTimestamp());

View File

@@ -285,6 +285,8 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
private int regeneratedThisTurn = 0;
private int turnInZone;
// the player that under which control it enters
private Player turnInController = null;
private Map<String, Integer> xManaCostPaidByColor;
@@ -1631,6 +1633,14 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
turnInZone = turn;
}
public final Player getTurnInController() {
return turnInController;
}
public final void setTurnInController(final Player p) {
turnInController = p;
}
public final void setManaCost(final ManaCost s) {
currentState.setManaCost(s);
}
@@ -4273,13 +4283,6 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
updateChangedText();
}
public final void removeAllChangedText(final Long timestamp) {
changedTextTypes.removeAll();
changedTextColors.removeAll();
updateKeywordsOnRemoveChangedText(removeChangedCardKeywords(timestamp));
updateChangedText();
}
private void updateKeywordsChangedText(final Long timestamp) {
if (hasSVar("LockInKeywords")) {
return;

View File

@@ -1002,6 +1002,18 @@ public class CardProperty {
}
}
return false;
} else if (property.startsWith("EnteredUnder")) {
Player u = card.getTurnInController();
if (u == null) {
return false;
}
final String valid = property.substring(13);
if (!u.isValid(valid, sourceController, source, spellAbility)) {
final List<Player> lp = AbilityUtils.getDefinedPlayers(source, valid, spellAbility);
if (!lp.contains(u)) {
return false;
}
}
} else if (property.equals("EnteredSinceYourLastTurn")) {
if (card.getTurnInZone() <= sourceController.getLastTurnNr()) {
return false;

View File

@@ -108,13 +108,15 @@ public class Zone implements java.io.Serializable, Iterable<Card> {
final Zone oldZone = game.getZoneOf(c);
final ZoneType zt = oldZone == null ? ZoneType.Stack : oldZone.getZoneType();
// only if the zoneType differss from this
// only if the zoneType differs from this
// don't go in there is its a control change
if (zt != zoneType) {
c.setTurnInController(getPlayer());
c.setTurnInZone(game.getPhaseHandler().getTurn());
cardsAddedThisTurn.add(zt, latestState != null ? latestState : c);
}
}
c.setTurnInZone(game.getPhaseHandler().getTurn());
if (zoneType != ZoneType.Battlefield) {
c.setTapped(false);
}

View File

@@ -0,0 +1,23 @@
Name:Shaile, Dean of Radiance
ManaCost:1 W
Types:Legendary Creature Bird Cleric
PT:1/1
K:Flying
K:Vigilance
A:AB$ PutCounterAll | Cost$ T | ValidCards$ Creature.ThisTurnEntered+EnteredUnder You | CounterType$ P1P1 | CounterNum$ 1 | SpellDescription$ Put a +1/+1 counter on each creature that entered the battlefield under your control this turn.
DeckHas:Ability$Counters
AlternateMode:Modal
Oracle:Flying, vigilance\n{T}: Put a +1/+1 counter on each creature that entered the battlefield under your control this turn.
ALTERNATE
Name:Embrose, Dean of Shadow
ManaCost:2 B B
Types:Legendary Creature Human Warlock
PT:4/4
A:AB$ PutCounter | Cost$ T | ValidTgts$ Creature.Other | TgtPrompt$ Select another target creature | CounterType$ P1P1 | CounterNum$ 1 | SubAbility$ DBDmg | SpellDescription$ Put a +1/+1 counter on another target creature, then CARDNAME deals 2 damage to that creature.
SVar:DBDmg:DB$ DealDamage | Defined$ ParentTarget | NumDmg$ 2 | StackDescription$ None
T:Mode$ ChangesZone | Origin$ Battlefield | Destination$ Graveyard | ValidCard$ Creature.YouCtrl+counters_GE1_P1P1 | TriggerZones$ Battlefield | Execute$ TrigDraw | TriggerDescription$ Whenever a creature you control with a +1/+1 counter on it dies, draw a card.
SVar:TrigDraw:DB$ Draw | Defined$ You | NumCards$ 1
Oracle:{T}: Put a +1/+1 counter on another target creature, then Embrose, Dean of Shadow deals 2 damage to that creature.\nWhenever a creature you control with a +1/+1 counter on it dies, draw a card.