package com.pesets.game.skills;

import com.pesets.game.Enemy;
import com.pesets.game.Player;
import com.pesets.resources.ResourceManager;

public class SkillHeal extends Skill {

	@Override
	public void cast(Player player, Enemy target) {
		player.setHP(Math.min(player.getMaxHP(), player.getHP() + getAmount(player)));
		ResourceManager.getInstance().playSound("twinkle.mp3");
	}
	
	private float getAmount(Player player) {
		return player.getIntelligence() * 0.4f * getLevel();
	}

	@Override
	public String getName() {
		return "Heal";
	}

	@Override
	public ActEvent getEvent() {
		return ActEvent.Cast;
	}

	@Override
	public int getIcon() {
		return 14;
	}

	@Override
	public float getMaxColdown() {
		return 5f;
	}

	@Override
	public boolean canBeCasted(Player player, Enemy target) {
		if (player.getMaxHP() - player.getHP() < getAmount(player))
			return false;
		return super.canBeCasted(player, target);
	}
	
	@Override
	public String getDescription() {
		return "Heals player for (intelligence * 0.4 * level) hp\nColdown: 5 sec";
	}

	
}
