mirror of
https://github.com/correl/mage.git
synced 2024-11-15 19:19:33 +00:00
* Minamo Sightbender - FIxed tooltip text and reimplemented activated ability.
This commit is contained in:
parent
87218c2847
commit
bc03a23708
1 changed files with 31 additions and 36 deletions
|
@ -32,9 +32,12 @@ import java.util.UUID;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.constants.Rarity;
|
import mage.constants.Rarity;
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.ActivatedAbilityImpl;
|
import mage.abilities.ActivatedAbilityImpl;
|
||||||
|
import mage.abilities.common.SimpleActivatedAbility;
|
||||||
import mage.abilities.costs.common.TapSourceCost;
|
import mage.abilities.costs.common.TapSourceCost;
|
||||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||||
|
import mage.abilities.effects.Effect;
|
||||||
import mage.abilities.effects.common.combat.UnblockableTargetEffect;
|
import mage.abilities.effects.common.combat.UnblockableTargetEffect;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.constants.Outcome;
|
import mage.constants.Outcome;
|
||||||
|
@ -43,10 +46,12 @@ import mage.filter.Filter;
|
||||||
import mage.filter.FilterPermanent;
|
import mage.filter.FilterPermanent;
|
||||||
import mage.filter.common.FilterCreaturePermanent;
|
import mage.filter.common.FilterCreaturePermanent;
|
||||||
import mage.filter.predicate.mageobject.ConvertedManaCostPredicate;
|
import mage.filter.predicate.mageobject.ConvertedManaCostPredicate;
|
||||||
|
import mage.filter.predicate.mageobject.PowerPredicate;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
import mage.target.Target;
|
import mage.target.Target;
|
||||||
import mage.target.TargetPermanent;
|
import mage.target.TargetPermanent;
|
||||||
|
import mage.target.common.TargetCreaturePermanent;
|
||||||
import mage.target.targetpointer.FixedTarget;
|
import mage.target.targetpointer.FixedTarget;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -55,6 +60,8 @@ import mage.target.targetpointer.FixedTarget;
|
||||||
*/
|
*/
|
||||||
public class MinamoSightbender extends CardImpl<MinamoSightbender> {
|
public class MinamoSightbender extends CardImpl<MinamoSightbender> {
|
||||||
|
|
||||||
|
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature with power X or less");
|
||||||
|
|
||||||
public MinamoSightbender(UUID ownerId) {
|
public MinamoSightbender(UUID ownerId) {
|
||||||
super(ownerId, 41, "Minamo Sightbender", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{1}{U}");
|
super(ownerId, 41, "Minamo Sightbender", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{1}{U}");
|
||||||
this.expansionSetCode = "BOK";
|
this.expansionSetCode = "BOK";
|
||||||
|
@ -65,7 +72,30 @@ public class MinamoSightbender extends CardImpl<MinamoSightbender> {
|
||||||
this.toughness = new MageInt(1);
|
this.toughness = new MageInt(1);
|
||||||
|
|
||||||
// {X}, {T}: Target creature with power X or less is unblockable this turn.
|
// {X}, {T}: Target creature with power X or less is unblockable this turn.
|
||||||
this.addAbility(new MinamoSightbenderAbility());
|
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new UnblockableTargetEffect(), new ManaCostsImpl("{X}"));
|
||||||
|
Target target = new TargetCreaturePermanent(filter);
|
||||||
|
target.setRequired(true);
|
||||||
|
ability.addTarget(target);
|
||||||
|
ability.addCost(new TapSourceCost());
|
||||||
|
this.addAbility(ability);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void adjustTargets(Ability ability, Game game) {
|
||||||
|
if (ability instanceof SimpleActivatedAbility) {
|
||||||
|
for (Effect effect :ability.getEffects()) {
|
||||||
|
if (effect instanceof UnblockableTargetEffect) {
|
||||||
|
int manaX = ability.getManaCostsToPay().getX();
|
||||||
|
ability.getTargets().clear();
|
||||||
|
FilterCreaturePermanent newFilter = new FilterCreaturePermanent(new StringBuilder("creature with power ").append(manaX).append(" or less").toString());
|
||||||
|
filter.add(new PowerPredicate(Filter.ComparisonType.LessThan, manaX +1));
|
||||||
|
Target target = new TargetCreaturePermanent(newFilter);
|
||||||
|
ability.addTarget(target);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public MinamoSightbender(final MinamoSightbender card) {
|
public MinamoSightbender(final MinamoSightbender card) {
|
||||||
|
@ -77,38 +107,3 @@ public class MinamoSightbender extends CardImpl<MinamoSightbender> {
|
||||||
return new MinamoSightbender(this);
|
return new MinamoSightbender(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class MinamoSightbenderAbility extends ActivatedAbilityImpl<MinamoSightbenderAbility> {
|
|
||||||
|
|
||||||
public MinamoSightbenderAbility() {
|
|
||||||
super(Zone.BATTLEFIELD,new UnblockableTargetEffect(), new ManaCostsImpl("{X}"));
|
|
||||||
this.addCost(new TapSourceCost());
|
|
||||||
}
|
|
||||||
|
|
||||||
public MinamoSightbenderAbility(MinamoSightbenderAbility ability) {
|
|
||||||
super(ability);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public MinamoSightbenderAbility copy() {
|
|
||||||
return new MinamoSightbenderAbility(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean resolve(Game game) {
|
|
||||||
int manaX = this.getManaCostsToPay().getX();
|
|
||||||
FilterPermanent filter = new FilterCreaturePermanent("creature with power " + manaX + " or less");
|
|
||||||
filter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.LessThan, manaX + 1));
|
|
||||||
Target target = new TargetPermanent(filter);
|
|
||||||
Player player = game.getPlayer(controllerId);
|
|
||||||
if (player != null) {
|
|
||||||
if (player.chooseTarget(Outcome.Benefit, target, this, game)) {
|
|
||||||
this.getEffects().get(0).setTargetPointer(new FixedTarget(target.getFirstTarget()));
|
|
||||||
return super.resolve(game);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
Loading…
Reference in a new issue