[refactor] removed remaining Counter implementations

This commit is contained in:
North 2014-05-31 18:55:20 +03:00
parent ca1af753eb
commit 4b058f845d
4 changed files with 9 additions and 57 deletions

View file

@ -127,7 +127,7 @@ class ArbiterOfTheIdealEffect extends OneShotEffect<ArbiterOfTheIdealEffect> {
card.putOntoBattlefield(game, Zone.LIBRARY, source.getSourceId(), source.getControllerId());
Permanent permanent = game.getPermanent(card.getId());
if (permanent != null) {
permanent.addCounters(new ManifestationCounter(), game);
permanent.addCounters(new Counter("Manifestation"), game);
ContinuousEffect effect = new AddCardTypeTargetEffect(CardType.ENCHANTMENT, Duration.Custom);
effect.setTargetPointer(new FixedTarget(permanent.getId()));
game.addEffect(effect, source);
@ -140,11 +140,3 @@ class ArbiterOfTheIdealEffect extends OneShotEffect<ArbiterOfTheIdealEffect> {
return false;
}
}
class ManifestationCounter extends Counter {
public ManifestationCounter() {
super("manifestation");
this.count = 1;
}
}

View file

@ -66,7 +66,7 @@ public class SenseiGoldenTail extends CardImpl<SenseiGoldenTail> {
// Bushido 1 (When this blocks or becomes blocked, it gets +1/+1 until end of turn.)
this.addAbility(new BushidoAbility(1));
// {1}{W}, {T}: Put a training counter on target creature.
Ability ability = new ActivateAsSorceryActivatedAbility(Zone.BATTLEFIELD, new AddCountersTargetEffect(new TrainingCounter()), new ManaCostsImpl("{1}{W}"));
Ability ability = new ActivateAsSorceryActivatedAbility(Zone.BATTLEFIELD, new AddCountersTargetEffect(new Counter("Training")), new ManaCostsImpl("{1}{W}"));
ability.addCost(new TapSourceCost());
ability.addTarget(new TargetCreaturePermanent());
// That creature gains bushido 1 and becomes a Samurai in addition to its other creature types. Activate this ability only any time you could cast a sorcery.
@ -85,16 +85,3 @@ public class SenseiGoldenTail extends CardImpl<SenseiGoldenTail> {
}
}
class TrainingCounter extends Counter {
public TrainingCounter() {
this(1);
}
public TrainingCounter(int amount) {
super("training");
this.count = amount;
}
}

View file

@ -71,6 +71,7 @@ public class AssembleTheLegion extends CardImpl<AssembleTheLegion> {
}
class AssembleTheLegionEffect extends OneShotEffect<AssembleTheLegionEffect> {
private static final String MUSTER_COUNTER_NAME = "Muster";
public AssembleTheLegionEffect() {
super(Outcome.Copy);
@ -98,11 +99,11 @@ class AssembleTheLegionEffect extends OneShotEffect<AssembleTheLegionEffect> {
if (sourcePermanent == null) {
Permanent lki = (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD);
if (lki != null) {
amountCounters = lki.getCounters().getCount("Muster");
amountCounters = lki.getCounters().getCount(MUSTER_COUNTER_NAME);
}
} else {
new AddCountersSourceEffect(new MusterCounter(),false).apply(game, source);
amountCounters = sourcePermanent.getCounters().getCount("Muster");
new AddCountersSourceEffect(new Counter(MUSTER_COUNTER_NAME),false).apply(game, source);
amountCounters = sourcePermanent.getCounters().getCount(MUSTER_COUNTER_NAME);
}
if (amountCounters > 0) {
@ -111,16 +112,3 @@ class AssembleTheLegionEffect extends OneShotEffect<AssembleTheLegionEffect> {
return false;
}
}
class MusterCounter extends Counter {
public MusterCounter() {
super("Muster");
this.count = 1;
}
public MusterCounter(int amount) {
super("Muster");
this.count = amount;
}
}

View file

@ -56,7 +56,7 @@ public class Smokestack extends CardImpl<Smokestack> {
this.expansionSetCode = "USG";
// At the beginning of your upkeep, you may put a soot counter on Smokestack.
this.addAbility(new BeginningOfUpkeepTriggeredAbility(new AddCountersSourceEffect(new SootCounter()), TargetController.YOU, true));
this.addAbility(new BeginningOfUpkeepTriggeredAbility(new AddCountersSourceEffect(new Counter("Soot")), TargetController.YOU, true));
// At the beginning of each player's upkeep, that player sacrifices a permanent for each soot counter on Smokestack.
this.addAbility(new BeginningOfUpkeepTriggeredAbility(new SmokestackEffect(), TargetController.ANY, false));
@ -72,19 +72,6 @@ public class Smokestack extends CardImpl<Smokestack> {
}
}
class SootCounter extends Counter {
public SootCounter() {
super("soot");
this.count = 1;
}
public SootCounter(int amount) {
super("soot");
this.count = amount;
}
}
class SmokestackEffect extends OneShotEffect<SmokestackEffect> {
public SmokestackEffect() {
@ -106,7 +93,7 @@ class SmokestackEffect extends OneShotEffect<SmokestackEffect> {
Player activePlayer = game.getPlayer(getTargetPointer().getFirst(game, source));
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
if (activePlayer != null && sourcePermanent != null) {
int count = sourcePermanent.getCounters().getCount("soot");
int count = sourcePermanent.getCounters().getCount("Soot");
if (count > 0) {
int amount = Math.min(count, game.getBattlefield().countAll(new FilterControlledPermanent(), activePlayer.getId(), game));
Target target = new TargetControlledPermanent(amount, amount, new FilterControlledPermanent(), false);
@ -119,14 +106,12 @@ class SmokestackEffect extends OneShotEffect<SmokestackEffect> {
}
for (int idx = 0; idx < target.getTargets().size(); idx++) {
Permanent permanent = game.getPermanent((UUID) target.getTargets().get(idx));
Permanent permanent = game.getPermanent(target.getTargets().get(idx));
if (permanent != null) {
permanent.sacrifice(source.getSourceId(), game);
}
}
}
}
return true;