- Added Imprison

This commit is contained in:
swordshine
2018-01-17 18:55:15 +08:00
parent e3265ace4b
commit c97d67e4fc
4 changed files with 42 additions and 12 deletions

View File

@@ -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);
}
}
}

View File

@@ -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;

View File

@@ -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.

View File

@@ -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.