- Converted Mass Mutiny for multiplayer.

- Added TargetsWithDifferentControllers param for targeting with different controllers (should supercede TargetsFromDifferentZone in most cases as it works with player lists instead of using getOpponent)
This commit is contained in:
moomarc
2012-12-26 10:33:03 +00:00
parent bf898ddefb
commit 479e5a614a
7 changed files with 42 additions and 3 deletions

View File

@@ -2,7 +2,8 @@ Name:Mass Mutiny
ManaCost:3 R R ManaCost:3 R R
Types:Sorcery Types:Sorcery
Text:no text Text:no text
A:SP$ GainControl | Cost$ 3 R R | ValidTgts$ Creature.OppCtrl | TgtPrompt$ Select target creature opponent controls. | LoseControl$ EOT | Untap$ True | AddKWs$ Haste | SpellDescription$ For each opponent, gain control of up to one target creature that player controls until end of turn. Untap those creatures. They gain haste until end of turn. A:SP$ GainControl | Cost$ 3 R R | ValidTgts$ Creature.OppCtrl | TgtPrompt$ Select target creature an opponent controls to gain control of. | TargetMin$ 0 | TargetMax$ OneEach | References$ OneEach | TargetsWithDifferentControllers$ True | LoseControl$ EOT | Untap$ True | AddKWs$ Haste | SpellDescription$ For each opponent, gain control of up to one target creature that player controls until end of turn. Untap those creatures. They gain haste until end of turn.
SVar:OneEach:PlayerCountOpponents$Amount
SVar:Rarity:Rare SVar:Rarity:Rare
SVar:Picture:http://www.wizards.com/global/images/magic/general/mass_mutiny.jpg SVar:Picture:http://www.wizards.com/global/images/magic/general/mass_mutiny.jpg
SetInfo:PC2|Rare|http://magiccards.info/scans/en/pc2/48.jpg SetInfo:PC2|Rare|http://magiccards.info/scans/en/pc2/48.jpg

View File

@@ -275,6 +275,9 @@ public class CardLists {
return CardLists.filter(cardList, CardPredicates.isController(player)); return CardLists.filter(cardList, CardPredicates.isController(player));
} }
public static List<Card> filterControlledBy(Iterable<Card> cardList, List<Player> player) {
return CardLists.filter(cardList, CardPredicates.hasListController(player));
}
public static List<Card> getValidCards(Iterable<Card> cardList, String[] restrictions, Player sourceController, Card source) { public static List<Card> getValidCards(Iterable<Card> cardList, String[] restrictions, Player sourceController, Card source) {
return CardLists.filter(cardList, CardPredicates.restriction(restrictions, sourceController, source)); return CardLists.filter(cardList, CardPredicates.restriction(restrictions, sourceController, source));

View File

@@ -17,6 +17,8 @@
*/ */
package forge; package forge;
import java.util.List;
import com.google.common.base.Function; import com.google.common.base.Function;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;
import com.google.common.collect.Iterables; import com.google.common.collect.Iterables;
@@ -47,6 +49,14 @@ public final class CardPredicates {
} }
}; };
} }
public static final Predicate<Card> hasListController(final List<Player> pList) {
return new Predicate<Card>() {
@Override
public boolean apply(final Card c) {
return pList.contains((Player) c.getController());
}
};
}
public static final Predicate<Card> isOwner(final Player p) { public static final Predicate<Card> isOwner(final Player p) {
return new Predicate<Card>() { return new Predicate<Card>() {
@Override @Override

View File

@@ -212,6 +212,9 @@ public class AbilityFactory {
if (mapParams.containsKey("TargetsWithDefinedController")) { if (mapParams.containsKey("TargetsWithDefinedController")) {
abTgt.setDefinedController(mapParams.get("TargetsWithDefinedController")); abTgt.setDefinedController(mapParams.get("TargetsWithDefinedController"));
} }
if (mapParams.containsKey("TargetsWithDifferentControllers")) {
abTgt.setDifferentControllers(true);
}
} }
// *********************************** // ***********************************

View File

@@ -1795,8 +1795,7 @@ public class CardFactoryUtil {
return CardFactoryUtil.doXMath(n, m, source); return CardFactoryUtil.doXMath(n, m, source);
} }
// count valid cards in any specified zone/s // count valid cards in any specified zone/s
System.out.println("Passed string: " + s);
if (l[0].startsWith("Valid") && !l[0].contains("Valid ")) { if (l[0].startsWith("Valid") && !l[0].contains("Valid ")) {
String[] lparts = l[0].split(" ", 2); String[] lparts = l[0].split(" ", 2);
final List<ZoneType> vZone = ZoneType.listValueOf(lparts[0].split("Valid")[1]); final List<ZoneType> vZone = ZoneType.listValueOf(lparts[0].split("Valid")[1]);

View File

@@ -45,6 +45,7 @@ public class Target {
private boolean uniqueTargets = false; private boolean uniqueTargets = false;
private boolean singleZone = false; private boolean singleZone = false;
private boolean differentZone = false; private boolean differentZone = false;
private boolean differentControllers = false;
private boolean withoutSameCreatureType = false; private boolean withoutSameCreatureType = false;
private String definedController = null; private String definedController = null;
private TargetChoices choice = null; private TargetChoices choice = null;
@@ -811,6 +812,20 @@ public class Target {
this.differentZone = different; this.differentZone = different;
} }
/**
* @return the differentControllers
*/
public boolean isDifferentControllers() {
return differentControllers;
}
/**
* @param different the differentControllers to set
*/
public void setDifferentControllers(boolean different) {
this.differentControllers = different;
}
/** /**
* @return the definedController * @return the definedController
*/ */

View File

@@ -295,6 +295,14 @@ public class TargetSelection {
if (tgt.isDifferentZone() && !targeted.isEmpty()) { if (tgt.isDifferentZone() && !targeted.isEmpty()) {
choices = CardLists.filterControlledBy(choices, targeted.get(0).getController().getOpponent()); choices = CardLists.filterControlledBy(choices, targeted.get(0).getController().getOpponent());
} }
// If all cards must have different controllers
if (tgt.isDifferentControllers() && !targeted.isEmpty()) {
final List<Player> availableControllers = new ArrayList<Player>(Singletons.getModel().getGame().getPlayers());
for (int i = 0; i < targeted.size(); i++) {
availableControllers.remove(targeted.get(i).getController());
}
choices = CardLists.filterControlledBy(choices, availableControllers);
}
// If the cards can't share a creature type // If the cards can't share a creature type
if (tgt.isWithoutSameCreatureType() && !targeted.isEmpty()) { if (tgt.isWithoutSameCreatureType() && !targeted.isEmpty()) {
final Card card = targeted.get(0); final Card card = targeted.get(0);