diff --git a/Mage.Sets/src/mage/sets/magicorigins/PyromancersGoggles.java b/Mage.Sets/src/mage/sets/magicorigins/PyromancersGoggles.java new file mode 100644 index 0000000000..f9729a180d --- /dev/null +++ b/Mage.Sets/src/mage/sets/magicorigins/PyromancersGoggles.java @@ -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(); + } +} diff --git a/Mage.Sets/src/mage/sets/magicorigins/SigilOfValor.java b/Mage.Sets/src/mage/sets/magicorigins/SigilOfValor.java new file mode 100644 index 0000000000..4dc297988f --- /dev/null +++ b/Mage.Sets/src/mage/sets/magicorigins/SigilOfValor.java @@ -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(); + } +} diff --git a/Mage/src/mage/abilities/effects/common/CopyTargetSpellEffect.java b/Mage/src/mage/abilities/effects/common/CopyTargetSpellEffect.java index 6d02c2cb8e..fcec4c594c 100644 --- a/Mage/src/mage/abilities/effects/common/CopyTargetSpellEffect.java +++ b/Mage/src/mage/abilities/effects/common/CopyTargetSpellEffect.java @@ -1,38 +1,36 @@ /* -* 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. -*/ - - + * 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.constants.Outcome; import mage.abilities.Ability; import mage.abilities.Mode; import mage.abilities.effects.OneShotEffect; +import mage.constants.Outcome; import mage.constants.Zone; import mage.game.Game; import mage.game.stack.Spell; @@ -82,8 +80,11 @@ public class CopyTargetSpellEffect extends OneShotEffect { return new CopyTargetSpellEffect(this); } - @Override + @Override public String getText(Mode mode) { + if (staticText != null && !staticText.isEmpty()) { + return staticText; + } StringBuilder sb = new StringBuilder(); sb.append("copy target ").append(mode.getTargets().get(0).getTargetName()).append(". You may choose new targets for the copy"); return sb.toString(); diff --git a/Mage/src/mage/abilities/keyword/ExaltedAbility.java b/Mage/src/mage/abilities/keyword/ExaltedAbility.java index d35381cda9..bc0bd895a8 100644 --- a/Mage/src/mage/abilities/keyword/ExaltedAbility.java +++ b/Mage/src/mage/abilities/keyword/ExaltedAbility.java @@ -1,40 +1,38 @@ /* -* 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. -*/ - + * 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.keyword; -import mage.constants.Duration; -import mage.constants.Zone; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.common.continuous.BoostTargetEffect; +import mage.constants.Duration; +import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; -import mage.game.events.GameEvent.EventType; import mage.target.targetpointer.FixedTarget; /** @@ -63,7 +61,7 @@ public class ExaltedAbility extends TriggeredAbilityImpl { @Override public boolean checkTrigger(GameEvent event, Game game) { - if (game.getActivePlayerId().equals(this.controllerId) ) { + if (game.getActivePlayerId().equals(this.controllerId)) { if (game.getCombat().attacksAlone()) { this.getEffects().get(0).setTargetPointer(new FixedTarget(game.getCombat().getAttackers().get(0))); return true; @@ -74,7 +72,7 @@ public class ExaltedAbility extends TriggeredAbilityImpl { @Override public String getRule() { - return "Exalted"; + return "Exalted (Whenever a creature you control attacks alone, that creature gets +1/+1 until end of turn.)"; } } diff --git a/Mage/src/mage/game/events/GameEvent.java b/Mage/src/mage/game/events/GameEvent.java index 4b0c5223b6..10ccca9d24 100644 --- a/Mage/src/mage/game/events/GameEvent.java +++ b/Mage/src/mage/game/events/GameEvent.java @@ -1,31 +1,30 @@ /* -* 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. -*/ - + * 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.game.events; import java.io.Serializable; @@ -54,7 +53,6 @@ public class GameEvent implements Serializable { //Game events BEGINNING, PREVENT_DAMAGE, PREVENTED_DAMAGE, - //Turn-based events PLAY_TURN, EXTRA_TURN, CHANGE_PHASE, PHASE_CHANGED, @@ -78,15 +76,14 @@ public class GameEvent implements Serializable { CLEANUP_STEP_PRE, CLEANUP_STEP, CLEANUP_STEP_POST, EMPTY_MANA_POOL, AT_END_OF_TURN, - //player events /* ZONE_CHANGE - targetId id of the zone changing object - sourceId sourceId of the ability with the object moving effect - playerId controller of the moved object - amount not used for this event - flag not used for this event - */ + targetId id of the zone changing object + sourceId sourceId of the ability with the object moving effect + playerId controller of the moved object + amount not used for this event + flag not used for this event + */ ZONE_CHANGE, ZONE_CHANGE_GROUP, EMPTY_DRAW, @@ -96,77 +93,69 @@ public class GameEvent implements Serializable { DISCARDED_CARD, CYCLE_CARD, CYCLED_CARD, CLASH, CLASHED, - DAMAGE_PLAYER, - + DAMAGE_PLAYER, /* DAMAGED_PLAYER - targetId the id of the damged player - sourceId sourceId of the ability which caused the damage - playerId the id of the damged player - amount amount of damage - flag true = comabat damage - other damage = false - */ + targetId the id of the damged player + sourceId sourceId of the ability which caused the damage + playerId the id of the damged player + amount amount of damage + flag true = comabat damage - other damage = false + */ DAMAGED_PLAYER, - DAMAGE_CAUSES_LIFE_LOSS, PLAYER_LIFE_CHANGE, GAIN_LIFE, GAINED_LIFE, LOSE_LIFE, LOST_LIFE, PLAY_LAND, LAND_PLAYED, - CAST_SPELL, - + CAST_SPELL, /* SPELL_CAST - targetId id of the spell that's cast - sourceId sourceId of the spell that's cast - playerId player that casts the spell - amount not used for this event - flag not used for this event - zone zone the spell is cast from - */ + targetId id of the spell that's cast + sourceId sourceId of the spell that's cast + playerId player that casts the spell + amount not used for this event + flag not used for this event + zone zone the spell is cast from + */ SPELL_CAST, - ACTIVATE_ABILITY, ACTIVATED_ABILITY, - ADD_MANA, MANA_ADDED, - + ADD_MANA, MANA_ADDED, /* MANA_PAYED - targetId id if the ability the mana was paid for (not the sourceId) - sourceId sourceId of the mana source - playerId controller of the ability the mana was paid for - amount not used for this event - flag indicates a special condition - */ - MANA_PAYED, - + targetId id if the ability the mana was paid for (not the sourceId) + sourceId sourceId of the mana source + playerId controller of the ability the mana was paid for + amount not used for this event + flag indicates a special condition + data originalId of the mana producing ability + */ + MANA_PAYED, LOSES, LOST, WINS, TARGET, TARGETED, - /* COUNTER - targetId id of the spell or id of stack ability - sourceId sourceId of the ability countering the spell or stack ability - playerId controller of the countered spell or stack ability - amount not used for this event - flag not used for this event - */ + targetId id of the spell or id of stack ability + sourceId sourceId of the ability countering the spell or stack ability + playerId controller of the countered spell or stack ability + amount not used for this event + flag not used for this event + */ COUNTER, COUNTERED, DECLARING_ATTACKERS, DECLARED_ATTACKERS, DECLARE_ATTACKER, - /* ATTACKER_DECLARED - targetId id of the defending player or planeswalker attacked - sourceId id of the attacking creature - playerId player defining the attacking creatures - amount not used for this event - flag not used for this event - */ + targetId id of the defending player or planeswalker attacked + sourceId id of the attacking creature + playerId player defining the attacking creatures + amount not used for this event + flag not used for this event + */ ATTACKER_DECLARED, - /* DECLARING_BLOCKERS - targetId attackerId - sourceId not used for this event - playerId attackerId - amount not used for this event - flag not used for this event - */ + targetId attackerId + sourceId not used for this event + playerId attackerId + amount not used for this event + flag not used for this event + */ DECLARING_BLOCKERS, DECLARED_BLOCKERS, DECLARE_BLOCKER, BLOCKER_DECLARED, @@ -176,7 +165,6 @@ public class GameEvent implements Serializable { ENCHANT_PLAYER, ENCHANTED_PLAYER, CAN_TAKE_MULLIGAN, FLIP_COIN, COIN_FLIPPED, SCRY, FATESEAL, - //permanent events ENTERS_THE_BATTLEFIELD, TAP, TAPPED, TAPPED_FOR_MANA, @@ -192,17 +180,15 @@ public class GameEvent implements Serializable { TURNFACEDOWN, TURNEDFACEDOWN, DAMAGE_CREATURE, DAMAGED_CREATURE, DAMAGE_PLANESWALKER, DAMAGED_PLANESWALKER, - DESTROY_PERMANENT, - + DESTROY_PERMANENT, /* DESTROYED_PERMANENT - targetId id of the destroyed creature - sourceId sourceId of the ability with the destroy effect - playerId controller of the creature - amount not used for this event - flag true if no regeneration is allowed - */ + targetId id of the destroyed creature + sourceId sourceId of the ability with the destroy effect + playerId controller of the creature + amount not used for this event + flag true if no regeneration is allowed + */ DESTROYED_PERMANENT, - SACRIFICE_PERMANENT, SACRIFICED_PERMANENT, FIGHTED_PERMANENT, EXPLOITED_CREATURE, @@ -211,31 +197,27 @@ public class GameEvent implements Serializable { ADD_COUNTER, COUNTER_ADDED, ADD_COUNTERS, COUNTERS_ADDED, COUNTER_REMOVED, - LOSE_CONTROL, - + LOSE_CONTROL, /* LOST_CONTROL - targetId id of the creature that lost control - sourceId id of the creature that lost control - playerId player that controlles the creature before - amount not used for this event - flag not used for this event - */ + targetId id of the creature that lost control + sourceId id of the creature that lost control + playerId player that controlles the creature before + amount not used for this event + flag not used for this event + */ LOST_CONTROL, GAIN_CONTROL, GAINED_CONTROL, CREATE_TOKEN, - /* REGENERATE - targetId id of the creature to regenerate - sourceId sourceId of the effect doing the regeneration - playerId controller of the creature - amount not used for this event - flag not used for this event - */ + targetId id of the creature to regenerate + sourceId sourceId of the effect doing the regeneration + playerId controller of the creature + amount not used for this event + flag not used for this event + */ REGENERATE, - REGENERATED, CHANGE_COLOR, COLOR_CHANGED, - //combat events COMBAT_DAMAGE_APPLIED, 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) { - GameEvent event = getEvent(type, targetId,playerId); + GameEvent event = getEvent(type, targetId, playerId); event.setAmount(amount); event.setData(data); return event; @@ -310,7 +292,6 @@ public class GameEvent implements Serializable { this.flag = flag; } - public String getData() { return data; } @@ -326,17 +307,18 @@ public class GameEvent implements Serializable { public void setZone(Zone zone) { this.zone = zone; } + /** * used to store which replacement effects were already applied to an event * or or any modified events that may replace it * - * 614.5. A replacement effect doesn't invoke itself repeatedly; it gets only one - * opportunity to affect an event or any modified events that may replace it. - * Example: A player controls two permanents, each with an ability that reads - * "If a creature you control would deal damage to a creature or player, it - * deals double that damage to that creature or player instead." A creature - * that normally deals 2 damage will deal 8 damage--not just 4, and not an - * infinite amount. + * 614.5. A replacement effect doesn't invoke itself repeatedly; it gets + * only one opportunity to affect an event or any modified events that may + * replace it. Example: A player controls two permanents, each with an + * ability that reads "If a creature you control would deal damage to a + * creature or player, it deals double that damage to that creature or + * player instead." A creature that normally deals 2 damage will deal 8 + * damage--not just 4, and not an infinite amount. * * @return */