Erwan
- Added "@movedTo(...) trigger. See argothian enchantress in USG
This commit is contained in:
@@ -320,7 +320,7 @@ int ActionStack::addAction(Interruptible * action){
|
||||
return 1;
|
||||
}
|
||||
|
||||
int ActionStack::addSpell(MTGCardInstance * _source, Targetable * _targets[], int _nbtargets, ManaCost * mana){
|
||||
Spell * ActionStack::addSpell(MTGCardInstance * _source, Targetable * _targets[], int _nbtargets, ManaCost * mana){
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
char buf[4096], *p = buf;
|
||||
sprintf(buf, "Add spell\n");
|
||||
@@ -333,7 +333,7 @@ int ActionStack::addSpell(MTGCardInstance * _source, Targetable * _targets[], in
|
||||
GameOptions::GetInstance()->values[OPTIONS_INTERRUPTMYSPELLS].getIntValue() == 0){
|
||||
interruptDecision[0] = DONT_INTERRUPT;
|
||||
}
|
||||
return result;
|
||||
return spell;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -71,6 +71,17 @@ TriggeredAbility * AbilityFactory::parseTrigger(string magicText, int id, Spell
|
||||
size_t found = magicText.find("@");
|
||||
if (found == string::npos) return NULL;
|
||||
|
||||
//Card Changed Zone
|
||||
found = magicText.find("movedto(");
|
||||
if (found != string::npos){
|
||||
size_t end = magicText.find (")");
|
||||
string starget = magicText.substr(found+8,end - found - 8);
|
||||
TargetChooserFactory tcf;
|
||||
TargetChooser *toTc = tcf.createTargetChooser(starget,card);
|
||||
toTc->targetter = NULL;
|
||||
return NEW TrCardAddedToZone(id,card,toTc);
|
||||
}
|
||||
|
||||
//Next Time...
|
||||
found = magicText.find("next");
|
||||
if (found != string::npos){
|
||||
@@ -339,13 +350,6 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
||||
found = s.find(destroys[i]);
|
||||
if (found != string::npos){
|
||||
int bury = destroyTypes[i];
|
||||
/*if (trigger){
|
||||
if (bury){
|
||||
BuryEvent * action = NEW BuryEvent();
|
||||
return NEW GenericTriggeredAbility(id, card,trigger,action);
|
||||
}
|
||||
return NULL;
|
||||
}*/
|
||||
MTGAbility * a = NEW AADestroyer(id,card,target,bury);
|
||||
a->oneShot = 1;
|
||||
return a;
|
||||
@@ -403,11 +407,6 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
||||
nbcards = atoi(s.substr(start+1).c_str());
|
||||
}
|
||||
|
||||
/*if (trigger){
|
||||
DrawEvent * action = NEW DrawEvent(card->controller(),nbcards);
|
||||
return NEW GenericTriggeredAbility(id, card,trigger,action);
|
||||
}*/
|
||||
|
||||
MTGAbility * a = NEW AADrawer(id,card,NULL,nbcards);
|
||||
a->oneShot = 1;
|
||||
return a;
|
||||
@@ -2205,6 +2204,14 @@ TriggeredAbility::TriggeredAbility(int id, MTGCardInstance * card, Targetable *
|
||||
TriggeredAbility::TriggeredAbility(int id, MTGCardInstance * card):MTGAbility(id,card){
|
||||
}
|
||||
|
||||
int TriggeredAbility::receiveEvent(WEvent * e){
|
||||
if (triggerOnEvent(e)){
|
||||
fireAbility();
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void TriggeredAbility::Update(float dt){
|
||||
if (trigger()) fireAbility();
|
||||
}
|
||||
@@ -2397,9 +2404,8 @@ int GenericTriggeredAbility::trigger(){
|
||||
}
|
||||
|
||||
|
||||
int GenericTriggeredAbility::receiveEvent(WEvent * e){
|
||||
if (t->receiveEvent(e)) return resolve();
|
||||
return 0;
|
||||
int GenericTriggeredAbility::triggerOnEvent(WEvent * e){
|
||||
return t->triggerOnEvent(e);
|
||||
}
|
||||
|
||||
void GenericTriggeredAbility::Update(float dt){
|
||||
@@ -2427,6 +2433,10 @@ GenericTriggeredAbility::~GenericTriggeredAbility(){
|
||||
}
|
||||
}
|
||||
|
||||
const char * GenericTriggeredAbility::getMenuText(){
|
||||
return ability->getMenuText();
|
||||
}
|
||||
|
||||
GenericTriggeredAbility* GenericTriggeredAbility::clone() const{
|
||||
GenericTriggeredAbility * a = NEW GenericTriggeredAbility(*this);
|
||||
a->isClone = 1;
|
||||
|
||||
@@ -502,6 +502,14 @@ int MTGGameZone::zoneStringToId(string zoneName){
|
||||
"targetcontrollerexile",
|
||||
"ownerexile",
|
||||
"exile",
|
||||
|
||||
"mystack",
|
||||
"opponentstack",
|
||||
"targetownerstack",
|
||||
"targetcontrollerstack",
|
||||
"ownerstack",
|
||||
"stack",
|
||||
|
||||
};
|
||||
|
||||
int values[] = {
|
||||
@@ -553,6 +561,13 @@ int MTGGameZone::zoneStringToId(string zoneName){
|
||||
TARGET_CONTROLLER_EXILE,
|
||||
OWNER_EXILE ,
|
||||
EXILE,
|
||||
|
||||
MY_STACK,
|
||||
OPPONENT_STACK,
|
||||
TARGET_OWNER_STACK ,
|
||||
TARGET_CONTROLLER_STACK,
|
||||
OWNER_STACK ,
|
||||
STACK,
|
||||
};
|
||||
|
||||
int max = sizeof(values) / sizeof*(values);
|
||||
|
||||
@@ -60,15 +60,15 @@ int MTGPutInPlayRule::reactToClick(MTGCardInstance * card){
|
||||
delete spell;
|
||||
player->canPutLandsIntoPlay--;
|
||||
}else{
|
||||
MTGCardInstance * copy = player->game->putInZone(card, player->game->hand, player->game->stack);
|
||||
Spell * spell = NULL;
|
||||
if (game->targetChooser){
|
||||
game->mLayers->stackLayer()->addSpell(copy,game->targetChooser->targets,game->targetChooser->cursor, spellCost);
|
||||
spell = game->mLayers->stackLayer()->addSpell(card,game->targetChooser->targets,game->targetChooser->cursor, spellCost);
|
||||
SAFE_DELETE(game->targetChooser);
|
||||
}else{
|
||||
game->mLayers->stackLayer()->addSpell(copy,NULL,0, spellCost);
|
||||
spell = game->mLayers->stackLayer()->addSpell(card,NULL,0, spellCost);
|
||||
}
|
||||
|
||||
|
||||
MTGCardInstance * copy = player->game->putInZone(card, player->game->hand, player->game->stack);
|
||||
spell->source = copy;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user