[AFR] Implemented Warlock Class

This commit is contained in:
Evan Kranzler 2021-07-15 08:27:26 -04:00
parent 22066aa921
commit d33f233db2
2 changed files with 110 additions and 0 deletions

View file

@ -0,0 +1,109 @@
package mage.cards.w;
import mage.abilities.Ability;
import mage.abilities.common.BecomesClassLevelTriggeredAbility;
import mage.abilities.common.BeginningOfEndStepTriggeredAbility;
import mage.abilities.condition.common.MorbidCondition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.abilities.effects.common.LoseLifeOpponentsEffect;
import mage.abilities.hint.common.MorbidHint;
import mage.abilities.keyword.ClassLevelAbility;
import mage.abilities.keyword.ClassReminderAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.players.Player;
import mage.watchers.common.MorbidWatcher;
import mage.watchers.common.PlayerLostLifeWatcher;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class WarlockClass extends CardImpl {
public WarlockClass(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{B}");
this.subtype.add(SubType.CLASS);
// (Gain the next level as a sorcery to add its ability.)
this.addAbility(new ClassReminderAbility());
// At the beginning of your end step, if a creature died this turn, each opponent loses 1 life.
this.addAbility(new ConditionalInterveningIfTriggeredAbility(
new BeginningOfEndStepTriggeredAbility(
new LoseLifeOpponentsEffect(2), TargetController.YOU, false
), MorbidCondition.instance, "At the beginning of your end step, " +
"if a creature died this turn, each opponent loses 1 life."
).addHint(MorbidHint.instance), new MorbidWatcher());
// {1}{B}: Level 2
this.addAbility(new ClassLevelAbility(2, "{1}{B}"));
// When this Class becomes level 2, look at the top three cards of your library. Put one of them into your hand and the rest into your graveyard.
this.addAbility(new BecomesClassLevelTriggeredAbility(new LookLibraryAndPickControllerEffect(
StaticValue.get(1), false, StaticValue.get(1), StaticFilters.FILTER_CARD,
Zone.GRAVEYARD, false, false, false, Zone.HAND, false
), 2));
// {6}{B}: Level 3
this.addAbility(new ClassLevelAbility(3, "{6}{B}"));
// At the beginning of your end step, each opponent loses life equal to the life they lost this turn.
this.addAbility(new BeginningOfEndStepTriggeredAbility(
new WarlockClassEffect(), TargetController.YOU, false
));
}
private WarlockClass(final WarlockClass card) {
super(card);
}
@Override
public WarlockClass copy() {
return new WarlockClass(this);
}
}
class WarlockClassEffect extends OneShotEffect {
WarlockClassEffect() {
super(Outcome.Benefit);
staticText = "At the beginning of your end step, each opponent loses life equal to the life they lost this turn.";
}
private WarlockClassEffect(final WarlockClassEffect effect) {
super(effect);
}
@Override
public WarlockClassEffect copy() {
return new WarlockClassEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
PlayerLostLifeWatcher watcher = game.getState().getWatcher(PlayerLostLifeWatcher.class);
if (watcher == null) {
return false;
}
for (UUID playerId : game.getOpponents(source.getControllerId())) {
Player opponent = game.getPlayer(playerId);
if (opponent == null) {
continue;
}
int lifeLost = watcher.getLifeLost(playerId);
if (lifeLost > 0) {
opponent.loseLife(lifeLost, game, source, false);
}
}
return true;
}
}

View file

@ -244,6 +244,7 @@ public final class AdventuresInTheForgottenRealms extends ExpansionSet {
cards.add(new SetCardInfo("Volo, Guide to Monsters", 238, Rarity.RARE, mage.cards.v.VoloGuideToMonsters.class));
cards.add(new SetCardInfo("Vorpal Sword", 124, Rarity.RARE, mage.cards.v.VorpalSword.class));
cards.add(new SetCardInfo("Wandering Troubadour", 210, Rarity.UNCOMMON, mage.cards.w.WanderingTroubadour.class));
cards.add(new SetCardInfo("Warlock Class", 125, Rarity.UNCOMMON, mage.cards.w.WarlockClass.class));
cards.add(new SetCardInfo("Werewolf Pack Leader", 211, Rarity.RARE, mage.cards.w.WerewolfPackLeader.class));
cards.add(new SetCardInfo("Westgate Regent", 126, Rarity.RARE, mage.cards.w.WestgateRegent.class));
cards.add(new SetCardInfo("White Dragon", 41, Rarity.UNCOMMON, mage.cards.w.WhiteDragon.class));