void Creature::addHealPoints(Creature* caster, int32_t healthPoints) { if(healthPoints <= 0) return; uint32_t casterId = 0; if(caster) casterId = caster->getID(); CountMap::iterator it = healMap.find(casterId); if(it != healMap.end()) { it->second.ticks = OTSYS_TIME(); it->second.total += healthPoints; } else healMap[casterId] = CountBlock_t(healthPoints); }
void Creature::addDamagePoints(Creature* attacker, int32_t damagePoints) { uint32_t attackerId = 0; if(attacker) attackerId = attacker->getID(); CountMap::iterator it = damageMap.find(attackerId); if(it != damageMap.end()) { it->second.ticks = OTSYS_TIME(); if(damagePoints > 0) it->second.total += damagePoints; } else damageMap[attackerId] = CountBlock_t(damagePoints); if(damagePoints > 0) lastHitCreature = attackerId; }