diff --git a/.gitattributes b/.gitattributes index 1ba71229621..bc139135c6c 100644 --- a/.gitattributes +++ b/.gitattributes @@ -8277,6 +8277,7 @@ res/cardsfolder/p/psychotic_haze.txt svneol=native#text/plain res/cardsfolder/p/psychotrope_thallid.txt svneol=native#text/plain res/cardsfolder/p/pteron_ghost.txt svneol=native#text/plain res/cardsfolder/p/public_execution.txt -text +res/cardsfolder/p/pucas_mischief.txt -text res/cardsfolder/p/puffer_extract.txt svneol=native#text/plain res/cardsfolder/p/pull_from_eternity.txt -text res/cardsfolder/p/pull_under.txt svneol=native#text/plain @@ -10227,6 +10228,7 @@ res/cardsfolder/s/sparring_collar.txt -text res/cardsfolder/s/sparring_golem.txt svneol=native#text/plain res/cardsfolder/s/spatial_merging.txt -text res/cardsfolder/s/spawn_of_rix_maadi.txt -text +res/cardsfolder/s/spawnbroker.txt -text res/cardsfolder/s/spawning_breath.txt svneol=native#text/plain res/cardsfolder/s/spawning_pit.txt svneol=native#text/plain res/cardsfolder/s/spawning_pool.txt svneol=native#text/plain diff --git a/res/cardsfolder/p/pucas_mischief.txt b/res/cardsfolder/p/pucas_mischief.txt new file mode 100644 index 00000000000..c91e928e5a7 --- /dev/null +++ b/res/cardsfolder/p/pucas_mischief.txt @@ -0,0 +1,10 @@ +Name:Puca's Mischief +ManaCost:3 U +Types:Enchantment +T:Mode$ Phase | Phase$ Upkeep | ValidPlayer$ You | TriggerZones$ Battlefield | OptionalDecider$ You | Execute$ TrigExchange | TriggerDescription$ At the beginning of your upkeep, you may exchange control of target nonland permanent you control and target nonland permanent an opponent controls with an equal or lesser converted mana cost. +SVar:TrigExchange:AB$ Pump | Cost$ 0 | ValidTgts$ Permanent.YouCtrl+nonLand | TgtPrompt$ Select target nonland permanent you control | SubAbility$ DBExchange +SVar:DBExchange:DB$ ExchangeControl | Defined$ ParentTarget | ValidTgts$ Permanent.OppCtrl+nonLand | TgtPrompt$ Select target nonland permanent an opponent controls with less or equal converted mana cost | TargetsWithRelatedProperty$ LECMC +SVar:RemAIDeck:True +SVar:Picture:http://www.wizards.com/global/images/magic/general/pucas_mischief.jpg +Oracle:At the beginning of your upkeep, you may exchange control of target nonland permanent you control and target nonland permanent an opponent controls with an equal or lesser converted mana cost. +SetInfo:SHM Rare \ No newline at end of file diff --git a/res/cardsfolder/r/reins_of_power.txt b/res/cardsfolder/r/reins_of_power.txt index 53c604204f4..6164cab063b 100644 --- a/res/cardsfolder/r/reins_of_power.txt +++ b/res/cardsfolder/r/reins_of_power.txt @@ -6,6 +6,7 @@ SVar:DBUnTapYours:DB$ UntapAll | ValidCards$ Creature.YouCtrl | RememberUntapped SVar:DBGainCtrl:DB$ GainControl | AllValid$ Creature.IsRemembered+RememberedPlayerCtrl | AddKWs$ Haste | NewController$ You | LoseControl$ EOT | ForgetControlled$ True | StackDescription$ None | SubAbility$ DBGainCtrlOpp SVar:DBGainCtrlOpp:DB$ GainControl | AllValid$ Creature.IsRemembered+YouCtrl | AddKWs$ Haste | NewController$ Player.IsRemembered | LoseControl$ EOT | StackDescription$ None | SubAbility$ DBCleanup SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True +SVar:RemAIDeck:True SVar:Picture:http://www.wizards.com/global/images/magic/general/reins_of_power.jpg Oracle:Untap all creatures you control and all creatures target opponent controls. You and that opponent each gain control of all creatures the other controls until end of turn. Those creatures gain haste until end of turn. SetInfo:COM Rare diff --git a/res/cardsfolder/s/spawnbroker.txt b/res/cardsfolder/s/spawnbroker.txt new file mode 100644 index 00000000000..edadd41a1af --- /dev/null +++ b/res/cardsfolder/s/spawnbroker.txt @@ -0,0 +1,11 @@ +Name:Spawnbroker +ManaCost:2 U +Types:Creature Human Wizard +PT:1/1 +T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | OptionalDecider$ You | Execute$ TrigExchange | TriggerDescription$ When CARDNAME enters the battlefield, you may exchange control of target creature you control and target creature with power less than or equal to that creature's power an opponent controls. +SVar:TrigExchange:AB$ Pump | Cost$ 0 | ValidTgts$ Creature.YouCtrl | TgtPrompt$ Select target creature you control | SubAbility$ DBExchange +SVar:DBExchange:DB$ ExchangeControl | Defined$ ParentTarget | ValidTgts$ Creature.OppCtrl | TgtPrompt$ Select target creature an opponent controls with less or equal power | TargetsWithRelatedProperty$ LEPower +SVar:RemAIDeck:True +SVar:Picture:http://www.wizards.com/global/images/magic/general/spawnbroker.jpg +Oracle:When Spawnbroker enters the battlefield, you may exchange control of target creature you control and target creature with power less than or equal to that creature's power an opponent controls. +SetInfo:RAV Rare \ No newline at end of file diff --git a/src/main/java/forge/card/ability/AbilityFactory.java b/src/main/java/forge/card/ability/AbilityFactory.java index 68983e2ea1c..5b791dae558 100644 --- a/src/main/java/forge/card/ability/AbilityFactory.java +++ b/src/main/java/forge/card/ability/AbilityFactory.java @@ -270,6 +270,9 @@ public final class AbilityFactory { if (mapParams.containsKey("TargetsAtRandom")) { abTgt.setRandomTarget(true); } + if (mapParams.containsKey("TargetsWithRelatedProperty")) { + abTgt.setRelatedProperty(mapParams.get("TargetsWithRelatedProperty")); + } return abTgt; } diff --git a/src/main/java/forge/card/spellability/Target.java b/src/main/java/forge/card/spellability/Target.java index 2959aed8df1..c1b220aca76 100644 --- a/src/main/java/forge/card/spellability/Target.java +++ b/src/main/java/forge/card/spellability/Target.java @@ -65,6 +65,7 @@ public class Target { private boolean singleTarget = false; private boolean randomTarget = false; private String definedController = null; + private String relatedProperty = null; // How many can be targeted? private String minTargets; @@ -107,7 +108,9 @@ public class Target { this.sameController = target.isSameController(); this.withoutSameCreatureType = target.isWithoutSameCreatureType(); this.definedController = target.getDefinedController(); + this.relatedProperty = target.getRelatedProperty(); this.singleTarget = target.isSingleTarget(); + this.randomTarget = target.isRandomTarget(); this.choice = target.getTargetChoices(); } @@ -888,6 +891,20 @@ public class Target { public void setDefinedController(String defined) { this.definedController = defined; } + + /** + * @return the relatedProperty + */ + public String getRelatedProperty() { + return relatedProperty; + } + + /** + * @param related the relatedProperty to set + */ + public void setRelatedProperty(String related) { + this.relatedProperty = related; + } /** * @return the singleTarget diff --git a/src/main/java/forge/card/spellability/TargetSelection.java b/src/main/java/forge/card/spellability/TargetSelection.java index 5e99f04a7a5..c963886a2a0 100644 --- a/src/main/java/forge/card/spellability/TargetSelection.java +++ b/src/main/java/forge/card/spellability/TargetSelection.java @@ -183,7 +183,35 @@ public class TargetSelection { }); } } - + // If second target has properties related to the first + if (tgt.getRelatedProperty() != null && !targetedObjects.isEmpty()) { + final List list = new ArrayList(); + final String related = tgt.getRelatedProperty(); + for (final Object o : targetedObjects) { + if (o instanceof Card) { + list.add((Card) o); + } + } + if (!list.isEmpty()) { + final Card card = list.get(0); + if ("LEPower".equals(related)) { + choices = CardLists.filter(choices, new Predicate() { + @Override + public boolean apply(final Card c) { + return c.getCurrentPower() <= card.getCurrentPower(); + } + }); + } + if ("LECMC".equals(related)) { + choices = CardLists.filter(choices, new Predicate() { + @Override + public boolean apply(final Card c) { + return c.getCMC() <= card.getCMC(); + } + }); + } + } + } // If all cards must be from the same zone if (tgt.isSingleZone() && !targeted.isEmpty()) { choices = CardLists.filterControlledBy(choices, targeted.get(0).getController());