forked from External/mage
* Available mana calculation - Fixed a problem with repeatable mana converting abilities (e.g. Farrelite Priest) that were only considered once (#6698).
This commit is contained in:
parent
cbb289337d
commit
653a2dd7b2
5 changed files with 109 additions and 40 deletions
|
|
@ -3157,10 +3157,8 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
game.getContinuousEffects().costModification(copyAbility, game);
|
||||
|
||||
for (Mana mana : copyAbility.getManaCostsToPay().getOptions()) {
|
||||
for (Mana avail : availableMana) {
|
||||
if (mana.enough(avail)) {
|
||||
return true;
|
||||
}
|
||||
if (availableMana.enough(mana)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3196,10 +3194,8 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
game.getContinuousEffects().costModification(copyAbility, game);
|
||||
|
||||
for (Mana mana : copyAbility.getManaCostsToPay().getOptions()) {
|
||||
for (Mana avail : availableMana) {
|
||||
if (mana.enough(avail)) {
|
||||
return true;
|
||||
}
|
||||
if (availableMana.enough(mana)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3247,7 +3243,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
|
||||
protected ActivatedAbility findActivatedAbilityFromAlternativeSourceCost(MageObject object, ManaOptions availableMana, Ability ability, Game game) {
|
||||
// return play ability that can activate AlternativeSourceCosts
|
||||
if (ability instanceof AlternativeSourceCosts && !(object instanceof Permanent)) {
|
||||
if (ability instanceof AlternativeSourceCosts && object != null && !(object instanceof Permanent)) {
|
||||
ActivatedAbility playAbility = null;
|
||||
if (object.isLand()) {
|
||||
playAbility = (PlayLandAbility) CardUtil.getAbilities(object, game).stream().filter(a -> a instanceof PlayLandAbility).findFirst().orElse(null);
|
||||
|
|
@ -3263,8 +3259,8 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
// Even mana cost can't be checked here without lookahead
|
||||
// So make it available all the time
|
||||
boolean canUse;
|
||||
if (ability instanceof MorphAbility) {
|
||||
canUse = game.canPlaySorcery(playerId) && ((MorphAbility) ability).isAvailable(playAbility, game);
|
||||
if (ability instanceof MorphAbility && object instanceof Card && game.canPlaySorcery(getId())) {
|
||||
canUse = canPlayCardByAlternateCost((Card) object, availableMana, ability, game);
|
||||
} else {
|
||||
canUse = canPlay(playAbility, availableMana, object, game); // canPlay already checks alternative source costs and all conditions
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue