mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 13:02:06 -08:00
Merge origin/master
This commit is contained in:
commit
9abbdae032
46 changed files with 157 additions and 90 deletions
|
|
@ -0,0 +1,67 @@
|
|||
|
||||
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 BlocksSourceTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
private boolean setTargetPointer;
|
||||
private boolean once = false;
|
||||
|
||||
public BlocksSourceTriggeredAbility(Effect effect, boolean optional) {
|
||||
this(effect, optional, false);
|
||||
}
|
||||
|
||||
public BlocksSourceTriggeredAbility(Effect effect, boolean optional, boolean setTargetPointer) {
|
||||
this(effect, optional, setTargetPointer, false);
|
||||
}
|
||||
|
||||
public BlocksSourceTriggeredAbility(Effect effect, boolean optional, boolean setTargetPointer, boolean once) {
|
||||
super(Zone.BATTLEFIELD, effect, optional);
|
||||
this.setTargetPointer = setTargetPointer;
|
||||
this.once = once;
|
||||
}
|
||||
|
||||
public BlocksSourceTriggeredAbility(final BlocksSourceTriggeredAbility 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()));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "When" + (once ? "" : "ever") + " {this} blocks" + (setTargetPointer ? " a creature, " : ", ") + super.getRule();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlocksSourceTriggeredAbility copy() {
|
||||
return new BlocksSourceTriggeredAbility(this);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
package mage.game.permanent.token;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.common.BlocksTriggeredAbility;
|
||||
import mage.abilities.common.BlocksSourceTriggeredAbility;
|
||||
import mage.abilities.effects.common.DontUntapInControllersNextUntapStepTargetEffect;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
|
|
@ -20,7 +20,7 @@ public final class MesmerizingBenthidToken extends TokenImpl {
|
|||
subtype.add(SubType.ILLUSION);
|
||||
power = new MageInt(0);
|
||||
toughness = new MageInt(2);
|
||||
this.addAbility(new BlocksTriggeredAbility(
|
||||
this.addAbility(new BlocksSourceTriggeredAbility(
|
||||
new DontUntapInControllersNextUntapStepTargetEffect("that creature"),
|
||||
false, true
|
||||
));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue