"Can be wounded X times check" now takes into account "can't take more than X wounds" effects into account.
This commit is contained in:
@@ -215,7 +215,7 @@ public class PlayConditions {
|
||||
public boolean visitPhysicalCard(PhysicalCard physicalCard) {
|
||||
if (filter.accepts(gameState, modifiersQuerying, physicalCard)
|
||||
&& modifiersQuerying.getVitality(gameState, physicalCard) > times
|
||||
&& modifiersQuerying.canTakeWound(gameState, physicalCard))
|
||||
&& modifiersQuerying.canTakeWounds(gameState, physicalCard, times))
|
||||
_woundableCount++;
|
||||
return _woundableCount >= count;
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ public class CantTakeMoreThanXWoundsModifier extends AbstractModifier {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canTakeWound(GameState gameState, ModifiersQuerying modifiersLogic, PhysicalCard physicalCard, int woundsAlreadyTaken) {
|
||||
return woundsAlreadyTaken < _count;
|
||||
public boolean canTakeWounds(GameState gameState, ModifiersQuerying modifiersLogic, PhysicalCard physicalCard, int woundsAlreadyTaken, int woundsToTake) {
|
||||
return woundsAlreadyTaken + woundsToTake <= _count;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ public class CantTakeWoundsModifier extends AbstractModifier {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canTakeWound(GameState gameState, ModifiersQuerying modifiersLogic, PhysicalCard physicalCard, int woundsAlreadyTaken) {
|
||||
public boolean canTakeWounds(GameState gameState, ModifiersQuerying modifiersLogic, PhysicalCard physicalCard, int woundsAlreadyTaken, int woundsToTake) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -339,7 +339,7 @@ public class Filters {
|
||||
return new Filter() {
|
||||
@Override
|
||||
public boolean accepts(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard physicalCard) {
|
||||
return modifiersQuerying.canTakeWound(gameState, physicalCard) && modifiersQuerying.getVitality(gameState, physicalCard) >= count;
|
||||
return modifiersQuerying.canTakeWounds(gameState, physicalCard, count) && modifiersQuerying.getVitality(gameState, physicalCard) >= count;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ public class WoundCharactersEffect extends AbstractPreventableCardEffect {
|
||||
return new Filter() {
|
||||
@Override
|
||||
public boolean accepts(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard physicalCard) {
|
||||
return modifiersQuerying.canTakeWound(gameState, physicalCard);
|
||||
return modifiersQuerying.canTakeWounds(gameState, physicalCard, 1);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -132,7 +132,7 @@ public abstract class AbstractModifier implements Modifier {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canTakeWound(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard physicalCard, int woundsAlreadyTaken) {
|
||||
public boolean canTakeWounds(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard physicalCard, int woundsAlreadyTaken, int woundsToTake) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ public interface Modifier {
|
||||
|
||||
public int getOverwhelmMultiplier(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard physicalCard);
|
||||
|
||||
public boolean canTakeWound(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard physicalCard, int woundsAlreadyTakenInPhase);
|
||||
public boolean canTakeWounds(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard physicalCard, int woundsAlreadyTakenInPhase, int woundsToTake);
|
||||
|
||||
public boolean canTakeArcheryWound(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard physicalCard);
|
||||
|
||||
|
||||
@@ -444,14 +444,14 @@ public class ModifiersLogic implements ModifiersEnvironment, ModifiersQuerying {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canTakeWound(GameState gameState, PhysicalCard card) {
|
||||
public boolean canTakeWounds(GameState gameState, PhysicalCard card, int woundsToTake) {
|
||||
LoggingThreadLocal.logMethodStart(card, "canTakeWound");
|
||||
try {
|
||||
for (Modifier modifier : getModifiersAffectingCard(gameState, ModifierEffect.WOUND_MODIFIER, card)) {
|
||||
Integer woundsTaken = _woundsPerPhaseMap.get(card.getCardId());
|
||||
if (woundsTaken == null)
|
||||
woundsTaken = 0;
|
||||
if (!modifier.canTakeWound(gameState, this, card, woundsTaken))
|
||||
if (!modifier.canTakeWounds(gameState, this, card, woundsTaken, woundsToTake))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -53,7 +53,7 @@ public interface ModifiersQuerying {
|
||||
public boolean isAdditionalCardType(GameState gameState, PhysicalCard card, CardType cardType);
|
||||
|
||||
// Wounds/exertions
|
||||
public boolean canTakeWound(GameState gameState, PhysicalCard card);
|
||||
public boolean canTakeWounds(GameState gameState, PhysicalCard card, int woundsToTake);
|
||||
|
||||
public boolean canTakeArcheryWound(GameState gameState, PhysicalCard card);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user