Skip to content

Commit

Permalink
Cybership fix (#4638)
Browse files Browse the repository at this point in the history
* Cybership fix

* Fix check to avoid LKI for Mishra Meld
  • Loading branch information
tool4ever authored Feb 6, 2024
1 parent 4f38d02 commit 3d6bbad
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 26 deletions.
2 changes: 1 addition & 1 deletion forge-game/src/main/java/forge/game/GameAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ private Card changeZone(final Zone zoneFrom, Zone zoneTo, final Card c, Integer
CardCollection cards = new CardCollection(c.getMergedCards());
// replace top card with copied card for correct name for human to choose.
cards.set(cards.indexOf(c), copied);
// 723.3b
// 725.3b
if (cause != null && zoneTo.getZoneType() == ZoneType.Exile) {
cards = (CardCollection) cause.getHostCard().getController().getController().orderMoveToZoneList(cards, zoneTo.getZoneType(), cause);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -694,9 +694,7 @@ protected static boolean addToCombat(Card c, SpellAbility sa, String attackingPa
defender = sa.getActivatingPlayer().getController().chooseSingleEntityForEffect(defs, sa,
Localizer.getInstance().getMessage("lblChooseDefenderToAttackWithCard", CardTranslation.getTranslatedName(c.getName())), false, params);

final GameEntity originalDefender = combat.getDefenderByAttacker(c);
if (defender != null &&
(originalDefender == null || !originalDefender.equals(defender))) {
if (defender != null && !combat.getAttackersOf(defender).contains(c)) {
// we might be reselecting
combat.removeFromCombat(c);

Expand Down
31 changes: 18 additions & 13 deletions forge-game/src/main/java/forge/game/ability/effects/DigEffect.java
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,10 @@ protected String getStackDescription(SpellAbility sa) {
@Override
public void resolve(SpellAbility sa) {
final Card host = sa.getHostCard();
final Player player = sa.getActivatingPlayer();
final Game game = player.getGame();
final Player activator = sa.getActivatingPlayer();
final Game game = activator.getGame();
final Player cont = host.getController();
Player chooser = player;
Player chooser = activator;
int digNum = AbilityUtils.calculateAmount(host, sa.getParam("DigNum"), sa);

final ZoneType srcZone = sa.hasParam("SourceZone") ? ZoneType.smartValueOf(sa.getParam("SourceZone")) : ZoneType.Library;
Expand Down Expand Up @@ -215,7 +215,7 @@ else if (!sa.hasParam("NoLooking")) {

if (noMove) {
// Let the activating player see the cards even if they're not moved
game.getAction().revealTo(top, player);
game.getAction().revealTo(top, activator);
}
}

Expand All @@ -228,7 +228,7 @@ else if (!sa.hasParam("NoLooking")) {
if (sa.hasParam("Choser")) {
final FCollectionView<Player> choosers = AbilityUtils.getDefinedPlayers(host, sa.getParam("Choser"), sa);
if (!choosers.isEmpty()) {
chooser = player.getController().chooseSingleEntityForEffect(choosers, null, sa, Localizer.getInstance().getMessage("lblChooser") + ":", false, p, null);
chooser = activator.getController().chooseSingleEntityForEffect(choosers, null, sa, Localizer.getInstance().getMessage("lblChooser") + ":", false, p, null);
}
if (sa.hasParam("SetChosenPlayer")) {
host.setChosenPlayer(chooser);
Expand Down Expand Up @@ -258,7 +258,7 @@ else if (!sa.hasParam("NoLooking")) {

if (forceRevealToController) {
// Force revealing the card to the player activating the ability (e.g. Explorer's Scope)
game.getAction().revealTo(top, player);
game.getAction().revealTo(top, activator);
delayedReveal = null; // top is already seen by the player, do not reveal twice
}

Expand Down Expand Up @@ -368,7 +368,12 @@ else if (!sa.hasParam("NoLooking")) {
Collections.reverse(movedCards);

if (destZone1.equals(ZoneType.Battlefield) || destZone1.equals(ZoneType.Library)) {
movedCards = (CardCollection) GameActionUtil.orderCardsByTheirOwners(game, movedCards, destZone1, sa);
if (sa.hasParam("GainControl")) {
// for Cybership
movedCards = (CardCollection) activator.getController().orderMoveToZoneList(rest, destZone2, sa);
} else {
movedCards = (CardCollection) GameActionUtil.orderCardsByTheirOwners(game, movedCards, destZone1, sa);
}
}

Map<AbilityKey, Object> moveParams = AbilityKey.newMap();
Expand All @@ -390,12 +395,12 @@ else if (!sa.hasParam("NoLooking")) {
if (destZone1.equals(ZoneType.Battlefield)) {
moveParams.put(AbilityKey.SimultaneousETB, movedCards);
if (sa.hasParam("GainControl")) {
c.setController(player, game.getNextTimestamp());
c.setController(activator, game.getNextTimestamp());
}
if (sa.hasParam("WithCounter")) {
final int numCtr = AbilityUtils.calculateAmount(host,
sa.getParamOrDefault("WithCounterNum", "1"), sa);
c.addEtbCounter(CounterType.getType(sa.getParam("WithCounter")), numCtr, player);
c.addEtbCounter(CounterType.getType(sa.getParam("WithCounter")), numCtr, activator);
}
}
if (sa.hasAdditionalAbility("AnimateSubAbility")) {
Expand All @@ -415,7 +420,7 @@ else if (!sa.hasParam("NoLooking")) {
}
} else if (destZone1.equals(ZoneType.Exile)) {
if (sa.hasParam("ExileWithCounter")) {
c.addCounter(CounterType.getType(sa.getParam("ExileWithCounter")), 1, player, counterTable);
c.addCounter(CounterType.getType(sa.getParam("ExileWithCounter")), 1, activator, counterTable);
}
handleExiledWith(c, sa);
}
Expand All @@ -425,7 +430,7 @@ else if (!sa.hasParam("NoLooking")) {
c.turnFaceDown(true);
}
if (sa.hasParam("WithMayLook")) {
c.addMayLookFaceDownExile(player);
c.addMayLookFaceDownExile(activator);
}
if (sa.hasParam("Imprint")) {
host.addImprintedCard(c);
Expand Down Expand Up @@ -472,7 +477,7 @@ else if (!sa.hasParam("NoLooking")) {
c = game.getAction().moveTo(destZone2, c, sa, moveParams);
if (destZone2 == ZoneType.Exile) {
if (sa.hasParam("ExileWithCounter")) {
c.addCounter(CounterType.getType(sa.getParam("ExileWithCounter")), 1, player, counterTable);
c.addCounter(CounterType.getType(sa.getParam("ExileWithCounter")), 1, activator, counterTable);
}
handleExiledWith(c, sa);
if (remZone2) {
Expand All @@ -490,7 +495,7 @@ else if (!sa.hasParam("NoLooking")) {
game.updateCombatForView();
game.fireEvent(new GameEventCombatChanged());
}
//table trigger there

table.triggerChangesZoneAll(game, sa);
counterTable.replaceCounterEffect(game, sa, true);
}
Expand Down
1 change: 0 additions & 1 deletion forge-game/src/main/java/forge/game/combat/Combat.java
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,6 @@ public final Player getDefenderPlayerByAttacker(final Card c) {
} else {
return def.getController();
}

}

return null;
Expand Down
4 changes: 2 additions & 2 deletions forge-gui/res/cardsfolder/a/anoint_with_affliction.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Name:Anoint with Affliction
ManaCost:1 B
Types:Instant
A:SP$ ChangeZone | Defined$ Targeted | ValidTgts$ Creature | ConditionCheckSVar$ X | CondtionSVarCompare$ GE3 | Origin$ Battlefield | Destination$ Exile | SubAbility$ NotPoisoned | SpellDescription$ Exile target creature if it has mana value 3 or less. Corrupted — Exile that creature instead if its controller has three or more poison counters.
SVar:NotPoisoned:DB$ ChangeZone | Defined$ Targeted | Origin$ Battlefield | Destination$ Exile | ConditionDefined$ Targeted | ConditionPresent$ Permanent.nonLand+cmcLE3
A:SP$ ChangeZone | Defined$ Targeted | ValidTgts$ Creature | ConditionCheckSVar$ X | ConditionSVarCompare$ GE3 | Origin$ Battlefield | Destination$ Exile | SubAbility$ NotPoisoned | SpellDescription$ Exile target creature if it has mana value 3 or less. Corrupted — Exile that creature instead if its controller has three or more poison counters.
SVar:NotPoisoned:DB$ ChangeZone | Defined$ Targeted | Origin$ Battlefield | Destination$ Exile | ConditionDefined$ Targeted | ConditionPresent$ Creature.cmcLE3
DeckHints:Ability$Proliferate & Keyword$Infect|Toxic
SVar:X:TargetedController$PoisonCounters
Oracle:Exile target creature if it has mana value 3 or less.\nCorrupted — Exile that creature instead if its controller has three or more poison counters.
2 changes: 1 addition & 1 deletion forge-gui/res/cardsfolder/c/cybership.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ K:Crew:4
T:Mode$ DamageDone | ValidSource$ Card.Self | ValidTarget$ Player | Execute$ TrigDig | CombatDamage$ True | TriggerDescription$ Whenever CARDNAME deals combat damage to a player, put the top two cards of that player's library onto the battlefield face down under your control. They're 2/2 Cyberman artifact creatures.
SVar:TrigDig:DB$ Dig | Defined$ TriggeredTarget | DigNum$ 2 | GainControl$ True | ChangeNum$ All | DestinationZone$ Battlefield | FaceDown$ True | FaceDownPower$ 2 | FaceDownToughness$ 2 | FaceDownSetType$ Artifact & Creature & Cyberman
DeckHas:Type$Cyberman
Oracle:Flying\nWhenever Cybership deals combat damage to a player, put the top two cards of that players library onto the battlefield face down under your control. They're 2/2 Cyberman artifact creatures.\nCrew 4
Oracle:Flying\nWhenever Cybership deals combat damage to a player, put the top two cards of that player's library onto the battlefield face down under your control. They're 2/2 Cyberman artifact creatures.\nCrew 4
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Name:Mishra, Claimed by Gix
ManaCost:2 B R
Types:Legendary Creature Phyrexian Human Artificer
PT:3/5
T:Mode$ AttackersDeclared | AttackingPlayer$ You | AttackedTarget$ Player,Planeswalker | Execute$ TrigDrain | TriggerZones$ Battlefield | TriggerDescription$ Whenever you attack, each opponent loses X life and you gain X life, where X is the number of attacking creatures. If CARDNAME and a creature named Phyrexian Dragon Engine are attacking, and you both own and control them, exile them, then meld them into Mishra, Lost to Phyrexia. It enters the battlefield tapped and attacking
T:Mode$ AttackersDeclared | AttackingPlayer$ You | AttackedTarget$ Player,Planeswalker | Execute$ TrigDrain | TriggerZones$ Battlefield | TriggerDescription$ Whenever you attack, each opponent loses X life and you gain X life, where X is the number of attacking creatures. If CARDNAME and a creature named Phyrexian Dragon Engine are attacking, and you both own and control them, exile them, then meld them into Mishra, Lost to Phyrexia. It enters the battlefield tapped and attacking.
SVar:TrigDrain:DB$ LoseLife | Defined$ Player.Opponent | LifeAmount$ X | SubAbility$ DBGainLife
SVar:DBGainLife:DB$ GainLife | LifeAmount$ X | SubAbility$ Meld
SVar:Meld:DB$ Meld | ConditionPresent$ Card.Self+YouCtrl+YouOwn+attacking | ConditionCheckSVar$ Y | Name$ Mishra, Lost to Phyrexia | Tapped$ True | Attacking$ True | Primary$ Mishra, Claimed by Gix | Secondary$ Phyrexian Dragon Engine
Expand All @@ -21,8 +21,8 @@ ManaCost:no cost
Types:Legendary Artifact Creature Phyrexian Artificer
PT:9/9
Colors:black,red
T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigCharm | TriggerDescription$ Whenever CARDNAME enters the battlefield or attacks, ABILITY.
T:Mode$ Attacks | ValidCard$ Card.Self | Execute$ TrigCharm | TriggerZones$ Battlefield | Secondary$ True | TriggerDescription$ Whenever CARDNAME enters the battlefield or attacks, ABILITY.
T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigCharm | TriggerDescription$ Whenever CARDNAME enters the battlefield or attacks, ABILITY
T:Mode$ Attacks | ValidCard$ Card.Self | Execute$ TrigCharm | TriggerZones$ Battlefield | Secondary$ True | TriggerDescription$ Whenever CARDNAME enters the battlefield or attacks, ABILITY
SVar:TrigCharm:DB$ Charm | Choices$ DBDamage,DBDestroy,DBPump,DBCurse,DBToken | CharmNum$ 3
SVar:DBDamage:DB$ DealDamage | NumDmg$ 3 | ValidTgts$ Any | SpellDescription$ NICKNAME deals 3 damage to any target.
SVar:DBDestroy:DB$ Destroy | TargetMax$ 1 | ValidTgts$ Artifact,Planeswalker | TgtPrompt$ Select target artifact or planeswalker | SpellDescription$ Destroy target artifact or planeswalker
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ S:Mode$ Continuous | Affected$ Creature.YouCtrl+Other | AddKeyword$ Haste | Desc
T:Mode$ DamageDoneOnce | CombatDamage$ True | ValidSource$ Creature.faceDown+YouCtrl | ValidTarget$ Player | TriggerZones$ Battlefield | Execute$ TrigDraw | TriggerDescription$ Whenever one or more face-down creatures you control deal combat damage to a player, draw a card.
SVar:TrigDraw:DB$ Draw | NumCards$ 1
T:Mode$ ChangesZone | Origin$ Battlefield | Destination$ Graveyard | ValidCard$ Creature.faceDown+YouCtrl | TriggerZones$ Battlefield | Execute$ TrigReturn | TriggerDescription$ Whenever a face-down creature you control dies, return it to the battlefield face down under its owner's control if it's a permanent card, then turn it face up.
SVar:TrigReturn:DB$ ChangeZone | Origin$ Graveyard | Destination$ Battlefield | RememberChanged$ True | Defined$ TriggeredCard | SubAbility$ DBTurnFaceUp | ConditionDefined$ TriggeredCard | ConditionPresent$ Card.Permanent
SVar:TrigReturn:DB$ ChangeZone | Origin$ Graveyard | Destination$ Battlefield | FaceDown$ True | RememberChanged$ True | Defined$ TriggeredNewCardLKICopy | SubAbility$ DBTurnFaceUp | ConditionDefined$ TriggeredCard | ConditionPresent$ Card.Permanent
SVar:DBTurnFaceUp:DB$ SetState | Defined$ Remembered | Mode$ TurnFaceUp | SubAbility$ DBCleanup
SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True
DeckHints:Keyword$Morph|Disguise
Expand Down
2 changes: 1 addition & 1 deletion forge-gui/res/cardsfolder/w/wilfred_mott.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Types:Legendary Creature Human Soldier
PT:2/4
T:Mode$ Phase | Phase$ Upkeep | ValidPlayer$ You | TriggerZones$ Battlefield | Execute$ TrigPutCounter | TriggerDescription$ Look to the Stars — At the beginning of your upkeep, put a time counter on CARDNAME. Then look at the top X cards of your library, where X is the number of time counters on CARDNAME. You may put a nonland permanent card with mana value 3 or less from among them onto the battlefield. Put the rest on the bottom of your library in a random order.
SVar:TrigPutCounter:DB$ PutCounter | Defined$ Self | CounterType$ TIME | CounterNum$ 1 | SubAbility$ DBDig
SVar:DBDig:DB$ Dig | DigNum$ X | ChangeNum$ 1 | Optional$ True | ChangeValid$ Card.nonLand+cmcLE3 | DestinationZone$ Battlefield | RestRandomOrder$ True
SVar:DBDig:DB$ Dig | DigNum$ X | ChangeNum$ 1 | Optional$ True | ChangeValid$ Permanent.nonLand+cmcLE3 | DestinationZone$ Battlefield | RestRandomOrder$ True
SVar:X:Count$CardCounters.Time
DeckHas:Ability$Counters
Oracle:Look to the Stars — At the beginning of your upkeep, put a time counter on Wilfred Mott. Then look at the top X cards of your library, where X is the number of time counters on Wilfred Mott. You may put a nonland permanent card with mana value 3 or less from among them onto the battlefield. Put the rest on the bottom of your library in a random order.

0 comments on commit 3d6bbad

Please sign in to comment.