Erwan
- Added "stack" as a zone in the perser - Added "fizzle" keyword in the parser for counterspells
This commit is contained in:
@@ -510,7 +510,6 @@ void ActionStack::Update(float dt){
|
||||
unpackDamageStacks();
|
||||
for (int i = 0; i < mCount ; i++){
|
||||
Interruptible * current = (Interruptible *)mObjects[i];
|
||||
OutputDebugString("OH MY GOD, TAARGET MODE!\n");
|
||||
if (tc->canTarget(current)){
|
||||
if (mObjects[mCurr]) mObjects[mCurr]->Leaving(PSP_CTRL_UP);
|
||||
current->display = 1;
|
||||
|
||||
@@ -307,6 +307,25 @@ int AbilityFactory::magicText(int id, Spell * spell, MTGCardInstance * card){
|
||||
if (s.find("other") != string::npos) lordIncludeSelf = 0;
|
||||
}
|
||||
|
||||
|
||||
//Fizzle (counterspell...)
|
||||
found = s.find("fizzle");
|
||||
if (found != string::npos){
|
||||
if (dryMode) {
|
||||
dryModeResult = BAKA_EFFECT_BAD;
|
||||
dryModeResultSet = 1;
|
||||
break;
|
||||
}
|
||||
if (tc){
|
||||
//TODO
|
||||
}else{
|
||||
Spell * starget = spell->getNextSpellTarget();
|
||||
if (starget) game->mLayers->stackLayer()->Fizzle(starget);
|
||||
}
|
||||
result++;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
//Untapper (Ley Druid...)
|
||||
found = s.find("untap");
|
||||
@@ -919,12 +938,12 @@ void AbilityFactory::addAbilities(int _id, Spell * spell){
|
||||
game->addObserver(NEW AConservator(_id,card));
|
||||
break;
|
||||
}
|
||||
case 1196: //Counterspell
|
||||
/* case 1196: //Counterspell
|
||||
{
|
||||
Spell * starget = spell->getNextSpellTarget();
|
||||
if (starget) game->mLayers->stackLayer()->Fizzle(starget);
|
||||
break;
|
||||
}
|
||||
} */
|
||||
case 1197: //Creature Bond
|
||||
{
|
||||
game->addObserver(NEW ACreatureBond(_id,card, card->target));
|
||||
|
||||
@@ -52,6 +52,10 @@ TargetChooser * TargetChooserFactory::createTargetChooser(string s, MTGCardInsta
|
||||
zones[nbzones] = game->players[0]->game->inPlay;
|
||||
nbzones++;
|
||||
zones[nbzones] = game->players[1]->game->inPlay;
|
||||
}else if(zoneName.compare("stack") == 0){
|
||||
zones[nbzones] = game->players[0]->game->stack;
|
||||
nbzones++;
|
||||
zones[nbzones] = game->players[1]->game->stack;
|
||||
}else{
|
||||
MTGGameZone * zone = MTGGameZone::stringToZone(zoneName, card,card);
|
||||
if (zone) zones[nbzones] = zone;
|
||||
@@ -220,7 +224,7 @@ TargetChooser * TargetChooserFactory::createTargetChooser(MTGCardInstance * card
|
||||
//Any target than cannot be defined automatically is determined by its id
|
||||
switch (id){
|
||||
//Spell
|
||||
case 1196: //CounterSpell
|
||||
//case 1196: //CounterSpell
|
||||
case 1224: //Spell blast
|
||||
{
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
@@ -273,6 +277,8 @@ int TargetChooser::canTarget(Targetable * target){
|
||||
MTGCardInstance * card = (MTGCardInstance *) target;
|
||||
if (source && (card->protectedAgainst(source) || card->has(Constants::SHROUD))) return 0;
|
||||
return 1;
|
||||
}else if (target->typeAsTarget() == TARGET_STACKACTION){
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -362,14 +368,25 @@ void TypeTargetChooser::addType(int type){
|
||||
}
|
||||
|
||||
int TypeTargetChooser::canTarget(Targetable * target ){
|
||||
if (!TargetZoneChooser::canTarget(target)) return 0;
|
||||
if (target->typeAsTarget() == TARGET_CARD){
|
||||
MTGCardInstance * card = (MTGCardInstance *) target;
|
||||
if (!TargetZoneChooser::canTarget(card)) return 0;
|
||||
for (int i= 0; i < nbtypes; i++){
|
||||
if (card->hasSubtype(types[i])) return 1;
|
||||
if (Subtypes::subtypesList->find(card->name) == types[i]) return 1;
|
||||
}
|
||||
return 0;
|
||||
}else if (target->typeAsTarget() == TARGET_STACKACTION){
|
||||
Interruptible * action = (Interruptible *) target;
|
||||
if (action->type == ACTION_SPELL && action->state==NOT_RESOLVED){
|
||||
Spell * spell = (Spell *) action;
|
||||
MTGCardInstance * card = spell->source;
|
||||
for (int i= 0; i < nbtypes; i++){
|
||||
if (card->hasSubtype(types[i])) return 1;
|
||||
if (Subtypes::subtypesList->find(card->name) == types[i]) return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -397,10 +414,17 @@ DescriptorTargetChooser::DescriptorTargetChooser(CardDescriptor * _cd, MTGGameZo
|
||||
}
|
||||
|
||||
int DescriptorTargetChooser::canTarget(Targetable * target){
|
||||
if (!TargetZoneChooser::canTarget(target)) return 0;
|
||||
if (target->typeAsTarget() == TARGET_CARD){
|
||||
MTGCardInstance * _target = (MTGCardInstance *) target;
|
||||
if (!TargetZoneChooser::canTarget(_target)) return 0;
|
||||
if (cd->match(_target)) return 1;
|
||||
}else if (target->typeAsTarget() == TARGET_STACKACTION){
|
||||
Interruptible * action = (Interruptible *) target;
|
||||
if (action->type == ACTION_SPELL && action->state==NOT_RESOLVED){
|
||||
Spell * spell = (Spell *) action;
|
||||
MTGCardInstance * card = spell->source;
|
||||
if (cd->match(card)) return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -473,6 +497,16 @@ int TargetZoneChooser::canTarget(Targetable * target){
|
||||
for (int i = 0; i<nbzones; i++){
|
||||
if (zones[i]->hasCard(card)) return 1;
|
||||
}
|
||||
}else if (target->typeAsTarget() == TARGET_STACKACTION){
|
||||
OutputDebugString ("CHECKING INTERRUPTIBLE\n");
|
||||
Interruptible * action = (Interruptible *) target;
|
||||
if (action->type == ACTION_SPELL && action->state==NOT_RESOLVED){
|
||||
Spell * spell = (Spell *) action;
|
||||
MTGCardInstance * card = spell->source;
|
||||
for (int i = 0; i<nbzones; i++){
|
||||
if (zones[i]->hasCard(card)) return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -109,6 +109,9 @@ int TestSuiteAI::Act(float dt){
|
||||
}else{
|
||||
int mtgid = suite->getMTGId(action);
|
||||
if (mtgid){
|
||||
char buffe[512];
|
||||
sprintf(buffe, "CARD ID : %i\n", mtgid);
|
||||
OutputDebugString(buffe);
|
||||
Interruptible * toInterrupt = suite->getActionByMTGId(mtgid);
|
||||
if (toInterrupt){
|
||||
g->stackObjectClicked(toInterrupt);
|
||||
|
||||
Reference in New Issue
Block a user