forked from External/mage
fix Swathcutter Giant, use common class for those effects
This commit is contained in:
parent
2f5ba8736e
commit
d10a6b3a06
4 changed files with 29 additions and 158 deletions
|
|
@ -1,20 +1,19 @@
|
|||
package mage.cards.g;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.AttacksTriggeredAbility;
|
||||
import mage.abilities.condition.common.DeliriumCondition;
|
||||
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.DamageAllControlledTargetEffect;
|
||||
import mage.abilities.hint.common.CardTypesInGraveyardHint;
|
||||
import mage.constants.*;
|
||||
import mage.abilities.keyword.ReachAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SetTargetPointer;
|
||||
import mage.constants.SubType;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -35,7 +34,7 @@ public final class GougedZealot extends CardImpl {
|
|||
|
||||
// Delirium — Whenever Gouged Zealot attacks, if there are four or more card types among cards in your graveyard, Gouged Zealot deals 1 damage to each creature defending player controls.
|
||||
this.addAbility(new ConditionalInterveningIfTriggeredAbility(
|
||||
new AttacksTriggeredAbility(new GougedZealotEffect(), false, null, SetTargetPointer.PLAYER),
|
||||
new AttacksTriggeredAbility(new DamageAllControlledTargetEffect(1), false, null, SetTargetPointer.PLAYER),
|
||||
DeliriumCondition.instance,
|
||||
"<i>Delirium</i> — Whenever {this} attacks, if there are four or more card types among cards in your graveyard, {this} deals 1 damage to each creature defending player controls."
|
||||
).addHint(CardTypesInGraveyardHint.YOU));
|
||||
|
|
@ -50,32 +49,3 @@ public final class GougedZealot extends CardImpl {
|
|||
return new GougedZealot(this);
|
||||
}
|
||||
}
|
||||
|
||||
class GougedZealotEffect extends OneShotEffect {
|
||||
|
||||
GougedZealotEffect() {
|
||||
super(Outcome.Damage);
|
||||
this.staticText = "{this} deals 1 damage to each creature defending player controls";
|
||||
}
|
||||
|
||||
private GougedZealotEffect(final GougedZealotEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public GougedZealotEffect copy() {
|
||||
return new GougedZealotEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
UUID defendingPlayerId = getTargetPointer().getFirst(game, source);
|
||||
if (defendingPlayerId != null) {
|
||||
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, defendingPlayerId, game)) {
|
||||
permanent.damage(1, source.getSourceId(), source, game);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,26 +1,21 @@
|
|||
|
||||
package mage.cards.l;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Abilities;
|
||||
import mage.abilities.AbilitiesImpl;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.AttacksTriggeredAbility;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.DamageAllControlledTargetEffect;
|
||||
import mage.abilities.keyword.LevelUpAbility;
|
||||
import mage.abilities.keyword.LevelerCardBuilder;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.cards.LevelerCard;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SetTargetPointer;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.permanent.ControllerIdPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -46,7 +41,9 @@ public final class LordOfShatterskullPass extends LevelerCard {
|
|||
// 6/6
|
||||
// Whenever Lord of Shatterskull Pass attacks, it deals 6 damage to each creature defending player controls.
|
||||
Abilities<Ability> abilities2 = new AbilitiesImpl<>();
|
||||
abilities2.add(new AttacksTriggeredAbility(new LordOfShatterskullPassEffect(), false));
|
||||
abilities2.add(new AttacksTriggeredAbility(new DamageAllControlledTargetEffect(6)
|
||||
.setText("it deals 6 damage to each creature defending player controls"),
|
||||
false, null, SetTargetPointer.PLAYER));
|
||||
|
||||
this.addAbilities(LevelerCardBuilder.construct(
|
||||
new LevelerCardBuilder.LevelAbility(1, 5, abilities1, 6, 6),
|
||||
|
|
@ -63,35 +60,3 @@ public final class LordOfShatterskullPass extends LevelerCard {
|
|||
return new LordOfShatterskullPass(this);
|
||||
}
|
||||
}
|
||||
|
||||
class LordOfShatterskullPassEffect extends OneShotEffect {
|
||||
|
||||
LordOfShatterskullPassEffect() {
|
||||
super(Outcome.Damage);
|
||||
this.staticText = "it deals 6 damage to each creature defending player controls";
|
||||
}
|
||||
|
||||
private LordOfShatterskullPassEffect(final LordOfShatterskullPassEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LordOfShatterskullPassEffect copy() {
|
||||
return new LordOfShatterskullPassEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
UUID defenderId = game.getCombat().getDefenderId(source.getSourceId());
|
||||
if (defenderId != null) {
|
||||
FilterCreaturePermanent filter = new FilterCreaturePermanent();
|
||||
filter.add(new ControllerIdPredicate(defenderId));
|
||||
List<Permanent> permanents = game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source, game);
|
||||
for (Permanent permanent : permanents) {
|
||||
permanent.damage(6, source.getSourceId(), source, game, false, true);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,22 +1,16 @@
|
|||
|
||||
package mage.cards.r;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.AttacksTriggeredAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.DamageAllControlledTargetEffect;
|
||||
import mage.abilities.keyword.BushidoAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SetTargetPointer;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.permanent.ControllerIdPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -35,7 +29,9 @@ public final class RoninCliffrider extends CardImpl {
|
|||
// Bushido 1
|
||||
this.addAbility(new BushidoAbility(1));
|
||||
// Whenever Ronin Cliffrider attacks, you may have it deal 1 damage to each creature defending player controls.
|
||||
this.addAbility(new AttacksTriggeredAbility(new RoninCliffriderEffect(), true));
|
||||
this.addAbility(new AttacksTriggeredAbility(new DamageAllControlledTargetEffect(1)
|
||||
.setText("you may have it deal 1 damage to each creature defending player controls"),
|
||||
true, null, SetTargetPointer.PLAYER));
|
||||
}
|
||||
|
||||
private RoninCliffrider(final RoninCliffrider card) {
|
||||
|
|
@ -47,34 +43,3 @@ public final class RoninCliffrider extends CardImpl {
|
|||
return new RoninCliffrider(this);
|
||||
}
|
||||
}
|
||||
class RoninCliffriderEffect extends OneShotEffect {
|
||||
|
||||
RoninCliffriderEffect() {
|
||||
super(Outcome.Damage);
|
||||
this.staticText = "you may have it deal 1 damage to each creature defending player controls";
|
||||
}
|
||||
|
||||
private RoninCliffriderEffect(final RoninCliffriderEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RoninCliffriderEffect copy() {
|
||||
return new RoninCliffriderEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
UUID defenderId = game.getCombat().getDefenderId(source.getSourceId());
|
||||
if (defenderId != null) {
|
||||
FilterCreaturePermanent filter = new FilterCreaturePermanent();
|
||||
filter.add(new ControllerIdPredicate(defenderId));
|
||||
List<Permanent> permanents = game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source, game);
|
||||
for (Permanent permanent : permanents) {
|
||||
permanent.damage(1, source.getSourceId(), source, game, false, true);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,20 +1,16 @@
|
|||
package mage.cards.s;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.AttacksTriggeredAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.DamageAllEffect;
|
||||
import mage.constants.SubType;
|
||||
import mage.abilities.effects.common.DamageAllControlledTargetEffect;
|
||||
import mage.abilities.keyword.VigilanceAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.permanent.ControllerIdPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.constants.SetTargetPointer;
|
||||
import mage.constants.SubType;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -34,7 +30,9 @@ public final class SwathcutterGiant extends CardImpl {
|
|||
this.addAbility(VigilanceAbility.getInstance());
|
||||
|
||||
// Whenever Swathcutter Giant attacks, it deals 1 damage to each creature defending player controls.
|
||||
this.addAbility(new AttacksTriggeredAbility(new SwathcutterGiantEffect(), false));
|
||||
this.addAbility(new AttacksTriggeredAbility(new DamageAllControlledTargetEffect(1)
|
||||
.setText("it deals 1 damage to each creature defending player controls"),
|
||||
false, null, SetTargetPointer.PLAYER));
|
||||
}
|
||||
|
||||
private SwathcutterGiant(final SwathcutterGiant card) {
|
||||
|
|
@ -46,30 +44,3 @@ public final class SwathcutterGiant extends CardImpl {
|
|||
return new SwathcutterGiant(this);
|
||||
}
|
||||
}
|
||||
|
||||
class SwathcutterGiantEffect extends OneShotEffect {
|
||||
|
||||
SwathcutterGiantEffect() {
|
||||
super(Outcome.Benefit);
|
||||
this.staticText = "it deals 1 damage to each creature "
|
||||
+ "defending player controls.";
|
||||
}
|
||||
|
||||
private SwathcutterGiantEffect(final SwathcutterGiantEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SwathcutterGiantEffect copy() {
|
||||
return new SwathcutterGiantEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
FilterCreaturePermanent filter = new FilterCreaturePermanent();
|
||||
filter.add(new ControllerIdPredicate(
|
||||
game.getCombat().getDefenderId(source.getSourceId())
|
||||
));
|
||||
return new DamageAllEffect(1, filter).apply(game, source);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue