From c386e15dffd26b1a26b1ef98c10e38472d74b385 Mon Sep 17 00:00:00 2001 From: magenoxx Date: Wed, 21 Sep 2011 22:03:42 +0400 Subject: [PATCH] [ISD] Olivia Voldaren --- .../mage/sets/innistrad/OliviaVoldaren.java | 102 ++++++++++++++++++ .../common/EquippedHasSubtypeCondition.java | 63 +++++++++++ .../AddCardSubTypeTargetEffect.java | 76 +++++++++++++ .../AddCardSubtypeAttachedEffect.java | 31 ++++++ .../continious/AddCardTypeAttachedEffect.java | 31 ++++++ .../continious/AddCardTypeTargetEffect.java | 31 ++++++ 6 files changed, 334 insertions(+) create mode 100644 Mage.Sets/src/mage/sets/innistrad/OliviaVoldaren.java create mode 100644 Mage/src/mage/abilities/condition/common/EquippedHasSubtypeCondition.java create mode 100644 Mage/src/mage/abilities/effects/common/continious/AddCardSubTypeTargetEffect.java diff --git a/Mage.Sets/src/mage/sets/innistrad/OliviaVoldaren.java b/Mage.Sets/src/mage/sets/innistrad/OliviaVoldaren.java new file mode 100644 index 00000000000..1c02c31d443 --- /dev/null +++ b/Mage.Sets/src/mage/sets/innistrad/OliviaVoldaren.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.innistrad; + +import java.util.UUID; + +import mage.Constants; +import mage.Constants.CardType; +import mage.Constants.Rarity; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.common.DamageTargetEffect; +import mage.abilities.effects.common.continious.AddCardSubTypeTargetEffect; +import mage.abilities.effects.common.continious.AddCardSubtypeAttachedEffect; +import mage.abilities.effects.common.continious.GainControlTargetEffect; +import mage.abilities.effects.common.counter.AddCountersSourceEffect; +import mage.abilities.keyword.FlyingAbility; +import mage.cards.CardImpl; +import mage.counters.CounterType; +import mage.filter.Filter; +import mage.filter.common.FilterCreaturePermanent; +import mage.sets.zendikar.MerfolkWayfinder; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author nantuko + */ +public class OliviaVoldaren extends CardImpl { + + private static FilterCreaturePermanent filter = new FilterCreaturePermanent("another creature"); + private static FilterCreaturePermanent vampireFilter = new FilterCreaturePermanent("Vampire"); + + static { + filter.setAnother(true); + // + vampireFilter.getSubtype().add("Vampire"); + vampireFilter.setScopeSubtype(Filter.ComparisonScope.Any); + } + + public OliviaVoldaren(UUID ownerId) { + super(ownerId, 215, "Olivia Voldaren", Rarity.MYTHIC, new CardType[]{CardType.CREATURE}, "{2}{B}{R}"); + this.expansionSetCode = "ISD"; + this.supertype.add("Legendary"); + this.subtype.add("Vampire"); + + this.color.setRed(true); + this.color.setBlack(true); + this.power = new MageInt(3); + this.toughness = new MageInt(3); + + this.addAbility(FlyingAbility.getInstance()); + + // {1}{R}: Olivia Voldaren deals 1 damage to another target creature. That creature becomes a Vampire in addition to its other types. Put a +1/+1 counter on Olivia Voldaren. + Ability ability = new SimpleActivatedAbility(Constants.Zone.BATTLEFIELD, new DamageTargetEffect(1), new ManaCostsImpl("{1}{R}")); + ability.addTarget(new TargetCreaturePermanent(filter)); + ability.addEffect(new AddCardSubTypeTargetEffect("Vampire", Constants.Duration.WhileOnBattlefield)); + ability.addEffect(new AddCountersSourceEffect(CounterType.P1P1.createInstance())); + this.addAbility(ability); + + // {3}{B}{B}: Gain control of target Vampire for as long as you control Olivia Voldaren. + Ability ability2 = new SimpleActivatedAbility(Constants.Zone.BATTLEFIELD, new GainControlTargetEffect(Constants.Duration.WhileOnBattlefield), new ManaCostsImpl("{3}{B}{B}")); + ability2.addTarget(new TargetCreaturePermanent(vampireFilter)); + this.addAbility(ability2); + } + + public OliviaVoldaren(final OliviaVoldaren card) { + super(card); + } + + @Override + public OliviaVoldaren copy() { + return new OliviaVoldaren(this); + } +} diff --git a/Mage/src/mage/abilities/condition/common/EquippedHasSubtypeCondition.java b/Mage/src/mage/abilities/condition/common/EquippedHasSubtypeCondition.java new file mode 100644 index 00000000000..c77e455770b --- /dev/null +++ b/Mage/src/mage/abilities/condition/common/EquippedHasSubtypeCondition.java @@ -0,0 +1,63 @@ +/* + * 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.condition.common; + +import mage.abilities.Ability; +import mage.abilities.condition.Condition; +import mage.game.Game; +import mage.game.permanent.Permanent; + +import java.util.UUID; + +/** + * Describes condition when equipped permanent has subType + * + * @author nantuko + */ +public class EquippedHasSubtypeCondition implements Condition { + + private String subType; + + public EquippedHasSubtypeCondition(String subType) { + this.subType = subType; + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent permanent = game.getBattlefield().getPermanent(source.getSourceId()); + if (permanent != null && permanent.getAttachedTo() != null) { + Permanent attachedTo = game.getBattlefield().getPermanent(permanent.getAttachedTo()); + if (attachedTo != null) { + if (attachedTo.hasSubtype(this.subType)) { + return true; + } + } + } + return false; + } +} diff --git a/Mage/src/mage/abilities/effects/common/continious/AddCardSubTypeTargetEffect.java b/Mage/src/mage/abilities/effects/common/continious/AddCardSubTypeTargetEffect.java new file mode 100644 index 00000000000..1b1b42e4575 --- /dev/null +++ b/Mage/src/mage/abilities/effects/common/continious/AddCardSubTypeTargetEffect.java @@ -0,0 +1,76 @@ +/* + * 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; +import mage.abilities.Ability; +import mage.abilities.Mode; +import mage.abilities.effects.ContinuousEffectImpl; +import mage.game.Game; +import mage.game.permanent.Permanent; + +/** + * @author nantuko + */ +public class AddCardSubTypeTargetEffect extends ContinuousEffectImpl { + private String addedSubType; + + public AddCardSubTypeTargetEffect(String addedSubType, Constants.Duration duration) { + super(duration, Constants.Layer.TypeChangingEffects_4, Constants.SubLayer.NA, Constants.Outcome.Benefit); + this.addedSubType = addedSubType; + } + + public AddCardSubTypeTargetEffect(final AddCardSubTypeTargetEffect effect) { + super(effect); + this.addedSubType = effect.addedSubType; + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent target = game.getPermanent(targetPointer.getFirst(source)); + if (target != null) { + if (!target.hasSubtype(addedSubType)) { + target.getSubtype().add(addedSubType); + } + } + return false; + } + + @Override + public AddCardSubTypeTargetEffect copy() { + return new AddCardSubTypeTargetEffect(this); + } + + @Override + public String getText(Mode mode) { + StringBuilder sb = new StringBuilder(); + sb.append("Target ").append(mode.getTargets().get(0).getTargetName()).append(" becomes ").append(addedSubType).append(" in addition to its other types ").append(duration.toString()); + return sb.toString(); + } +} diff --git a/Mage/src/mage/abilities/effects/common/continious/AddCardSubtypeAttachedEffect.java b/Mage/src/mage/abilities/effects/common/continious/AddCardSubtypeAttachedEffect.java index 2ffedfe0b10..5558b0b0b78 100644 --- a/Mage/src/mage/abilities/effects/common/continious/AddCardSubtypeAttachedEffect.java +++ b/Mage/src/mage/abilities/effects/common/continious/AddCardSubtypeAttachedEffect.java @@ -1,3 +1,31 @@ +/* + * 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; @@ -6,6 +34,9 @@ import mage.abilities.effects.ContinuousEffectImpl; import mage.game.Game; import mage.game.permanent.Permanent; +/** + * @author nantuko + */ public class AddCardSubtypeAttachedEffect extends ContinuousEffectImpl { private String addedSubtype; private Constants.AttachmentType attachmentType; diff --git a/Mage/src/mage/abilities/effects/common/continious/AddCardTypeAttachedEffect.java b/Mage/src/mage/abilities/effects/common/continious/AddCardTypeAttachedEffect.java index 1128351cb03..ed6ec24ba97 100644 --- a/Mage/src/mage/abilities/effects/common/continious/AddCardTypeAttachedEffect.java +++ b/Mage/src/mage/abilities/effects/common/continious/AddCardTypeAttachedEffect.java @@ -1,3 +1,31 @@ +/* + * 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; @@ -6,6 +34,9 @@ import mage.abilities.effects.ContinuousEffectImpl; import mage.game.Game; import mage.game.permanent.Permanent; +/** + * @author nantuko + */ public class AddCardTypeAttachedEffect extends ContinuousEffectImpl { private Constants.CardType addedCardType; private Constants.AttachmentType attachmentType; diff --git a/Mage/src/mage/abilities/effects/common/continious/AddCardTypeTargetEffect.java b/Mage/src/mage/abilities/effects/common/continious/AddCardTypeTargetEffect.java index e7e322f5302..eae140076c1 100644 --- a/Mage/src/mage/abilities/effects/common/continious/AddCardTypeTargetEffect.java +++ b/Mage/src/mage/abilities/effects/common/continious/AddCardTypeTargetEffect.java @@ -1,3 +1,31 @@ +/* + * 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; @@ -7,6 +35,9 @@ import mage.abilities.effects.ContinuousEffectImpl; import mage.game.Game; import mage.game.permanent.Permanent; +/** + * @author nantuko + */ public class AddCardTypeTargetEffect extends ContinuousEffectImpl { private Constants.CardType addedCardType;