1
0
Fork 0
mirror of https://github.com/correl/mage.git synced 2025-04-12 17:00:08 -09:00

Some minor fixes and changes to framework.

This commit is contained in:
LevelX2 2014-04-18 17:31:17 +02:00
parent 33c5526eff
commit b2eb3a350e
4 changed files with 205 additions and 5 deletions

View file

@ -0,0 +1,104 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.abilities.effects.common;
import mage.abilities.Ability;
import mage.abilities.effects.PreventionEffectImpl;
import mage.constants.Duration;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
/**
*
* @author LevelX2
*/
public class PreventAllDamageByAttachedEffect extends PreventionEffectImpl<PreventAllDamageByAttachedEffect> {
private final String attachedDescription;
private final boolean combatOnly;
public PreventAllDamageByAttachedEffect(Duration duration, String attachedDescription, boolean combatOnly) {
super(duration);
this.attachedDescription = attachedDescription;
this.combatOnly = combatOnly;
staticText = setText();
}
public PreventAllDamageByAttachedEffect(final PreventAllDamageByAttachedEffect effect) {
super(effect);
this.attachedDescription = effect.attachedDescription;
this.combatOnly = effect.combatOnly;
}
@Override
public PreventAllDamageByAttachedEffect copy() {
return new PreventAllDamageByAttachedEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
return true;
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
GameEvent preventEvent = new GameEvent(GameEvent.EventType.PREVENT_DAMAGE, source.getFirstTarget(), source.getSourceId(), source.getControllerId(), event.getAmount(), false);
if (!game.replaceEvent(preventEvent)) {
int damage = event.getAmount();
event.setAmount(0);
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.PREVENTED_DAMAGE, source.getFirstTarget(), source.getSourceId(), source.getControllerId(), damage));
}
return false;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (super.applies(event, source, game)) {
Permanent attachment = game.getPermanent(source.getSourceId());
if (attachment != null && attachment.getAttachedTo() != null) {
if (event.getSourceId().equals(attachment.getAttachedTo())) {
return true;
}
}
}
return false;
}
private String setText() {
StringBuilder sb = new StringBuilder("prevent all ");
if (combatOnly) {
sb.append("combat ");
}
sb.append("damage that would be dealt by ");
sb.append(attachedDescription);
return sb.toString();
}
}

View file

