fixed EldraziSpawnToken and added ability selector for sacrifice only abilities

This commit is contained in:
BetaSteward 2010-11-20 03:51:30 +00:00
parent 8767f65005
commit 20826e850c
5 changed files with 68 additions and 12 deletions

View file

@ -71,7 +71,7 @@ public class GameView implements Serializable {
if (object != null)
stack.put(stackObject.getId(), new StackAbilityView((StackAbility)stackObject, object.getName()));
else
stack.put(null, new StackAbilityView((StackAbility)stackObject, ""));
stack.put(stackObject.getId(), new StackAbilityView((StackAbility)stackObject, ""));
}
else {
stack.put(stackObject.getId(), new CardView((Spell)stackObject));

View file

@ -46,6 +46,7 @@ import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.ActivatedAbility;
import mage.abilities.SpecialAction;
import mage.abilities.costs.common.SacrificeSourceCost;
import mage.abilities.costs.mana.ManaCost;
import mage.abilities.costs.mana.VariableManaCost;
import mage.cards.decks.Deck;
@ -434,16 +435,18 @@ public class HumanPlayer extends PlayerImpl<HumanPlayer> {
protected void activateAbility(Map<UUID, ? extends ActivatedAbility> abilities, Game game) {
if (abilities.size() == 1) {
activateAbility(abilities.values().iterator().next(), game);
}
else {
game.fireGetChoiceEvent(playerId, name, abilities.values());
waitForResponse();
if (response.getUUID() != null) {
if (abilities.containsKey(response.getUUID()))
activateAbility(abilities.get(response.getUUID()), game);
ActivatedAbility ability = abilities.values().iterator().next();
if (ability.getTargets().size() != 0 || !(ability.getCosts().size() == 1 && ability.getCosts().get(0) instanceof SacrificeSourceCost)) {
activateAbility(ability, game);
return;
}
}
game.fireGetChoiceEvent(playerId, name, abilities.values());
waitForResponse();
if (response.getUUID() != null) {
if (abilities.containsKey(response.getUUID()))
activateAbility(abilities.get(response.getUUID()), game);
}
}
@Override

View file

@ -0,0 +1,54 @@
/*
* 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.mana;
import mage.Constants.Zone;
import mage.abilities.costs.Cost;
import mage.abilities.effects.common.ManaEffect;
/**
*
* @author BetaSteward_at_googlemail.com
*/
public class SimpleManaAbility extends ManaAbility<SimpleManaAbility> {
public SimpleManaAbility(Zone zone, ManaEffect effect, Cost cost) {
super(zone, effect, cost);
}
public SimpleManaAbility(final SimpleManaAbility ability) {
super(ability);
}
@Override
public SimpleManaAbility copy() {
return new SimpleManaAbility(this);
}
}

View file

@ -32,9 +32,9 @@ import mage.Constants.CardType;
import mage.Constants.Zone;
import mage.MageInt;
import mage.Mana;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.SacrificeSourceCost;
import mage.abilities.effects.common.ManaEffect;
import mage.abilities.mana.SimpleManaAbility;
/**
*
@ -49,8 +49,7 @@ public class EldraziSpawnToken extends Token {
subtype.add("Spawn");
power = new MageInt(0);
toughness = new MageInt(1);
addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new ManaEffect(Mana.ColorlessMana), new SacrificeSourceCost()));
addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, new ManaEffect(Mana.ColorlessMana), new SacrificeSourceCost()));
}
}