Remove superfluous addManaCost method (#11288)

* no need to specify mana cost, just add cost

* handle all mana costs through addcost method only

* eliminate another constructor

* more constructor cleanup
This commit is contained in:
xenohedron 2023-10-09 15:25:19 -04:00 committed by GitHub
parent 4e2a5bd5a9
commit d7afa37893
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
53 changed files with 153 additions and 338 deletions

View file

@ -46,7 +46,7 @@ public final class ArwenMortalQueen extends CardImpl {
new GainAbilityTargetEffect(IndestructibleAbility.getInstance()), new GainAbilityTargetEffect(IndestructibleAbility.getInstance()),
new RemoveCountersSourceCost(CounterType.INDESTRUCTIBLE.createInstance()) new RemoveCountersSourceCost(CounterType.INDESTRUCTIBLE.createInstance())
); );
ability.addManaCost(new GenericManaCost(1)); ability.addCost(new GenericManaCost(1));
ability.addEffect(new AddCountersTargetEffect(CounterType.P1P1.createInstance()) ability.addEffect(new AddCountersTargetEffect(CounterType.P1P1.createInstance())
.setText("Put a +1/+1 counter")); .setText("Put a +1/+1 counter"));
ability.addEffect(new AddCountersTargetEffect(CounterType.LIFELINK.createInstance()) ability.addEffect(new AddCountersTargetEffect(CounterType.LIFELINK.createInstance())

View file

@ -42,7 +42,7 @@ public final class CateranBrute extends CardImpl {
// {2}, {T}: Search your library for a Mercenary permanent card with converted mana cost 2 or less and put it onto the battlefield. Then shuffle your library. // {2}, {T}: Search your library for a Mercenary permanent card with converted mana cost 2 or less and put it onto the battlefield. Then shuffle your library.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(filter)), new TapSourceCost()); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(filter)), new TapSourceCost());
ability.addManaCost(new GenericManaCost(2)); ability.addCost(new GenericManaCost(2));
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -46,7 +46,7 @@ public final class CateranEnforcer extends CardImpl {
// {4}, {T}: Search your library for a Mercenary permanent card with converted mana cost 4 or less and put it onto the battlefield. Then shuffle your library. // {4}, {T}: Search your library for a Mercenary permanent card with converted mana cost 4 or less and put it onto the battlefield. Then shuffle your library.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(filter)), new TapSourceCost()); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(filter)), new TapSourceCost());
ability.addManaCost(new GenericManaCost(4)); ability.addCost(new GenericManaCost(4));
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -41,7 +41,7 @@ public final class CateranKidnappers extends CardImpl {
// {3}, {T}: Search your library for a Mercenary permanent card with converted mana cost 3 or less and put it onto the battlefield. Then shuffle your library. // {3}, {T}: Search your library for a Mercenary permanent card with converted mana cost 3 or less and put it onto the battlefield. Then shuffle your library.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(filter)), new TapSourceCost()); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(filter)), new TapSourceCost());
ability.addManaCost(new GenericManaCost(3)); ability.addCost(new GenericManaCost(3));
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -49,7 +49,7 @@ public final class CateranOverlord extends CardImpl {
// {6}, {T}: Search your library for a Mercenary permanent card with converted mana cost 6 or less and put it onto the battlefield. Then shuffle your library. // {6}, {T}: Search your library for a Mercenary permanent card with converted mana cost 6 or less and put it onto the battlefield. Then shuffle your library.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(filter)), new TapSourceCost()); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(filter)), new TapSourceCost());
ability.addManaCost(new GenericManaCost(6)); ability.addCost(new GenericManaCost(6));
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -42,7 +42,7 @@ public final class CateranPersuader extends CardImpl {
// {1}, {T}: Search your library for a Mercenary permanent card with converted mana cost 1 or less and put it onto the battlefield. Then shuffle your library. // {1}, {T}: Search your library for a Mercenary permanent card with converted mana cost 1 or less and put it onto the battlefield. Then shuffle your library.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(filter)), new TapSourceCost()); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(filter)), new TapSourceCost());
ability.addManaCost(new GenericManaCost(1)); ability.addCost(new GenericManaCost(1));
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -1,5 +1,3 @@
package mage.cards.c; package mage.cards.c;
import java.util.UUID; import java.util.UUID;
@ -30,7 +28,7 @@ public final class CateranSlaver extends CardImpl {
static { static {
filter.add(SubType.MERCENARY.getPredicate()); filter.add(SubType.MERCENARY.getPredicate());
filter.add(new ManaValuePredicate(ComparisonType.FEWER_THAN, 6)); filter.add(new ManaValuePredicate(ComparisonType.FEWER_THAN, 6));
} }
public CateranSlaver(UUID ownerId, CardSetInfo setInfo) { public CateranSlaver(UUID ownerId, CardSetInfo setInfo) {
@ -46,7 +44,7 @@ public final class CateranSlaver extends CardImpl {
// {5}, {T}: Search your library for a Mercenary permanent card with converted mana cost 5 or less and put it onto the battlefield. Then shuffle your library. // {5}, {T}: Search your library for a Mercenary permanent card with converted mana cost 5 or less and put it onto the battlefield. Then shuffle your library.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(filter)), new TapSourceCost()); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(filter)), new TapSourceCost());
ability.addManaCost(new GenericManaCost(5)); ability.addCost(new GenericManaCost(5));
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -1,5 +1,3 @@
package mage.cards.c; package mage.cards.c;
import java.util.UUID; import java.util.UUID;
@ -22,7 +20,7 @@ public final class CrystalBall extends CardImpl {
public CrystalBall(UUID ownerId, CardSetInfo setInfo) { public CrystalBall(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{3}"); super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{3}");
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ScryEffect(2), new TapSourceCost()); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ScryEffect(2), new TapSourceCost());
ability.addManaCost(new GenericManaCost(1)); ability.addCost(new GenericManaCost(1));
this.addAbility(ability); this.addAbility(ability);
} }
@ -36,4 +34,3 @@ public final class CrystalBall extends CardImpl {
} }
} }

View file

@ -1,22 +1,20 @@
package mage.cards.d; package mage.cards.d;
import mage.MageObject; import mage.abilities.Ability;
import mage.abilities.ActivatedAbilityImpl; import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.SacrificeSourceCost; import mage.abilities.costs.common.SacrificeSourceCost;
import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect; import mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect;
import mage.abilities.mana.ColorlessManaAbility; import mage.abilities.mana.ColorlessManaAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.*; import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.filter.FilterCard; import mage.filter.FilterCard;
import mage.filter.predicate.Predicate;
import mage.filter.predicate.Predicates; import mage.filter.predicate.Predicates;
import mage.target.common.TargetCardInLibrary; import mage.target.common.TargetCardInLibrary;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID; import java.util.UUID;
/** /**
@ -25,6 +23,16 @@ import java.util.UUID;
*/ */
public final class DroidFactory extends CardImpl { public final class DroidFactory extends CardImpl {
private static final FilterCard filter = new FilterCard("basic Plains, Island or Swamp card");
static {
filter.add(SuperType.BASIC.getPredicate());
filter.add(Predicates.or(
SubType.PLAINS.getPredicate(),
SubType.ISLAND.getPredicate(),
SubType.SWAMP.getPredicate()
));
}
public DroidFactory(UUID ownerId, CardSetInfo setInfo) { public DroidFactory(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.LAND},""); super(ownerId,setInfo,new CardType[]{CardType.LAND},"");
@ -32,7 +40,9 @@ public final class DroidFactory extends CardImpl {
this.addAbility(new ColorlessManaAbility()); this.addAbility(new ColorlessManaAbility());
// {T}, Sacrifice Droid Factor: Search your library for a basic Plains, Island or Swamp card and put it onto the battlefield tapped. Then shuffle your library. // {T}, Sacrifice Droid Factor: Search your library for a basic Plains, Island or Swamp card and put it onto the battlefield tapped. Then shuffle your library.
this.addAbility(new DroidFactoryAbility()); Ability ability = new SimpleActivatedAbility(new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(filter), true), new TapSourceCost());
ability.addCost(new SacrificeSourceCost());
this.addAbility(ability);
} }
@ -45,31 +55,4 @@ public final class DroidFactory extends CardImpl {
return new DroidFactory(this); return new DroidFactory(this);
} }
public final class DroidFactoryAbility extends ActivatedAbilityImpl {
private DroidFactoryAbility(final DroidFactoryAbility ability) {
super(ability);
}
public DroidFactoryAbility() {
super(Zone.BATTLEFIELD, null);
addCost(new TapSourceCost());
addCost(new SacrificeSourceCost());
FilterCard filter = new FilterCard("basic Plains, Island or Swamp");
filter.add(CardType.LAND.getPredicate());
List<Predicate<MageObject>> subtypePredicates = new ArrayList<>();
subtypePredicates.add(SubType.SWAMP.getPredicate());
subtypePredicates.add(SubType.PLAINS.getPredicate());
subtypePredicates.add(SubType.ISLAND.getPredicate());
filter.add(Predicates.or(subtypePredicates));
filter.add(SuperType.BASIC.getPredicate());
TargetCardInLibrary target = new TargetCardInLibrary(filter);
addEffect(new SearchLibraryPutInPlayEffect(target, true));
}
@Override
public DroidFactoryAbility copy() {
return new DroidFactoryAbility(this);
}
}
} }

View file

@ -1,5 +1,3 @@
package mage.cards.e; package mage.cards.e;
import java.util.UUID; import java.util.UUID;
@ -27,7 +25,7 @@ public final class ElixirOfImmortality extends CardImpl {
public ElixirOfImmortality(UUID ownerId, CardSetInfo setInfo) { public ElixirOfImmortality(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{1}"); super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{1}");
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ElixerOfImmortalityEffect(), new TapSourceCost()); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ElixerOfImmortalityEffect(), new TapSourceCost());
ability.addManaCost(new GenericManaCost(2)); ability.addCost(new GenericManaCost(2));
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -42,7 +42,7 @@ public final class FirecatBlitz extends CardImpl {
// Flashback-{R}{R}, Sacrifice X Mountains. // Flashback-{R}{R}, Sacrifice X Mountains.
Ability ability = new FlashbackAbility(this, new SacrificeXTargetCost(filter)); Ability ability = new FlashbackAbility(this, new SacrificeXTargetCost(filter));
ability.addManaCost(new ManaCostsImpl<>("{R}{R}")); ability.addCost(new ManaCostsImpl<>("{R}{R}"));
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -1,22 +1,20 @@
package mage.cards.j; package mage.cards.j;
import mage.MageObject; import mage.abilities.Ability;
import mage.abilities.ActivatedAbilityImpl; import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.SacrificeSourceCost; import mage.abilities.costs.common.SacrificeSourceCost;
import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect; import mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect;
import mage.abilities.mana.ColorlessManaAbility; import mage.abilities.mana.ColorlessManaAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.*; import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.filter.FilterCard; import mage.filter.FilterCard;
import mage.filter.predicate.Predicate;
import mage.filter.predicate.Predicates; import mage.filter.predicate.Predicates;
import mage.target.common.TargetCardInLibrary; import mage.target.common.TargetCardInLibrary;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID; import java.util.UUID;
/** /**
@ -25,6 +23,16 @@ import java.util.UUID;
*/ */
public final class JediEnclave extends CardImpl { public final class JediEnclave extends CardImpl {
private static final FilterCard filter = new FilterCard("basic Forest, Plains, or Island card");
static {
filter.add(SuperType.BASIC.getPredicate());
filter.add(Predicates.or(
SubType.FOREST.getPredicate(),
SubType.PLAINS.getPredicate(),
SubType.ISLAND.getPredicate()
));
}
public JediEnclave(UUID ownerId, CardSetInfo setInfo) { public JediEnclave(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.LAND},""); super(ownerId,setInfo,new CardType[]{CardType.LAND},"");
@ -32,7 +40,9 @@ public final class JediEnclave extends CardImpl {
this.addAbility(new ColorlessManaAbility()); this.addAbility(new ColorlessManaAbility());
// {T}, Sacrifice Jedi Enclave: Search your library for a basic Forest, Plains or Island card and put it onto the battlefield tapped. Then shuffle your library. // {T}, Sacrifice Jedi Enclave: Search your library for a basic Forest, Plains or Island card and put it onto the battlefield tapped. Then shuffle your library.
this.addAbility(new JediEnclaveAbility()); Ability ability = new SimpleActivatedAbility(new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(filter), true), new TapSourceCost());
ability.addCost(new SacrificeSourceCost());
this.addAbility(ability);
} }
@ -45,31 +55,4 @@ public final class JediEnclave extends CardImpl {
return new JediEnclave(this); return new JediEnclave(this);
} }
public static class JediEnclaveAbility extends ActivatedAbilityImpl {
private JediEnclaveAbility(final JediEnclaveAbility ability) {
super(ability);
}
public JediEnclaveAbility() {
super(Zone.BATTLEFIELD, null);
addCost(new TapSourceCost());
addCost(new SacrificeSourceCost());
FilterCard filter = new FilterCard("basic Forest, Plains or Island");
filter.add(CardType.LAND.getPredicate());
List<Predicate<MageObject>> subtypePredicates = new ArrayList<>();
subtypePredicates.add(SubType.FOREST.getPredicate());
subtypePredicates.add(SubType.PLAINS.getPredicate());
subtypePredicates.add(SubType.ISLAND.getPredicate());
filter.add(Predicates.or(subtypePredicates));
filter.add(SuperType.BASIC.getPredicate());
TargetCardInLibrary target = new TargetCardInLibrary(filter);
addEffect(new SearchLibraryPutInPlayEffect(target, true));
}
@Override
public JediEnclaveAbility copy() {
return new JediEnclaveAbility(this);
}
}
} }

View file

@ -1,22 +1,20 @@
package mage.cards.j; package mage.cards.j;
import mage.MageObject; import mage.abilities.Ability;
import mage.abilities.ActivatedAbilityImpl; import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.SacrificeSourceCost; import mage.abilities.costs.common.SacrificeSourceCost;
import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect; import mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect;
import mage.abilities.mana.ColorlessManaAbility; import mage.abilities.mana.ColorlessManaAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.*; import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.filter.FilterCard; import mage.filter.FilterCard;
import mage.filter.predicate.Predicate;
import mage.filter.predicate.Predicates; import mage.filter.predicate.Predicates;
import mage.target.common.TargetCardInLibrary; import mage.target.common.TargetCardInLibrary;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID; import java.util.UUID;
/** /**
@ -25,6 +23,16 @@ import java.util.UUID;
*/ */
public final class JungleVillage extends CardImpl { public final class JungleVillage extends CardImpl {
private static final FilterCard filter = new FilterCard("basic Mountain, Forest, or Plains card");
static {
filter.add(SuperType.BASIC.getPredicate());
filter.add(Predicates.or(
SubType.MOUNTAIN.getPredicate(),
SubType.FOREST.getPredicate(),
SubType.PLAINS.getPredicate()
));
}
public JungleVillage(UUID ownerId, CardSetInfo setInfo) { public JungleVillage(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.LAND},""); super(ownerId,setInfo,new CardType[]{CardType.LAND},"");
@ -32,7 +40,9 @@ public final class JungleVillage extends CardImpl {
this.addAbility(new ColorlessManaAbility()); this.addAbility(new ColorlessManaAbility());
// {T}, Sacrifice Jungle Village: Search your library for a basic Mountain, Forest or Plains card and put it onto the battlefield tapped. Then shuffle your library. // {T}, Sacrifice Jungle Village: Search your library for a basic Mountain, Forest or Plains card and put it onto the battlefield tapped. Then shuffle your library.
this.addAbility(new JungleVillageAbility()); Ability ability = new SimpleActivatedAbility(new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(filter), true), new TapSourceCost());
ability.addCost(new SacrificeSourceCost());
this.addAbility(ability);
} }
@ -45,31 +55,4 @@ public final class JungleVillage extends CardImpl {
return new JungleVillage(this); return new JungleVillage(this);
} }
public final class JungleVillageAbility extends ActivatedAbilityImpl {
private JungleVillageAbility(final JungleVillageAbility ability) {
super(ability);
}
public JungleVillageAbility() {
super(Zone.BATTLEFIELD, null);
addCost(new TapSourceCost());
addCost(new SacrificeSourceCost());
FilterCard filter = new FilterCard("basic Mountain, Forest or Plains");
filter.add(CardType.LAND.getPredicate());
List<Predicate<MageObject>> subtypePredicates = new ArrayList<>();
subtypePredicates.add(SubType.PLAINS.getPredicate());
subtypePredicates.add(SubType.MOUNTAIN.getPredicate());
subtypePredicates.add(SubType.FOREST.getPredicate());
filter.add(Predicates.or(subtypePredicates));
filter.add(SuperType.BASIC.getPredicate());
TargetCardInLibrary target = new TargetCardInLibrary(filter);
addEffect(new SearchLibraryPutInPlayEffect(target, true));
}
@Override
public JungleVillageAbility copy() {
return new JungleVillageAbility(this);
}
}
} }

