#include "Sounds.h"
#include "Client.h"

#include "Utils/AudioUtils.h"
#include "Utils/TimeUtils.h"

auto Sounds::onAttack(Actor& actor) -> void {
	long long now = Utils::Time::getMs();
	static long long start = now;
	if (now - start >= 400.f) {
		static float pitch = 0.4f;
		pitch += 0.2f;
		if (pitch > 1.f)
			pitch = 0.4f;

		switch (damage) {
		case 1:
			Utils::Audio::playmc(_("random.pop2"), volume, pitch);
			break;
		case 2:
			Utils::Audio::playmc(_("dig.stone"), volume, pitch);
			break;
		}
		start = now;
	}
}
