mirror of
https://github.com/magefree/mage.git
synced 2026-01-23 11:49:56 -08:00
implement [EOE] Cryoshatter
This commit is contained in:
parent
7ca32d5bc3
commit
1a7d8ce397
4 changed files with 131 additions and 1 deletions
|
|
@ -1,29 +1,39 @@
|
|||
|
||||
package mage.abilities.common;
|
||||
|
||||
import mage.constants.SetTargetPointer;
|
||||
import mage.constants.Zone;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
/**
|
||||
* @author LoneFox
|
||||
*/
|
||||
public class BecomesTappedAttachedTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
private final SetTargetPointer setTargetPointer;
|
||||
|
||||
public BecomesTappedAttachedTriggeredAbility(Effect effect, String description) {
|
||||
this(effect, description, false);
|
||||
}
|
||||
|
||||
public BecomesTappedAttachedTriggeredAbility(Effect effect, String description, boolean isOptional) {
|
||||
this(effect, description, isOptional, SetTargetPointer.NONE);
|
||||
}
|
||||
|
||||
public BecomesTappedAttachedTriggeredAbility(Effect effect, String description, boolean isOptional, SetTargetPointer setTargetPointer) {
|
||||
super(Zone.BATTLEFIELD, effect, isOptional);
|
||||
setTriggerPhrase(getWhen() + description + " becomes tapped, ");
|
||||
this.setTargetPointer = setTargetPointer;
|
||||
}
|
||||
|
||||
protected BecomesTappedAttachedTriggeredAbility(final BecomesTappedAttachedTriggeredAbility ability) {
|
||||
super(ability);
|
||||
this.setTargetPointer = ability.setTargetPointer;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -43,6 +53,17 @@ public class BecomesTappedAttachedTriggeredAbility extends TriggeredAbilityImpl
|
|||
return false;
|
||||
}
|
||||
Permanent enchanted = game.getPermanent(enchantment.getAttachedTo());
|
||||
return enchanted != null && event.getTargetId().equals(enchanted.getId());
|
||||
if (enchanted == null || !event.getTargetId().equals(enchanted.getId())) {
|
||||
return false;
|
||||
}
|
||||
switch (setTargetPointer) {
|
||||
case PERMANENT:
|
||||
getEffects().setTargetPointer(new FixedTarget(enchanted, game));
|
||||
case NONE:
|
||||
break;
|
||||
default:
|
||||
throw new IllegalArgumentException("Unsupported SetTargetPointer in BecomesTappedAttachedTriggeredAbility");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue