- fix global effect cards (wrath of god) VS protection 
- Removed/updated a few debug outputs
This commit is contained in:
wagic.the.homebrew@gmail.com
2009-09-06 01:11:51 +00:00
parent 74bd57cb55
commit c1accf5c6e
9 changed files with 27 additions and 76 deletions
+1 -1
View File
@@ -141,7 +141,7 @@ public:
triggered = 1; triggered = 1;
game->mLayers->actionLayer()->setMenuObject(source); game->mLayers->actionLayer()->setMenuObject(source);
game->mLayers->stackLayer()->setIsInterrupting(source->controller()); game->mLayers->stackLayer()->setIsInterrupting(source->controller());
OutputDebugString("SetMenuObject!\n"); OutputDebugString("ALLABILITIES SetMenuObject!\n");
} }
} }
+1 -2
View File
@@ -202,7 +202,6 @@ int ActionLayer::reactToClick(MTGCardInstance * card){
for (int i=0;i<mCount;i++){ for (int i=0;i<mCount;i++){
ActionElement * currentAction = (ActionElement *)mObjects[i]; ActionElement * currentAction = (ActionElement *)mObjects[i];
OutputDebugString(currentAction->getMenuText());
result += reactToClick(currentAction,card); result += reactToClick(currentAction,card);
if (result) return result; if (result) return result;
} }
@@ -233,7 +232,7 @@ void ActionLayer::doReactTo(int menuIndex){
if (menuObject){ if (menuObject){
int controlid = abilitiesMenu->mObjects[menuIndex]->GetId(); int controlid = abilitiesMenu->mObjects[menuIndex]->GetId();
char buf[4096]; char buf[4096];
sprintf(buf, "doReact To %i\n",controlid); sprintf(buf, "ACTIONLAYER doReact To %i\n",controlid);
OutputDebugString(buf); OutputDebugString(buf);
if (controlid != -1){ if (controlid != -1){
ActionElement * currentAction = (ActionElement *)mObjects[controlid]; ActionElement * currentAction = (ActionElement *)mObjects[controlid];
+5 -5
View File
@@ -383,7 +383,7 @@ int ActionStack::addAction(Interruptible * action){
Spell * ActionStack::addSpell(MTGCardInstance * _source, TargetChooser * tc, ManaCost * mana){ Spell * ActionStack::addSpell(MTGCardInstance * _source, TargetChooser * tc, ManaCost * mana){
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX)
char buf[4096], *p = buf; char buf[4096], *p = buf;
sprintf(buf, "Add spell\n"); sprintf(buf, "ACTIONSTACK Add spell\n");
OutputDebugString(buf); OutputDebugString(buf);
#endif #endif
Spell * spell = NEW Spell(mCount,_source,tc, mana); Spell * spell = NEW Spell(mCount,_source,tc, mana);
@@ -704,7 +704,7 @@ bool ActionStack::CheckUserInput(u32 key){
mObjects[mCurr]->Entering(); mObjects[mCurr]->Entering();
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX)
char buf[4096]; char buf[4096];
sprintf(buf, "Stack UP TO mCurr = %i\n", mCurr); sprintf(buf, "ACTIONSTACK UP TO mCurr = %i\n", mCurr);
OutputDebugString(buf); OutputDebugString(buf);
#endif #endif
} }
@@ -718,7 +718,7 @@ bool ActionStack::CheckUserInput(u32 key){
mObjects[mCurr]->Entering(); mObjects[mCurr]->Entering();
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX)
char buf[4096]; char buf[4096];
sprintf(buf, "Stack DOWN TO mCurr = %i\n", mCurr); sprintf(buf, "ACTIONSTACK DOWN TO mCurr = %i\n", mCurr);
OutputDebugString(buf); OutputDebugString(buf);
#endif #endif
} }
@@ -727,7 +727,7 @@ bool ActionStack::CheckUserInput(u32 key){
}else if (PSP_CTRL_CIRCLE == key){ }else if (PSP_CTRL_CIRCLE == key){
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX)
char buf[4096]; char buf[4096];
sprintf(buf, "Stack CLIKED mCurr = %i\n", mCurr); sprintf(buf, "ACTIONSTACK CLIKED mCurr = %i\n", mCurr);
OutputDebugString(buf); OutputDebugString(buf);
#endif #endif
game->stackObjectClicked(((Interruptible *) mObjects[mCurr])); game->stackObjectClicked(((Interruptible *) mObjects[mCurr]));
@@ -763,7 +763,7 @@ while( iter != mObjects.end() ){
void ActionStack::Fizzle(Interruptible * action){ void ActionStack::Fizzle(Interruptible * action){
if (!action){ if (!action){
OutputDebugString("==ERROR==: action is NULL in ActionStack::Fizzle\n"); OutputDebugString("ACTIONSTACK ==ERROR==: action is NULL in ActionStack::Fizzle\n");
return; return;
} }
if (action->type == ACTION_SPELL){ if (action->type == ACTION_SPELL){
+1 -11
View File
@@ -164,7 +164,6 @@ void GameObserver::userRequestNextGamePhase(){
} }
int GameObserver::forceShuffleLibraries(){ int GameObserver::forceShuffleLibraries(){
OutputDebugString("FORCING\n");
int result = 0; int result = 0;
if (players[0]->game->library->needShuffle) if (players[0]->game->library->needShuffle)
{ {
@@ -296,7 +295,7 @@ void GameObserver::Render()
void GameObserver::ButtonPressed(PlayGuiObject * target){ void GameObserver::ButtonPressed(PlayGuiObject * target){
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX)
OutputDebugString("Click\n"); OutputDebugString("GAMEOBSERVER Click\n");
#endif #endif
if (CardView* cardview = dynamic_cast<CardView*>(target)){ if (CardView* cardview = dynamic_cast<CardView*>(target)){
MTGCardInstance * card = cardview->getCard(); MTGCardInstance * card = cardview->getCard();
@@ -317,23 +316,14 @@ void GameObserver::ButtonPressed(PlayGuiObject * target){
else if (GuiGraveyard* graveyard = dynamic_cast<GuiGraveyard*>(target)) else if (GuiGraveyard* graveyard = dynamic_cast<GuiGraveyard*>(target))
graveyard->toggleDisplay(); graveyard->toggleDisplay();
else if (GuiAvatar* avatar = dynamic_cast<GuiAvatar*>(target)){ else if (GuiAvatar* avatar = dynamic_cast<GuiAvatar*>(target)){
#if defined (WIN32) || defined (LINUX)
OutputDebugString("Click Player !\n");
#endif
cardClick(NULL, avatar->player); cardClick(NULL, avatar->player);
} }
} }
void GameObserver::stackObjectClicked(Interruptible * action){ void GameObserver::stackObjectClicked(Interruptible * action){
if (targetChooser != NULL){ if (targetChooser != NULL){
#if defined (WIN32) || defined (LINUX)
OutputDebugString("target chooser ok \n");
#endif
int result = targetChooser->toggleTarget(action); int result = targetChooser->toggleTarget(action);
if (result == TARGET_OK_FULL){ if (result == TARGET_OK_FULL){
#if defined (WIN32) || defined (LINUX)
OutputDebugString("target chooser Full \n");
#endif
cardClick(cardWaitingForTargets); cardClick(cardWaitingForTargets);
}else{ }else{
return; return;
+4 -19
View File
@@ -174,7 +174,7 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
MTGAbility * a = parseMagicLine(s1, id, spell, card, 1); MTGAbility * a = parseMagicLine(s1, id, spell, card, 1);
if (!a){ if (!a){
OutputDebugString("Error parsing:"); OutputDebugString("ABILITYFACTORY Error parsing:");
OutputDebugString(s.c_str()); OutputDebugString(s.c_str());
OutputDebugString("\n"); OutputDebugString("\n");
return NULL; return NULL;
@@ -837,7 +837,7 @@ int AbilityFactory::magicText(int id, Spell * spell, MTGCardInstance * card){
} }
result++; result++;
}else{ }else{
OutputDebugString("ERROR: Parser returned NULL\n"); OutputDebugString("ABILITYFACTORY ERROR: Parser returned NULL\n");
//return result; //return result;
} }
} }
@@ -1825,10 +1825,8 @@ int MTGAbility::testDestroy(){
if (waitingForAnswer) return 0; if (waitingForAnswer) return 0;
if (forceDestroy == 1) return 1; if (forceDestroy == 1) return 1;
if (forceDestroy == -1) return 0; if (forceDestroy == -1) return 0;
if (!game->isInPlay(source) ){ if (!game->isInPlay(source) ) return 1;
OutputDebugString("Destroying Ability !!!\n");
return 1;
}
if (target && !game->isInPlay((MTGCardInstance *)target)){ if (target && !game->isInPlay((MTGCardInstance *)target)){
source->controller()->game->putInGraveyard(source);//TODO put this in a better place ??? source->controller()->game->putInGraveyard(source);//TODO put this in a better place ???
return 1; return 1;
@@ -1868,9 +1866,6 @@ int ActivatedAbility::isReactingToClick(MTGCardInstance * card, ManaCost * mana)
if (!cost) return 1; if (!cost) return 1;
if (!mana) mana = player->getManaPool(); if (!mana) mana = player->getManaPool();
if (!mana->canAfford(cost)) return 0; if (!mana->canAfford(cost)) return 0;
char buf[4096];
sprintf(buf, "Will react to Click : %i\n", aType);
OutputDebugString(buf);
return 1; return 1;
} }
return 0; return 0;
@@ -1878,13 +1873,9 @@ int ActivatedAbility::isReactingToClick(MTGCardInstance * card, ManaCost * mana)
int ActivatedAbility::reactToClick(MTGCardInstance * card){ int ActivatedAbility::reactToClick(MTGCardInstance * card){
if (!isReactingToClick(card)) return 0; if (!isReactingToClick(card)) return 0;
OutputDebugString("React To click 1\n");
if (cost){ if (cost){
cost->setExtraCostsAction(this, card); cost->setExtraCostsAction(this, card);
OutputDebugString("React To click 2\n");
if (!cost->isExtraPaymentSet()){ if (!cost->isExtraPaymentSet()){
OutputDebugString("React To click 3\n");
game->waitForExtraPayment = cost->extraCosts; game->waitForExtraPayment = cost->extraCosts;
return 0; return 0;
} }
@@ -1902,9 +1893,7 @@ int ActivatedAbility::reactToTargetClick(Targetable * object){
if (!isReactingToTargetClick(object)) return 0; if (!isReactingToTargetClick(object)) return 0;
if (cost){ if (cost){
if (object->typeAsTarget() == TARGET_CARD) cost->setExtraCostsAction(this, (MTGCardInstance *) object); if (object->typeAsTarget() == TARGET_CARD) cost->setExtraCostsAction(this, (MTGCardInstance *) object);
OutputDebugString("React To click 2\n");
if (!cost->isExtraPaymentSet()){ if (!cost->isExtraPaymentSet()){
OutputDebugString("React To click 3\n");
game->waitForExtraPayment = cost->extraCosts; game->waitForExtraPayment = cost->extraCosts;
return 0; return 0;
} }
@@ -2328,13 +2317,9 @@ AManaProducer::AManaProducer(int id, MTGCardInstance * card, ManaCost * _output,
int AManaProducer::reactToClick(MTGCardInstance * _card){ int AManaProducer::reactToClick(MTGCardInstance * _card){
if (!isReactingToClick( _card)) return 0; if (!isReactingToClick( _card)) return 0;
OutputDebugString("React To click 1\n");
if (cost){ if (cost){
cost->setExtraCostsAction(this, _card); cost->setExtraCostsAction(this, _card);
OutputDebugString("React To click 2\n");
if (!cost->isExtraPaymentSet()){ if (!cost->isExtraPaymentSet()){
OutputDebugString("React To click 3\n");
GameObserver::GetInstance()->waitForExtraPayment = cost->extraCosts; GameObserver::GetInstance()->waitForExtraPayment = cost->extraCosts;
return 0; return 0;
} }
-3
View File
@@ -594,9 +594,6 @@ JSample * MTGCardInstance::getSample(){
for (int i = nb_types-1; i>0; i--){ for (int i = nb_types-1; i>0; i--){
string type = Subtypes::subtypesList->find(types[i]); string type = Subtypes::subtypesList->find(types[i]);
type = type + ".wav"; type = type + ".wav";
#ifdef WIN32
OutputDebugString(type.c_str());
#endif
if (fileExists(resources.sfxFile(type).c_str())){ if (fileExists(resources.sfxFile(type).c_str())){
sample = string(type); sample = string(type);
break; break;
-1
View File
@@ -65,7 +65,6 @@ void MTGPlayerCards::initGame(int shuffle, int draw){
if (shuffle) library->shuffle(); if (shuffle) library->shuffle();
if (draw){ if (draw){
for (int i=0;i<7;i++){ for (int i=0;i<7;i++){
OutputDebugString("draw\n");
drawFromLibrary(); drawFromLibrary();
} }
} }
+2 -19
View File
@@ -88,14 +88,7 @@ TargetChooser * TargetChooserFactory::createTargetChooser(string s, MTGCardInsta
if (found != string::npos){ if (found != string::npos){
int nbminuses = 0; int nbminuses = 0;
int end = typeName.find("]"); int end = typeName.find("]");
#ifdef WIN32
OutputDebugString("Advanced Attributes 1 \n");
#endif
string attributes = typeName.substr(found+1,end-found-1); string attributes = typeName.substr(found+1,end-found-1);
#ifdef WIN32
OutputDebugString(attributes.c_str());
OutputDebugString("\n");
#endif
cd = NEW CardDescriptor(); cd = NEW CardDescriptor();
while(attributes.size()){ while(attributes.size()){
unsigned int found2 = attributes.find(";"); unsigned int found2 = attributes.find(";");
@@ -110,17 +103,10 @@ TargetChooser * TargetChooserFactory::createTargetChooser(string s, MTGCardInsta
} }
int minus = 0; int minus = 0;
if (attribute[0] == '-'){ if (attribute[0] == '-'){
#ifdef WIN32
OutputDebugString("MINUS\n");
#endif
minus = 1; minus = 1;
nbminuses++; nbminuses++;
attribute=attribute.substr(1); attribute=attribute.substr(1);
} }
#ifdef WIN32
OutputDebugString(attribute.c_str());
OutputDebugString("\n");
#endif
//Attacker //Attacker
if (attribute.find("attacking") != string::npos){ if (attribute.find("attacking") != string::npos){
if (minus){ if (minus){
@@ -277,7 +263,7 @@ TargetChooser::TargetChooser(MTGCardInstance * card, int _maxtargets): TargetsLi
bool TargetChooser::canTarget(Targetable * target){ bool TargetChooser::canTarget(Targetable * target){
if (target->typeAsTarget() == TARGET_CARD){ if (target->typeAsTarget() == TARGET_CARD){
MTGCardInstance * card = (MTGCardInstance *) target; MTGCardInstance * card = (MTGCardInstance *) target;
if (source && card->isInPlay() && (card->has(Constants::SHROUD)|| card->protectedAgainst(source) )) return false; if (source && targetter && card->isInPlay() && (card->has(Constants::SHROUD)|| card->protectedAgainst(targetter) )) return false;
if (source && targetter && card->isInPlay() && (source->controller() != card->controller()) && (card->has(Constants::OPPONENTSHROUD) || card->protectedAgainst(targetter))) return false; if (source && targetter && card->isInPlay() && (source->controller() != card->controller()) && (card->has(Constants::OPPONENTSHROUD) || card->protectedAgainst(targetter))) return false;
return true; return true;
} }
@@ -293,7 +279,7 @@ int TargetChooser::addTarget(Targetable * target){
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX)
char buf[4096]; char buf[4096];
sprintf(buf, "Nb targets : %i\n", cursor); sprintf(buf, "TARGETCHOOSER Nb targets : %i\n", cursor);
OutputDebugString(buf); OutputDebugString(buf);
#endif #endif
return targetsReadyCheck(); return targetsReadyCheck();
@@ -539,9 +525,6 @@ bool PlayerTargetChooser::canTarget(Targetable * target){
/*Damageable Target */ /*Damageable Target */
bool DamageableTargetChooser::canTarget(Targetable * target){ bool DamageableTargetChooser::canTarget(Targetable * target){
if (target->typeAsTarget() == TARGET_PLAYER){ if (target->typeAsTarget() == TARGET_PLAYER){
#if defined (WIN32) || defined (LINUX)
OutputDebugString("Targetting Player !!!\n");
#endif
return true; return true;
} }
return CreatureTargetChooser::canTarget(target); return CreatureTargetChooser::canTarget(target);
+11 -13
View File
@@ -35,7 +35,7 @@ MTGCardInstance * TestSuite::getCardByMTGId(int mtgid){
MTGGameZone * zone = zones[j]; MTGGameZone * zone = zones[j];
for (int k = 0; k < zone->nb_cards; k++){ for (int k = 0; k < zone->nb_cards; k++){
MTGCardInstance * card = zone->cards[k]; MTGCardInstance * card = zone->cards[k];
if (!card) OutputDebugString ("wtf ?"); if (!card) return NULL;
if (card->getMTGId() == mtgid) return card; if (card->getMTGId() == mtgid) return card;
} }
} }
@@ -71,7 +71,7 @@ int TestSuiteAI::Act(float dt){
string action = suite->getNextAction(); string action = suite->getNextAction();
g->mLayers->stackLayer()->Dump(); g->mLayers->stackLayer()->Dump();
// DamageResolverLayer * drl = g->mLayers->combatLayer(); // DamageResolverLayer * drl = g->mLayers->combatLayer();
OutputDebugString("TESTSUITE command:");
OutputDebugString(action.c_str()); OutputDebugString(action.c_str());
OutputDebugString("\n"); OutputDebugString("\n");
@@ -96,7 +96,7 @@ int TestSuiteAI::Act(float dt){
g->userRequestNextGamePhase(); g->userRequestNextGamePhase();
} }
else if (action.compare("human")==0){ else if (action.compare("human")==0){
OutputDebugString("You have control"); OutputDebugString("TESTSUITE You have control");
humanMode = 1; humanMode = 1;
return 1; return 1;
} }
@@ -122,7 +122,7 @@ int TestSuiteAI::Act(float dt){
g->mLayers->stackLayer()->cancelInterruptOffer(); g->mLayers->stackLayer()->cancelInterruptOffer();
} }
}else if(action.find("choice ")!=string::npos){ }else if(action.find("choice ")!=string::npos){
OutputDebugString("choice !!!\n"); OutputDebugString("TESTSUITE choice !!!\n");
int choice = atoi(action.substr(action.find("choice ") + 7).c_str()); int choice = atoi(action.substr(action.find("choice ") + 7).c_str());
g->mLayers->actionLayer()->doReactTo(choice); g->mLayers->actionLayer()->doReactTo(choice);
}else if(action.find(" -momir- ")!=string::npos){ }else if(action.find(" -momir- ")!=string::npos){
@@ -141,7 +141,7 @@ int TestSuiteAI::Act(float dt){
int mtgid = suite->getMTGId(action); int mtgid = suite->getMTGId(action);
if (mtgid){ if (mtgid){
char buffe[512]; char buffe[512];
sprintf(buffe, "CARD ID : %i\n", mtgid); sprintf(buffe, "TESTSUITE CARD ID : %i\n", mtgid);
OutputDebugString(buffe); OutputDebugString(buffe);
Interruptible * toInterrupt = suite->getActionByMTGId(mtgid); Interruptible * toInterrupt = suite->getActionByMTGId(mtgid);
if (toInterrupt){ if (toInterrupt){
@@ -149,8 +149,9 @@ int TestSuiteAI::Act(float dt){
}else{ }else{
MTGCardInstance * card = suite->getCardByMTGId(mtgid); MTGCardInstance * card = suite->getCardByMTGId(mtgid);
if (card) { if (card) {
OutputDebugString("Clicking ON: "); OutputDebugString("TESTSUITE Clicking ON: ");
OutputDebugString(card->name.c_str()); OutputDebugString(card->name.c_str());
OutputDebugString("\n");
/* /*
if (drl->mCount){ if (drl->mCount){
if (drl->orderingIsNeeded){ if (drl->orderingIsNeeded){
@@ -283,7 +284,7 @@ void TestSuite::initGame(){
} }
//Put the GameObserver in the initial state //Put the GameObserver in the initial state
GameObserver * g = GameObserver::GetInstance(); GameObserver * g = GameObserver::GetInstance();
OutputDebugString("Init Game\n"); OutputDebugString("TESTSUITE Init Game\n");
g->phaseRing->goToPhase(initState.phase, g->players[0]); g->phaseRing->goToPhase(initState.phase, g->players[0]);
g->currentGamePhase = initState.phase; g->currentGamePhase = initState.phase;
for (int i = 0; i < 2; i++){ for (int i = 0; i < 2; i++){
@@ -295,9 +296,6 @@ void TestSuite::initGame(){
MTGGameZone * zone = playerZones[j]; MTGGameZone * zone = playerZones[j];
for (int k = 0; k < initState.playerData[i].zones[j].nbitems; k++){ for (int k = 0; k < initState.playerData[i].zones[j].nbitems; k++){
MTGCardInstance * card = getCardByMTGId(initState.playerData[i].zones[j].cards[k]); MTGCardInstance * card = getCardByMTGId(initState.playerData[i].zones[j].cards[k]);
char buf[4096];
sprintf(buf, "QUAD : %p\n", resources.RetrieveCard(card));
OutputDebugString(buf);
if (card && zone != p->game->library){ if (card && zone != p->game->library){
if (zone == p->game->inPlay){ if (zone == p->game->inPlay){
MTGCardInstance * copy = p->game->putInZone(card, p->game->library, p->game->stack); MTGCardInstance * copy = p->game->putInZone(card, p->game->library, p->game->stack);
@@ -307,17 +305,17 @@ void TestSuite::initGame(){
delete spell; delete spell;
}else{ }else{
if (!p->game->library->hasCard(card)){ if (!p->game->library->hasCard(card)){
LOG ("ERROR, CARD NOT FOUND IN LIBRARY\n"); LOG ("TESTUITE ERROR, CARD NOT FOUND IN LIBRARY\n");
} }
p->game->putInZone(card,p->game->library,zone); p->game->putInZone(card,p->game->library,zone);
} }
}else{ }else{
if (!card) { LOG ("ERROR, card is NULL\n"); } if (!card) { LOG ("TESTUITE ERROR, card is NULL\n"); }
} }
} }
} }
} }
OutputDebugString("Init Game Done !\n"); OutputDebugString("TESTUITE Init Game Done !\n");
} }
int TestSuite::Log(const char * text){ int TestSuite::Log(const char * text){