Add Kicker Event

This commit is contained in:
Noah Gleason 2018-06-18 10:52:23 -04:00
parent acf6af17dd
commit c3b9d55e98
No known key found for this signature in database
GPG key ID: EC030EC6B0650A40
3 changed files with 7 additions and 15 deletions

View file

@ -1,9 +1,7 @@
package mage.cards.s;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.keyword.KickerAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
@ -11,7 +9,6 @@ import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.token.SaprolingToken;
import mage.game.stack.Spell;
import java.util.UUID;
@ -41,7 +38,7 @@ public final class SaprolingInfestation extends CardImpl {
class SaprolingInfestationTriggeredAbility extends TriggeredAbilityImpl {
SaprolingInfestationTriggeredAbility() {
super(Zone.BATTLEFIELD, new CreateTokenEffect(new SaprolingToken("INV")).setText("you create a 1/1 green Saproling creature token"), false);
super(Zone.BATTLEFIELD, new CreateTokenEffect(new SaprolingToken("INV")), false);
}
SaprolingInfestationTriggeredAbility(final SaprolingInfestationTriggeredAbility ability) {
@ -55,25 +52,17 @@ public final class SaprolingInfestation extends CardImpl {
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.SPELL_CAST;
return event.getType() == GameEvent.EventType.KICKED;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
Spell spell = game.getStack().getSpell(event.getTargetId());
if (spell != null) {
for (Ability ability : spell.getAbilities()) {
if (ability instanceof KickerAbility && ((KickerAbility) ability).getKickedCounter(game, spell.getSpellAbility()) > 0) {
return true;
}
}
}
return false;
return true;
}
@Override
public String getRule() {
return "Whenever a player kicks a spell, " + super.getRule();
return "Whenever a player kicks a spell, you put a 1/1 green Saproling creature token onto the battlefield.";
}
}
}

View file

@ -14,6 +14,7 @@ import mage.constants.AbilityType;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.players.Player;
/**
@ -152,6 +153,7 @@ public class KickerAbility extends StaticAbility implements OptionalAdditionalSo
amount += activations.get(key);
}
activations.put(key, amount);
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.KICKED, source.getSourceId(), source.getSourceId(), source.getControllerId()));
}
private String getActivationKey(Ability source, String costText, Game game) {

View file

@ -72,6 +72,7 @@ public class GameEvent implements Serializable {
MIRACLE_CARD_REVEALED,
MADNESS_CARD_EXILED,
INVESTIGATED,
KICKED,
DISCARD_CARD,
DISCARDED_CARD,
CYCLE_CARD, CYCLED_CARD,