@ -42,7 +42,7 @@ import mage.game.permanent.Permanent;
*/
public class RemoveCounterSourceEffect extends OneShotEffect<RemoveCounterSourceEffect> {
private Counter counter;
private final Counter counter;
public RemoveCounterSourceEffect(Counter counter) {
super(Outcome.UnboostCreature);

View file

@ -0,0 +1,96 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.abilities.effects.common.counter;
import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.constants.Outcome;
import mage.counters.Counter;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.util.CardUtil;
/**
*
* @author LevelX2
*/
public class RemoveCounterTargetEffect extends OneShotEffect<RemoveCounterTargetEffect> {
private final Counter counter;
public RemoveCounterTargetEffect(Counter counter) {
super(Outcome.UnboostCreature);
this.counter = counter;
}
public RemoveCounterTargetEffect(RemoveCounterTargetEffect effect) {
super(effect);
this.counter = effect.counter.copy();
}
@Override
public boolean apply(Game game, Ability source) {
Permanent p = game.getPermanent(targetPointer.getFirst(game, source));
if (p != null && p.getCounters().getCount(counter.getName()) >= counter.getCount()) {
p.removeCounters(counter.getName(), counter.getCount(), game);
game.informPlayers(new StringBuilder("Removed ").append(counter.getCount()).append(" ").append(counter.getName())
.append(" counter from ").append(p.getName()).toString());
return true;
}
Card c = game.getCard(targetPointer.getFirst(game, source));
if (c != null && c.getCounters().getCount(counter.getName()) >= counter.getCount()) {
c.removeCounters(counter.getName(), counter.getCount(), game);
game.informPlayers(new StringBuilder("Removed ").append(counter.getCount()).append(" ").append(counter.getName())
.append(" counter from ").append(c.getName())
.append(" (").append(c.getCounters().getCount(counter.getName())).append(" left)").toString());
return true;
}
return false;
}
@Override
public RemoveCounterTargetEffect copy() {
return new RemoveCounterTargetEffect(this);
}
@Override
public String getText(Mode mode) {
if (staticText != null && !staticText.isEmpty()) {
return staticText;
}
StringBuilder sb = new StringBuilder("remove ");
sb.append(CardUtil.numberToText(counter.getCount(), "a"));
sb.append(" ").append(counter.getName());
sb.append(counter.getCount() > 1 ?" counters from ":" counter from ");
sb.append(mode.getTargets().get(0).getTargetName());
return sb.toString();
}
}

View file

@ -23183,7 +23183,7 @@ Supply-Line Cranes|Journey into Nyx|28|C|{3}{W}{W}|Creature - Bird|2|4|Flying$Wh
Tethmos High Priest|Journey into Nyx|29|U|{2}{W}|Creature - Cat Cleric|2|3|Heroic — Whenever you cast a spell that targets Tethmos High Priest, return target creature card with converted mana cost 2 or less from your graveyard to the battlefield.|
Aerial Formation|Journey into Nyx|30|C|{U}|Instant|||Strive — Aerial Formation costs 2U more to cast for each target beyond the first.$Any number of target creatures each get +1/+1 and gain flying until end of turn.|
Battlefield Thaumaturge|Journey into Nyx|31|R|{1}{U}|Creature - Human Wizard|2|1|Each instant and sorcery spell you cast costs 1 less to cast for each creature it targets.$Heroic - Whenever you cast a spell that targets Battlefield Thaumaturge, Battlefield Thaumaturge gains hexproof until end of turn.|
Battlefield Thaumaturge|Journey into Nyx|32|R|{1}{U}|Creature - Human Wizard|2|1|Each instant and sorcery spell you cast costs 1 less to cast for each creature it targets.$Heroic - Whenever you cast a spell that targets Battlefield Thaumaturge, Battlefield Thaumaturge gains hexproof until end of turn.|
Cloaked Siren|Journey into Nyx|32|C|{3}{U}|Creature - Siren |3|2|Flash$Flying|
Countermand|Journey into Nyx|33|C|{2}{U}{U}|Instant|||Counter target spell. Its controller puts the top four cards of his or her library into his or her graveyard.|
Crystalline Nautilus|Journey into Nyx|34|U|{2}{U}|Enchantment Creature - Nautilus|4|4|Bestow 3UU (If you cast this card for its bestow cost, it's an Aura spell with enchant creature. It becomes a creature again if it's not attached to a creature.)$When Crystalline Nautilus becomes the target of a spell or ability, sacrifice it.$Enchanted creature gets +4/+4 and has "When this creature becomes the target of a spell or ability, sacrifice it."|
Dakra Mystic|Journey into Nyx|35|U|{U}|Creature - Merfolk Wizard|1|1|{U},{T}:Each player reveals the top card of his or her library. You may put the revealed cards into their owners graveyard. If you don't, each player draws a card.|
@ -23197,7 +23197,7 @@ Hypnotic Siren|Journey into Nyx|42|R|{U}|Enchantment Creature - Siren|1|1|Bestow
Interpret the Signs|Journey into Nyx|43|U|{5}{U}|Sorcery|||Scry 3, then reveal the top card of your library. Draw cards equal to that card's converted mana cost.|
Kiora's Dismissal|Journey into Nyx|44|R|{U}|Instant|||Strive — Kiora's Dismissal costs U more to cast for each target beyond the first.$Return any number of target enchantments to their owners' hands.|
Pin to the Earth|Journey into Nyx|45|C|{1}{U}|Enchantment - Aura|||Enchant creature$Enchanted creature gets -6/-0.|
Polymorphous Rush|Journey into Nyx|46|R|{2}{U}|Instant|||Strive Polymorphous Rush costs 1U more to cast for each target beyond the first.$Choose a creature on the battlefield. Any number of target creatures you control each become a copy of that creature until end of turn.|
Polymorphous Rush|Journey into Nyx|46|R|{2}{U}|Instant|||Strive - Polymorphous Rush costs 1U more to cast for each target beyond the first.$Choose a creature on the battlefield. Any number of target creatures you control each become a copy of that creature until end of turn.|
Pull from the Deep|Journey into Nyx|47|U|{2}{U}{U}|Sorcery|||Return up to one target instant card and up to one target sorcery card from your graveyard to your hand. Exile Pull from the Deep.|
Riptide Chimera|Journey into Nyx|48|U|{2}{U}|Enchantment Creature - Chimera|3|4|Flying$At the beginning of your upkeep, return an enchanment you control to its owner's hand.|
Rise of Eagles|Journey into Nyx|49|C|{4}{U}{U}|Sorcery|||Put two 2/2 blue Bird enchantment creature tokens with flying onto the battlefield. Scry 1.|
@ -23214,7 +23214,7 @@ Agent of Erebos|Journey into Nyx|59|U|{3}{B}|Enchantment Creature - Zombie|2|2|C
Aspect of Gorgon|Journey into Nyx|60|C|{2}{B}|Enchantment - Aura|||Enchant creature$Enchanted creature gets +1/+3 and has deathtouch.|
Bloodcrazed Hoplite|Journey into Nyx|61|C|{1}{B}|Creature - Human Soldier|2|1|Heroic - Whenever you cast a spell that targets Bloodcrazed Hoplite, put a +1/+1 counter on it.$Whenever a +1/+1 counter is placed on Bloodcrazed Hoplite, remove a +1/+1 counter from target creature an opponent controls.|
Brain Maggot|Journey into Nyx|62|U|{1}{B}|Enchantment Creature - Insect|1|1|When Brain Maggot enters the battlefield, target opponent reveals his or her hand and you choose a nonland card from it. Exile that card until Brain Maggot leaves the battlefield.|
Dictate of Erebos|Journey into Nyx|63|R|{3}{B}{B}|Enchantment|||Flash$Whenever a creature you control dies, each opponent sacrifices a creature.|
Cast into Darkness|Journey into Nyx|63|C|{1}{B}|Enchantment - Aura |||Enchant creature$Enchanted creature gets -2/-0 and can't block.|
Cruel Feeding|Journey into Nyx|64|C|{B}|Instant|||Strive - Cruel Feeding costs {2}{B} more to cast for each target beyond the first.$Any number of target creatures each get +1/+0 and gain lifelink until end of turn.|
Dictate of Erebos|Journey into Nyx|65|R|{3}{B}{B}|Enchantment|||Flash$Whenever a creature you control dies, each opponent sacrifices a creature.|
Doomwake Giant|Journey into Nyx|66|R|{4}{B}|Enchantment Creature - Giant|4|6|Constellation — When Doomwake Giant or another enchantment enters the battlefield under your control, creatures your opponents control get -1/-1 until end of turn.|
@ -23234,7 +23234,7 @@ Returned Reveler|Journey into Nyx|79|C|{1}{B}|Creature - Zombie Satyr|1|3|When R
Ritual of the Returned|Journey into Nyx|80|U|{3}{B}|Instant|||Exile target creature card from your graveyard. Put a black Zombie creature token onto the battlefield with power equal to the exiled card's power and toughness equal to the exiled card's toughness.|
Rotted Hulk|Journey into Nyx|81|C|{3}{B}|Creature - Elemental|2|5||
Silence the Believers|Journey into Nyx|82|R|{2}{B}{B}|Instant|||Strive — Silence the Believers costs 2B more to cast for each target beyond the first.$Exile any number of target creatures and all Auras attached to them.|
Spiteful Blow|Journey into Nyx|83||{4}{B}{B}|Sorcery|||Destroy target creature and target land.|
Spiteful Blow|Journey into Nyx|83|U|{4}{B}{B}|Sorcery|||Destroy target creature and target land.|
Squelching Leeches|Journey into Nyx|84|R|{2}{B}{B}|Creature - Leech|0|0|Squelching Leeches's power and toughness are each equal to the number of Swamps you control.|
Thoughtrender Lamia|Journey into Nyx|85|U|{4}{B}{B}|Enchantment Creature - Lamia|5|3|Constellation - Whenever Thoughtrender Lamia or another enchantment enters the battlefield under your control, each opponent discards a card.|
Tormented Thoughts|Journey into Nyx|86|U|{2}{B}|Sorcery|||As an additional cost to cast Tormented Thoughts, sacrifice a creature.$Target player discards a number of cards equal to the sacrificed creature's power.|