added ability to have triggered abilities target based on the event that triggered, bramblewood paragon, graft, etc.

use "trigger" inside target code of triggered ability.
does not work with @each and @next.
@damaged can use trigger[to] and trigger[from] to specify the target or source of the damage, respectively.

Adds cards:
Aether Flash
Bramblewood Paragon
In the Web of War
Juniper Order Ranger
Mortuary
Primal Forcemage
Fungus Sliver
Simic Initiate

as well as a test file for feral hydra, missing from my last commit.
and daily build.
This commit is contained in:
salmelo16
2010-04-03 23:50:39 +00:00
parent b9d82a55c7
commit 9cf4c7587b
17 changed files with 376 additions and 42 deletions

View File

@@ -5,7 +5,7 @@
#include "../include/GameObserver.h"
#include "../include/Subtypes.h"
#include "../include/Counters.h"
#include "../include/WEvent.h"
TargetChooser * TargetChooserFactory::createTargetChooser(string s, MTGCardInstance * card, MTGAbility * ability){
@@ -29,6 +29,16 @@ TargetChooser * TargetChooserFactory::createTargetChooser(string s, MTGCardInsta
s=s.substr(6);
}
found = s.find("trigger");
if (found == 0){
if (s.length() > 7 && s.find("[") == 7) {
string s1 = s.substr(7,s.find("]"));
if (s1.find("to") != string::npos) return NEW TriggerTargetChooser(WEvent::TARGET_TO);
if (s1.find("from") != string::npos) return NEW TriggerTargetChooser(WEvent::TARGET_FROM);
}
return NEW TriggerTargetChooser(1);
}
found = s.find("player");
if (found != string::npos){
int maxtargets = 1;
@@ -761,3 +771,22 @@ bool DamageTargetChooser::canTarget(Targetable * target){
DamageTargetChooser * a = NEW DamageTargetChooser(*this);
return a;
}
TriggerTargetChooser::TriggerTargetChooser(int _triggerTarget){
triggerTarget = _triggerTarget;
target = NULL;
}
bool TriggerTargetChooser::targetsZone(MTGGameZone * z){
return true;
}
bool TriggerTargetChooser::canTarget(Targetable * _target){
if (_target == target) return true;
return false;
}
TriggerTargetChooser * TriggerTargetChooser::clone() const{
TriggerTargetChooser * a = NEW TriggerTargetChooser(*this);
return a;
}