mirror of
https://github.com/correl/mage.git
synced 2024-11-22 03:00:11 +00:00
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
|
@ -153,7 +153,7 @@ public class SimulatedPlayer2 extends ComputerPlayer {
|
|||
if (newAbility instanceof AbilityImpl) {
|
||||
xMultiplier = ((AbilityImpl) newAbility).handleManaXMultiplier(game, xMultiplier);
|
||||
}
|
||||
newAbility.getManaCostsToPay().add(new ManaCostsImpl(new StringBuilder("{").append(xAnnounceValue).append('}').toString()));
|
||||
newAbility.getManaCostsToPay().add(new ManaCostsImpl<>(new StringBuilder("{").append(xAnnounceValue).append('}').toString()));
|
||||
newAbility.getManaCostsToPay().setX(xAnnounceValue * xMultiplier, xAnnounceValue * xInstancesCount);
|
||||
if (varCost != null) {
|
||||
varCost.setPaid();
|
||||
|
|
|
@ -73,7 +73,7 @@ public class ConditionalAsThoughTest extends CardTestPlayerBase {
|
|||
Ability ability = new SimpleActivatedAbility(
|
||||
Zone.ALL,
|
||||
new InfoEffect("test"),
|
||||
new ManaCostsImpl("{R}")
|
||||
new ManaCostsImpl<>("{R}")
|
||||
);
|
||||
ability.addTarget(new TargetCardInLibrary());
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ public class ConditionalAsThoughTest extends CardTestPlayerBase {
|
|||
0
|
||||
)
|
||||
).setText("allow target cast"),
|
||||
new ManaCostsImpl("{R}")
|
||||
new ManaCostsImpl<>("{R}")
|
||||
);
|
||||
ability.addTarget(new TargetCardInOpponentsGraveyard(StaticFilters.FILTER_CARD));
|
||||
addCustomCardWithAbility("play any opponent hand", playerA, ability);
|
||||
|
|
|
@ -207,7 +207,7 @@ public class SparkDoubleTest extends CardTestPlayerBase {
|
|||
|
||||
@Test
|
||||
public void test_CopyOfSparksCopy_ByAbility() {
|
||||
Ability ability = new SimpleActivatedAbility(new CreateTokenCopyTargetEffect(), new ManaCostsImpl(""));
|
||||
Ability ability = new SimpleActivatedAbility(new CreateTokenCopyTargetEffect(), new ManaCostsImpl<>(""));
|
||||
ability.addTarget(new TargetPermanent());
|
||||
addCustomCardWithAbility("copy", playerA, ability);
|
||||
|
||||
|
|
|
@ -171,7 +171,7 @@ public class ManaPoolTest extends CardTestPlayerBase {
|
|||
public void test_ConditionalMana_OneXSpell() {
|
||||
addCustomCardWithAbility("add 10", playerA, new SimpleActivatedAbility(Zone.ALL,
|
||||
new AddConditionalManaEffect(Mana.RedMana(10), new InstantOrSorcerySpellManaBuilder()),
|
||||
new ManaCostsImpl("")));
|
||||
new ManaCostsImpl<>("")));
|
||||
addCard(Zone.HAND, playerA, "Volcanic Geyser"); // {X}{R}{R}
|
||||
|
||||
// make mana
|
||||
|
@ -197,7 +197,7 @@ public class ManaPoolTest extends CardTestPlayerBase {
|
|||
public void test_ConditionalMana_MultipleXSpell() {
|
||||
addCustomCardWithAbility("add 10", playerA, new SimpleActivatedAbility(Zone.ALL,
|
||||
new AddConditionalManaEffect(Mana.RedMana(10), new InstantOrSorcerySpellManaBuilder()),
|
||||
new ManaCostsImpl("")));
|
||||
new ManaCostsImpl<>("")));
|
||||
addCard(Zone.HAND, playerA, "Volcanic Geyser", 2); // {X}{R}{R}
|
||||
|
||||
// make mana
|
||||
|
@ -229,7 +229,7 @@ public class ManaPoolTest extends CardTestPlayerBase {
|
|||
public void test_MultipleMana_OneXAbility() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 4);
|
||||
//
|
||||
Ability ability = new SimpleActivatedAbility(Zone.ALL, new DamageTargetEffect(ManacostVariableValue.REGULAR), new ManaCostsImpl("{X}"));
|
||||
Ability ability = new SimpleActivatedAbility(Zone.ALL, new DamageTargetEffect(ManacostVariableValue.REGULAR), new ManaCostsImpl<>("{X}"));
|
||||
ability.addTarget(new TargetAnyTarget());
|
||||
addCustomCardWithAbility("damage X", playerA, ability);
|
||||
|
||||
|
@ -259,9 +259,9 @@ public class ManaPoolTest extends CardTestPlayerBase {
|
|||
public void test_ConditionalMana_OneXAbility() {
|
||||
addCustomCardWithAbility("add 10", playerA, new SimpleActivatedAbility(Zone.ALL,
|
||||
new AddConditionalManaEffect(Mana.RedMana(10), new SimpleActivatedAbilityManaBuilder()),
|
||||
new ManaCostsImpl("")));
|
||||
new ManaCostsImpl<>("")));
|
||||
//
|
||||
Ability ability = new SimpleActivatedAbility(Zone.ALL, new DamageTargetEffect(ManacostVariableValue.REGULAR), new ManaCostsImpl("{X}"));
|
||||
Ability ability = new SimpleActivatedAbility(Zone.ALL, new DamageTargetEffect(ManacostVariableValue.REGULAR), new ManaCostsImpl<>("{X}"));
|
||||
ability.addTarget(new TargetAnyTarget());
|
||||
addCustomCardWithAbility("damage X", playerA, ability);
|
||||
|
||||
|
@ -289,12 +289,12 @@ public class ManaPoolTest extends CardTestPlayerBase {
|
|||
addCard(Zone.HAND, playerA, "Lightning Bolt"); // {R}
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 1 + 3 + 1);
|
||||
//
|
||||
Ability ability = new SimpleActivatedAbility(Zone.ALL, new DamageTargetEffect(ManacostVariableValue.REGULAR), new ManaCostsImpl(""));
|
||||
Ability ability = new SimpleActivatedAbility(Zone.ALL, new DamageTargetEffect(ManacostVariableValue.REGULAR), new ManaCostsImpl<>(""));
|
||||
ability.addTarget(new TargetAnyTarget());
|
||||
addCustomCardWithAbility("damage X", playerA, ability);
|
||||
//
|
||||
// {X}: Counter target spell
|
||||
ability = new SimpleActivatedAbility(Zone.ALL, new CounterUnlessPaysEffect(ManacostVariableValue.REGULAR), new ManaCostsImpl("{X}"));
|
||||
ability = new SimpleActivatedAbility(Zone.ALL, new CounterUnlessPaysEffect(ManacostVariableValue.REGULAR), new ManaCostsImpl<>("{X}"));
|
||||
ability.addTarget(new TargetSpell());
|
||||
addCustomCardWithAbility("counter until pay X", playerB, ability);
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Island", 3);
|
||||
|
@ -336,14 +336,14 @@ public class ManaPoolTest extends CardTestPlayerBase {
|
|||
//
|
||||
addCustomCardWithAbility("add 10", playerA, new SimpleManaAbility(Zone.ALL,
|
||||
new AddConditionalManaEffect(Mana.RedMana(10), new SimpleActivatedAbilityManaBuilder()),
|
||||
new ManaCostsImpl("")));
|
||||
new ManaCostsImpl<>("")));
|
||||
//
|
||||
Ability ability = new SimpleActivatedAbility(Zone.ALL, new DamageTargetEffect(ManacostVariableValue.REGULAR), new ManaCostsImpl(""));
|
||||
Ability ability = new SimpleActivatedAbility(Zone.ALL, new DamageTargetEffect(ManacostVariableValue.REGULAR), new ManaCostsImpl<>(""));
|
||||
ability.addTarget(new TargetAnyTarget());
|
||||
addCustomCardWithAbility("damage X", playerA, ability);
|
||||
//
|
||||
// {X}: Counter target spell
|
||||
ability = new SimpleActivatedAbility(Zone.ALL, new CounterUnlessPaysEffect(ManacostVariableValue.REGULAR), new ManaCostsImpl("{X}"));
|
||||
ability = new SimpleActivatedAbility(Zone.ALL, new CounterUnlessPaysEffect(ManacostVariableValue.REGULAR), new ManaCostsImpl<>("{X}"));
|
||||
ability.addTarget(new TargetSpell());
|
||||
addCustomCardWithAbility("counter until pay X", playerB, ability);
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Island", 3);
|
||||
|
|
|
@ -487,7 +487,7 @@ public abstract class MageTestPlayerBase {
|
|||
* @param damageAmount
|
||||
*/
|
||||
protected void addCustomEffect_TargetDamage(TestPlayer controller, int damageAmount) {
|
||||
Ability ability = new SimpleActivatedAbility(new DamageTargetEffect(damageAmount).setText("target damage " + damageAmount), new ManaCostsImpl(""));
|
||||
Ability ability = new SimpleActivatedAbility(new DamageTargetEffect(damageAmount).setText("target damage " + damageAmount), new ManaCostsImpl<>(""));
|
||||
ability.addTarget(new TargetAnyTarget());
|
||||
addCustomCardWithAbility(
|
||||
"target damage " + damageAmount + " for " + controller.getName(),
|
||||
|
@ -502,7 +502,7 @@ public abstract class MageTestPlayerBase {
|
|||
* @param controller
|
||||
*/
|
||||
protected void addCustomEffect_DestroyTarget(TestPlayer controller) {
|
||||
Ability ability = new SimpleActivatedAbility(new DestroyTargetEffect().setText("target destroy"), new ManaCostsImpl(""));
|
||||
Ability ability = new SimpleActivatedAbility(new DestroyTargetEffect().setText("target destroy"), new ManaCostsImpl<>(""));
|
||||
ability.addTarget(new TargetPermanent());
|
||||
addCustomCardWithAbility(
|
||||
"target destroy for " + controller.getName(),
|
||||
|
@ -518,7 +518,7 @@ public abstract class MageTestPlayerBase {
|
|||
*/
|
||||
protected void addCustomEffect_ReturnFromAnyToHand(TestPlayer controller) {
|
||||
// graveyard
|
||||
Ability ability = new SimpleActivatedAbility(new ReturnFromGraveyardToHandTargetEffect().setText("return from graveyard"), new ManaCostsImpl(""));
|
||||
Ability ability = new SimpleActivatedAbility(new ReturnFromGraveyardToHandTargetEffect().setText("return from graveyard"), new ManaCostsImpl<>(""));
|
||||
ability.addTarget(new TargetCardInGraveyard(StaticFilters.FILTER_CARD));
|
||||
addCustomCardWithAbility(
|
||||
"return from graveyard for " + controller.getName(),
|
||||
|
@ -527,7 +527,7 @@ public abstract class MageTestPlayerBase {
|
|||
);
|
||||
|
||||
// exile
|
||||
ability = new SimpleActivatedAbility(new ReturnFromExileEffect(Zone.HAND).setText("return from exile"), new ManaCostsImpl(""));
|
||||
ability = new SimpleActivatedAbility(new ReturnFromExileEffect(Zone.HAND).setText("return from exile"), new ManaCostsImpl<>(""));
|
||||
ability.addTarget(new TargetCardInExile(StaticFilters.FILTER_CARD));
|
||||
addCustomCardWithAbility(
|
||||
"return from exile for " + controller.getName(),
|
||||
|
@ -536,7 +536,7 @@ public abstract class MageTestPlayerBase {
|
|||
);
|
||||
|
||||
// library
|
||||
ability = new SimpleActivatedAbility(new SearchLibraryPutInHandEffect(new TargetCardInLibrary(StaticFilters.FILTER_CARD)).setText("return from library"), new ManaCostsImpl(""));
|
||||
ability = new SimpleActivatedAbility(new SearchLibraryPutInHandEffect(new TargetCardInLibrary(StaticFilters.FILTER_CARD)).setText("return from library"), new ManaCostsImpl<>(""));
|
||||
addCustomCardWithAbility(
|
||||
"return from library for " + controller.getName(),
|
||||
controller,
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ public class MockCard extends CardImpl {
|
|||
|
||||
this.usesVariousArt = card.usesVariousArt();
|
||||
|
||||
//this.manaCost = new ManaCostsImpl(join(card.getManaCosts(CardInfo.ManaCostSide.ALL)));
|
||||
//this.manaCost = new ManaCostsImpl<>(join(card.getManaCosts(CardInfo.ManaCostSide.ALL)));
|
||||
this.manaCostLeftStr = card.getManaCosts(CardInfo.ManaCostSide.LEFT);
|
||||
this.manaCostRightStr = card.getManaCosts(CardInfo.ManaCostSide.RIGHT);
|
||||
this.manaCostStr = card.getManaCosts(CardInfo.ManaCostSide.ALL);
|
||||
|
|
|
@ -30,7 +30,7 @@ public abstract class Designation implements MageObject {
|
|||
|
||||
private static final List<CardType> emptySet = new ArrayList<>();
|
||||
private static final ObjectColor emptyColor = new ObjectColor();
|
||||
private static final ManaCostsImpl emptyCost = new ManaCostsImpl();
|
||||
private static final ManaCostsImpl emptyCost = new ManaCostsImpl<>();
|
||||
|
||||
private String name;
|
||||
private final DesignationType designationType;
|
||||
|
|
|
@ -33,7 +33,7 @@ public class Emblem implements CommandObject {
|
|||
|
||||
private static List<CardType> emptySet = new ArrayList<>();
|
||||
private static ObjectColor emptyColor = new ObjectColor();
|
||||
private static ManaCosts emptyCost = new ManaCostsImpl();
|
||||
private static ManaCosts emptyCost = new ManaCostsImpl<>();
|
||||
|
||||
private String name = "";
|
||||
private UUID id;
|
||||
|
|
|
@ -36,7 +36,7 @@ public class Plane implements CommandObject {
|
|||
|
||||
private static List<CardType> emptySet = new ArrayList<>();
|
||||
private static ObjectColor emptyColor = new ObjectColor();
|
||||
private static ManaCosts emptyCost = new ManaCostsImpl();
|
||||
private static ManaCosts emptyCost = new ManaCostsImpl<>();
|
||||
|
||||
private Planes planeType = null;
|
||||
private UUID id;
|
||||
|
|
|
@ -11,10 +11,11 @@ import mage.abilities.effects.Effect;
|
|||
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
||||
import mage.abilities.effects.common.GainLifeEffect;
|
||||
import mage.constants.Zone;
|
||||
import static mage.filter.StaticFilters.FILTER_CONTROLLED_CREATURE_SHORT_TEXT;
|
||||
import mage.game.command.Emblem;
|
||||
import mage.target.common.TargetControlledCreaturePermanent;
|
||||
|
||||
import static mage.filter.StaticFilters.FILTER_CONTROLLED_CREATURE_SHORT_TEXT;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author spjspj
|
||||
|
@ -27,7 +28,7 @@ public final class ObNixilisOfTheBlackOathEmblem extends Emblem {
|
|||
DynamicValue xValue = SacrificeCostCreaturesPower.instance;
|
||||
Effect effect = new GainLifeEffect(xValue);
|
||||
effect.setText("You gain X life");
|
||||
Ability ability = new SimpleActivatedAbility(Zone.COMMAND, effect, new ManaCostsImpl("{1}{B}"));
|
||||
Ability ability = new SimpleActivatedAbility(Zone.COMMAND, effect, new ManaCostsImpl<>("{1}{B}"));
|
||||
ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent(FILTER_CONTROLLED_CREATURE_SHORT_TEXT)));
|
||||
effect = new DrawCardSourceControllerEffect(xValue);
|
||||
effect.setText("and draw X cards, where X is the sacrificed creature's power");
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
|
||||
|
||||
package mage.game.permanent.token;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
|
@ -10,6 +9,8 @@ import mage.abilities.costs.common.SacrificeSourceCost;
|
|||
import mage.abilities.costs.common.TapSourceCost;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.effects.common.ReturnFromGraveyardToBattlefieldTargetEffect;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.common.FilterCreatureCard;
|
||||
import mage.filter.predicate.mageobject.NamePredicate;
|
||||
|
@ -41,7 +42,7 @@ public final class DeathpactAngelToken extends TokenImpl {
|
|||
power = new MageInt(1);
|
||||
toughness = new MageInt(1);
|
||||
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ReturnFromGraveyardToBattlefieldTargetEffect(), new ManaCostsImpl("{3}{W}{B}{B}"));
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ReturnFromGraveyardToBattlefieldTargetEffect(), new ManaCostsImpl<>("{3}{W}{B}{B}"));
|
||||
ability.addCost(new TapSourceCost());
|
||||
ability.addCost(new SacrificeSourceCost());
|
||||
ability.addTarget(new TargetCardInYourGraveyard(filter));
|
||||
|
|
|
@ -26,7 +26,7 @@ public final class DragonEggDragonToken extends TokenImpl {
|
|||
toughness = new MageInt(2);
|
||||
|
||||
this.addAbility(FlyingAbility.getInstance());
|
||||
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostSourceEffect(1, 0, Duration.EndOfTurn), new ManaCostsImpl("{R}")));
|
||||
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostSourceEffect(1, 0, Duration.EndOfTurn), new ManaCostsImpl<>("{R}")));
|
||||
|
||||
availableImageSetCodes = Arrays.asList("C18", "EMA", "M14", "M15", "M19", "CMR", "IMA", "GN2");
|
||||
}
|
||||
|
|
|
@ -1,14 +1,15 @@
|
|||
|
||||
|
||||
package mage.game.permanent.token;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.costs.common.TapSourceCost;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.effects.common.TapTargetEffect;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
||||
|
@ -27,7 +28,7 @@ public final class GoldmeadowHarrierToken extends TokenImpl {
|
|||
power = new MageInt(1);
|
||||
toughness = new MageInt(1);
|
||||
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new TapTargetEffect(), new ManaCostsImpl("{W}"));
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new TapTargetEffect(), new ManaCostsImpl<>("{W}"));
|
||||
ability.addCost(new TapSourceCost());
|
||||
ability.addTarget(new TargetCreaturePermanent());
|
||||
this.addAbility(ability);
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
|
||||
|
||||
package mage.game.permanent.token;
|
||||
import mage.constants.CardType;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.costs.common.SacrificeSourceCost;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.effects.common.DamageTargetEffect;
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.common.FilterAttackingCreature;
|
||||
import mage.filter.predicate.Predicates;
|
||||
|
@ -31,7 +32,7 @@ public final class LandMineToken extends TokenImpl {
|
|||
this.setOriginalExpansionSetCode("M15");
|
||||
cardType.add(CardType.ARTIFACT);
|
||||
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DamageTargetEffect(2), new ManaCostsImpl("{R}"));
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DamageTargetEffect(2), new ManaCostsImpl<>("{R}"));
|
||||
ability.addCost(new SacrificeSourceCost());
|
||||
ability.addTarget(new TargetCreaturePermanent(filter));
|
||||
this.addAbility(ability);
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
|
||||
|
||||
package mage.game.permanent.token;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.effects.common.ReturnFromGraveyardToBattlefieldTargetEffect;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.SuperType;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.common.FilterCreatureCard;
|
||||
|
@ -29,7 +30,7 @@ public final class NighteyesTheDesecratorToken extends TokenImpl {
|
|||
power = new MageInt(4);
|
||||
toughness = new MageInt(2);
|
||||
// {4}{B}: Put target creature card from a graveyard onto the battlefield under your control.
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ReturnFromGraveyardToBattlefieldTargetEffect(), new ManaCostsImpl("{4}{B}"));
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ReturnFromGraveyardToBattlefieldTargetEffect(), new ManaCostsImpl<>("{4}{B}"));
|
||||
ability.addTarget(new TargetCardInGraveyard(new FilterCreatureCard("creature card from a graveyard")));
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ public final class SengirNosferatuBatToken extends TokenImpl {
|
|||
// {1}{B}, Sacrifice this creature: Return an exiled card named Sengir Nosferatu to the battlefield under its owner’s control.
|
||||
ReturnSengirNosferatuEffect effect = new ReturnSengirNosferatuEffect();
|
||||
effect.setText("Return an exiled card named Sengir Nosferatu to the battlefield under its owner's control.");
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl("{1}{B}"));
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl<>("{1}{B}"));
|
||||
ability.addCost(new SacrificeSourceCost());
|
||||
this.addAbility(ability);
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
|
||||
package mage.game.permanent.token;
|
||||
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.keyword.CumulativeUpkeepAbility;
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -22,7 +22,7 @@ public final class SplinterToken extends TokenImpl {
|
|||
power = new MageInt(1);
|
||||
toughness = new MageInt(1);
|
||||
this.addAbility(FlyingAbility.getInstance());
|
||||
this.addAbility(new CumulativeUpkeepAbility(new ManaCostsImpl("{G}")));
|
||||
this.addAbility(new CumulativeUpkeepAbility(new ManaCostsImpl<>("{G}")));
|
||||
}
|
||||
|
||||
public SplinterToken(final SplinterToken token) {
|
||||
|
|
|
@ -3297,7 +3297,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
for (Permanent permanent : game.getBattlefield().getActivePermanents(playerId, game)) { // Some permanents allow use of abilities from non controlling players. so check all permanents in range
|
||||
Boolean canUse = null;
|
||||
boolean canAdd = false;
|
||||
boolean useLater = false; // sources with mana costs or mana pool dependency
|
||||
boolean useLater = false; // sources with mana costs or mana pool dependency
|
||||
Abilities<ActivatedManaAbilityImpl> manaAbilities
|
||||
= permanent.getAbilities(game).getAvailableActivatedManaAbilities(Zone.BATTLEFIELD, playerId, game); // returns ability only if canActivate is true
|
||||
for (Iterator<ActivatedManaAbilityImpl> it = manaAbilities.iterator(); it.hasNext(); ) {
|
||||
|
@ -3606,7 +3606,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
if (alternateSourceCostsAbility instanceof AlternativeSourceCosts) {
|
||||
if (((AlternativeSourceCosts) alternateSourceCostsAbility).isAvailable(ability, game)) {
|
||||
if (alternateSourceCostsAbility.getCosts().canPay(ability, ability, playerId, game)) {
|
||||
ManaCostsImpl manaCosts = new ManaCostsImpl();
|
||||
ManaCostsImpl manaCosts = new ManaCostsImpl<>();
|
||||
for (Cost cost : alternateSourceCostsAbility.getCosts()) {
|
||||
// AlternativeCost2 replaced by real cost on activate, so getPlayable need to extract that costs here
|
||||
if (cost instanceof AlternativeCost) {
|
||||
|
@ -3655,7 +3655,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
if (alternateSourceCosts instanceof Ability) {
|
||||
if (alternateSourceCosts.isAvailable(ability, game)) {
|
||||
if (((Ability) alternateSourceCosts).getCosts().canPay(ability, ability, playerId, game)) {
|
||||
ManaCostsImpl manaCosts = new ManaCostsImpl();
|
||||
ManaCostsImpl manaCosts = new ManaCostsImpl<>();
|
||||
for (Cost cost : ((Ability) alternateSourceCosts).getCosts()) {
|
||||
// AlternativeCost2 replaced by real cost on activate, so getPlayable need to extract that costs here
|
||||
if (cost instanceof AlternativeCost) {
|
||||
|
|
Loading…
Reference in a new issue