Fix issue 563 (double strike VS regenerate)

-- also made "blocked" variable a private.
This commit is contained in:
wagic.the.homebrew
2011-10-10 12:29:52 +00:00
parent 9b2654997e
commit f0964d9af8
8 changed files with 14 additions and 10 deletions
+1 -1
View File
@@ -503,7 +503,7 @@ ExtraCost("Select unblocked attacker", _tc)
int Ninja::isPaymentSet()
{
if (target && ((target->isAttacker() && target->blocked) ||
if (target && ((target->isAttacker() && target->isBlocked()) ||
target->isAttacker() < 1 ||
target->getObserver()->getCurrentGamePhase() != Constants::MTG_PHASE_COMBATBLOCKERS))
{
+1 -1
View File
@@ -429,7 +429,7 @@ int GuiCombat::resolve() // Returns the number of damage objects dealt this turn
dmg -= (*q)->sumDamages();
}
if (dmg > 0 && ((!attacker->blocked) || attacker->has(Constants::TRAMPLE)))
if (dmg > 0 && ((!attacker->isBlocked()) || attacker->has(Constants::TRAMPLE)))
stack->Add(NEW Damage(observer, (*it)->card, observer->opponent(), dmg, DAMAGE_COMBAT));
for (vector<Damage>::iterator d = (*it)->damages.begin(); d != (*it)->damages.end(); ++d)
stack->Add(NEW Damage(*d));
+4 -1
View File
@@ -791,7 +791,10 @@ int MTGCardInstance::getDefenserRank(MTGCardInstance * blocker)
int MTGCardInstance::removeBlocker(MTGCardInstance * blocker)
{
blockers.remove(blocker);
if (!blockers.size())
// Blockers can be removed "manually" (by the blocking player) at the Blockers step,
// Or "automatically" in the damage phase, when they die and regenerate (see http://code.google.com/p/wagic/issues/detail?id=563 )
// In the second case, we still want the card to be marked as "blocked" this turn
if (!blockers.size() && observer->currentGamePhase == Constants::MTG_PHASE_COMBATBLOCKERS)
{
blocked = false;
}
+2 -2
View File
@@ -1355,12 +1355,12 @@ int MTGCombatTriggersRule::receiveEvent(WEvent *e)
for (int i = 0; i < z->nb_cards; i++)
{
MTGCardInstance * card = z->cards[i];
if (card && card->isAttacker() && !card->blocked)
if (card && card->isAttacker() && !card->isBlocked())
{
card->eventattackednotblocked();
card->notblocked = 1;
}
if (card && card->isAttacker() && card->blocked)
if (card && card->isAttacker() && card->isBlocked())
{
MTGCardInstance * opponent = card->getNextOpponent();