[ORI] Added Sigil of Valor and Pyromancer's Goggles.

This commit is contained in:
LevelX2 2015-07-05 20:32:36 +02:00
parent a61dd323e6
commit d7f9e07386
5 changed files with 447 additions and 183 deletions

View file

@ -0,0 +1,129 @@
/*
* 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.sets.magicorigins;
import java.util.UUID;
import mage.ObjectColor;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.CopyTargetSpellEffect;
import mage.abilities.mana.RedManaAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.common.FilterInstantOrSorcerySpell;
import mage.filter.predicate.mageobject.ColorPredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.stack.Spell;
import mage.target.targetpointer.FixedTarget;
/**
*
* @author LevelX2
*/
public class PyromancersGoggles extends CardImpl {
public PyromancersGoggles(UUID ownerId) {
super(ownerId, 236, "Pyromancer's Goggles", Rarity.MYTHIC, new CardType[]{CardType.ARTIFACT}, "{5}");
this.expansionSetCode = "ORI";
this.supertype.add("Legendary");
// {T}: Add {R} to your mana pool.
Ability ability = new RedManaAbility();
this.addAbility(ability);
// When that mana is used to cast a red instant or sorcery spell, copy that spell and you may choose new targets for the copy.
Effect effect = new CopyTargetSpellEffect();
effect.setText("copy that spell and you may choose new targets for the copy");
this.addAbility(new PyromancersGogglesTriggeredAbility(ability.getOriginalId(), effect));
}
public PyromancersGoggles(final PyromancersGoggles card) {
super(card);
}
@Override
public PyromancersGoggles copy() {
return new PyromancersGoggles(this);
}
}
class PyromancersGogglesTriggeredAbility extends TriggeredAbilityImpl {
private final static FilterInstantOrSorcerySpell filter = new FilterInstantOrSorcerySpell();
static {
filter.add(new ColorPredicate(ObjectColor.RED));
}
String abilityOriginalId;
public PyromancersGogglesTriggeredAbility(UUID abilityOriginalId, Effect effect) {
super(Zone.ALL, effect, true);
this.abilityOriginalId = abilityOriginalId.toString();
}
public PyromancersGogglesTriggeredAbility(final PyromancersGogglesTriggeredAbility ability) {
super(ability);
this.abilityOriginalId = ability.abilityOriginalId;
}
@Override
public PyromancersGogglesTriggeredAbility copy() {
return new PyromancersGogglesTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType().equals(EventType.MANA_PAYED);
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getData().equals(abilityOriginalId)) {
Spell spell = game.getStack().getSpell(event.getTargetId());
if (spell != null && filter.match(spell, getControllerId(), game)) {
for (Effect effect : getEffects()) {
effect.setTargetPointer(new FixedTarget(event.getTargetId()));
}
return true;
}
}
return false;
}
@Override
public String getRule() {
return "When that mana is used to cast a red instant or sorcery spell, " + super.getRule();
}
}

View file

@ -0,0 +1,154 @@
/*
* 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.sets.magicorigins;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.continuous.BoostTargetEffect;
import mage.abilities.keyword.EquipAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardIdPredicate;
import static mage.filter.predicate.permanent.ControllerControlsIslandPredicate.filter;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.target.targetpointer.FixedTarget;
/**
*
* @author LevelX2
*/
public class SigilOfValor extends CardImpl {
public SigilOfValor(UUID ownerId) {
super(ownerId, 239, "Sigil of Valor", Rarity.UNCOMMON, new CardType[]{CardType.ARTIFACT}, "{2}");
this.expansionSetCode = "ORI";
this.subtype.add("Equipment");
// Whenever equipped creature attacks alone, it gets +1/+1 until end of turn for each other creature you control.
this.addAbility(new SigilOfValorTriggeredAbility(new SigilOfValorCount()));
// Equip {1}
this.addAbility(new EquipAbility(Outcome.AddAbility, new GenericManaCost(1)));
}
public SigilOfValor(final SigilOfValor card) {
super(card);
}
@Override
public SigilOfValor copy() {
return new SigilOfValor(this);
}
}
class SigilOfValorTriggeredAbility extends TriggeredAbilityImpl {
public SigilOfValorTriggeredAbility(DynamicValue boostValue) {
super(Zone.BATTLEFIELD, new BoostTargetEffect(boostValue, boostValue, Duration.EndOfTurn));
}
public SigilOfValorTriggeredAbility(final SigilOfValorTriggeredAbility ability) {
super(ability);
}
@Override
public SigilOfValorTriggeredAbility copy() {
return new SigilOfValorTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DECLARED_ATTACKERS;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (game.getActivePlayerId().equals(this.controllerId)) {
if (game.getCombat().attacksAlone()) {
this.getEffects().get(0).setTargetPointer(new FixedTarget(game.getCombat().getAttackers().get(0)));
return true;
}
}
return false;
}
@Override
public String getRule() {
return "Whenever equipped creature attacks alone, it gets +1/+1 until end of turn for each other creature you control.";
}
}
class SigilOfValorCount implements DynamicValue {
public SigilOfValorCount() {
}
public SigilOfValorCount(final SigilOfValorCount dynamicValue) {
super();
}
@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
Permanent equipment = game.getPermanent(sourceAbility.getSourceId());
if (equipment != null && equipment.getAttachedTo() != null) {
FilterPermanent filterPermanent = new FilterControlledCreaturePermanent();
filterPermanent.add(Predicates.not(new CardIdPredicate(equipment.getAttachedTo())));
return game.getBattlefield().count(filterPermanent, sourceAbility.getSourceId(), sourceAbility.getControllerId(), game);
}
return 0;
}
@Override
public DynamicValue copy() {
return new SigilOfValorCount(this);
}
@Override
public String toString() {
return "X";
}
@Override
public String getMessage() {
return filter.getMessage();
}
}

View file

@ -1,38 +1,36 @@
/* /*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without modification, are * Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met: * permitted provided that the following conditions are met:
* *
* 1. Redistributions of source code must retain the above copyright notice, this list of * 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer. * conditions and the following disclaimer.
* *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list * 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 * of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution. * provided with the distribution.
* *
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED * 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 * 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 * 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 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 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 * 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 * 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 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
* The views and conclusions contained in the software and documentation are those of the * 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 * authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com. * or implied, of BetaSteward_at_googlemail.com.
*/ */
package mage.abilities.effects.common; package mage.abilities.effects.common;
import mage.constants.Outcome;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.Mode; import mage.abilities.Mode;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.constants.Outcome;
import mage.constants.Zone; import mage.constants.Zone;
import mage.game.Game; import mage.game.Game;
import mage.game.stack.Spell; import mage.game.stack.Spell;
@ -82,8 +80,11 @@ public class CopyTargetSpellEffect extends OneShotEffect {
return new CopyTargetSpellEffect(this); return new CopyTargetSpellEffect(this);
} }
@Override @Override
public String getText(Mode mode) { public String getText(Mode mode) {
if (staticText != null && !staticText.isEmpty()) {
return staticText;
}
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append("copy target ").append(mode.getTargets().get(0).getTargetName()).append(". You may choose new targets for the copy"); sb.append("copy target ").append(mode.getTargets().get(0).getTargetName()).append(". You may choose new targets for the copy");
return sb.toString(); return sb.toString();

View file

@ -1,40 +1,38 @@
/* /*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without modification, are * Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met: * permitted provided that the following conditions are met:
* *
* 1. Redistributions of source code must retain the above copyright notice, this list of * 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer. * conditions and the following disclaimer.
* *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list * 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 * of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution. * provided with the distribution.
* *
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED * 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 * 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 * 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 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 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 * 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 * 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 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
* The views and conclusions contained in the software and documentation are those of the * 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 * authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com. * or implied, of BetaSteward_at_googlemail.com.
*/ */
package mage.abilities.keyword; package mage.abilities.keyword;
import mage.constants.Duration;
import mage.constants.Zone;
import mage.abilities.TriggeredAbilityImpl; import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.common.continuous.BoostTargetEffect; import mage.abilities.effects.common.continuous.BoostTargetEffect;
import mage.constants.Duration;
import mage.constants.Zone;
import mage.game.Game; import mage.game.Game;
import mage.game.events.GameEvent; import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.target.targetpointer.FixedTarget; import mage.target.targetpointer.FixedTarget;
/** /**
@ -63,7 +61,7 @@ public class ExaltedAbility extends TriggeredAbilityImpl {
@Override @Override
public boolean checkTrigger(GameEvent event, Game game) { public boolean checkTrigger(GameEvent event, Game game) {
if (game.getActivePlayerId().equals(this.controllerId) ) { if (game.getActivePlayerId().equals(this.controllerId)) {
if (game.getCombat().attacksAlone()) { if (game.getCombat().attacksAlone()) {
this.getEffects().get(0).setTargetPointer(new FixedTarget(game.getCombat().getAttackers().get(0))); this.getEffects().get(0).setTargetPointer(new FixedTarget(game.getCombat().getAttackers().get(0)));
return true; return true;
@ -74,7 +72,7 @@ public class ExaltedAbility extends TriggeredAbilityImpl {
@Override @Override
public String getRule() { public String getRule() {
return "Exalted"; return "Exalted <i>(Whenever a creature you control attacks alone, that creature gets +1/+1 until end of turn.)</i>";
} }
} }

View file

@ -1,31 +1,30 @@
/* /*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without modification, are * Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met: * permitted provided that the following conditions are met:
* *
* 1. Redistributions of source code must retain the above copyright notice, this list of * 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer. * conditions and the following disclaimer.
* *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list * 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 * of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution. * provided with the distribution.
* *
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED * 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 * 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 * 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 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 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 * 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 * 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 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
* The views and conclusions contained in the software and documentation are those of the * 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 * authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com. * or implied, of BetaSteward_at_googlemail.com.
*/ */
package mage.game.events; package mage.game.events;
import java.io.Serializable; import java.io.Serializable;
@ -54,7 +53,6 @@ public class GameEvent implements Serializable {
//Game events //Game events
BEGINNING, BEGINNING,
PREVENT_DAMAGE, PREVENTED_DAMAGE, PREVENT_DAMAGE, PREVENTED_DAMAGE,
//Turn-based events //Turn-based events
PLAY_TURN, EXTRA_TURN, PLAY_TURN, EXTRA_TURN,
CHANGE_PHASE, PHASE_CHANGED, CHANGE_PHASE, PHASE_CHANGED,
@ -78,15 +76,14 @@ public class GameEvent implements Serializable {
CLEANUP_STEP_PRE, CLEANUP_STEP, CLEANUP_STEP_POST, CLEANUP_STEP_PRE, CLEANUP_STEP, CLEANUP_STEP_POST,
EMPTY_MANA_POOL, EMPTY_MANA_POOL,
AT_END_OF_TURN, AT_END_OF_TURN,
//player events //player events
/* ZONE_CHANGE /* ZONE_CHANGE
targetId id of the zone changing object targetId id of the zone changing object
sourceId sourceId of the ability with the object moving effect sourceId sourceId of the ability with the object moving effect
playerId controller of the moved object playerId controller of the moved object
amount not used for this event amount not used for this event
flag not used for this event flag not used for this event
*/ */
ZONE_CHANGE, ZONE_CHANGE,
ZONE_CHANGE_GROUP, ZONE_CHANGE_GROUP,
EMPTY_DRAW, EMPTY_DRAW,
@ -96,77 +93,69 @@ public class GameEvent implements Serializable {
DISCARDED_CARD, DISCARDED_CARD,
CYCLE_CARD, CYCLED_CARD, CYCLE_CARD, CYCLED_CARD,
CLASH, CLASHED, CLASH, CLASHED,
DAMAGE_PLAYER, DAMAGE_PLAYER,
/* DAMAGED_PLAYER /* DAMAGED_PLAYER
targetId the id of the damged player targetId the id of the damged player
sourceId sourceId of the ability which caused the damage sourceId sourceId of the ability which caused the damage
playerId the id of the damged player playerId the id of the damged player
amount amount of damage amount amount of damage
flag true = comabat damage - other damage = false flag true = comabat damage - other damage = false
*/ */
DAMAGED_PLAYER, DAMAGED_PLAYER,
DAMAGE_CAUSES_LIFE_LOSS, DAMAGE_CAUSES_LIFE_LOSS,
PLAYER_LIFE_CHANGE, PLAYER_LIFE_CHANGE,
GAIN_LIFE, GAINED_LIFE, GAIN_LIFE, GAINED_LIFE,
LOSE_LIFE, LOST_LIFE, LOSE_LIFE, LOST_LIFE,
PLAY_LAND, LAND_PLAYED, PLAY_LAND, LAND_PLAYED,
CAST_SPELL, CAST_SPELL,
/* SPELL_CAST /* SPELL_CAST
targetId id of the spell that's cast targetId id of the spell that's cast
sourceId sourceId of the spell that's cast sourceId sourceId of the spell that's cast
playerId player that casts the spell playerId player that casts the spell
amount not used for this event amount not used for this event
flag not used for this event flag not used for this event
zone zone the spell is cast from zone zone the spell is cast from
*/ */
SPELL_CAST, SPELL_CAST,
ACTIVATE_ABILITY, ACTIVATED_ABILITY, ACTIVATE_ABILITY, ACTIVATED_ABILITY,
ADD_MANA, MANA_ADDED, ADD_MANA, MANA_ADDED,
/* MANA_PAYED /* MANA_PAYED
targetId id if the ability the mana was paid for (not the sourceId) targetId id if the ability the mana was paid for (not the sourceId)
sourceId sourceId of the mana source sourceId sourceId of the mana source
playerId controller of the ability the mana was paid for playerId controller of the ability the mana was paid for
amount not used for this event amount not used for this event
flag indicates a special condition flag indicates a special condition
*/ data originalId of the mana producing ability
MANA_PAYED, */
MANA_PAYED,
LOSES, LOST, WINS, LOSES, LOST, WINS,
TARGET, TARGETED, TARGET, TARGETED,
/* COUNTER /* COUNTER
targetId id of the spell or id of stack ability targetId id of the spell or id of stack ability
sourceId sourceId of the ability countering the spell or stack ability sourceId sourceId of the ability countering the spell or stack ability
playerId controller of the countered spell or stack ability playerId controller of the countered spell or stack ability
amount not used for this event amount not used for this event
flag not used for this event flag not used for this event
*/ */
COUNTER, COUNTER,
COUNTERED, COUNTERED,
DECLARING_ATTACKERS, DECLARED_ATTACKERS, DECLARING_ATTACKERS, DECLARED_ATTACKERS,
DECLARE_ATTACKER, DECLARE_ATTACKER,
/* ATTACKER_DECLARED /* ATTACKER_DECLARED
targetId id of the defending player or planeswalker attacked targetId id of the defending player or planeswalker attacked
sourceId id of the attacking creature sourceId id of the attacking creature
playerId player defining the attacking creatures playerId player defining the attacking creatures
amount not used for this event amount not used for this event
flag not used for this event flag not used for this event
*/ */
ATTACKER_DECLARED, ATTACKER_DECLARED,
/* DECLARING_BLOCKERS /* DECLARING_BLOCKERS
targetId attackerId targetId attackerId
sourceId not used for this event sourceId not used for this event
playerId attackerId playerId attackerId
amount not used for this event amount not used for this event
flag not used for this event flag not used for this event
*/ */
DECLARING_BLOCKERS, DECLARING_BLOCKERS,
DECLARED_BLOCKERS, DECLARED_BLOCKERS,
DECLARE_BLOCKER, BLOCKER_DECLARED, DECLARE_BLOCKER, BLOCKER_DECLARED,
@ -176,7 +165,6 @@ public class GameEvent implements Serializable {
ENCHANT_PLAYER, ENCHANTED_PLAYER, ENCHANT_PLAYER, ENCHANTED_PLAYER,
CAN_TAKE_MULLIGAN, CAN_TAKE_MULLIGAN,
FLIP_COIN, COIN_FLIPPED, SCRY, FATESEAL, FLIP_COIN, COIN_FLIPPED, SCRY, FATESEAL,
//permanent events //permanent events
ENTERS_THE_BATTLEFIELD, ENTERS_THE_BATTLEFIELD,
TAP, TAPPED, TAPPED_FOR_MANA, TAP, TAPPED, TAPPED_FOR_MANA,
@ -192,17 +180,15 @@ public class GameEvent implements Serializable {
TURNFACEDOWN, TURNEDFACEDOWN, TURNFACEDOWN, TURNEDFACEDOWN,
DAMAGE_CREATURE, DAMAGED_CREATURE, DAMAGE_CREATURE, DAMAGED_CREATURE,
DAMAGE_PLANESWALKER, DAMAGED_PLANESWALKER, DAMAGE_PLANESWALKER, DAMAGED_PLANESWALKER,
DESTROY_PERMANENT, DESTROY_PERMANENT,
/* DESTROYED_PERMANENT /* DESTROYED_PERMANENT
targetId id of the destroyed creature targetId id of the destroyed creature
sourceId sourceId of the ability with the destroy effect sourceId sourceId of the ability with the destroy effect
playerId controller of the creature playerId controller of the creature
amount not used for this event amount not used for this event
flag true if no regeneration is allowed flag true if no regeneration is allowed
*/ */
DESTROYED_PERMANENT, DESTROYED_PERMANENT,
SACRIFICE_PERMANENT, SACRIFICED_PERMANENT, SACRIFICE_PERMANENT, SACRIFICED_PERMANENT,
FIGHTED_PERMANENT, FIGHTED_PERMANENT,
EXPLOITED_CREATURE, EXPLOITED_CREATURE,
@ -211,31 +197,27 @@ public class GameEvent implements Serializable {
ADD_COUNTER, COUNTER_ADDED, ADD_COUNTER, COUNTER_ADDED,
ADD_COUNTERS, COUNTERS_ADDED, ADD_COUNTERS, COUNTERS_ADDED,
COUNTER_REMOVED, COUNTER_REMOVED,
LOSE_CONTROL, LOSE_CONTROL,
/* LOST_CONTROL /* LOST_CONTROL
targetId id of the creature that lost control targetId id of the creature that lost control
sourceId id of the creature that lost control sourceId id of the creature that lost control
playerId player that controlles the creature before playerId player that controlles the creature before
amount not used for this event amount not used for this event
flag not used for this event flag not used for this event
*/ */
LOST_CONTROL, LOST_CONTROL,
GAIN_CONTROL, GAINED_CONTROL, GAIN_CONTROL, GAINED_CONTROL,
CREATE_TOKEN, CREATE_TOKEN,
/* REGENERATE /* REGENERATE
targetId id of the creature to regenerate targetId id of the creature to regenerate
sourceId sourceId of the effect doing the regeneration sourceId sourceId of the effect doing the regeneration
playerId controller of the creature playerId controller of the creature
amount not used for this event amount not used for this event
flag not used for this event flag not used for this event
*/ */
REGENERATE, REGENERATE,
REGENERATED, REGENERATED,
CHANGE_COLOR, COLOR_CHANGED, CHANGE_COLOR, COLOR_CHANGED,
//combat events //combat events
COMBAT_DAMAGE_APPLIED, COMBAT_DAMAGE_APPLIED,
SELECTED_ATTACKER, SELECTED_BLOCKER; SELECTED_ATTACKER, SELECTED_BLOCKER;
@ -268,7 +250,7 @@ public class GameEvent implements Serializable {
} }
public static GameEvent getEvent(EventType type, UUID targetId, UUID playerId, String data, int amount) { public static GameEvent getEvent(EventType type, UUID targetId, UUID playerId, String data, int amount) {
GameEvent event = getEvent(type, targetId,playerId); GameEvent event = getEvent(type, targetId, playerId);
event.setAmount(amount); event.setAmount(amount);
event.setData(data); event.setData(data);
return event; return event;
@ -310,7 +292,6 @@ public class GameEvent implements Serializable {
this.flag = flag; this.flag = flag;
} }
public String getData() { public String getData() {
return data; return data;
} }
@ -326,17 +307,18 @@ public class GameEvent implements Serializable {
public void setZone(Zone zone) { public void setZone(Zone zone) {
this.zone = zone; this.zone = zone;
} }
/** /**
* used to store which replacement effects were already applied to an event * used to store which replacement effects were already applied to an event
* or or any modified events that may replace it * or or any modified events that may replace it
* *
* 614.5. A replacement effect doesn't invoke itself repeatedly; it gets only one * 614.5. A replacement effect doesn't invoke itself repeatedly; it gets
* opportunity to affect an event or any modified events that may replace it. * only one opportunity to affect an event or any modified events that may
* Example: A player controls two permanents, each with an ability that reads * replace it. Example: A player controls two permanents, each with an
* "If a creature you control would deal damage to a creature or player, it * ability that reads "If a creature you control would deal damage to a
* deals double that damage to that creature or player instead." A creature * creature or player, it deals double that damage to that creature or
* that normally deals 2 damage will deal 8 damage--not just 4, and not an * player instead." A creature that normally deals 2 damage will deal 8
* infinite amount. * damage--not just 4, and not an infinite amount.
* *
* @return * @return
*/ */