diff --git a/forge-ai/src/main/java/forge/ai/ability/ChooseCardAi.java b/forge-ai/src/main/java/forge/ai/ability/ChooseCardAi.java index 13dd7ccbec8..8278642c9c3 100644 --- a/forge-ai/src/main/java/forge/ai/ability/ChooseCardAi.java +++ b/forge-ai/src/main/java/forge/ai/ability/ChooseCardAi.java @@ -269,6 +269,10 @@ public class ChooseCardAi extends SpellAbilityAi { Card chosen = ComputerUtilCard.getBestCreatureAI(aiCreatures); return chosen; + } else if (logic.equals("OrzhovAdvokist")) { + if (ai.equals(sa.getActivatingPlayer())) { + choice = ComputerUtilCard.getBestAI(options); + } // TODO: improve ai } else { choice = ComputerUtilCard.getBestAI(options); } diff --git a/forge-game/src/main/java/forge/game/ability/effects/RemoveFromCombatEffect.java b/forge-game/src/main/java/forge/game/ability/effects/RemoveFromCombatEffect.java index d4922c61781..d08365cb039 100644 --- a/forge-game/src/main/java/forge/game/ability/effects/RemoveFromCombatEffect.java +++ b/forge-game/src/main/java/forge/game/ability/effects/RemoveFromCombatEffect.java @@ -1,6 +1,7 @@ package forge.game.ability.effects; import forge.game.Game; +import forge.game.ability.AbilityUtils; import forge.game.ability.SpellAbilityEffect; import forge.game.card.Card; import forge.game.card.CardCollection; @@ -38,18 +39,21 @@ public class RemoveFromCombatEffect extends SpellAbilityEffect { final Combat combat = game.getPhaseHandler().getCombat(); if (combat != null && (tgt == null || c.canBeTargetedBy(sa))) { // Unblock creatures that were blocked only by this card (e.g. Ydwen Efreet) - if (sa.hasParam("UnblockCreaturesBlockedOnlyBySelf")) { - CardCollection blockedBySelf = combat.getAttackersBlockedBy(sa.getHostCard()); - for (Card atk : blockedBySelf) { - boolean blockedOnlyBySelf = true; - for (Card blocker : combat.getBlockers(atk)) { - if (!blocker.equals(sa.getHostCard())) { - blockedOnlyBySelf = false; - break; + if (sa.hasParam("UnblockCreaturesBlockedOnlyBy")) { + CardCollection attackers = AbilityUtils.getDefinedCards(sa.getHostCard(), sa.getParam("UnblockCreaturesBlockedOnlyBy"), sa); + if (!attackers.isEmpty()) { + CardCollection blockedByCard = combat.getAttackersBlockedBy(attackers.getFirst()); + for (Card atk : blockedByCard) { + boolean blockedOnlyByCard = true; + for (Card blocker : combat.getBlockers(atk)) { + if (!blocker.equals(attackers.getFirst())) { + blockedOnlyByCard = false; + break; + } + } + if (blockedOnlyByCard) { + combat.setBlocked(atk, false); } - } - if (blockedOnlyBySelf) { - combat.setBlocked(atk, false); } } } diff --git a/forge-game/src/main/java/forge/game/card/CardProperty.java b/forge-game/src/main/java/forge/game/card/CardProperty.java index 6ee269b7813..4be430d9c60 100644 --- a/forge-game/src/main/java/forge/game/card/CardProperty.java +++ b/forge-game/src/main/java/forge/game/card/CardProperty.java @@ -188,21 +188,13 @@ public class CardProperty { Player p = property.endsWith("Ctrl") ? controller : card.getOwner(); if (!source.hasRemembered()) { final Card newCard = game.getCardState(source); - for (final Object o : newCard.getRemembered()) { - if (o instanceof Player) { - if (!p.equals(o)) { - return false; - } - } + if (!newCard.isRemembered(p)) { + return false; } } - for (final Object o : source.getRemembered()) { - if (o instanceof Player) { - if (!p.equals(o)) { - return false; - } - } + if (!source.isRemembered(p)) { + return false; } } else if (property.startsWith("nonRememberedPlayerCtrl")) { if (!source.hasRemembered()) { diff --git a/forge-game/src/main/java/forge/game/trigger/TriggerSpellAbilityCast.java b/forge-game/src/main/java/forge/game/trigger/TriggerSpellAbilityCast.java index f039272d22c..cd1a7ab5e1e 100644 --- a/forge-game/src/main/java/forge/game/trigger/TriggerSpellAbilityCast.java +++ b/forge-game/src/main/java/forge/game/trigger/TriggerSpellAbilityCast.java @@ -160,6 +160,13 @@ public class TriggerSpellAbilityCast extends Trigger { } } + if (hasParam("HasTapCost")) { + final Cost cost = (Cost) (runParams2.get("Cost")); + if (!cost.hasTapCost()) { + return false; + } + } + if (hasParam("Conspire")) { if (!spellAbility.isOptionalCostPaid(OptionalCost.Conspire)) { return false; diff --git a/forge-gui/res/cardsfolder/i/imprison.txt b/forge-gui/res/cardsfolder/i/imprison.txt new file mode 100644 index 00000000000..9ee9662dc8d --- /dev/null +++ b/forge-gui/res/cardsfolder/i/imprison.txt @@ -0,0 +1,19 @@ +Name:Imprison +ManaCost:B +Types:Enchantment Aura +K:Enchant creature +A:SP$ Attach | Cost$ B | ValidTgts$ Creature | AILogic$ Curse +T:Mode$ AbilityCast | ValidCard$ Creature.EnchantedBy | HasTapCost$ True | TriggerZones$ Battlefield | Execute$ TrigDestroy1 | TriggerDescription$ Whenever a player activates an ability of enchanted creature with {T} in its activation cost that isn't a mana ability, you may pay {1}. If you do, counter that ability. If you don't, destroy CARDNAME. +SVar:TrigDestroy1:DB$ Destroy | Defined$ Self | UnlessCost$ 1 | UnlessPayer$ You | UnlessResolveSubs$ WhenPaid | SubAbility$ DBCounter +SVar:DBCounter:DB$ Counter | Defined$ TriggeredSpellAbility +T:Mode$ Attacks | ValidCard$ Card.EnchantedBy | TriggerZones$ Battlefield | Execute$ TrigDestroy2 | TriggerDescription$ Whenever enchanted creature attacks or blocks, you may pay {1}. If you do, tap the creature, remove it from combat, and creatures it was blocking that had become blocked by only that creature this combat become unblocked. If you don't, destroy CARDNAME. +T:Mode$ Blocks | ValidCard$ Card.EnchantedBy | TriggerZones$ Battlefield | Execute$ TrigDestroy3 | Secondary$ True | TriggerDescription$ Whenever enchanted creature attacks or blocks, you may pay {1}. If you do, tap the creature, remove it from combat, and creatures it was blocking that had become blocked by only that creature this combat become unblocked. If you don't, destroy CARDNAME. +SVar:TrigDestroy2:DB$ Destroy | Defined$ Self | UnlessCost$ 1 | UnlessPayer$ You | UnlessResolveSubs$ WhenPaid | SubAbility$ DBTapAttacker +SVar:TrigDestroy3:DB$ Destroy | Defined$ Self | UnlessCost$ 1 | UnlessPayer$ You | UnlessResolveSubs$ WhenPaid | SubAbility$ DBTapBlocker +SVar:DBTapAttacker:DB$ Tap | Defined$ TriggeredAttacker | SubAbility$ DBRemoveAttacker +SVar:DBTapBlocker:DB$ Tap | Defined$ TriggeredBlocker | SubAbility$ DBRemoveBlocker +SVar:DBRemoveAttacker:DB$ RemoveFromCombat | Defined$ TriggeredAttacker +SVar:DBRemoveBlocker:DB$ RemoveFromCombat | Defined$ TriggeredBlocker | UnblockCreaturesBlockedOnlyBy$ TriggeredBlocker +SVar:RemAIDeck:True +SVar:Picture:http://www.wizards.com/global/images/magic/general/imprison.jpg +Oracle:Enchant creature\nWhenever a player activates an ability of enchanted creature with {T} in its activation cost that isn't a mana ability, you may pay {1}. If you do, counter that ability. If you don't, destroy Imprison.\nWhenever enchanted creature attacks or blocks, you may pay {1}. If you do, tap the creature, remove it from combat, and creatures it was blocking that had become blocked by only that creature this combat become unblocked. If you don't, destroy Imprison. diff --git a/forge-gui/res/cardsfolder/o/orzhov_advokist.txt b/forge-gui/res/cardsfolder/o/orzhov_advokist.txt new file mode 100644 index 00000000000..fd0c83c4b95 --- /dev/null +++ b/forge-gui/res/cardsfolder/o/orzhov_advokist.txt @@ -0,0 +1,15 @@ +Name:Orzhov Advokist +ManaCost:2 W +Types:Creature Human Advisor +PT:1/4 +T:Mode$ Phase | Phase$ Upkeep | ValidPlayer$ You | TriggerZones$ Battlefield | Execute$ TrigChoose | TriggerDescription$ At the beginning of your upkeep, each player may put two +1/+1 counters on a creature he or she controls. If a player does, creatures that player controls can't attack you or a planeswalker you control until your next turn. +SVar:TrigChoose:DB$ RepeatEach | RepeatPlayers$ Player | RepeatSubAbility$ DBChoice | SubAbility$ DBPutCounter +SVar:DBChoice:DB$ ChooseCard | Defined$ Player.IsRemembered | Amount$ 1 | MinAmount$ 0 | Choices$ Creature.RememberedPlayerCtrl | RememberChosen$ True | AILogic$ OrzhovAdvokist +SVar:DBPutCounter:DB$ PutCounterAll | ValidCards$ Creature.IsRemembered | CounterType$ P1P1 | CounterNum$ 2 | SubAbility$ DBClearChosen +SVar:DBClearChosen:DB$ Cleanup | ClearChosenCard$ True | SubAbility$ DBRememberPlayer +SVar:DBRememberPlayer:DB$ Pump | RememberObjects$ RememberedController | SubAbility$ DBEffect +SVar:DBEffect:DB$ Effect | RememberObjects$ Player.IsRemembered | StaticAbilities$ STCantAttack | Duration$ UntilYourNextTurn | SubAbility$ DBCleanup +SVar:STCantAttack:Mode$ CantAttack | EffectZone$ Command | ValidCard$ Creature.RememberedPlayerCtrl | Target$ You,Planeswalker.YouCtrl | Description$ Creatures that player controls can't attack you or a planeswalker you control until your next turn. +SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True +SVar:Picture:http://www.wizards.com/global/images/magic/general/orzhov_advokist.jpg +Oracle:At the beginning of your upkeep, each player may put two +1/+1 counters on a creature he or she controls. If a player does, creatures that player controls can't attack you or a planeswalker you control until your next turn. \ No newline at end of file diff --git a/forge-gui/res/cardsfolder/p/palace_jailer.txt b/forge-gui/res/cardsfolder/p/palace_jailer.txt new file mode 100644 index 00000000000..d98179b1574 --- /dev/null +++ b/forge-gui/res/cardsfolder/p/palace_jailer.txt @@ -0,0 +1,15 @@ +Name:Palace Jailer +ManaCost:2 W W +Types:Creature Human Soldier +PT:2/2 +T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigMonarch | TriggerDescription$ When CARDNAME enters the battlefield, you become the monarch. +SVar:TrigMonarch:DB$ BecomeMonarch | Defined$ You +T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigExile | TriggerDescription$ When CARDNAME enters the battlefield, you become the monarch. +SVar:TrigExile:DB$ ChangeZone | Origin$ Battlefield | Destination$ Exile | ValidTgts$ Creature.OppCtrl | TgtPrompt$ Select target creature an opponent controls | SubAbility$ DBEffect +SVar:DBEffect:DB$ Effect | Triggers$ ComeBack | RememberObjects$ Targeted | SVars$ TrigReturn,ExileSelf | Duration$ Permanent | ForgetOnMoved$ Exile +SVar:ComeBack:Mode$ BecomeMonarch | ValidPlayer$ Player.Opponent | Execute$ TrigReturn | TriggerZones$ Command | Static$ True | TriggerDescription$ That creature is exiled until an opponent becomes the monarch. +SVar:TrigReturn:DB$ ChangeZoneAll | Origin$ Exile | Destination$ Battlefield | ChangeType$ Card.IsRemembered | SubAbility$ ExileSelf +SVar:ExileSelf:DB$ ChangeZone | Origin$ Command | Destination$ Exile | Defined$ Self +SVar:PlayMain1:TRUE +SVar:Picture:http://www.wizards.com/global/images/magic/general/palace_jailer.jpg +Oracle:When Palace Jailer enters the battlefield, you become the monarch.\nWhen Palace Jailer enters the battlefield, exile target creature an opponent controls until an opponent becomes the monarch. (That creature returns under its owner's control.) \ No newline at end of file diff --git a/forge-gui/res/cardsfolder/y/ydwen_efreet.txt b/forge-gui/res/cardsfolder/y/ydwen_efreet.txt index 95c1d022aa4..c78bde1a9a7 100644 --- a/forge-gui/res/cardsfolder/y/ydwen_efreet.txt +++ b/forge-gui/res/cardsfolder/y/ydwen_efreet.txt @@ -4,7 +4,7 @@ Types:Creature Efreet PT:3/6 T:Mode$ Blocks | ValidCard$ Card.Self | Execute$ FlipCoin | TriggerDescription$ Whenever CARDNAME blocks, flip a coin. If you lose the flip, remove CARDNAME from combat and it can't block this turn. Creatures it was blocking that had become blocked by only CARDNAME this combat become unblocked. SVar:FlipCoin:DB$ FlipACoin | LoseSubAbility$ DBRemoveFromCombat -SVar:DBRemoveFromCombat:DB$ RemoveFromCombat | Defined$ Self | UnblockCreaturesBlockedOnlyBySelf$ True | SubAbility$ DBCantBlock +SVar:DBRemoveFromCombat:DB$ RemoveFromCombat | Defined$ Self | UnblockCreaturesBlockedOnlyBy$ Self | SubAbility$ DBCantBlock SVar:DBCantBlock:DB$ Pump | Defined$ Self | KW$ HIDDEN CARDNAME can't block. SVar:Picture:http://www.wizards.com/global/images/magic/general/ydwen_efreet.jpg Oracle:Whenever Ydwen Efreet blocks, flip a coin. If you lose the flip, remove Ydwen Efreet from combat and it can't block this turn. Creatures it was blocking that had become blocked by only Ydwen Efreet this combat become unblocked.