mirror of
https://github.com/magefree/mage.git
synced 2026-01-25 12:49:39 -08:00
- Fixed Hellcarver Demon.
This commit is contained in:
parent
86022e17cf
commit
b739c3bd7d
1 changed files with 60 additions and 19 deletions
|
|
@ -38,23 +38,28 @@ import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
import mage.constants.Outcome;
|
import mage.constants.Outcome;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
|
import mage.abilities.effects.AsThoughEffectImpl;
|
||||||
|
import mage.abilities.effects.ContinuousEffect;
|
||||||
import mage.cards.Card;
|
import mage.cards.Card;
|
||||||
|
import mage.constants.AsThoughEffectType;
|
||||||
|
import mage.constants.Duration;
|
||||||
|
import mage.constants.Zone;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.filter.common.FilterControlledPermanent;
|
import mage.filter.common.FilterControlledPermanent;
|
||||||
import mage.filter.common.FilterNonlandCard;
|
import mage.filter.common.FilterNonlandCard;
|
||||||
import mage.target.common.TargetCardInExile;
|
import mage.target.common.TargetCardInExile;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
|
import mage.target.targetpointer.FixedTarget;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author jeffwadsworth
|
* @author jeffwadsworth
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class HellcarverDemon extends CardImpl {
|
public class HellcarverDemon extends CardImpl {
|
||||||
|
|
||||||
public HellcarverDemon(UUID ownerId, CardSetInfo setInfo) {
|
public HellcarverDemon(UUID ownerId, CardSetInfo setInfo) {
|
||||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{B}{B}{B}");
|
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{B}{B}{B}");
|
||||||
this.subtype.add("Demon");
|
this.subtype.add("Demon");
|
||||||
|
|
||||||
this.power = new MageInt(6);
|
this.power = new MageInt(6);
|
||||||
|
|
@ -92,44 +97,80 @@ class HellcarverDemonEffect extends OneShotEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player player = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
Permanent hellcarverDemon = game.getPermanent(source.getSourceId());
|
Permanent hellcarverDemon = game.getPermanent(source.getSourceId());
|
||||||
|
|
||||||
for (Permanent permanent: game.getBattlefield().getActivePermanents(filterPermanents, source.getControllerId(), game)) {
|
for (Permanent permanent : game.getBattlefield().getActivePermanents(filterPermanents, source.getControllerId(), game)) {
|
||||||
if (!Objects.equals(permanent, hellcarverDemon)) {
|
if (!Objects.equals(permanent, hellcarverDemon)) {
|
||||||
permanent.sacrifice(source.getSourceId(), game);
|
permanent.sacrifice(source.getSourceId(), game);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player != null && !player.getHand().isEmpty()) {
|
if (controller != null && !controller.getHand().isEmpty()) {
|
||||||
int cardsInHand = player.getHand().size();
|
int cardsInHand = controller.getHand().size();
|
||||||
player.discard(cardsInHand, source, game);
|
controller.discard(cardsInHand, false, source, game);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < 6; i++) {
|
for (int i = 0; i < 6; i++) {
|
||||||
if (player != null && player.getLibrary().hasCards()) {
|
if (controller != null
|
||||||
Card topCard = player.getLibrary().getFromTop(game);
|
&& controller.getLibrary().hasCards()) {
|
||||||
|
Card topCard = controller.getLibrary().getFromTop(game);
|
||||||
topCard.moveToExile(source.getSourceId(), "Cards exiled by Hellcarver Demon", source.getSourceId(), game);
|
topCard.moveToExile(source.getSourceId(), "Cards exiled by Hellcarver Demon", source.getSourceId(), game);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
while (player != null && player.canRespond() && player.chooseUse(Outcome.PlayForFree, "Cast another nonland card exiled with Hellcarver Demon without paying that card's mana cost?", source, game)) {
|
while (controller != null
|
||||||
|
&& controller.canRespond()
|
||||||
|
&& controller.chooseUse(Outcome.PlayForFree, controller.getLogName() + " can cast another nonland card exiled with Hellcarver Demon without paying that card's mana cost.", source, game)) {
|
||||||
TargetCardInExile target = new TargetCardInExile(filter, source.getSourceId());
|
TargetCardInExile target = new TargetCardInExile(filter, source.getSourceId());
|
||||||
while (player.choose(Outcome.PlayForFree, game.getExile().getExileZone(source.getSourceId()), target, game)) {
|
while (controller.chooseUse(Outcome.PlayForFree, "Cast another spell exiled by Hellcarver Demon?", source, game)) {
|
||||||
Card card = game.getCard(target.getFirstTarget());
|
controller.choose(Outcome.PlayForFree, game.getExile().getExileZone(source.getSourceId()), target, game);
|
||||||
if (card != null) {
|
Card card = game.getCard(target.getFirstTarget());
|
||||||
game.getExile().removeCard(card, game);
|
if (card != null) {
|
||||||
player.cast(card.getSpellAbility(), game, true);
|
ContinuousEffect effect = new HellcarverDemonCastFromExileEffect();
|
||||||
}
|
effect.setTargetPointer(new FixedTarget(card.getId()));
|
||||||
target.clearChosen();
|
game.addEffect(effect, source);
|
||||||
|
controller.cast(card.getSpellAbility(), game, true);
|
||||||
|
}
|
||||||
|
target.clearChosen();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HellcarverDemonEffect copy() {
|
public HellcarverDemonEffect copy() {
|
||||||
return new HellcarverDemonEffect(this);
|
return new HellcarverDemonEffect(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class HellcarverDemonCastFromExileEffect extends AsThoughEffectImpl {
|
||||||
|
|
||||||
|
public HellcarverDemonCastFromExileEffect() {
|
||||||
|
super(AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, Duration.Custom, Outcome.Benefit);
|
||||||
|
staticText = "You may play the card from exile without paying its mana cost";
|
||||||
|
}
|
||||||
|
|
||||||
|
public HellcarverDemonCastFromExileEffect(final HellcarverDemonCastFromExileEffect effect) {
|
||||||
|
super(effect);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean apply(Game game, Ability source) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HellcarverDemonCastFromExileEffect copy() {
|
||||||
|
return new HellcarverDemonCastFromExileEffect(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean applies(UUID sourceId, Ability source, UUID affectedControllerId, Game game) {
|
||||||
|
if (targetPointer.getTargets(game, source).contains(sourceId)) {
|
||||||
|
return game.getState().getZone(sourceId) == Zone.EXILED;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue