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