mirror of
https://github.com/correl/mage.git
synced 2025-03-12 17:00:08 -09:00
- Fixed #8185
This commit is contained in:
parent
640e7a252e
commit
ce2f166c53
2 changed files with 79 additions and 14 deletions
|
@ -1,15 +1,13 @@
|
|||
|
||||
package mage.cards.s;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.condition.common.TransformedCondition;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.decorator.ConditionalTriggeredAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.TransformSourceEffect;
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
import mage.abilities.keyword.TransformAbility;
|
||||
import mage.cards.CardImpl;
|
||||
|
@ -20,7 +18,6 @@ import mage.constants.Outcome;
|
|||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
/**
|
||||
|
@ -29,7 +26,7 @@ import mage.game.permanent.Permanent;
|
|||
public final class ScreechingBat extends CardImpl {
|
||||
|
||||
public ScreechingBat(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{B}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{B}");
|
||||
this.subtype.add(SubType.BAT);
|
||||
|
||||
this.transformable = true;
|
||||
|
@ -42,7 +39,7 @@ public final class ScreechingBat extends CardImpl {
|
|||
|
||||
// At the beginning of your upkeep, you may pay {2}{B}{B}. If you do, transform Screeching Bat.
|
||||
this.addAbility(new TransformAbility());
|
||||
this.addAbility(new ConditionalTriggeredAbility(new ScreechingBatBeginningOfUpkeepTriggeredAbility(), new TransformedCondition(true), ""));
|
||||
this.addAbility(new ScreechingBatBeginningOfUpkeepTriggeredAbility());
|
||||
}
|
||||
|
||||
private ScreechingBat(final ScreechingBat card) {
|
||||
|
@ -108,9 +105,7 @@ class ScreechingBatTransformSourceEffect extends OneShotEffect {
|
|||
if (permanent != null) {
|
||||
Cost cost = new ManaCostsImpl("{2}{B}{B}");
|
||||
if (cost.pay(source, game, source, permanent.getControllerId(), false, null)) {
|
||||
if (permanent.isTransformable()) {
|
||||
permanent.setTransformed(!permanent.isTransformed());
|
||||
}
|
||||
new TransformSourceEffect(true).apply(game, source);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1,15 +1,23 @@
|
|||
|
||||
package mage.cards.s;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.condition.common.TransformedCondition;
|
||||
import mage.abilities.decorator.ConditionalTriggeredAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.TransformSourceEffect;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
/**
|
||||
* @author nantuko
|
||||
|
@ -17,7 +25,7 @@ import java.util.UUID;
|
|||
public final class StalkingVampire extends CardImpl {
|
||||
|
||||
public StalkingVampire(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "");
|
||||
this.subtype.add(SubType.VAMPIRE);
|
||||
this.color.setBlack(true);
|
||||
|
||||
|
@ -28,7 +36,7 @@ public final class StalkingVampire extends CardImpl {
|
|||
this.toughness = new MageInt(5);
|
||||
|
||||
// At the beginning of your upkeep, you may pay {2}{B}{B}. If you do, transform Stalking Vampire.
|
||||
this.addAbility(new ConditionalTriggeredAbility(new ScreechingBatBeginningOfUpkeepTriggeredAbility(), new TransformedCondition(), ""));
|
||||
this.addAbility(new StalkingVampireBeginningOfUpkeepTriggeredAbility());
|
||||
}
|
||||
|
||||
private StalkingVampire(final StalkingVampire card) {
|
||||
|
@ -40,3 +48,65 @@ public final class StalkingVampire extends CardImpl {
|
|||
return new StalkingVampire(this);
|
||||
}
|
||||
}
|
||||
|
||||
class StalkingVampireBeginningOfUpkeepTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
public StalkingVampireBeginningOfUpkeepTriggeredAbility() {
|
||||
super(Zone.BATTLEFIELD, new StalkingVampireTransformSourceEffect(), true);
|
||||
}
|
||||
|
||||
public StalkingVampireBeginningOfUpkeepTriggeredAbility(final StalkingVampireBeginningOfUpkeepTriggeredAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public StalkingVampireBeginningOfUpkeepTriggeredAbility copy() {
|
||||
return new StalkingVampireBeginningOfUpkeepTriggeredAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.UPKEEP_STEP_PRE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
return event.getPlayerId().equals(this.controllerId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "At the beginning of your upkeep, you may pay {2}{B}{B}. If you do, transform {this}.";
|
||||
}
|
||||
}
|
||||
|
||||
class StalkingVampireTransformSourceEffect extends OneShotEffect {
|
||||
|
||||
public StalkingVampireTransformSourceEffect() {
|
||||
super(Outcome.Transform);
|
||||
staticText = "transform {this}";
|
||||
}
|
||||
|
||||
public StalkingVampireTransformSourceEffect(final StalkingVampireTransformSourceEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public StalkingVampireTransformSourceEffect copy() {
|
||||
return new StalkingVampireTransformSourceEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (permanent != null) {
|
||||
Cost cost = new ManaCostsImpl("{2}{B}{B}");
|
||||
if (cost.pay(source, game, source, permanent.getControllerId(), false, null)) {
|
||||
new TransformSourceEffect(false).apply(game, source);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue