mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
[STX] Implemented Promising Duskmage
This commit is contained in:
parent
2513a0a7ec
commit
8699b847d8
3 changed files with 66 additions and 12 deletions
58
Mage.Sets/src/mage/cards/p/PromisingDuskmage.java
Normal file
58
Mage.Sets/src/mage/cards/p/PromisingDuskmage.java
Normal file
|
@ -0,0 +1,58 @@
|
|||
package mage.cards.p;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.DiesSourceTriggeredAbility;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
|
||||
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.counters.CounterType;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class PromisingDuskmage extends CardImpl {
|
||||
|
||||
public PromisingDuskmage(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{B}");
|
||||
|
||||
this.subtype.add(SubType.HUMAN);
|
||||
this.subtype.add(SubType.WARLOCK);
|
||||
this.power = new MageInt(2);
|
||||
this.toughness = new MageInt(3);
|
||||
|
||||
// When Promising Duskmage dies, if it had a +1/+1 counter on it, draw a card.
|
||||
this.addAbility(new ConditionalInterveningIfTriggeredAbility(
|
||||
new DiesSourceTriggeredAbility(new DrawCardSourceControllerEffect(1)),
|
||||
PromisingDuskmageCondition.instance, "When {this} dies, " +
|
||||
"if it had a +1/+1 counter on it, draw a card."
|
||||
));
|
||||
}
|
||||
|
||||
private PromisingDuskmage(final PromisingDuskmage card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PromisingDuskmage copy() {
|
||||
return new PromisingDuskmage(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum PromisingDuskmageCondition implements Condition {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = (Permanent) source.getEffects().get(0).getValue("permanentLeftBattlefield");
|
||||
return permanent != null && permanent.getCounters(game).containsKey(CounterType.P1P1);
|
||||
}
|
||||
}
|
|
@ -162,6 +162,7 @@ public final class StrixhavenSchoolOfMages extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Professor of Symbology", 24, Rarity.UNCOMMON, mage.cards.p.ProfessorOfSymbology.class));
|
||||
cards.add(new SetCardInfo("Professor of Zoomancy", 140, Rarity.COMMON, mage.cards.p.ProfessorOfZoomancy.class));
|
||||
cards.add(new SetCardInfo("Professor's Warning", 84, Rarity.COMMON, mage.cards.p.ProfessorsWarning.class));
|
||||
cards.add(new SetCardInfo("Promising Duskmage", 85, Rarity.COMMON, mage.cards.p.PromisingDuskmage.class));
|
||||
cards.add(new SetCardInfo("Quandrix Apprentice", 216, Rarity.UNCOMMON, mage.cards.q.QuandrixApprentice.class));
|
||||
cards.add(new SetCardInfo("Quandrix Campus", 271, Rarity.COMMON, mage.cards.q.QuandrixCampus.class));
|
||||
cards.add(new SetCardInfo("Quandrix Command", 217, Rarity.RARE, mage.cards.q.QuandrixCommand.class));
|
||||
|
|
|
@ -21,7 +21,7 @@ public class DiesSourceTriggeredAbility extends ZoneChangeTriggeredAbility {
|
|||
this(effect, false);
|
||||
}
|
||||
|
||||
public DiesSourceTriggeredAbility(DiesSourceTriggeredAbility ability) {
|
||||
public DiesSourceTriggeredAbility(final DiesSourceTriggeredAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
|
@ -29,24 +29,19 @@ public class DiesSourceTriggeredAbility extends ZoneChangeTriggeredAbility {
|
|||
public DiesSourceTriggeredAbility copy() {
|
||||
return new DiesSourceTriggeredAbility(this);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
|
||||
if (zEvent.isDiesEvent() && event.getTargetId().equals(getSourceId())) {
|
||||
for (Effect effect : getEffects()) {
|
||||
effect.setValue("permanentLeftBattlefield", zEvent.getTarget());
|
||||
}
|
||||
return true;
|
||||
if (!zEvent.isDiesEvent() || !event.getTargetId().equals(getSourceId())) {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
getEffects().setValue("permanentLeftBattlefield", zEvent.getTarget());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isInUseableZone(Game game, MageObject source, GameEvent event) {
|
||||
return TriggeredAbilityImpl.isInUseableZoneDiesTrigger(this, event, game);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue