mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 03:38:01 +00:00
- 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:
@@ -2,7 +2,8 @@ Name:Mass Mutiny
|
||||
ManaCost:3 R R
|
||||
Types:Sorcery
|
||||
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:Picture:http://www.wizards.com/global/images/magic/general/mass_mutiny.jpg
|
||||
SetInfo:PC2|Rare|http://magiccards.info/scans/en/pc2/48.jpg
|
||||
|
||||
@@ -275,6 +275,9 @@ public class CardLists {
|
||||
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) {
|
||||
return CardLists.filter(cardList, CardPredicates.restriction(restrictions, sourceController, source));
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
*/
|
||||
package forge;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.base.Predicate;
|
||||
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) {
|
||||
return new Predicate<Card>() {
|
||||
@Override
|
||||
|
||||
@@ -212,6 +212,9 @@ public class AbilityFactory {
|
||||
if (mapParams.containsKey("TargetsWithDefinedController")) {
|
||||
abTgt.setDefinedController(mapParams.get("TargetsWithDefinedController"));
|
||||
}
|
||||
if (mapParams.containsKey("TargetsWithDifferentControllers")) {
|
||||
abTgt.setDifferentControllers(true);
|
||||
}
|
||||
}
|
||||
|
||||
// ***********************************
|
||||
|
||||
@@ -1796,7 +1796,6 @@ public class CardFactoryUtil {
|
||||
}
|
||||
|
||||
// count valid cards in any specified zone/s
|
||||
System.out.println("Passed string: " + s);
|
||||
if (l[0].startsWith("Valid") && !l[0].contains("Valid ")) {
|
||||
String[] lparts = l[0].split(" ", 2);
|
||||
final List<ZoneType> vZone = ZoneType.listValueOf(lparts[0].split("Valid")[1]);
|
||||
|
||||
@@ -45,6 +45,7 @@ public class Target {
|
||||
private boolean uniqueTargets = false;
|
||||
private boolean singleZone = false;
|
||||
private boolean differentZone = false;
|
||||
private boolean differentControllers = false;
|
||||
private boolean withoutSameCreatureType = false;
|
||||
private String definedController = null;
|
||||
private TargetChoices choice = null;
|
||||
@@ -811,6 +812,20 @@ public class Target {
|
||||
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
|
||||
*/
|
||||
|
||||
@@ -295,6 +295,14 @@ public class TargetSelection {
|
||||
if (tgt.isDifferentZone() && !targeted.isEmpty()) {
|
||||
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 (tgt.isWithoutSameCreatureType() && !targeted.isEmpty()) {
|
||||
final Card card = targeted.get(0);
|
||||
|
||||
Reference in New Issue
Block a user