[ONE] Implement Soulless Jailer (#10013)

This commit is contained in:
Merlingilb 2023-02-21 03:13:36 +01:00 committed by GitHub
parent 71f4d4b19d
commit d22930cbb0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 104 additions and 0 deletions

View file

@ -0,0 +1,103 @@
package mage.cards.s;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ContinuousRuleModifyingEffectImpl;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.ZoneChangeEvent;
import java.util.UUID;
public class SoullessJailer extends CardImpl {
public SoullessJailer(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{2}");
this.addSubType(SubType.PHYREXIAN);
this.addSubType(SubType.GOLEM);
this.power = new MageInt(0);
this.toughness = new MageInt(4);
//Permanent cards in graveyards cant enter the battlefield.
this.addAbility(new SimpleStaticAbility(new SoullessJailerEnterEffect()));
//Players cant cast noncreature spells from graveyards or exile.
this.addAbility(new SimpleStaticAbility(new SoullessJailerCastEffect()));
}
private SoullessJailer(final SoullessJailer card) {
super(card);
}
@Override
public SoullessJailer copy() {
return new SoullessJailer(this);
}
}
class SoullessJailerEnterEffect extends ContinuousRuleModifyingEffectImpl {
SoullessJailerEnterEffect() {
super(Duration.WhileOnBattlefield, Outcome.Benefit);
staticText = "permanent cards in graveyards can't enter the battlefield";
}
private SoullessJailerEnterEffect(final SoullessJailerEnterEffect effect) {
super(effect);
}
@Override
public SoullessJailerEnterEffect copy() {
return new SoullessJailerEnterEffect(this);
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.ZONE_CHANGE;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
if (zEvent.getToZone() != Zone.BATTLEFIELD
|| zEvent.getFromZone() != Zone.GRAVEYARD) {
return false;
}
Card card = game.getCard(zEvent.getTargetId());
return card != null && card.isPermanent(game);
}
}
class SoullessJailerCastEffect extends ContinuousRuleModifyingEffectImpl {
SoullessJailerCastEffect() {
super(Duration.WhileOnBattlefield, Outcome.Benefit);
staticText = "players can't cast noncreature spells from graveyards or exile";
}
private SoullessJailerCastEffect(final SoullessJailerCastEffect effect) {
super(effect);
}
@Override
public SoullessJailerCastEffect copy() {
return new SoullessJailerCastEffect(this);
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.CAST_SPELL;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
return game.getCard(event.getSourceId()) != null
&& !game.getCard(event.getSourceId()).isCreature(game)
&& (game.getState().getZone(event.getSourceId()) == Zone.GRAVEYARD
|| game.getState().getZone(event.getSourceId()) == Zone.EXILED);
}
}

View file

@ -205,6 +205,7 @@ public final class PhyrexiaAllWillBeOne extends ExpansionSet {
cards.add(new SetCardInfo("Skyscythe Engulfer", 183, Rarity.COMMON, mage.cards.s.SkyscytheEngulfer.class));
cards.add(new SetCardInfo("Slaughter Singer", 216, Rarity.UNCOMMON, mage.cards.s.SlaughterSinger.class));
cards.add(new SetCardInfo("Solphim, Mayhem Dominus", 150, Rarity.MYTHIC, mage.cards.s.SolphimMayhemDominus.class));
cards.add(new SetCardInfo("Soulless Jailer", 241, Rarity.RARE, mage.cards.s.SoullessJailer.class));
cards.add(new SetCardInfo("Staff of Compleation", 242, Rarity.MYTHIC, mage.cards.s.StaffOfCompleation.class));
cards.add(new SetCardInfo("Stinging Hivemaster", 110, Rarity.COMMON, mage.cards.s.StingingHivemaster.class));
cards.add(new SetCardInfo("Surgical Skullbomb", 243, Rarity.COMMON, mage.cards.s.SurgicalSkullbomb.class));