[MID] Implemented Hostile Hostel // Creeping Inn (#8278)

* [MID] Implemented Necrosynthesis

* [MID] Refactored Hostile Hostel // Creeping Inn

* [MID] Refactored Hostile Hostel // Creeping Inn
This commit is contained in:
Raphael "who?!" Kehldorfer 2021-09-19 18:41:29 +02:00 committed by GitHub
parent ef313d20ad
commit f02575ca9f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 205 additions and 0 deletions

View file

@ -0,0 +1,111 @@
package mage.cards.c;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.AttacksTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.PhaseOutSourceEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.StaticFilters;
import mage.game.ExileZone;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetCardInGraveyard;
import mage.util.CardUtil;
import java.util.UUID;
/**
* @author LePwnerer
*/
public final class CreepingInn extends CardImpl {
public CreepingInn(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "");
this.subtype.add(SubType.HORROR);
this.subtype.add(SubType.CONSTRUCT);
this.power = new MageInt(3);
this.toughness = new MageInt(7);
this.color.setBlack(true);
this.transformable = true;
this.nightCard = true;
// Whenever Creeping Inn attacks, you may exile a creature card from your graveyard.
// If you do, each opponent loses X life and you gain X life,
// where X is the number of creature cards exiled with Creeping Inn.
this.addAbility(new AttacksTriggeredAbility(new CreepingInnEffect()));
// {4}: Creeping Inn phases out.
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new PhaseOutSourceEffect(), new ManaCostsImpl("{4}")));
}
private CreepingInn(final CreepingInn card) {
super(card);
}
@Override
public CreepingInn copy() {
return new CreepingInn(this);
}
}
class CreepingInnEffect extends OneShotEffect {
public CreepingInnEffect() {
super(Outcome.Exile);
this.staticText = "you may exile a creature card from your graveyard. " +
"If you do, each opponent loses X life and you gain X life, " +
"where X is the number of creature cards exiled with Creeping Inn.";
}
public CreepingInnEffect(final CreepingInnEffect effect) {
super(effect);
}
@Override
public CreepingInnEffect copy() {
return new CreepingInnEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
Permanent permanent = source.getSourcePermanentOrLKI(game);
if (player != null && permanent != null) {
UUID exileId = CardUtil.getExileZoneId(game, source);
TargetCardInGraveyard target = new TargetCardInGraveyard(0, 1, StaticFilters.FILTER_CARD_CREATURE_YOUR_GRAVEYARD);
target.setNotTarget(true);
if (target.canChoose(source.getSourceId(), player.getId(), game)) {
if (player.choose(Outcome.Exile, target, source.getId(), game)) {
Card cardChosen = game.getCard(target.getFirstTarget());
if (cardChosen != null) {
int lifeAmount = 0;
player.moveCardsToExile(cardChosen, source, game, true, exileId, permanent.getName());
ExileZone exile = game.getExile().getExileZone(exileId);
if (exile != null) {
for (UUID cardId : exile) {
lifeAmount++;
}
}
for (UUID playerId : game.getOpponents(source.getControllerId())) {
game.getPlayer(playerId).loseLife(lifeAmount, game, source, false);
}
player.gainLife(lifeAmount, game, source);
}
}
}
return true;
}
return false;
}
}

View file

