MCPcopy Create free account
hub / github.com/Card-Forge/forge / canBeSacrificedBy

Method canBeSacrificedBy

forge-game/src/main/java/forge/game/card/Card.java:6949–6973  ·  view source on GitHub ↗
(final SpellAbility source, final boolean effect)

Source from the content-addressed store, hash-verified

6947 }
6948
6949 public final boolean canBeSacrificedBy(final SpellAbility source, final boolean effect) {
6950 if (isImmutable()) {
6951 System.out.println("Trying to sacrifice immutables: " + this);
6952 return false;
6953 }
6954
6955 if (!isInPlay() || isPhasedOut()) {
6956 return false;
6957 }
6958
6959 // can't sacrifice it for mana ability if it is already marked as sacrifice
6960 if (source != null && source.isManaAbility() && isUsedToPay()) {
6961 return false;
6962 }
6963
6964 final Card gameCard = game.getCardState(this, null);
6965 // gameCard is LKI in that case, the card is not in game anymore
6966 // or the timestamp did change
6967 // this should check Self too
6968 if (gameCard == null || !this.equalsWithGameTimestamp(gameCard)) {
6969 return false;
6970 }
6971
6972 return !StaticAbilityCantSacrifice.cantSacrifice(this, source, effect);
6973 }
6974
6975 public final boolean canExiledBy(final SpellAbility source, final boolean effect) {
6976 return !StaticAbilityCantExile.cantExile(this, source, effect);

Callers 8

canPayMethod · 0.95
visitMethod · 0.95
willPayUnlessCostMethod · 0.95
stateBasedAction_SagaMethod · 0.45
sacrificeMethod · 0.45
cardHasPropertyMethod · 0.45
resolveMethod · 0.45
doSacOneEachLogicMethod · 0.45

Calls 8

isImmutableMethod · 0.95
isInPlayMethod · 0.95
isPhasedOutMethod · 0.95
isUsedToPayMethod · 0.95
cantSacrificeMethod · 0.95
isManaAbilityMethod · 0.45
getCardStateMethod · 0.45

Tested by

no test coverage detected