- Added Time and Tide, Amulet of Quoz

This commit is contained in:
swordshine
2013-06-11 04:21:29 +00:00
parent ec3d40caa1
commit 1eee0f967c
7 changed files with 75 additions and 5 deletions

View File

@@ -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;
}
}

View File

@@ -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<Card> milled = p.mill(numCards, destination, bottom);
if (destination.equals(ZoneType.Exile) && sa.hasParam("ExileFaceDown")) {
for (final Card c : milled) {

View File

@@ -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 {
* </p>
* @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<Card> tgtCards = getTargetCards(sa);
List<Card> tgtCards = new ArrayList<Card>();
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();
}
}
}
}
}

View File

@@ -361,6 +361,18 @@ public class Game {
}
}
public List<Card> getCardsIncludePhasingIn(final ZoneType zone) {
if (zone == ZoneType.Stack) {
return getStackZone().getCards();
} else {
List<Card> cards = new ArrayList<Card>();
for (final Player p : getPlayers()) {
cards.addAll(p.getCardsIncludePhasingIn(zone));
}
return cards;
}
}
public List<Card> getCardsIn(final Iterable<ZoneType> zones) {
final List<Card> cards = new ArrayList<Card>();
for (final ZoneType z : zones) {