mirror of
https://github.com/correl/mage.git
synced 2024-12-26 11:09:27 +00:00
* Flashback ability - Fixed that flashback abilities with non mana costs (e.g. Cabal Therapy) added the costs wrongly again as additional costs to the tooltip text of the card.
This commit is contained in:
parent
ad6898ca54
commit
a229d4d260
9 changed files with 52 additions and 9 deletions
|
@ -32,7 +32,6 @@ import mage.constants.CardType;
|
||||||
import mage.constants.Outcome;
|
import mage.constants.Outcome;
|
||||||
import mage.constants.Rarity;
|
import mage.constants.Rarity;
|
||||||
import mage.constants.TimingRule;
|
import mage.constants.TimingRule;
|
||||||
import mage.constants.Zone;
|
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.costs.common.SacrificeTargetCost;
|
import mage.abilities.costs.common.SacrificeTargetCost;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
|
@ -64,7 +63,9 @@ public class CabalTherapy extends CardImpl<CabalTherapy> {
|
||||||
this.getSpellAbility().addTarget(new TargetPlayer(true));
|
this.getSpellAbility().addTarget(new TargetPlayer(true));
|
||||||
this.getSpellAbility().addEffect(new CabalTherapyEffect());
|
this.getSpellAbility().addEffect(new CabalTherapyEffect());
|
||||||
// Flashback-Sacrifice a creature.
|
// Flashback-Sacrifice a creature.
|
||||||
this.addAbility(new FlashbackAbility(new SacrificeTargetCost(new TargetControlledCreaturePermanent(1,1,new FilterControlledCreaturePermanent("a creature"), true)), TimingRule.SORCERY));
|
this.addAbility(new FlashbackAbility(
|
||||||
|
new SacrificeTargetCost(new TargetControlledCreaturePermanent(1,1,new FilterControlledCreaturePermanent("a creature"), true)),
|
||||||
|
TimingRule.SORCERY));
|
||||||
}
|
}
|
||||||
|
|
||||||
public CabalTherapy(final CabalTherapy card) {
|
public CabalTherapy(final CabalTherapy card) {
|
||||||
|
|
|
@ -40,6 +40,7 @@ import mage.constants.TimingRule;
|
||||||
import mage.target.TargetPlayer;
|
import mage.target.TargetPlayer;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import mage.abilities.costs.Cost;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -58,7 +59,7 @@ public class DeepAnalysis extends CardImpl<DeepAnalysis> {
|
||||||
this.getSpellAbility().addTarget(new TargetPlayer());
|
this.getSpellAbility().addTarget(new TargetPlayer());
|
||||||
|
|
||||||
// Flashback-{1}{U}, Pay 3 life.
|
// Flashback-{1}{U}, Pay 3 life.
|
||||||
Costs costs = new CostsImpl();
|
CostsImpl costs = new CostsImpl();
|
||||||
costs.add(new ManaCostsImpl("{1}{U}"));
|
costs.add(new ManaCostsImpl("{1}{U}"));
|
||||||
costs.add(new PayLifeCost(3));
|
costs.add(new PayLifeCost(3));
|
||||||
this.addAbility(new FlashbackAbility(costs, TimingRule.SORCERY));
|
this.addAbility(new FlashbackAbility(costs, TimingRule.SORCERY));
|
||||||
|
|
|
@ -95,7 +95,7 @@ public class AbilitiesImpl<T extends Ability> extends ArrayList<T> implements Ab
|
||||||
}
|
}
|
||||||
rules.add(sbRule.toString());
|
rules.add(sbRule.toString());
|
||||||
}
|
}
|
||||||
if (ability.getCosts().size() > 0) {
|
if (ability.getAdditionalCostsRuleVisible() && ability.getCosts().size() > 0) {
|
||||||
StringBuilder sbRule = new StringBuilder();
|
StringBuilder sbRule = new StringBuilder();
|
||||||
for (Cost cost: ability.getCosts()) {
|
for (Cost cost: ability.getCosts()) {
|
||||||
if (cost.getText() != null && !cost.getText().isEmpty()) {
|
if (cost.getText() != null && !cost.getText().isEmpty()) {
|
||||||
|
|
|
@ -391,6 +391,7 @@ public interface Ability extends Controllable, Serializable {
|
||||||
*/
|
*/
|
||||||
boolean getRuleVisible();
|
boolean getRuleVisible();
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the value for the ruleVisible attribute
|
* Sets the value for the ruleVisible attribute
|
||||||
*
|
*
|
||||||
|
@ -401,6 +402,23 @@ public interface Ability extends Controllable, Serializable {
|
||||||
*/
|
*/
|
||||||
void setRuleVisible(boolean ruleVisible);
|
void setRuleVisible(boolean ruleVisible);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if the additional costs of the abilitiy should be visible on the tooltip text
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
boolean getAdditionalCostsRuleVisible();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the value for the additional costs rule attribute
|
||||||
|
*
|
||||||
|
* true = rule will be shown for the card / permanent
|
||||||
|
* false = rule won't be shown
|
||||||
|
*
|
||||||
|
* @param ruleAdditionalCostsVisible
|
||||||
|
*/
|
||||||
|
void setAdditionalCostsRuleVisible(boolean ruleAdditionalCostsVisible);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the originalId of the ability
|
* Get the originalId of the ability
|
||||||
|
|
|
@ -95,6 +95,7 @@ public abstract class AbilityImpl<T extends AbilityImpl<T>> implements Ability {
|
||||||
protected boolean usesStack = true;
|
protected boolean usesStack = true;
|
||||||
protected boolean ruleAtTheTop = false;
|
protected boolean ruleAtTheTop = false;
|
||||||
protected boolean ruleVisible = true;
|
protected boolean ruleVisible = true;
|
||||||
|
protected boolean ruleAdditionalCostsVisible = true;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public abstract T copy();
|
public abstract T copy();
|
||||||
|
@ -130,6 +131,7 @@ public abstract class AbilityImpl<T extends AbilityImpl<T>> implements Ability {
|
||||||
this.modes = ability.modes.copy();
|
this.modes = ability.modes.copy();
|
||||||
this.ruleAtTheTop = ability.ruleAtTheTop;
|
this.ruleAtTheTop = ability.ruleAtTheTop;
|
||||||
this.ruleVisible = ability.ruleVisible;
|
this.ruleVisible = ability.ruleVisible;
|
||||||
|
this.ruleAdditionalCostsVisible = ability.ruleAdditionalCostsVisible;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -760,6 +762,15 @@ public abstract class AbilityImpl<T extends AbilityImpl<T>> implements Ability {
|
||||||
this.ruleVisible = ruleVisible;
|
this.ruleVisible = ruleVisible;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean getAdditionalCostsRuleVisible() {
|
||||||
|
return ruleAdditionalCostsVisible;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setAdditionalCostsRuleVisible(boolean ruleAdditionalCostsVisible) {
|
||||||
|
this.ruleAdditionalCostsVisible = ruleAdditionalCostsVisible;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public UUID getOriginalId() {
|
public UUID getOriginalId() {
|
||||||
|
|
|
@ -40,6 +40,7 @@ import mage.target.Targets;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author BetaSteward_at_googlemail.com
|
* @author BetaSteward_at_googlemail.com
|
||||||
|
* @param <T>
|
||||||
*/
|
*/
|
||||||
public class CostsImpl<T extends Cost> extends ArrayList<T> implements Costs<T> {
|
public class CostsImpl<T extends Cost> extends ArrayList<T> implements Costs<T> {
|
||||||
|
|
||||||
|
@ -97,7 +98,7 @@ public class CostsImpl<T extends Cost> extends ArrayList<T> implements Costs<T>
|
||||||
@Override
|
@Override
|
||||||
public boolean isPaid() {
|
public boolean isPaid() {
|
||||||
for (T cost: this) {
|
for (T cost: this) {
|
||||||
if (!((T)cost instanceof VariableManaCost) && !cost.isPaid()) {
|
if (!(cost instanceof VariableManaCost) && !cost.isPaid()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -120,7 +121,7 @@ public class CostsImpl<T extends Cost> extends ArrayList<T> implements Costs<T>
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Costs<T> getUnpaid() {
|
public Costs<T> getUnpaid() {
|
||||||
Costs<T> unpaid = new CostsImpl<T>();
|
Costs<T> unpaid = new CostsImpl<>();
|
||||||
for (T cost: this) {
|
for (T cost: this) {
|
||||||
if (!cost.isPaid()) {
|
if (!cost.isPaid()) {
|
||||||
unpaid.add(cost);
|
unpaid.add(cost);
|
||||||
|
@ -139,7 +140,7 @@ public class CostsImpl<T extends Cost> extends ArrayList<T> implements Costs<T>
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<VariableCost> getVariableCosts() {
|
public List<VariableCost> getVariableCosts() {
|
||||||
List<VariableCost> variableCosts = new ArrayList<VariableCost>();
|
List<VariableCost> variableCosts = new ArrayList<>();
|
||||||
for (T cost: this) {
|
for (T cost: this) {
|
||||||
if (cost instanceof VariableCost) {
|
if (cost instanceof VariableCost) {
|
||||||
variableCosts.add((VariableCost) cost);
|
variableCosts.add((VariableCost) cost);
|
||||||
|
|
|
@ -40,7 +40,7 @@ import java.util.UUID;
|
||||||
*/
|
*/
|
||||||
public class PayLifeCost extends CostImpl<PayLifeCost> {
|
public class PayLifeCost extends CostImpl<PayLifeCost> {
|
||||||
|
|
||||||
private int amount;
|
private final int amount;
|
||||||
|
|
||||||
public PayLifeCost(int amount) {
|
public PayLifeCost(int amount) {
|
||||||
this.amount = amount;
|
this.amount = amount;
|
||||||
|
|
|
@ -57,6 +57,7 @@ public class FlashbackAbility extends SpellAbility {
|
||||||
|
|
||||||
public FlashbackAbility(Cost cost, TimingRule timingRule) {
|
public FlashbackAbility(Cost cost, TimingRule timingRule) {
|
||||||
super(null, "", Zone.GRAVEYARD);
|
super(null, "", Zone.GRAVEYARD);
|
||||||
|
this.setAdditionalCostsRuleVisible(false);
|
||||||
this.name = new StringBuilder("Flashback ").append(cost.getText()).toString();
|
this.name = new StringBuilder("Flashback ").append(cost.getText()).toString();
|
||||||
this.addEffect(new FlashbackEffect());
|
this.addEffect(new FlashbackEffect());
|
||||||
this.addCost(cost);
|
this.addCost(cost);
|
||||||
|
|
|
@ -390,6 +390,16 @@ public class StackAbility implements StackObject, Ability {
|
||||||
this.ability.setRuleVisible(ruleVisible);
|
this.ability.setRuleVisible(ruleVisible);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean getAdditionalCostsRuleVisible() {
|
||||||
|
return this.ability.getAdditionalCostsRuleVisible();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setAdditionalCostsRuleVisible(boolean ruleAdditionalCostsVisible) {
|
||||||
|
this.ability.setAdditionalCostsRuleVisible(ruleAdditionalCostsVisible);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public UUID getOriginalId() {
|
public UUID getOriginalId() {
|
||||||
return this.ability.getOriginalId();
|
return this.ability.getOriginalId();
|
||||||
|
|
Loading…
Reference in a new issue