Merge origin/master

This commit is contained in:
fireshoes 2017-04-10 18:46:43 -05:00
commit 7da69e5064
9 changed files with 248 additions and 10 deletions

View file

@ -286,6 +286,17 @@ public abstract class AbilityImpl implements Ability {
}
}
// 117.6. Some mana costs contain no mana symbols. This represents an unpayable cost. An ability can
// also have an unpayable cost if its cost is based on the mana cost of an object with no mana cost.
// Attempting to cast a spell or activate an ability that has an unpayable cost is a legal action.
// However, attempting to pay an unpayable cost is an illegal action.
//
// We apply this now, *AFTER* the user has made the choice to pay an alternative cost for the
// spell. You can also still cast a spell with an unplayable cost by... not paying it's mana cost.
if (getAbilityType() == AbilityType.SPELL && getManaCostsToPay().isEmpty() && !noMana) {
return false;
}
// 20121001 - 601.2b
// If the spell has a variable cost that will be paid as it's being cast (such as an {X} in
// its mana cost; see rule 107.3), the player announces the value of that variable.

View file

@ -61,8 +61,8 @@ public abstract class EffectImpl implements Effect {
public EffectImpl(final EffectImpl effect) {
this.id = effect.id;
this.outcome = effect.outcome;
this.effectType = effect.effectType;
this.staticText = effect.staticText;
this.effectType = effect.effectType;
this.targetPointer = effect.targetPointer.copy();
if (effect.values != null) {
values = new HashMap<>();

View file

@ -1281,9 +1281,6 @@ public abstract class PlayerImpl implements Player, Serializable {
if (Zone.GRAVEYARD == zone && canPlayCardsFromGraveyard()) {
for (ActivatedAbility ability : candidateAbilites.getPlayableAbilities(Zone.HAND)) {
if (canUse || ability.getAbilityType() == AbilityType.SPECIAL_ACTION) {
if (ability.getManaCosts().isEmpty() && ability.getCosts().isEmpty() && ability instanceof SpellAbility) {
continue; // You can't play spells from graveyard that have no costs
}
if (ability.canActivate(playerId, game)) {
output.put(ability.getId(), ability);
}
@ -1293,9 +1290,6 @@ public abstract class PlayerImpl implements Player, Serializable {
if (zone != Zone.BATTLEFIELD && game.getContinuousEffects().asThough(object.getId(), AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, this.getId(), game)) {
for (Ability ability : candidateAbilites) {
if (canUse || ability.getAbilityType() == AbilityType.SPECIAL_ACTION) {
if (ability.getManaCosts().isEmpty() && ability.getCosts().isEmpty() && ability instanceof SpellAbility && !(Objects.equals(ability.getSourceId(), getCastSourceIdWithAlternateMana()))) {
continue; // You can't play spells that have no costs, unless you can play them without paying their mana costs
}
ability.setControllerId(this.getId());
if (ability instanceof ActivatedAbility && ability.getZone().match(Zone.HAND)
&& ((ActivatedAbility) ability).canActivate(playerId, game)) {