[WOE] Implement Virtue of Courage (#10987)

This commit is contained in:
Susucre 2023-08-27 21:09:07 +02:00 committed by GitHub
parent c50e913398
commit b7db0541ce
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 84 additions and 0 deletions

View file

@ -0,0 +1,83 @@
package mage.cards.v;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.abilities.effects.common.ExileTopXMayPlayUntilEndOfTurnEffect;
import mage.cards.AdventureCard;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.DamagedPlayerEvent;
import mage.game.events.GameEvent;
import mage.target.common.TargetAnyTarget;
import java.util.UUID;
/**
* @author Susucr
*/
public final class VirtueOfCourage extends AdventureCard {
public VirtueOfCourage(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, new CardType[]{CardType.INSTANT}, "{3}{R}{R}", "Embereth Blaze", "{1}{R}");
// Whenever a source you control deals noncombat damage to an opponent, you may exile that many cards from the top of your library. You may play those cards this turn.
this.addAbility(new VirtueOfCourageTriggeredAbility());
// Embereth Blaze
// Embereth Blaze deals 2 damage to any target.
this.getSpellCard().getSpellAbility().addEffect(new DamageTargetEffect(2));
this.getSpellCard().getSpellAbility().addTarget(new TargetAnyTarget());
}
private VirtueOfCourage(final VirtueOfCourage card) {
super(card);
}
@Override
public VirtueOfCourage copy() {
return new VirtueOfCourage(this);
}
}
class VirtueOfCourageTriggeredAbility extends TriggeredAbilityImpl {
VirtueOfCourageTriggeredAbility() {
super(Zone.BATTLEFIELD, null);
}
private VirtueOfCourageTriggeredAbility(final VirtueOfCourageTriggeredAbility ability) {
super(ability);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DAMAGED_PLAYER;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
DamagedPlayerEvent dEvent = (DamagedPlayerEvent) event;
if (dEvent.isCombatDamage()
|| !game.getOpponents(getControllerId()).contains(event.getTargetId())
|| !game.getControllerId(event.getSourceId()).equals(getControllerId())) {
return false;
}
this.getEffects().clear();
this.addEffect(new ExileTopXMayPlayUntilEndOfTurnEffect(event.getAmount()));
return true;
}
@Override
public VirtueOfCourageTriggeredAbility copy() {
return new VirtueOfCourageTriggeredAbility(this);
}
@Override
public String getRule() {
return "whenever a source you control deals noncombat damage to an opponent, "
+ "you may exile that many cards from the top of your library. "
+ "You may play those cards this turn";
}
}

View file

@ -275,6 +275,7 @@ public final class WildsOfEldraine extends ExpansionSet {
cards.add(new SetCardInfo("Up the Beanstalk", 195, Rarity.UNCOMMON, mage.cards.u.UpTheBeanstalk.class));
cards.add(new SetCardInfo("Vantress Transmuter", 75, Rarity.COMMON, mage.cards.v.VantressTransmuter.class));
cards.add(new SetCardInfo("Verdant Outrider", 196, Rarity.COMMON, mage.cards.v.VerdantOutrider.class));
cards.add(new SetCardInfo("Virtue of Courage", 157, Rarity.MYTHIC, mage.cards.v.VirtueOfCourage.class));
cards.add(new SetCardInfo("Virtue of Knowledge", 76, Rarity.MYTHIC, mage.cards.v.VirtueOfKnowledge.class));
cards.add(new SetCardInfo("Virtue of Loyalty", 38, Rarity.MYTHIC, mage.cards.v.VirtueOfLoyalty.class));
cards.add(new SetCardInfo("Virtue of Persistence", 115, Rarity.MYTHIC, mage.cards.v.VirtueOfPersistence.class));