forked from External/mage
* Some minor changes to logging and return code handling.
This commit is contained in:
parent
94be7cb4da
commit
4c33359fe2
22 changed files with 862 additions and 888 deletions
|
|
@ -27,11 +27,11 @@
|
|||
*/
|
||||
package mage.abilities.effects.common;
|
||||
|
||||
import mage.constants.Outcome;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.dynamicvalue.common.StaticValue;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.constants.Outcome;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.predicate.permanent.ControllerIdPredicate;
|
||||
import mage.game.Game;
|
||||
|
|
@ -45,25 +45,25 @@ import mage.util.CardUtil;
|
|||
*
|
||||
* @author maurer.it_at_gmail.com
|
||||
*/
|
||||
public class SacrificeEffect extends OneShotEffect{
|
||||
public class SacrificeEffect extends OneShotEffect {
|
||||
|
||||
private FilterPermanent filter;
|
||||
private String preText;
|
||||
private DynamicValue count;
|
||||
|
||||
public SacrificeEffect (FilterPermanent filter, int count, String preText ) {
|
||||
public SacrificeEffect(FilterPermanent filter, int count, String preText) {
|
||||
this(filter, new StaticValue(count), preText);
|
||||
}
|
||||
|
||||
public SacrificeEffect (FilterPermanent filter, DynamicValue count, String preText ) {
|
||||
public SacrificeEffect(FilterPermanent filter, DynamicValue count, String preText) {
|
||||
super(Outcome.Sacrifice);
|
||||
this.filter = filter;
|
||||
this.count = count;
|
||||
this.preText = preText;
|
||||
setText();
|
||||
}
|
||||
|
||||
public SacrificeEffect (final SacrificeEffect effect ) {
|
||||
|
||||
public SacrificeEffect(final SacrificeEffect effect) {
|
||||
super(effect);
|
||||
this.filter = effect.filter;
|
||||
this.count = effect.count;
|
||||
|
|
@ -87,24 +87,20 @@ public class SacrificeEffect extends OneShotEffect{
|
|||
|
||||
Target target = new TargetPermanent(amount, amount, newFilter, true);
|
||||
|
||||
// A spell or ability could have removed the only legal target this player
|
||||
// had, if thats the case this ability should fizzle.
|
||||
if (amount > 0 && target.canChoose(source.getSourceId(), player.getId(), game)) {
|
||||
while (!target.isChosen() && target.canChoose(player.getId(), game) && player.canRespond()) {
|
||||
player.chooseTarget(Outcome.Sacrifice, target, source, game);
|
||||
}
|
||||
|
||||
for ( int idx = 0; idx < target.getTargets().size(); idx++) {
|
||||
for (int idx = 0; idx < target.getTargets().size(); idx++) {
|
||||
Permanent permanent = game.getPermanent(target.getTargets().get(idx));
|
||||
|
||||
if ( permanent != null ) {
|
||||
if (permanent != null) {
|
||||
permanent.sacrifice(source.getSourceId(), game);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public void setAmount(DynamicValue amount) {
|
||||
|
|
@ -128,7 +124,7 @@ public class SacrificeEffect extends OneShotEffect{
|
|||
sb.append("sacrifice ");
|
||||
} else {
|
||||
sb.append(" sacrifice ");
|
||||
}
|
||||
}
|
||||
}
|
||||
sb.append(CardUtil.numberToText(count.toString(), "a")).append(' ');
|
||||
sb.append(filter.getMessage());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue