Deleted two duplicate Ability classes

This commit is contained in:
Alex W. Jackson 2022-01-02 14:54:56 -05:00
parent 0b93dcdfaa
commit 635e70e77e
3 changed files with 2 additions and 164 deletions

View file

@ -2,7 +2,7 @@ package mage.cards.k;
import mage.MageInt; import mage.MageInt;
import mage.abilities.common.AttacksTriggeredAbility; import mage.abilities.common.AttacksTriggeredAbility;
import mage.abilities.common.BlocksTriggeredAbility; import mage.abilities.common.BlocksSourceTriggeredAbility;
import mage.abilities.effects.common.continuous.BoostAllEffect; import mage.abilities.effects.common.continuous.BoostAllEffect;
import mage.abilities.keyword.FlyingAbility; import mage.abilities.keyword.FlyingAbility;
import mage.abilities.keyword.VigilanceAbility; import mage.abilities.keyword.VigilanceAbility;
@ -60,7 +60,7 @@ public final class KangeeSkyWarden extends CardImpl {
), false)); ), false));
// Whenever Kangee blocks, blocking creatures with flying get +0/+2 until end of turn. // Whenever Kangee blocks, blocking creatures with flying get +0/+2 until end of turn.
this.addAbility(new BlocksTriggeredAbility(new BoostAllEffect( this.addAbility(new BlocksSourceTriggeredAbility(new BoostAllEffect(
0, 2, Duration.EndOfTurn, filter2, false 0, 2, Duration.EndOfTurn, filter2, false
), false)); ), false));
} }

View file

@ -1,95 +0,0 @@
package mage.abilities.common;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.Effect;
import mage.constants.Zone;
import mage.filter.FilterPermanent;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.target.targetpointer.FixedTarget;
/**
* @author North, Loki
*/
public class BlocksOrBecomesBlockedTriggeredAbility extends TriggeredAbilityImpl {
protected FilterPermanent filter;
protected String rule;
protected boolean setTargetPointer;
public BlocksOrBecomesBlockedTriggeredAbility(Effect effect, boolean optional) {
this(effect, StaticFilters.FILTER_PERMANENT_CREATURE, optional, null, true);
}
public BlocksOrBecomesBlockedTriggeredAbility(Effect effect, FilterPermanent filter, boolean optional) {
this(effect, filter, optional, null, true);
}
public BlocksOrBecomesBlockedTriggeredAbility(Effect effect, FilterPermanent filter, boolean optional, String rule) {
this(effect, filter, optional, rule, true);
}
public BlocksOrBecomesBlockedTriggeredAbility(Effect effect, FilterPermanent filter, boolean optional, String rule, boolean setTargetPointer) {
super(Zone.BATTLEFIELD, effect, optional);
this.filter = filter;
this.rule = rule;
this.setTargetPointer = setTargetPointer;
}
public BlocksOrBecomesBlockedTriggeredAbility(final BlocksOrBecomesBlockedTriggeredAbility ability) {
super(ability);
this.filter = ability.filter;
this.rule = ability.rule;
this.setTargetPointer = ability.setTargetPointer;
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.BLOCKER_DECLARED;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getSourceId().equals(this.getSourceId())) {
Permanent blocked = game.getPermanent(event.getTargetId());
if (filter.match(blocked, game)) {
if (setTargetPointer) {
this.getEffects().setTargetPointer(new FixedTarget(blocked, game));
}
return true;
}
}
if (event.getTargetId().equals(this.getSourceId())) {
Permanent blocker = game.getPermanent(event.getSourceId());
if (filter.match(blocker, game)) {
if (setTargetPointer) {
this.getEffects().setTargetPointer(new FixedTarget(blocker, game));
}
return true;
}
}
return false;
}
@Override
public String getRule() {
if (rule != null) {
return rule;
}
return super.getRule();
}
@Override
public String getTriggerPhrase() {
return "Whenever {this} blocks or becomes blocked" + (setTargetPointer ? " by a " + filter.getMessage() : "") + ", ";
}
@Override
public BlocksOrBecomesBlockedTriggeredAbility copy() {
return new BlocksOrBecomesBlockedTriggeredAbility(this);
}
}

View file

@ -1,67 +0,0 @@
package mage.abilities.common;
import mage.constants.Zone;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.Effect;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.target.targetpointer.FixedTarget;
/**
*
* @author North
*/
public class BlocksTriggeredAbility extends TriggeredAbilityImpl {
private boolean setTargetPointer;
private boolean once = false;
public BlocksTriggeredAbility(Effect effect, boolean optional) {
this(effect, optional, false);
}
public BlocksTriggeredAbility(Effect effect, boolean optional, boolean setTargetPointer) {
this(effect, optional, setTargetPointer, false);
}
public BlocksTriggeredAbility(Effect effect, boolean optional, boolean setTargetPointer, boolean once) {
super(Zone.BATTLEFIELD, effect, optional);
this.setTargetPointer = setTargetPointer;
this.once = once;
}
public BlocksTriggeredAbility(final BlocksTriggeredAbility ability) {
super(ability);
this.setTargetPointer = ability.setTargetPointer;
this.once = ability.once;
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.BLOCKER_DECLARED;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getSourceId().equals(this.getSourceId())) {
if (setTargetPointer) {
for (Effect effect : this.getEffects()) {
effect.setTargetPointer(new FixedTarget(event.getTargetId(), game));
}
}
return true;
}
return false;
}
@Override
public String getTriggerPhrase() {
return "When" + (once ? "" : "ever") + " {this} blocks" + (setTargetPointer ? " a creature, " : ", ") ;
}
@Override
public BlocksTriggeredAbility copy() {
return new BlocksTriggeredAbility(this);
}
}