[C13] Added Azorius Herald, Oloro, Ageless Ascetic and Kingming 'Sleeping Dragon'. Sime fixes to commander handling.

This commit is contained in:
LevelX2 2013-11-25 07:28:56 +01:00
parent a85f4a9848
commit 0ad2d040b1
18 changed files with 442 additions and 32 deletions

View file

@ -52,6 +52,7 @@ import org.apache.log4j.Logger;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import mage.game.command.Emblem;
/**
@ -608,10 +609,15 @@ public abstract class AbilityImpl<T extends AbilityImpl<T>> implements Ability {
@Override
public boolean isInUseableZone(Game game, MageObject source, boolean checkLKI) {
// emblem are always actual (also true for a commander? LevelX)
if (zone.equals(Zone.COMMAND)) {
return true;
if (this.getSourceId() == null) { // commander effects
return true;
}
MageObject object = game.getObject(this.getSourceId());
// emblem are always actual
if (object != null && object instanceof Emblem) {
return true;
}
}
// try LKI first

View file

@ -28,9 +28,9 @@
package mage.abilities.condition.common;
import mage.constants.ManaType;
import mage.abilities.Ability;
import mage.abilities.condition.Condition;
import mage.constants.ColoredManaSymbol;
import mage.game.Game;
/**
@ -41,14 +41,20 @@ import mage.game.Game;
public class ManaWasSpentCondition implements Condition {
protected ManaType manaType;
protected ColoredManaSymbol coloredManaSymbol;
public ManaWasSpentCondition(ManaType manaType) {
this.manaType = manaType;
public ManaWasSpentCondition(ColoredManaSymbol coloredManaSymbol) {
this.coloredManaSymbol = coloredManaSymbol;
}
@Override
public boolean apply(Game game, Ability source) {
return (source.getManaCostsToPay().getPayment().get(manaType) > 0);
return (source.getManaCostsToPay().getPayment().getColor(coloredManaSymbol) > 0);
}
@Override
public String toString() {
return new StringBuilder("{").append(coloredManaSymbol.toString()).append("} was spent to cast it").toString();
}
}

View file

@ -32,10 +32,8 @@ import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.costs.CostImpl;
import mage.abilities.costs.VariableCost;
import mage.counters.CounterType;
import mage.filter.FilterMana;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
/**
@ -65,11 +63,14 @@ public class PayVariableLifeCost extends CostImpl<PayVariableLifeCost> implement
@Override
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) {
Player controller = game.getPlayer(controllerId);
this.amountPaid = controller.getAmount(0, controller.getLife(), "Choose X", game);
if (this.amountPaid> 0) {
controller.loseLife(amountPaid, game);
if (controller != null) {
this.amountPaid = controller.getAmount(0, controller.getLife(), "Choose X (life to pay)", game);
if (this.amountPaid> 0) {
controller.loseLife(amountPaid, game);
}
game.informPlayers(new StringBuilder(controller.getName()).append(" pays ").append(amountPaid).append(" life.").toString());
this.paid = true;
}
this.paid = true;
return paid;
}

View file

@ -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;
import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.condition.Condition;
import mage.abilities.effects.OneShotEffect;
import mage.constants.Outcome;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
/**
*
* @author LevelX2
*/
public class SacrificeSourceUnlessConditionEffect extends OneShotEffect<SacrificeSourceUnlessConditionEffect> {
protected Condition condition;
public SacrificeSourceUnlessConditionEffect(Condition condition) {
super(Outcome.Sacrifice);
this.condition = condition;
}
public SacrificeSourceUnlessConditionEffect(final SacrificeSourceUnlessConditionEffect effect) {
super(effect);
this.condition = effect.condition;
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
Permanent permanent = game.getPermanent(source.getSourceId());
if (player != null && permanent != null) {
if (condition.apply(game, source)) {
return true;
}
permanent.sacrifice(source.getSourceId(), game);
return true;
}
return false;
}
@Override
public SacrificeSourceUnlessConditionEffect copy() {
return new SacrificeSourceUnlessConditionEffect(this);
}
@Override
public String getText(Mode mode) {
StringBuilder sb = new StringBuilder("sacrifice {this} unless ");
sb.append(condition.toString());
return sb.toString();
}
}

View file

@ -471,7 +471,7 @@ public abstract class CardImpl<T extends CardImpl<T>> extends MageObjectImpl<T>
removed = true;
break;
case COMMAND:
game.getState().getCommand().remove((Commander)game.getObject(objectId));
// command object (commander) is only on the stack, so no removing neccessary here
removed = true;
break;
case PICK: