Implement [JUD] Soulgorger Orgg (#10228)

This commit is contained in:
xenohedron 2023-04-20 20:42:45 -04:00 committed by GitHub
parent 8013f4909b
commit caf331c368
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 118 additions and 0 deletions

View file

@ -0,0 +1,117 @@
package mage.cards.s;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.common.LeavesBattlefieldTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.abilities.keyword.TrampleAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.game.Game;
import mage.players.Player;
/**
* @author xenohedron
*/
public final class SoulgorgerOrgg extends CardImpl {
public SoulgorgerOrgg(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{R}{R}");
this.subtype.add(SubType.NIGHTMARE);
this.subtype.add(SubType.ORGG);
this.power = new MageInt(6);
this.toughness = new MageInt(6);
// Trample
this.addAbility(TrampleAbility.getInstance());
// When Soulgorger Orgg enters the battlefield, you lose all but 1 life.
this.addAbility(new EntersBattlefieldTriggeredAbility(new SoulgorgerOrggLoseLifeEffect()));
// When Soulgorger Orgg leaves the battlefield, you gain life equal to the life you lost when it entered the battlefield.
this.addAbility(new LeavesBattlefieldTriggeredAbility(new SoulgorgerOrggGainLifeEffect(), false));
}
private SoulgorgerOrgg(final SoulgorgerOrgg card) {
super(card);
}
@Override
public SoulgorgerOrgg copy() {
return new SoulgorgerOrgg(this);
}
}
class SoulgorgerOrggLoseLifeEffect extends OneShotEffect {
public SoulgorgerOrggLoseLifeEffect() {
super(Outcome.LoseLife);
staticText = "you lose all but 1 life";
}
public SoulgorgerOrggLoseLifeEffect(final SoulgorgerOrggLoseLifeEffect effect) {
super(effect);
}
@Override
public SoulgorgerOrggLoseLifeEffect copy() {
return new SoulgorgerOrggLoseLifeEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player != null) {
int lifeValue = 0;
if (player.getLife() > 1) {
lifeValue = player.getLife() - 1;
}
game.getState().setValue(source.getSourceId().toString() + source.getControllerId().toString() + source.getSourceObjectZoneChangeCounter() + "_lifeValue", lifeValue);
if (lifeValue > 0) {
player.loseLife(lifeValue, game, source, false);
}
}
return true;
}
}
class SoulgorgerOrggGainLifeEffect extends OneShotEffect {
public SoulgorgerOrggGainLifeEffect() {
super(Outcome.GainLife);
staticText = "you gain life equal to the life you lost when it entered the battlefield";
}
public SoulgorgerOrggGainLifeEffect(final SoulgorgerOrggGainLifeEffect effect) {
super(effect);
}
@Override
public SoulgorgerOrggGainLifeEffect copy() {
return new SoulgorgerOrggGainLifeEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
Object obj = game.getState().getValue(source.getSourceId().toString() + source.getControllerId().toString() + (source.getSourceObjectZoneChangeCounter() - 1) + "_lifeValue");
if (!(obj instanceof Integer)) {
return false;
}
int lifeValue = (int) obj;
if (player != null && lifeValue > 0) {
player.gainLife(lifeValue, game, source);
}
return true;
}
}

View file

@ -136,6 +136,7 @@ public final class Judgment extends ExpansionSet {
cards.add(new SetCardInfo("Silver Seraph", 23, Rarity.RARE, mage.cards.s.SilverSeraph.class));
cards.add(new SetCardInfo("Solitary Confinement", 24, Rarity.RARE, mage.cards.s.SolitaryConfinement.class));
cards.add(new SetCardInfo("Soulcatchers' Aerie", 25, Rarity.UNCOMMON, mage.cards.s.SoulcatchersAerie.class));
cards.add(new SetCardInfo("Soulgorger Orgg", 99, Rarity.UNCOMMON, mage.cards.s.SoulgorgerOrgg.class));
cards.add(new SetCardInfo("Spellgorger Barbarian", 100, Rarity.COMMON, mage.cards.s.SpellgorgerBarbarian.class));
cards.add(new SetCardInfo("Spelljack", 51, Rarity.RARE, mage.cards.s.Spelljack.class));
cards.add(new SetCardInfo("Spirit Cairn", 26, Rarity.UNCOMMON, mage.cards.s.SpiritCairn.class));