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:
Hanmac
2016-08-03 10:50:34 +00:00
parent 22c741c7d0
commit 2458a8f73c
5 changed files with 26 additions and 25 deletions

View File

@@ -3991,6 +3991,10 @@ public class Card extends GameEntity implements Comparable<Card> {
if (!getExiledWith().equals(host)) {
return false;
}
} else if (property.equals("CanBeSacrificedBy")) {
if (!canBeSacrificedBy(spellAbility)) {
return false;
}
} else if (property.startsWith("AttachedBy")) {
if (!isEquippedBy(source) && !isEnchantedBy(source) && !isFortifiedBy(source)) {
return false;
@@ -6641,8 +6645,21 @@ public class Card extends GameEntity implements Comparable<Card> {
if (!canBeSacrificed()) {
return false;
}
return !(source != null && getController().isOpponentOf(source.getActivatingPlayer())
&& getController().hasKeyword("Spells and abilities your opponents control can't cause you to sacrifice permanents."));
if (source == null){
return false;
}
if (isCreature() && source.getActivatingPlayer().hasKeyword("You can't sacrifice creatures to cast spells or activate abilities.")) {
return false;
}
if (getController().isOpponentOf(source.getActivatingPlayer())
&& getController().hasKeyword("Spells and abilities your opponents control can't cause you to sacrifice permanents.")) {
return false;
}
return true;
}
public CardRules getRules() {

View File

@@ -93,9 +93,6 @@ public class CostSacrifice extends CostPartWithList {
typeList = CardLists.getValidCards(typeList, this.getType().split(";"), activator, source, ability);
final Integer amount = this.convertAmount();
if (activator.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 (!needsAnnoucement && (amount != null) && (typeList.size() < amount)) {
@@ -106,13 +103,8 @@ public class CostSacrifice extends CostPartWithList {
// if X is defined, it needs to be calculated and checked, if X is
// choice, it can be Paid even if it's 0
}
else {
if (!source.canBeSacrificed()) {
return false;
}
else if (source.isCreature() && activator.hasKeyword("You can't sacrifice creatures to cast spells or activate abilities.")) {
return false;
}
else if (!source.canBeSacrificedBy(ability)) {
return false;
}
return true;