[MKM] Implement Blood Spatter Analysis (#11863)

This commit is contained in:
Cameron Merkel 2024-02-27 16:30:17 -06:00 committed by GitHub
parent 3486c57364
commit 9e587ca05d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 108 additions and 0 deletions

View file

@ -0,0 +1,105 @@
package mage.cards.b;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.common.delayed.ReflexiveTriggeredAbility;
import mage.abilities.condition.common.SourceHasCounterCondition;
import mage.abilities.costs.common.SacrificeSourceCost;
import mage.abilities.decorator.ConditionalOneShotEffect;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.abilities.effects.common.DoWhenCostPaid;
import mage.abilities.effects.common.MillCardsControllerEffect;
import mage.abilities.effects.common.ReturnFromGraveyardToHandTargetEffect;
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.filter.StaticFilters;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.ZoneChangeBatchEvent;
import mage.game.events.ZoneChangeEvent;
import mage.game.permanent.Permanent;
import mage.target.common.TargetCardInYourGraveyard;
import mage.target.common.TargetOpponentsCreaturePermanent;
import java.util.UUID;
/**
* @author Cguy7777
*/
public final class BloodSpatterAnalysis extends CardImpl {
public BloodSpatterAnalysis(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{B}{R}");
// When Blood Spatter Analysis enters the battlefield, it deals 3 damage to target creature an opponent controls.
Ability ability = new EntersBattlefieldTriggeredAbility(new DamageTargetEffect(3));
ability.addTarget(new TargetOpponentsCreaturePermanent());
this.addAbility(ability);
// Whenever one or more creatures die, mill a card and put a bloodstain counter on Blood Spatter Analysis.
// Then sacrifice it if it has five or more bloodstain counters on it.
// When you do, return target creature card from your graveyard to your hand.
this.addAbility(new BloodSpatterAnalysisTriggeredAbility());
}
private BloodSpatterAnalysis(final BloodSpatterAnalysis card) {
super(card);
}
@Override
public BloodSpatterAnalysis copy() {
return new BloodSpatterAnalysis(this);
}
}
class BloodSpatterAnalysisTriggeredAbility extends TriggeredAbilityImpl {
BloodSpatterAnalysisTriggeredAbility() {
super(Zone.BATTLEFIELD, new MillCardsControllerEffect(1));
this.addEffect(new AddCountersSourceEffect(CounterType.BLOODSTAIN.createInstance()).concatBy("and"));
ReflexiveTriggeredAbility returnAbility = new ReflexiveTriggeredAbility(new ReturnFromGraveyardToHandTargetEffect(), false);
returnAbility.addTarget(new TargetCardInYourGraveyard(StaticFilters.FILTER_CARD_CREATURE_YOUR_GRAVEYARD));
this.addEffect(new ConditionalOneShotEffect(
new DoWhenCostPaid(returnAbility, new SacrificeSourceCost(), null, false),
new SourceHasCounterCondition(CounterType.BLOODSTAIN, 5))
.setText("Then sacrifice it if it has five or more bloodstain counters on it. When you do, return target creature card from your graveyard to your hand"));
setTriggerPhrase("Whenever one or more creatures die, ");
}
private BloodSpatterAnalysisTriggeredAbility(final BloodSpatterAnalysisTriggeredAbility ability) {
super(ability);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.ZONE_CHANGE_BATCH;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
ZoneChangeBatchEvent zBatchEvent = (ZoneChangeBatchEvent) event;
for (ZoneChangeEvent zEvent : zBatchEvent.getEvents()) {
if (zEvent.isDiesEvent()) {
Permanent permanent = game.getPermanentOrLKIBattlefield(zEvent.getTargetId());
if (permanent != null && permanent.isCreature(game)) {
return true;
}
}
}
return false;
}
@Override
public BloodSpatterAnalysisTriggeredAbility copy() {
return new BloodSpatterAnalysisTriggeredAbility(this);
}
}

View file

@ -47,6 +47,8 @@ public final class MurdersAtKarlovManor extends ExpansionSet {
cards.add(new SetCardInfo("Basilica Stalker", 78, Rarity.COMMON, mage.cards.b.BasilicaStalker.class));
cards.add(new SetCardInfo("Behind the Mask", 39, Rarity.COMMON, mage.cards.b.BehindTheMask.class));
cards.add(new SetCardInfo("Benthic Criminologists", 40, Rarity.COMMON, mage.cards.b.BenthicCriminologists.class));
cards.add(new SetCardInfo("Blood Spatter Analysis", 189, Rarity.RARE, mage.cards.b.BloodSpatterAnalysis.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Blood Spatter Analysis", 413, Rarity.RARE, mage.cards.b.BloodSpatterAnalysis.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Bolrac-Clan Basher", 112, Rarity.UNCOMMON, mage.cards.b.BolracClanBasher.class));
cards.add(new SetCardInfo("Branch of Vitu-Ghazi", 258, Rarity.UNCOMMON, mage.cards.b.BranchOfVituGhazi.class));
cards.add(new SetCardInfo("Burden of Proof", 42, Rarity.UNCOMMON, mage.cards.b.BurdenOfProof.class));

View file

@ -26,6 +26,7 @@ public enum CounterType {
BLESSING("blessing"),
BLOOD("blood"),
BLOODLINE("bloodline"),
BLOODSTAIN("bloodstain"),
BOOK("book"),
BORE("bore"),
BOUNTY("bounty"),