forked from External/mage
* refactor all instances of getRule in triggered abilities using new getTriggerPrefix method * updated triggered ability rules generation * renamed method * fixed a test failure * some more refactoring * simplified some instances of ability word usage
45 lines
1.1 KiB
Java
45 lines
1.1 KiB
Java
|
|
|
|
package mage.abilities.common;
|
|
|
|
import mage.abilities.TriggeredAbilityImpl;
|
|
import mage.abilities.effects.Effect;
|
|
import mage.constants.Zone;
|
|
import mage.game.Game;
|
|
import mage.game.events.GameEvent;
|
|
|
|
/**
|
|
*
|
|
* @author LevelX2
|
|
*/
|
|
|
|
public class SacrificeSourceTriggeredAbility extends TriggeredAbilityImpl {
|
|
|
|
public SacrificeSourceTriggeredAbility(Effect effect, boolean optional) {
|
|
super(Zone.ALL, effect, optional);
|
|
}
|
|
|
|
public SacrificeSourceTriggeredAbility(final SacrificeSourceTriggeredAbility ability) {
|
|
super(ability);
|
|
}
|
|
|
|
@Override
|
|
public SacrificeSourceTriggeredAbility copy() {
|
|
return new SacrificeSourceTriggeredAbility(this);
|
|
}
|
|
|
|
@Override
|
|
public boolean checkEventType(GameEvent event, Game game) {
|
|
return event.getType() == GameEvent.EventType.SACRIFICED_PERMANENT;
|
|
}
|
|
|
|
@Override
|
|
public boolean checkTrigger(GameEvent event, Game game) {
|
|
return event.getTargetId().equals(this.getSourceId());
|
|
}
|
|
|
|
@Override
|
|
public String getTriggerPhrase() {
|
|
return "When you sacrifice {this}, " ;
|
|
}
|
|
}
|