From af32152bcca165669575c9cf300ad559c90576c2 Mon Sep 17 00:00:00 2001 From: Hanmac Date: Fri, 16 Feb 2018 16:49:25 +0100 Subject: [PATCH 1/9] CantBlockBy: now done as static ability --- .../java/forge/game/combat/CombatUtil.java | 12 ++++++ .../game/staticability/StaticAbility.java | 2 + .../StaticAbilityCantAttackBlock.java | 41 +++++++++++++++++++ 3 files changed, 55 insertions(+) diff --git a/forge-game/src/main/java/forge/game/combat/CombatUtil.java b/forge-game/src/main/java/forge/game/combat/CombatUtil.java index cd78ea29340..6c41d4fd021 100644 --- a/forge-game/src/main/java/forge/game/combat/CombatUtil.java +++ b/forge-game/src/main/java/forge/game/combat/CombatUtil.java @@ -955,6 +955,7 @@ public class CombatUtil { return false; } + final Game game = attacker.getGame(); if (!CombatUtil.canBlock(blocker, nextTurn)) { return false; } @@ -995,6 +996,16 @@ public class CombatUtil { return false; } + // CantBlockBy static abilities + for (final Card ca : game.getCardsIn(ZoneType.listValueOf("Battlefield,Command"))) { + for (final StaticAbility stAb : ca.getStaticAbilities()) { + if (stAb.applyAbility("CantBlockBy", attacker, blocker)) { + return false; + } + } + } + + // TODO remove it later to replace it with CantBlockBy above for (KeywordInterface inst1 : attacker.getKeywords()) { String k = inst1.getOriginal(); if (k.startsWith("CantBeBlockedBy ")) { @@ -1021,6 +1032,7 @@ public class CombatUtil { } } } + for (KeywordInterface inst : blocker.getKeywords()) { String keyword = inst.getOriginal(); if (keyword.startsWith("CantBlockCardUID")) { diff --git a/forge-game/src/main/java/forge/game/staticability/StaticAbility.java b/forge-game/src/main/java/forge/game/staticability/StaticAbility.java index 39f8be88ff9..c66787a7c5f 100644 --- a/forge-game/src/main/java/forge/game/staticability/StaticAbility.java +++ b/forge-game/src/main/java/forge/game/staticability/StaticAbility.java @@ -453,6 +453,8 @@ public class StaticAbility extends CardTraitBase implements Comparable Date: Fri, 16 Feb 2018 16:50:43 +0100 Subject: [PATCH 2/9] Card: show CantBlockBy on affected creature --- .../src/main/java/forge/game/card/Card.java | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/forge-game/src/main/java/forge/game/card/Card.java b/forge-game/src/main/java/forge/game/card/Card.java index 54370bf834a..298550120fa 100644 --- a/forge-game/src/main/java/forge/game/card/Card.java +++ b/forge-game/src/main/java/forge/game/card/Card.java @@ -1910,6 +1910,28 @@ public class Card extends GameEntity implements Comparable { } } + // CantBlockBy static abilities + if (game != null && isCreature() && isInZone(ZoneType.Battlefield)) { + for (final Card ca : game.getCardsIn(ZoneType.listValueOf("Battlefield,Command"))) { + if (equals(ca)) { + continue; + } + for (final StaticAbility stAb : ca.getStaticAbilities()) { + if (stAb.isSecondary() || + !stAb.getParam("Mode").equals("CantBlockBy") || + stAb.isSuppressed() || !stAb.checkConditions() || + !stAb.hasParam("ValidAttacker")) { + continue; + } + final Card host = stAb.getHostCard(); + if (isValid(stAb.getParam("ValidAttacker").split(","), host.getController(), host, null)) { + sb.append(stAb.toString()); + sb.append("\r\n"); + } + } + } + } + // NOTE: if (sb.toString().contains(" (NOTE: ")) { sb.insert(sb.indexOf("(NOTE: "), "\r\n"); From ec87b64d0c5b67c6d389b102be5728b63dfd15d5 Mon Sep 17 00:00:00 2001 From: Hanmac Date: Fri, 16 Feb 2018 16:51:37 +0100 Subject: [PATCH 3/9] Blazing Torch: CantBlockBy example --- forge-gui/res/cardsfolder/b/blazing_torch.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/forge-gui/res/cardsfolder/b/blazing_torch.txt b/forge-gui/res/cardsfolder/b/blazing_torch.txt index 7685a227eb9..b2ca9e86a69 100644 --- a/forge-gui/res/cardsfolder/b/blazing_torch.txt +++ b/forge-gui/res/cardsfolder/b/blazing_torch.txt @@ -2,7 +2,7 @@ Name:Blazing Torch ManaCost:1 Types:Artifact Equipment K:Equip 1 -S:Mode$ Continuous | Affected$ Creature.EquippedBy | AddHiddenKeyword$ CantBeBlockedBy Creature.Vampire,Creature.Zombie | Description$ Equipped creature can't be blocked by Vampires or Zombies. +S:Mode$ CantBlockBy | ValidAttacker$ Creature.EquippedBy | ValidBlocker$ Creature.Vampire,Creature.Zombie | Description$ Equipped creature can't be blocked by Vampires or Zombies. S:Mode$ Continuous | Affected$ Creature.EquippedBy | AddAbility$ TorchDamage | Description$ Equipped creature has "{T}, Sacrifice Blazing Torch: Blazing Torch deals 2 damage to target creature or player." SVar:TorchDamage:AB$ DealDamage | Cost$ T Sac<1/Card.Attached+namedBlazing Torch/equipped Blazing Torch> | ValidTgts$ Creature,Player | TgtPrompt$ Select target creature or player | NumDmg$ 2 | DamageSource$ Sacrificed | SpellDescription$ Blazing Torch deals 2 damage to target creature or player. SVar:NonStackingAttachEffect:True From 8f1c7bf40a130b167f7c1bdb7c831a2e2a5a86ec Mon Sep 17 00:00:00 2001 From: Hanmac Date: Fri, 16 Feb 2018 20:44:48 +0100 Subject: [PATCH 4/9] EffectEffect: add AtEOT, remembering host card --- .../main/java/forge/game/ability/effects/EffectEffect.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/forge-game/src/main/java/forge/game/ability/effects/EffectEffect.java b/forge-game/src/main/java/forge/game/ability/effects/EffectEffect.java index 437a640bfe0..e6c9e781eb3 100644 --- a/forge-game/src/main/java/forge/game/ability/effects/EffectEffect.java +++ b/forge-game/src/main/java/forge/game/ability/effects/EffectEffect.java @@ -229,6 +229,10 @@ public class EffectEffect extends SpellAbilityEffect { eff.copyChangedTextFrom(hostCard); } + if (sa.hasParam("AtEOT")) { + registerDelayedTrigger(sa, sa.getParam("AtEOT"), Lists.newArrayList(hostCard)); + } + // Duration final String duration = sa.getParam("Duration"); if ((duration == null) || !duration.equals("Permanent")) { From 8490f8d90b11c5647d3b4ff755e99a91cb4db07f Mon Sep 17 00:00:00 2001 From: Hanmac Date: Fri, 16 Feb 2018 20:55:17 +0100 Subject: [PATCH 5/9] Card: fixed CARDNAME & EFFECTSOURCE on the static abilties --- forge-game/src/main/java/forge/game/card/Card.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/forge-game/src/main/java/forge/game/card/Card.java b/forge-game/src/main/java/forge/game/card/Card.java index 298550120fa..353f743495a 100644 --- a/forge-game/src/main/java/forge/game/card/Card.java +++ b/forge-game/src/main/java/forge/game/card/Card.java @@ -1925,7 +1925,12 @@ public class Card extends GameEntity implements Comparable { } final Card host = stAb.getHostCard(); if (isValid(stAb.getParam("ValidAttacker").split(","), host.getController(), host, null)) { - sb.append(stAb.toString()); + String desc = stAb.toString(); + desc = TextUtil.fastReplace(desc, "CARDNAME", host.getName()); + if (host.getEffectSource() != null) { + desc = TextUtil.fastReplace(desc, "EFFECTSOURCE", host.getEffectSource().getName()); + } + sb.append(desc); sb.append("\r\n"); } } From e990c3648e6ef0e3a95fa78db95bd65281307d8b Mon Sep 17 00:00:00 2001 From: Hanmac Date: Sat, 17 Feb 2018 10:29:07 +0100 Subject: [PATCH 6/9] cards: update card scripts for new CantBlockByStatic --- forge-gui/res/cardsfolder/a/arctic_foxes.txt | 3 +-- forge-gui/res/cardsfolder/b/black_scarab.txt | 5 ++--- forge-gui/res/cardsfolder/b/blue_scarab.txt | 5 ++--- forge-gui/res/cardsfolder/b/bower_passage.txt | 2 +- forge-gui/res/cardsfolder/c/canopy_cover.txt | 2 +- forge-gui/res/cardsfolder/c/champion_of_lambholt.txt | 3 ++- forge-gui/res/cardsfolder/c/cloak_of_invisibility.txt | 3 ++- forge-gui/res/cardsfolder/d/dread_charge.txt | 3 ++- forge-gui/res/cardsfolder/d/dust_corona.txt | 3 ++- forge-gui/res/cardsfolder/f/field_of_reality.txt | 2 +- forge-gui/res/cardsfolder/f/firefright_mage.txt | 3 ++- forge-gui/res/cardsfolder/g/ghirapur_guide.txt | 3 ++- forge-gui/res/cardsfolder/g/green_scarab.txt | 5 ++--- forge-gui/res/cardsfolder/h/heat_wave.txt | 2 +- forge-gui/res/cardsfolder/i/infiltrators_magemark.txt | 3 ++- forge-gui/res/cardsfolder/i/invisibility.txt | 2 +- forge-gui/res/cardsfolder/j/jovens_tools.txt | 3 ++- forge-gui/res/cardsfolder/k/kithkin_armor.txt | 2 +- forge-gui/res/cardsfolder/l/legion_loyalist.txt | 7 ++++--- forge-gui/res/cardsfolder/p/prowlers_helm.txt | 2 +- forge-gui/res/cardsfolder/r/red_scarab.txt | 5 ++--- forge-gui/res/cardsfolder/r/rhonass_stalwart.txt | 6 ++++-- forge-gui/res/cardsfolder/r/rime_transfusion.txt | 3 ++- forge-gui/res/cardsfolder/s/sabertooth_alley_cat.txt | 3 ++- forge-gui/res/cardsfolder/s/sedge_sliver.txt | 5 ++--- forge-gui/res/cardsfolder/s/seeker.txt | 2 +- forge-gui/res/cardsfolder/s/shifting_sliver.txt | 2 +- forge-gui/res/cardsfolder/s/skyblinder_staff.txt | 2 +- forge-gui/res/cardsfolder/t/tower_of_coireall.txt | 3 ++- forge-gui/res/cardsfolder/t/treetop_bracers.txt | 3 ++- forge-gui/res/cardsfolder/v/varchilds_crusader.txt | 3 ++- forge-gui/res/cardsfolder/w/white_scarab.txt | 5 ++--- forge-gui/res/cardsfolder/z/zulaport_enforcer.txt | 7 +++---- 33 files changed, 60 insertions(+), 52 deletions(-) diff --git a/forge-gui/res/cardsfolder/a/arctic_foxes.txt b/forge-gui/res/cardsfolder/a/arctic_foxes.txt index 93d0a14e49b..3145d16728f 100644 --- a/forge-gui/res/cardsfolder/a/arctic_foxes.txt +++ b/forge-gui/res/cardsfolder/a/arctic_foxes.txt @@ -2,7 +2,6 @@ Name:Arctic Foxes ManaCost:1 W Types:Creature Fox PT:1/1 -S:Mode$ Continuous | Affected$ Card.Self | AddHiddenKeyword$ CantBeBlockedBy Creature.powerGE2 | CheckSVar$ X | SVarCompare$ GE1 | Description$ CARDNAME can't be blocked by creatures with power 2 or greater as long as defending player controls a snow land. -SVar:X:Count$Valid Land.Snow+DefenderCtrl +S:Mode$ CantBlockBy | ValidAttacker$ Card.Self | ValidBlocker$ Creature.powerGE2 | IsPresent$ Land.Snow+DefenderCtrl | Description$ CARDNAME can't be blocked by creatures with power 2 or greater as long as defending player controls a snow land. SVar:Picture:http://www.wizards.com/global/images/magic/general/arctic_foxes.jpg Oracle:Arctic Foxes can't be blocked by creatures with power 2 or greater as long as defending player controls a snow land. diff --git a/forge-gui/res/cardsfolder/b/black_scarab.txt b/forge-gui/res/cardsfolder/b/black_scarab.txt index 3d6ac3daba3..cb47e516e4c 100644 --- a/forge-gui/res/cardsfolder/b/black_scarab.txt +++ b/forge-gui/res/cardsfolder/b/black_scarab.txt @@ -3,9 +3,8 @@ ManaCost:W Types:Enchantment Aura K:Enchant creature A:SP$ Attach | Cost$ W | ValidTgts$ Creature | AILogic$ Pump -S:Mode$ Continuous | Affected$ Creature.EnchantedBy | AddHiddenKeyword$ CantBeBlockedBy Creature.Black | Description$ Enchanted creature can't be blocked by black creatures. -S:Mode$ Continuous | Affected$ Creature.EnchantedBy | AddPower$ 2 | AddToughness$ 2 | CheckSVar$ X | SVarCompare$ GE1 | Description$ Enchanted creature gets +2/+2 as long as an opponent controls a black permanent. -SVar:X:Count$Valid Permanent.Black+OppCtrl +S:Mode$ CantBlockBy | ValidAttacker$ Creature.EnchantedBy | ValidBlocker$ Creature.Black | Description$ Enchanted creature can't be blocked by black creatures. +S:Mode$ Continuous | Affected$ Creature.EnchantedBy | AddPower$ 2 | AddToughness$ 2 | IsPresent$ Permanent.Black+OppCtrl | Description$ Enchanted creature gets +2/+2 as long as an opponent controls a black permanent. SVar:RemRandomDeck:True SVar:Picture:http://www.wizards.com/global/images/magic/general/black_scarab.jpg Oracle:Enchant creature\nEnchanted creature can't be blocked by black creatures.\nEnchanted creature gets +2/+2 as long as an opponent controls a black permanent. diff --git a/forge-gui/res/cardsfolder/b/blue_scarab.txt b/forge-gui/res/cardsfolder/b/blue_scarab.txt index 26c2b169fa5..62c710bcc8b 100644 --- a/forge-gui/res/cardsfolder/b/blue_scarab.txt +++ b/forge-gui/res/cardsfolder/b/blue_scarab.txt @@ -3,9 +3,8 @@ ManaCost:W Types:Enchantment Aura K:Enchant creature A:SP$ Attach | Cost$ W | ValidTgts$ Creature | AILogic$ Pump -S:Mode$ Continuous | Affected$ Creature.EnchantedBy | AddHiddenKeyword$ CantBeBlockedBy Creature.Blue | Description$ Enchanted creature can't be blocked by blue creatures. -S:Mode$ Continuous | Affected$ Creature.EnchantedBy | AddPower$ 2 | AddToughness$ 2 | CheckSVar$ X | SVarCompare$ GE1 | Description$ Enchanted creature gets +2/+2 as long as an opponent controls a blue permanent. -SVar:X:Count$Valid Permanent.Blue+OppCtrl +S:Mode$ CantBlockBy | ValidAttacker$ Creature.EnchantedBy | ValidBlocker$ Creature.Blue | Description$ Enchanted creature can't be blocked by blue creatures. +S:Mode$ Continuous | Affected$ Creature.EnchantedBy | AddPower$ 2 | AddToughness$ 2 | IsPresent$ Permanent.Blue+OppCtrl | Description$ Enchanted creature gets +2/+2 as long as an opponent controls a blue permanent. SVar:RemRandomDeck:True SVar:Picture:http://www.wizards.com/global/images/magic/general/blue_scarab.jpg Oracle:Enchant creature\nEnchanted creature can't be blocked by blue creatures.\nEnchanted creature gets +2/+2 as long as an opponent controls a blue permanent. diff --git a/forge-gui/res/cardsfolder/b/bower_passage.txt b/forge-gui/res/cardsfolder/b/bower_passage.txt index 3d7312b3538..de298f59e01 100644 --- a/forge-gui/res/cardsfolder/b/bower_passage.txt +++ b/forge-gui/res/cardsfolder/b/bower_passage.txt @@ -1,7 +1,7 @@ Name:Bower Passage ManaCost:1 G Types:Enchantment -S:Mode$ Continuous | Affected$ Creature.YouCtrl | AddHiddenKeyword$ CantBeBlockedBy Creature.withFlying | Description$ Creatures with flying can't block creatures you control. +S:Mode$ CantBlockBy | ValidAttacker$ Creature.YouCtrl | ValidBlocker$ Creature.withFlying | Description$ Creatures with flying can't block creatures you control. SVar:NonStackingEffect:True SVar:Picture:http://www.wizards.com/global/images/magic/general/bower_passage.jpg Oracle:Creatures with flying can't block creatures you control. diff --git a/forge-gui/res/cardsfolder/c/canopy_cover.txt b/forge-gui/res/cardsfolder/c/canopy_cover.txt index 4faf343065c..3b45770b7d1 100644 --- a/forge-gui/res/cardsfolder/c/canopy_cover.txt +++ b/forge-gui/res/cardsfolder/c/canopy_cover.txt @@ -3,7 +3,7 @@ ManaCost:1 G Types:Enchantment Aura K:Enchant creature A:SP$ Attach | Cost$ 1 G | ValidTgts$ Creature | AILogic$ Pump -S:Mode$ Continuous | Affected$ Creature.EnchantedBy | AddHiddenKeyword$ CantBeBlockedBy Creature.withoutFlying+withoutReach | Description$ Enchanted creature can't be blocked except by creatures with flying or reach. +S:Mode$ CantBlockBy | ValidAttacker$ Creature.EnchantedBy | ValidBlocker$ Creature.withoutFlying+withoutReach | Description$ Enchanted creature can't be blocked except by creatures with flying or reach. S:Mode$ CantTarget | ValidCard$ Card.EnchantedBy | Activator$ Opponent | Description$ Enchanted creature can't be the target of spells or abilities your opponents control. SVar:Picture:http://www.wizards.com/global/images/magic/general/canopy_cover.jpg Oracle:Enchant creature\nEnchanted creature can't be blocked except by creatures with flying or reach.\nEnchanted creature can't be the target of spells or abilities your opponents control. diff --git a/forge-gui/res/cardsfolder/c/champion_of_lambholt.txt b/forge-gui/res/cardsfolder/c/champion_of_lambholt.txt index f36eb13b83d..6aef3adb37b 100644 --- a/forge-gui/res/cardsfolder/c/champion_of_lambholt.txt +++ b/forge-gui/res/cardsfolder/c/champion_of_lambholt.txt @@ -2,9 +2,10 @@ Name:Champion of Lambholt ManaCost:1 G G Types:Creature Human Warrior PT:1/1 -S:Mode$ Continuous | Affected$ Creature.YouCtrl | AddKeyword$ CantBeBlockedBy Creature.YouDontCtrl+powerLTHostCardPower | Description$ Creatures with power less than CARDNAME's power can't block creatures you control. +S:Mode$ CantBlockBy | ValidAttacker$ Creature.YouCtrl | ValidBlocker$ Creature.YouDontCtrl+powerLTX | Description$ Creatures with power less than CARDNAME's power can't block creatures you control. T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Creature.Other+YouCtrl | TriggerZones$ Battlefield | Execute$ TrigPutCounter | TriggerDescription$ Whenever another creature enters the battlefield under your control, put a +1/+1 counter on CARDNAME. SVar:TrigPutCounter:DB$ PutCounter | Defined$ Self | CounterType$ P1P1 | CounterNum$ 1 SVar:BuffedBy:Creature +SVar:X:Count$CardPower SVar:Picture:http://www.wizards.com/global/images/magic/general/champion_of_lambholt.jpg Oracle:Creatures with power less than Champion of Lambholt's power can't block creatures you control.\nWhenever another creature enters the battlefield under your control, put a +1/+1 counter on Champion of Lambholt. diff --git a/forge-gui/res/cardsfolder/c/cloak_of_invisibility.txt b/forge-gui/res/cardsfolder/c/cloak_of_invisibility.txt index a96a23a241b..cb149317f78 100644 --- a/forge-gui/res/cardsfolder/c/cloak_of_invisibility.txt +++ b/forge-gui/res/cardsfolder/c/cloak_of_invisibility.txt @@ -3,6 +3,7 @@ ManaCost:U Types:Enchantment Aura K:Enchant creature A:SP$ Attach | Cost$ U | ValidTgts$ Creature | AILogic$ Pump -S:Mode$ Continuous | Affected$ Permanent.EnchantedBy | AddKeyword$ Phasing | AddHiddenKeyword$ CantBeBlockedBy Creature.nonWall | Description$ Enchanted creature has phasing and can't be blocked except by Walls. +S:Mode$ Continuous | Affected$ Creature.EnchantedBy | AddKeyword$ Phasing | Description$ Enchanted creature has phasing and can't be blocked except by Walls. +S:Mode$ CantBlockBy | ValidAttacker$ Creature.EnchantedBy | ValidBlocker$ Creature.nonWall | Secondary$ True | Description$ Enchanted creature can't be blocked except by Walls. SVar:Picture:http://www.wizards.com/global/images/magic/general/cloak_of_invisibility.jpg Oracle:Enchant creature\nEnchanted creature has phasing and can't be blocked except by Walls. (It phases in or out before its controller untaps during each of his or her untap steps. While it's phased out, it's treated as though it doesn't exist.) diff --git a/forge-gui/res/cardsfolder/d/dread_charge.txt b/forge-gui/res/cardsfolder/d/dread_charge.txt index 116a8519119..fa4e27f81f2 100644 --- a/forge-gui/res/cardsfolder/d/dread_charge.txt +++ b/forge-gui/res/cardsfolder/d/dread_charge.txt @@ -1,7 +1,8 @@ Name:Dread Charge ManaCost:3 B Types:Sorcery -A:SP$ PumpAll | Cost$ 3 B | ValidCards$ Creature.Black+YouCtrl | KW$ HIDDEN CantBeBlockedBy Creature.nonBlack | SpellDescription$ Black creatures you control can't be blocked this turn except by black creatures. +A:SP$ Effect | Cost$ 3 B | Name$ Dread Charge Effect | StaticAbilities$ KWPump | SpellDescription$ Black creatures you control can't be blocked this turn except by black creatures. +SVar:KWPump:Mode$ CantBlockBy | ValidAttacker$ Creature.Black+YouCtrl | ValidBlocker$ Creature.nonBlack | EffectZone$ Command | Description$ Black creatures you control can't be blocked this turn except by black creatures. SVar:RemAIDeck:True SVar:Picture:http://www.wizards.com/global/images/magic/general/dread_charge.jpg Oracle:Black creatures you control can't be blocked this turn except by black creatures. diff --git a/forge-gui/res/cardsfolder/d/dust_corona.txt b/forge-gui/res/cardsfolder/d/dust_corona.txt index 422caf694eb..318677bef32 100644 --- a/forge-gui/res/cardsfolder/d/dust_corona.txt +++ b/forge-gui/res/cardsfolder/d/dust_corona.txt @@ -3,6 +3,7 @@ ManaCost:R Types:Enchantment Aura K:Enchant creature A:SP$ Attach | Cost$ R | ValidTgts$ Creature | AILogic$ Pump -S:Mode$ Continuous | Affected$ Creature.EnchantedBy | AddPower$ 2 | AddHiddenKeyword$ CantBeBlockedBy Creature.withFlying | Description$ Enchanted creature gets +2/+0 and can't be blocked by creatures with flying. +S:Mode$ Continuous | Affected$ Creature.EnchantedBy | AddPower$ 2 | Description$ Enchanted creature gets +2/+0 and can't be blocked by creatures with flying. +S:Mode$ CantBlockBy | ValidAttacker$ Creature.EnchantedBy | ValidBlocker$ Creature.withFlying | Secondary$ True | Description$ Enchanted creature can't be blocked by creatures with flying. SVar:Picture:http://www.wizards.com/global/images/magic/general/dust_corona.jpg Oracle:Enchant creature\nEnchanted creature gets +2/+0 and can't be blocked by creatures with flying. diff --git a/forge-gui/res/cardsfolder/f/field_of_reality.txt b/forge-gui/res/cardsfolder/f/field_of_reality.txt index ec89e9f2c0b..0dd5d400f2f 100644 --- a/forge-gui/res/cardsfolder/f/field_of_reality.txt +++ b/forge-gui/res/cardsfolder/f/field_of_reality.txt @@ -3,7 +3,7 @@ ManaCost:2 U Types:Enchantment Aura K:Enchant creature A:SP$ Attach | Cost$ 2 U | ValidTgts$ Creature | AILogic$ Pump -S:Mode$ Continuous | Affected$ Creature.EnchantedBy | AddHiddenKeyword$ CantBeBlockedBy Spirit | Description$ Enchanted creature can't be blocked by Spirits. +S:Mode$ CantBlockBy | ValidAttacker$ Creature.EnchantedBy | ValidBlocker$ Creature.Spirit | Description$ Enchanted creature can't be blocked by Spirits. A:AB$ ChangeZone | Cost$ 1 U | Origin$ Battlefield | Destination$ Hand | SpellDescription$ Return CARDNAME to its owner's hand. SVar:RemRandomDeck:True SVar:NonStackingAttachEffect:True diff --git a/forge-gui/res/cardsfolder/f/firefright_mage.txt b/forge-gui/res/cardsfolder/f/firefright_mage.txt index 89e595b66d7..24f5f7ca55c 100644 --- a/forge-gui/res/cardsfolder/f/firefright_mage.txt +++ b/forge-gui/res/cardsfolder/f/firefright_mage.txt @@ -2,7 +2,8 @@ Name:Firefright Mage ManaCost:R Types:Creature Goblin Spellshaper PT:1/1 -A:AB$ Pump | Cost$ 1 R T Discard<1/Card> | KW$ HIDDEN CantBeBlockedBy Creature.nonArtifact+nonRed | ValidTgts$ Creature | SpellDescription$ Target creature can't be blocked this turn except by artifact creatures and/or red creatures. +A:AB$ Effect | Cost$ 1 R T Discard<1/Card> | ValidTgts$ Creature.YouCtrl | TgtPrompt$ Select target creature | RememberObjects$ Targeted | Name$ Firefright Mage's Effect | StaticAbilities$ KWPump | SpellDescription$ Target creature can't be blocked this turn except by artifact creatures and/or red creatures. +SVar:KWPump:Mode$ CantBlockBy | ValidAttacker$ Creature.Remembered | ValidBlocker$ Creature.nonArtifact+nonRed | EffectZone$ Command | Description$ Remembered creature can't be blocked this turn except by artifact creatures and/or red creatures. SVar:RemAIDeck:True SVar:Picture:http://www.wizards.com/global/images/magic/general/firefright_mage.jpg Oracle:{1}{R}, {T}, Discard a card: Target creature can't be blocked this turn except by artifact creatures and/or red creatures. diff --git a/forge-gui/res/cardsfolder/g/ghirapur_guide.txt b/forge-gui/res/cardsfolder/g/ghirapur_guide.txt index a807984a5c9..9715ca3e6b3 100644 --- a/forge-gui/res/cardsfolder/g/ghirapur_guide.txt +++ b/forge-gui/res/cardsfolder/g/ghirapur_guide.txt @@ -2,6 +2,7 @@ Name:Ghirapur Guide ManaCost:2 G Types:Creature Elf Scout PT:3/2 -A:AB$ Pump | Cost$ 2 G | ValidTgts$ Creature.YouCtrl | TgtPrompt$ Select target creature | KW$ HIDDEN CantBeBlockedBy Creature.powerLE2 | SpellDescription$ Target creature you control can't be blocked by creatures with power 2 or less this turn. +A:AB$ Effect | Cost$ 2 G | ValidTgts$ Creature.YouCtrl | TgtPrompt$ Select target creature | RememberObjects$ Targeted | Name$ Ghirapur Guide's Effect | StaticAbilities$ KWPump | SpellDescription$ Target creature you control can't be blocked by creatures with power 2 or less this turn. +SVar:KWPump:Mode$ CantBlockBy | ValidAttacker$ Creature.Remembered | ValidBlocker$ Creature.powerLE2 | EffectZone$ Command | Description$ Remembered creature can't be blocked by creatures with power 2 or less this turn. SVar:Picture:http://www.wizards.com/global/images/magic/general/ghirapur_guide.jpg Oracle:{2}{G}: Target creature you control can't be blocked by creatures with power 2 or less this turn. diff --git a/forge-gui/res/cardsfolder/g/green_scarab.txt b/forge-gui/res/cardsfolder/g/green_scarab.txt index bccabdc17e1..3a1d0cf18c8 100644 --- a/forge-gui/res/cardsfolder/g/green_scarab.txt +++ b/forge-gui/res/cardsfolder/g/green_scarab.txt @@ -3,9 +3,8 @@ ManaCost:W Types:Enchantment Aura K:Enchant creature A:SP$ Attach | Cost$ W | ValidTgts$ Creature | AILogic$ Pump -S:Mode$ Continuous | Affected$ Creature.EnchantedBy | AddHiddenKeyword$ CantBeBlockedBy Creature.Green | Description$ Enchanted creature can't be blocked by green creatures. -S:Mode$ Continuous | Affected$ Creature.EnchantedBy | AddPower$ 2 | AddToughness$ 2 | CheckSVar$ X | SVarCompare$ GE1 | Description$ Enchanted creature gets +2/+2 as long as an opponent controls a green permanent. -SVar:X:Count$Valid Permanent.Green+OppCtrl +S:Mode$ CantBlockBy | ValidAttacker$ Creature.EnchantedBy | ValidBlocker$ Creature.Green | Description$ Enchanted creature can't be blocked by green creatures. +S:Mode$ Continuous | Affected$ Creature.EnchantedBy | AddPower$ 2 | AddToughness$ 2 | IsPresent$ Permanent.Green+OppCtrl | Description$ Enchanted creature gets +2/+2 as long as an opponent controls a green permanent. SVar:RemRandomDeck:True SVar:Picture:http://www.wizards.com/global/images/magic/general/green_scarab.jpg Oracle:Enchant creature\nEnchanted creature can't be blocked by green creatures.\nEnchanted creature gets +2/+2 as long as an opponent controls a green permanent. diff --git a/forge-gui/res/cardsfolder/h/heat_wave.txt b/forge-gui/res/cardsfolder/h/heat_wave.txt index 374013a08d2..4de1d9c4486 100644 --- a/forge-gui/res/cardsfolder/h/heat_wave.txt +++ b/forge-gui/res/cardsfolder/h/heat_wave.txt @@ -2,7 +2,7 @@ Name:Heat Wave ManaCost:2 R Types:Enchantment K:Cumulative upkeep:R -S:Mode$ Continuous | Affected$ Creature.YouCtrl | AddHiddenKeyword$ CantBeBlockedBy Creature.Blue | Description$ Blue creatures can't block creatures you control. +S:Mode$ CantBlockBy | ValidAttacker$ Creature.YouCtrl | ValidBlocker$ Creature.Blue | Description$ Blue creatures can't block creatures you control. S:Mode$ CantBlockUnless | ValidCard$ Creature.nonBlue | Attacker$ Creature.YouCtrl | Cost$ PayLife<1> | Description$ Nonblue creatures can't block creatures you control unless their controller pays 1 life for each blocking creature he or she controls. SVar:RemAIDeck:True SVar:Picture:http://www.wizards.com/global/images/magic/general/heat_wave.jpg diff --git a/forge-gui/res/cardsfolder/i/infiltrators_magemark.txt b/forge-gui/res/cardsfolder/i/infiltrators_magemark.txt index 6b764721cab..9df95157ca2 100644 --- a/forge-gui/res/cardsfolder/i/infiltrators_magemark.txt +++ b/forge-gui/res/cardsfolder/i/infiltrators_magemark.txt @@ -3,6 +3,7 @@ ManaCost:2 U Types:Enchantment Aura K:Enchant creature A:SP$ Attach | Cost$ 2 U | ValidTgts$ Creature | AILogic$ Pump -S:Mode$ Continuous | Affected$ Creature.enchanted+YouCtrl | AddPower$ 1 | AddToughness$ 1 | AddHiddenKeyword$ CantBeBlockedBy Creature.withoutDefender | Description$ Creatures you control that are enchanted get +1/+1 and can't be blocked except by creatures with defender. +S:Mode$ Continuous | Affected$ Creature.enchanted+YouCtrl | AddPower$ 1 | AddToughness$ 1 | Description$ Creatures you control that are enchanted get +1/+1 and can't be blocked except by creatures with defender. +S:Mode$ CantBlockBy | ValidAttacker$ Creature.enchanted+YouCtrl | ValidBlocker$ Creature.withoutDefender | Secondary$ True | Description$ Creatures you control can't be blocked except by creatures with defender. SVar:Picture:http://www.wizards.com/global/images/magic/general/infiltrators_magemark.jpg Oracle:Enchant creature\nCreatures you control that are enchanted get +1/+1 and can't be blocked except by creatures with defender. diff --git a/forge-gui/res/cardsfolder/i/invisibility.txt b/forge-gui/res/cardsfolder/i/invisibility.txt index cf3b3eb01e4..6089e98b3d0 100644 --- a/forge-gui/res/cardsfolder/i/invisibility.txt +++ b/forge-gui/res/cardsfolder/i/invisibility.txt @@ -3,6 +3,6 @@ ManaCost:U U Types:Enchantment Aura K:Enchant creature A:SP$ Attach | Cost$ U U | ValidTgts$ Creature | AILogic$ Pump -S:Mode$ Continuous | Affected$ Creature.EnchantedBy | AddHiddenKeyword$ CantBeBlockedBy Creature.nonWall | Description$ Enchanted creature can't be blocked except by Walls. +S:Mode$ CantBlockBy | ValidAttacker$ Creature.EnchantedBy | ValidBlocker$ Creature.nonWall | Description$ Enchanted creature can't be blocked except by Walls. SVar:Picture:http://www.wizards.com/global/images/magic/general/invisibility.jpg Oracle:Enchant creature\nEnchanted creature can't be blocked except by Walls. diff --git a/forge-gui/res/cardsfolder/j/jovens_tools.txt b/forge-gui/res/cardsfolder/j/jovens_tools.txt index 77e9b3783eb..0fd9eb92912 100644 --- a/forge-gui/res/cardsfolder/j/jovens_tools.txt +++ b/forge-gui/res/cardsfolder/j/jovens_tools.txt @@ -1,6 +1,7 @@ Name:Joven's Tools ManaCost:6 Types:Artifact -A:AB$ Pump | Cost$ 4 T | ValidTgts$ Creature | TgtPrompt$ Select target creature | KW$ HIDDEN CantBeBlockedBy Creature.nonWall | SpellDescription$ Target creature can't be blocked this turn except by Walls. +A:AB$ Effect | Cost$ 4 T | ValidTgts$ Creature | TgtPrompt$ Select target creature | RememberObjects$ Targeted | Name$ Joven's Tools' Effect | StaticAbilities$ KWPump | SpellDescription$ Target creature can't be blocked this turn except by Walls. +SVar:KWPump:Mode$ CantBlockBy | ValidAttacker$ Creature.Remembered | ValidBlocker$ Creature.nonWall | EffectZone$ Command | Description$ Remembered creature can't be blocked this turn except by Walls. SVar:Picture:http://www.wizards.com/global/images/magic/general/jovens_tools.jpg Oracle:{4}, {T}: Target creature can't be blocked this turn except by Walls. diff --git a/forge-gui/res/cardsfolder/k/kithkin_armor.txt b/forge-gui/res/cardsfolder/k/kithkin_armor.txt index 2ca4a92b92a..e4c37ad7ab5 100644 --- a/forge-gui/res/cardsfolder/k/kithkin_armor.txt +++ b/forge-gui/res/cardsfolder/k/kithkin_armor.txt @@ -3,7 +3,7 @@ ManaCost:W Types:Enchantment Aura K:Enchant creature A:SP$ Attach | Cost$ W | ValidTgts$ Creature | AILogic$ Pump -S:Mode$ Continuous | Affected$ Card.EnchantedBy | AddHiddenKeyword$ CantBeBlockedBy Creature.powerGE3 | Description$ Enchanted creature can't be blocked by creatures with power 3 or greater. +S:Mode$ CantBlockBy | ValidAttacker$ Creature.EnchantedBy | ValidBlocker$ Creature.powerGE3 | Description$ Enchanted creature can't be blocked by creatures with power 3 or greater. T:Mode$ Attached | ValidSource$ Card.Self | ValidTarget$ Creature | TriggerZones$ Battlefield | Execute$ TrigImprint | Static$ True SVar:TrigImprint:DB$ Cleanup | ClearImprinted$ True | SubAbility$ ImprintNew SVar:ImprintNew:DB$ Pump | ImprintCards$ Enchanted diff --git a/forge-gui/res/cardsfolder/l/legion_loyalist.txt b/forge-gui/res/cardsfolder/l/legion_loyalist.txt index 3bc54d7a10e..487937092b5 100644 --- a/forge-gui/res/cardsfolder/l/legion_loyalist.txt +++ b/forge-gui/res/cardsfolder/l/legion_loyalist.txt @@ -3,8 +3,9 @@ ManaCost:R Types:Creature Goblin Soldier PT:1/1 K:Haste -T:Mode$ Attacks | ValidCard$ Card.Self | TriggerZones$ Battlefield | Execute$ TrigPump | CheckSVar$ BattalionTest | NoResolvingCheck$ True | SVarCompare$ GE2 | TriggerDescription$ Battalion — Whenever CARDNAME and at least two other creatures attack, creatures you control gain first strike and trample until end of turn and can't be blocked by creature tokens this turn. -SVar:TrigPump:DB$ PumpAll | ValidCards$ Creature.YouCtrl | KW$ First Strike & Trample & HIDDEN CantBeBlockedBy Creature.token -SVar:BattalionTest:Count$Valid Creature.attacking+Other +T:Mode$ Attacks | ValidCard$ Card.Self | TriggerZones$ Battlefield | Execute$ TrigPump | IsPresent$ Creature.attacking+Other | NoResolvingCheck$ True | PresentCompare$ GE2 | TriggerDescription$ Battalion — Whenever CARDNAME and at least two other creatures attack, creatures you control gain first strike and trample until end of turn and can't be blocked by creature tokens this turn. +SVar:TrigPump:DB$ PumpAll | ValidCards$ Creature.YouCtrl | KW$ First Strike & Trample | SubAbility$ TrigEffect +SVar:TrigEffect:DB$ Effect | Name$ Legion Loyalist Effect | StaticAbilities$ KWPump +SVar:KWPump:Mode$ CantBlockBy | ValidAttacker$ Creature.YouCtrl | ValidBlocker$ Creature.token | EffectZone$ Command | Description$ Creatures you control can't be blocked by creature tokens this turn SVar:Picture:http://www.wizards.com/global/images/magic/general/legion_loyalist.jpg Oracle:Haste\nBattalion — Whenever Legion Loyalist and at least two other creatures attack, creatures you control gain first strike and trample until end of turn and can't be blocked by creature tokens this turn. diff --git a/forge-gui/res/cardsfolder/p/prowlers_helm.txt b/forge-gui/res/cardsfolder/p/prowlers_helm.txt index 4436b29e3e0..4503b43b81e 100644 --- a/forge-gui/res/cardsfolder/p/prowlers_helm.txt +++ b/forge-gui/res/cardsfolder/p/prowlers_helm.txt @@ -2,6 +2,6 @@ Name:Prowler's Helm ManaCost:2 Types:Artifact Equipment K:Equip 2 -S:Mode$ Continuous | Affected$ Creature.EquippedBy | AddHiddenKeyword$ CantBeBlockedBy Creature.nonWall | Description$ Equipped creature can't be blocked except by Walls. +S:Mode$ CantBlockBy | ValidAttacker$ Creature.EquippedBy | ValidBlocker$ Creature.nonWall | Description$ Equipped creature can't be blocked except by Walls. SVar:Picture:http://www.wizards.com/global/images/magic/general/prowlers_helm.jpg Oracle:Equipped creature can't be blocked except by Walls.\nEquip {2} diff --git a/forge-gui/res/cardsfolder/r/red_scarab.txt b/forge-gui/res/cardsfolder/r/red_scarab.txt index 4e049b08d48..d2c4548415d 100644 --- a/forge-gui/res/cardsfolder/r/red_scarab.txt +++ b/forge-gui/res/cardsfolder/r/red_scarab.txt @@ -3,9 +3,8 @@ ManaCost:W Types:Enchantment Aura K:Enchant creature A:SP$ Attach | Cost$ W | ValidTgts$ Creature | AILogic$ Pump -S:Mode$ Continuous | Affected$ Creature.EnchantedBy | AddHiddenKeyword$ CantBeBlockedBy Creature.Red | Description$ Enchanted creature can't be blocked by red creatures. -S:Mode$ Continuous | Affected$ Creature.EnchantedBy | AddPower$ 2 | AddToughness$ 2 | CheckSVar$ X | SVarCompare$ GE1 | References$ X | Description$ Enchanted creature gets +2/+2 as long as an opponent controls a red permanent. -SVar:X:Count$Valid Permanent.Red+OppCtrl +S:Mode$ CantBlockBy | ValidAttacker$ Creature.EnchantedBy | ValidBlocker$ Creature.Red | Description$ Enchanted creature can't be blocked by red creatures. +S:Mode$ Continuous | Affected$ Creature.EnchantedBy | AddPower$ 2 | AddToughness$ 2 | IsPresent$ Permanent.Red+OppCtrl | Description$ Enchanted creature gets +2/+2 as long as an opponent controls a red permanent. SVar:RemRandomDeck:True SVar:Picture:http://www.wizards.com/global/images/magic/general/red_scarab.jpg Oracle:Enchant creature\nEnchanted creature can't be blocked by red creatures.\nEnchanted creature gets +2/+2 as long as an opponent controls a red permanent. diff --git a/forge-gui/res/cardsfolder/r/rhonass_stalwart.txt b/forge-gui/res/cardsfolder/r/rhonass_stalwart.txt index a89c15fc58b..a1c2b2f0fe1 100644 --- a/forge-gui/res/cardsfolder/r/rhonass_stalwart.txt +++ b/forge-gui/res/cardsfolder/r/rhonass_stalwart.txt @@ -4,5 +4,7 @@ Types:Creature Human Warrior PT:2/2 K:You may exert CARDNAME as it attacks. T:Mode$ Exerted | ValidCard$ Card.Self | Execute$ TrigPump | TriggerDescription$ When you exert CARDNAME, it gets +1/+1 and can't be blocked by creatures with power 2 or less this turn. -SVar:TrigPump:DB$ Pump | Defined$ Self | NumAtt$ 1 | NumDef$ 1 | KW$ HIDDEN CantBeBlockedBy Creature.powerLE2 -Oracle:You may exert Rhonas's Stalwart as it attacks. When you do, it gets +1/+1 and can't be blocked by creatures with power 2 or less this turn. (An exerted creature won't untap during your next untap step) \ No newline at end of file +SVar:TrigPump:DB$ Pump | Defined$ Self | NumAtt$ 1 | NumDef$ 1 | SubAbility$ TrigEffect +SVar:TrigEffect:DB$ Effect | Name$ Rhonas's Stalwart Effect | StaticAbilities$ KWPump +SVar:KWPump:Mode$ CantBlockBy | ValidAttacker$ Creature.EffectSource | ValidBlocker$ Creature.powerLE2 | EffectZone$ Command | Description$ EFFECTSOURCE can't be blocked by creatures with power 2 or less this turn. +Oracle:You may exert Rhonas's Stalwart as it attacks. When you do, it gets +1/+1 and can't be blocked by creatures with power 2 or less this turn. (An exerted creature won't untap during your next untap step) diff --git a/forge-gui/res/cardsfolder/r/rime_transfusion.txt b/forge-gui/res/cardsfolder/r/rime_transfusion.txt index 4c58479023e..ffd6e1e4596 100644 --- a/forge-gui/res/cardsfolder/r/rime_transfusion.txt +++ b/forge-gui/res/cardsfolder/r/rime_transfusion.txt @@ -4,6 +4,7 @@ Types:Snow Enchantment Aura K:Enchant creature A:SP$ Attach | Cost$ 1 B | ValidTgts$ Creature | AILogic$ Pump S:Mode$ Continuous | Affected$ Creature.EnchantedBy | AddPower$ 2 | AddToughness$ 1 | AddAbility$ PumpA | Description$ Enchanted creature gets +2/+1 and has "{S}: This creature can't be blocked this turn except by snow creatures." ({S} can be paid with one mana from a snow permanent.) -SVar:PumpA:AB$ Pump | Cost$ S | KW$ HIDDEN CantBeBlockedBy Creature.nonSnow | SpellDescription$ CARDNAME can't be blocked this turn except by snow creatures. +SVar:PumpA:AB$ Effect | Cost$ S | Name$ Rime Transfusion Effect | StaticAbilities$ KWPump | SpellDescription$ CARDNAME can't be blocked this turn except by snow creatures. +SVar:KWPump:Mode$ CantBlockBy | ValidAttacker$ Creature.EffectSource | ValidBlocker$ Creature.nonSnow | EffectZone$ Command | Description$ EFFECTSOURCE can't be blocked this turn except by snow creatures. SVar:Picture:http://www.wizards.com/global/images/magic/general/rime_transfusion.jpg Oracle:Enchant creature\nEnchanted creature gets +2/+1 and has "{S}: This creature can't be blocked this turn except by snow creatures." ({S} can be paid with one mana from a snow permanent.) diff --git a/forge-gui/res/cardsfolder/s/sabertooth_alley_cat.txt b/forge-gui/res/cardsfolder/s/sabertooth_alley_cat.txt index b029ace647f..f4b1d278950 100644 --- a/forge-gui/res/cardsfolder/s/sabertooth_alley_cat.txt +++ b/forge-gui/res/cardsfolder/s/sabertooth_alley_cat.txt @@ -3,6 +3,7 @@ ManaCost:1 R R Types:Creature Cat PT:2/1 K:CARDNAME attacks each combat if able. -A:AB$ Pump | Cost$ 1 R | KW$ HIDDEN CantBeBlockedBy Creature.withoutDefender | SpellDescription$ Creatures without defender can't block CARDNAME this turn. +A:AB$ Effect | Cost$ 1 R | Name$ Sabertooth Alley Cat's Effect | StaticAbilities$ KWPump | SpellDescription$ Creatures without defender can't block CARDNAME this turn. +SVar:KWPump:Mode$ CantBlockBy | ValidAttacker$ Creature.EffectSource | ValidBlocker$ Creature.withoutDefender | EffectZone$ Command | Description$ Creatures without defender can't block EFFECTSOURCE this turn. SVar:Picture:http://www.wizards.com/global/images/magic/general/sabertooth_alley_cat.jpg Oracle:Sabertooth Alley Cat attacks each combat if able.\n{1}{R}: Creatures without defender can't block Sabertooth Alley Cat this turn. diff --git a/forge-gui/res/cardsfolder/s/sedge_sliver.txt b/forge-gui/res/cardsfolder/s/sedge_sliver.txt index d17c5c36240..2b4b00f4d29 100644 --- a/forge-gui/res/cardsfolder/s/sedge_sliver.txt +++ b/forge-gui/res/cardsfolder/s/sedge_sliver.txt @@ -2,11 +2,10 @@ Name:Sedge Sliver ManaCost:2 R Types:Creature Sliver PT:2/2 -S:Mode$ Continuous | Affected$ Creature.Sliver | AddStaticAbility$ SedgeSliverST | AddSVar$ SedgeSliverX | Description$ All Sliver creatures have "This creature gets +1/+1 as long as you control a Swamp." -SVar:SedgeSliverST:Mode$ Continuous | Affected$ Card.Self | AddPower$ 1 | AddToughness$ 1 | CheckSVar$ SedgeSliverX | Description$ CARDNAME gets +1/+1 as long as you control a Swamp. +S:Mode$ Continuous | Affected$ Creature.Sliver | AddStaticAbility$ SedgeSliverST | Description$ All Sliver creatures have "This creature gets +1/+1 as long as you control a Swamp." +SVar:SedgeSliverST:Mode$ Continuous | Affected$ Card.Self | AddPower$ 1 | AddToughness$ 1 | IsPresent$ Swamp.YouCtrl | Description$ CARDNAME gets +1/+1 as long as you control a Swamp. S:Mode$ Continuous | Affected$ Sliver | AddAbility$ Pump | Description$ All Slivers have "{B}: Regenerate this permanent." SVar:Pump:AB$ Regenerate | Cost$ B | SpellDescription$ Regenerate CARDNAME. -SVar:SedgeSliverX:Count$Valid Swamp.YouCtrl SVar:PlayMain1:TRUE SVar:RemRandomDeck:True DeckNeeds:Color$Black diff --git a/forge-gui/res/cardsfolder/s/seeker.txt b/forge-gui/res/cardsfolder/s/seeker.txt index 3f624395fc5..f6216341d85 100644 --- a/forge-gui/res/cardsfolder/s/seeker.txt +++ b/forge-gui/res/cardsfolder/s/seeker.txt @@ -3,6 +3,6 @@ ManaCost:2 W W Types:Enchantment Aura K:Enchant creature A:SP$ Attach | Cost$ 2 W W | ValidTgts$ Creature | AILogic$ Pump -S:Mode$ Continuous | Affected$ Creature.EnchantedBy | AddHiddenKeyword$ CantBeBlockedBy Creature.nonArtifact+nonWhite | Description$ Enchanted creature can't be blocked except by artifact creatures and/or white creatures. +S:Mode$ CantBlockBy | ValidAttacker$ Creature.EnchantedBy | ValidBlocker$ Creature.nonArtifact+nonWhite | Description$ Enchanted creature can't be blocked except by artifact creatures and/or white creatures. SVar:Picture:http://www.wizards.com/global/images/magic/general/seeker.jpg Oracle:Enchant creature\nEnchanted creature can't be blocked except by artifact creatures and/or white creatures. diff --git a/forge-gui/res/cardsfolder/s/shifting_sliver.txt b/forge-gui/res/cardsfolder/s/shifting_sliver.txt index 79ea90797b9..571859527b5 100644 --- a/forge-gui/res/cardsfolder/s/shifting_sliver.txt +++ b/forge-gui/res/cardsfolder/s/shifting_sliver.txt @@ -2,6 +2,6 @@ Name:Shifting Sliver ManaCost:3 U Types:Creature Sliver PT:2/2 -S:Mode$ Continuous | Affected$ Creature.Sliver | AddHiddenKeyword$ CantBeBlockedBy Creature.nonSliver | Description$ Slivers can't be blocked except by Slivers. +S:Mode$ CantBlockBy | ValidAttacker$ Creature.Sliver | ValidBlocker$ Creature.nonSliver | Description$ Slivers can't be blocked except by Slivers. SVar:Picture:http://www.wizards.com/global/images/magic/general/shifting_sliver.jpg Oracle:Slivers can't be blocked except by Slivers. diff --git a/forge-gui/res/cardsfolder/s/skyblinder_staff.txt b/forge-gui/res/cardsfolder/s/skyblinder_staff.txt index f9ed68ab8e3..cf591c693ea 100644 --- a/forge-gui/res/cardsfolder/s/skyblinder_staff.txt +++ b/forge-gui/res/cardsfolder/s/skyblinder_staff.txt @@ -3,6 +3,6 @@ ManaCost:1 Types:Artifact Equipment K:Equip 3 S:Mode$ Continuous | Affected$ Creature.EquippedBy | AddPower$ 1 | Description$ Equipped creature gets +1/+0 and can't be blocked by creatures with flying. -S:Mode$ Continuous | Affected$ Creature.EquippedBy | AddHiddenKeyword$ CantBeBlockedBy Creature.withFlying +S:Mode$ CantBlockBy | ValidAttacker$ Creature.EquippedBy | ValidBlocker$ Creature.withFlying | Secondary$ True | Description$ Equipped creature can't be blocked by creatures with flying. SVar:Picture:http://www.wizards.com/global/images/magic/general/skyblinder_staff.jpg Oracle:Equipped creature gets +1/+0 and can't be blocked by creatures with flying.\nEquip {3} ({3}: Attach to target creature you control. Equip only as a sorcery.) diff --git a/forge-gui/res/cardsfolder/t/tower_of_coireall.txt b/forge-gui/res/cardsfolder/t/tower_of_coireall.txt index 925322c5158..367b989621c 100644 --- a/forge-gui/res/cardsfolder/t/tower_of_coireall.txt +++ b/forge-gui/res/cardsfolder/t/tower_of_coireall.txt @@ -1,7 +1,8 @@ Name:Tower of Coireall ManaCost:2 Types:Artifact -A:AB$ Pump | Cost$ T | ValidTgts$ Creature | TgtPrompt$ Select target creature | KW$ HIDDEN CantBeBlockedBy Creature.Wall | SpellDescription$ Target creature can't be blocked by Walls this turn. +A:AB$ Effect | Cost$ T | ValidTgts$ Creature | TgtPrompt$ Select target creature | RememberObjects$ Targeted | Name$ Tower of Coireall Effect | StaticAbilities$ KWPump | SpellDescription$ Target creature can't be blocked by Walls this turn. +SVar:KWPump:Mode$ CantBlockBy | ValidAttacker$ Creature.Remembered | ValidBlocker$ Creature.Wall | EffectZone$ Command | Description$ Remembered creature can't be blocked by Walls this turn. SVar:RemRandomDeck:True SVar:Picture:http://www.wizards.com/global/images/magic/general/tower_of_coireall.jpg Oracle:{T}: Target creature can't be blocked by Walls this turn. diff --git a/forge-gui/res/cardsfolder/t/treetop_bracers.txt b/forge-gui/res/cardsfolder/t/treetop_bracers.txt index c81bab86703..50be8d7a000 100644 --- a/forge-gui/res/cardsfolder/t/treetop_bracers.txt +++ b/forge-gui/res/cardsfolder/t/treetop_bracers.txt @@ -3,6 +3,7 @@ ManaCost:1 G Types:Enchantment Aura K:Enchant creature A:SP$ Attach | Cost$ 1 G | ValidTgts$ Creature | AILogic$ Pump -S:Mode$ Continuous | Affected$ Creature.EnchantedBy | AddPower$ 1 | AddToughness$ 1 | AddHiddenKeyword$ CantBeBlockedBy Creature.withoutFlying | Description$ Enchanted creature gets +1/+1 and can't be blocked except by creatures with flying. +S:Mode$ Continuous | Affected$ Creature.EnchantedBy | AddPower$ 1 | AddToughness$ 1 | Description$ Enchanted creature gets +1/+1 and can't be blocked except by creatures with flying. +S:Mode$ CantBlockBy | ValidAttacker$ Creature.EnchantedBy | ValidBlocker$ Creature.withoutFlying | Secondary$ True | Description$ Enchanted creature can't be blocked except by creatures with flying. SVar:Picture:http://www.wizards.com/global/images/magic/general/treetop_bracers.jpg Oracle:Enchant creature (Target a creature as you cast this. This card enters the battlefield attached to that creature.)\nEnchanted creature gets +1/+1 and can't be blocked except by creatures with flying. diff --git a/forge-gui/res/cardsfolder/v/varchilds_crusader.txt b/forge-gui/res/cardsfolder/v/varchilds_crusader.txt index 092fde32a6d..62420f73ba2 100644 --- a/forge-gui/res/cardsfolder/v/varchilds_crusader.txt +++ b/forge-gui/res/cardsfolder/v/varchilds_crusader.txt @@ -2,7 +2,8 @@ Name:Varchild's Crusader ManaCost:3 R Types:Creature Human Knight PT:3/2 -A:AB$ Pump | Cost$ 0 | KW$ HIDDEN CantBeBlockedBy Creature.nonWall | AtEOT$ Sacrifice | SpellDescription$ CARDNAME can't be blocked this turn except by Walls. Sacrifice CARDNAME at the beginning of the next end step. +A:AB$ Effect | Cost$ 0 | AtEOT$ Sacrifice | Name$ Varchild's Crusader Effect | StaticAbilities$ KWPump | SpellDescription$ CARDNAME can't be blocked this turn except by Walls. Sacrifice CARDNAME at the beginning of the next end step. +SVar:KWPump:Mode$ CantBlockBy | ValidAttacker$ Creature.EffectSource | ValidBlocker$ Creature.nonWall | EffectZone$ Command | Description$ EFFECTSOURCE can't be blocked this turn except by Walls. SVar:RemAIDeck:True SVar:Picture:http://www.wizards.com/global/images/magic/general/varchilds_crusader.jpg Oracle:{0}: Varchild's Crusader can't be blocked this turn except by Walls. Sacrifice Varchild's Crusader at the beginning of the next end step. diff --git a/forge-gui/res/cardsfolder/w/white_scarab.txt b/forge-gui/res/cardsfolder/w/white_scarab.txt index 34ddb4dbfb1..423f81f36c7 100644 --- a/forge-gui/res/cardsfolder/w/white_scarab.txt +++ b/forge-gui/res/cardsfolder/w/white_scarab.txt @@ -3,9 +3,8 @@ ManaCost:W Types:Enchantment Aura K:Enchant creature A:SP$ Attach | Cost$ W | ValidTgts$ Creature | AILogic$ Pump -S:Mode$ Continuous | Affected$ Creature.EnchantedBy | AddHiddenKeyword$ CantBeBlockedBy Creature.White | Description$ Enchanted creature can't be blocked by white creatures. -S:Mode$ Continuous | Affected$ Creature.EnchantedBy | AddPower$ 2 | AddToughness$ 2 | CheckSVar$ X | SVarCompare$ GE1 | Description$ Enchanted creature gets +2/+2 as long as an opponent controls a white permanent. -SVar:X:Count$Valid Permanent.White+OppCtrl +S:Mode$ CantBlockBy | ValidAttacker$ Creature.EnchantedBy | ValidBlocker$ Creature.White | Description$ Enchanted creature can't be blocked by white creatures. +S:Mode$ Continuous | Affected$ Creature.EnchantedBy | AddPower$ 2 | AddToughness$ 2 | IsPresent$ Permanent.White+OppCtrl | Description$ Enchanted creature gets +2/+2 as long as an opponent controls a white permanent. SVar:RemRandomDeck:True SVar:Picture:http://www.wizards.com/global/images/magic/general/white_scarab.jpg Oracle:Enchant creature\nEnchanted creature can't be blocked by white creatures.\nEnchanted creature gets +2/+2 as long as an opponent controls a white permanent. diff --git a/forge-gui/res/cardsfolder/z/zulaport_enforcer.txt b/forge-gui/res/cardsfolder/z/zulaport_enforcer.txt index 5eaeae6ce77..704beb4ee91 100644 --- a/forge-gui/res/cardsfolder/z/zulaport_enforcer.txt +++ b/forge-gui/res/cardsfolder/z/zulaport_enforcer.txt @@ -4,9 +4,8 @@ Types:Creature Human Warrior PT:1/1 K:Level up:4 SVar:maxLevel:3 -S:Mode$ Continuous | Affected$ Card.Self | SetPower$ 3 | SetToughness$ 3 | CheckSVar$ X | SVarCompare$ EQ1 | Description$ LEVEL 1-2 3/3 -S:Mode$ Continuous | Affected$ Card.Self | SetPower$ 5 | SetToughness$ 5 | AddHiddenKeyword$ CantBeBlockedBy Creature.nonBlack | CheckSVar$ Y | SVarCompare$ EQ1 | Description$ LEVEL 3+ 5/5 CARDNAME can't be blocked except by black creatures -SVar:X:Count$Valid Card.Self+counters_GE1_LEVEL+counters_LT3_LEVEL -SVar:Y:Count$Valid Card.Self+counters_GE3_LEVEL +S:Mode$ Continuous | Affected$ Card.Self | SetPower$ 3 | SetToughness$ 3 | IsPresent$ Card.Self+counters_GE1_LEVEL+counters_LT3_LEVEL | Description$ LEVEL 1-2 3/3 +S:Mode$ Continuous | Affected$ Card.Self | SetPower$ 5 | SetToughness$ 5 | IsPresent$ Card.Self+counters_GE3_LEVEL | Description$ LEVEL 3+ 5/5 CARDNAME can't be blocked except by black creatures +S:Mode$ CantBlockBy | ValidAttacker$ Creature.Self | ValidBlocker$ Creature.nonBlack | Secondary$ True | IsPresent$ Card.Self+counters_GE3_LEVEL | Description$ CARDNAME can't be blocked except by black creatures SVar:Picture:http://www.wizards.com/global/images/magic/general/zulaport_enforcer.jpg Oracle:Level up {4} ({4}: Put a level counter on this. Level up only as a sorcery.)\nLEVEL 1-2\n3/3\nLEVEL 3+\n5/5\nZulaport Enforcer can't be blocked except by black creatures. From 3f1d6238ff6d94048bf33d91525ae0d58debafe8 Mon Sep 17 00:00:00 2001 From: Hanmac Date: Sat, 17 Feb 2018 12:01:53 +0100 Subject: [PATCH 7/9] CardFactoryUtil: add Battle cry as trigger --- forge-game/src/main/java/forge/game/card/Card.java | 2 +- .../main/java/forge/game/card/CardFactoryUtil.java | 12 ++++++++++++ forge-gui/res/cardsfolder/a/accorder_paladin.txt | 3 +-- forge-gui/res/cardsfolder/g/goblin_wardriver.txt | 3 +-- forge-gui/res/cardsfolder/h/hero_of_bladehold.txt | 3 +-- forge-gui/res/cardsfolder/h/hero_of_oxid_ridge.txt | 3 +-- forge-gui/res/cardsfolder/k/kuldotha_ringleader.txt | 3 +-- forge-gui/res/cardsfolder/l/loxodon_partisan.txt | 3 +-- forge-gui/res/cardsfolder/s/signal_pest.txt | 3 +-- 9 files changed, 20 insertions(+), 15 deletions(-) diff --git a/forge-game/src/main/java/forge/game/card/Card.java b/forge-game/src/main/java/forge/game/card/Card.java index 353f743495a..73192aa9796 100644 --- a/forge-game/src/main/java/forge/game/card/Card.java +++ b/forge-game/src/main/java/forge/game/card/Card.java @@ -1546,7 +1546,7 @@ public class Card extends GameEntity implements Comparable { || (keyword.startsWith("Split second") && !sb.toString().contains("Split second")) || keyword.equals("Suspend") // for the ones without amounnt || keyword.equals("Hideaway") || keyword.equals("Ascend") - || keyword.equals("Totem armor") + || keyword.equals("Totem armor") || keyword.equals("Battle cry") || keyword.equals("Devoid")){ sbLong.append(keyword + " (" + inst.getReminderText() + ")"); } else if (keyword.startsWith("Modular") || keyword.startsWith("Bloodthirst") diff --git a/forge-game/src/main/java/forge/game/card/CardFactoryUtil.java b/forge-game/src/main/java/forge/game/card/CardFactoryUtil.java index 09cdfdfe561..5c1a576ff06 100644 --- a/forge-game/src/main/java/forge/game/card/CardFactoryUtil.java +++ b/forge-game/src/main/java/forge/game/card/CardFactoryUtil.java @@ -2114,6 +2114,18 @@ public class CardFactoryUtil { sa.setBlessing(true); } } + } else if (keyword.equals("Battle cry")) { + final String trig = "Mode$ Attacks | ValidCard$ Card.Self | TriggerZones$ Battlefield | Secondary$ True " + + " | TriggerDescription$ " + keyword + " (" + inst.getReminderText() + ")"; + String pumpStr = "DB$ PumpAll | ValidCards$ Creature.attacking+Other | NumAtt$ 1"; + SpellAbility sa = AbilityFactory.getAbility(pumpStr, card); + + sa.setIntrinsic(intrinsic); + + final Trigger trigger = TriggerHandler.parseTrigger(trig, card, intrinsic); + trigger.setOverridingAbility(sa); + + inst.addTrigger(trigger); } else if (keyword.startsWith("Bushido")) { final String[] k = keyword.split(" ", 2); final String n = k[1]; diff --git a/forge-gui/res/cardsfolder/a/accorder_paladin.txt b/forge-gui/res/cardsfolder/a/accorder_paladin.txt index b09cc8fc82e..b4140e30ff1 100644 --- a/forge-gui/res/cardsfolder/a/accorder_paladin.txt +++ b/forge-gui/res/cardsfolder/a/accorder_paladin.txt @@ -2,7 +2,6 @@ Name:Accorder Paladin ManaCost:1 W Types:Creature Human Knight PT:3/1 -T:Mode$ Attacks | ValidCard$ Card.Self | TriggerZones$ Battlefield | Execute$ TrigBattleCry | TriggerDescription$ Battle cry (Whenever this creature attacks, each other attacking creature gets +1/+0 until end of turn.) -SVar:TrigBattleCry:DB$ PumpAll | ValidCards$ Creature.attacking+Other | NumAtt$ 1 +K:Battle cry SVar:Picture:http://www.wizards.com/global/images/magic/general/accorder_paladin.jpg Oracle:Battle cry (Whenever this creature attacks, each other attacking creature gets +1/+0 until end of turn.) diff --git a/forge-gui/res/cardsfolder/g/goblin_wardriver.txt b/forge-gui/res/cardsfolder/g/goblin_wardriver.txt index 58fa35ac1b1..3b0b03341ad 100644 --- a/forge-gui/res/cardsfolder/g/goblin_wardriver.txt +++ b/forge-gui/res/cardsfolder/g/goblin_wardriver.txt @@ -2,7 +2,6 @@ Name:Goblin Wardriver ManaCost:R R Types:Creature Goblin Warrior PT:2/2 -T:Mode$ Attacks | ValidCard$ Card.Self | TriggerZones$ Battlefield | Execute$ TrigBattleCry | TriggerDescription$ Battle cry (Whenever this creature attacks, each other attacking creature gets +1/+0 until end of turn.) -SVar:TrigBattleCry:DB$PumpAll | ValidCards$ Creature.attacking+Other | NumAtt$ 1 +K:Battle cry SVar:Picture:http://www.wizards.com/global/images/magic/general/goblin_wardriver.jpg Oracle:Battle cry (Whenever this creature attacks, each other attacking creature gets +1/+0 until end of turn.) diff --git a/forge-gui/res/cardsfolder/h/hero_of_bladehold.txt b/forge-gui/res/cardsfolder/h/hero_of_bladehold.txt index 2a5d070d5b8..3ae17564746 100644 --- a/forge-gui/res/cardsfolder/h/hero_of_bladehold.txt +++ b/forge-gui/res/cardsfolder/h/hero_of_bladehold.txt @@ -2,9 +2,8 @@ Name:Hero of Bladehold ManaCost:2 W W Types:Creature Human Knight PT:3/4 +K:Battle cry T:Mode$ Attacks | ValidCard$ Card.Self | Execute$ TrigToken | TriggerDescription$ Whenever CARDNAME attacks, create two 1/1 white Soldier creature tokens that are tapped and attacking. -T:Mode$ Attacks | ValidCard$ Card.Self | TriggerZones$ Battlefield | Execute$ TrigBattleCry | TriggerDescription$ Battle cry (Whenever this creature attacks, each other attacking creature gets +1/+0 until end of turn.) -SVar:TrigBattleCry:DB$ PumpAll | ValidCards$ Creature.attacking+Other | NumAtt$ 1 SVar:TrigToken:DB$ Token | TokenAmount$ 2 | TokenName$ Soldier | TokenTypes$ Creature,Soldier | TokenOwner$ You | TokenColors$ White | TokenPower$ 1 | TokenToughness$ 1 | TokenTapped$ True | TokenAttacking$ True | TokenImage$ w 1 1 soldier SOM SVar:HasAttackEffect:TRUE SVar:Picture:http://www.wizards.com/global/images/magic/general/hero_of_bladehold.jpg diff --git a/forge-gui/res/cardsfolder/h/hero_of_oxid_ridge.txt b/forge-gui/res/cardsfolder/h/hero_of_oxid_ridge.txt index 029bc3bb411..6bafae0a380 100644 --- a/forge-gui/res/cardsfolder/h/hero_of_oxid_ridge.txt +++ b/forge-gui/res/cardsfolder/h/hero_of_oxid_ridge.txt @@ -3,9 +3,8 @@ ManaCost:2 R R Types:Creature Human Knight PT:4/2 K:Haste -T:Mode$ Attacks | ValidCard$ Card.Self | TriggerZones$ Battlefield | Execute$ TrigBattleCry | TriggerDescription$ Battle cry (Whenever this creature attacks, each other attacking creature gets +1/+0 until end of turn.) +K:Battle cry T:Mode$ Attacks | ValidCard$ Card.Self | TriggerZones$ Battlefield | Execute$ TrigEffect | TriggerDescription$ When CARDNAME attacks, creatures with power 1 or less can't block this turn. -SVar:TrigBattleCry:DB$ PumpAll | ValidCards$ Creature.attacking+Other | NumAtt$ 1 SVar:TrigEffect:DB$ Effect | Name$ Hero of Oxid Ridge Effect | StaticAbilities$ KWPump SVar:KWPump:Mode$ Continuous | EffectZone$ Command | Affected$ Creature.powerLE1 | AddHiddenKeyword$ CARDNAME can't block. | Description$ Creatures with power 1 or less can't block this turn. SVar:Picture:http://www.wizards.com/global/images/magic/general/hero_of_oxid_ridge.jpg diff --git a/forge-gui/res/cardsfolder/k/kuldotha_ringleader.txt b/forge-gui/res/cardsfolder/k/kuldotha_ringleader.txt index 533504e19c2..10310312ab7 100644 --- a/forge-gui/res/cardsfolder/k/kuldotha_ringleader.txt +++ b/forge-gui/res/cardsfolder/k/kuldotha_ringleader.txt @@ -2,8 +2,7 @@ Name:Kuldotha Ringleader ManaCost:4 R Types:Creature Giant Berserker PT:4/4 +K:Battle cry K:CARDNAME attacks each combat if able. -T:Mode$ Attacks | ValidCard$ Card.Self | TriggerZones$ Battlefield | Execute$ TrigBattleCry | TriggerDescription$ Battle cry (Whenever this creature attacks, each other attacking creature gets +1/+0 until end of turn.) -SVar:TrigBattleCry:DB$PumpAll | ValidCards$ Creature.attacking+Other | NumAtt$ 1 SVar:Picture:http://www.wizards.com/global/images/magic/general/kuldotha_ringleader.jpg Oracle:Battle cry (Whenever this creature attacks, each other attacking creature gets +1/+0 until end of turn.)\nKuldotha Ringleader attacks each combat if able. diff --git a/forge-gui/res/cardsfolder/l/loxodon_partisan.txt b/forge-gui/res/cardsfolder/l/loxodon_partisan.txt index 7303a3172b8..0f7102adf01 100644 --- a/forge-gui/res/cardsfolder/l/loxodon_partisan.txt +++ b/forge-gui/res/cardsfolder/l/loxodon_partisan.txt @@ -2,7 +2,6 @@ Name:Loxodon Partisan ManaCost:4 W Types:Creature Elephant Soldier PT:3/4 -T:Mode$ Attacks | ValidCard$ Card.Self | TriggerZones$ Battlefield | Execute$ TrigBattleCry | TriggerDescription$ Battle cry (Whenever this creature attacks, each other attacking creature gets +1/+0 until end of turn.) -SVar:TrigBattleCry:DB$PumpAll | ValidCards$ Creature.attacking+Other | NumAtt$ 1 +K:Battle cry SVar:Picture:http://www.wizards.com/global/images/magic/general/loxodon_partisan.jpg Oracle:Battle cry (Whenever this creature attacks, each other attacking creature gets +1/+0 until end of turn.) diff --git a/forge-gui/res/cardsfolder/s/signal_pest.txt b/forge-gui/res/cardsfolder/s/signal_pest.txt index 5f09d6c476c..0cddd3ba6cf 100644 --- a/forge-gui/res/cardsfolder/s/signal_pest.txt +++ b/forge-gui/res/cardsfolder/s/signal_pest.txt @@ -2,8 +2,7 @@ Name:Signal Pest ManaCost:1 Types:Artifact Creature Pest PT:0/1 +K:Battle cry K:CantBeBlockedBy Creature.withoutFlying+withoutReach -T:Mode$ Attacks | ValidCard$ Card.Self | TriggerZones$ Battlefield | Execute$ TrigBattleCry | TriggerDescription$ Battle cry (Whenever this creature attacks, each other attacking creature gets +1/+0 until end of turn.) -SVar:TrigBattleCry:DB$PumpAll | ValidCards$ Creature.attacking+Other | NumAtt$ 1 SVar:Picture:http://www.wizards.com/global/images/magic/general/signal_pest.jpg Oracle:Battle cry (Whenever this creature attacks, each other attacking creature gets +1/+0 until end of turn.)\nSignal Pest can't be blocked except by creatures with flying or reach. From a829dc72bcce2f710d3fb2d6e6049b663fdb2988 Mon Sep 17 00:00:00 2001 From: Hanmac Date: Sat, 17 Feb 2018 15:25:51 +0100 Subject: [PATCH 8/9] CardFactoryUtil: make CantBeBlockedBy into new StaticAbility --- .../src/main/java/forge/game/card/Card.java | 115 +----------------- .../java/forge/game/card/CardFactoryUtil.java | 114 +++++++++++++++++ .../java/forge/game/combat/CombatUtil.java | 28 ----- 3 files changed, 117 insertions(+), 140 deletions(-) diff --git a/forge-game/src/main/java/forge/game/card/Card.java b/forge-game/src/main/java/forge/game/card/Card.java index 73192aa9796..9d160f25d16 100644 --- a/forge-game/src/main/java/forge/game/card/Card.java +++ b/forge-game/src/main/java/forge/game/card/Card.java @@ -18,7 +18,6 @@ package forge.game.card; import com.esotericsoftware.minlog.Log; -import com.google.common.base.Function; import com.google.common.collect.*; import forge.GameCommand; import forge.ImageKeys; @@ -1537,6 +1536,7 @@ public class Card extends GameEntity implements Comparable { sbLong.append(keyword).append("\r\n"); } else if (keyword.startsWith("Strive") || keyword.startsWith("Escalate") || keyword.startsWith("ETBReplacement") + || keyword.startsWith("CantBeBlockedBy ") || keyword.equals("CARDNAME enters the battlefield tapped.") || keyword.startsWith("UpkeepCost")) { } else if (keyword.startsWith("Provoke") || keyword.startsWith("Ingest") || keyword.equals("Unleash") @@ -1595,12 +1595,9 @@ public class Card extends GameEntity implements Comparable { || keyword.startsWith("Amplify") || keyword.startsWith("Ninjutsu") || keyword.startsWith("Cycling") || keyword.startsWith("TypeCycling")) { // keyword parsing takes care of adding a proper description - } else if (keyword.startsWith("CantBeBlockedBy")) { + } else if (keyword.startsWith("CantBeBlockedByAmount")) { sbLong.append(getName()).append(" can't be blocked "); - if (keyword.startsWith("CantBeBlockedByAmount")) - sbLong.append(getTextForKwCantBeBlockedByAmount(keyword)); - else - sbLong.append(getTextForKwCantBeBlockedByType(keyword)); + sbLong.append(getTextForKwCantBeBlockedByAmount(keyword)); } else if (keyword.startsWith("CantBlock")) { sbLong.append(getName()).append(" can't block "); if (keyword.contains("CardUID")) { @@ -1657,112 +1654,6 @@ public class Card extends GameEntity implements Comparable { return byClause + Lang.nounWithNumeral(cnt, isLT ? "or more creature" : "creature"); } - private static String getTextForKwCantBeBlockedByType(final String keyword) { - boolean negative = true; - final List subs = Lists.newArrayList(TextUtil.split(keyword.split(" ", 2)[1], ',')); - final List> subsAnd = Lists.newArrayList(); - final List orClauses = Lists.newArrayList(); - for (final String expession : subs) { - final List parts = Lists.newArrayList(expession.split("[.+]")); - for (int p = 0; p < parts.size(); p++) { - final String part = parts.get(p); - if (part.equalsIgnoreCase("creature")) { - parts.remove(p--); - continue; - } - // based on suppossition that each expression has at least 1 predicate except 'creature' - negative &= part.contains("non") || part.contains("without"); - } - subsAnd.add(parts); - } - - final boolean allNegative = negative; - final String byClause = allNegative ? "except by " : "by "; - - final Function, String> withToString = new Function, String>() { - @Override - public String apply(Pair inp) { - boolean useNon = inp.getKey() == allNegative; - return (useNon ? "*NO* " : "") + inp.getRight(); - } - }; - - for (final List andOperands : subsAnd) { - final List> prependedAdjectives = Lists.newArrayList(); - final List> postponedAdjectives = Lists.newArrayList(); - String creatures = null; - - for (String part : andOperands) { - boolean positive = true; - if (part.startsWith("non")) { - part = part.substring(3); - positive = false; - } - if (part.startsWith("with")) { - positive = !part.startsWith("without"); - postponedAdjectives.add(Pair.of(positive, part.substring(positive ? 4 : 7))); - } else if (part.startsWith("powerLEX")) {// Kraken of the Straits - postponedAdjectives.add(Pair.of(true, "power less than the number of islands you control")); - } else if (part.startsWith("power")) { - int kwLength = 5; - String opName = Expressions.operatorName(part.substring(kwLength, kwLength + 2)); - String operand = part.substring(kwLength + 2); - postponedAdjectives.add(Pair.of(true, "power" + opName + operand)); - } else if (CardType.isACreatureType(part)) { - if (creatures != null && CardType.isACreatureType(creatures)) { // e.g. Kor Castigator - creatures = StringUtils.capitalize(Lang.getPlural(part)) + creatures; - } else { - creatures = StringUtils.capitalize(Lang.getPlural(part)) + (creatures == null ? "" : " or " + creatures); - } - // Kor Castigator and other similar creatures with composite subtype Eldrazi Scion in their text - creatures = TextUtil.fastReplace(creatures, "Scions or Eldrazis", "Eldrazi Scions"); - } else { - prependedAdjectives.add(Pair.of(positive, part.toLowerCase())); - } - } - - StringBuilder sbShort = new StringBuilder(); - if (allNegative) { - boolean isFirst = true; - for (Pair pre : prependedAdjectives) { - if (isFirst) isFirst = false; - else sbShort.append(" and/or "); - - boolean useNon = pre.getKey() == allNegative; - if (useNon) sbShort.append("non-"); - sbShort.append(pre.getValue()).append(" ").append(creatures == null ? "creatures" : creatures); - } - if (prependedAdjectives.isEmpty()) - sbShort.append(creatures == null ? "creatures" : creatures); - - if (!postponedAdjectives.isEmpty()) { - if (!prependedAdjectives.isEmpty()) { - sbShort.append(" and/or creatures"); - } - - sbShort.append(" with "); - sbShort.append(Lang.joinHomogenous(postponedAdjectives, withToString, allNegative ? "or" : "and")); - } - - } else { - for (Pair pre : prependedAdjectives) { - boolean useNon = pre.getKey() == allNegative; - if (useNon) sbShort.append("non-"); - sbShort.append(pre.getValue()).append(" "); - } - sbShort.append(creatures == null ? "creatures" : creatures); - - if (!postponedAdjectives.isEmpty()) { - sbShort.append(" with "); - sbShort.append(Lang.joinHomogenous(postponedAdjectives, withToString, allNegative ? "or" : "and")); - } - - } - orClauses.add(sbShort.toString()); - } - return byClause + StringUtils.join(orClauses, " or ") + "."; - } - // get the text of the abilities of a card public String getAbilityText() { return getAbilityText(currentState); diff --git a/forge-game/src/main/java/forge/game/card/CardFactoryUtil.java b/forge-game/src/main/java/forge/game/card/CardFactoryUtil.java index 5c1a576ff06..3a5d9418b3f 100644 --- a/forge-game/src/main/java/forge/game/card/CardFactoryUtil.java +++ b/forge-game/src/main/java/forge/game/card/CardFactoryUtil.java @@ -17,6 +17,7 @@ */ package forge.game.card; +import com.google.common.base.Function; import com.google.common.base.Predicate; import com.google.common.base.Predicates; import com.google.common.collect.Iterables; @@ -51,10 +52,12 @@ import forge.game.trigger.TriggerHandler; import forge.game.zone.Zone; import forge.game.zone.ZoneType; import forge.util.Aggregates; +import forge.util.Expressions; import forge.util.Lang; import forge.util.TextUtil; import forge.util.collect.FCollectionView; import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.tuple.Pair; import java.util.*; import java.util.Map.Entry; @@ -4226,6 +4229,11 @@ public class CardFactoryUtil { } else if (keyword.equals("Undaunted")) { effect = "Mode$ ReduceCost | ValidCard$ Card.Self | Type$ Spell | Secondary$ True" + "| Amount$ Undaunted | EffectZone$ All | Description$ Undaunted (" + inst.getReminderText() + ")"; + } else if (keyword.startsWith("CantBeBlockedBy ")) { + final String[] k = keyword.split(" ", 2); + + effect = "Mode$ CantBlockBy | ValidAttacker$ Creature.Self | ValidBlocker$ " + k[1] + + " | Description$ CARDNAME can't be blocked " + getTextForKwCantBeBlockedByType(keyword); } if (effect != null) { @@ -4277,4 +4285,110 @@ public class CardFactoryUtil { return as; // ETBReplacementMove(sa.getHostCard(), null)); } + + private static String getTextForKwCantBeBlockedByType(final String keyword) { + boolean negative = true; + final List subs = Lists.newArrayList(TextUtil.split(keyword.split(" ", 2)[1], ',')); + final List> subsAnd = Lists.newArrayList(); + final List orClauses = Lists.newArrayList(); + for (final String expession : subs) { + final List parts = Lists.newArrayList(expession.split("[.+]")); + for (int p = 0; p < parts.size(); p++) { + final String part = parts.get(p); + if (part.equalsIgnoreCase("creature")) { + parts.remove(p--); + continue; + } + // based on suppossition that each expression has at least 1 predicate except 'creature' + negative &= part.contains("non") || part.contains("without"); + } + subsAnd.add(parts); + } + + final boolean allNegative = negative; + final String byClause = allNegative ? "except by " : "by "; + + final Function, String> withToString = new Function, String>() { + @Override + public String apply(Pair inp) { + boolean useNon = inp.getKey() == allNegative; + return (useNon ? "*NO* " : "") + inp.getRight(); + } + }; + + for (final List andOperands : subsAnd) { + final List> prependedAdjectives = Lists.newArrayList(); + final List> postponedAdjectives = Lists.newArrayList(); + String creatures = null; + + for (String part : andOperands) { + boolean positive = true; + if (part.startsWith("non")) { + part = part.substring(3); + positive = false; + } + if (part.startsWith("with")) { + positive = !part.startsWith("without"); + postponedAdjectives.add(Pair.of(positive, part.substring(positive ? 4 : 7))); + } else if (part.startsWith("powerLEX")) {// Kraken of the Straits + postponedAdjectives.add(Pair.of(true, "power less than the number of islands you control")); + } else if (part.startsWith("power")) { + int kwLength = 5; + String opName = Expressions.operatorName(part.substring(kwLength, kwLength + 2)); + String operand = part.substring(kwLength + 2); + postponedAdjectives.add(Pair.of(true, "power" + opName + operand)); + } else if (CardType.isACreatureType(part)) { + if (creatures != null && CardType.isACreatureType(creatures)) { // e.g. Kor Castigator + creatures = StringUtils.capitalize(Lang.getPlural(part)) + creatures; + } else { + creatures = StringUtils.capitalize(Lang.getPlural(part)) + (creatures == null ? "" : " or " + creatures); + } + // Kor Castigator and other similar creatures with composite subtype Eldrazi Scion in their text + creatures = TextUtil.fastReplace(creatures, "Scions or Eldrazis", "Eldrazi Scions"); + } else { + prependedAdjectives.add(Pair.of(positive, part.toLowerCase())); + } + } + + StringBuilder sbShort = new StringBuilder(); + if (allNegative) { + boolean isFirst = true; + for (Pair pre : prependedAdjectives) { + if (isFirst) isFirst = false; + else sbShort.append(" and/or "); + + boolean useNon = pre.getKey() == allNegative; + if (useNon) sbShort.append("non-"); + sbShort.append(pre.getValue()).append(" ").append(creatures == null ? "creatures" : creatures); + } + if (prependedAdjectives.isEmpty()) + sbShort.append(creatures == null ? "creatures" : creatures); + + if (!postponedAdjectives.isEmpty()) { + if (!prependedAdjectives.isEmpty()) { + sbShort.append(" and/or creatures"); + } + + sbShort.append(" with "); + sbShort.append(Lang.joinHomogenous(postponedAdjectives, withToString, allNegative ? "or" : "and")); + } + + } else { + for (Pair pre : prependedAdjectives) { + boolean useNon = pre.getKey() == allNegative; + if (useNon) sbShort.append("non-"); + sbShort.append(pre.getValue()).append(" "); + } + sbShort.append(creatures == null ? "creatures" : creatures); + + if (!postponedAdjectives.isEmpty()) { + sbShort.append(" with "); + sbShort.append(Lang.joinHomogenous(postponedAdjectives, withToString, allNegative ? "or" : "and")); + } + + } + orClauses.add(sbShort.toString()); + } + return byClause + StringUtils.join(orClauses, " or ") + "."; + } } diff --git a/forge-game/src/main/java/forge/game/combat/CombatUtil.java b/forge-game/src/main/java/forge/game/combat/CombatUtil.java index 6c41d4fd021..91533392b28 100644 --- a/forge-game/src/main/java/forge/game/combat/CombatUtil.java +++ b/forge-game/src/main/java/forge/game/combat/CombatUtil.java @@ -1005,34 +1005,6 @@ public class CombatUtil { } } - // TODO remove it later to replace it with CantBlockBy above - for (KeywordInterface inst1 : attacker.getKeywords()) { - String k = inst1.getOriginal(); - if (k.startsWith("CantBeBlockedBy ")) { - final String[] n = k.split(" ", 2); - final String[] restrictions = n[1].split(","); - if (blocker.isValid(restrictions, attacker.getController(), attacker, null)) { - boolean stillblock = false; - //Dragon Hunter check - if (n[1].contains("withoutReach") && blocker.hasStartOfKeyword("IfReach")) { - for (KeywordInterface inst2 : blocker.getKeywords()) { - String k2 = inst2.getOriginal(); - if (k2.startsWith("IfReach")) { - String n2[] = k2.split(":"); - if (attacker.getType().hasCreatureType(n2[1])) { - stillblock = true; - break; - } - } - } - } - if (!stillblock) { - return false; - } - } - } - } - for (KeywordInterface inst : blocker.getKeywords()) { String keyword = inst.getOriginal(); if (keyword.startsWith("CantBlockCardUID")) { From 4528541b3f38ad19015189d25225e711c675d012 Mon Sep 17 00:00:00 2001 From: Hanmac Date: Sat, 17 Feb 2018 16:25:41 +0100 Subject: [PATCH 9/9] AiController: add orderSa for token and pump effects for Hero of Bladehold --- forge-ai/src/main/java/forge/ai/AiController.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/forge-ai/src/main/java/forge/ai/AiController.java b/forge-ai/src/main/java/forge/ai/AiController.java index 3a4738f06a7..7f8d7a805e2 100644 --- a/forge-ai/src/main/java/forge/ai/AiController.java +++ b/forge-ai/src/main/java/forge/ai/AiController.java @@ -1782,6 +1782,10 @@ public class AiController { List evolve = filterList(putCounter, SpellAbilityPredicates.hasParam("Evolve")); + List token = filterListByApi(activePlayerSAs, ApiType.Token); + List pump = filterListByApi(activePlayerSAs, ApiType.Pump); + List pumpAll = filterListByApi(activePlayerSAs, ApiType.PumpAll); + // do mandatory discard early if hand is empty or has DiscardMe card boolean discardEarly = false; CardCollectionView playerHand = player.getCardsIn(ZoneType.Hand); @@ -1790,6 +1794,11 @@ public class AiController { result.addAll(mandatoryDiscard); } + // token should be added first so they might get the pump bonus + result.addAll(token); + result.addAll(pump); + result.addAll(pumpAll); + // do Evolve Trigger before other PutCounter SpellAbilities // do putCounter before Draw/Discard because it can cause a Draw Trigger result.addAll(evolve); @@ -1805,6 +1814,9 @@ public class AiController { } result.addAll(activePlayerSAs); + + //need to reverse because of magic stack + Collections.reverse(result); return result; }