mirror of
https://github.com/correl/mage.git
synced 2025-03-29 11:43:34 -09:00
- Fixed Simic Manipulator #4479
This commit is contained in:
parent
88d4e2b965
commit
a39cbbb7d7
1 changed files with 27 additions and 3 deletions
|
@ -31,6 +31,7 @@ import java.util.UUID;
|
|||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.common.RemoveVariableCountersSourceCost;
|
||||
import mage.abilities.costs.common.TapSourceCost;
|
||||
import mage.abilities.effects.common.continuous.GainControlTargetEffect;
|
||||
|
@ -38,12 +39,14 @@ import mage.abilities.keyword.EvolveAbility;
|
|||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.ComparisonType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.TargetAdjustment;
|
||||
import mage.constants.Zone;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.mageobject.PowerPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
||||
/**
|
||||
|
@ -60,7 +63,8 @@ import mage.target.common.TargetCreaturePermanent;
|
|||
*/
|
||||
public class SimicManipulator extends CardImpl {
|
||||
|
||||
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature with power less than or equal to the number of +1/+1 counters removed this way");
|
||||
private final UUID originalId;
|
||||
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("with power less than or equal to the number of +1/+1 counters removed this way");
|
||||
|
||||
public SimicManipulator(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{U}{U}");
|
||||
|
@ -77,16 +81,36 @@ public class SimicManipulator extends CardImpl {
|
|||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new GainControlTargetEffect(Duration.Custom, true), new TapSourceCost());
|
||||
ability.addTarget(new TargetCreaturePermanent(filter));
|
||||
ability.addCost(new RemoveVariableCountersSourceCost(CounterType.P1P1.createInstance(), 1, "Remove one or more +1/+1 counters from {this}"));
|
||||
ability.setTargetAdjustment(TargetAdjustment.SIMIC_MANIPULATOR);
|
||||
this.addAbility(ability);
|
||||
this.originalId = ability.getOriginalId();
|
||||
|
||||
}
|
||||
|
||||
public SimicManipulator(final SimicManipulator card) {
|
||||
super(card);
|
||||
this.originalId = card.originalId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SimicManipulator copy() {
|
||||
return new SimicManipulator(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (ability.getOriginalId().equals(originalId)) {
|
||||
ability.getTargets().clear();
|
||||
int maxPower = 0;
|
||||
FilterCreaturePermanent filter = new FilterCreaturePermanent("creature with power less than or equal to the number of +1/+1 counters removed this way");
|
||||
for (Cost cost : ability.getCosts()) {
|
||||
if (cost instanceof RemoveVariableCountersSourceCost) {
|
||||
maxPower = ((RemoveVariableCountersSourceCost) cost).getAmount();
|
||||
break;
|
||||
}
|
||||
}
|
||||
filter.add(new PowerPredicate(ComparisonType.FEWER_THAN, maxPower + 1));
|
||||
TargetCreaturePermanent target = new TargetCreaturePermanent(1, 1, filter, false);
|
||||
ability.addTarget(target);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue