void FrostTurretProjectile::update(float _dt) { m_timeToImpact = max(m_timeToImpact-_dt, 0.0f); if(m_timeToImpact == 0.0f) { ServerEntity* target = EntityHandler::getServerEntity(m_target); if(target) { int damage = random(1, 5); int healthBefore = target->getHealth(); target->takeDamage(this->m_masterOwner, this->m_damage, 0); ((UnitEntity*)target)->applyFrostTurretSlowEffect(this->m_slowEffect); // dbg stringstream ss; target = EntityHandler::getServerEntity(m_target); if(target) ss << "Frost turret projectile did " << damage << " damage and reduced health from " << healthBefore << " to " << target->getHealth() << endl; else ss << "Frost turret projectile did " << damage << " damage and reduced health from " << healthBefore << " to death" << endl; OutputDebugString(ss.str().c_str()); // Remove me from server entity handler this->m_messageQueue->pushOutgoingMessage(new RemoveServerEntityMessage(0, EntityHandler::getId(), this->m_id)); } } }
void CloudOfDarknessEffect::tick() { vector<ServerEntity*> enemies = EntityHandler::getEntitiesByType(Type::EnemyType); for(int i = 0; i < enemies.size(); i++) { ServerEntity* enemy = enemies[i]; if(enemy->intersects(*m_bs)) { enemy->takeDamage(this->getId(), m_damage*0.5f, 0); } } }