moved the eventsending for drawing cards into the resolve of adrawer. tho i think this will make this event unusable for "card draw replacement effects"...it really doesn't matter as i don't see card draw replacement being added to wagic any time soon, if ever.

2nd, having levelup and counters return effs separately.
This commit is contained in:
omegablast2002@yahoo.com
2011-04-25 12:00:33 +00:00
parent 1cbf3db582
commit 934e0af004
3 changed files with 58 additions and 54 deletions
+26 -22
View File
@@ -387,7 +387,6 @@ int AIAction::getEfficiency()
break; break;
} }
case MTGAbility::STANDARD_LEVELUP: case MTGAbility::STANDARD_LEVELUP:
case MTGAbility::COUNTERS:
{ {
MTGCardInstance * _target = (MTGCardInstance *) target; MTGCardInstance * _target = (MTGCardInstance *) target;
efficiency = 0; efficiency = 0;
@@ -402,27 +401,6 @@ int AIAction::getEfficiency()
currentlevel = targetCounter->nb; currentlevel = targetCounter->nb;
} }
} }
if(AACounter * cc = dynamic_cast<AACounter*> (a))
{
if(cc && !targetCounter)
{
if(_target && _target->controller()->isAI() && cc->toughness>=0)
{
efficiency = 90;
}
if(_target && !_target->controller()->isAI() && ((_target->toughness + cc->toughness <= 0 && _target->toughness) || (cc->toughness < 0 && cc->power < 0)))
{
efficiency = 90;
}
if(_target && _target->counters && _target->counters->counters && _target->counters->hasCounter(cc->power,cc->toughness) && _target->counters->hasCounter(cc->power,cc->toughness)->nb > 15)
{
efficiency = _target->counters->hasCounter(cc->power,cc->toughness)->nb;
}
break;
}
}
if (currentlevel < _target->MaxLevelUp) if (currentlevel < _target->MaxLevelUp)
{ {
efficiency = 85; efficiency = 85;
@@ -443,6 +421,32 @@ int AIAction::getEfficiency()
} }
break; break;
} }
case MTGAbility::COUNTERS:
{
MTGCardInstance * _target = (MTGCardInstance *) target;
efficiency = 0;
if(AACounter * cc = dynamic_cast<AACounter*> (a))
{
if(cc && _target)
{
if(_target && _target->controller()->isAI() && cc->toughness>=0)
{
efficiency = 90;
}
if(_target && !_target->controller()->isAI() && ((_target->toughness + cc->toughness <= 0 && _target->toughness) || (cc->toughness < 0 && cc->power < 0)))
{
efficiency = 90;
}
if(_target && _target->counters && _target->counters->counters && _target->counters->hasCounter(cc->power,cc->toughness) && _target->counters->hasCounter(cc->power,cc->toughness)->nb > 15)
{
efficiency = _target->counters->hasCounter(cc->power,cc->toughness)->nb;
}
}
}
break;
}
case MTGAbility::STANDARD_PUMP: case MTGAbility::STANDARD_PUMP:
{ {
MTGCardInstance * _target = (MTGCardInstance *) (a->target); MTGCardInstance * _target = (MTGCardInstance *) (a->target);
-6
View File
@@ -537,12 +537,6 @@ int ActionStack::addDraw(Player * player, int nb_cards)
{ {
DrawAction * draw = NEW DrawAction(mCount, player, nb_cards); DrawAction * draw = NEW DrawAction(mCount, player, nb_cards);
addAction(draw); addAction(draw);
GameObserver *g = GameObserver::GetInstance();
for(int i = nb_cards; i > 0;i--)
{
WEvent * e = NEW WEventcardDraw(player, nb_cards);
g->receiveEvent(e);
}
return 1; return 1;
} }
+7 -1
View File
@@ -292,7 +292,7 @@ AACounter::AACounter(int id, MTGCardInstance * source, MTGCardInstance * target,
ActivatedAbility(id, source, cost, 0),counterstring(counterstring), nb(nb),maxNb(maxNb), power(power), toughness(toughness), name(_name) ActivatedAbility(id, source, cost, 0),counterstring(counterstring), nb(nb),maxNb(maxNb), power(power), toughness(toughness), name(_name)
{ {
this->target = target; this->target = target;
if (name.find("Level")) if (name.find("Level") != string::npos || name.find("level") != string::npos)
aType = MTGAbility::STANDARD_LEVELUP; aType = MTGAbility::STANDARD_LEVELUP;
else else
aType = MTGAbility::COUNTERS; aType = MTGAbility::COUNTERS;
@@ -677,6 +677,12 @@ AADrawer::AADrawer(int _id, MTGCardInstance * card, Targetable * _target, ManaCo
} }
game->mLayers->stackLayer()->addDraw(player, numCards.getValue()); game->mLayers->stackLayer()->addDraw(player, numCards.getValue());
game->mLayers->stackLayer()->resolve(); game->mLayers->stackLayer()->resolve();
GameObserver *g = GameObserver::GetInstance();
for(int i = numCards.getValue(); i > 0;i--)
{
WEvent * e = NEW WEventcardDraw(player, 1);
g->receiveEvent(e);
}
} }
return 1; return 1;
} }