@ -0,0 +1,92 @@
package mage.cards.h;
import mage.abilities.Ability;
import mage.abilities.common.ActivateAsSorceryActivatedAbility;
import mage.abilities.costs.common.SacrificeTargetCost;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.TransformSourceEffect;
import mage.abilities.keyword.TransformAbility;
import mage.abilities.mana.ColorlessManaAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.counters.CounterType;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetControlledCreaturePermanent;
import java.util.UUID;
import static mage.filter.StaticFilters.FILTER_CONTROLLED_CREATURE_SHORT_TEXT;
/**
* @author LePwnerer
*/
public final class HostileHostel extends CardImpl {
public HostileHostel(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.LAND}, "");
this.transformable = true;
this.secondSideCardClazz = mage.cards.c.CreepingInn.class;
// {T}: Add {C}.
this.addAbility(new ColorlessManaAbility());
// {1}, {T}, Sacrifice a creature: Put a soul counter on Hostile Hostel. Then if there are three or more soul counters on it, remove those counters, transform it, then untap it. Activate only as a sorcery.
this.addAbility(new TransformAbility());
Ability ability = new ActivateAsSorceryActivatedAbility(Zone.BATTLEFIELD, new HostileHostelEffect(), new ManaCostsImpl("{1}"));
ability.addCost(new TapSourceCost());
ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent(FILTER_CONTROLLED_CREATURE_SHORT_TEXT)));
this.addAbility(ability);
}
private HostileHostel(final HostileHostel card) {
super(card);
}
@Override
public HostileHostel copy() {
return new HostileHostel(this);
}
}
class HostileHostelEffect extends OneShotEffect {
HostileHostelEffect() {
super(Outcome.Benefit);
this.staticText = "Put a soul counter on {this}. " +
"Then if there are three or more soul counters on it, remove those counters, transform it, then untap it.";
}
HostileHostelEffect(final mage.cards.h.HostileHostelEffect effect) {
super(effect);
}
@Override
public mage.cards.h.HostileHostelEffect copy() {
return new mage.cards.h.HostileHostelEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
Permanent permanent = source.getSourcePermanentIfItStillExists(game);
if (permanent != null && player != null) {
permanent.addCounters(CounterType.SOUL.createInstance(), source.getControllerId(), source, game);
int counters = permanent.getCounters(game).getCount(CounterType.SOUL);
if (counters > 2) {
permanent.removeCounters(CounterType.SOUL.getName(), counters, source, game);
new TransformSourceEffect(true).apply(game, source);
permanent.untap(game);
}
return true;
}
return false;
}
}

View file

@ -89,6 +89,7 @@ public final class InnistradMidnightHunt extends ExpansionSet {
cards.add(new SetCardInfo("Covetous Castaway", 45, Rarity.UNCOMMON, mage.cards.c.CovetousCastaway.class));
cards.add(new SetCardInfo("Covetous Geist", 92, Rarity.UNCOMMON, mage.cards.c.CovetousGeist.class));
cards.add(new SetCardInfo("Crawl from the Cellar", 93, Rarity.COMMON, mage.cards.c.CrawlFromTheCellar.class));
cards.add(new SetCardInfo("Creeping Inn", 264, Rarity.MYTHIC, mage.cards.c.CreepingInn.class));
cards.add(new SetCardInfo("Croaking Counterpart", 215, Rarity.RARE, mage.cards.c.CroakingCounterpart.class));
cards.add(new SetCardInfo("Crossroads Candleguide", 253, Rarity.COMMON, mage.cards.c.CrossroadsCandleguide.class));
cards.add(new SetCardInfo("Curse of Shaken Faith", 134, Rarity.RARE, mage.cards.c.CurseOfShakenFaith.class));
@ -172,6 +173,7 @@ public final class InnistradMidnightHunt extends ExpansionSet {
cards.add(new SetCardInfo("Hobbling Zombie", 106, Rarity.COMMON, mage.cards.h.HobblingZombie.class));
cards.add(new SetCardInfo("Homestead Courage", 24, Rarity.COMMON, mage.cards.h.HomesteadCourage.class));
cards.add(new SetCardInfo("Hook-Haunt Drifter", 42, Rarity.COMMON, mage.cards.h.HookHauntDrifter.class));
cards.add(new SetCardInfo("Hostile Hostel", 264, Rarity.MYTHIC, mage.cards.h.HostileHostel.class));
cards.add(new SetCardInfo("Hound Tamer", 187, Rarity.UNCOMMON, mage.cards.h.HoundTamer.class));
cards.add(new SetCardInfo("Howl of the Hunt", 188, Rarity.COMMON, mage.cards.h.HowlOfTheHunt.class));
cards.add(new SetCardInfo("Hungry for More", 228, Rarity.UNCOMMON, mage.cards.h.HungryForMore.class));