* Kiora, the Crashing Wave - Some minor rework.

This commit is contained in:
LevelX2 2014-10-11 11:28:10 +02:00
parent d47dd0bb52
commit 36ef4c3bcf

View file

@ -29,7 +29,6 @@ package mage.sets.bornofthegods;
import java.util.UUID;
import mage.MageInt;
import mage.ObjectColor;
import mage.abilities.Ability;
import mage.abilities.LoyaltyAbility;
import mage.abilities.common.BeginningOfEndStepTriggeredAbility;
@ -43,7 +42,6 @@ import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.PhaseStep;
import mage.constants.Rarity;
import mage.constants.TargetController;
import mage.constants.Zone;
@ -56,8 +54,8 @@ import mage.game.events.DamageEvent;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.game.permanent.token.Token;
import mage.game.turn.Step;
import mage.target.TargetPermanent;
import mage.util.CardUtil;
/**
*
@ -109,7 +107,7 @@ public class KioraTheCrashingWave extends CardImpl {
class KioraPreventionEffect extends PreventionEffectImpl {
public KioraPreventionEffect() {
super(Duration.Custom);
super(Duration.UntilYourNextTurn, Integer.MAX_VALUE, false, false);
staticText = "Until your next turn, prevent all damage that would be dealt to and dealt by target permanent an opponent controls";
}
@ -133,22 +131,11 @@ class KioraPreventionEffect extends PreventionEffectImpl {
for(UUID targetId :this.getTargetPointer().getTargets(game, source)) {
Permanent permanent = game.getPermanent(targetId);
if (permanent != null) {
permanent.addInfo(new StringBuilder("kioraPrevention").append(getId()).toString(),"[All damage that would be dealt to and dealt by this permanent is prevented.]");
permanent.addInfo(new StringBuilder("kioraPrevention").append(getId()).toString(),CardUtil.addToolTipMarkTags("All damage that would be dealt to and dealt by this permanent is prevented."));
}
}
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
GameEvent preventEvent = new GameEvent(GameEvent.EventType.PREVENT_DAMAGE, source.getFirstTarget(), source.getSourceId(), source.getControllerId(), event.getAmount(), false);
if (!game.replaceEvent(preventEvent)) {
int damage = event.getAmount();
event.setAmount(0);
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.PREVENTED_DAMAGE, source.getFirstTarget(), source.getSourceId(), source.getControllerId(), damage));
}
return false;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (super.applies(event, source, game) && event instanceof DamageEvent) {
@ -163,17 +150,14 @@ class KioraPreventionEffect extends PreventionEffectImpl {
@Override
public boolean isInactive(Ability source, Game game) {
if (game.getPhase().getStep().getType() == PhaseStep.UNTAP && game.getStep().getStepPart() == Step.StepPart.PRE)
{
if (game.getActivePlayerId().equals(source.getControllerId()) || game.getPlayer(source.getControllerId()).hasReachedNextTurnAfterLeaving()) {
for(UUID targetId :this.getTargetPointer().getTargets(game, source)) {
Permanent permanent = game.getPermanent(targetId);
if (permanent != null) {
permanent.addInfo(new StringBuilder("kioraPrevention").append(getId()).toString(),"");
}
if (super.isInactive(source, game)) {
for(UUID targetId :this.getTargetPointer().getTargets(game, source)) {
Permanent permanent = game.getPermanent(targetId);
if (permanent != null) {
permanent.addInfo(new StringBuilder("kioraPrevention").append(getId()).toString(),"");
}
return true;
}
return true;
}
return false;
}
@ -184,6 +168,7 @@ class KioraPreventionEffect extends PreventionEffectImpl {
*/
class KioraEmblem extends Emblem {
public KioraEmblem() {
this.setName("EMBLEM: Kiora, the Crashing Wave");
Ability ability = new BeginningOfEndStepTriggeredAbility(Zone.COMMAND, new CreateTokenEffect(new KioraKrakenToken()), TargetController.YOU, null, false);
this.getAbilities().add(ability);
}