From 1eee0f967c3157c01ec27f50de9110519b6903bb Mon Sep 17 00:00:00 2001
From: swordshine
Date: Tue, 11 Jun 2013 04:21:29 +0000
Subject: [PATCH] - Added Time and Tide, Amulet of Quoz
---
.gitattributes | 2 ++
res/cardsfolder/a/amulet_of_quoz.txt | 13 ++++++++
res/cardsfolder/t/time_and_tide.txt | 6 ++++
.../java/forge/card/ability/ai/MillAi.java | 8 +++++
.../card/ability/effects/MillEffect.java | 6 ++++
.../card/ability/effects/PhasesEffect.java | 33 ++++++++++++++++---
src/main/java/forge/game/Game.java | 12 +++++++
7 files changed, 75 insertions(+), 5 deletions(-)
create mode 100644 res/cardsfolder/a/amulet_of_quoz.txt
create mode 100644 res/cardsfolder/t/time_and_tide.txt
diff --git a/.gitattributes b/.gitattributes
index de243860373..07599c99019 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -264,6 +264,7 @@ res/cardsfolder/a/amrou_scout.txt svneol=native#text/plain
res/cardsfolder/a/amrou_seekers.txt svneol=native#text/plain
res/cardsfolder/a/amugaba.txt svneol=native#text/plain
res/cardsfolder/a/amulet_of_kroog.txt svneol=native#text/plain
+res/cardsfolder/a/amulet_of_quoz.txt -text
res/cardsfolder/a/amulet_of_unmaking.txt svneol=native#text/plain
res/cardsfolder/a/amulet_of_vigor.txt svneol=native#text/plain
res/cardsfolder/a/an_havva_constable.txt svneol=native#text/plain
@@ -11348,6 +11349,7 @@ res/cardsfolder/t/timbermare.txt svneol=native#text/plain
res/cardsfolder/t/timbermaw_larva.txt svneol=native#text/plain
res/cardsfolder/t/timberpack_wolf.txt -text
res/cardsfolder/t/timberwatch_elf.txt svneol=native#text/plain
+res/cardsfolder/t/time_and_tide.txt -text
res/cardsfolder/t/time_bomb.txt svneol=native#text/plain
res/cardsfolder/t/time_ebb.txt svneol=native#text/plain
res/cardsfolder/t/time_elemental.txt svneol=native#text/plain
diff --git a/res/cardsfolder/a/amulet_of_quoz.txt b/res/cardsfolder/a/amulet_of_quoz.txt
new file mode 100644
index 00000000000..810ca397724
--- /dev/null
+++ b/res/cardsfolder/a/amulet_of_quoz.txt
@@ -0,0 +1,13 @@
+Name:Amulet of Quoz
+ManaCost:6
+Types:Artifact
+K:Remove CARDNAME from your deck before playing if you're not playing for ante.
+A:AB$ Mill | Cost$ T Sac<1/CARDNAME> | ValidTgts$ Opponent | Destination$ Ante | NumCards$ 1 | RememberMilled$ True | Optional$ True | SubAbility$ DBFlip | PlayerTurn$ True | ActivationPhases$ Upkeep | SpellDescription$ Target opponent may add the top card of his or her library to the ante. If he or she doesn't, you flip a coin. If you win the flip, that player loses the game. If you lose the flip, you lose the game. Activate this ability only during your upkeep.
+SVar:DBFlip:DB$ FlipACoin | Caller$ You | WinSubAbility$ OppLoseGame | LoseSubAbility$ YouLoseGame | ConditionDefined$ Remembered | ConditionPresent$ Card | ConditionCompare$ EQ0 | SubAbility$ DBCleanup
+SVar:OppLoseGame:DB$ LosesGame | Defined$ Targeted
+SVar:YouLoseGame:DB$ LosesGame | Defined$ You
+SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True
+SVar:RemAIDeck:True
+SVar:RemRandomDeck:True
+SVar:Picture:http://www.wizards.com/global/images/magic/general/amulet_of_quoz.jpg
+Oracle:Remove Amulet of Quoz from your deck before playing if you're not playing for ante.\n{T}, Sacrifice Amulet of Quoz: Target opponent may add the top card of his or her library to the ante. If he or she doesn't, you flip a coin. If you win the flip, that player loses the game. If you lose the flip, you lose the game. Activate this ability only during your upkeep.
diff --git a/res/cardsfolder/t/time_and_tide.txt b/res/cardsfolder/t/time_and_tide.txt
new file mode 100644
index 00000000000..39db3e06f37
--- /dev/null
+++ b/res/cardsfolder/t/time_and_tide.txt
@@ -0,0 +1,6 @@
+Name:Time and Tide
+ManaCost:U U
+Types:Instant
+A:SP$ Phases | Cost$ U U | AllValid$ Creature | PhaseInOrOutAll$ True | SpellDescription$ Simultaneously, all phased-out creatures phase in and all creatures with phasing phase out.
+SVar:Picture:http://www.wizards.com/global/images/magic/general/time_and_tide.jpg
+Oracle:Simultaneously, all phased-out creatures phase in and all creatures with phasing phase out.
diff --git a/src/main/java/forge/card/ability/ai/MillAi.java b/src/main/java/forge/card/ability/ai/MillAi.java
index 155c56a2a96..04f63f7162b 100644
--- a/src/main/java/forge/card/ability/ai/MillAi.java
+++ b/src/main/java/forge/card/ability/ai/MillAi.java
@@ -14,6 +14,7 @@ import forge.game.ai.ComputerUtilCost;
import forge.game.ai.ComputerUtilMana;
import forge.game.phase.PhaseType;
import forge.game.player.Player;
+import forge.game.player.PlayerActionConfirmMode;
import forge.game.zone.ZoneType;
import forge.util.MyRandom;
@@ -155,4 +156,11 @@ public class MillAi extends SpellAbilityAi {
return true;
}
+ /* (non-Javadoc)
+ * @see forge.card.ability.SpellAbilityAi#confirmAction(forge.game.player.Player, forge.card.spellability.SpellAbility, forge.game.player.PlayerActionConfirmMode, java.lang.String)
+ */
+ @Override
+ public boolean confirmAction(Player player, SpellAbility sa, PlayerActionConfirmMode mode, String message) {
+ return true;
+ }
}
diff --git a/src/main/java/forge/card/ability/effects/MillEffect.java b/src/main/java/forge/card/ability/effects/MillEffect.java
index 1f98148b084..9381a458d0c 100644
--- a/src/main/java/forge/card/ability/effects/MillEffect.java
+++ b/src/main/java/forge/card/ability/effects/MillEffect.java
@@ -32,6 +32,12 @@ public class MillEffect extends SpellAbilityEffect {
for (final Player p : getTargetPlayers(sa)) {
if ((tgt == null) || p.canBeTargetedBy(sa)) {
+ if (sa.hasParam("Optional")) {
+ final String prompt = String.format("Do you want to put card(s) from library to %s?", destination);
+ if (!p.getController().confirmAction(sa, null, prompt)) {
+ continue;
+ }
+ }
final List milled = p.mill(numCards, destination, bottom);
if (destination.equals(ZoneType.Exile) && sa.hasParam("ExileFaceDown")) {
for (final Card c : milled) {
diff --git a/src/main/java/forge/card/ability/effects/PhasesEffect.java b/src/main/java/forge/card/ability/effects/PhasesEffect.java
index 93fb63e8470..004e762199e 100644
--- a/src/main/java/forge/card/ability/effects/PhasesEffect.java
+++ b/src/main/java/forge/card/ability/effects/PhasesEffect.java
@@ -1,12 +1,16 @@
package forge.card.ability.effects;
+import java.util.ArrayList;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import forge.Card;
+import forge.card.ability.AbilityUtils;
import forge.card.ability.SpellAbilityEffect;
import forge.card.spellability.SpellAbility;
+import forge.game.Game;
+import forge.game.zone.ZoneType;
public class PhasesEffect extends SpellAbilityEffect {
@@ -35,17 +39,36 @@ public class PhasesEffect extends SpellAbilityEffect {
*
* @param sa
* a {@link forge.card.spellability.SpellAbility} object.
- * @param af
- * a {@link forge.card.ability.AbilityFactory} object.
*/
@Override
public void resolve(SpellAbility sa) {
- final List tgtCards = getTargetCards(sa);
+ List tgtCards = new ArrayList();
+ final Game game = sa.getActivatingPlayer().getGame();
+ final Card source = sa.getSourceCard();
+ final boolean phaseInOrOut = sa.hasParam("PhaseInOrOutAll");
- for (final Card tgtC : tgtCards) {
- if (!tgtC.isPhasedOut()) {
+ if (sa.hasParam("AllValid")) {
+ if (phaseInOrOut) {
+ tgtCards = game.getCardsIncludePhasingIn(ZoneType.Battlefield);
+ } else {
+ tgtCards = game.getCardsIn(ZoneType.Battlefield);
+ }
+ tgtCards = AbilityUtils.filterListByType(tgtCards, sa.getParam("AllValid"), sa);
+ } else if (sa.hasParam("Defined")) {
+ tgtCards = AbilityUtils.getDefinedCards(source, sa.getParam("Defined"), sa);
+ } else {
+ tgtCards = getTargetCards(sa);
+ }
+ if (phaseInOrOut) { // Time and Tide
+ for (final Card tgtC : tgtCards) {
tgtC.phase();
}
+ } else { // just phase out
+ for (final Card tgtC : tgtCards) {
+ if (!tgtC.isPhasedOut()) {
+ tgtC.phase();
+ }
+ }
}
}
}
diff --git a/src/main/java/forge/game/Game.java b/src/main/java/forge/game/Game.java
index f5ea50fe2ad..b517113e1ba 100644
--- a/src/main/java/forge/game/Game.java
+++ b/src/main/java/forge/game/Game.java
@@ -361,6 +361,18 @@ public class Game {
}
}
+ public List getCardsIncludePhasingIn(final ZoneType zone) {
+ if (zone == ZoneType.Stack) {
+ return getStackZone().getCards();
+ } else {
+ List cards = new ArrayList();
+ for (final Player p : getPlayers()) {
+ cards.addAll(p.getCardsIncludePhasingIn(zone));
+ }
+ return cards;
+ }
+ }
+
public List getCardsIn(final Iterable zones) {
final List cards = new ArrayList();
for (final ZoneType z : zones) {