[WHO] Implement Davros, Dalek Creator (#11313)

This commit is contained in:
Susucre 2023-10-16 20:36:36 +02:00 committed by GitHub
parent 116767e234
commit 06dc5be2d8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 184 additions and 11 deletions

View file

@ -0,0 +1,168 @@
package mage.cards.d;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.BeginningOfEndStepTriggeredAbility;
import mage.abilities.condition.common.OpponentLostLifeCondition;
import mage.abilities.decorator.ConditionalOneShotEffect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.hint.Hint;
import mage.abilities.keyword.MenaceAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.choices.FaceVillainousChoice;
import mage.choices.VillainousChoice;
import mage.constants.*;
import mage.game.Game;
import mage.game.permanent.token.DalekToken;
import mage.players.Player;
import mage.watchers.common.PlayerLostLifeWatcher;
import java.util.Set;
import java.util.UUID;
/**
* @author Susucr
*/
public final class DavrosDalekCreator extends CardImpl {
public DavrosDalekCreator(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{1}{U}{B}{R}");
this.supertype.add(SuperType.LEGENDARY);
this.subtype.add(SubType.ALIEN);
this.subtype.add(SubType.SCIENTIST);
this.power = new MageInt(3);
this.toughness = new MageInt(4);
// Menace
this.addAbility(new MenaceAbility(false));
// At the beginning of your end step, create a 3/3 black Dalek artifact creature token with menace if an opponent lost 3 or more life this turn. Then each opponent who lost 3 or more life this turn faces a villainous choice -- You draw a card, or that player discards a card.
Ability ability = new BeginningOfEndStepTriggeredAbility(
new ConditionalOneShotEffect(
new CreateTokenEffect(new DalekToken()),
new OpponentLostLifeCondition(ComparisonType.OR_GREATER, 3)
),
TargetController.YOU, false
);
ability.addHint(DavrosDalekCreatorHint.instance);
ability.addEffect(new DavrosDalekCreatorEffect());
this.addAbility(ability);
}
private DavrosDalekCreator(final DavrosDalekCreator card) {
super(card);
}
@Override
public DavrosDalekCreator copy() {
return new DavrosDalekCreator(this);
}
}
enum DavrosDalekCreatorHint implements Hint {
instance;
@Override
public String getText(Game game, Ability ability) {
if (!game.isActivePlayer(ability.getControllerId())) {
return "";
}
PlayerLostLifeWatcher watcher = game.getState().getWatcher(PlayerLostLifeWatcher.class);
String sep = "";
String hint = "Opponents that lost 3 or more this turn: [";
Set<UUID> opponents = game.getOpponents(ability.getControllerId());
if (watcher != null) {
for (UUID playerId : game.getState().getPlayersInRange(ability.getControllerId(), game)) {
if (!opponents.contains(playerId)) {
continue;
}
int lostLive = watcher.getLifeLost(playerId);
if (lostLive >= 3) {
Player player = game.getPlayer(playerId);
if (player != null) {
hint += sep + player.getName();
sep = ", ";
}
}
}
}
return hint + "]";
}
@Override
public Hint copy() {
return instance;
}
}
class DavrosDalekCreatorEffect extends OneShotEffect {
private static final FaceVillainousChoice choice = new FaceVillainousChoice(
Outcome.Detriment, new DavrosDalekCreatorFirstChoice(), new DavrosDalekCreatorSecondChoice()
);
DavrosDalekCreatorEffect() {
super(Outcome.Benefit);
staticText = "Then each opponent who lost 3 or more life this turn " + choice.generateRule();
}
private DavrosDalekCreatorEffect(final DavrosDalekCreatorEffect effect) {
super(effect);
}
@Override
public DavrosDalekCreatorEffect copy() {
return new DavrosDalekCreatorEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
PlayerLostLifeWatcher watcher = game.getState().getWatcher(PlayerLostLifeWatcher.class);
Set<UUID> opponents = game.getOpponents(source.getControllerId());
if (watcher != null) {
for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) {
if (!opponents.contains(playerId)) {
continue;
}
int lostLive = watcher.getLifeLost(playerId);
if (lostLive >= 3) {
Player player = game.getPlayer(playerId);
if (player != null) {
choice.faceChoice(player, game, source);
}
}
}
}
return true;
}
}
class DavrosDalekCreatorFirstChoice extends VillainousChoice {
DavrosDalekCreatorFirstChoice() {
super("You draw a card", "{controller} draws a card");
}
@Override
public boolean doChoice(Player player, Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
return controller != null && controller.drawCards(1, source, game) > 0;
}
}
class DavrosDalekCreatorSecondChoice extends VillainousChoice {
DavrosDalekCreatorSecondChoice() {
super("that player discards a card", "you discard a card");
}
@Override
public boolean doChoice(Player player, Game game, Ability source) {
return !player.discard(1, false, false, source, game).isEmpty();
}
}

View file

@ -1,6 +1,5 @@
package mage.cards.s;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.BeginningOfEndStepTriggeredAbility;
import mage.abilities.condition.common.OpponentLostLifeCondition;
@ -8,21 +7,17 @@ import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.hint.ConditionHint;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.ComparisonType;
import mage.constants.SuperType;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.constants.*;
import java.util.UUID;
/**
*
* @author LevelX2
*/
public final class SyggRiverCutthroat extends CardImpl {
public SyggRiverCutthroat(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{U/B}{U/B}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{U/B}{U/B}");
this.supertype.add(SuperType.LEGENDARY);
this.subtype.add(SubType.MERFOLK);
this.subtype.add(SubType.ROGUE);
@ -34,9 +29,12 @@ public final class SyggRiverCutthroat extends CardImpl {
this.addAbility(new BeginningOfEndStepTriggeredAbility(Zone.BATTLEFIELD,
new DrawCardSourceControllerEffect(1),
TargetController.ANY,
new OpponentLostLifeCondition(ComparisonType.MORE_THAN, 2),
new OpponentLostLifeCondition(ComparisonType.OR_GREATER, 3),
true
).addHint(new ConditionHint(new OpponentLostLifeCondition(ComparisonType.MORE_THAN, 2), "An opponent lost 3 or more life this turn")));
).addHint(new ConditionHint(
new OpponentLostLifeCondition(ComparisonType.OR_GREATER, 3),
"An opponent lost 3 or more life this turn"
)));
}
private SyggRiverCutthroat(final SyggRiverCutthroat card) {

View file

@ -61,6 +61,7 @@ public final class DoctorWho extends ExpansionSet {
cards.add(new SetCardInfo("Dalek Squadron", 65, Rarity.UNCOMMON, mage.cards.d.DalekSquadron.class));
cards.add(new SetCardInfo("Dan Lewis", 78, Rarity.RARE, mage.cards.d.DanLewis.class));
cards.add(new SetCardInfo("Darkwater Catacombs", 269, Rarity.RARE, mage.cards.d.DarkwaterCatacombs.class));
cards.add(new SetCardInfo("Davros, Dalek Creator", 1, Rarity.MYTHIC, mage.cards.d.DavrosDalekCreator.class));
cards.add(new SetCardInfo("Day of Destiny", 206, Rarity.RARE, mage.cards.d.DayOfDestiny.class));
cards.add(new SetCardInfo("Decaying Time Loop", 80, Rarity.UNCOMMON, mage.cards.d.DecayingTimeLoop.class));
cards.add(new SetCardInfo("Delete", 81, Rarity.RARE, mage.cards.d.Delete.class));

View file

@ -42,12 +42,18 @@ public class OpponentLostLifeCondition extends IntCompareCondition {
case MORE_THAN:
sb.append(value + 1).append(" or more life this turn");
break;
case OR_GREATER:
sb.append(value).append(" or more life this turn");
break;
case EQUAL_TO:
sb.append(value).append(" life this turn");
break;
case FEWER_THAN:
sb.append(" less than ").append(value).append(" life this turn");
break;
case OR_LESS:
sb.append(value).append(" or less life this turn");
break;
}
return sb.toString();
}