View file

@ -32,7 +32,7 @@ public final class KnotvineMystic extends CardImpl {
// {1}, {T}: Add {R}{G}{W}. // {1}, {T}: Add {R}{G}{W}.
Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 0, 0, 1, 1, 0, 0, 0), new TapSourceCost()); Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new Mana(1, 0, 0, 1, 1, 0, 0, 0), new TapSourceCost());
ability.addManaCost(new GenericManaCost(1)); ability.addCost(new GenericManaCost(1));
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -38,7 +38,7 @@ public final class Moggcatcher extends CardImpl {
// {3}, {T}: Search your library for a Goblin permanent card and put it onto the battlefield. Then shuffle your library. // {3}, {T}: Search your library for a Goblin permanent card and put it onto the battlefield. Then shuffle your library.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(filter)), new TapSourceCost()); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(filter)), new TapSourceCost());
ability.addManaCost(new GenericManaCost(3)); ability.addCost(new GenericManaCost(3));
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -1,5 +1,3 @@
package mage.cards.r; package mage.cards.r;
import java.util.UUID; import java.util.UUID;
@ -30,7 +28,7 @@ public final class RamosianCaptain extends CardImpl {
static { static {
filter.add(SubType.REBEL.getPredicate()); filter.add(SubType.REBEL.getPredicate());
filter.add(new ManaValuePredicate(ComparisonType.FEWER_THAN, 5)); filter.add(new ManaValuePredicate(ComparisonType.FEWER_THAN, 5));
} }
public RamosianCaptain(UUID ownerId, CardSetInfo setInfo) { public RamosianCaptain(UUID ownerId, CardSetInfo setInfo) {
@ -46,7 +44,7 @@ public final class RamosianCaptain extends CardImpl {
// {5}, {T}: Search your library for a Rebel permanent card with converted mana cost 4 or less and put it onto the battlefield. Then shuffle your library. // {5}, {T}: Search your library for a Rebel permanent card with converted mana cost 4 or less and put it onto the battlefield. Then shuffle your library.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(filter)), new TapSourceCost()); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(filter)), new TapSourceCost());
ability.addManaCost(new GenericManaCost(5)); ability.addCost(new GenericManaCost(5));
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -1,5 +1,3 @@
package mage.cards.r; package mage.cards.r;
import java.util.UUID; import java.util.UUID;
@ -29,7 +27,7 @@ public final class RamosianCommander extends CardImpl {
static { static {
filter.add(SubType.REBEL.getPredicate()); filter.add(SubType.REBEL.getPredicate());
filter.add(new ManaValuePredicate(ComparisonType.FEWER_THAN, 6)); filter.add(new ManaValuePredicate(ComparisonType.FEWER_THAN, 6));
} }
public RamosianCommander(UUID ownerId, CardSetInfo setInfo) { public RamosianCommander(UUID ownerId, CardSetInfo setInfo) {
@ -42,7 +40,7 @@ public final class RamosianCommander extends CardImpl {
// {6}, {T}: Search your library for a Rebel permanent card with converted mana cost 5 or less and put it onto the battlefield. Then shuffle your library. // {6}, {T}: Search your library for a Rebel permanent card with converted mana cost 5 or less and put it onto the battlefield. Then shuffle your library.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(filter)), new TapSourceCost()); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(filter)), new TapSourceCost());
ability.addManaCost(new GenericManaCost(6)); ability.addCost(new GenericManaCost(6));
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -1,5 +1,3 @@
package mage.cards.r; package mage.cards.r;
import java.util.UUID; import java.util.UUID;
@ -29,7 +27,7 @@ public final class RamosianLieutenant extends CardImpl {
static { static {
filter.add(SubType.REBEL.getPredicate()); filter.add(SubType.REBEL.getPredicate());
filter.add(new ManaValuePredicate(ComparisonType.FEWER_THAN, 4)); filter.add(new ManaValuePredicate(ComparisonType.FEWER_THAN, 4));
} }
public RamosianLieutenant(UUID ownerId, CardSetInfo setInfo) { public RamosianLieutenant(UUID ownerId, CardSetInfo setInfo) {
@ -42,7 +40,7 @@ public final class RamosianLieutenant extends CardImpl {
// {4}, {T}: Search your library for a Rebel permanent card with converted mana cost 3 or less and put it onto the battlefield. Then shuffle your library. // {4}, {T}: Search your library for a Rebel permanent card with converted mana cost 3 or less and put it onto the battlefield. Then shuffle your library.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(filter)), new TapSourceCost()); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(filter)), new TapSourceCost());
ability.addManaCost(new GenericManaCost(4)); ability.addCost(new GenericManaCost(4));
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -1,5 +1,3 @@
package mage.cards.r; package mage.cards.r;
import java.util.UUID; import java.util.UUID;
@ -41,7 +39,7 @@ public final class RamosianSergeant extends CardImpl {
// {3}, {T}: Search your library for a Rebel permanent card with converted mana cost 2 or less and put it onto the battlefield. Then shuffle your library. // {3}, {T}: Search your library for a Rebel permanent card with converted mana cost 2 or less and put it onto the battlefield. Then shuffle your library.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(filter)), new TapSourceCost()); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(filter)), new TapSourceCost());
ability.addManaCost(new GenericManaCost(3)); ability.addCost(new GenericManaCost(3));
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -45,7 +45,7 @@ public final class RamosianSkyMarshal extends CardImpl {
// {7}, {T}: Search your library for a Rebel permanent card with converted mana cost 6 or less and put it onto the battlefield. Then shuffle your library. // {7}, {T}: Search your library for a Rebel permanent card with converted mana cost 6 or less and put it onto the battlefield. Then shuffle your library.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(filter)), new TapSourceCost()); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(filter)), new TapSourceCost());
ability.addManaCost(new GenericManaCost(7)); ability.addCost(new GenericManaCost(7));
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -60,7 +60,7 @@ public final class RathiAssassin extends CardImpl {
// {3}, {T}: Search your library for a Mercenary permanent card with converted mana cost 3 or less and put it onto the battlefield. Then shuffle your library. // {3}, {T}: Search your library for a Mercenary permanent card with converted mana cost 3 or less and put it onto the battlefield. Then shuffle your library.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(filter)), new TapSourceCost()); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(filter)), new TapSourceCost());
ability.addManaCost(new GenericManaCost(3)); ability.addCost(new GenericManaCost(3));
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -46,7 +46,7 @@ public final class RathiFiend extends CardImpl {
this.addAbility(new EntersBattlefieldTriggeredAbility(new LoseLifeAllPlayersEffect(3), false)); this.addAbility(new EntersBattlefieldTriggeredAbility(new LoseLifeAllPlayersEffect(3), false));
// {3}, {T}: Search your library for a Mercenary permanent card with converted mana cost 3 or less and put it onto the battlefield. Then shuffle your library. // {3}, {T}: Search your library for a Mercenary permanent card with converted mana cost 3 or less and put it onto the battlefield. Then shuffle your library.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(filter)), new TapSourceCost()); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(filter)), new TapSourceCost());
ability.addManaCost(new GenericManaCost(3)); ability.addCost(new GenericManaCost(3));
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -44,7 +44,7 @@ public final class RathiIntimidator extends CardImpl {
this.addAbility(FearAbility.getInstance()); this.addAbility(FearAbility.getInstance());
// {2}, {T}: Search your library for a Mercenary permanent card with converted mana cost 2 or less and put it onto the battlefield. Then shuffle your library. // {2}, {T}: Search your library for a Mercenary permanent card with converted mana cost 2 or less and put it onto the battlefield. Then shuffle your library.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(filter)), new TapSourceCost()); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(filter)), new TapSourceCost());
ability.addManaCost(new GenericManaCost(2)); ability.addCost(new GenericManaCost(2));
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -38,7 +38,7 @@ public final class Seahunter extends CardImpl {
// {3}, {T}: Search your library for a Merfolk permanent card and put it onto the battlefield. Then shuffle your library. // {3}, {T}: Search your library for a Merfolk permanent card and put it onto the battlefield. Then shuffle your library.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(filter)), new TapSourceCost()); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(filter)), new TapSourceCost());
ability.addManaCost(new GenericManaCost(3)); ability.addCost(new GenericManaCost(3));
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -1,22 +1,20 @@
package mage.cards.s; package mage.cards.s;
import mage.MageObject; import mage.abilities.Ability;
import mage.abilities.ActivatedAbilityImpl; import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.SacrificeSourceCost; import mage.abilities.costs.common.SacrificeSourceCost;
import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect; import mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect;
import mage.abilities.mana.ColorlessManaAbility; import mage.abilities.mana.ColorlessManaAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.*; import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.filter.FilterCard; import mage.filter.FilterCard;
import mage.filter.predicate.Predicate;
import mage.filter.predicate.Predicates; import mage.filter.predicate.Predicates;
import mage.target.common.TargetCardInLibrary; import mage.target.common.TargetCardInLibrary;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID; import java.util.UUID;
/** /**
@ -25,6 +23,16 @@ import java.util.UUID;
*/ */
public final class SithRuins extends CardImpl { public final class SithRuins extends CardImpl {
private static final FilterCard filter = new FilterCard("basic Island, Swamp, or Mountain card");
static {
filter.add(SuperType.BASIC.getPredicate());
filter.add(Predicates.or(
SubType.ISLAND.getPredicate(),
SubType.SWAMP.getPredicate(),
SubType.MOUNTAIN.getPredicate()
));
}
public SithRuins(UUID ownerId, CardSetInfo setInfo) { public SithRuins(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.LAND},""); super(ownerId,setInfo,new CardType[]{CardType.LAND},"");
@ -32,7 +40,9 @@ public final class SithRuins extends CardImpl {
this.addAbility(new ColorlessManaAbility()); this.addAbility(new ColorlessManaAbility());
// {T}, Sacrifice Sith Ruins: Search your library for a basic Island, Swamp or Mountain card and put it onto the battlefield tapped. Then shuffle your library. // {T}, Sacrifice Sith Ruins: Search your library for a basic Island, Swamp or Mountain card and put it onto the battlefield tapped. Then shuffle your library.
this.addAbility(new SithRuinsAbility()); Ability ability = new SimpleActivatedAbility(new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(filter), true), new TapSourceCost());
ability.addCost(new SacrificeSourceCost());
this.addAbility(ability);
} }
@ -45,31 +55,4 @@ public final class SithRuins extends CardImpl {
return new SithRuins(this); return new SithRuins(this);
} }
public static class SithRuinsAbility extends ActivatedAbilityImpl {
private SithRuinsAbility(final SithRuinsAbility ability) {
super(ability);
}
public SithRuinsAbility() {
super(Zone.BATTLEFIELD, null);
addCost(new TapSourceCost());
addCost(new SacrificeSourceCost());
FilterCard filter = new FilterCard("basic Island, Swamp or Mountain");
filter.add(CardType.LAND.getPredicate());
List<Predicate<MageObject>> subtypePredicates = new ArrayList<>();
subtypePredicates.add(SubType.SWAMP.getPredicate());
subtypePredicates.add(SubType.MOUNTAIN.getPredicate());
subtypePredicates.add(SubType.ISLAND.getPredicate());
filter.add(Predicates.or(subtypePredicates));
filter.add(SuperType.BASIC.getPredicate());
TargetCardInLibrary target = new TargetCardInLibrary(filter);
addEffect(new SearchLibraryPutInPlayEffect(target, true));
}
@Override
public SithRuinsAbility copy() {
return new SithRuinsAbility(this);
}
}
} }

View file

@ -31,7 +31,7 @@ public final class SoldierOfFortune extends CardImpl {
// {R}, {T}: Target player shuffles their library. // {R}, {T}: Target player shuffles their library.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ShuffleLibraryTargetEffect(), new TapSourceCost()); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ShuffleLibraryTargetEffect(), new TapSourceCost());
ability.addManaCost(new ManaCostsImpl<>("{R}")); ability.addCost(new ManaCostsImpl<>("{R}"));
ability.addTarget(new TargetPlayer()); ability.addTarget(new TargetPlayer());
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -30,7 +30,7 @@ public final class SorcerersStrongbox extends CardImpl {
effect.setText("and draw three cards"); effect.setText("and draw three cards");
flipCoinEffect.addEffectWon(effect); flipCoinEffect.addEffectWon(effect);
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, flipCoinEffect, new TapSourceCost()); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, flipCoinEffect, new TapSourceCost());
ability.addManaCost(new GenericManaCost(2)); ability.addCost(new GenericManaCost(2));
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -32,7 +32,7 @@ public final class TrigonOfCorruption extends CardImpl {
// {B}{B}, {T}: Put a charge counter on Trigon of Corruption. // {B}{B}, {T}: Put a charge counter on Trigon of Corruption.
Ability ability2 = new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.CHARGE.createInstance()), new TapSourceCost()); Ability ability2 = new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.CHARGE.createInstance()), new TapSourceCost());
ability2.addManaCost(new ManaCostsImpl<>("{B}{B}")); ability2.addCost(new ManaCostsImpl<>("{B}{B}"));
this.addAbility(ability2); this.addAbility(ability2);
// {2}, {T}, Remove a charge counter from Trigon of Corruption: Put a -1/-1 counter on target creature. // {2}, {T}, Remove a charge counter from Trigon of Corruption: Put a -1/-1 counter on target creature.

View file

@ -30,7 +30,7 @@ public final class TrigonOfInfestation extends CardImpl {
// {G}{G}, {T}: Put a charge counter on Trigon of Infestation. // {G}{G}, {T}: Put a charge counter on Trigon of Infestation.
Ability ability2 = new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.CHARGE.createInstance()), new TapSourceCost()); Ability ability2 = new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.CHARGE.createInstance()), new TapSourceCost());
ability2.addManaCost(new ManaCostsImpl<>("{G}{G}")); ability2.addCost(new ManaCostsImpl<>("{G}{G}"));
this.addAbility(ability2); this.addAbility(ability2);
// {2}, {T}, Remove a charge counter from Trigon of Infestation: Create a 1/1 green Phyrexian Insect creature token with infect. // {2}, {T}, Remove a charge counter from Trigon of Infestation: Create a 1/1 green Phyrexian Insect creature token with infect.

View file

@ -30,7 +30,7 @@ public final class TrigonOfMending extends CardImpl {
// {W}{W}, {T}: Put a charge counter on Trigon of Mending. // {W}{W}, {T}: Put a charge counter on Trigon of Mending.
Ability ability2 = new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.CHARGE.createInstance()), new TapSourceCost()); Ability ability2 = new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.CHARGE.createInstance()), new TapSourceCost());
ability2.addManaCost(new ManaCostsImpl<>("{W}{W}")); ability2.addCost(new ManaCostsImpl<>("{W}{W}"));
this.addAbility(ability2); this.addAbility(ability2);
// {2}, {T}, Remove a charge counter from Trigon of Mending: Target player gains 3 life. // {2}, {T}, Remove a charge counter from Trigon of Mending: Target player gains 3 life.

View file

@ -32,7 +32,7 @@ public final class TrigonOfRage extends CardImpl {
// {R}{R}, {T}: Put a charge counter on Trigon of Rage. // {R}{R}, {T}: Put a charge counter on Trigon of Rage.
Ability ability2 = new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.CHARGE.createInstance()), new TapSourceCost()); Ability ability2 = new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.CHARGE.createInstance()), new TapSourceCost());
ability2.addManaCost(new ManaCostsImpl<>("{R}{R}")); ability2.addCost(new ManaCostsImpl<>("{R}{R}"));
this.addAbility(ability2); this.addAbility(ability2);
// {2}, {T}, Remove a charge counter from Trigon of Rage: Target creature gets +3/+0 until end of turn. // {2}, {T}, Remove a charge counter from Trigon of Rage: Target creature gets +3/+0 until end of turn.

View file

@ -29,7 +29,7 @@ public final class TrigonOfThought extends CardImpl {
// {U}{U}, {T}: Put a charge counter on Trigon of Thought. // {U}{U}, {T}: Put a charge counter on Trigon of Thought.
Ability ability2 = new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.CHARGE.createInstance()), new TapSourceCost()); Ability ability2 = new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.CHARGE.createInstance()), new TapSourceCost());
ability2.addManaCost(new ManaCostsImpl<>("{U}{U}")); ability2.addCost(new ManaCostsImpl<>("{U}{U}"));
this.addAbility(ability2); this.addAbility(ability2);
// {2}, {T}, Remove a charge counter from Trigon of Thought: Draw a card. // {2}, {T}, Remove a charge counter from Trigon of Thought: Draw a card.

View file

@ -1,22 +1,20 @@
package mage.cards.u; package mage.cards.u;
import mage.MageObject; import mage.abilities.Ability;
import mage.abilities.ActivatedAbilityImpl; import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.SacrificeSourceCost; import mage.abilities.costs.common.SacrificeSourceCost;
import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect; import mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect;
import mage.abilities.mana.ColorlessManaAbility; import mage.abilities.mana.ColorlessManaAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.*; import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.filter.FilterCard; import mage.filter.FilterCard;
import mage.filter.predicate.Predicate;
import mage.filter.predicate.Predicates; import mage.filter.predicate.Predicates;
import mage.target.common.TargetCardInLibrary; import mage.target.common.TargetCardInLibrary;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID; import java.util.UUID;
/** /**
@ -25,6 +23,16 @@ import java.util.UUID;
*/ */
public final class UnderworldSlums extends CardImpl { public final class UnderworldSlums extends CardImpl {
private static final FilterCard filter = new FilterCard("basic Swamp, Mountain, or Forest card");
static {
filter.add(SuperType.BASIC.getPredicate());
filter.add(Predicates.or(
SubType.SWAMP.getPredicate(),
SubType.MOUNTAIN.getPredicate(),
SubType.FOREST.getPredicate()
));
}
public UnderworldSlums(UUID ownerId, CardSetInfo setInfo) { public UnderworldSlums(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.LAND},""); super(ownerId,setInfo,new CardType[]{CardType.LAND},"");
@ -32,7 +40,9 @@ public final class UnderworldSlums extends CardImpl {
this.addAbility(new ColorlessManaAbility()); this.addAbility(new ColorlessManaAbility());
// {T}, Sacrifice Underworld Slums: Search your library for a basic Swamp, Mountain or Forest card and put it onto the battlefield tapped. Then shuffle your library. // {T}, Sacrifice Underworld Slums: Search your library for a basic Swamp, Mountain or Forest card and put it onto the battlefield tapped. Then shuffle your library.
this.addAbility(new UnderworldSlumsAbility()); Ability ability = new SimpleActivatedAbility(new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(filter), true), new TapSourceCost());
ability.addCost(new SacrificeSourceCost());
this.addAbility(ability);
} }
@ -45,31 +55,4 @@ public final class UnderworldSlums extends CardImpl {
return new UnderworldSlums(this); return new UnderworldSlums(this);
} }
public static class UnderworldSlumsAbility extends ActivatedAbilityImpl {
private UnderworldSlumsAbility(final UnderworldSlumsAbility ability) {
super(ability);
}
public UnderworldSlumsAbility() {
super(Zone.BATTLEFIELD, null);
addCost(new TapSourceCost());
addCost(new SacrificeSourceCost());
FilterCard filter = new FilterCard("basic Swamp, Mountain or Forest");
filter.add(CardType.LAND.getPredicate());
List<Predicate<MageObject>> subtypePredicates = new ArrayList<>();
subtypePredicates.add(SubType.SWAMP.getPredicate());
subtypePredicates.add(SubType.MOUNTAIN.getPredicate());
subtypePredicates.add(SubType.FOREST.getPredicate());
filter.add(Predicates.or(subtypePredicates));
filter.add(SuperType.BASIC.getPredicate());
TargetCardInLibrary target = new TargetCardInLibrary(filter);
addEffect(new SearchLibraryPutInPlayEffect(target, true));
}
@Override
public UnderworldSlumsAbility copy() {
return new UnderworldSlumsAbility(this);
}
}
} }

