- fix for issue 301 (creatures go to graveyard)
- This adds an important change to "movedTo", which now accepts a "full" target description in both "from" and "movedTo". The point is that a card does not move to "creature|graveyard" from "battlefield" but moves from "creature|battlefield" to "graveyard".
This commit is contained in:
wagic.the.homebrew@gmail.com
2010-01-21 14:12:11 +00:00
parent 0948dc611a
commit 3edc364d8e
19 changed files with 58 additions and 49 deletions
+13 -3
View File
@@ -64,20 +64,30 @@ TriggeredAbility * AbilityFactory::parseTrigger(string magicText, int id, Spell
if (found != string::npos){
size_t end = s.find (")");
string starget = s.substr(found+8,end - found - 8);
if (starget.find("|") == string::npos) starget.insert(0,"*|");
TargetChooserFactory tcf;
TargetChooser *toTc = tcf.createTargetChooser(starget,card);
toTc->targetter = NULL;
TargetChooser *fromTc = NULL;
TargetChooser * fromTcCard = NULL;
found = s.find("from(");
if (found != string::npos){
end = s.find ("|", found);
if (end == string::npos) {
fromTcCard = tcf.createTargetChooser("*",card);
found = found + 5;
}else{
fromTcCard = tcf.createTargetChooser(s.substr(found + 5, end - found - 5).append("|*"),card);
found = end + 1;
}
fromTcCard->setAllZones();
end = s.find (")", found);
starget = s.substr(found+5,end - found - 5);
if (starget.find("|") == string::npos) starget.insert(0,"*|");
starget = s.substr(found,end - found).insert(0,"*|");
fromTc = tcf.createTargetChooser(starget,card);
fromTc->targetter = NULL;
}
return NEW TrCardAddedToZone(id,card,toTc,(TargetZoneChooser *)fromTc);
return NEW TrCardAddedToZone(id,card,toTc,(TargetZoneChooser *)fromTc,fromTcCard);
}
//Card Tapped
+8 -16
View File
@@ -56,8 +56,9 @@ TargetChooser * TargetChooserFactory::createTargetChooser(string s, MTGCardInsta
}
zones[nbzones] = MTGGameZone::MY_BATTLEFIELD;
//Graveyards
if(zoneName.compare("graveyard") == 0){
if(zoneName.compare("*") == 0){
zones[nbzones] = MTGGameZone::ALL_ZONES;
}else if(zoneName.compare("graveyard") == 0){
zones[nbzones] = MTGGameZone::MY_GRAVEYARD;
nbzones++;
zones[nbzones] = MTGGameZone::OPPONENT_GRAVEYARD;
@@ -590,21 +591,10 @@ int TargetZoneChooser::init(int * _zones, int _nbzones){
int TargetZoneChooser::setAllZones(){
int zones[] = {
MTGGameZone::MY_BATTLEFIELD,
MTGGameZone::MY_EXILE,
MTGGameZone::MY_GRAVEYARD,
MTGGameZone::MY_HAND,
MTGGameZone::MY_LIBRARY,
MTGGameZone::MY_STACK,
MTGGameZone::OPPONENT_BATTLEFIELD,
MTGGameZone::OPPONENT_EXILE,
MTGGameZone::OPPONENT_GRAVEYARD,
MTGGameZone::OPPONENT_HAND,
MTGGameZone::OPPONENT_LIBRARY,
MTGGameZone::OPPONENT_STACK
MTGGameZone::ALL_ZONES,
};
init(zones,12);
init(zones,1);
return 1;
}
@@ -613,8 +603,10 @@ bool TargetZoneChooser::canTarget(Targetable * target){
if (!TargetChooser::canTarget(target)) return false;
if (target->typeAsTarget() == TARGET_CARD){
MTGCardInstance * card = (MTGCardInstance *) target;
for (int i = 0; i<nbzones; i++)
for (int i = 0; i<nbzones; i++){
if (zones[i] == MTGGameZone::ALL_ZONES) return true;
if (MTGGameZone::intToZone(zones[i],source,card)->hasCard(card)) return true;
}
}else if (target->typeAsTarget() == TARGET_STACKACTION){
OutputDebugString ("CHECKING INTERRUPTIBLE\n");
Interruptible * action = (Interruptible *) target;