forked from External/mage
Fix remaining raw unparameterized usages of ManaCostImpl
This commit is contained in:
parent
4806626ba0
commit
882afbf8b5
37 changed files with 84 additions and 76 deletions
|
|
@ -626,7 +626,7 @@ public abstract class AbilityImpl implements Ability {
|
|||
manaString.append('{').append(manaSymbol).append('}');
|
||||
}
|
||||
}
|
||||
manaCostsToPay.add(new ManaCostsImpl(manaString.toString()));
|
||||
manaCostsToPay.add(new ManaCostsImpl<>(manaString.toString()));
|
||||
manaCostsToPay.setX(xValue * xValueMultiplier, amountMana);
|
||||
}
|
||||
variableManaCost.setPaid();
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ public class StriveAbility extends SimpleStaticAbility {
|
|||
private final String striveCost;
|
||||
|
||||
public StriveAbility(String manaString) {
|
||||
super(Zone.STACK, new StriveCostIncreasingEffect(new ManaCostsImpl(manaString)));
|
||||
super(Zone.STACK, new StriveCostIncreasingEffect(new ManaCostsImpl<>(manaString)));
|
||||
setRuleAtTheTop(true);
|
||||
this.striveCost = manaString;
|
||||
setAbilityWord(AbilityWord.STRIVE);
|
||||
|
|
@ -67,7 +67,7 @@ class StriveCostIncreasingEffect extends CostModificationEffectImpl {
|
|||
sb.append(striveCosts.getText());
|
||||
}
|
||||
String finalCost = ManaUtil.condenseManaCostString(sb.toString());
|
||||
abilityToModify.getManaCostsToPay().add(new ManaCostsImpl(finalCost));
|
||||
abilityToModify.getManaCostsToPay().add(new ManaCostsImpl<>(finalCost));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
|
||||
package mage.abilities.effects.common.continuous;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.condition.common.SourceIsSpellCondition;
|
||||
import mage.abilities.costs.AlternativeCostSourceAbility;
|
||||
|
|
@ -14,13 +13,15 @@ import mage.constants.SubLayer;
|
|||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author JRHerlehy
|
||||
* Created on 4/4/18.
|
||||
*/
|
||||
public class WUBRGInsteadEffect extends ContinuousEffectImpl {
|
||||
|
||||
private final AlternativeCostSourceAbility alternativeCastingCostAbility = new AlternativeCostSourceAbility(new ManaCostsImpl("{W}{U}{B}{R}{G}"), SourceIsSpellCondition.instance);
|
||||
private final AlternativeCostSourceAbility alternativeCastingCostAbility = new AlternativeCostSourceAbility(new ManaCostsImpl<>("{W}{U}{B}{R}{G}"), SourceIsSpellCondition.instance);
|
||||
|
||||
public WUBRGInsteadEffect() {
|
||||
super(Duration.WhileOnBattlefield, Outcome.Detriment);
|
||||
|
|
|
|||
|
|
@ -41,13 +41,13 @@ public class EchoEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
if (cost == null) {
|
||||
cost = new ManaCostsImpl(Integer.toString(amount.calculate(game, source, this)));
|
||||
cost = new ManaCostsImpl<>(Integer.toString(amount.calculate(game, source, this)));
|
||||
}
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null
|
||||
&& source.getSourceObjectIfItStillExists(game) != null) {
|
||||
if (game.getContinuousEffects().asThough(source.getSourceId(), AsThoughEffectType.PAY_0_ECHO, source, source.getControllerId(), game) != null) {
|
||||
Cost altCost = new ManaCostsImpl("{0}");
|
||||
Cost altCost = new ManaCostsImpl<>("{0}");
|
||||
if (controller.chooseUse(Outcome.Benefit, "Pay {0} instead of the echo cost?", source, game)) {
|
||||
altCost.clearPaid();
|
||||
if (altCost.pay(source, game, source, source.getControllerId(), false, null)) {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
|
||||
package mage.abilities.effects.keyword;
|
||||
|
||||
import java.util.Set;
|
||||
import mage.MageObjectReference;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.costs.mana.ManaCosts;
|
||||
|
|
@ -18,6 +17,8 @@ import mage.game.permanent.Permanent;
|
|||
import mage.players.Player;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
|
|
@ -54,7 +55,7 @@ public class ManifestEffect extends OneShotEffect {
|
|||
if (card.isCreature(game)) {
|
||||
manaCosts = card.getSpellAbility() != null ? card.getSpellAbility().getManaCosts() : null;
|
||||
if (manaCosts == null) {
|
||||
manaCosts = new ManaCostsImpl("{0}");
|
||||
manaCosts = new ManaCostsImpl<>("{0}");
|
||||
}
|
||||
}
|
||||
MageObjectReference objectReference = new MageObjectReference(card.getId(), card.getZoneChangeCounter(game) + 1, game);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
|
||||
package mage.abilities.effects.keyword;
|
||||
|
||||
import java.util.Set;
|
||||
import mage.MageObjectReference;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.costs.mana.ManaCosts;
|
||||
|
|
@ -18,6 +17,8 @@ import mage.game.permanent.Permanent;
|
|||
import mage.players.Player;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
|
|
@ -57,7 +58,7 @@ public class ManifestTargetPlayerEffect extends OneShotEffect {
|
|||
if (card.isCreature(game)) {
|
||||
manaCosts = card.getSpellAbility().getManaCosts();
|
||||
if (manaCosts == null) {
|
||||
manaCosts = new ManaCostsImpl("{0}");
|
||||
manaCosts = new ManaCostsImpl<>("{0}");
|
||||
}
|
||||
}
|
||||
MageObjectReference objectReference = new MageObjectReference(card.getId(), card.getZoneChangeCounter(game) + 1, game);
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ import mage.constants.Zone;
|
|||
public class AdaptAbility extends ActivatedAbilityImpl {
|
||||
|
||||
public AdaptAbility(int adaptNumber, String manaCost) {
|
||||
super(Zone.BATTLEFIELD, new AdaptEffect(adaptNumber), new ManaCostsImpl(manaCost));
|
||||
super(Zone.BATTLEFIELD, new AdaptEffect(adaptNumber), new ManaCostsImpl<>(manaCost));
|
||||
}
|
||||
|
||||
private AdaptAbility(final AdaptAbility ability) {
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ import mage.target.common.TargetAttackingCreature;
|
|||
public class BloodrushAbility extends ActivatedAbilityImpl {
|
||||
|
||||
public BloodrushAbility(String manaString, Effect effect) {
|
||||
super(Zone.HAND, effect, new ManaCostsImpl(manaString));
|
||||
super(Zone.HAND, effect, new ManaCostsImpl<>(manaString));
|
||||
this.addCost(new DiscardSourceCost());
|
||||
this.addTarget(new TargetAttackingCreature());
|
||||
this.setAbilityWord(AbilityWord.BLOODRUSH);
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ public class BuybackAbility extends StaticAbility implements OptionalAdditionalS
|
|||
|
||||
public BuybackAbility(String manaString) {
|
||||
super(Zone.STACK, new BuybackEffect());
|
||||
addBuybackCostAndSetup(new OptionalAdditionalCostImpl(keywordText, reminderTextMana, new ManaCostsImpl(manaString)));
|
||||
addBuybackCostAndSetup(new OptionalAdditionalCostImpl(keywordText, reminderTextMana, new ManaCostsImpl<>(manaString)));
|
||||
setRuleAtTheTop(true);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ public class DisturbAbility extends SpellAbility {
|
|||
this.manaCost = manaCost;
|
||||
this.getManaCosts().clear();
|
||||
this.getManaCostsToPay().clear();
|
||||
this.addManaCost(new ManaCostsImpl(manaCost));
|
||||
this.addManaCost(new ManaCostsImpl<>(manaCost));
|
||||
this.addSubAbility(new TransformAbility());
|
||||
}
|
||||
|
||||
|
|
@ -126,4 +126,4 @@ class DisturbEffect extends ContinuousEffectImpl {
|
|||
TransformAbility.transformCardSpellDynamic(spell, spell.getCard().getSecondCardFace(), game);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,9 +26,9 @@ public class EchoAbility extends TriggeredAbilityImpl {
|
|||
private String rule;
|
||||
|
||||
public EchoAbility(String manaString) {
|
||||
super(Zone.BATTLEFIELD, new EchoEffect(new ManaCostsImpl(manaString)), false);
|
||||
super(Zone.BATTLEFIELD, new EchoEffect(new ManaCostsImpl<>(manaString)), false);
|
||||
this.echoPaid = false;
|
||||
this.echoCosts.add(new ManaCostsImpl(manaString));
|
||||
this.echoCosts.add(new ManaCostsImpl<>(manaString));
|
||||
this.lastController = null;
|
||||
this.rule = null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ public class EntwineAbility extends StaticAbility implements OptionalAdditionalM
|
|||
|
||||
public EntwineAbility(String manaString) {
|
||||
super(Zone.STACK, null);
|
||||
addEntwineCostAndSetup(new OptionalAdditionalCostImpl(keywordText, reminderText, new ManaCostsImpl(manaString)));
|
||||
addEntwineCostAndSetup(new OptionalAdditionalCostImpl(keywordText, reminderText, new ManaCostsImpl<>(manaString)));
|
||||
}
|
||||
|
||||
public EntwineAbility(Cost cost) {
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ public class EscapeAbility extends SpellAbility {
|
|||
this.exileCount = exileCount;
|
||||
this.getManaCosts().clear();
|
||||
this.getManaCostsToPay().clear();
|
||||
this.addManaCost(new ManaCostsImpl(manaCost));
|
||||
this.addManaCost(new ManaCostsImpl<>(manaCost));
|
||||
this.addCost(new ExileFromGraveCost(new TargetCardInYourGraveyard(exileCount, filter), "")); // hide additional cost text from rules
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,20 +2,20 @@
|
|||
|
||||
package mage.abilities.keyword;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.constants.Zone;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* FAQ 2013/01/11
|
||||
*
|
||||
|
|
@ -76,7 +76,7 @@ class ExtortEffect extends OneShotEffect {
|
|||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (player != null && permanent != null) {
|
||||
if (player.chooseUse(Outcome.Damage, new StringBuilder("Extort opponents? (").append(permanent.getName()).append(')').toString(), source, game)) {
|
||||
Cost cost = new ManaCostsImpl("{W/B}");
|
||||
Cost cost = new ManaCostsImpl<>("{W/B}");
|
||||
if (cost.pay(source, game, source, player.getId(), false, null)) {
|
||||
int loseLife = 0;
|
||||
for (UUID opponentId : game.getOpponents(source.getControllerId())) {
|
||||
|
|
|
|||
|
|
@ -18,13 +18,13 @@ import mage.cards.*;
|
|||
import mage.constants.*;
|
||||
import mage.game.ExileZone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.players.Player;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
import mage.util.CardUtil;
|
||||
import mage.watchers.common.ForetoldWatcher;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.game.events.GameEvent;
|
||||
|
||||
/**
|
||||
* @author jeffwadsworth
|
||||
|
|
@ -312,7 +312,7 @@ public class ForetellAbility extends SpecialAction {
|
|||
}
|
||||
this.setAdditionalCostsRuleVisible(false);
|
||||
this.name = "Foretell " + foretellCost;
|
||||
this.addCost(new ManaCostsImpl(foretellCost));
|
||||
this.addCost(new ManaCostsImpl<>(foretellCost));
|
||||
}
|
||||
|
||||
public ForetellCostAbility(final ForetellCostAbility ability) {
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ public class KickerAbility extends StaticAbility implements OptionalAdditionalSo
|
|||
|
||||
public final OptionalAdditionalCost addKickerCost(String manaString) {
|
||||
OptionalAdditionalCost newCost = new OptionalAdditionalCostImpl(
|
||||
keywordText, reminderText, new ManaCostsImpl(manaString));
|
||||
keywordText, reminderText, new ManaCostsImpl<>(manaString));
|
||||
addKickerCostAndSetup(newCost);
|
||||
return newCost;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import mage.constants.TimingRule;
|
|||
public class MutateAbility extends SpellAbility {
|
||||
|
||||
public MutateAbility(Card card, String manaString) {
|
||||
super(new ManaCostsImpl(manaString), card.getName() + " using mutate");
|
||||
super(new ManaCostsImpl<>(manaString), card.getName() + " using mutate");
|
||||
this.spellAbilityType = SpellAbilityType.BASE_ALTERNATE;
|
||||
this.timing = TimingRule.SORCERY;
|
||||
// TODO: Implement this
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ public class SuspendAbility extends SpecialAction {
|
|||
VariableManaCost xCosts = new VariableManaCost(VariableCostType.ALTERNATIVE);
|
||||
xCosts.setMinX(1);
|
||||
this.addManaCost(xCosts);
|
||||
cost = new ManaCostsImpl("{X}" + cost.getText());
|
||||
cost = new ManaCostsImpl<>("{X}" + cost.getText());
|
||||
}
|
||||
StringBuilder sb = new StringBuilder("Suspend ");
|
||||
if (cost != null) {
|
||||
|
|
|
|||
|
|
@ -2,13 +2,13 @@ package mage.abilities.keyword;
|
|||
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.constants.ComparisonType;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.costs.common.DiscardSourceCost;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.Cards;
|
||||
import mage.cards.CardsImpl;
|
||||
import mage.constants.ComparisonType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.TimingRule;
|
||||
import mage.constants.Zone;
|
||||
|
|
@ -39,7 +39,7 @@ import mage.target.common.TargetCardInLibrary;
|
|||
public class TransmuteAbility extends SimpleActivatedAbility {
|
||||
|
||||
public TransmuteAbility(String manaCost) {
|
||||
super(Zone.HAND, new TransmuteEffect(), new ManaCostsImpl(manaCost));
|
||||
super(Zone.HAND, new TransmuteEffect(), new ManaCostsImpl<>(manaCost));
|
||||
this.setTiming(TimingRule.SORCERY);
|
||||
this.addCost(new DiscardSourceCost());
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue