[refactor] removed dependency to Counter implementations (except BoostCounters)

This commit is contained in:
North 2014-05-31 17:48:04 +03:00
parent 545e4298b7
commit 519754a96c
16 changed files with 19 additions and 33 deletions

View file

@ -44,7 +44,6 @@ import mage.abilities.effects.common.continious.BoostTargetEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.cards.CardImpl;
import mage.counters.CounterType;
import mage.counters.common.DevotionCounter;
import mage.filter.common.FilterControlledPermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.target.common.TargetCreaturePermanent;
@ -72,7 +71,7 @@ public class BloodthirstyOgre extends CardImpl<BloodthirstyOgre> {
this.toughness = new MageInt(1);
// {T}: Put a devotion counter on Bloodthirsty Ogre
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddCountersSourceEffect(new DevotionCounter()),new TapSourceCost()));
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.DEVOTION.createInstance()),new TapSourceCost()));
// {T}: Target creature gets -X/-X until end of turn, where X is the number of devotion counters on Bloodthirsty Ogre. Activate this ability only if you control a Demon.
DynamicValue devotionCounters = new SignInversionDynamicValue(new CountersCount(CounterType.DEVOTION));
Ability ability;

View file

@ -44,7 +44,6 @@ import mage.abilities.effects.common.continious.GainAbilityAttachedEffect;
import mage.abilities.keyword.EquipAbility;
import mage.cards.CardImpl;
import mage.counters.CounterType;
import mage.counters.common.AimCounter;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
@ -107,7 +106,7 @@ class HankyuAddCounterEffect extends OneShotEffect<HankyuAddCounterEffect> {
public boolean apply(Game game, Ability source) {
Permanent equipment = game.getPermanent(this.effectGivingEquipmentId);
if (equipment != null) {
equipment.addCounters(new AimCounter(), game);
equipment.addCounters(CounterType.AIM.createInstance(), game);
}
return true;
}

View file

@ -44,7 +44,6 @@ import mage.constants.Rarity;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.counters.CounterType;
import mage.counters.common.DevotionCounter;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.NamePredicate;
import mage.game.Game;
@ -71,7 +70,7 @@ public class PiousKitsune extends CardImpl<PiousKitsune> {
this.addAbility(new BeginningOfUpkeepTriggeredAbility(new PiousKitsuneEffect(), TargetController.YOU, false));
// {tap}, Remove a devotion counter from Pious Kitsune: You gain 1 life.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new GainLifeEffect(1), new TapSourceCost());
ability.addCost(new RemoveCountersSourceCost(new DevotionCounter()));
ability.addCost(new RemoveCountersSourceCost(CounterType.DEVOTION.createInstance()));
this.addAbility(ability);
}
@ -110,7 +109,7 @@ class PiousKitsuneEffect extends OneShotEffect<PiousKitsuneEffect> {
@Override
public boolean apply(Game game, Ability source) {
boolean result;
result = new AddCountersSourceEffect(new DevotionCounter()).apply(game, source);
result = new AddCountersSourceEffect(CounterType.DEVOTION.createInstance()).apply(game, source);
if (game.getBattlefield().count(filter, source.getSourceId(), source.getControllerId(), game) > 0) {
Permanent permanent = game.getPermanent(source.getSourceId());
if (permanent != null) {

View file

@ -43,7 +43,6 @@ import mage.constants.Rarity;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.counters.CounterType;
import mage.counters.common.ChargeCounter;
import mage.filter.common.FilterLandCard;
import mage.game.Game;
import mage.game.stack.Spell;
@ -142,7 +141,7 @@ class LightningStormAddCounterEffect extends OneShotEffect<LightningStormAddCoun
public boolean apply(Game game, Ability source) {
Spell spell = game.getStack().getSpell(source.getSourceId());
if (spell != null) {
spell.addCounters(new ChargeCounter(2), game);
spell.addCounters(CounterType.CHARGE.createInstance(2), game);
return spell.chooseNewTargets(game, source.getControllerId(), false, false);
}
return false;

View file

@ -44,7 +44,6 @@ import mage.constants.Rarity;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.counters.CounterType;
import mage.counters.common.BriberyCounter;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.game.Game;
@ -113,7 +112,7 @@ class GwafaHazidProfiteerEffect1 extends OneShotEffect<GwafaHazidProfiteerEffect
Permanent targetCreature = game.getPermanent(source.getFirstTarget());
if (targetCreature != null) {
Player controller = game.getPlayer(targetCreature.getControllerId());
targetCreature.addCounters(new BriberyCounter(), game);
targetCreature.addCounters(CounterType.BRIBERY.createInstance(), game);
if (controller != null) {
controller.drawCards(1, game);
}

View file

@ -43,7 +43,6 @@ import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.cards.CardImpl;
import mage.constants.Zone;
import mage.counters.CounterType;
import mage.counters.common.ChargeCounter;
import mage.game.permanent.token.Token;
import mage.target.common.TargetControlledCreaturePermanent;
@ -56,7 +55,7 @@ public class SpawningPit extends CardImpl<SpawningPit> {
public SpawningPit (UUID ownerId) {
super(ownerId, 141, "Spawning Pit", Rarity.UNCOMMON, new CardType[]{CardType.ARTIFACT}, "{2}");
this.expansionSetCode = "DST";
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddCountersSourceEffect(new ChargeCounter()), new SacrificeTargetCost(new TargetControlledCreaturePermanent())));
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.CHARGE.createInstance()), new SacrificeTargetCost(new TargetControlledCreaturePermanent())));
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new CreateTokenEffect(new SpawningPitToken()), new GenericManaCost(1));
ability.addCost(new RemoveCountersSourceCost(CounterType.CHARGE.createInstance(2)));
this.addAbility(ability);

View file

@ -42,7 +42,6 @@ import mage.counters.CounterType;
import mage.target.TargetPermanent;
import java.util.UUID;
import mage.counters.common.ChargeCounter;
/**
*
@ -53,7 +52,7 @@ public class LuxCannon extends CardImpl<LuxCannon> {
public LuxCannon (UUID ownerId) {
super(ownerId, 173, "Lux Cannon", Rarity.MYTHIC, new CardType[]{CardType.ARTIFACT}, "{4}");
this.expansionSetCode = "SOM";
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddCountersSourceEffect(new ChargeCounter()), new TapSourceCost()));
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.CHARGE.createInstance()), new TapSourceCost()));
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DestroyTargetEffect(), new TapSourceCost());
ability.addCost(new RemoveCountersSourceCost(CounterType.CHARGE.createInstance(3)));
ability.addTarget(new TargetPermanent());

View file

@ -44,7 +44,6 @@ import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.abilities.effects.common.counter.AddCountersTargetEffect;
import mage.cards.CardImpl;
import mage.counters.CounterType;
import mage.counters.common.ChargeCounter;
import mage.target.Target;
import mage.target.common.TargetCreaturePermanent;
@ -61,7 +60,7 @@ public class TrigonOfCorruption extends CardImpl<TrigonOfCorruption> {
super(ownerId, 213, "Trigon of Corruption", Rarity.UNCOMMON, new CardType[]{CardType.ARTIFACT}, "{4}");
this.expansionSetCode = "SOM";
this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(new ChargeCounter(3)), ""));
this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.CHARGE.createInstance(3)), ""));
Costs costs = new CostsImpl();
costs.add(new RemoveCountersSourceCost(CounterType.CHARGE.createInstance()));

View file

@ -42,7 +42,6 @@ import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.cards.CardImpl;
import mage.counters.CounterType;
import mage.counters.common.ChargeCounter;
import mage.game.permanent.token.InsectInfectToken;
import java.util.UUID;
@ -60,7 +59,7 @@ public class TrigonOfInfestation extends CardImpl<TrigonOfInfestation> {
super(ownerId, 214, "Trigon of Infestation", Rarity.UNCOMMON, new CardType[]{CardType.ARTIFACT}, "{4}");
this.expansionSetCode = "SOM";
this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(new ChargeCounter(3)), ""));
this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.CHARGE.createInstance(3)), ""));
Costs costs = new CostsImpl();
costs.add(new RemoveCountersSourceCost(CounterType.CHARGE.createInstance()));

View file

@ -42,7 +42,6 @@ import mage.abilities.effects.common.GainLifeEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.cards.CardImpl;
import mage.counters.CounterType;
import mage.counters.common.ChargeCounter;
import java.util.UUID;
import mage.abilities.Ability;
@ -57,7 +56,7 @@ public class TrigonOfMending extends CardImpl<TrigonOfMending> {
super(ownerId, 215, "Trigon of Mending", Rarity.UNCOMMON, new CardType[]{CardType.ARTIFACT}, "{2}");
this.expansionSetCode = "SOM";
this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(new ChargeCounter(3)), ""));
this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.CHARGE.createInstance(3)), ""));
Costs costs = new CostsImpl();
costs.add(new RemoveCountersSourceCost(CounterType.CHARGE.createInstance()));

View file

@ -45,7 +45,6 @@ import mage.abilities.effects.common.continious.BoostTargetEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.cards.CardImpl;
import mage.counters.CounterType;
import mage.counters.common.ChargeCounter;
import mage.target.Target;
import mage.target.common.TargetCreaturePermanent;
@ -61,7 +60,7 @@ public class TrigonOfRage extends CardImpl<TrigonOfRage> {
super(ownerId, 216, "Trigon of Rage", Rarity.UNCOMMON, new CardType[]{CardType.ARTIFACT}, "{2}");
this.expansionSetCode = "SOM";
this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(new ChargeCounter(3)), ""));
this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.CHARGE.createInstance(3)), ""));
Costs costs = new CostsImpl();
costs.add(new RemoveCountersSourceCost(CounterType.CHARGE.createInstance()));

View file

@ -42,7 +42,6 @@ import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.cards.CardImpl;
import mage.counters.CounterType;
import mage.counters.common.ChargeCounter;
import java.util.UUID;
import mage.abilities.Ability;
@ -57,7 +56,7 @@ public class TrigonOfThought extends CardImpl<TrigonOfThought> {
super(ownerId, 217, "Trigon of Thought", Rarity.UNCOMMON, new CardType[]{CardType.ARTIFACT}, "{5}");
this.expansionSetCode = "SOM";
this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(new ChargeCounter(3)), ""));
this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.CHARGE.createInstance(3)), ""));
Costs costs = new CostsImpl();
costs.add(new RemoveCountersSourceCost(CounterType.CHARGE.createInstance()));

View file

@ -40,7 +40,7 @@ import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.TargetController;
import mage.counters.common.TimeCounter;
import mage.counters.CounterType;
import mage.filter.FilterSpell;
import mage.filter.predicate.permanent.ControllerPredicate;
@ -70,7 +70,7 @@ public class DeepSeaKraken extends CardImpl<DeepSeaKraken> {
this.addAbility(new SuspendAbility(9, new ManaCostsImpl("{2}{U}"), this));
// Whenever an opponent casts a spell, if Deep-Sea Kraken is suspended, remove a time counter from it.
this.addAbility(new ConditionalTriggeredAbility(
new SpellCastAllTriggeredAbility(new RemoveCounterSourceEffect(new TimeCounter(1)), filter, false), SuspendedCondition.getInstance(),
new SpellCastAllTriggeredAbility(new RemoveCounterSourceEffect(CounterType.TIME.createInstance()), filter, false), SuspendedCondition.getInstance(),
"Whenever an opponent casts a spell, if Deep-Sea Kraken is suspended, remove a time counter from it.", false));
}

View file

@ -41,7 +41,6 @@ import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect;
import mage.cards.CardImpl;
import mage.counters.CounterType;
import mage.counters.common.QuestCounter;
import mage.filter.common.FilterBasicLandCard;
import mage.target.common.TargetCardInLibrary;
@ -56,7 +55,7 @@ public class KhalniHeartExpedition extends CardImpl<KhalniHeartExpedition> {
this.expansionSetCode = "ZEN";
this.color.setGreen(true);
this.addAbility(new LandfallAbility(new AddCountersSourceEffect(new QuestCounter()), true));
this.addAbility(new LandfallAbility(new AddCountersSourceEffect(CounterType.QUEST.createInstance()), true));
TargetCardInLibrary target = new TargetCardInLibrary(0, 2, new FilterBasicLandCard());
SimpleActivatedAbility ability = new SimpleActivatedAbility(Zone.BATTLEFIELD,
new SearchLibraryPutInPlayEffect(target, true, Outcome.PutLandInPlay),

View file

@ -43,7 +43,6 @@ import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.abilities.effects.common.GainLifeEffect;
import mage.cards.CardImpl;
import mage.counters.CounterType;
import mage.counters.common.QuestCounter;
/**
*
@ -56,7 +55,7 @@ public class SunspringExpedition extends CardImpl<SunspringExpedition> {
this.expansionSetCode = "ZEN";
this.color.setWhite(true);
this.addAbility(new LandfallAbility(new AddCountersSourceEffect(new QuestCounter()), true));
this.addAbility(new LandfallAbility(new AddCountersSourceEffect(CounterType.QUEST.createInstance()), true));
Costs costs = new CostsImpl();
costs.add(new RemoveCountersSourceCost(CounterType.QUEST.createInstance(3)));
costs.add(new SacrificeSourceCost());

View file

@ -33,7 +33,7 @@ import mage.abilities.costs.mana.ManaCosts;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.constants.TimingRule;
import mage.constants.Zone;
import mage.counters.common.LevelCounter;
import mage.counters.CounterType;
/**
*
@ -42,7 +42,7 @@ import mage.counters.common.LevelCounter;
public class LevelUpAbility extends ActivatedAbilityImpl<LevelUpAbility> {
public LevelUpAbility(ManaCosts costs) {
super(Zone.BATTLEFIELD, new AddCountersSourceEffect(new LevelCounter()), costs);
super(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.LEVEL.createInstance()), costs);
this.timing = TimingRule.SORCERY;
}