mirror of
https://github.com/magefree/mage.git
synced 2026-01-10 04:42:07 -08:00
[DMU] Implemented Karn, Living Legacy
This commit is contained in:
parent
02968c9cc1
commit
b9bbb4d1b3
4 changed files with 243 additions and 0 deletions
|
|
@ -0,0 +1,36 @@
|
|||
package mage.game.command.emblems;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.costs.common.TapTargetCost;
|
||||
import mage.abilities.effects.common.DamageTargetEffect;
|
||||
import mage.filter.common.FilterControlledArtifactPermanent;
|
||||
import mage.filter.common.FilterControlledPermanent;
|
||||
import mage.filter.predicate.permanent.TappedPredicate;
|
||||
import mage.game.command.Emblem;
|
||||
import mage.target.common.TargetAnyTarget;
|
||||
import mage.target.common.TargetControlledPermanent;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class KarnLivingLegacyEmblem extends Emblem {
|
||||
|
||||
private static final FilterControlledPermanent filter = new FilterControlledArtifactPermanent("an untapped artifact you control");
|
||||
|
||||
static {
|
||||
filter.add(TappedPredicate.UNTAPPED);
|
||||
}
|
||||
|
||||
// -7: You get an emblem with "Tap an untapped artifact you control: This emblem deals 1 damage to any target."
|
||||
public KarnLivingLegacyEmblem() {
|
||||
this.setName("Emblem Karn");
|
||||
this.setExpansionSetCodeForImage("DMU");
|
||||
Ability ability = new SimpleActivatedAbility(
|
||||
new DamageTargetEffect(1, "this emblem"),
|
||||
new TapTargetCost(new TargetControlledPermanent(filter))
|
||||
);
|
||||
ability.addTarget(new TargetAnyTarget());
|
||||
this.getAbilities().add(ability);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,110 @@
|
|||
package mage.game.permanent.token;
|
||||
|
||||
import mage.ConditionalMana;
|
||||
import mage.MageObject;
|
||||
import mage.Mana;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.SpellAbility;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.mana.ConditionalColorlessManaAbility;
|
||||
import mage.abilities.mana.builder.ConditionalManaBuilder;
|
||||
import mage.abilities.mana.conditional.ManaCondition;
|
||||
import mage.cards.Card;
|
||||
import mage.constants.CardType;
|
||||
import mage.game.Game;
|
||||
import mage.game.command.Commander;
|
||||
import mage.game.stack.Spell;
|
||||
import mage.game.stack.StackAbility;
|
||||
import mage.game.stack.StackObject;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class PowerstoneToken extends TokenImpl {
|
||||
|
||||
public PowerstoneToken() {
|
||||
super("Powerstone Token", "Powerstone token");
|
||||
cardType.add(CardType.ARTIFACT);
|
||||
|
||||
// {T}: Add {C}. This mana can't be spent to cast a nonartifact spell.
|
||||
this.addAbility(new ConditionalColorlessManaAbility(1, new PowerstoneTokenManaBuilder()));
|
||||
|
||||
availableImageSetCodes = Arrays.asList("DMU");
|
||||
}
|
||||
|
||||
public PowerstoneToken(final PowerstoneToken token) {
|
||||
super(token);
|
||||
}
|
||||
|
||||
public PowerstoneToken copy() {
|
||||
return new PowerstoneToken(this);
|
||||
}
|
||||
}
|
||||
|
||||
class PowerstoneTokenManaBuilder extends ConditionalManaBuilder {
|
||||
|
||||
public PowerstoneTokenManaBuilder() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConditionalMana build(Object... options) {
|
||||
this.mana.setFlag(true); // indicates that the mana is from second ability
|
||||
return new PowerstoneTokenConditionalMana(this.mana);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "This mana can't be spent to cast a nonartifact spell.";
|
||||
}
|
||||
}
|
||||
|
||||
class PowerstoneTokenConditionalMana extends ConditionalMana {
|
||||
|
||||
PowerstoneTokenConditionalMana(Mana mana) {
|
||||
super(mana);
|
||||
staticText = "This mana can't be spent to cast a nonartifact spell.";
|
||||
addCondition(new PowerstoneTokenManaCondition());
|
||||
}
|
||||
}
|
||||
|
||||
class PowerstoneTokenManaCondition extends ManaCondition implements Condition {
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
if (!(source instanceof SpellAbility)) {
|
||||
return false;
|
||||
}
|
||||
MageObject object = game.getObject(source);
|
||||
if (object instanceof StackObject) {
|
||||
return object instanceof StackAbility || !object.isArtifact(game);
|
||||
}
|
||||
if (!game.inCheckPlayableState()) {
|
||||
return false;
|
||||
}
|
||||
Spell spell;
|
||||
if (object instanceof Card) {
|
||||
spell = new Spell(
|
||||
(Card) object, (SpellAbility) source, source.getControllerId(),
|
||||
game.getState().getZone(source.getSourceId()), game
|
||||
);
|
||||
} else if (object instanceof Commander) {
|
||||
spell = new Spell(
|
||||
((Commander) object).getSourceObject(),
|
||||
(SpellAbility) source, source.getControllerId(),
|
||||
game.getState().getZone(source.getSourceId()), game
|
||||
);
|
||||
} else {
|
||||
spell = null;
|
||||
}
|
||||
return spell == null || spell.isArtifact(game);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source, UUID originalId, Cost costToPay) {
|
||||
return apply(game, source);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue