Fix dark depths to only put token into play if it was sacrificed successfully

This commit is contained in:
Dustin Conrad 2014-08-25 20:48:40 -04:00
parent f8902483ea
commit bd86082100

View file

@ -29,10 +29,10 @@ package mage.sets.coldsnap;
import java.util.UUID;
import mage.abilities.Ability;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.MageInt;
import mage.ObjectColor;
import mage.abilities.StateTriggeredAbility;
import mage.abilities.common.EntersBattlefieldAbility;
import mage.abilities.common.SimpleActivatedAbility;
@ -81,11 +81,42 @@ public class DarkDepths extends CardImpl {
}
}
class DarkDepthsSacrificeEffect extends SacrificeSourceEffect {
private boolean sacrificed = false;
public DarkDepthsSacrificeEffect(){
super();
}
public DarkDepthsSacrificeEffect(final DarkDepthsSacrificeEffect effect) {
super(effect);
this.sacrificed = effect.sacrificed;
}
@Override
public DarkDepthsSacrificeEffect copy() {
return new DarkDepthsSacrificeEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
sacrificed = super.apply(game, source);
if (sacrificed) {
new CreateTokenEffect(new MaritLageToken()).apply(game, source);
}
return sacrificed;
}
public boolean isSacrificed() {
return sacrificed;
}
}
class DarkDepthsAbility extends StateTriggeredAbility {
public DarkDepthsAbility() {
super(Zone.BATTLEFIELD, new SacrificeSourceEffect());
this.addEffect(new CreateTokenEffect(new MaritLageToken()));
super(Zone.BATTLEFIELD, new DarkDepthsSacrificeEffect());
}
public DarkDepthsAbility(final DarkDepthsAbility ability) {
@ -100,10 +131,7 @@ class DarkDepthsAbility extends StateTriggeredAbility {
@Override
public boolean checkTrigger(GameEvent event, Game game) {
Permanent permanent = game.getPermanent(getSourceId());
if(permanent != null && permanent.getCounters().getCount(CounterType.ICE) == 0){
return true;
}
return false;
return permanent != null && permanent.getCounters().getCount(CounterType.ICE) == 0;
}
@Override