Fix Cellar Door

This commit is contained in:
tool4EvEr
2023-08-01 19:08:25 +02:00
parent dff8492bf8
commit 50900dbab2
6 changed files with 12 additions and 29 deletions

View File

@@ -24,7 +24,6 @@ public class MillEffect extends SpellAbilityEffect {
final Card source = sa.getHostCard(); final Card source = sa.getHostCard();
final Game game = source.getGame(); final Game game = source.getGame();
final int numCards = sa.hasParam("NumCards") ? AbilityUtils.calculateAmount(sa.getHostCard(), sa.getParam("NumCards"), sa) : 1; final int numCards = sa.hasParam("NumCards") ? AbilityUtils.calculateAmount(sa.getHostCard(), sa.getParam("NumCards"), sa) : 1;
final boolean bottom = sa.hasParam("FromBottom");
final boolean facedown = sa.hasParam("ExileFaceDown"); final boolean facedown = sa.hasParam("ExileFaceDown");
final boolean reveal = !sa.hasParam("NoReveal"); final boolean reveal = !sa.hasParam("NoReveal");
final boolean showRevealDialog = sa.hasParam("ShowMilledCards"); final boolean showRevealDialog = sa.hasParam("ShowMilledCards");
@@ -55,7 +54,7 @@ public class MillEffect extends SpellAbilityEffect {
continue; continue;
} }
} }
final CardCollectionView milled = p.mill(numCards, destination, bottom, sa, table, moveParams); final CardCollectionView milled = p.mill(numCards, destination, sa, table, moveParams);
// Reveal the milled cards, so players don't have to manually inspect the // Reveal the milled cards, so players don't have to manually inspect the
// graveyard to figure out which ones were milled. // graveyard to figure out which ones were milled.
if (!facedown && reveal) { // do not reveal when exiling face down if (!facedown && reveal) { // do not reveal when exiling face down

View File

@@ -94,7 +94,7 @@ public class CostMill extends CostPart {
Map<AbilityKey, Object> moveParams = AbilityKey.newMap(); Map<AbilityKey, Object> moveParams = AbilityKey.newMap();
moveParams.put(AbilityKey.LastStateBattlefield, ai.getGame().getLastStateBattlefield()); moveParams.put(AbilityKey.LastStateBattlefield, ai.getGame().getLastStateBattlefield());
moveParams.put(AbilityKey.LastStateGraveyard, ai.getGame().getLastStateGraveyard()); moveParams.put(AbilityKey.LastStateGraveyard, ai.getGame().getLastStateGraveyard());
ability.getPaidHash().put("Milled", true, (CardCollection) ai.mill(decision.c, ZoneType.Graveyard, false, ability, table, moveParams)); ability.getPaidHash().put("Milled", true, (CardCollection) ai.mill(decision.c, ZoneType.Graveyard, ability, table, moveParams));
table.triggerChangesZoneAll(ai.getGame(), ability); table.triggerChangesZoneAll(ai.getGame(), ability);
return true; return true;
} }

View File

@@ -1594,11 +1594,7 @@ public class Player extends GameEntity implements Comparable<Player> {
return notedNum.get(notedFor); return notedNum.get(notedFor);
} }
public final CardCollectionView mill(int n, final ZoneType destination, public final CardCollectionView mill(int n, final ZoneType destination, SpellAbility sa, CardZoneTable table, Map<AbilityKey, Object> params) {
final boolean bottom, SpellAbility sa, CardZoneTable table, Map<AbilityKey, Object> params) {
final CardCollectionView lib = getCardsIn(ZoneType.Library);
final CardCollection milled = new CardCollection();
// Replacement effects // Replacement effects
final Map<AbilityKey, Object> repRunParams = AbilityKey.mapFromAffected(this); final Map<AbilityKey, Object> repRunParams = AbilityKey.mapFromAffected(this);
repRunParams.put(AbilityKey.Number, n); repRunParams.put(AbilityKey.Number, n);
@@ -1606,7 +1602,7 @@ public class Player extends GameEntity implements Comparable<Player> {
repRunParams.putAll(params); repRunParams.putAll(params);
} }
if (destination == ZoneType.Graveyard && !bottom) { if (destination == ZoneType.Graveyard) {
switch (getGame().getReplacementHandler().run(ReplacementType.Mill, repRunParams)) { switch (getGame().getReplacementHandler().run(ReplacementType.Mill, repRunParams)) {
case NotReplaced: case NotReplaced:
break; break;
@@ -1615,24 +1611,15 @@ public class Player extends GameEntity implements Comparable<Player> {
if (this.equals(repRunParams.get(AbilityKey.Affected))) { if (this.equals(repRunParams.get(AbilityKey.Affected))) {
n = (int) repRunParams.get(AbilityKey.Number); n = (int) repRunParams.get(AbilityKey.Number);
} else { } else {
return milled; return CardCollection.EMPTY;
} }
break; break;
default: default:
return milled; return CardCollection.EMPTY;
}
}
final int max = Math.min(n, lib.size());
for (int i = 0; i < max; i++) {
if (bottom) {
milled.add(lib.get(lib.size() - i - 1));
} else {
milled.add(lib.get(i));
} }
} }
CardCollection milled = getTopXCardsFromLibrary(n);
CardCollectionView milledView = milled; CardCollectionView milledView = milled;
if (destination == ZoneType.Graveyard) { if (destination == ZoneType.Graveyard) {

View File

@@ -2,10 +2,9 @@ Name:Call the Coppercoats
ManaCost:2 W ManaCost:2 W
Types:Instant Types:Instant
K:Strive:1 W K:Strive:1 W
A:SP$ RepeatEach | Cost$ 2 W | ValidTgts$ Opponent | TargetMin$ 0 | TargetMax$ MaxTargets | TgtPrompt$ Choose any number of target opponents | RepeatPlayers$ Targeted | RepeatSubAbility$ DBToken | SpellDescription$ Choose any number of target opponents. Create X 1/1 white Human Soldier creature tokens, where X is the number of creatures those opponents control. A:SP$ Token | TokenAmount$ X | TokenScript$ w_1_1_human_soldier | TokenOwner$ You | ValidTgts$ Opponent | TargetMin$ 0 | TargetMax$ MaxTargets | TgtPrompt$ Choose any number of target opponents | SpellDescription$ Choose any number of target opponents. Create X 1/1 white Human Soldier creature tokens, where X is the number of creatures those opponents control.
SVar:MaxTargets:PlayerCountOpponents$Amount SVar:MaxTargets:PlayerCountOpponents$Amount
SVar:DBToken:DB$ Token | TokenAmount$ X | TokenScript$ w_1_1_human_soldier | TokenOwner$ You SVar:X:Count$Valid Creature.TargetedPlayerCtrl
SVar:X:Count$Valid Creature.RememberedPlayerCtrl
DeckHas:Ability$Token DeckHas:Ability$Token
AI:RemoveDeck:All AI:RemoveDeck:All
Oracle:Strive — This spell costs {1}{W} more to cast for each target beyond the first.\nChoose any number of target opponents. Create X 1/1 white Human Soldier creature tokens, where X is the number of creatures those opponents control. Oracle:Strive — This spell costs {1}{W} more to cast for each target beyond the first.\nChoose any number of target opponents. Create X 1/1 white Human Soldier creature tokens, where X is the number of creatures those opponents control.

View File

@@ -1,7 +1,7 @@
Name:Cellar Door Name:Cellar Door
ManaCost:2 ManaCost:2
Types:Artifact Types:Artifact
A:AB$ Mill | Cost$ 3 T | NumCards$ 1 | ValidTgts$ Player | TgtPrompt$ Choose a player | FromBottom$ True | RememberMilled$ True | SubAbility$ DBToken | StackDescription$ {p:Targeted} puts the bottom card of their library into their graveyard. | SpellDescription$ Target player puts the bottom card of their library into their graveyard. If it's a creature card, you create a 2/2 black Zombie creature token. A:AB$ Dig | Cost$ 3 T | DigNum$ 1 | ChangeNum$ All | ValidTgts$ Player | FromBottom$ True | DestinationZone$ Graveyard | RememberChanged$ True | SubAbility$ DBToken | StackDescription$ {p:Targeted} puts the bottom card of their library into their graveyard. | SpellDescription$ Target player puts the bottom card of their library into their graveyard. If it's a creature card, you create a 2/2 black Zombie creature token.
SVar:DBToken:DB$ Token | TokenScript$ b_2_2_zombie | TokenOwner$ You | TokenAmount$ 1 | ConditionDefined$ Remembered | ConditionPresent$ Creature | ConditionCompare$ EQ1 | SubAbility$ DBCleanup | StackDescription$ If it's a creature card, {p:You} creates a 2/2 black Zombie creature token. | SpellDescription$ If it's a creature card, you create a 2/2 black Zombie creature token. SVar:DBToken:DB$ Token | TokenScript$ b_2_2_zombie | TokenOwner$ You | TokenAmount$ 1 | ConditionDefined$ Remembered | ConditionPresent$ Creature | ConditionCompare$ EQ1 | SubAbility$ DBCleanup | StackDescription$ If it's a creature card, {p:You} creates a 2/2 black Zombie creature token. | SpellDescription$ If it's a creature card, you create a 2/2 black Zombie creature token.
SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True
Oracle:{3}, {T}: Target player puts the bottom card of their library into their graveyard. If it's a creature card, you create a 2/2 black Zombie creature token. Oracle:{3}, {T}: Target player puts the bottom card of their library into their graveyard. If it's a creature card, you create a 2/2 black Zombie creature token.

View File

@@ -4,10 +4,8 @@ Types:Artifact Creature Equipment Ogre
PT:2/2 PT:2/2
K:Reconfigure:3 K:Reconfigure:3
S:Mode$ Continuous | Affected$ Creature.EquippedBy | AddPower$ 2 | AddToughness$ 2 | Description$ Equipped creature gets +2/+2. S:Mode$ Continuous | Affected$ Creature.EquippedBy | AddPower$ 2 | AddToughness$ 2 | Description$ Equipped creature gets +2/+2.
T:Mode$ DamageDone | ValidSource$ Card.Self | ValidTarget$ Player | CombatDamage$ True | Execute$ TrigDiscard1 | TriggerDescription$ Whenever CARDNAME or equipped creature deals combat damage to a player, you may sacrifice it. If you do, discard your hand, then draw three cards. T:Mode$ DamageDone | ValidSource$ Card.Self,Creature.EquippedBy | ValidTarget$ Player | CombatDamage$ True | Execute$ TrigDiscard | TriggerDescription$ Whenever CARDNAME or equipped creature deals combat damage to a player, you may sacrifice it. If you do, discard your hand, then draw three cards.
T:Mode$ DamageDone | ValidSource$ Creature.EquippedBy | ValidTarget$ Player | CombatDamage$ True | Execute$ TrigDiscard2 | Secondary$ True | TriggerDescription$ Whenever CARDNAME or equipped creature deals combat damage to a player, you may sacrifice it. If you do, discard your hand, then draw three cards. SVar:TrigDiscard:AB$ Discard | Cost$ Sac<1/Card.TriggeredSource> | Mode$ Hand | SubAbility$ DBDraw
SVar:TrigDiscard1:AB$ Discard | Cost$ Sac<1/CARDNAME> | Mode$ Hand | SubAbility$ DBDraw
SVar:TrigDiscard2:AB$ Discard | Cost$ Sac<1/Creature.EquippedBy/equipped creature> | Mode$ Hand | SubAbility$ DBDraw
SVar:DBDraw:DB$ Draw | NumCards$ 3 SVar:DBDraw:DB$ Draw | NumCards$ 3
DeckHas:Ability$Sacrifice|Discard DeckHas:Ability$Sacrifice|Discard
Oracle:Equipped creature gets +2/+2.\nWhenever Ogre-Head Helm or equipped creature deals combat damage to a player, you may sacrifice it. If you do, discard your hand, then draw three cards.\nReconfigure {3} ({3}: Attach to target creature you control; or unattach from a creature. Reconfigure only as a sorcery. While attached, this isn't a creature.) Oracle:Equipped creature gets +2/+2.\nWhenever Ogre-Head Helm or equipped creature deals combat damage to a player, you may sacrifice it. If you do, discard your hand, then draw three cards.\nReconfigure {3} ({3}: Attach to target creature you control; or unattach from a creature. Reconfigure only as a sorcery. While attached, this isn't a creature.)