uint32 EnhancePackImplementation::calculatePower(CreatureObject* healer, CreatureObject* patient, bool applyBattleFatigue) {
		float power = getEffectiveness();

		if (applyBattleFatigue)
			power = power - (power * patient->calculateBFRatio() * healer->calculateBFRatio());
		int droidBuff = healer->getSkillModOfType("private_medical_rating",SkillModManager::DROID);
		int bldBuff = healer->getSkillModOfType("private_medical_rating", SkillModManager::STRUCTURE);
		int mod = healer->getSkillModOfType("private_medical_rating", SkillModManager::CITY);
		mod +=  droidBuff > bldBuff ? droidBuff : bldBuff;
		float modEnvironment = ((float) mod / 100);
		float modSkill = (float) healer->getSkillMod("healing_wound_treatment");

		return power * modEnvironment * (100 + modSkill) / 100;
}
Ejemplo n.º 2
0
void Extractor::update(float frameTime)
{
	if(getActive())
	{
		//i rewrite the building logic because i need to take into account minerals
		ActorWithHealthBar::update(frameTime);
		if(anythingNearby&&getPower())
		{
			if(game->getIdlePop() > 0 && getStaff() < getCapacity())
			{
				modifyStaff(1);
				game->removeIdlePop(1);
			}
		}
		else if(getStaff() > 0)
		{
			modifyStaff(-1);
			game->addIdlePop(1);
		}

		if(getPower())
		{
			game->spawnParticleCloud(getCenter(),graphicsNS::GRAY,1);
			if(anythingNearby)
			{
				if(minerals==nullptr||!minerals->getActive())
					minerals=game->findMineableMinerals(this);
					if(minerals==nullptr)
						anythingNearby = false;
				else
				{
					game->addMinerals(minerals->mine(ExtractorNS::DEFAULT_MINING_RATE*frameTime*getEffectiveness()));
					game->spawnParticleCloud(getCenter(),graphicsNS::CYAN,1);
				}
			}

		}
	}
}