- Added Attached Trigger

- Added Bramble Elemental, Oathkeeper, Takeno's Daisho and Shieldmage Elder
This commit is contained in:
swordshine
2013-04-06 08:06:12 +00:00
parent 43cbf9edc3
commit 53a2ef4ee9
7 changed files with 145 additions and 0 deletions

4
.gitattributes vendored
View File

@@ -1247,6 +1247,7 @@ res/cardsfolder/b/brainspoil.txt svneol=native#text/plain
res/cardsfolder/b/brainstorm.txt svneol=native#text/plain
res/cardsfolder/b/brainwash.txt svneol=native#text/plain
res/cardsfolder/b/bramble_creeper.txt svneol=native#text/plain
res/cardsfolder/b/bramble_elemental.txt -text
res/cardsfolder/b/bramblecrush.txt -text
res/cardsfolder/b/bramblesnap.txt svneol=native#text/plain
res/cardsfolder/b/bramblewood_paragon.txt svneol=native#text/plain
@@ -7355,6 +7356,7 @@ res/cardsfolder/o/oath_of_druids.txt svneol=native#text/plain
res/cardsfolder/o/oath_of_ghouls.txt svneol=native#text/plain
res/cardsfolder/o/oath_of_lieges.txt -text
res/cardsfolder/o/oath_of_lim_dul.txt -text
res/cardsfolder/o/oathkeeper_takenos_daisho.txt -text
res/cardsfolder/o/oathsworn_giant.txt svneol=native#text/plain
res/cardsfolder/o/ob_nixilis_the_fallen.txt svneol=native#text/plain
res/cardsfolder/o/obelisk_of_alara.txt svneol=native#text/plain
@@ -9453,6 +9455,7 @@ res/cardsfolder/s/shield_sphere.txt svneol=native#text/plain
res/cardsfolder/s/shield_wall.txt svneol=native#text/plain
res/cardsfolder/s/shielded_passage.txt -text
res/cardsfolder/s/shielding_plax.txt svneol=native#text/plain
res/cardsfolder/s/shieldmage_elder.txt -text
res/cardsfolder/s/shieldmates_blessing.txt svneol=native#text/plain
res/cardsfolder/s/shields_of_velis_vel.txt -text
res/cardsfolder/s/shifting_borders.txt -text
@@ -13831,6 +13834,7 @@ src/main/java/forge/card/staticability/StaticAbilityPreventDamage.java svneol=na
src/main/java/forge/card/staticability/package-info.java svneol=native#text/plain
src/main/java/forge/card/trigger/Trigger.java svneol=native#text/plain
src/main/java/forge/card/trigger/TriggerAlways.java svneol=native#text/plain
src/main/java/forge/card/trigger/TriggerAttached.java -text
src/main/java/forge/card/trigger/TriggerAttackerBlocked.java svneol=native#text/plain
src/main/java/forge/card/trigger/TriggerAttackerUnblocked.java svneol=native#text/plain
src/main/java/forge/card/trigger/TriggerAttackersDeclared.java svneol=native#text/plain

View File

@@ -0,0 +1,11 @@
Name:Bramble Elemental
ManaCost:3 G G
Types:Creature Elemental
PT:4/4
T:Mode$ Attached | ValidSource$ Aura | ValidTarget$ Card.Self | TriggerZones$ Battlefield | Execute$ TrigToken | TriggerDescription$ Whenever an Aura becomes attached to CARDNAME, put two 1/1 green Saproling creature tokens onto the battlefield.
SVar:TrigToken:AB$ Token | Cost$ 0 | TokenAmount$ 2 | TokenOwner$ TriggeredTargetController | TokenName$ Saproling | TokenTypes$ Creature,Saproling | TokenColors$ Green | TokenPower$ 1 | TokenToughness$ 1
SVar:EnchantMe:Multiple
SVar:Picture:http://www.wizards.com/global/images/magic/general/bramble_elemental.jpg
Oracle:Whenever an Aura becomes attached to Bramble Elemental, put two 1/1 green Saproling creature tokens onto the battlefield.
SetInfo:RAV Common
SetInfo:PC2 Common

View File

@@ -0,0 +1,17 @@
Name:Oathkeeper, Takeno's Daisho
ManaCost:3
Types:Legendary Artifact Equipment
Equipped creature gets +3/+1.
K:Equip 2
T:Mode$ Attached | ValidSource$ Card.Self | ValidTarget$ Creature | TriggerZones$ Battlefield | Execute$ TrigRemember | Static$ True
SVar:TrigRemember:DB$ Cleanup | ClearRemembered$ True | SubAbility$ RememberNew
SVar:RememberNew:DB$ Pump | RememberObjects$ Equipped
T:Mode$ ChangesZone | Origin$ Battlefield | Destination$ Graveyard | ValidCard$ Card.Self+equipping | Execute$ TrigChangeZone | TriggerController$ TriggeredCardController | TriggerDescription$ When CARDNAME is put into a graveyard from the battlefield, exile equipped creature.
SVar:TrigChangeZone:AB$ ChangeZone | Cost$ 0 | Origin$ Battlefield | Destination$ Exile | Defined$ Remembered
T:Mode$ ChangesZone | Origin$ Battlefield | Destination$ Graveyard | ValidCard$ Card.EquippedBy | Execute$ TrigReturn | TriggerController$ TriggeredCardController | TriggerDescription$ Whenever equipped creature dies, return that card to the battlefield under your control if it's a Samurai card.
SVar:TrigReturn:AB$ ChangeZone | Cost$ 0 | Origin$ Graveyard | Destination$ Battlefield | Defined$ TriggeredCard | GainControl$ True | ConditionDefined$ TriggeredCard | ConditionPresent$ Card.Samurai | ConditionCompare$ GE1
SVar:RemAIDeck:True
DeckHints:Type$Samurai
SVar:Picture:http://www.wizards.com/global/images/magic/general/oathkeeper_takenos_daisho.jpg
Oracle:Equipped creature gets +3/+1.\nWhenever equipped creature dies, return that card to the battlefield under your control if it's a Samurai card.\nWhen Oathkeeper, Takeno's Daisho is put into a graveyard from the battlefield, exile equipped creature.\nEquip {2}
SetInfo:CHK Rare

