more fixes from the review...
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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<unsigned char>(actA)/2,100,0,0));
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -895,7 +895,7 @@ int MTGDeck::complete()
|
||||
{
|
||||
StypeIsNothing = true;
|
||||
}
|
||||
if (!StypeIsNothing == true)
|
||||
if (!StypeIsNothing )
|
||||
{
|
||||
if (cards.find(id) == cards.end())
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user