Removed redundant field in PermanentsOnBattlefieldCount

Fixed the Cards that were using it
Removed duplicate "you control" form TapTargetCost
This commit is contained in:
North 2011-05-26 23:09:28 +03:00
parent 16b7ebcf30
commit ade063fbbf
5 changed files with 22 additions and 24 deletions

View file

@ -34,7 +34,7 @@ import mage.Constants.Rarity;
import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
import mage.abilities.effects.common.continious.BoostTargetEffect;
import mage.cards.CardImpl;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.target.common.TargetCreaturePermanent;
/**
@ -49,7 +49,7 @@ public class MightOfTheMasses extends CardImpl<MightOfTheMasses> {
this.color.setGreen(true);
PermanentsOnBattlefieldCount value = new PermanentsOnBattlefieldCount(new FilterCreaturePermanent(), true);
PermanentsOnBattlefieldCount value = new PermanentsOnBattlefieldCount(new FilterControlledCreaturePermanent());
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
this.getSpellAbility().addEffect(new BoostTargetEffect(value, value, Duration.EndOfTurn));
}

View file

@ -31,6 +31,7 @@ import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Duration;
import mage.Constants.Rarity;
import mage.Constants.TargetController;
import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
import mage.abilities.effects.common.continious.BoostTargetEffect;
import mage.cards.CardImpl;
@ -43,10 +44,12 @@ import mage.target.common.TargetCreaturePermanent;
*/
public class PrimalBellow extends CardImpl<PrimalBellow> {
private static final FilterLandPermanent filter = new FilterLandPermanent("Forest");
private static final FilterLandPermanent filter = new FilterLandPermanent("Forest you control");
static {
filter.getName().add("Forest");
filter.setTargetController(TargetController.YOU);
}
public PrimalBellow(UUID ownerId) {
@ -54,7 +57,7 @@ public class PrimalBellow extends CardImpl<PrimalBellow> {
this.expansionSetCode = "ZEN";
this.color.setGreen(true);
PermanentsOnBattlefieldCount value = new PermanentsOnBattlefieldCount(filter, true);
PermanentsOnBattlefieldCount value = new PermanentsOnBattlefieldCount(filter);
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
this.getSpellAbility().addEffect(new BoostTargetEffect(value, value, Duration.EndOfTurn));
}

View file

@ -31,6 +31,7 @@ import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Duration;
import mage.Constants.Rarity;
import mage.Constants.TargetController;
import mage.MageInt;
import mage.abilities.common.AttacksTriggeredAbility;
import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
@ -44,10 +45,12 @@ import mage.filter.common.FilterLandPermanent;
*/
public class TimbermawLarva extends CardImpl<TimbermawLarva> {
private static final FilterLandPermanent filter = new FilterLandPermanent("Forest");
private static final FilterLandPermanent filter = new FilterLandPermanent("Forest you control");
static {
filter.getName().add("Forest");
filter.setTargetController(TargetController.YOU);
}
public TimbermawLarva(UUID ownerId) {
@ -59,7 +62,7 @@ public class TimbermawLarva extends CardImpl<TimbermawLarva> {
this.power = new MageInt(2);
this.toughness = new MageInt(2);
PermanentsOnBattlefieldCount value = new PermanentsOnBattlefieldCount(filter, true);
PermanentsOnBattlefieldCount value = new PermanentsOnBattlefieldCount(filter);
this.addAbility(new AttacksTriggeredAbility(new BoostSourceEffect(value, value, Duration.EndOfTurn), false));
}

View file

@ -46,7 +46,7 @@ public class TapTargetCost extends CostImpl<TapTargetCost> {
public TapTargetCost(TargetControlledPermanent target) {
this.target = target;
this.text = "tap " + target.getMaxNumberOfTargets() + " " + target.getTargetName() + " you control";
this.text = "tap " + target.getMaxNumberOfTargets() + " " + target.getTargetName();
}
public TapTargetCost(final TapTargetCost cost) {

View file

@ -10,39 +10,31 @@ import mage.game.Game;
* @author North
*/
public class PermanentsOnBattlefieldCount implements DynamicValue {
private FilterPermanent filter;
private boolean controlled;
public PermanentsOnBattlefieldCount() {
filter = new FilterPermanent();
controlled = false;
}
public PermanentsOnBattlefieldCount(FilterPermanent filter, boolean controlled) {
public PermanentsOnBattlefieldCount(FilterPermanent filter) {
this.filter = filter;
this.controlled = controlled;
}
public PermanentsOnBattlefieldCount(final PermanentsOnBattlefieldCount dynamicValue) {
this.filter = dynamicValue.filter;
this.controlled = dynamicValue.controlled;
}
@Override
public int calculate(Game game, Ability sourceAbility) {
if (controlled) {
return game.getBattlefield().countAll(filter, sourceAbility.getControllerId());
} else {
return game.getBattlefield().countAll(filter);
}
return game.getBattlefield().countAll(filter);
}
@Override
public DynamicValue clone() {
return new PermanentsOnBattlefieldCount(this);
}
@Override
public String toString() {
return "X";