From 45bd4a7161c851342d0d51c9af8935fd9a1f717d Mon Sep 17 00:00:00 2001 From: melvin Date: Wed, 30 Oct 2013 10:23:56 +0800 Subject: [PATCH] added 'your upkeep effect ' --- src/magic/model/MagicAbility.java | 7 +++++++ src/magic/model/trigger/MagicAtUpkeepTrigger.java | 13 +++++++++++++ 2 files changed, 20 insertions(+) diff --git a/src/magic/model/MagicAbility.java b/src/magic/model/MagicAbility.java index e66f0e4096..4e4782c3bc 100644 --- a/src/magic/model/MagicAbility.java +++ b/src/magic/model/MagicAbility.java @@ -828,6 +828,13 @@ public enum MagicAbility { )); } }, + YourUpkeepEffect("your upkeep effect", 10) { + protected void addAbilityImpl(final MagicAbilityStore card, final String arg) { + card.add(MagicAtUpkeepTrigger.createYour( + MagicRuleEventAction.create(arg) + )); + } + }, BattalionEffect("battalion effect", 10) { protected void addAbilityImpl(final MagicAbilityStore card, final String arg) { card.add(MagicBattalionTrigger.create( diff --git a/src/magic/model/trigger/MagicAtUpkeepTrigger.java b/src/magic/model/trigger/MagicAtUpkeepTrigger.java index 25388ffeb9..e2ff19e968 100644 --- a/src/magic/model/trigger/MagicAtUpkeepTrigger.java +++ b/src/magic/model/trigger/MagicAtUpkeepTrigger.java @@ -28,6 +28,19 @@ public abstract class MagicAtUpkeepTrigger extends MagicTrigger { } }; } + + public static final MagicAtUpkeepTrigger createYour(final MagicSourceEvent sourceEvent) { + return new MagicAtUpkeepTrigger() { + @Override + public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent, final MagicPlayer upkeepPlayer) { + return sourceEvent.getEvent(permanent); + } + @Override + public boolean accept(final MagicPermanent permanent, final MagicPlayer upkeepPlayer) { + return permanent.isController(upkeepPlayer); + } + }; + } public static final MagicAtUpkeepTrigger MayCharge = new MagicAtUpkeepTrigger() { @Override