View File

@@ -0,0 +1,13 @@
Name:Shieldmage Elder
ManaCost:5 W
Types:Creature Human Cleric Wizard
PT:2/3
A:AB$ Pump | Cost$ tapXType<2/Cleric> | ValidTgts$ Creature | KW$ HIDDEN Prevent all damage that would be dealt by CARDNAME. | IsCurse$ True | TgtPrompt$ Select target creature | SpellDescription$ Prevent all damage target creature would deal this turn.
A:AB$ Effect | Cost$ tapXType<2/Wizard> | ValidTgts$ Card.inZoneStack | TgtZone$ Stack,Battlefield | IsCurse$ True | TgtPrompt$ Select target spell | RememberObjects$ Targeted | StaticAbilities$ STNoDmg | SubAbility$ DBCleanup | SpellDescription$ Prevent all damage target spell would deal this turn.
SVar:STNoDmg:Mode$ Continuous | EffectZone$ Command | AffectedZone$ Battlefield,Stack | Affected$ Card.IsRemembered | AddHiddenKeyword$ Prevent all damage that would be dealt by CARDNAME. | Description$ Prevent all damage target spell would deal this turn.
SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True
#Another Zone should be included currently, therefore the target would be a card, not a spell/ability
SVar:RemAIDeck:True
SVar:Picture:http://www.wizards.com/global/images/magic/general/shieldmage_elder.jpg
Oracle:Tap two untapped Clerics you control: Prevent all damage target creature would deal this turn.\nTap two untapped Wizards you control: Prevent all damage target spell would deal this turn.
SetInfo:ONS Uncommon

View File

@@ -3715,6 +3715,11 @@ public class Card extends GameEntity implements Comparable<Card> {
// Play the Equip sound
Singletons.getModel().getGame().getEvents().post(new CardEquippedEvent());
// run trigger
final HashMap<String, Object> runParams = new HashMap<String, Object>();
runParams.put("AttachSource", this);
runParams.put("AttachTarget", c);
this.getController().getGame().getTriggerHandler().runTrigger(TriggerType.Attached, runParams, false);
}
/**
@@ -3898,6 +3903,11 @@ public class Card extends GameEntity implements Comparable<Card> {
this.addEnchanting(entity);
entity.addEnchantedBy(this);
this.enchant();
// run trigger
final HashMap<String, Object> runParams = new HashMap<String, Object>();
runParams.put("AttachSource", this);
runParams.put("AttachTarget", entity);
this.getController().getGame().getTriggerHandler().runTrigger(TriggerType.Attached, runParams, false);
}
/**

View File

@@ -0,0 +1,89 @@
/*
* Forge: Play Magic: the Gathering.
* Copyright (C) 2011 Forge Team
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package forge.card.trigger;
import forge.Card;
import forge.card.spellability.SpellAbility;
/**
* <p>
* Trigger_Attached class.
* </p>
*
* @author Forge
* @version $Id: TriggerAttached.java 17802 2012-10-31 08:05:14Z Max mtg $
*/
public class TriggerAttached extends Trigger {
/**
* <p>
* Constructor for Trigger_Attached.
* </p>
*
* @param params
* a {@link java.util.HashMap} object.
* @param host
* a {@link forge.Card} object.
* @param intrinsic
* the intrinsic
*/
public TriggerAttached(final java.util.Map<String, String> params, final Card host, final boolean intrinsic) {
super(params, host, intrinsic);
}
/** {@inheritDoc} */
@Override
public final boolean performTest(final java.util.Map<String, Object> runParams2) {
final Card src = (Card) runParams2.get("AttachSource");
final Object tgt = runParams2.get("AttachTarget");
if (this.getMapParams().containsKey("ValidSource")) {
if (!src.isValid(this.getMapParams().get("ValidSource").split(","), this.getHostCard().getController(),
this.getHostCard())) {
return false;
}
}
if (this.getMapParams().containsKey("ValidTarget")) {
if (!matchesValid(tgt, this.getMapParams().get("ValidTarget").split(","), this.getHostCard())) {
return false;
}
}
return true;
}
/** {@inheritDoc} */
@Override
public final Trigger getCopy() {
final Trigger copy = new TriggerAttached(this.getMapParams(), this.getHostCard(), this.isIntrinsic());
if (this.getOverridingAbility() != null) {
copy.setOverridingAbility(this.getOverridingAbility());
}
copyFieldsTo(copy);
return copy;
}
/** {@inheritDoc} */
@Override
public final void setTriggeringObjects(final SpellAbility sa) {
sa.setTriggeringObject("Source", this.getRunParams().get("AttachSource"));
sa.setTriggeringObject("Target", this.getRunParams().get("AttachTarget"));
}
}

View File

@@ -20,6 +20,7 @@ public enum TriggerType {
ChangesZone(TriggerChangesZone.class),
Clashed(TriggerClashed.class),
Attached(TriggerAttached.class),
Destroyed(TriggerDestroyed.class),
Devoured(TriggerDevoured.class),
Countered(TriggerCountered.class),