mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 21:12:04 -08:00
[SNC] Implement High-Rise Sawjack. (#8847)
* [SNC] Implement High-Rise Sawjack. Add BlocksCreatureWithFlyingTriggeredAbility. * [SNC] Implement more generic BlocksCreatureTriggeredAbility Co-authored-by: Evan Kranzler <theelk801@gmail.com>
This commit is contained in:
parent
aa2215fefb
commit
53e5e2cd74
9 changed files with 177 additions and 242 deletions
|
|
@ -0,0 +1,56 @@
|
|||
package mage.abilities.common;
|
||||
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
|
||||
/**
|
||||
* @author Hiddevb
|
||||
*/
|
||||
public class BlocksCreatureTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
private final FilterCreaturePermanent filter;
|
||||
|
||||
public BlocksCreatureTriggeredAbility(Effect effect, boolean optional) {
|
||||
super(Zone.BATTLEFIELD, effect, optional);
|
||||
this.filter = StaticFilters.FILTER_PERMANENT_CREATURE;
|
||||
}
|
||||
|
||||
public BlocksCreatureTriggeredAbility(Effect effect, FilterCreaturePermanent filter, boolean optional) {
|
||||
super(Zone.BATTLEFIELD, effect, optional);
|
||||
this.filter = filter;
|
||||
}
|
||||
|
||||
public BlocksCreatureTriggeredAbility(final BlocksCreatureTriggeredAbility ability) {
|
||||
super(ability);
|
||||
this.filter = ability.filter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.BLOCKER_DECLARED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
return event.getSourceId().equals(this.getSourceId())
|
||||
&& !filter.match(game.getPermanent(event.getSourceId()), game);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTriggerPhrase() {
|
||||
return "Whenever {this} blocks "
|
||||
+ (filter.getMessage().startsWith("an ") ? "" : "a ")
|
||||
+ filter.getMessage() + ", " ;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlocksCreatureTriggeredAbility copy() {
|
||||
return new BlocksCreatureTriggeredAbility(this);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue