mirror of
https://github.com/correl/mage.git
synced 2024-12-27 03:00:13 +00:00
Added to BeginningOfUpkeepTriggeredAbility for targetController a mode that defines the controller of the object the source is attached to.
This commit is contained in:
parent
8a46aa720b
commit
d653de950f
2 changed files with 17 additions and 1 deletions
|
@ -380,7 +380,7 @@ public final class Constants {
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum TargetController {
|
public enum TargetController {
|
||||||
ANY, YOU, NOT_YOU, OPPONENT
|
ANY, YOU, NOT_YOU, OPPONENT, CONTROLLER_ATTACHED_TO
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum RangeOfInfluence {
|
public enum RangeOfInfluence {
|
||||||
|
|
|
@ -5,6 +5,7 @@ import mage.abilities.TriggeredAbilityImpl;
|
||||||
import mage.abilities.effects.Effect;
|
import mage.abilities.effects.Effect;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.events.GameEvent;
|
import mage.game.events.GameEvent;
|
||||||
|
import mage.game.permanent.Permanent;
|
||||||
import mage.target.targetpointer.FixedTarget;
|
import mage.target.targetpointer.FixedTarget;
|
||||||
|
|
||||||
public class BeginningOfUpkeepTriggeredAbility extends TriggeredAbilityImpl<BeginningOfUpkeepTriggeredAbility> {
|
public class BeginningOfUpkeepTriggeredAbility extends TriggeredAbilityImpl<BeginningOfUpkeepTriggeredAbility> {
|
||||||
|
@ -60,6 +61,19 @@ public class BeginningOfUpkeepTriggeredAbility extends TriggeredAbilityImpl<Begi
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
case CONTROLLER_ATTACHED_TO:
|
||||||
|
Permanent attachment = game.getPermanent(sourceId);
|
||||||
|
if (attachment != null && attachment.getAttachedTo() != null) {
|
||||||
|
Permanent attachedTo = game.getPermanent(attachment.getAttachedTo());
|
||||||
|
if (attachedTo != null && attachedTo.getControllerId().equals(event.getPlayerId())) {
|
||||||
|
if (getTargets().size() == 0) {
|
||||||
|
for (Effect effect : this.getEffects()) {
|
||||||
|
effect.setTargetPointer(new FixedTarget(event.getPlayerId()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -82,6 +96,8 @@ public class BeginningOfUpkeepTriggeredAbility extends TriggeredAbilityImpl<Begi
|
||||||
return "At the beginning of each opponent's upkeep, " + generateZoneString() + effectsText;
|
return "At the beginning of each opponent's upkeep, " + generateZoneString() + effectsText;
|
||||||
case ANY:
|
case ANY:
|
||||||
return "At the beginning of each player's upkeep, " + generateZoneString() + effectsText;
|
return "At the beginning of each player's upkeep, " + generateZoneString() + effectsText;
|
||||||
|
case CONTROLLER_ATTACHED_TO:
|
||||||
|
return "At the beginning of the upkeep of enchanted creature's controller, " + generateZoneString() + effectsText;
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue