mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 18:28:00 +00:00
Clean script
This commit is contained in:
@@ -67,14 +67,10 @@ public class SacrificeAllEffect extends SpellAbilityEffect {
|
||||
// update cards that where using LKI
|
||||
CardCollection gameList = new CardCollection();
|
||||
for (Card sac : list) {
|
||||
final Card gameCard = game.getCardState(sac, null);
|
||||
// gameCard is LKI in that case, the card is not in game anymore
|
||||
// or the timestamp did change
|
||||
// this should check Self too
|
||||
if (gameCard == null || !sac.equalsWithTimestamp(gameCard) || !gameCard.canBeSacrificedBy(sa, true)) {
|
||||
if (!sac.canBeSacrificedBy(sa, true)) {
|
||||
continue;
|
||||
}
|
||||
gameList.add(gameCard);
|
||||
gameList.add(game.getCardState(sac, null));
|
||||
}
|
||||
|
||||
list = gameList;
|
||||
|
||||
@@ -6473,10 +6473,19 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
|
||||
System.out.println("Trying to sacrifice immutables: " + this);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!isInPlay() || isPhasedOut()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
final Card gameCard = game.getCardState(this, null);
|
||||
// gameCard is LKI in that case, the card is not in game anymore
|
||||
// or the timestamp did change
|
||||
// this should check Self too
|
||||
if (gameCard == null || !this.equalsWithTimestamp(gameCard)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return !StaticAbilityCantSacrifice.cantSacrifice(this, source, effect);
|
||||
}
|
||||
|
||||
|
||||
@@ -117,22 +117,25 @@ public class CostSacrifice extends CostPartWithList {
|
||||
Card originalEquipment = ability.getOriginalHost();
|
||||
return originalEquipment.isEquipping() && originalEquipment.canBeSacrificedBy(ability, effect);
|
||||
}
|
||||
else if (!payCostFromSource()) { // You can always sac all
|
||||
if ("All".equalsIgnoreCase(getAmount())) {
|
||||
CardCollectionView typeList = activator.getCardsIn(ZoneType.Battlefield);
|
||||
typeList = CardLists.getValidCards(typeList, getType().split(";"), activator, source, ability);
|
||||
// it needs to check if everything can be sacrificed
|
||||
return Iterables.all(typeList, CardPredicates.canBeSacrificedBy(ability, effect));
|
||||
}
|
||||
|
||||
int amount = getAbilityAmount(ability);
|
||||
|
||||
return getMaxAmountX(ability, activator, effect) >= amount;
|
||||
// If amount is null, it's either "ALL" or "X"
|
||||
// if X is defined, it needs to be calculated and checked, if X is
|
||||
// choice, it can be Paid even if it's 0
|
||||
if (payCostFromSource()) {
|
||||
return source.canBeSacrificedBy(ability, effect);
|
||||
}
|
||||
else return source.canBeSacrificedBy(ability, effect);
|
||||
|
||||
// You can always sac all
|
||||
if ("All".equalsIgnoreCase(getAmount())) {
|
||||
CardCollectionView typeList = activator.getCardsIn(ZoneType.Battlefield);
|
||||
typeList = CardLists.getValidCards(typeList, getType().split(";"), activator, source, ability);
|
||||
// it needs to check if everything can be sacrificed
|
||||
return Iterables.all(typeList, CardPredicates.canBeSacrificedBy(ability, effect));
|
||||
}
|
||||
|
||||
int amount = getAbilityAmount(ability);
|
||||
|
||||
// If amount is null, it's either "ALL" or "X"
|
||||
// if X is defined, it needs to be calculated and checked, if X is
|
||||
// choice, it can be Paid even if it's 0
|
||||
return getMaxAmountX(ability, activator, effect) >= amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user