mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 11:18:01 +00:00
Fix handling of provoke when provoker is removed from combat
This commit is contained in:
@@ -4956,6 +4956,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
else if (property.startsWith("attacking")) {
|
||||
if (null == combat) return false;
|
||||
if (property.equals("attacking")) return combat.isAttacking(this);
|
||||
if (property.equals("attackingLKI")) return combat.isLKIAttacking(this);
|
||||
if (property.equals("attackingYou")) return combat.isAttacking(this, sourceController);
|
||||
} else if (property.startsWith("notattacking")) {
|
||||
return null == combat || !combat.isAttacking(this);
|
||||
|
||||
@@ -243,7 +243,10 @@ public class Combat {
|
||||
return Lists.newArrayList(attackedByBands.values());
|
||||
}
|
||||
|
||||
public final boolean isAttacking(final Card c) {
|
||||
/**
|
||||
* Checks if a card is attacking, returns true if the card was attacking when it left the battlefield
|
||||
*/
|
||||
public final boolean isLKIAttacking(final Card c) {
|
||||
AttackingBand ab = getBandOfAttacker(c);
|
||||
return ab != null;
|
||||
}
|
||||
@@ -257,6 +260,18 @@ public class Combat {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a card is currently attacking, returns false if the card is not currently attacking, even if its LKI was.
|
||||
*/
|
||||
public final boolean isAttacking(Card card) {
|
||||
for (AttackingBand ab : attackedByBands.values()) {
|
||||
if (ab.contains(card)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public final CardCollection getAttackers() {
|
||||
CardCollection result = new CardCollection();
|
||||
|
||||
@@ -660,18 +660,13 @@ public class CombatUtil {
|
||||
// if a creature does not block but should, return false
|
||||
for (final Card blocker : defendersArmy) {
|
||||
if (blocker.getMustBlockCards() != null) {
|
||||
final int mustBlockAmt = blocker.getMustBlockCards().size();
|
||||
final CardCollectionView blockedSoFar = combat.getAttackersBlockedBy(blocker);
|
||||
final CardCollection remainingBlockables = new CardCollection();
|
||||
for (final Card attacker : attackers) {
|
||||
if (!blockedSoFar.contains(attacker) && CombatUtil.canBlock(attacker, blocker)) {
|
||||
remainingBlockables.add(attacker);
|
||||
}
|
||||
}
|
||||
boolean canBlockAnother = CombatUtil.canBlockMoreCreatures(blocker, blockedSoFar);
|
||||
if (canBlockAnother && mustBlockAmt > blockedSoFar.size() && remainingBlockables.size() > 0) {
|
||||
return String.format("%s must still block %s.", blocker, Lang.joinHomogenous(remainingBlockables));
|
||||
}
|
||||
final CardCollectionView blockedSoFar = combat.getAttackersBlockedBy(blocker);
|
||||
for (Card cardToBeBlocked : blocker.getMustBlockCards()) {
|
||||
if (!blockedSoFar.contains(cardToBeBlocked) && CombatUtil.canBlockMoreCreatures(blocker, blockedSoFar)
|
||||
&& combat.isAttacking(cardToBeBlocked) && CombatUtil.canBlock(cardToBeBlocked, blocker)) {
|
||||
return String.format("%s must still block %s.", blocker, cardToBeBlocked);
|
||||
}
|
||||
}
|
||||
}
|
||||
// lure effects
|
||||
if (!blockers.contains(blocker) && CombatUtil.mustBlockAnAttacker(blocker, combat)) {
|
||||
|
||||
@@ -2,7 +2,7 @@ Name:Kithkin Mourncaller
|
||||
ManaCost:2 G
|
||||
Types:Creature Kithkin Scout
|
||||
PT:2/2
|
||||
T:Mode$ ChangesZone | Origin$ Battlefield | Destination$ Graveyard | ValidCard$ Creature.Kithkin+attacking+YouOwn,Creature.Elf+attacking+YouOwn | Execute$ TrigDraw | OptionalDecider$ You | TriggerZones$ Battlefield | TriggerDescription$ Whenever an attacking Kithkin or Elf is put into your graveyard from the battlefield, you may draw a card.
|
||||
T:Mode$ ChangesZone | Origin$ Battlefield | Destination$ Graveyard | ValidCard$ Creature.Kithkin+attackingLKI+YouOwn,Creature.Elf+attackingLKI+YouOwn | Execute$ TrigDraw | OptionalDecider$ You | TriggerZones$ Battlefield | TriggerDescription$ Whenever an attacking Kithkin or Elf is put into your graveyard from the battlefield, you may draw a card.
|
||||
SVar:TrigDraw:AB$ Draw | Cost$ 0 | Defined$ You | NumCards$ 1
|
||||
SVar:RemRandomDeck:True
|
||||
SVar:Picture:http://www.wizards.com/global/images/magic/general/kithkin_mourncaller.jpg
|
||||
|
||||
Reference in New Issue
Block a user