Implemented Font of Agonies

This commit is contained in:
Evan Kranzler 2019-01-09 12:43:15 -05:00
parent fb9b69ae9a
commit 6aeedac387
4 changed files with 89 additions and 2 deletions

View file

@ -0,0 +1,81 @@
package mage.cards.f;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.RemoveCountersSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.DestroyTargetEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Zone;
import mage.counters.CounterType;
import mage.game.Game;
import mage.game.events.GameEvent;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class FontOfAgonies extends CardImpl {
public FontOfAgonies(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{B}");
// Whenever you pay life, put that many blood counters on Font of Agonies.
this.addAbility(new FontOfAgoniesTriggeredAbility());
// {1}{B}, Remove four blood counters from Font of Agonies: Destroy target creature.
Ability ability = new SimpleActivatedAbility(new DestroyTargetEffect(), new ManaCostsImpl("{1}{B}"));
ability.addCost(new RemoveCountersSourceCost(CounterType.BLOOD.createInstance(4)));
this.addAbility(ability);
}
private FontOfAgonies(final FontOfAgonies card) {
super(card);
}
@Override
public FontOfAgonies copy() {
return new FontOfAgonies(this);
}
}
class FontOfAgoniesTriggeredAbility extends TriggeredAbilityImpl {
FontOfAgoniesTriggeredAbility() {
super(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.BLOOD.createInstance()), false);
}
private FontOfAgoniesTriggeredAbility(final FontOfAgoniesTriggeredAbility ability) {
super(ability);
}
@Override
public FontOfAgoniesTriggeredAbility copy() {
return new FontOfAgoniesTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType().equals(GameEvent.EventType.LIFE_PAID);
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getPlayerId().equals(controllerId) && event.getAmount() > 0) {
this.getEffects().clear();
this.addEffect(new AddCountersSourceEffect(CounterType.BLOOD.createInstance(event.getAmount())));
return true;
}
return false;
}
@Override
public String getRule() {
return "Whenever you pay life, put that many blood counters on {this}.";
}
}

View file

@ -74,6 +74,7 @@ public final class RavnicaAllegiance extends ExpansionSet {
cards.add(new SetCardInfo("End-Raze Forerunners", 124, Rarity.RARE, mage.cards.e.EndRazeForerunners.class));
cards.add(new SetCardInfo("Essence Capture", 37, Rarity.UNCOMMON, mage.cards.e.EssenceCapture.class));
cards.add(new SetCardInfo("Ethereal Absolution", 170, Rarity.RARE, mage.cards.e.EtherealAbsolution.class));
cards.add(new SetCardInfo("Font of Agonies", 74, Rarity.RARE, mage.cards.f.FontOfAgonies.class));
cards.add(new SetCardInfo("Frenzied Arynx", 173, Rarity.COMMON, mage.cards.f.FrenziedArynx.class));
cards.add(new SetCardInfo("Frilled Mystic", 174, Rarity.UNCOMMON, mage.cards.f.FrilledMystic.class));
cards.add(new SetCardInfo("Gate Colossus", 232, Rarity.UNCOMMON, mage.cards.g.GateColossus.class));

View file

@ -1,15 +1,16 @@
package mage.abilities.costs.common;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.costs.Cost;
import mage.abilities.costs.CostImpl;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.game.Game;
import mage.game.events.GameEvent;
import java.util.UUID;
/**
*
* @author BetaSteward_at_googlemail.com
*/
public class PayLifeCost extends CostImpl {
@ -49,6 +50,9 @@ public class PayLifeCost extends CostImpl {
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) {
int lifeToPayAmount = amount.calculate(game, ability, null);
this.paid = game.getPlayer(controllerId).loseLife(lifeToPayAmount, game, false) == lifeToPayAmount;
if (paid) {
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.LIFE_PAID, controllerId, sourceId, controllerId, lifeToPayAmount));
}
return paid;
}

View file

@ -221,6 +221,7 @@ public class GameEvent implements Serializable {
PLANESWALK, PLANESWALKED,
PAID_CUMULATIVE_UPKEEP,
DIDNT_PAY_CUMULATIVE_UPKEEP,
LIFE_PAID,
//permanent events
ENTERS_THE_BATTLEFIELD_SELF, /* 616.1a If any of the replacement and/or prevention effects are self-replacement effects (see rule 614.15),
one of them must be chosen. If not, proceed to rule 616.1b. */