void CCompChoppyThrower::ReceiveMessage(SMessage &msg) {
	if (msg.m_type == EMT_SHOOT && m_lastShot >= GetCooldown()) {
		SShootMsg &shootMsg = static_cast<SShootMsg &>(msg);
		if (shootMsg.GetWeaponId() == GetId()) {
			SGetWorldMsg worldMsg;
			m_owner->ReceiveMessage(worldMsg);
			CWorld * world = worldMsg.GetWorld();
			SGetRotMsg rotMsg;
			m_owner->ReceiveMessage(rotMsg);
			SGetPosMsg posMsg;
			m_owner->ReceiveMessage(posMsg);
			SGetEnergyMsg getEnergyMsg;
			m_owner->ReceiveMessage(getEnergyMsg);
			if (rotMsg.Modified() && getEnergyMsg.Modified() &&
				getEnergyMsg.GetEnergy() - GetEnergyConsumed() > 0) {
				world->AddEntity(world->GetEntitiesFactory().SpawnEntity(
					new SBotParams(m_owner->GetSide(), GetImg(),
						posMsg.GetX(), posMsg.GetY(), m_botLifeTime, GetDamage(),
						m_speed)));
				SUpdateEnergyMsg updateEnergyMsg(-GetEnergyConsumed());
				m_owner->ReceiveMessage(updateEnergyMsg);
				m_lastShot = 0;
				AudioBuffer * buffer = new AudioBuffer("data/sounds/fusion_blaster_shoot.wav");
				AudioSource * shootAudio = new AudioSource(buffer);
				shootAudio->Play();
			}
		}
	}
}
Ejemplo n.º 2
0
FString UAoEHeal::GetTooltipText()
{
	FString lnBreak = " \n";
	FString healString = FString::SanitizeFloat(GetWeaponHealthChange() * healAmount);
	return "AoE Heal" + lnBreak + "Heals all allies in a " + FString::FromInt(700) + " radius, for " + healString + " health." + lnBreak + "Cooldown: " + FString::SanitizeFloat(GetCooldown());
}
Ejemplo n.º 3
0
bool UDefenceBoost::Activate(class AMech_RPGCharacter* target, FVector targetLocation) {
	SetOnCooldown(owner->GetWorld());
	owner->GetWorld()->GetTimerManager().SetTimer(TimerHandle_DefenceBoostEnded, this, &UDefenceBoost::ResetDefenceBoost, GetCooldown() * 0.5);
	owner->SetDefenceModifier(owner->GetDefenceModifier() + DefenceModifier);
	return true;
}
Ejemplo n.º 4
0
void UAbility::SetOnCooldown(UWorld* const World) {
	onCooldown = true;
	currentTime = GetCooldown() - 0.1;
	World->GetTimerManager().SetTimer(TimerHandle_AbilityOffCooldown, this, &UAbility::ResetOnCooldown, 0.1F);
}
Ejemplo n.º 5
0
FString UImmobilise::GetTooltipText()
{
	return "Immobilise" + UMiscLibrary::lnBreak + "Prevents target from using moving for " + FString::SanitizeFloat(duration) + " seconds" + UMiscLibrary::lnBreak + "Cooldown: " + FString::SanitizeFloat(GetCooldown());
}
Ejemplo n.º 6
0
FString UCritBoost::GetTooltipText()
{
	FString lnBreak = " \n";
	FString critString = FString::SanitizeFloat(critMultiplier < 2 ? critMultiplier * 100 : critMultiplier);
	return "Critical Boost" + lnBreak + "Increases weapons crit chance by " + critString + "%" + lnBreak + "Cooldown: " + FString::SanitizeFloat(GetCooldown());
}