mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
DestroyAI: better logic for Pongify also Update for X
This commit is contained in:
@@ -65,6 +65,16 @@ public class CostDiscard extends CostPartWithList {
|
||||
|
||||
public int paymentOrder() { return 10; }
|
||||
|
||||
@Override
|
||||
public Integer getMaxAmountX(SpellAbility ability, Player payer) {
|
||||
final Card source = ability.getHostCard();
|
||||
String type = this.getType();
|
||||
CardCollectionView handList = payer.canDiscardBy(ability) ? payer.getCardsIn(ZoneType.Hand) : CardCollection.EMPTY;
|
||||
|
||||
handList = CardLists.getValidCards(handList, type.split(";"), payer, source, ability);
|
||||
return handList.size();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
|
||||
@@ -1391,7 +1391,7 @@ public abstract class SpellAbility extends CardTraitBase implements ISpellAbilit
|
||||
return false;
|
||||
}
|
||||
|
||||
return getTargets().size() < getTargetRestrictions().getMaxTargets(hostCard, this);
|
||||
return getTargets().size() < getMaxTargets();
|
||||
}
|
||||
|
||||
public boolean isZeroTargets() {
|
||||
@@ -1405,6 +1405,14 @@ public abstract class SpellAbility extends CardTraitBase implements ISpellAbilit
|
||||
return getTargetRestrictions().isMaxTargetsChosen(hostCard, this);
|
||||
}
|
||||
|
||||
public int getMinTargets() {
|
||||
return getTargetRestrictions().getMinTargets(getHostCard(), this);
|
||||
}
|
||||
|
||||
public int getMaxTargets() {
|
||||
return getTargetRestrictions().getMaxTargets(getHostCard(), this);
|
||||
}
|
||||
|
||||
public boolean isTargetNumberValid() {
|
||||
if (!this.usesTargeting()) {
|
||||
return getTargets().isEmpty();
|
||||
@@ -1413,7 +1421,7 @@ public abstract class SpellAbility extends CardTraitBase implements ISpellAbilit
|
||||
if (!isMinTargetChosen()) {
|
||||
return false;
|
||||
}
|
||||
int maxTargets = getTargetRestrictions().getMaxTargets(hostCard, this);
|
||||
int maxTargets = getMaxTargets();
|
||||
|
||||
if (maxTargets == 0 && getPayCosts().hasSpecificCostType(CostRemoveCounter.class)
|
||||
&& hasSVar(getParam("TargetMax"))
|
||||
|
||||
Reference in New Issue
Block a user