diff --git a/projects/mtg/include/AllAbilities.h b/projects/mtg/include/AllAbilities.h index b748521f7..6521eec2a 100644 --- a/projects/mtg/include/AllAbilities.h +++ b/projects/mtg/include/AllAbilities.h @@ -223,7 +223,7 @@ public: if(source->isPhased) return 0; WEventZoneChange * e = dynamic_cast (event); if (!e) return 0; - if(sourceUntapped == true && source->isTapped() == 1) + if(sourceUntapped && source->isTapped() == 1) return 0; if(activeTrigger == false) return 0; @@ -239,7 +239,7 @@ public: { return 0; } - if(once == true && activeTrigger == true) + if(once && activeTrigger) activeTrigger = false; return 1; } @@ -437,7 +437,7 @@ public: if(source->isPhased) return 0; WEventCardAttacked * e = dynamic_cast (event); if (!e) return 0; - if (sourceUntapped == true && source->isTapped() == 1) + if (sourceUntapped && source->isTapped() == 1) return 0; if (e->card->didattacked < 1) return 0; if (!tc->canTarget(e->card)) return 0; @@ -522,7 +522,7 @@ public: //if(e->card->didblocked < 1) return 0; if (fromTc && !fromTc->canTarget(e->card->getNextOpponent())) return 0; if (!tc->canTarget(e->card)) return 0; - if(once == true && activeTrigger == true) + if(once && activeTrigger ) activeTrigger = false; return 1; } @@ -668,7 +668,7 @@ public: if(source->isPhased) return 0; WEventDamage * e = dynamic_cast (event); if (!e) return 0; - if (sourceUntapped == true && source->isTapped() == 1) + if (sourceUntapped && source->isTapped() == 1) return 0; if (!tc->canTarget(e->damage->target)) return 0; if (fromTc && !fromTc->canTarget(e->damage->source)) return 0; @@ -715,7 +715,7 @@ public: if(source->isPhased) return 0; WEventLife * e = dynamic_cast (event); if (!e) return 0; - if (sourceUntapped == true && source->isTapped() == 1) + if (sourceUntapped && source->isTapped() == 1) return 0; if (!tc->canTarget(e->player)) return 0; if (fromTc && !fromTc->canTarget(e->player)) return 0; @@ -5737,7 +5737,7 @@ public: { WEventDamage * e = (WEventDamage *) event; Damage * d = e->damage; - if (combatonly == true && e->damage->typeOfDamage != DAMAGE_COMBAT) + if (combatonly && e->damage->typeOfDamage != DAMAGE_COMBAT) return 0; MTGCardInstance * card = d->source; if (d->damage > 0 && card && (card == source || card == source->target)) diff --git a/projects/mtg/include/MTGAbility.h b/projects/mtg/include/MTGAbility.h index 85813fd59..df365bfd3 100644 --- a/projects/mtg/include/MTGAbility.h +++ b/projects/mtg/include/MTGAbility.h @@ -419,7 +419,5 @@ class AManaProducer: public ActivatedAbilityTP{ virtual AManaProducer * clone() const; }; -#include "MTGCardInstance.h" - #endif diff --git a/projects/mtg/src/AIPlayer.cpp b/projects/mtg/src/AIPlayer.cpp index e2145bda4..79d57cde7 100644 --- a/projects/mtg/src/AIPlayer.cpp +++ b/projects/mtg/src/AIPlayer.cpp @@ -110,7 +110,7 @@ bool AIPlayer::tapLandsForMana(ManaCost * cost, MTGCardInstance * target) MTGCardInstance * card = amp->source; if (card == target) used[card] = true; //http://code.google.com/p/wagic/issues/detail?id=76 - if (!used[card] && amp->isReactingToClick(card) && amp->output->getConvertedCost() == 1) + if (!used[card] && amp->isReactingToClick(card) && amp->output->getConvertedCost() >= 1) { used[card] = true; int doTap = 1; @@ -291,7 +291,7 @@ int AIAction::getEfficiency() { if ((target->defenser || target->blockers.size()) && target->preventable < target->getNextOpponent()->power) NeedPreventing = true; - if (p == target->controller() && target->controller()->isAI() && NeedPreventing == true && !(target->getNextOpponent()->has(Constants::DEATHTOUCH) + if (p == target->controller() && target->controller()->isAI() && NeedPreventing && !(target->getNextOpponent()->has(Constants::DEATHTOUCH) || target->getNextOpponent()->has(Constants::WITHER))) { efficiency = 20 * (target->DangerRanking());//increase this chance to be used in combat if the creature blocking/blocked could kill the creature this chance is taking into consideration how good the creature is, best creature will always be the first "saved".. @@ -1189,15 +1189,15 @@ MTGCardInstance * AIPlayerBaka::FindCardToPlay(ManaCost * pMana, const char * ty { if (!CanHandleCost(card->getManaCost())) continue; - if (card->hasType(Subtypes::TYPE_CREATURE) && this->castrestrictedcreature == true && this->castrestrictedspell == true) + if (card->hasType(Subtypes::TYPE_CREATURE) && this->castrestrictedcreature && this->castrestrictedspell ) continue; - if (card->hasType(Subtypes::TYPE_ENCHANTMENT) && this->castrestrictedspell == true) + if (card->hasType(Subtypes::TYPE_ENCHANTMENT) && this->castrestrictedspell ) continue; - if (card->hasType(Subtypes::TYPE_ARTIFACT) && this->castrestrictedspell == true) + if (card->hasType(Subtypes::TYPE_ARTIFACT) && this->castrestrictedspell ) continue; - if (card->hasType(Subtypes::TYPE_SORCERY) && this->castrestrictedspell == true) + if (card->hasType(Subtypes::TYPE_SORCERY) && this->castrestrictedspell ) continue; - if (card->hasType(Subtypes::TYPE_INSTANT) && this->castrestrictedspell == true) + if (card->hasType(Subtypes::TYPE_INSTANT) && this->castrestrictedspell ) continue; if (card->hasType(Subtypes::TYPE_LAND) && !this->canPutLandsIntoPlay) continue; diff --git a/projects/mtg/src/AllAbilities.cpp b/projects/mtg/src/AllAbilities.cpp index bd5445aea..6c5706abf 100644 --- a/projects/mtg/src/AllAbilities.cpp +++ b/projects/mtg/src/AllAbilities.cpp @@ -387,7 +387,7 @@ AARemoveAllCounter::AARemoveAllCounter(int id, MTGCardInstance * source, MTGCard if (target) { MTGCardInstance * _target = (MTGCardInstance *) target; - if (all == true) + if (all ) { for(int amount = 0;amount < _target->counters->mCount;amount++) { @@ -914,13 +914,13 @@ int AADynamic::resolve() case 0: sourceamount = ((MTGCardInstance *) source)->power; targetamount = ((MTGCardInstance *) _target)->power; - if(eachother == true) + if(eachother ) sourceamount = ((MTGCardInstance *) source)->power; break; case 1: sourceamount = ((MTGCardInstance *) source)->toughness; targetamount = ((MTGCardInstance *) _target)->toughness; - if(eachother == true) + if(eachother ) sourceamount = ((MTGCardInstance *) source)->toughness; break; case 2: @@ -1030,7 +1030,7 @@ int AADynamic::resolve() game->mLayers->stackLayer()->addDamage((MTGCardInstance *)source, _target, sourceamount); else game->mLayers->stackLayer()->addDamage((MTGCardInstance *)source, OriginalSrc, sourceamount); - if(eachother == true) + if(eachother ) { game->mLayers->stackLayer()->addDamage((MTGCardInstance *)_target, source, targetamount); } @@ -2277,7 +2277,7 @@ int ATransformer::addToGame() for (it = types.begin(); it != types.end(); it++) { - if (remove == true) + if (remove ) { _target->removeType(*it); } @@ -2297,13 +2297,13 @@ int ATransformer::addToGame() for (it = oldcolors.begin(); it != oldcolors.end(); it++) { } - if(newpowerfound == true) + if(newpowerfound ) { oldpower = _target->power; _target->power += newpower; _target->power -= oldpower; } - if(newtoughnessfound == true) + if(newtoughnessfound ) { oldtoughness = _target->toughness; _target->addToToughness(newtoughness); @@ -2338,7 +2338,7 @@ int ATransformer::destroy() { _target->setColor(*it); } - if (remove == true) + if (remove ) { for (it = oldtypes.begin(); it != oldtypes.end(); it++) { @@ -2346,11 +2346,11 @@ int ATransformer::destroy() _target->addType(*it); } } - if(newpowerfound == true) + if(newpowerfound ) { _target->power = oldpower; } - if(newtoughnessfound == true) + if(newtoughnessfound ) { _target->toughness = oldtoughness; } @@ -2429,13 +2429,13 @@ int AForeverTransformer::addToGame() { _target->basicAbilities[*it]++; } - if(newpowerfound == true) + if(newpowerfound ) { oldpower = _target->power -= oldpower; _target->power += newpower; _target->power -= oldpower; } - if(newtoughnessfound == true) + if(newtoughnessfound ) { oldtoughness = _target->toughness; _target->addToToughness(newtoughness); @@ -2795,7 +2795,7 @@ void AUpkeep::Update(float dt) { paidThisTurn = 0; } - else if(newPhase == Constants::MTG_PHASE_UPKEEP && Cumulative == true) + else if(newPhase == Constants::MTG_PHASE_UPKEEP && Cumulative ) { source->counters->addCounter("age",0,0); Counter * targetCounter = NULL; @@ -2867,7 +2867,7 @@ void APhaseAction::Update(float dt) { if (newPhase != currentPhase) { - if(newPhase == phase && next == true) + if(newPhase == phase && next ) { MTGCardInstance * _target = (MTGCardInstance *) target; if (_target) diff --git a/projects/mtg/src/CardGui.cpp b/projects/mtg/src/CardGui.cpp index 2aaa58ed9..86d328636 100644 --- a/projects/mtg/src/CardGui.cpp +++ b/projects/mtg/src/CardGui.cpp @@ -162,7 +162,7 @@ void CardGui::Render() renderer->RenderQuad(shadow, actX + (actZ - 1) * 15, actY + (actZ - 1) * 15, actT, 28 * actZ / 16, 40 * actZ / 16); } JQuad* extracostshadow = NULL; - if(card->isExtraCostTarget == true) + if(card->isExtraCostTarget ) { extracostshadow = WResourceManager::Instance()->GetQuad("extracostshadow"); extracostshadow->SetColor(ARGB(static_cast(actA)/2,100,0,0)); diff --git a/projects/mtg/src/ExtraCost.cpp b/projects/mtg/src/ExtraCost.cpp index 7103f603f..b6b232d9c 100644 --- a/projects/mtg/src/ExtraCost.cpp +++ b/projects/mtg/src/ExtraCost.cpp @@ -371,7 +371,7 @@ int Ninja::isPaymentSet() { GameObserver * g = GameObserver::GetInstance(); int currentPhase = g->getCurrentGamePhase(); - if (target && ((target->isAttacker() && target->blocked == true) || target->isAttacker() < 1 || currentPhase + if (target && ((target->isAttacker() && target->blocked) || target->isAttacker() < 1 || currentPhase != Constants::MTG_PHASE_COMBATBLOCKERS)) { tc->removeTarget(target); diff --git a/projects/mtg/src/MTGAbility.cpp b/projects/mtg/src/MTGAbility.cpp index 0308eb334..946d8e61d 100644 --- a/projects/mtg/src/MTGAbility.cpp +++ b/projects/mtg/src/MTGAbility.cpp @@ -173,9 +173,9 @@ int MTGAbility::allowedToAltCast(MTGCardInstance * card,Player * player) if(opponenttypemin < opponentmin && less == false && more == false) return 0; } - if(less == true && more == false && opponenttypemin <= mytypemin) + if(less && more == false && opponenttypemin <= mytypemin) return 0; - if(less == false && more == true && opponenttypemin >= mytypemin) + if(less == false && more && opponenttypemin >= mytypemin) return 0; return 1; } @@ -4276,13 +4276,13 @@ TriggerAtPhase::TriggerAtPhase(int id, MTGCardInstance * source, Targetable * ta int TriggerAtPhase::trigger() { if(source->isPhased) return 0; - if(lifelost == true && source->controller()->opponent()->lifeLostThisTurn < lifeamount) + if(lifelost && source->controller()->opponent()->lifeLostThisTurn < lifeamount) { return 0; } - if (sourceUntapped == true && source->isTapped() == 1) + if (sourceUntapped && source->isTapped() == 1) return 0; - if (sourceTap == true && !source->isTapped()) + if (sourceTap && !source->isTapped()) return 0; if (testDestroy()) return 0; // http://code.google.com/p/wagic/issues/detail?id=426 diff --git a/projects/mtg/src/MTGCardInstance.cpp b/projects/mtg/src/MTGCardInstance.cpp index 27468015e..a31819c93 100644 --- a/projects/mtg/src/MTGCardInstance.cpp +++ b/projects/mtg/src/MTGCardInstance.cpp @@ -209,7 +209,7 @@ void MTGCardInstance::initMTGCI() isBlueAndGreen = 1; if(this->hasColor(Constants::MTG_COLOR_RED) && this->hasColor(Constants::MTG_COLOR_WHITE)) isRedAndWhite = 1; - if(previous && previous->morphed == true && !turningOver) + if(previous && previous->morphed && !turningOver) { morphed = true; isMorphed = true; diff --git a/projects/mtg/src/MTGDeck.cpp b/projects/mtg/src/MTGDeck.cpp index 43c4eee57..9b07e7129 100644 --- a/projects/mtg/src/MTGDeck.cpp +++ b/projects/mtg/src/MTGDeck.cpp @@ -895,7 +895,7 @@ int MTGDeck::complete() { StypeIsNothing = true; } - if (!StypeIsNothing == true) + if (!StypeIsNothing ) { if (cards.find(id) == cards.end()) { diff --git a/projects/mtg/src/MTGRules.cpp b/projects/mtg/src/MTGRules.cpp index ad711df05..223466dc8 100644 --- a/projects/mtg/src/MTGRules.cpp +++ b/projects/mtg/src/MTGRules.cpp @@ -58,30 +58,30 @@ if(!allowedToCast(card,player)) #ifdef WIN32 cost->Dump(); #endif - if (player->castrestrictedspell == true && !card->hasType("land")) + if (player->castrestrictedspell && !card->hasType("land")) { return 0; } - if (player->onlyonecast == true && player->castcount >= 1) + if (player->onlyonecast && player->castcount >= 1) { return 0; } - if (player->nospellinstant == true) + if (player->nospellinstant) { return 0; } - if (player->onlyoneinstant == true) + if (player->onlyoneinstant) { if (player->castcount >= 1) { return 0; } } - if (player->nocreatureinstant == true && card->hasType("creature")) + if (player->nocreatureinstant && card->hasType("creature")) { return 0; } - if (player->castrestrictedcreature == true && card->hasType("creature")) + if (player->castrestrictedcreature && card->hasType("creature")) { return 0; } @@ -166,7 +166,7 @@ int MTGPutInPlayRule::reactToClick(MTGCardInstance * card) game->targetChooser = NULL; player->castedspellsthisturn += 1; player->opponent()->castedspellsthisturn += 1; - if (player->onlyonecast == true || player->onlyoneinstant == true) + if (player->onlyonecast || player->onlyoneinstant) { player->castcount += 1; } @@ -176,7 +176,7 @@ int MTGPutInPlayRule::reactToClick(MTGCardInstance * card) spell = game->mLayers->stackLayer()->addSpell(copy, NULL, spellCost, payResult, 0); player->castedspellsthisturn += 1; player->opponent()->castedspellsthisturn += 1; - if (player->onlyonecast == true || player->onlyoneinstant == true) + if (player->onlyonecast || player->onlyoneinstant) { player->castcount += 1; } @@ -277,30 +277,30 @@ int MTGAlternativeCostRule::isReactingToClick(MTGCardInstance * card, ManaCost * ManaCost * cost = card->getManaCost(); cost->Dump(); #endif - if (player->castrestrictedspell == true && !card->hasType("land")) + if (player->castrestrictedspell && !card->hasType("land")) { return 0; } - if (player->onlyonecast == true && player->castcount >= 1) + if (player->onlyonecast && player->castcount >= 1) { return 0; } - if (player->nospellinstant == true) + if (player->nospellinstant ) { return 0; } - if (player->onlyoneinstant == true) + if (player->onlyoneinstant ) { if (player->castcount >= 1) { return 0; } } - if (player->nocreatureinstant == true && card->hasType("creature")) + if (player->nocreatureinstant && card->hasType("creature")) { return 0; } - if (player->castrestrictedcreature == true && card->hasType("creature")) + if (player->castrestrictedcreature && card->hasType("creature")) { return 0; } @@ -381,7 +381,7 @@ int MTGAlternativeCostRule::reactToClick(MTGCardInstance * card, ManaCost *alter game->targetChooser = NULL; player->castedspellsthisturn += 1; player->opponent()->castedspellsthisturn += 1; - if (player->onlyonecast == true || player->onlyoneinstant == true) + if (player->onlyonecast || player->onlyoneinstant) player->castcount += 1; if (card->has(Constants::STORM)) @@ -627,30 +627,30 @@ int MTGMorphCostRule::isReactingToClick(MTGCardInstance * card, ManaCost * mana) #ifdef WIN32 cost->Dump(); #endif - if (player->castrestrictedspell == true && !card->hasType("land")) + if (player->castrestrictedspell && !card->hasType("land")) { return 0; } - if (player->onlyonecast == true && player->castcount >= 1) + if (player->onlyonecast && player->castcount >= 1) { return 0; } - if (player->nospellinstant == true) + if (player->nospellinstant ) { return 0; } - if (player->onlyoneinstant == true) + if (player->onlyoneinstant ) { if (player->castcount >= 1) { return 0; } } - if (player->nocreatureinstant == true && card->hasType("creature")) + if (player->nocreatureinstant && card->hasType("creature")) { return 0; } - if (player->castrestrictedcreature == true && card->hasType("creature")) + if (player->castrestrictedcreature && card->hasType("creature")) { return 0; } @@ -720,7 +720,7 @@ int MTGMorphCostRule::reactToClick(MTGCardInstance * card) copy->toughness = 2; player->castedspellsthisturn += 1; player->opponent()->castedspellsthisturn += 1; - if (player->onlyonecast == true || player->onlyoneinstant == true) + if (player->onlyonecast || player->onlyoneinstant) { player->castcount += 1;