mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 02:30:08 -08:00
cleanup to common class
This commit is contained in:
parent
0ae2c2b86e
commit
1fb0d26db9
2 changed files with 10 additions and 87 deletions
|
|
@ -1,10 +1,9 @@
|
|||
|
||||
package mage.cards.f;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.common.DealsCombatDamageTriggeredAbility;
|
||||
import mage.abilities.condition.common.ManaWasSpentCondition;
|
||||
import mage.abilities.decorator.ConditionalContinuousEffect;
|
||||
import mage.abilities.dynamicvalue.common.SavedDamageValue;
|
||||
import mage.abilities.effects.common.GainLifeEffect;
|
||||
import mage.abilities.effects.common.UntapTargetEffect;
|
||||
import mage.abilities.effects.common.continuous.GainAbilityTargetEffect;
|
||||
|
|
@ -13,15 +12,11 @@ import mage.abilities.keyword.HasteAbility;
|
|||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.ColoredManaSymbol;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.DamagedEvent;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
|
|
@ -36,7 +31,10 @@ public final class FlashConscription extends CardImpl {
|
|||
this.getSpellAbility().addEffect(new GainControlTargetEffect(Duration.EndOfTurn).setText("and gain control of it until end of turn"));
|
||||
this.getSpellAbility().addEffect(new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.EndOfTurn).setText("That creature gains haste until end of turn"));
|
||||
this.getSpellAbility().addEffect(new ConditionalContinuousEffect(
|
||||
new GainAbilityTargetEffect(new FlashConscriptionTriggeredAbility(), Duration.EndOfTurn),
|
||||
new GainAbilityTargetEffect(
|
||||
new DealsCombatDamageTriggeredAbility(new GainLifeEffect(SavedDamageValue.MUCH), false),
|
||||
Duration.EndOfTurn
|
||||
),
|
||||
ManaWasSpentCondition.WHITE,
|
||||
"If {W} was spent to cast this spell, the creature gains "
|
||||
+ "\"Whenever this creature deals combat damage, you gain that much life\" until end of turn"
|
||||
|
|
@ -54,43 +52,3 @@ public final class FlashConscription extends CardImpl {
|
|||
return new FlashConscription(this);
|
||||
}
|
||||
}
|
||||
|
||||
class FlashConscriptionTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
public FlashConscriptionTriggeredAbility() {
|
||||
super(Zone.BATTLEFIELD, null);
|
||||
}
|
||||
|
||||
private FlashConscriptionTriggeredAbility(final FlashConscriptionTriggeredAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FlashConscriptionTriggeredAbility copy() {
|
||||
return new FlashConscriptionTriggeredAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.DAMAGED_PERMANENT
|
||||
|| event.getType() == GameEvent.EventType.DAMAGED_PLAYER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
DamagedEvent damageEvent = (DamagedEvent) event;
|
||||
if (damageEvent.isCombatDamage()) {
|
||||
if (event.getSourceId().equals(this.sourceId)) {
|
||||
this.getEffects().clear();
|
||||
this.getEffects().add(new GainLifeEffect(damageEvent.getAmount()));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "Whenever {this} deals combat damage, you gain that much life.";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,13 +1,10 @@
|
|||
package mage.game.permanent.token;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.common.DealsCombatDamageTriggeredAbility;
|
||||
import mage.abilities.effects.common.SacrificeSourceEffect;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
|
||||
public final class VrondissRageOfAncientsToken extends TokenImpl {
|
||||
|
||||
|
|
@ -21,7 +18,7 @@ public final class VrondissRageOfAncientsToken extends TokenImpl {
|
|||
power = new MageInt(5);
|
||||
toughness = new MageInt(4);
|
||||
|
||||
this.addAbility(new VrondissRageOfAncientsTokenTriggeredAbility());
|
||||
this.addAbility(new DealsCombatDamageTriggeredAbility(new SacrificeSourceEffect(), false));
|
||||
}
|
||||
|
||||
private VrondissRageOfAncientsToken(final VrondissRageOfAncientsToken token) {
|
||||
|
|
@ -32,35 +29,3 @@ public final class VrondissRageOfAncientsToken extends TokenImpl {
|
|||
return new VrondissRageOfAncientsToken(this);
|
||||
}
|
||||
}
|
||||
|
||||
class VrondissRageOfAncientsTokenTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
public VrondissRageOfAncientsTokenTriggeredAbility() {
|
||||
super(Zone.BATTLEFIELD, new SacrificeSourceEffect(), false);
|
||||
}
|
||||
|
||||
protected VrondissRageOfAncientsTokenTriggeredAbility(final VrondissRageOfAncientsTokenTriggeredAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public VrondissRageOfAncientsTokenTriggeredAbility copy() {
|
||||
return new VrondissRageOfAncientsTokenTriggeredAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.DAMAGED_PLAYER
|
||||
|| event.getType() == GameEvent.EventType.DAMAGED_PERMANENT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
return event.getSourceId().equals(this.getSourceId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "When this creature deals damage, sacrifice it.";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue