mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 04:08:01 +00:00
Cost: moved "You can't sacrifice creatures to cast spells or activate abilities." into Card.canBeSacrificedBy.
also add Property for that.
This commit is contained in:
@@ -424,11 +424,6 @@ public class AiCostDecision extends CostDecisionMakerBase {
|
||||
return PaymentDecision.card(source);
|
||||
}
|
||||
if (cost.getAmount().equals("All")) {
|
||||
/*CardCollectionView typeList = new CardCollection(activator.getCardsIn(ZoneType.Battlefield));
|
||||
typeList = CardLists.getValidCards(typeList, cost.getType().split(";"), activator, source);
|
||||
if (activator.hasKeyword("You can't sacrifice creatures to cast spells or activate abilities.")) {
|
||||
typeList = CardLists.getNotType(typeList, "Creature");
|
||||
}*/
|
||||
// Does the AI want to use Sacrifice All?
|
||||
return null;
|
||||
}
|
||||
@@ -441,7 +436,7 @@ public class AiCostDecision extends CostDecisionMakerBase {
|
||||
|
||||
c = AbilityUtils.calculateAmount(source, cost.getAmount(), ability);
|
||||
}
|
||||
CardCollectionView list = ComputerUtil.chooseSacrificeType(player, cost.getType(), source, ability.getTargetCard(), c);
|
||||
CardCollectionView list = ComputerUtil.chooseSacrificeType(player, cost.getType(), ability, ability.getTargetCard(), c);
|
||||
return PaymentDecision.card(list);
|
||||
}
|
||||
|
||||
|
||||
@@ -372,11 +372,11 @@ public class ComputerUtil {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static CardCollection chooseSacrificeType(final Player ai, final String type, final Card source, final Card target, final int amount) {
|
||||
public static CardCollection chooseSacrificeType(final Player ai, final String type, final SpellAbility ability, final Card target, final int amount) {
|
||||
final Card source = ability.getHostCard();
|
||||
CardCollection typeList = CardLists.getValidCards(ai.getCardsIn(ZoneType.Battlefield), type.split(";"), source.getController(), source, null);
|
||||
if (ai.hasKeyword("You can't sacrifice creatures to cast spells or activate abilities.")) {
|
||||
typeList = CardLists.getNotType(typeList, "Creature");
|
||||
}
|
||||
|
||||
typeList = CardLists.filter(typeList, CardPredicates.canBeSacrificedBy(ability));
|
||||
|
||||
if ((target != null) && target.getController() == ai && typeList.contains(target)) {
|
||||
typeList.remove(target); // don't sacrifice the card we're pumping
|
||||
|
||||
Reference in New Issue
Block a user