Fix facedown permanent with adventure (#4355)

* Restore adventure text when card not in play

* Remove obsolete code

* Fix crash with Cybership

* Fix NPE
This commit is contained in:
tool4ever
2023-12-15 09:58:30 +01:00
committed by GitHub
parent 023e41c8a0
commit 90c3a13e3d
10 changed files with 21 additions and 37 deletions

View File

@@ -635,8 +635,7 @@ public class AttachAi extends SpellAbilityAi {
}
// Cards that trigger on dealing damage
private static Card attachAICuriosityPreference(final SpellAbility sa, final List<Card> list, final boolean mandatory,
final Card attachSource) {
private static Card attachAICuriosityPreference(final SpellAbility sa, final List<Card> list, final boolean mandatory, final Card attachSource) {
Card chosen = null;
int priority = 0;
for (Card card : list) {
@@ -690,7 +689,6 @@ public class AttachAi extends SpellAbilityAi {
}
}
return chosen;
}
/**

View File

@@ -121,7 +121,7 @@ public class FogAi extends SpellAbilityAi {
int fogs = 0;
for (Card c : ai.getCardsActivatableInExternalZones(false)) {
for (SpellAbility ability : c.getSpellAbilities()) {
if (ability.getApi().equals(ApiType.Fog)) {
if (ApiType.Fog.equals(ability.getApi())) {
fogs++;
break;
}
@@ -130,7 +130,7 @@ public class FogAi extends SpellAbilityAi {
for (Card c : ai.getCardsIn(ZoneType.Hand)) {
for (SpellAbility ability : c.getSpellAbilities()) {
if (ability.getApi().equals(ApiType.Fog)) {
if (ApiType.Fog.equals(ability.getApi())) {
fogs++;
break;
}

View File

@@ -510,11 +510,6 @@ public class GameAction {
}
}
// if an adventureCard is put from Stack somewhere else, need to reset to Original State
if (copied.isAdventureCard() && ((zoneFrom != null && zoneFrom.is(ZoneType.Stack)) || !zoneTo.is(ZoneType.Stack))) {
copied.setState(CardStateName.Original, false);
}
GameEntityCounterTable table = new GameEntityCounterTable();
if (mergedCards != null) {
@@ -992,13 +987,13 @@ public class GameAction {
if (!lki.getController().equals(lki.getOwner())) {
game.getTriggerHandler().registerActiveLTBTrigger(lki);
}
}
final Map<AbilityKey, Object> runParams = AbilityKey.mapFromCard(c);
runParams.put(AbilityKey.CardLKI, lki);
runParams.put(AbilityKey.Origin, c.getZone().getZoneType().name());
game.getTriggerHandler().runTrigger(TriggerType.ChangesZone, runParams, false);
}
}
}
public final void controllerChangeZoneCorrection(final Card c) {
System.out.println("Correcting zone for " + c.toString());

View File

@@ -143,13 +143,13 @@ public class GameLogFormatter extends IGameEventVisitor.Base<GameLogEntry> {
for (final GameOutcome game : gamesPlayed) {
RegisteredPlayer player = game.getWinningPlayer();
int amount = winCount.containsKey(player) ? winCount.get(player) : 0;
int amount = winCount.getOrDefault(player, 0);
winCount.put(player, amount + 1);
}
final StringBuilder sb = new StringBuilder();
for (Entry<RegisteredPlayer, String> entry : players.entrySet()) {
int amount = winCount.containsKey(entry.getKey()) ? winCount.get(entry.getKey()) : 0;
int amount = winCount.getOrDefault(entry.getKey(), 0);
sb.append(entry.getValue()).append(": ").append(amount).append(" ");
}

View File

@@ -58,8 +58,6 @@ public enum PlanarDice {
}
PlanarDice res = results.get(0);
PlanarDice trigRes = res;
final Map<AbilityKey, Object> resRepParams = AbilityKey.mapFromAffected(roller);
resRepParams.put(AbilityKey.Result, res);
@@ -67,13 +65,13 @@ public enum PlanarDice {
case NotReplaced:
break;
case Updated: {
trigRes = (PlanarDice) resRepParams.get(AbilityKey.Result);
res = (PlanarDice) resRepParams.get(AbilityKey.Result);
break;
}
}
Map<AbilityKey, Object> runParams = AbilityKey.mapFromPlayer(roller);
runParams.put(AbilityKey.Result, trigRes);
runParams.put(AbilityKey.Result, res);
game.getTriggerHandler().runTrigger(TriggerType.PlanarDice, runParams, false);
// Also run normal RolledDie and RolledDieOnce triggers
@@ -98,7 +96,6 @@ public enum PlanarDice {
* @return enum equivalent
*/
public static PlanarDice smartValueOf(String value) {
final String valToCompate = value.trim();
for (final PlanarDice v : PlanarDice.values()) {
if (v.name().compareToIgnoreCase(valToCompate) == 0) {

View File

@@ -38,7 +38,6 @@ public abstract class TriggerReplacementBase extends CardTraitBase implements II
public Set<ZoneType> getActiveZone() {
return validHostZones;
}
public void setActiveZone(EnumSet<ZoneType> zones) {
validHostZones = zones;
}

View File

@@ -374,9 +374,8 @@ public class DigEffect extends SpellAbilityEffect {
for (Card c : movedCards) {
final ZoneType origin = c.getZone().getZoneType();
final PlayerZone zone = c.getOwner().getZone(destZone1);
if (zone.is(ZoneType.Library) || zone.is(ZoneType.PlanarDeck) || zone.is(ZoneType.SchemeDeck)) {
if (destZone1.equals(ZoneType.Library) || destZone1.equals(ZoneType.PlanarDeck) || destZone1.equals(ZoneType.SchemeDeck)) {
c = game.getAction().moveTo(destZone1, c, libraryPosition, sa);
} else {
Map<AbilityKey, Object> moveParams = AbilityKey.newMap();
@@ -410,7 +409,7 @@ public class DigEffect extends SpellAbilityEffect {
host.removeRemembered(c);
animate.setSVar("unanimateTimestamp", String.valueOf(game.getTimestamp()));
}
c = game.getAction().moveTo(zone, c, sa, moveParams);
c = game.getAction().moveTo(c.getController().getZone(destZone1), c, sa, moveParams);
if (destZone1.equals(ZoneType.Battlefield)) {
if (addToCombat(c, c.getController(), sa, "Attacking", "Blocking")) {
combatChanged = true;

View File

@@ -2682,11 +2682,6 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
continue;
}
// skip Basic Spells
if (sa.isSpell() && sa.isBasicSpell()) {
continue;
}
// should not print Spelldescription for Morph
if (sa.isCastFaceDown()) {
continue;
@@ -2704,6 +2699,8 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
sbSA.append(": ");
sbSA.append(sAbility);
sAbility = sbSA.toString();
} else if (sa.isSpell() && sa.isBasicSpell()) {
continue;
}
if (sa.getManaPart() != null) {

View File

@@ -1,8 +1,7 @@
Name:Blood for Bones
ManaCost:3 B
Types:Sorcery
A:SP$ ChangeZone | Cost$ 3 B Sac<1/Creature> | Origin$ Graveyard | Destination$ Battlefield | Hidden$ True | Mandatory$ True | ChangeType$ Creature.YouOwn | PrimaryPrompt$ Choose a creature card to return to the battlefield | ChangeTypeDesc$ creature | RememberChanged$ True | SubAbility$ DBChangeZone | SpellDescription$ Return a creature card from your graveyard to the battlefield, then return another creature card from your graveyard to your hand.
SVar:DBChangeZone:DB$ ChangeZone | Origin$ Graveyard | Destination$ Hand | Hidden$ True | Mandatory$ True | ChangeType$ Creature.YouOwn+IsNotRemembered | PrimaryPrompt$ Choose another creature card to return to your hand | ChangeNumDesc$ another | ChangeTypeDesc$ creature | SubAbility$ DBCleanup
SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True
A:SP$ ChangeZone | Cost$ 3 B Sac<1/Creature> | Origin$ Graveyard | Destination$ Battlefield | Hidden$ True | Mandatory$ True | ChangeType$ Creature.YouOwn | PrimaryPrompt$ Choose a creature card to return to the battlefield | ChangeTypeDesc$ creature | SubAbility$ DBChangeZone | SpellDescription$ Return a creature card from your graveyard to the battlefield, then return another creature card from your graveyard to your hand.
SVar:DBChangeZone:DB$ ChangeZone | Origin$ Graveyard | Destination$ Hand | Hidden$ True | Mandatory$ True | ChangeType$ Creature.YouOwn | PrimaryPrompt$ Choose another creature card to return to your hand | ChangeNumDesc$ another | ChangeTypeDesc$ creature
AI:RemoveDeck:Random
Oracle:As an additional cost to cast this spell, sacrifice a creature.\nReturn a creature card from your graveyard to the battlefield, then return another creature card from your graveyard to your hand.

View File

@@ -8,7 +8,7 @@ SVar:TrigToken:AB$ Token | Cost$ 1 ExileAnyGrave<1/Card.TriggeredNewCard> | Toke
SVar:DBAnimate:DB$ Animate | Defined$ Imprinted | Duration$ Permanent | Triggers$ CDTrigger
SVar:CDTrigger:Mode$ DamageDone | ValidSource$ Card.Self | ValidTarget$ Player | CombatDamage$ True | Execute$ TrigSac | TriggerZones$ Battlefield | TriggerDescription$ When this creature deals combat damage to a player, sacrifice it and return the exiled card to the battlefield tapped.
SVar:TrigSac:DB$ Sacrifice | SubAbility$ DBReturn
SVar:DBReturn:DB$ ChangeZone | Defined$ Remembered | Origin$ Exile | Destination$ Battlefield | Tapped$ True
SVar:DBReturn:DB$ ChangeZone | Defined$ Remembered | Origin$ Exile | Destination$ Battlefield | Tapped$ True | GainControl$ True
DeckNeeds:Type$Vampire
DeckHas:Ability$Token|Sacrifice
Oracle:Ward—Discard a card.\nWhenever another nontoken Vampire you control dies, you may pay {1} and exile it. If you do, create a 1/1 black Bat creature token with flying. It gains "When this creature deals combat damage to a player, sacrifice it and return the exiled card to the battlefield tapped."