mirror of
https://github.com/correl/mage.git
synced 2024-12-26 11:09:27 +00:00
[AFC] Implemented Sword of Hours
This commit is contained in:
parent
36affdcdeb
commit
fe4edbd664
5 changed files with 180 additions and 122 deletions
|
@ -1,8 +1,6 @@
|
|||
|
||||
package mage.cards.b;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.common.DealsCombatDamageEquippedTriggeredAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.costs.mana.GenericManaCost;
|
||||
import mage.abilities.dynamicvalue.common.CountersSourceCount;
|
||||
|
@ -14,29 +12,29 @@ import mage.cards.CardSetInfo;
|
|||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.counters.CounterType;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.DamagedEvent;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author North
|
||||
*/
|
||||
public final class BansheesBlade extends CardImpl {
|
||||
|
||||
private static final CountersSourceCount chargeCountersCount = new CountersSourceCount(CounterType.CHARGE);
|
||||
|
||||
public BansheesBlade(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{2}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{2}");
|
||||
this.subtype.add(SubType.EQUIPMENT);
|
||||
|
||||
// Equipped creature gets +1/+1 for each charge counter on Banshee's Blade.
|
||||
CountersSourceCount chargeCountersCount = new CountersSourceCount(CounterType.CHARGE);
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostEquippedEffect(chargeCountersCount, chargeCountersCount)));
|
||||
this.addAbility(new SimpleStaticAbility(new BoostEquippedEffect(chargeCountersCount, chargeCountersCount)));
|
||||
|
||||
// Whenever equipped creature deals combat damage, put a charge counter on Banshee's Blade.
|
||||
this.addAbility(new BansheesBladeAbility());
|
||||
this.addAbility(new DealsCombatDamageEquippedTriggeredAbility(
|
||||
new AddCountersSourceEffect(CounterType.CHARGE.createInstance(1))
|
||||
));
|
||||
|
||||
// Equip {2}
|
||||
this.addAbility(new EquipAbility(Outcome.AddAbility, new GenericManaCost(2)));
|
||||
}
|
||||
|
@ -50,50 +48,3 @@ public final class BansheesBlade extends CardImpl {
|
|||
return new BansheesBlade(this);
|
||||
}
|
||||
}
|
||||
|
||||
class BansheesBladeAbility extends TriggeredAbilityImpl {
|
||||
|
||||
private boolean usedInPhase;
|
||||
|
||||
public BansheesBladeAbility() {
|
||||
super(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.CHARGE.createInstance(1)));
|
||||
this.usedInPhase = false;
|
||||
}
|
||||
|
||||
public BansheesBladeAbility(final BansheesBladeAbility ability) {
|
||||
super(ability);
|
||||
this.usedInPhase = ability.usedInPhase;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BansheesBladeAbility copy() {
|
||||
return new BansheesBladeAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.DAMAGED_PLAYER
|
||||
|| event.getType() == GameEvent.EventType.DAMAGED_PERMANENT
|
||||
|| event.getType() == GameEvent.EventType.COMBAT_DAMAGE_STEP_PRE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (event instanceof DamagedEvent && ((DamagedEvent) event).isCombatDamage() && !usedInPhase) {
|
||||
Permanent permanent = game.getPermanent(event.getSourceId());
|
||||
if (permanent != null && permanent.getAttachments().contains(this.getSourceId())) {
|
||||
usedInPhase = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (event.getType() == GameEvent.EventType.COMBAT_DAMAGE_STEP_PRE) {
|
||||
usedInPhase = false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "Whenever equipped creature deals combat damage, put a charge counter on {this}.";
|
||||
}
|
||||
}
|
||||
|
|
96
Mage.Sets/src/mage/cards/s/SwordOfHours.java
Normal file
96
Mage.Sets/src/mage/cards/s/SwordOfHours.java
Normal file
|
@ -0,0 +1,96 @@
|
|||
package mage.cards.s;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.AttacksAttachedTriggeredAbility;
|
||||
import mage.abilities.common.DealsCombatDamageEquippedTriggeredAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.counter.AddCountersAttachedEffect;
|
||||
import mage.abilities.keyword.EquipAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.counters.CounterType;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class SwordOfHours extends CardImpl {
|
||||
|
||||
public SwordOfHours(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{2}");
|
||||
|
||||
this.subtype.add(SubType.EQUIPMENT);
|
||||
|
||||
// Whenever equipped creature attacks, put a +1/+1 counter on it.
|
||||
this.addAbility(new AttacksAttachedTriggeredAbility(
|
||||
new AddCountersAttachedEffect(CounterType.P1P1.createInstance(), "it")
|
||||
));
|
||||
|
||||
// Whenever equipped creature deals combat damage, roll a d12. If the result is greater than the damage dealt or the result is 12, double the number of +1/+1 counters on that creature.
|
||||
this.addAbility(new DealsCombatDamageEquippedTriggeredAbility(new SwordOfHoursEffect()));
|
||||
|
||||
// Equip {2}
|
||||
this.addAbility(new EquipAbility(2));
|
||||
}
|
||||
|
||||
private SwordOfHours(final SwordOfHours card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SwordOfHours copy() {
|
||||
return new SwordOfHours(this);
|
||||
}
|
||||
}
|
||||
|
||||
class SwordOfHoursEffect extends OneShotEffect {
|
||||
|
||||
SwordOfHoursEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "roll a d12. If the result is greater than the damage dealt " +
|
||||
"or the result is 12, double the number of +1/+1 counters on that creature";
|
||||
}
|
||||
|
||||
private SwordOfHoursEffect(final SwordOfHoursEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SwordOfHoursEffect copy() {
|
||||
return new SwordOfHoursEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player == null) {
|
||||
return false;
|
||||
}
|
||||
int result = player.rollDice(source, game, 12);
|
||||
int damage = (Integer) getValue("damage");
|
||||
if (result != 12 && damage <= result) {
|
||||
return true;
|
||||
}
|
||||
Permanent sourcePermanent = source.getSourcePermanentOrLKI(game);
|
||||
if (sourcePermanent == null) {
|
||||
return true;
|
||||
}
|
||||
Permanent permanent = game.getPermanent(sourcePermanent.getAttachedTo());
|
||||
if (permanent == null) {
|
||||
return true;
|
||||
}
|
||||
permanent.addCounters(
|
||||
CounterType.P1P1.createInstance(
|
||||
permanent.getCounters(game).getCount(CounterType.P1P1)
|
||||
), source.getControllerId(), source, game
|
||||
);
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -1,10 +1,8 @@
|
|||
|
||||
package mage.cards.u;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.Mode;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.common.DealsCombatDamageEquippedTriggeredAbility;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.costs.common.RemoveCountersSourceCost;
|
||||
import mage.abilities.costs.mana.GenericManaCost;
|
||||
|
@ -17,25 +15,24 @@ import mage.cards.CardImpl;
|
|||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.counters.CounterType;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.DamagedEvent;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author Loki
|
||||
*/
|
||||
public final class UmezawasJitte extends CardImpl {
|
||||
|
||||
public UmezawasJitte(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{2}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{2}");
|
||||
addSuperType(SuperType.LEGENDARY);
|
||||
this.subtype.add(SubType.EQUIPMENT);
|
||||
|
||||
// Whenever equipped creature deals combat damage, put two charge counters on Umezawa's Jitte.
|
||||
this.addAbility(new UmezawasJitteAbility());
|
||||
this.addAbility(new DealsCombatDamageEquippedTriggeredAbility(
|
||||
new AddCountersSourceEffect(CounterType.CHARGE.createInstance(2))
|
||||
));
|
||||
|
||||
// Remove a charge counter from Umezawa's Jitte: Choose one — Equipped creature gets +2/+2 until end of turn.
|
||||
Ability ability = new SimpleActivatedAbility(
|
||||
|
@ -68,54 +65,3 @@ public final class UmezawasJitte extends CardImpl {
|
|||
return new UmezawasJitte(this);
|
||||
}
|
||||
}
|
||||
|
||||
class UmezawasJitteAbility extends TriggeredAbilityImpl {
|
||||
|
||||
private boolean usedInPhase;
|
||||
|
||||
public UmezawasJitteAbility() {
|
||||
super(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.CHARGE.createInstance(2)));
|
||||
this.usedInPhase = false;
|
||||
}
|
||||
|
||||
public UmezawasJitteAbility(final UmezawasJitteAbility ability) {
|
||||
super(ability);
|
||||
this.usedInPhase = ability.usedInPhase;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UmezawasJitteAbility copy() {
|
||||
return new UmezawasJitteAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkEventType(GameEvent event, Game game) {
|
||||
switch(event.getType()) {
|
||||
case DAMAGED_PERMANENT:
|
||||
case DAMAGED_PLAYER:
|
||||
case COMBAT_DAMAGE_STEP_PRE:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (event instanceof DamagedEvent && !usedInPhase && ((DamagedEvent) event).isCombatDamage()) {
|
||||
Permanent permanent = game.getPermanent(event.getSourceId());
|
||||
if (permanent != null && permanent.getAttachments().contains(this.getSourceId())) {
|
||||
usedInPhase = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (event.getType() == GameEvent.EventType.COMBAT_DAMAGE_STEP_PRE) {
|
||||
usedInPhase = false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTriggerPhrase() {
|
||||
return "Whenever equipped creature deals combat damage, " ;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -226,6 +226,7 @@ public final class ForgottenRealmsCommander extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Sungrass Prairie", 264, Rarity.RARE, mage.cards.s.SungrassPrairie.class));
|
||||
cards.add(new SetCardInfo("Sunken Hollow", 265, Rarity.RARE, mage.cards.s.SunkenHollow.class));
|
||||
cards.add(new SetCardInfo("Swiftfoot Boots", 217, Rarity.UNCOMMON, mage.cards.s.SwiftfootBoots.class));
|
||||
cards.add(new SetCardInfo("Sword of Hours", 61, Rarity.UNCOMMON, mage.cards.s.SwordOfHours.class));
|
||||
cards.add(new SetCardInfo("Sword of the Animist", 218, Rarity.RARE, mage.cards.s.SwordOfTheAnimist.class));
|
||||
cards.add(new SetCardInfo("Swords to Plowshares", 75, Rarity.UNCOMMON, mage.cards.s.SwordsToPlowshares.class));
|
||||
cards.add(new SetCardInfo("Tainted Peak", 266, Rarity.UNCOMMON, mage.cards.t.TaintedPeak.class));
|
||||
|
|
|
@ -0,0 +1,64 @@
|
|||
package mage.abilities.common;
|
||||
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.DamagedBatchEvent;
|
||||
import mage.game.events.DamagedEvent;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public class DealsCombatDamageEquippedTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
public DealsCombatDamageEquippedTriggeredAbility(Effect effect) {
|
||||
this(effect, false);
|
||||
}
|
||||
|
||||
public DealsCombatDamageEquippedTriggeredAbility(Effect effect, boolean optional) {
|
||||
super(Zone.BATTLEFIELD, effect, optional);
|
||||
}
|
||||
|
||||
public DealsCombatDamageEquippedTriggeredAbility(final DealsCombatDamageEquippedTriggeredAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DealsCombatDamageEquippedTriggeredAbility copy() {
|
||||
return new DealsCombatDamageEquippedTriggeredAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.DAMAGED_PLAYER_BATCH
|
||||
|| event.getType() == GameEvent.EventType.DAMAGED_PERMANENT_BATCH;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
Permanent sourcePermanent = getSourcePermanentOrLKI(game);
|
||||
if (sourcePermanent == null || sourcePermanent.getAttachedTo() == null) {
|
||||
return false;
|
||||
}
|
||||
int amount = ((DamagedBatchEvent) event)
|
||||
.getEvents()
|
||||
.stream()
|
||||
.filter(DamagedEvent::isCombatDamage)
|
||||
.filter(e -> e.getSourceId().equals(sourcePermanent.getAttachedTo()))
|
||||
.mapToInt(GameEvent::getAmount)
|
||||
.sum();
|
||||
if (amount < 1) {
|
||||
return false;
|
||||
}
|
||||
this.getEffects().setValue("damage", amount);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTriggerPhrase() {
|
||||
return "Whenever equipped creature deals combat damage, ";
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue