Fixed a bug of Samurai of the Pale Curtain. Changed Mark of the Oni.

This commit is contained in:
LevelX2 2012-12-22 20:08:53 +01:00
parent 390ce20458
commit ba4a18ab5e
2 changed files with 19 additions and 42 deletions

View file

@ -36,7 +36,9 @@ import mage.Constants.Rarity;
import mage.Constants.Zone;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.BeginningOfEndStepTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.condition.common.ControlsPermanentCondition;
import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.common.SacrificeSourceEffect;
import mage.abilities.effects.common.continious.ControlEnchantedEffect;
@ -54,6 +56,10 @@ import mage.target.common.TargetCreaturePermanent;
* @author LevelX2
*/
public class MarkOfTheOni extends CardImpl<MarkOfTheOni> {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("if you control no Demons");
static {
filter.add(new SubtypePredicate("Demon"));
}
public MarkOfTheOni(UUID ownerId) {
super(ownerId, 73, "Mark of the Oni", Rarity.UNCOMMON, new CardType[]{CardType.ENCHANTMENT}, "{2}{B}");
@ -72,8 +78,11 @@ public class MarkOfTheOni extends CardImpl<MarkOfTheOni> {
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ControlEnchantedEffect()));
// At the beginning of the end step, if you control no Demons, sacrifice Mark of the Oni.
this.addAbility(new MarkOfTheOniTriggeredAbility());
this.addAbility(new BeginningOfEndStepTriggeredAbility(Zone.BATTLEFIELD,
new SacrificeSourceEffect(),
Constants.TargetController.ANY,
new ControlsPermanentCondition(filter, ControlsPermanentCondition.CountType.FEWER_THAN, 1),
false));
}
public MarkOfTheOni(final MarkOfTheOni card) {
@ -84,37 +93,4 @@ public class MarkOfTheOni extends CardImpl<MarkOfTheOni> {
public MarkOfTheOni copy() {
return new MarkOfTheOni(this);
}
private class MarkOfTheOniTriggeredAbility extends TriggeredAbilityImpl<MarkOfTheOniTriggeredAbility> {
MarkOfTheOniTriggeredAbility() {
super(Constants.Zone.BATTLEFIELD, new SacrificeSourceEffect());
}
MarkOfTheOniTriggeredAbility(final MarkOfTheOniTriggeredAbility ability) {
super(ability);
}
@Override
public MarkOfTheOniTriggeredAbility copy() {
return new MarkOfTheOniTriggeredAbility(this);
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.END_TURN_STEP_PRE) {
FilterCreaturePermanent filter = new FilterCreaturePermanent();
filter.add(new SubtypePredicate("Demon"));
if (!game.getBattlefield().contains(filter, controllerId, 1, game)) {
return true;
}
}
return false;
}
@Override
public String getRule() {
return "At the beginning of the end step, if you control no Demons, sacrifice {this}.";
}
}
}

View file

@ -57,9 +57,10 @@ public class SamuraiOfThePaleCurtain extends CardImpl<SamuraiOfThePaleCurtain> {
this.expansionSetCode = "CHK";
this.subtype.add("Fox");
this.subtype.add("Samurai");
this.color.setWhite(true);
this.color.setWhite(true);
this.power = new MageInt(2);
this.toughness = new MageInt(2);
// Bushido 1 (When this blocks or becomes blocked, it gets +1/+1 until end of turn.)
this.addAbility(new BushidoAbility(1));
// If a permanent would be put into a graveyard, exile it instead.
@ -82,7 +83,7 @@ public class SamuraiOfThePaleCurtain extends CardImpl<SamuraiOfThePaleCurtain> {
class SamuraiOfThePaleCurtainEffect extends ReplacementEffectImpl<SamuraiOfThePaleCurtainEffect> {
public SamuraiOfThePaleCurtainEffect() {
super(Duration.EndOfTurn, Outcome.Exile);
super(Duration.WhileOnBattlefield, Outcome.Exile);
staticText = "If a permanent would be put into a graveyard, exile it instead";
}
@ -102,16 +103,16 @@ class SamuraiOfThePaleCurtainEffect extends ReplacementEffectImpl<SamuraiOfThePa
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Permanent permanent = ((ZoneChangeEvent)event).getTarget();
if (permanent != null) {
return permanent.moveToExile(null, "", source.getId(), game);
}
Permanent permanent = ((ZoneChangeEvent)event).getTarget();
if (permanent != null) {
return permanent.moveToExile(null, "", source.getId(), game);
}
return false;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getType() == EventType.ZONE_CHANGE ) {
if (event.getType() == EventType.ZONE_CHANGE ) {
ZoneChangeEvent zEvent = (ZoneChangeEvent)event;
if (zEvent.getToZone() == Zone.GRAVEYARD) {
return true;