mirror of
https://github.com/correl/mage.git
synced 2025-01-13 11:01:58 +00:00
- Added Diseased Vermin and Fatal Lore.
This commit is contained in:
parent
77bee43673
commit
7a58c21ef1
3 changed files with 464 additions and 205 deletions
166
Mage.Sets/src/mage/cards/d/DiseasedVermin.java
Normal file
166
Mage.Sets/src/mage/cards/d/DiseasedVermin.java
Normal file
|
@ -0,0 +1,166 @@
|
||||||
|
package mage.cards.d;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.UUID;
|
||||||
|
import mage.MageInt;
|
||||||
|
import mage.abilities.Ability;
|
||||||
|
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
|
||||||
|
import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility;
|
||||||
|
import mage.abilities.effects.OneShotEffect;
|
||||||
|
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
||||||
|
import mage.constants.SubType;
|
||||||
|
import mage.cards.CardImpl;
|
||||||
|
import mage.cards.CardSetInfo;
|
||||||
|
import mage.constants.CardType;
|
||||||
|
import mage.constants.Outcome;
|
||||||
|
import mage.constants.TargetController;
|
||||||
|
import mage.constants.WatcherScope;
|
||||||
|
import mage.constants.Zone;
|
||||||
|
import mage.counters.CounterType;
|
||||||
|
import mage.filter.FilterOpponent;
|
||||||
|
import mage.filter.predicate.ObjectSourcePlayer;
|
||||||
|
import mage.filter.predicate.ObjectSourcePlayerPredicate;
|
||||||
|
import mage.game.Game;
|
||||||
|
import mage.game.events.GameEvent;
|
||||||
|
import mage.game.events.GameEvent.EventType;
|
||||||
|
import mage.game.permanent.Permanent;
|
||||||
|
import mage.players.Player;
|
||||||
|
import mage.target.TargetPlayer;
|
||||||
|
import mage.watchers.Watcher;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author jeffwadsworth
|
||||||
|
*/
|
||||||
|
public final class DiseasedVermin extends CardImpl {
|
||||||
|
|
||||||
|
public DiseasedVermin(UUID ownerId, CardSetInfo setInfo) {
|
||||||
|
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{B}");
|
||||||
|
|
||||||
|
this.subtype.add(SubType.RAT);
|
||||||
|
this.power = new MageInt(1);
|
||||||
|
this.toughness = new MageInt(1);
|
||||||
|
|
||||||
|
// Whenever Diseased Vermin deals combat damage to a player, put an infection counter on it.
|
||||||
|
this.addAbility(new DealsCombatDamageToAPlayerTriggeredAbility(
|
||||||
|
new AddCountersSourceEffect(
|
||||||
|
CounterType.INFECTION.createInstance()),
|
||||||
|
false));
|
||||||
|
|
||||||
|
// At the beginning of your upkeep, Diseased Vermin deals X damage to target opponent previously dealt damage by it, where X is the number of infection counters on it.
|
||||||
|
Ability ability = new BeginningOfUpkeepTriggeredAbility(
|
||||||
|
Zone.BATTLEFIELD,
|
||||||
|
new DiseasedVerminEffect(),
|
||||||
|
TargetController.YOU,
|
||||||
|
false);
|
||||||
|
ability.addWatcher(new DiseasedVerminWatcher());
|
||||||
|
this.addAbility(ability);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private DiseasedVermin(final DiseasedVermin card) {
|
||||||
|
super(card);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DiseasedVermin copy() {
|
||||||
|
return new DiseasedVermin(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class DiseasedVerminEffect extends OneShotEffect {
|
||||||
|
|
||||||
|
static final FilterOpponent filter = new FilterOpponent("player previously dealt damage by {this}");
|
||||||
|
|
||||||
|
static {
|
||||||
|
filter.add(new DiseasedVerminPredicate());
|
||||||
|
}
|
||||||
|
|
||||||
|
public DiseasedVerminEffect() {
|
||||||
|
super(Outcome.Benefit);
|
||||||
|
this.staticText = "{this} deals X damage to target opponent previously dealt damage by it, where X is the number of infection counters on it";
|
||||||
|
}
|
||||||
|
|
||||||
|
public DiseasedVerminEffect(final DiseasedVerminEffect effect) {
|
||||||
|
super(effect);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DiseasedVerminEffect copy() {
|
||||||
|
return new DiseasedVerminEffect(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean apply(Game game, Ability source) {
|
||||||
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
|
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
|
||||||
|
if (sourcePermanent != null
|
||||||
|
&& controller != null) {
|
||||||
|
TargetPlayer targetOpponent = new TargetPlayer(1, 1, false, filter);
|
||||||
|
if (targetOpponent.canChoose(controller.getId(), game)
|
||||||
|
&& controller.choose(Outcome.Damage, targetOpponent, source.getSourceId(), game)) {
|
||||||
|
Player opponent = game.getPlayer(targetOpponent.getFirstTarget());
|
||||||
|
if (opponent != null
|
||||||
|
&& sourcePermanent.getCounters(game).getCount(CounterType.INFECTION) > 0) {
|
||||||
|
opponent.damage(
|
||||||
|
sourcePermanent.getCounters(game).getCount(CounterType.INFECTION),
|
||||||
|
source.getSourceId(), game, false, true);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class DiseasedVerminPredicate implements ObjectSourcePlayerPredicate<ObjectSourcePlayer<Player>> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean apply(ObjectSourcePlayer<Player> input, Game game) {
|
||||||
|
DiseasedVerminWatcher watcher = game.getState().getWatcher(DiseasedVerminWatcher.class);
|
||||||
|
if (watcher != null) {
|
||||||
|
return watcher.hasSourceDoneDamage(input.getObject().getId(), game);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "(Player previously dealt damage by {source})";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class DiseasedVerminWatcher extends Watcher {
|
||||||
|
|
||||||
|
// does not reset!!
|
||||||
|
private final Set<UUID> damagedPlayers;
|
||||||
|
|
||||||
|
public DiseasedVerminWatcher() {
|
||||||
|
super(DiseasedVerminWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||||
|
damagedPlayers = new HashSet<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public DiseasedVerminWatcher(final DiseasedVerminWatcher watcher) {
|
||||||
|
super(watcher);
|
||||||
|
this.damagedPlayers = new HashSet<>();
|
||||||
|
this.damagedPlayers.addAll(watcher.damagedPlayers);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DiseasedVerminWatcher copy() {
|
||||||
|
return new DiseasedVerminWatcher(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void watch(GameEvent event, Game game) {
|
||||||
|
if (event.getType() == EventType.DAMAGED_PLAYER
|
||||||
|
&& event.getSourceId() == sourceId) {
|
||||||
|
damagedPlayers.add(event.getTargetId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasSourceDoneDamage(UUID playerId, Game game) {
|
||||||
|
return damagedPlayers.contains(playerId);
|
||||||
|
}
|
||||||
|
}
|
91
Mage.Sets/src/mage/cards/f/FatalLore.java
Normal file
91
Mage.Sets/src/mage/cards/f/FatalLore.java
Normal file
|
@ -0,0 +1,91 @@
|
||||||
|
package mage.cards.f;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
import mage.abilities.Ability;
|
||||||
|
import mage.abilities.dynamicvalue.common.StaticValue;
|
||||||
|
import mage.abilities.effects.Effect;
|
||||||
|
import mage.abilities.effects.OneShotEffect;
|
||||||
|
import mage.abilities.effects.common.DestroyTargetEffect;
|
||||||
|
import mage.abilities.effects.common.DrawCardTargetEffect;
|
||||||
|
import mage.cards.CardImpl;
|
||||||
|
import mage.cards.CardSetInfo;
|
||||||
|
import mage.constants.CardType;
|
||||||
|
import mage.constants.Outcome;
|
||||||
|
import mage.filter.common.FilterCreaturePermanent;
|
||||||
|
import mage.filter.predicate.permanent.ControllerIdPredicate;
|
||||||
|
import mage.game.Game;
|
||||||
|
import mage.players.Player;
|
||||||
|
import mage.target.common.TargetCreaturePermanent;
|
||||||
|
import mage.target.common.TargetOpponent;
|
||||||
|
import mage.target.targetpointer.FixedTarget;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author jeffwadsworth
|
||||||
|
*/
|
||||||
|
public final class FatalLore extends CardImpl {
|
||||||
|
|
||||||
|
public FatalLore(UUID ownerId, CardSetInfo setInfo) {
|
||||||
|
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{B}{B}");
|
||||||
|
|
||||||
|
// An opponent chooses one - You draw three cards; or you destroy up to two target creatures that opponent controls and that player draws up to three cards. Those creatures can't be regenerated.
|
||||||
|
this.getSpellAbility().addEffect(new FatalLoreEffect());
|
||||||
|
this.getSpellAbility().addTarget(new TargetOpponent(true));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private FatalLore(final FatalLore card) {
|
||||||
|
super(card);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FatalLore copy() {
|
||||||
|
return new FatalLore(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class FatalLoreEffect extends OneShotEffect {
|
||||||
|
|
||||||
|
public FatalLoreEffect() {
|
||||||
|
super(Outcome.Neutral);
|
||||||
|
staticText = "An opponent chooses one - You draw three cards; or you destroy up to two target creatures that opponent controls and that player draws up to three cards. Those creatures can't be regenerated";
|
||||||
|
}
|
||||||
|
|
||||||
|
public FatalLoreEffect(final FatalLoreEffect effect) {
|
||||||
|
super(effect);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FatalLoreEffect copy() {
|
||||||
|
return new FatalLoreEffect(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean apply(Game game, Ability source) {
|
||||||
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
|
Player chosenOpponent = game.getPlayer(targetPointer.getFirst(game, source));
|
||||||
|
if (controller != null
|
||||||
|
&& chosenOpponent != null) {
|
||||||
|
if (chosenOpponent.chooseUse(Outcome.Neutral, "If you choose Yes, the controller draws three cards. If no, the controller gets to destroy up to two target creatures that you control and you get to draw up to 3 cards. Those creatures can't be regenerated.", source, game)) {
|
||||||
|
controller.drawCards(3, game);
|
||||||
|
} else {
|
||||||
|
FilterCreaturePermanent filter = new FilterCreaturePermanent("chosen opponent's creature");
|
||||||
|
filter.add(new ControllerIdPredicate(chosenOpponent.getId()));
|
||||||
|
TargetCreaturePermanent target = new TargetCreaturePermanent(0, 2, filter, false);
|
||||||
|
if (target.canChoose(controller.getId(), game)
|
||||||
|
&& controller.choose(Outcome.DestroyPermanent, target, source.getSourceId(), game)) {
|
||||||
|
for (UUID targetId : target.getTargets()) {
|
||||||
|
Effect destroyCreature = new DestroyTargetEffect(true);
|
||||||
|
destroyCreature.setTargetPointer(new FixedTarget(targetId));
|
||||||
|
destroyCreature.apply(game, source);
|
||||||
|
}
|
||||||
|
Effect opponentDrawsCards = new DrawCardTargetEffect(new StaticValue(3), false, true);
|
||||||
|
opponentDrawsCards.setTargetPointer(new FixedTarget(chosenOpponent.getId()));
|
||||||
|
opponentDrawsCards.apply(game, source);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
|
@ -53,6 +53,7 @@ public final class Alliances extends ExpansionSet {
|
||||||
cards.add(new SetCardInfo("Deadly Insect", "86b", Rarity.COMMON, mage.cards.d.DeadlyInsect.class, NON_FULL_USE_VARIOUS));
|
cards.add(new SetCardInfo("Deadly Insect", "86b", Rarity.COMMON, mage.cards.d.DeadlyInsect.class, NON_FULL_USE_VARIOUS));
|
||||||
cards.add(new SetCardInfo("Death Spark", 70, Rarity.UNCOMMON, mage.cards.d.DeathSpark.class));
|
cards.add(new SetCardInfo("Death Spark", 70, Rarity.UNCOMMON, mage.cards.d.DeathSpark.class));
|
||||||
cards.add(new SetCardInfo("Diminishing Returns", 26, Rarity.RARE, mage.cards.d.DiminishingReturns.class));
|
cards.add(new SetCardInfo("Diminishing Returns", 26, Rarity.RARE, mage.cards.d.DiminishingReturns.class));
|
||||||
|
cards.add(new SetCardInfo("Diseased Vermin", 46, Rarity.UNCOMMON, mage.cards.d.DiseasedVermin.class));
|
||||||
cards.add(new SetCardInfo("Dystopia", 47, Rarity.RARE, mage.cards.d.Dystopia.class));
|
cards.add(new SetCardInfo("Dystopia", 47, Rarity.RARE, mage.cards.d.Dystopia.class));
|
||||||
cards.add(new SetCardInfo("Elvish Bard", 87, Rarity.UNCOMMON, mage.cards.e.ElvishBard.class));
|
cards.add(new SetCardInfo("Elvish Bard", 87, Rarity.UNCOMMON, mage.cards.e.ElvishBard.class));
|
||||||
cards.add(new SetCardInfo("Elvish Ranger", "88a", Rarity.COMMON, mage.cards.e.ElvishRanger.class, NON_FULL_USE_VARIOUS));
|
cards.add(new SetCardInfo("Elvish Ranger", "88a", Rarity.COMMON, mage.cards.e.ElvishRanger.class, NON_FULL_USE_VARIOUS));
|
||||||
|
@ -66,6 +67,7 @@ public final class Alliances extends ExpansionSet {
|
||||||
cards.add(new SetCardInfo("Exile", 3, Rarity.RARE, mage.cards.e.Exile.class));
|
cards.add(new SetCardInfo("Exile", 3, Rarity.RARE, mage.cards.e.Exile.class));
|
||||||
cards.add(new SetCardInfo("False Demise", "27a", Rarity.COMMON, mage.cards.f.FalseDemise.class, NON_FULL_USE_VARIOUS));
|
cards.add(new SetCardInfo("False Demise", "27a", Rarity.COMMON, mage.cards.f.FalseDemise.class, NON_FULL_USE_VARIOUS));
|
||||||
cards.add(new SetCardInfo("False Demise", "27b", Rarity.COMMON, mage.cards.f.FalseDemise.class, NON_FULL_USE_VARIOUS));
|
cards.add(new SetCardInfo("False Demise", "27b", Rarity.COMMON, mage.cards.f.FalseDemise.class, NON_FULL_USE_VARIOUS));
|
||||||
|
cards.add(new SetCardInfo("Fatal Lore", 48, Rarity.RARE, mage.cards.f.FatalLore.class));
|
||||||
cards.add(new SetCardInfo("Feast or Famine", "49a", Rarity.COMMON, mage.cards.f.FeastOrFamine.class, NON_FULL_USE_VARIOUS));
|
cards.add(new SetCardInfo("Feast or Famine", "49a", Rarity.COMMON, mage.cards.f.FeastOrFamine.class, NON_FULL_USE_VARIOUS));
|
||||||
cards.add(new SetCardInfo("Feast or Famine", "49b", Rarity.COMMON, mage.cards.f.FeastOrFamine.class, NON_FULL_USE_VARIOUS));
|
cards.add(new SetCardInfo("Feast or Famine", "49b", Rarity.COMMON, mage.cards.f.FeastOrFamine.class, NON_FULL_USE_VARIOUS));
|
||||||
cards.add(new SetCardInfo("Fevered Strength", "50a", Rarity.COMMON, mage.cards.f.FeveredStrength.class, NON_FULL_USE_VARIOUS));
|
cards.add(new SetCardInfo("Fevered Strength", "50a", Rarity.COMMON, mage.cards.f.FeveredStrength.class, NON_FULL_USE_VARIOUS));
|
||||||
|
|
Loading…
Reference in a new issue