-fixed bugs with lifelink
This commit is contained in:
wagic.the.homebrew@gmail.com
2009-04-05 09:01:31 +00:00
parent d5cf601ec7
commit 34c139a15d
10 changed files with 101 additions and 38 deletions
-32
View File
@@ -715,38 +715,6 @@ class ASpellCounterEnchantment:public TargetAbility{
};
/* Lifelink Ability */
class ALifeLink:public MTGAbility{
public:
int nbdamagesthisturn;
Damage * lastDamage;
ALifeLink(int _id, MTGCardInstance * _source):MTGAbility(_id, _source){
nbdamagesthisturn = 0;
lastDamage = NULL;
}
void Update(float dt){
ActionStack * as = game->mLayers->stackLayer();
int totaldamages = as->count(ACTION_DAMAGE,RESOLVED_OK);
if ( totaldamages > nbdamagesthisturn){
Damage * damage = ((Damage * )as->getNext(lastDamage,ACTION_DAMAGE, RESOLVED_OK));
while(damage){
lastDamage = damage;
if (damage->source == source){
source->controller()->life+= damage->damage;
}
damage = ((Damage * )as->getNext(lastDamage,ACTION_DAMAGE, RESOLVED_OK));
}
}else if (totaldamages ==0){
lastDamage = NULL;
}
nbdamagesthisturn = totaldamages;
}
};
//Circle of Protections
class ACircleOfProtection: public TargetAbility{
public: