diff --git a/Mage.Client/src/main/java/mage/client/chat/ChatPanel.java b/Mage.Client/src/main/java/mage/client/chat/ChatPanel.java index d50bae53d9c..f43581e693b 100644 --- a/Mage.Client/src/main/java/mage/client/chat/ChatPanel.java +++ b/Mage.Client/src/main/java/mage/client/chat/ChatPanel.java @@ -277,7 +277,7 @@ public class ChatPanel extends javax.swing.JPanel { public void useExtendedView(VIEW_MODE extendedViewMode) { this.extendedViewMode = extendedViewMode; - this.txtConversation.setExtBackgroundColor(new Color(0, 0, 0, 100)); + this.txtConversation.setExtBackgroundColor(new Color(0, 0, 0, 255)); // Alpha = 255 not transparent // this.txtConversation.setBackground(new Color(0, 0, 0, 0)); // this.txtConversation.setForeground(new Color(255, 255, 255)); this.txtConversation.setSelectionColor(Color.LIGHT_GRAY); diff --git a/Mage.Sets/src/mage/sets/betrayersofkamigawa/RoninCliffrider.java b/Mage.Sets/src/mage/sets/betrayersofkamigawa/RoninCliffrider.java index 4c6161c8648..c8ce779faf1 100644 --- a/Mage.Sets/src/mage/sets/betrayersofkamigawa/RoninCliffrider.java +++ b/Mage.Sets/src/mage/sets/betrayersofkamigawa/RoninCliffrider.java @@ -1,4 +1,4 @@ -/* + /* * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are diff --git a/Mage.Sets/src/mage/sets/betrayersofkamigawa/ShinkaGatekeeper.java b/Mage.Sets/src/mage/sets/betrayersofkamigawa/ShinkaGatekeeper.java new file mode 100644 index 00000000000..3211ea61e0f --- /dev/null +++ b/Mage.Sets/src/mage/sets/betrayersofkamigawa/ShinkaGatekeeper.java @@ -0,0 +1,102 @@ +/* + * 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.betrayersofkamigawa; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.DealtDamageToSourceTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.game.Game; +import mage.players.Player; + +/** + * + * @author LevelX2 + */ +public class ShinkaGatekeeper extends CardImpl { + + public ShinkaGatekeeper(UUID ownerId) { + super(ownerId, 117, "Shinka Gatekeeper", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{2}{R}"); + this.expansionSetCode = "BOK"; + this.subtype.add("Ogre"); + this.subtype.add("Warrior"); + + this.color.setRed(true); + this.power = new MageInt(3); + this.toughness = new MageInt(2); + + // Whenever Shinka Gatekeeper is dealt damage, it deals that much damage to you. + this.addAbility(new DealtDamageToSourceTriggeredAbility(Zone.BATTLEFIELD, new ShinkaGatekeeperDealDamageEffect(), false)); + } + + public ShinkaGatekeeper(final ShinkaGatekeeper card) { + super(card); + } + + @Override + public ShinkaGatekeeper copy() { + return new ShinkaGatekeeper(this); + } +} + + +class ShinkaGatekeeperDealDamageEffect extends OneShotEffect { + + public ShinkaGatekeeperDealDamageEffect() { + super(Outcome.Damage); + this.staticText = "it deals that much damage to you"; + } + + public ShinkaGatekeeperDealDamageEffect(final ShinkaGatekeeperDealDamageEffect effect) { + super(effect); + } + + @Override + public ShinkaGatekeeperDealDamageEffect copy() { + return new ShinkaGatekeeperDealDamageEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + int amount = (Integer) getValue("damage"); + if (amount > 0) { + Player player = game.getPlayer(source.getControllerId()); + if (player != null) { + player.damage(amount, source.getSourceId(), game, false, true); + return true; + } + } + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/betrayersofkamigawa/TwistAllegiance.java b/Mage.Sets/src/mage/sets/betrayersofkamigawa/TwistAllegiance.java new file mode 100644 index 00000000000..d48c8311099 --- /dev/null +++ b/Mage.Sets/src/mage/sets/betrayersofkamigawa/TwistAllegiance.java @@ -0,0 +1,114 @@ +/* + * 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.betrayersofkamigawa; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.effects.ContinuousEffect; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.continious.GainAbilityTargetEffect; +import mage.abilities.effects.common.continious.GainControlTargetEffect; +import mage.abilities.keyword.HasteAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.filter.common.FilterCreaturePermanent; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.target.common.TargetOpponent; +import mage.target.targetpointer.FixedTarget; + +/** + * + * @author LevelX2 + */ +public class TwistAllegiance extends CardImpl { + + public TwistAllegiance(UUID ownerId) { + super(ownerId, 120, "Twist Allegiance", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{6}{R}"); + this.expansionSetCode = "BOK"; + + this.color.setRed(true); + + // You and target opponent each gain control of all creatures the other controls until end of turn. Untap those creatures. Those creatures gain haste until end of turn. + this.getSpellAbility().addEffect(new TwistAllegianceEffect()); + this.getSpellAbility().addTarget(new TargetOpponent()); + } + + public TwistAllegiance(final TwistAllegiance card) { + super(card); + } + + @Override + public TwistAllegiance copy() { + return new TwistAllegiance(this); + } +} + +class TwistAllegianceEffect extends OneShotEffect { + + public TwistAllegianceEffect() { + super(Outcome.Detriment); + this.staticText = "You and target opponent each gain control of all creatures the other controls until end of turn. Untap those creatures. Those creatures gain haste until end of turn"; + } + + public TwistAllegianceEffect(final TwistAllegianceEffect effect) { + super(effect); + } + + @Override + public TwistAllegianceEffect copy() { + return new TwistAllegianceEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + Player targetOpponent = game.getPlayer(getTargetPointer().getFirst(game, source)); + if (controller != null) { + for (Permanent permanent: game.getBattlefield().getActivePermanents(new FilterCreaturePermanent(), source.getControllerId(), source.getSourceId(), game)) { + // only creatures of controller & target opponent + if (permanent.getControllerId().equals(source.getControllerId()) || permanent.getControllerId().equals(targetOpponent.getId())) { + UUID newController = permanent.getControllerId().equals(source.getControllerId()) ? targetOpponent.getId() : source.getControllerId(); + ContinuousEffect effect = new GainControlTargetEffect(Duration.EndOfTurn, true, newController); + effect.setTargetPointer(new FixedTarget(permanent.getId())); + game.addEffect(effect, source); + permanent.untap(game); + effect = new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.EndOfTurn); + effect.setTargetPointer(new FixedTarget(permanent.getId())); + game.addEffect(effect, source); + } + } + return true; + } + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/betrayersofkamigawa/WardOfPiety.java b/Mage.Sets/src/mage/sets/betrayersofkamigawa/WardOfPiety.java new file mode 100644 index 00000000000..04372078295 --- /dev/null +++ b/Mage.Sets/src/mage/sets/betrayersofkamigawa/WardOfPiety.java @@ -0,0 +1,141 @@ +/* + * 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.betrayersofkamigawa; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.PreventionEffectData; +import mage.abilities.effects.PreventionEffectImpl; +import mage.abilities.effects.common.AttachEffect; +import mage.abilities.keyword.EnchantAbility; +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.game.Game; +import mage.game.events.GameEvent; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.target.TargetPermanent; +import mage.target.common.TargetCreatureOrPlayer; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author LevelX2 + */ +public class WardOfPiety extends CardImpl { + + public WardOfPiety(UUID ownerId) { + super(ownerId, 28, "Ward of Piety", Rarity.UNCOMMON, new CardType[]{CardType.ENCHANTMENT}, "{1}{W}"); + this.expansionSetCode = "BOK"; + this.subtype.add("Aura"); + + this.color.setWhite(true); + + // Enchant creature + TargetPermanent auraTarget = new TargetCreaturePermanent(); + this.getSpellAbility().addTarget(auraTarget); + this.getSpellAbility().addEffect(new AttachEffect(Outcome.PreventDamage)); + Ability ability = new EnchantAbility(auraTarget.getTargetName()); + this.addAbility(ability); + + // {1}{W}: The next 1 damage that would be dealt to enchanted creature this turn is dealt to target creature or player instead. + ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new WardOfPietyPreventDamageTargetEffect(), new ManaCostsImpl("{1}{W}")); + ability.addTarget(new TargetCreatureOrPlayer()); + this.addAbility(ability); + } + + public WardOfPiety(final WardOfPiety card) { + super(card); + } + + @Override + public WardOfPiety copy() { + return new WardOfPiety(this); + } +} + +class WardOfPietyPreventDamageTargetEffect extends PreventionEffectImpl { + + public WardOfPietyPreventDamageTargetEffect() { + super(Duration.EndOfTurn, 1, false, true); + staticText = "The next 1 damage that would be dealt to enchanted creature this turn is dealt to target creature or player instead"; + } + + public WardOfPietyPreventDamageTargetEffect(final WardOfPietyPreventDamageTargetEffect effect) { + super(effect); + } + + @Override + public WardOfPietyPreventDamageTargetEffect copy() { + return new WardOfPietyPreventDamageTargetEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + return true; + } + + @Override + public boolean replaceEvent(GameEvent event, Ability source, Game game) { + PreventionEffectData preventionData = preventDamageAction(event, source, game); + // deal damage now + if (preventionData.getPreventedDamage() > 0) { + Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source)); + if (permanent != null) { + game.informPlayers("Dealing " + preventionData.getPreventedDamage() + " damage to " + permanent.getLogName() + " instead"); + // keep the original source id as it is redirecting + permanent.damage(preventionData.getPreventedDamage(), event.getSourceId(), game, false, true); + } + Player player = game.getPlayer(getTargetPointer().getFirst(game, source)); + if (player != null) { + game.informPlayers("Dealing " + preventionData.getPreventedDamage() + " damage to " + player.getName() + " instead"); + // keep the original source id as it is redirecting + player.damage(preventionData.getPreventedDamage(), event.getSourceId(), game, false, true); + } + } + return false; + } + + @Override + public boolean applies(GameEvent event, Ability source, Game game) { + if (super.applies(event, source, game)) { + Permanent enchantment = game.getPermanent(source.getSourceId()); + if (enchantment != null && event.getTargetId().equals(enchantment.getAttachedTo())) { + return true; + } + } + return false; + } + +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/magic2010/HarmsWay.java b/Mage.Sets/src/mage/sets/magic2010/HarmsWay.java index 6f81bb49ec6..7ff3ddb4c9b 100644 --- a/Mage.Sets/src/mage/sets/magic2010/HarmsWay.java +++ b/Mage.Sets/src/mage/sets/magic2010/HarmsWay.java @@ -100,7 +100,7 @@ class HarmsWayPreventDamageTargetEffect extends PreventionEffectImpl { UUID redirectTo = source.getTargets().get(1).getFirstTarget(); Permanent permanent = game.getPermanent(redirectTo); if (permanent != null) { - game.informPlayers("Dealing " + preventionData.getPreventedDamage() + " to " + permanent.getName() + " instead"); + game.informPlayers("Dealing " + preventionData.getPreventedDamage() + " to " + permanent.getLogName() + " instead"); // keep the original source id as it is redirecting permanent.damage(preventionData.getPreventedDamage(), event.getSourceId(), game, false, true); } @@ -110,14 +110,13 @@ class HarmsWayPreventDamageTargetEffect extends PreventionEffectImpl { // keep the original source id as it is redirecting player.damage(preventionData.getPreventedDamage(), event.getSourceId(), game, false, true); } - } + } return false; } @Override public boolean applies(GameEvent event, Ability source, Game game) { if (!this.used && super.applies(event, source, game)) { - // check source MageObject object = game.getObject(event.getSourceId()); if (object == null) { @@ -125,8 +124,8 @@ class HarmsWayPreventDamageTargetEffect extends PreventionEffectImpl { return false; } - if (!object.getId().equals(source.getFirstTarget()) && - (!(object instanceof Spell) || !((Spell) object).getSourceId().equals(source.getFirstTarget()))) { + if (!object.getId().equals(source.getFirstTarget()) + && (!(object instanceof Spell) || !((Spell) object).getSourceId().equals(source.getFirstTarget()))) { return false; } @@ -152,3 +151,4 @@ class HarmsWayPreventDamageTargetEffect extends PreventionEffectImpl { } } + diff --git a/Mage.Sets/src/mage/sets/tempest/JackalPup.java b/Mage.Sets/src/mage/sets/tempest/JackalPup.java index 0396bc53b4e..3af46ed3481 100644 --- a/Mage.Sets/src/mage/sets/tempest/JackalPup.java +++ b/Mage.Sets/src/mage/sets/tempest/JackalPup.java @@ -28,24 +28,22 @@ package mage.sets.tempest; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; import mage.MageInt; import mage.abilities.Ability; -import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.common.DealtDamageToSourceTriggeredAbility; import mage.abilities.effects.OneShotEffect; import mage.cards.CardImpl; +import mage.constants.CardType; import mage.constants.Outcome; +import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; -import mage.game.events.GameEvent; import mage.players.Player; /** * * @author jeffwadsworth - + * */ public class JackalPup extends CardImpl { @@ -59,8 +57,8 @@ public class JackalPup extends CardImpl { this.toughness = new MageInt(1); // Whenever Jackal Pup is dealt damage, it deals that much damage to you. - this.addAbility(new JackalPupTriggeredAbility()); - + this.addAbility(new DealtDamageToSourceTriggeredAbility(Zone.BATTLEFIELD, new JackalPupEffect(), false)); + } public JackalPup(final JackalPup card) { @@ -73,43 +71,12 @@ public class JackalPup extends CardImpl { } } -class JackalPupTriggeredAbility extends TriggeredAbilityImpl { - - public JackalPupTriggeredAbility() { - super(Zone.BATTLEFIELD, new JackalPupEffect()); - } - - public JackalPupTriggeredAbility(final JackalPupTriggeredAbility effect) { - super(effect); - } - - @Override - public JackalPupTriggeredAbility copy() { - return new JackalPupTriggeredAbility(this); - } - - @Override - public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.DAMAGED_CREATURE && event.getTargetId().equals(this.sourceId)) { - this.getEffects().get(0).setValue("damageAmount", event.getAmount()); - return true; - } - return false; - } - - @Override - public String getRule() { - return "Whenever {this} is dealt damage, " + super.getRule(); - } -} - - class JackalPupEffect extends OneShotEffect { - public JackalPupEffect() { - super(Outcome.Damage); - staticText = "it deals that much damage to you"; - } + public JackalPupEffect() { + super(Outcome.Damage); + staticText = "it deals that much damage to you"; + } public JackalPupEffect(final JackalPupEffect effect) { super(effect); @@ -124,10 +91,9 @@ class JackalPupEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player you = game.getPlayer(source.getControllerId()); if (you != null) { - you.damage((Integer) this.getValue("damageAmount"), source.getSourceId(), game, false, true); + you.damage((Integer) this.getValue("damage"), source.getSourceId(), game, false, true); } return true; } - -} \ No newline at end of file +} diff --git a/Mage.Sets/src/mage/sets/theros/FiredrinkerSatyr.java b/Mage.Sets/src/mage/sets/theros/FiredrinkerSatyr.java index 32bd7c51f44..d6bab31a03b 100644 --- a/Mage.Sets/src/mage/sets/theros/FiredrinkerSatyr.java +++ b/Mage.Sets/src/mage/sets/theros/FiredrinkerSatyr.java @@ -81,6 +81,7 @@ public class FiredrinkerSatyr extends CardImpl { return new FiredrinkerSatyr(this); } } + class FiredrinkerSatyrDealDamageEffect extends OneShotEffect { public FiredrinkerSatyrDealDamageEffect() {