diff --git a/Mage/src/mage/Constants.java b/Mage/src/mage/Constants.java index 104b05fe56..62943c53ee 100644 --- a/Mage/src/mage/Constants.java +++ b/Mage/src/mage/Constants.java @@ -303,6 +303,7 @@ public final class Constants { BoostCreature(true), UnboostCreature(false), AddAbility(true), + LoseAbility(false), GainLife(true), ExtraTurn(true), BecomeCreature(true), diff --git a/Mage/src/mage/abilities/effects/common/continious/BecomesCreatureSourceEffect.java b/Mage/src/mage/abilities/effects/common/continious/BecomesCreatureSourceEffect.java index bb2c94c3ca..cd5f41d547 100644 --- a/Mage/src/mage/abilities/effects/common/continious/BecomesCreatureSourceEffect.java +++ b/Mage/src/mage/abilities/effects/common/continious/BecomesCreatureSourceEffect.java @@ -74,13 +74,19 @@ public class BecomesCreatureSourceEffect extends ContinuousEffectImpl 0) + if (token.getCardType().size() > 0) { for (Constants.CardType t : token.getCardType()) { - if (!permanent.getCardType().contains(t)) + if (!permanent.getCardType().contains(t)) { permanent.getCardType().add(t); + } } - if (token.getSubtype().size() > 0) + } + if (type == null) { + permanent.getSubtype().clear(); + } + if (token.getSubtype().size() > 0) { permanent.getSubtype().addAll(token.getSubtype()); + } } break; case ColorChangingEffects_5: diff --git a/Mage/src/mage/abilities/effects/common/continious/BecomesCreatureTargetEffect.java b/Mage/src/mage/abilities/effects/common/continious/BecomesCreatureTargetEffect.java index 8eb02217bf..5018bdcffc 100644 --- a/Mage/src/mage/abilities/effects/common/continious/BecomesCreatureTargetEffect.java +++ b/Mage/src/mage/abilities/effects/common/continious/BecomesCreatureTargetEffect.java @@ -27,6 +27,7 @@ */ package mage.abilities.effects.common.continious; +import mage.Constants; import mage.Constants.Duration; import mage.Constants.Layer; import mage.Constants.Outcome; @@ -72,10 +73,19 @@ public class BecomesCreatureTargetEffect extends ContinuousEffectImpl 0) - permanent.getCardType().addAll(token.getCardType()); - if (token.getSubtype().size() > 0) + if (token.getCardType().size() > 0) { + for (Constants.CardType t : token.getCardType()) { + if (!permanent.getCardType().contains(t)) { + permanent.getCardType().add(t); + } + } + } + if (type == null) { + permanent.getSubtype().clear(); + } + if (token.getSubtype().size() > 0) { permanent.getSubtype().addAll(token.getSubtype()); + } } break; case ColorChangingEffects_5: @@ -120,7 +130,7 @@ public class BecomesCreatureTargetEffect extends ContinuousEffectImpl 0) + if (type != null && type.length() > 0) sb.append(" that's still a ").append(type); return sb.toString(); } diff --git a/Mage/src/mage/abilities/effects/common/continious/LoseAllAbilitiesTargetEffect.java b/Mage/src/mage/abilities/effects/common/continious/LoseAllAbilitiesTargetEffect.java new file mode 100644 index 0000000000..8f0f3b5268 --- /dev/null +++ b/Mage/src/mage/abilities/effects/common/continious/LoseAllAbilitiesTargetEffect.java @@ -0,0 +1,82 @@ +/* +* 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.continious; + +import mage.Constants.Duration; +import mage.Constants.Layer; +import mage.Constants.Outcome; +import mage.Constants.SubLayer; +import mage.abilities.Ability; +import mage.abilities.Mode; +import mage.abilities.effects.ContinuousEffectImpl; +import mage.game.Game; +import mage.game.permanent.Permanent; + +import java.util.UUID; + +/** + * + * @author nantuko + */ +public class LoseAllAbilitiesTargetEffect extends ContinuousEffectImpl { + + public LoseAllAbilitiesTargetEffect(Duration duration) { + super(duration, Layer.AbilityAddingRemovingEffects_6, SubLayer.NA, Outcome.AddAbility); + } + + public LoseAllAbilitiesTargetEffect(final LoseAllAbilitiesTargetEffect effect) { + super(effect); + } + + @Override + public LoseAllAbilitiesTargetEffect copy() { + return new LoseAllAbilitiesTargetEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + int affectedTargets = 0; + for (UUID permanentId : source.getTargets().get(0).getTargets()) { + Permanent permanent = game.getPermanent(permanentId); + if (permanent != null) { + permanent.getAbilities().clear(); + affectedTargets++; + } + } + return affectedTargets > 0; + } + + @Override + public String getText(Mode mode) { + StringBuilder sb = new StringBuilder(); + sb.append("Target ").append(mode.getTargets().get(0).getTargetName()).append(" loses all abilities").append(duration.toString()); + return sb.toString(); + } + +} \ No newline at end of file