View file

@ -1,5 +1,3 @@
package mage.cards.v; package mage.cards.v;
import java.util.UUID; import java.util.UUID;
@ -12,8 +10,7 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Zone; import mage.constants.Zone;
import mage.filter.FilterPermanent; import mage.target.common.TargetArtifactPermanent;
import mage.target.TargetPermanent;
/** /**
* *
@ -21,17 +18,11 @@ import mage.target.TargetPermanent;
*/ */
public final class VoltaicKey extends CardImpl { public final class VoltaicKey extends CardImpl {
private static final FilterPermanent filter = new FilterPermanent("artifact");
static {
filter.add(CardType.ARTIFACT.getPredicate());
}
public VoltaicKey(UUID ownerId, CardSetInfo setInfo) { public VoltaicKey(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{1}"); super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{1}");
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new UntapTargetEffect(), new TapSourceCost()); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new UntapTargetEffect(), new TapSourceCost());
ability.addManaCost(new GenericManaCost(1)); ability.addCost(new GenericManaCost(1));
ability.addTarget(new TargetPermanent(filter)); ability.addTarget(new TargetArtifactPermanent());
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -155,14 +155,6 @@ public interface Ability extends Controllable, Serializable {
*/ */
ManaCosts<ManaCost> getManaCostsToPay(); ManaCosts<ManaCost> getManaCostsToPay();
/**
* Adds a {@link ManaCost} to this ability that must be paid before this
* ability is activated.
*
* @param cost The {@link ManaCost} to add.
*/
void addManaCost(ManaCost cost);
void addManaCostsToPay(ManaCost manaCost); void addManaCostsToPay(ManaCost manaCost);
/** /**

View file

@ -58,7 +58,7 @@ public abstract class AbilityImpl implements Ability {
protected UUID sourceId; protected UUID sourceId;
private final ManaCosts<ManaCost> manaCosts; private final ManaCosts<ManaCost> manaCosts;
private final ManaCosts<ManaCost> manaCostsToPay; private final ManaCosts<ManaCost> manaCostsToPay;
private Costs<Cost> costs; private final Costs<Cost> costs;
protected Modes modes; // access to it by GetModes only (it can be overridden by some abilities) protected Modes modes; // access to it by GetModes only (it can be overridden by some abilities)
protected Zone zone; protected Zone zone;
protected String name; protected String name;
@ -855,7 +855,6 @@ public abstract class AbilityImpl implements Ability {
if (cost == null) { if (cost == null) {
return; return;
} }
if (cost instanceof Costs) { if (cost instanceof Costs) {
// as list of costs // as list of costs
Costs<Cost> list = (Costs<Cost>) cost; Costs<Cost> list = (Costs<Cost>) cost;
@ -865,11 +864,9 @@ public abstract class AbilityImpl implements Ability {
} else { } else {
// as single cost // as single cost
if (cost instanceof ManaCost) { if (cost instanceof ManaCost) {
addManaCost((ManaCost) cost); manaCosts.add((ManaCost) cost);
manaCostsToPay.add((ManaCost) cost);
} else { } else {
if (costs == null) {
costs = new CostsImpl<>();
}
costs.add(cost); costs.add(cost);
} }
} }
@ -887,15 +884,6 @@ public abstract class AbilityImpl implements Ability {
} }
} }
@Override
public void addManaCost(ManaCost manaCost) {
if (manaCost == null) {
return;
}
manaCosts.add(manaCost);
manaCostsToPay.add(manaCost);
}
@Override @Override
public void addEffect(Effect effect) { public void addEffect(Effect effect) {
if (effect != null) { if (effect != null) {
@ -1141,10 +1129,10 @@ public abstract class AbilityImpl implements Ability {
if (object == null) { // e.g. sacrificed token if (object == null) { // e.g. sacrificed token
logger.warn("Could get no object: " + this); logger.warn("Could get no object: " + this);
} }
return new StringBuilder(" activates: ") return " activates: " +
.append(object != null ? this.formatRule(getModes().getText(), object.getLogName()) : getModes().getText()) (object != null ? this.formatRule(getModes().getText(), object.getLogName()) : getModes().getText()) +
.append(" from ") " from " +
.append(getMessageText(game)).toString(); getMessageText(game);
} }
protected String getMessageText(Game game) { protected String getMessageText(Game game) {

View file

@ -4,7 +4,6 @@ import mage.ApprovingObject;
import mage.MageObject; import mage.MageObject;
import mage.abilities.condition.Condition; import mage.abilities.condition.Condition;
import mage.abilities.costs.Cost; import mage.abilities.costs.Cost;
import mage.abilities.costs.mana.ManaCosts;
import mage.abilities.effects.Effect; import mage.abilities.effects.Effect;
import mage.abilities.mana.ManaOptions; import mage.abilities.mana.ManaOptions;
import mage.cards.Card; import mage.cards.Card;
@ -57,17 +56,6 @@ public abstract class ActivatedAbilityImpl extends AbilityImpl implements Activa
condition = ability.condition; condition = ability.condition;
} }
protected ActivatedAbilityImpl(Zone zone, Effect effect) {
super(AbilityType.ACTIVATED, zone);
this.addEffect(effect);
}
protected ActivatedAbilityImpl(Zone zone, Effect effect, ManaCosts cost) {
super(AbilityType.ACTIVATED, zone);
this.addEffect(effect);
this.addManaCost(cost);
}
protected ActivatedAbilityImpl(Zone zone, Effect effect, Cost cost) { protected ActivatedAbilityImpl(Zone zone, Effect effect, Cost cost) {
super(AbilityType.ACTIVATED, zone); super(AbilityType.ACTIVATED, zone);
this.addEffect(effect); this.addEffect(effect);

View file

@ -45,7 +45,7 @@ public class SpellAbility extends ActivatedAbilityImpl {
this.cardName = cardName; this.cardName = cardName;
this.spellAbilityType = spellAbilityType; this.spellAbilityType = spellAbilityType;
this.spellAbilityCastMode = spellAbilityCastMode; this.spellAbilityCastMode = spellAbilityCastMode;
this.addManaCost(cost); this.addCost(cost);
this.setIdentifier(MageIdentifier.Default); this.setIdentifier(MageIdentifier.Default);
setSpellName(); setSpellName();
} }

View file

@ -1,5 +1,3 @@
package mage.abilities.abilityword; package mage.abilities.abilityword;
import mage.abilities.ActivatedAbilityImpl; import mage.abilities.ActivatedAbilityImpl;
@ -18,11 +16,8 @@ import mage.target.common.TargetCardInHand;
public class GrandeurAbility extends ActivatedAbilityImpl { public class GrandeurAbility extends ActivatedAbilityImpl {
protected final String cardName;
public GrandeurAbility(Effect effect, String cardName) { public GrandeurAbility(Effect effect, String cardName) {
super(Zone.BATTLEFIELD, effect); super(Zone.BATTLEFIELD, effect, null);
this.cardName = cardName;
FilterCard filter = new FilterCard("another card named " + cardName); FilterCard filter = new FilterCard("another card named " + cardName);
filter.add(new NamePredicate(cardName)); filter.add(new NamePredicate(cardName));
@ -33,7 +28,6 @@ public class GrandeurAbility extends ActivatedAbilityImpl {
protected GrandeurAbility(final GrandeurAbility ability) { protected GrandeurAbility(final GrandeurAbility ability) {
super(ability); super(ability);
this.cardName = ability.cardName;
} }
@Override @Override

View file

@ -23,8 +23,7 @@ public class FetchLandActivatedAbility extends ActivatedAbilityImpl {
} }
public FetchLandActivatedAbility(boolean withDamage, SubType subType1, SubType subType2) { public FetchLandActivatedAbility(boolean withDamage, SubType subType1, SubType subType2) {
super(Zone.BATTLEFIELD, null); super(Zone.BATTLEFIELD, null, new TapSourceCost());
addCost(new TapSourceCost());
if (withDamage) { if (withDamage) {
addCost(new PayLifeCost(1)); addCost(new PayLifeCost(1));
} }

View file

@ -16,7 +16,7 @@ import java.util.UUID;
public class PassAbility extends ActivatedAbilityImpl { public class PassAbility extends ActivatedAbilityImpl {
public PassAbility() { public PassAbility() {
super(Zone.ALL, new PassEffect()); super(Zone.ALL, new PassEffect(), null);
this.usesStack = false; this.usesStack = false;
} }

View file

@ -3,7 +3,6 @@ package mage.abilities.common;
import mage.constants.Zone; import mage.constants.Zone;
import mage.abilities.ActivatedAbilityImpl; import mage.abilities.ActivatedAbilityImpl;
import mage.abilities.costs.Cost; import mage.abilities.costs.Cost;
import mage.abilities.costs.mana.ManaCosts;
import mage.abilities.effects.Effect; import mage.abilities.effects.Effect;
/** /**
@ -12,16 +11,8 @@ import mage.abilities.effects.Effect;
*/ */
public class SimpleActivatedAbility extends ActivatedAbilityImpl { public class SimpleActivatedAbility extends ActivatedAbilityImpl {
public SimpleActivatedAbility(Effect effect, ManaCosts cost) {
super(Zone.BATTLEFIELD, effect, cost);
}
public SimpleActivatedAbility(Effect effect, Cost cost) { public SimpleActivatedAbility(Effect effect, Cost cost) {
super(Zone.BATTLEFIELD, effect, cost); this(Zone.BATTLEFIELD, effect, cost);
}
public SimpleActivatedAbility(Zone zone, Effect effect, ManaCosts cost) {
super(zone, effect, cost);
} }
public SimpleActivatedAbility(Zone zone, Effect effect, Cost cost) { public SimpleActivatedAbility(Zone zone, Effect effect, Cost cost) {

View file

@ -32,7 +32,7 @@ public class SpellTransformedAbility extends SpellAbility {
this.manaCost = manaCost; this.manaCost = manaCost;
this.clearManaCosts(); this.clearManaCosts();
this.clearManaCostsToPay(); this.clearManaCostsToPay();
this.addManaCost(new ManaCostsImpl<>(manaCost)); this.addCost(new ManaCostsImpl<>(manaCost));
this.addSubAbility(new TransformAbility()); this.addSubAbility(new TransformAbility());
} }

View file

@ -1,11 +1,9 @@
package mage.abilities.common; package mage.abilities.common;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.SpecialAction; import mage.abilities.SpecialAction;
import mage.abilities.costs.Cost; import mage.abilities.costs.Cost;
import mage.abilities.costs.Costs; import mage.abilities.costs.Costs;
import mage.abilities.costs.mana.ManaCost;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.cards.Card; import mage.cards.Card;
import mage.constants.AbilityType; import mage.constants.AbilityType;
@ -28,14 +26,7 @@ public class TurnFaceUpAbility extends SpecialAction {
public TurnFaceUpAbility(Costs<Cost> costs, boolean megamorph) { public TurnFaceUpAbility(Costs<Cost> costs, boolean megamorph) {
super(Zone.BATTLEFIELD); super(Zone.BATTLEFIELD);
this.addEffect(new TurnFaceUpEffect(megamorph)); this.addEffect(new TurnFaceUpEffect(megamorph));
for (Cost cost : costs) { this.addCost(costs);
if (cost instanceof ManaCost) {
this.addManaCost((ManaCost) cost);
} else {
this.addCost(cost);
}
}
this.usesStack = false; this.usesStack = false;
this.abilityType = AbilityType.SPECIAL_ACTION; this.abilityType = AbilityType.SPECIAL_ACTION;
this.setRuleVisible(false); // will be made visible only to controller in CardView this.setRuleVisible(false); // will be made visible only to controller in CardView

View file

@ -3,7 +3,6 @@ package mage.abilities.decorator;
import mage.abilities.ActivatedAbilityImpl; import mage.abilities.ActivatedAbilityImpl;
import mage.abilities.condition.Condition; import mage.abilities.condition.Condition;
import mage.abilities.costs.Cost; import mage.abilities.costs.Cost;
import mage.abilities.costs.mana.ManaCosts;
import mage.abilities.effects.Effect; import mage.abilities.effects.Effect;
import mage.abilities.effects.Effects; import mage.abilities.effects.Effects;
import mage.constants.EffectType; import mage.constants.EffectType;
@ -29,15 +28,8 @@ public class ConditionalActivatedAbility extends ActivatedAbilityImpl {
this.condition = condition; this.condition = condition;
} }
public ConditionalActivatedAbility(Zone zone, Effect effect, ManaCosts cost, Condition condition, String rule) {
super(zone, effect, cost);
this.condition = condition;
this.ruleText = rule;
}
public ConditionalActivatedAbility(Zone zone, Effect effect, Cost cost, Condition condition, String rule) { public ConditionalActivatedAbility(Zone zone, Effect effect, Cost cost, Condition condition, String rule) {
super(zone, effect, cost); this(zone, effect, cost, condition);
this.condition = condition;
this.ruleText = rule; this.ruleText = rule;
} }
@ -70,10 +62,7 @@ public class ConditionalActivatedAbility extends ActivatedAbilityImpl {
sb.append("as a sorcery and only "); sb.append("as a sorcery and only ");
} }
String conditionText = condition.toString(); String conditionText = condition.toString();
if (conditionText.startsWith("during") if (!conditionText.startsWith("during") && !conditionText.startsWith("before") && !conditionText.startsWith("if")) {
|| conditionText.startsWith("before")
|| conditionText.startsWith("if")) {
} else {
sb.append("if "); sb.append("if ");
} }
sb.append(conditionText); sb.append(conditionText);

View file

@ -31,10 +31,10 @@ public class AwakenAbility extends SpellAbility {
private static final Logger logger = Logger.getLogger(AwakenAbility.class); private static final Logger logger = Logger.getLogger(AwakenAbility.class);
private static String filterMessage = "a land you control to awake"; private static final String filterMessage = "a land you control to awake";
private String rule; private final String rule;
private int awakenValue; private final int awakenValue;
public AwakenAbility(Card card, int awakenValue, String awakenCosts) { public AwakenAbility(Card card, int awakenValue, String awakenCosts) {
super(card.getSpellAbility()); super(card.getSpellAbility());
@ -45,7 +45,7 @@ public class AwakenAbility extends SpellAbility {
this.clearManaCosts(); this.clearManaCosts();
this.clearManaCostsToPay(); this.clearManaCostsToPay();
this.addManaCost(new ManaCostsImpl<>(awakenCosts)); this.addCost(new ManaCostsImpl<>(awakenCosts));
this.addTarget(new TargetControlledPermanent(new FilterControlledLandPermanent(filterMessage))); this.addTarget(new TargetControlledPermanent(new FilterControlledLandPermanent(filterMessage)));
this.addEffect(new AwakenEffect()); this.addEffect(new AwakenEffect());

View file

@ -37,7 +37,7 @@ public class EmergeAbility extends SpellAbility {
this.clearManaCosts(); this.clearManaCosts();
this.clearManaCostsToPay(); this.clearManaCostsToPay();
this.addManaCost(emergeCost.copy()); this.addCost(emergeCost.copy());
this.setRuleAtTheTop(true); this.setRuleAtTheTop(true);
} }

View file

@ -46,7 +46,7 @@ public class EscapeAbility extends SpellAbility {
this.clearManaCostsToPay(); this.clearManaCostsToPay();
String text = "Escape&mdash;" + manaCost; String text = "Escape&mdash;" + manaCost;
this.addManaCost(new ManaCostsImpl<>(manaCost)); this.addCost(new ManaCostsImpl<>(manaCost));
for (Cost cost : additionalCosts) { for (Cost cost : additionalCosts) {
text += ", " + CardUtil.getTextWithFirstCharUpperCase(cost.getText()); text += ", " + CardUtil.getTextWithFirstCharUpperCase(cost.getText());
this.addCost(cost.copy().setText("")); // hide additional cost text from rules this.addCost(cost.copy().setText("")); // hide additional cost text from rules

View file

@ -32,7 +32,7 @@ public class SpectacleAbility extends SpellAbility {
this.clearManaCosts(); this.clearManaCosts();
this.clearManaCostsToPay(); this.clearManaCostsToPay();
this.addManaCost(spectacleCosts.copy()); this.addCost(spectacleCosts.copy());
this.setRuleAtTheTop(true); this.setRuleAtTheTop(true);
this.rule = "Spectacle " + spectacleCosts.getText() this.rule = "Spectacle " + spectacleCosts.getText()
@ -58,7 +58,7 @@ public class SpectacleAbility extends SpellAbility {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public boolean activate(Game game, boolean noMana) { public boolean activate(Game game, boolean noMana) {
if (super.activate(game, noMana)) { if (super.activate(game, noMana)) {
List<Integer> spectacleActivations = (ArrayList) game.getState().getValue(SPECTACLE_ACTIVATION_VALUE_KEY + getSourceId()); List<Integer> spectacleActivations = (List<Integer>) game.getState().getValue(SPECTACLE_ACTIVATION_VALUE_KEY + getSourceId());
if (spectacleActivations == null) { if (spectacleActivations == null) {
spectacleActivations = new ArrayList<>(); // zoneChangeCounter spectacleActivations = new ArrayList<>(); // zoneChangeCounter
game.getState().setValue(SPECTACLE_ACTIVATION_VALUE_KEY + getSourceId(), spectacleActivations); game.getState().setValue(SPECTACLE_ACTIVATION_VALUE_KEY + getSourceId(), spectacleActivations);

View file

@ -21,7 +21,7 @@ public class SurgeAbility extends SpellAbility {
public static final String SURGE_ACTIVATION_VALUE_KEY = "surgeActivation"; public static final String SURGE_ACTIVATION_VALUE_KEY = "surgeActivation";
private String rule; private final String rule;
public SurgeAbility(Card card, String surgeCosts) { public SurgeAbility(Card card, String surgeCosts) {
super(card.getSpellAbility()); super(card.getSpellAbility());
@ -32,7 +32,7 @@ public class SurgeAbility extends SpellAbility {
this.clearManaCosts(); this.clearManaCosts();
this.clearManaCostsToPay(); this.clearManaCostsToPay();
this.addManaCost(new ManaCostsImpl<>(surgeCosts)); this.addCost(new ManaCostsImpl<>(surgeCosts));
this.setRuleAtTheTop(true); this.setRuleAtTheTop(true);
this.rule = "Surge " + surgeCosts this.rule = "Surge " + surgeCosts

View file

@ -132,7 +132,7 @@ public class SuspendAbility extends SpecialAction {
if (suspend == Integer.MAX_VALUE) { if (suspend == Integer.MAX_VALUE) {
VariableManaCost xCosts = new VariableManaCost(VariableCostType.ALTERNATIVE); VariableManaCost xCosts = new VariableManaCost(VariableCostType.ALTERNATIVE);
xCosts.setMinX(1); xCosts.setMinX(1);
this.addManaCost(xCosts); this.addCost(xCosts);
cost = new ManaCostsImpl<>("{X}" + cost.getText()); cost = new ManaCostsImpl<>("{X}" + cost.getText());
} }
StringBuilder sb = new StringBuilder("Suspend "); StringBuilder sb = new StringBuilder("Suspend ");

View file

@ -393,11 +393,6 @@ public class StackAbility extends StackObjectImpl implements Ability {
return ability.getManaCostsToPay(); return ability.getManaCostsToPay();
} }
@Override
public void addManaCost(ManaCost manaCost) {
// Do nothing
}
@Override @Override
public void addManaCostsToPay(ManaCost manaCost) { public void addManaCostsToPay(ManaCost manaCost) {
// Do nothing // Do nothing

View file

@ -1113,9 +1113,6 @@ public abstract class PlayerImpl implements Player, Serializable {
.computeIfAbsent(sourceId, k -> new HashMap<>()) .computeIfAbsent(sourceId, k -> new HashMap<>())
.put(identifier, costs != null ? costs.copy() : null); .put(identifier, costs != null ? costs.copy() : null);
if (identifier == null) {
boolean a = true;
}
} }
@Override @Override
@ -1236,7 +1233,7 @@ public abstract class PlayerImpl implements Player, Serializable {
} else { } else {
spellAbility.clearManaCosts(); spellAbility.clearManaCosts();
spellAbility.clearManaCostsToPay(); spellAbility.clearManaCostsToPay();
spellAbility.addManaCost(alternateCosts.copy()); spellAbility.addCost(alternateCosts.copy());
} }
spellAbility.clearCosts(); spellAbility.clearCosts();
spellAbility.addCost(costs); spellAbility.addCost(costs);