mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 18:58:00 +00:00
MustBlockEffect: fix missing duration
This commit is contained in:
@@ -1164,12 +1164,12 @@ public class AbilityUtils {
|
||||
}
|
||||
}
|
||||
else if (defined.startsWith("Enchanted")) {
|
||||
if (card.getEntityAttachedTo() != null) {
|
||||
if (card.isAttachedToEntity()) {
|
||||
addPlayer(Lists.newArrayList(card.getEntityAttachedTo()), defined, players);
|
||||
}
|
||||
}
|
||||
else if (defined.startsWith("Equipped")) {
|
||||
if (card.getEquipping() != null) {
|
||||
if (card.isEquipping()) {
|
||||
addPlayer(Lists.newArrayList(card.getEquipping()), defined, players);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ public class LifeExchangeVariantEffect extends SpellAbilityEffect {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!source.isInZone(ZoneType.Battlefield)) {
|
||||
if (!source.isInPlay()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import java.util.Map;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
import forge.GameCommand;
|
||||
import forge.game.Game;
|
||||
import forge.game.ability.AbilityUtils;
|
||||
import forge.game.ability.SpellAbilityEffect;
|
||||
@@ -32,7 +33,7 @@ public class MustBlockEffect extends SpellAbilityEffect {
|
||||
cards = Lists.newArrayList(host);
|
||||
}
|
||||
|
||||
List<Card> tgtCards = Lists.newArrayList();
|
||||
final List<Card> tgtCards = Lists.newArrayList();
|
||||
if (sa.hasParam("Choices")) {
|
||||
Player chooser = activator;
|
||||
if (sa.hasParam("Chooser")) {
|
||||
@@ -53,7 +54,7 @@ public class MustBlockEffect extends SpellAbilityEffect {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
tgtCards = getTargetCards(sa);
|
||||
tgtCards.addAll(getTargetCards(sa));
|
||||
}
|
||||
|
||||
final boolean mustBlockAll = sa.hasParam("BlockAllDefined");
|
||||
@@ -68,7 +69,26 @@ public class MustBlockEffect extends SpellAbilityEffect {
|
||||
}
|
||||
}
|
||||
}
|
||||
} // mustBlockResolve()
|
||||
|
||||
if (sa.hasParam("Duration")) {
|
||||
final GameCommand removeBlockingRequirements = new GameCommand() {
|
||||
private static final long serialVersionUID = -5861529814760561373L;
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
for (final Card c : tgtCards) {
|
||||
if (mustBlockAll) {
|
||||
c.removeMustBlockCards(cards);
|
||||
} else {
|
||||
final Card attacker = cards.get(0);
|
||||
c.removeMustBlockCard(attacker);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
addUntilCommand(sa, removeBlockingRequirements);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getStackDescription(SpellAbility sa) {
|
||||
|
||||
@@ -1321,6 +1321,12 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
|
||||
public final void addMustBlockCards(final Iterable<Card> attackersToBlock) {
|
||||
mustBlockCards = view.addCards(mustBlockCards, attackersToBlock, TrackableProperty.MustBlockCards);
|
||||
}
|
||||
public final void removeMustBlockCard(final Card c) {
|
||||
mustBlockCards = view.removeCard(mustBlockCards, c, TrackableProperty.MustBlockCards);
|
||||
}
|
||||
public final void removeMustBlockCards(final Iterable<Card> attackersToBlock) {
|
||||
mustBlockCards = view.removeCards(mustBlockCards, attackersToBlock, TrackableProperty.MustBlockCards);
|
||||
}
|
||||
public final void clearMustBlockCards() {
|
||||
mustBlockCards = view.clearCards(mustBlockCards, TrackableProperty.MustBlockCards);
|
||||
}
|
||||
|
||||
@@ -1590,7 +1590,7 @@ public class CardFactoryUtil {
|
||||
} else if (keyword.equals("Provoke")) {
|
||||
final String actualTrigger = "Mode$ Attacks | ValidCard$ Card.Self | OptionalDecider$ You | Secondary$ True"
|
||||
+ " | TriggerDescription$ Provoke (" + inst.getReminderText() + ")";
|
||||
final String blockStr = "DB$ MustBlock | ValidTgts$ Creature.ControlledBy TriggeredDefendingPlayer | TgtPrompt$ Select target creature defending player controls";
|
||||
final String blockStr = "DB$ MustBlock | Duration$ UntilEndOfCombat | ValidTgts$ Creature.ControlledBy TriggeredDefendingPlayer | TgtPrompt$ Select target creature defending player controls";
|
||||
final String untapStr = "DB$ Untap | Defined$ Targeted";
|
||||
|
||||
SpellAbility blockSA = AbilityFactory.getAbility(blockStr, card);
|
||||
|
||||
@@ -413,7 +413,7 @@ public class CardProperty {
|
||||
} else if (property.startsWith("AttachedTo")) {
|
||||
final String restriction = property.split("AttachedTo ")[1];
|
||||
|
||||
if (card.getEntityAttachedTo() == null) {
|
||||
if (!card.isAttachedToEntity()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,6 @@ Name:Aether Storm
|
||||
ManaCost:3 U
|
||||
Types:Enchantment
|
||||
S:Mode$ CantBeCast | ValidCard$ Creature | Description$ Creature spells can't be cast.
|
||||
A:AB$ Destroy | Cost$ PayLife<4> | Defined$ Self | NoReg$ True | Activator$ Player | SpellDescription$ Destroy CARDNAME. It can't be regenerated. Any player may activate this ability.
|
||||
A:AB$ Destroy | Cost$ PayLife<4> | Defined$ Self | NoRegen$ True | Activator$ Player | SpellDescription$ Destroy CARDNAME. It can't be regenerated. Any player may activate this ability.
|
||||
AI:RemoveDeck:All
|
||||
Oracle:Creature spells can't be cast.\nPay 4 life: Destroy Aether Storm. It can't be regenerated. Any player may activate this ability.
|
||||
|
||||
@@ -3,5 +3,5 @@ ManaCost:2 G U R
|
||||
Types:Creature Elephant Warrior
|
||||
PT:6/4
|
||||
T:Mode$ Attacks | ValidCard$ Card.Self | Execute$ TrigCantBlock | TriggerZones$ Battlefield | TriggerDescription$ Whenever CARDNAME attacks, target creature defending player controls blocks it this combat if able.
|
||||
SVar:TrigCantBlock:DB$ MustBlock | ValidTgts$ Creature.DefenderCtrl | TgtPrompt$ Select target creature | SpellDescription$ Target creature blocks CARDNAME this turn if able.
|
||||
SVar:TrigCantBlock:DB$ MustBlock | Duration$ UntilEndOfCombat | ValidTgts$ Creature.DefenderCtrl | TgtPrompt$ Select target creature | SpellDescription$ Target creature blocks CARDNAME this turn if able.
|
||||
Oracle:Whenever Avalanche Tusker attacks, target creature defending player controls blocks it this combat if able.
|
||||
|
||||
@@ -7,5 +7,5 @@ K:Class:2:1 R W:AddStaticAbility$ SReduceCost
|
||||
SVar:SReduceCost:Mode$ ReduceCost | ValidCard$ Card | ValidSpell$ Activated.Equip | Activator$ You | Amount$ 2 | Secondary$ True | Description$ Equip abilities you activate cost {2} less to activate.
|
||||
K:Class:3:3 R W:AddTrigger$ TriggerAttacks
|
||||
SVar:TriggerAttacks:Mode$ Attacks | ValidCard$ Creature.YouCtrl | TriggerZones$ Battlefield | Execute$ TrigMustBlock | Secondary$ True | TriggerDescription$ Whenever a creature you control attacks, up to one target creature blocks it this combat if able.
|
||||
SVar:TrigMustBlock:DB$ MustBlock | ValidTgts$ Creature | TargetMin$ 0 | TargetMax$ 1 | DefinedAttacker$ TriggeredAttacker | BlockAllDefined$ True
|
||||
SVar:TrigMustBlock:DB$ MustBlock | ValidTgts$ Creature | TargetMin$ 0 | TargetMax$ 1 | DefinedAttacker$ TriggeredAttacker | BlockAllDefined$ True | Duration$ UntilEndOfCombat
|
||||
Oracle:(Gain the next level as a sorcery to add its ability.)\nWhen Fighter Class enters the battlefield, search your library for an Equipment card, reveal it, put it into your hand, then shuffle.\n{1}{R}{W}: Level 2\nEquip abilities you activate cost {2} less to activate.\n{3}{R}{W}: Level 3\nWhenever a creature you control attacks, up to one target creature blocks it this combat if able.
|
||||
|
||||
@@ -5,7 +5,7 @@ PT:6/1
|
||||
K:Haste
|
||||
K:Trample
|
||||
T:Mode$ Attacks | ValidCard$ Card.Self | Execute$ TrigProvoke | TriggerDescription$ When CARDNAME attacks, up to one target creature defending player controls blocks it this combat if able.
|
||||
SVar:TrigProvoke:DB$ MustBlock | TargetMin$ 0 | TargetMax$ 1 | ValidTgts$ Creature.DefenderCtrl | TgtPrompt$ Select up to one target creature defending player controls
|
||||
SVar:TrigProvoke:DB$ MustBlock | Duration$ UntilEndOfCombat | TargetMin$ 0 | TargetMax$ 1 | ValidTgts$ Creature.DefenderCtrl | TgtPrompt$ Select up to one target creature defending player controls
|
||||
T:Mode$ Phase | Phase$ End of Turn | TriggerZones$ Battlefield | Execute$ TrigSac | TriggerDescription$ At the beginning of the end step, sacrifice CARDNAME.
|
||||
SVar:TrigSac:DB$ Sacrifice | SacValid$ Self
|
||||
SVar:EndOfTurnLeavePlay:True
|
||||
|
||||
Reference in New Issue
Block a user