mirror of
https://github.com/correl/mage.git
synced 2025-04-03 01:08:59 -09:00
everything done except Quenchable Fire
This commit is contained in:
parent
5f843eefcf
commit
7d5e12d7ea
3 changed files with 88 additions and 23 deletions
Mage.Sets/src/mage/cards
|
@ -30,7 +30,6 @@ package mage.cards.c;
|
|||
import mage.abilities.Ability;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.effects.common.AttachEffect;
|
||||
import mage.abilities.effects.common.DamageTargetEffect;
|
||||
import mage.abilities.keyword.EnchantAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
|
@ -47,6 +46,10 @@ import mage.target.TargetPlayer;
|
|||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.filter.common.FilterPlaneswalkerPermanent;
|
||||
import mage.filter.predicate.permanent.ControllerIdPredicate;
|
||||
import mage.target.TargetPermanent;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -55,7 +58,7 @@ import java.util.UUID;
|
|||
public class CurseOfThePiercedHeart extends CardImpl {
|
||||
|
||||
public CurseOfThePiercedHeart(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{1}{R}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{R}");
|
||||
this.subtype.add(SubType.AURA, SubType.CURSE);
|
||||
|
||||
// Enchant player
|
||||
|
@ -82,7 +85,7 @@ public class CurseOfThePiercedHeart extends CardImpl {
|
|||
class CurseOfThePiercedHeartAbility extends TriggeredAbilityImpl {
|
||||
|
||||
public CurseOfThePiercedHeartAbility() {
|
||||
super(Zone.BATTLEFIELD, new DamageTargetEffect(1));
|
||||
super(Zone.BATTLEFIELD, new CurseOfThePiercedHeartEffect());
|
||||
}
|
||||
|
||||
public CurseOfThePiercedHeartAbility(final CurseOfThePiercedHeartAbility ability) {
|
||||
|
@ -114,7 +117,54 @@ class CurseOfThePiercedHeartAbility extends TriggeredAbilityImpl {
|
|||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "At the beginning of enchanted player's upkeep, Curse of the Pierced Heart deals 1 damage to that player.";
|
||||
return "At the beginning of enchanted player's upkeep, "
|
||||
+ "{this} deals 1 damage to that player or a planeswalker that player controls.";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class CurseOfThePiercedHeartEffect extends OneShotEffect {
|
||||
|
||||
public CurseOfThePiercedHeartEffect() {
|
||||
super(Outcome.Damage);
|
||||
this.staticText = "{this} deals 1 damage to that player or a planeswalker that player controls";
|
||||
}
|
||||
|
||||
public CurseOfThePiercedHeartEffect(final CurseOfThePiercedHeartEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CurseOfThePiercedHeartEffect copy() {
|
||||
return new CurseOfThePiercedHeartEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Permanent enchantment = game.getPermanent(source.getSourceId());
|
||||
if (controller == null || enchantment == null) {
|
||||
return false;
|
||||
}
|
||||
UUID opponentId = enchantment.getAttachedTo();
|
||||
Player opponent = game.getPlayer(opponentId);
|
||||
if (opponent == null) {
|
||||
return false;
|
||||
}
|
||||
if (game.getBattlefield().getAllActivePermanents(new FilterPlaneswalkerPermanent(), opponentId, game).size() > 0) {
|
||||
if (controller.chooseUse(Outcome.Damage, "Redirect to a planeswalker controlled by " + opponent.getLogName() + "?", source, game)) {
|
||||
FilterPlaneswalkerPermanent filter = new FilterPlaneswalkerPermanent("a planeswalker controlled by " + opponent.getLogName());
|
||||
filter.add(new ControllerIdPredicate(opponentId));
|
||||
TargetPermanent target = new TargetPermanent(1, 1, filter, false);
|
||||
if (target.choose(Outcome.Damage, controller.getId(), source.getSourceId(), game)) {
|
||||
Permanent permanent = game.getPermanent(target.getFirstTarget());
|
||||
if (permanent != null) {
|
||||
return permanent.damage(1, source.getSourceId(), game, false, true) > 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
opponent.damage(1, source.getSourceId(), game, false, true);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,7 +42,6 @@ import mage.constants.WatcherScope;
|
|||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.watchers.Watcher;
|
||||
|
||||
/**
|
||||
|
@ -52,7 +51,7 @@ import mage.watchers.Watcher;
|
|||
public class TheFallen extends CardImpl {
|
||||
|
||||
public TheFallen(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{B}{B}{B}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{B}{B}{B}");
|
||||
this.subtype.add(SubType.ZOMBIE);
|
||||
this.power = new MageInt(2);
|
||||
this.toughness = new MageInt(3);
|
||||
|
@ -75,7 +74,7 @@ class TheFallenEffect extends OneShotEffect {
|
|||
|
||||
public TheFallenEffect() {
|
||||
super(Outcome.Damage);
|
||||
this.staticText = "{this} deals 1 damage to each opponent it has dealt damage to this game";
|
||||
this.staticText = "{this} deals 1 damage to each opponent or planeswalker it has dealt damage to this game";
|
||||
}
|
||||
|
||||
public TheFallenEffect(final TheFallenEffect effect) {
|
||||
|
@ -90,13 +89,10 @@ class TheFallenEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
TheFallenWatcher watcher = (TheFallenWatcher) game.getState().getWatchers().get(TheFallenWatcher.class.getSimpleName());
|
||||
if (watcher != null && watcher.getPlayerDealtDamageThisGame(source.getSourceId()) != null) {
|
||||
for (UUID playerId : watcher.getPlayerDealtDamageThisGame(source.getSourceId())) {
|
||||
if (watcher != null && watcher.getPlayersAndWalkersDealtDamageThisGame(source.getSourceId()) != null) {
|
||||
for (UUID playerId : watcher.getPlayersAndWalkersDealtDamageThisGame(source.getSourceId())) {
|
||||
if (!source.getControllerId().equals(playerId)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
player.damage(1, source.getSourceId(), game, false, true);
|
||||
}
|
||||
game.damagePlayerOrPlaneswalker(playerId, 1, source.getSourceId(), game, false, true);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
@ -107,7 +103,7 @@ class TheFallenEffect extends OneShotEffect {
|
|||
|
||||
class TheFallenWatcher extends Watcher {
|
||||
|
||||
private Map<UUID, Set<UUID>> playersDealtDamageThisGame = new HashMap<>(); // Map<creatureId, Set<playerId>>
|
||||
private Map<UUID, Set<UUID>> playersAndWalkersDealtDamageThisGame = new HashMap<>(); // Map<creatureId, Set<playerId>>
|
||||
|
||||
public TheFallenWatcher() {
|
||||
super(TheFallenWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||
|
@ -115,28 +111,29 @@ class TheFallenWatcher extends Watcher {
|
|||
|
||||
public TheFallenWatcher(final TheFallenWatcher watcher) {
|
||||
super(watcher);
|
||||
playersDealtDamageThisGame = new HashMap<>(watcher.playersDealtDamageThisGame);
|
||||
playersAndWalkersDealtDamageThisGame = new HashMap<>(watcher.playersAndWalkersDealtDamageThisGame);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void watch(GameEvent event, Game game) {
|
||||
if (event.getType() == GameEvent.EventType.DAMAGED_PLAYER) {
|
||||
if (event.getType() == GameEvent.EventType.DAMAGED_PLAYER
|
||||
|| event.getType() == GameEvent.EventType.DAMAGED_PLANESWALKER) {
|
||||
Permanent permanent = game.getPermanentOrLKIBattlefield(event.getSourceId());
|
||||
if (permanent != null) {
|
||||
Set<UUID> toAdd;
|
||||
if (playersDealtDamageThisGame.get(event.getSourceId()) == null) {
|
||||
if (playersAndWalkersDealtDamageThisGame.get(event.getSourceId()) == null) {
|
||||
toAdd = new HashSet<>();
|
||||
} else {
|
||||
toAdd = playersDealtDamageThisGame.get(event.getSourceId());
|
||||
toAdd = playersAndWalkersDealtDamageThisGame.get(event.getSourceId());
|
||||
}
|
||||
toAdd.add(event.getPlayerId());
|
||||
playersDealtDamageThisGame.put(event.getSourceId(), toAdd);
|
||||
playersAndWalkersDealtDamageThisGame.put(event.getSourceId(), toAdd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Set<UUID> getPlayerDealtDamageThisGame(UUID creatureId) {
|
||||
return playersDealtDamageThisGame.get(creatureId);
|
||||
public Set<UUID> getPlayersAndWalkersDealtDamageThisGame(UUID creatureId) {
|
||||
return playersAndWalkersDealtDamageThisGame.get(creatureId);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -43,10 +43,14 @@ import mage.constants.CardType;
|
|||
import mage.constants.SubType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SuperType;
|
||||
import mage.filter.common.FilterPlaneswalkerPermanent;
|
||||
import mage.filter.predicate.permanent.ControllerIdPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.stack.Spell;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.util.RandomUtil;
|
||||
import mage.watchers.common.SpellsCastWatcher;
|
||||
|
||||
|
@ -119,7 +123,8 @@ class VialSmasherTheFierceTriggeredAbility extends SpellCastControllerTriggeredA
|
|||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "Whenever you cast your first spell each turn, {this} deals damage equal to that spell's converted mana cost to an opponent chosen at random.";
|
||||
return "Whenever you cast your first spell each turn, choose an opponent at random. "
|
||||
+ "{this} deals damage equal to that spell’s converted mana cost to that player or a planeswalker that player controls";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -127,7 +132,7 @@ class VialSmasherTheFierceEffect extends OneShotEffect {
|
|||
|
||||
public VialSmasherTheFierceEffect() {
|
||||
super(Outcome.Damage);
|
||||
this.staticText = "{this} deals damage equal to that spell's converted mana cost to an opponent chosen at random";
|
||||
this.staticText = "{this} choose an opponent at random. {this} deals damage equal to that spell’s converted mana cost to that player or a planeswalker that player controls";
|
||||
}
|
||||
|
||||
public VialSmasherTheFierceEffect(final VialSmasherTheFierceEffect effect) {
|
||||
|
@ -155,6 +160,19 @@ class VialSmasherTheFierceEffect extends OneShotEffect {
|
|||
Player opponent = game.getPlayer(opponentId);
|
||||
if (opponent != null) {
|
||||
game.informPlayers(opponent.getLogName() + " was chosen at random.");
|
||||
if (game.getBattlefield().getAllActivePermanents(new FilterPlaneswalkerPermanent(), opponentId, game).size() > 0) {
|
||||
if (controller.chooseUse(Outcome.Damage, "Redirect to a planeswalker controlled by " + opponent.getLogName() + "?", source, game)) {
|
||||
FilterPlaneswalkerPermanent filter = new FilterPlaneswalkerPermanent("a planeswalker controlled by " + opponent.getLogName());
|
||||
filter.add(new ControllerIdPredicate(opponent.getId()));
|
||||
TargetPermanent target = new TargetPermanent(1, 1, filter, false);
|
||||
if (target.choose(Outcome.Damage, controller.getId(), source.getSourceId(), game)) {
|
||||
Permanent permanent = game.getPermanent(target.getFirstTarget());
|
||||
if (permanent != null) {
|
||||
return permanent.damage(damage, source.getSourceId(), game, false, true) > 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
opponent.damage(damage, source.getSourceId(), game, false, true);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue