mirror of
https://github.com/magefree/mage.git
synced 2026-01-26 21:29:17 -08:00
[MID] Implemented Curse of Shaken Faith
This commit is contained in:
parent
43b3f12b56
commit
71052fa417
2 changed files with 133 additions and 0 deletions
132
Mage.Sets/src/mage/cards/c/CurseOfShakenFaith.java
Normal file
132
Mage.Sets/src/mage/cards/c/CurseOfShakenFaith.java
Normal file
|
|
@ -0,0 +1,132 @@
|
|||
package mage.cards.c;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.stack.Spell;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetPlayer;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.common.AttachEffect;
|
||||
import mage.constants.Outcome;
|
||||
import mage.abilities.keyword.EnchantAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.watchers.common.SpellsCastWatcher;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author weirddan455
|
||||
*/
|
||||
public final class CurseOfShakenFaith extends CardImpl {
|
||||
|
||||
public CurseOfShakenFaith(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{R}");
|
||||
|
||||
this.subtype.add(SubType.AURA);
|
||||
this.subtype.add(SubType.CURSE);
|
||||
|
||||
// Enchant player
|
||||
TargetPlayer auraTarget = new TargetPlayer();
|
||||
this.getSpellAbility().addTarget(auraTarget);
|
||||
this.getSpellAbility().addEffect(new AttachEffect(Outcome.Detriment));
|
||||
Ability ability = new EnchantAbility(auraTarget.getTargetName());
|
||||
this.addAbility(ability);
|
||||
|
||||
// Whenever enchanted player casts a spell other than the first spell they cast each turn or copies a spell, Curse of Shaken Faith deals 2 damage to them.
|
||||
this.addAbility(new CurseOfShakenFaithTriggeredAbility());
|
||||
}
|
||||
|
||||
private CurseOfShakenFaith(final CurseOfShakenFaith card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CurseOfShakenFaith copy() {
|
||||
return new CurseOfShakenFaith(this);
|
||||
}
|
||||
}
|
||||
|
||||
class CurseOfShakenFaithTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
public CurseOfShakenFaithTriggeredAbility() {
|
||||
super(Zone.BATTLEFIELD, new CurseOfShakenFaithEffect());
|
||||
this.addWatcher(new SpellsCastWatcher());
|
||||
}
|
||||
|
||||
private CurseOfShakenFaithTriggeredAbility(final CurseOfShakenFaithTriggeredAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CurseOfShakenFaithTriggeredAbility copy() {
|
||||
return new CurseOfShakenFaithTriggeredAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.COPIED_STACKOBJECT
|
||||
|| event.getType() == GameEvent.EventType.SPELL_CAST;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
Permanent enchantment = game.getPermanentOrLKIBattlefield(sourceId);
|
||||
if (enchantment != null) {
|
||||
UUID enchantedPlayerId = enchantment.getAttachedTo();
|
||||
Spell spell = game.getSpell(event.getTargetId());
|
||||
if (spell != null && spell.isControlledBy(enchantedPlayerId)) {
|
||||
if (event.getType() == GameEvent.EventType.COPIED_STACKOBJECT) {
|
||||
return true;
|
||||
}
|
||||
SpellsCastWatcher watcher = game.getState().getWatcher(SpellsCastWatcher.class);
|
||||
if (watcher != null) {
|
||||
return watcher.getSpellsCastThisTurn(enchantedPlayerId).size() > 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTriggerPhrase() {
|
||||
return "Whenever enchanted player casts a spell other than the first spell they cast each turn or copies a spell, ";
|
||||
}
|
||||
}
|
||||
|
||||
class CurseOfShakenFaithEffect extends OneShotEffect {
|
||||
|
||||
public CurseOfShakenFaithEffect() {
|
||||
super(Outcome.Damage);
|
||||
staticText = "{this} deals 2 damage to them";
|
||||
}
|
||||
|
||||
private CurseOfShakenFaithEffect(final CurseOfShakenFaithEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CurseOfShakenFaithEffect copy() {
|
||||
return new CurseOfShakenFaithEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent enchantment = game.getPermanentOrLKIBattlefield(source.getSourceId());
|
||||
if (enchantment != null) {
|
||||
Player enchantedPlayer = game.getPlayer(enchantment.getAttachedTo());
|
||||
if (enchantedPlayer != null) {
|
||||
enchantedPlayer.damage(2, source.getSourceId(), source, game);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -48,6 +48,7 @@ public final class InnistradMidnightHunt extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Consider", 44, Rarity.COMMON, mage.cards.c.Consider.class));
|
||||
cards.add(new SetCardInfo("Contortionist Troupe", 178, Rarity.UNCOMMON, mage.cards.c.ContortionistTroupe.class));
|
||||
cards.add(new SetCardInfo("Croaking Counterpart", 215, Rarity.RARE, mage.cards.c.CroakingCounterpart.class));
|
||||
cards.add(new SetCardInfo("Curse of Shaken Faith", 134, Rarity.RARE, mage.cards.c.CurseOfShakenFaith.class));
|
||||
cards.add(new SetCardInfo("Dawnhart Rejuvenator", 180, Rarity.COMMON, mage.cards.d.DawnhartRejuvenator.class));
|
||||
cards.add(new SetCardInfo("Dawnhart Wardens", 308, Rarity.UNCOMMON, mage.cards.d.DawnhartWardens.class));
|
||||
cards.add(new SetCardInfo("Defend the Celestus", 182, Rarity.UNCOMMON, mage.cards.d.DefendTheCelestus.class));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue