diff --git a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/GathererSymbols.java b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/GathererSymbols.java index 85fe8ad34bf..bd25bd00594 100644 --- a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/GathererSymbols.java +++ b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/GathererSymbols.java @@ -1,12 +1,10 @@ /** * GathererSymbols.java - * + * * Created on 25.08.2010 */ - package org.mage.plugins.card.dl.sources; - import com.google.common.collect.AbstractIterator; import java.io.File; import static java.lang.String.format; @@ -15,10 +13,9 @@ import org.mage.plugins.card.dl.DownloadJob; import static org.mage.plugins.card.dl.DownloadJob.fromURL; import static org.mage.plugins.card.dl.DownloadJob.toFile; - /** * The class GathererSymbols. - * + * * @version V0.0 25.08.2010 * @author Clemens Koza */ @@ -26,24 +23,20 @@ public class GathererSymbols implements Iterable { //TODO chaos and planeswalker symbol //chaos: http://gatherer.wizards.com/Images/Symbols/chaos.gif - private static final String SYMBOLS_PATH = File.separator + "symbols"; + private static final String SYMBOLS_PATH = File.separator + "symbols"; private static final File DEFAULT_OUT_DIR = new File("plugins" + File.separator + "images" + SYMBOLS_PATH); - private static File outDir = DEFAULT_OUT_DIR; + private static File outDir = DEFAULT_OUT_DIR; - private static final String urlFmt = "http://gatherer.wizards.com/handlers/image.ashx?size=%1$s&name=%2$s&type=symbol"; + private static final String urlFmt = "http://gatherer.wizards.com/handlers/image.ashx?size=%1$s&name=%2$s&type=symbol"; - private static final String[] sizes = {"small", "medium", "large"}; + private static final String[] sizes = {"small", "medium", "large"}; private static final String[] symbols = {"W", "U", "B", "R", "G", - - "W/U", "U/B", "B/R", "R/G", "G/W", "W/B", "U/R", "B/G", "R/W", "G/U", - - "2/W", "2/U", "2/B", "2/R", "2/G", - - "WP", "UP", "BP", "RP", "GP", - - "X", "S", "T", "Q"}; - private static final int minNumeric = 0, maxNumeric = 16; + "W/U", "U/B", "B/R", "R/G", "G/W", "W/B", "U/R", "B/G", "R/W", "G/U", + "2/W", "2/U", "2/B", "2/R", "2/G", + "WP", "UP", "BP", "RP", "GP", + "X", "S", "T", "Q", "C"}; + private static final int minNumeric = 0, maxNumeric = 16; public GathererSymbols(String path) { if (path == null) { @@ -56,19 +49,19 @@ public class GathererSymbols implements Iterable { @Override public Iterator iterator() { return new AbstractIterator() { - private int sizeIndex, symIndex, numeric = minNumeric; + private int sizeIndex, symIndex, numeric = minNumeric; private File dir = new File(outDir, sizes[sizeIndex]); @Override protected DownloadJob computeNext() { String sym; - if(symIndex < symbols.length) { + if (symIndex < symbols.length) { sym = symbols[symIndex++]; - } else if(numeric <= maxNumeric) { + } else if (numeric <= maxNumeric) { sym = "" + (numeric++); } else { sizeIndex++; - if(sizeIndex == sizes.length) { + if (sizeIndex == sizes.length) { return endOfData(); } diff --git a/Mage.Sets/src/mage/sets/magic2010/VampireAristocrat.java b/Mage.Sets/src/mage/sets/magic2010/VampireAristocrat.java index 20f3e00c0fd..c0bafefe513 100644 --- a/Mage.Sets/src/mage/sets/magic2010/VampireAristocrat.java +++ b/Mage.Sets/src/mage/sets/magic2010/VampireAristocrat.java @@ -25,14 +25,9 @@ * authors and should not be interpreted as representing official policies, either expressed * or implied, of BetaSteward_at_googlemail.com. */ - package mage.sets.magic2010; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Duration; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; @@ -40,6 +35,11 @@ import mage.abilities.costs.common.SacrificeTargetCost; import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.effects.common.continuous.BoostSourceEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.filter.common.FilterControlledCreaturePermanent; import mage.target.common.TargetControlledCreaturePermanent; /** @@ -57,7 +57,7 @@ public class VampireAristocrat extends CardImpl { this.power = new MageInt(2); this.toughness = new MageInt(2); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostSourceEffect(2, 2, Duration.EndOfTurn), new ManaCostsImpl("")); - ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent())); + ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent(new FilterControlledCreaturePermanent("creature")))); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/sets/magic2012/BloodlordOfVaasgoth.java b/Mage.Sets/src/mage/sets/magic2012/BloodlordOfVaasgoth.java index 8232fdb70e0..cc6cc96b15e 100644 --- a/Mage.Sets/src/mage/sets/magic2012/BloodlordOfVaasgoth.java +++ b/Mage.Sets/src/mage/sets/magic2012/BloodlordOfVaasgoth.java @@ -28,9 +28,6 @@ package mage.sets.magic2012; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SpellCastControllerTriggeredAbility; @@ -38,9 +35,11 @@ import mage.abilities.effects.ContinuousEffectImpl; import mage.abilities.keyword.BloodthirstAbility; import mage.abilities.keyword.FlyingAbility; import mage.cards.CardImpl; +import mage.constants.CardType; import mage.constants.Duration; import mage.constants.Layer; import mage.constants.Outcome; +import mage.constants.Rarity; import mage.constants.SubLayer; import mage.filter.FilterSpell; import mage.filter.predicate.mageobject.CardTypePredicate; @@ -73,6 +72,7 @@ public class BloodlordOfVaasgoth extends CardImpl { // Bloodthirst 3 this.addAbility(new BloodthirstAbility(3)); + // Flying this.addAbility(FlyingAbility.getInstance()); // Whenever you cast a Vampire creature spell, it gains bloodthirst 3. @@ -92,6 +92,8 @@ public class BloodlordOfVaasgoth extends CardImpl { class BloodlordOfVaasgothEffect extends ContinuousEffectImpl { private Ability ability = new BloodthirstAbility(3); + private int zoneChangeCounter; + private UUID permanentId; public BloodlordOfVaasgothEffect() { super(Duration.OneUse, Layer.AbilityAddingRemovingEffects_6, SubLayer.NA, Outcome.AddAbility); @@ -101,6 +103,8 @@ class BloodlordOfVaasgothEffect extends ContinuousEffectImpl { public BloodlordOfVaasgothEffect(final BloodlordOfVaasgothEffect effect) { super(effect); this.ability = effect.ability.copy(); + this.zoneChangeCounter = effect.zoneChangeCounter; + this.permanentId = effect.permanentId; } @Override @@ -109,18 +113,34 @@ class BloodlordOfVaasgothEffect extends ContinuousEffectImpl { } @Override - public boolean apply(Game game, Ability source) { + public void init(Ability source, Game game) { + super.init(source, game); Spell object = game.getStack().getSpell(targetPointer.getFirst(game, source)); if (object != null) { - Permanent permanent = game.getPermanent(object.getSourceId()); - if (permanent != null) { - permanent.addAbility(ability, source.getSourceId(), game); - return true; - } - } else { - used = true; + zoneChangeCounter = game.getState().getZoneChangeCounter(object.getSourceId()) + 1; + permanentId = object.getSourceId(); } - return false; + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent permanent = game.getPermanent(permanentId); + if (permanent != null && permanent.getZoneChangeCounter(game) <= zoneChangeCounter) { + permanent.addAbility(ability, source.getSourceId(), game); + return true; + } else { + if (game.getState().getZoneChangeCounter(permanentId) >= zoneChangeCounter) { + discard(); + } + Spell spell = game.getStack().getSpell(targetPointer.getFirst(game, source)); + if (spell != null) { // Bloodthirst checked while spell is on the stack so needed to give it already to the spell + Ability ability1 = ability.copy(); + ability1.setSourceId(spell.getSourceId()); + ability1.setControllerId(spell.getControllerId()); + game.getState().addAbility(ability1, spell); + } + } + return true; } } diff --git a/Mage/src/main/java/mage/abilities/StaticAbility.java b/Mage/src/main/java/mage/abilities/StaticAbility.java index d868f704384..bbeee56b6a9 100644 --- a/Mage/src/main/java/mage/abilities/StaticAbility.java +++ b/Mage/src/main/java/mage/abilities/StaticAbility.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.abilities; import mage.MageObject; @@ -35,7 +34,6 @@ import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; - /** * * @author BetaSteward_at_googlemail.com @@ -56,7 +54,7 @@ public abstract class StaticAbility extends AbilityImpl { @Override public boolean isInUseableZone(Game game, MageObject source, GameEvent event) { if (game.getShortLivingLKI(getSourceId(), zone)) { - return true; + return true; // maybe this can be a problem if effects removed the ability from the object } return super.isInUseableZone(game, source, event); }