Code: Select all
newTalent{
	name = "Smart Shoot",
	type = {"technique/archery-base", 1},
	no_energy = "fake",
	hide = "always",
	innate = true,
	points = 1,
	range = 1,
	message = false,
	no_break_stealth = true, -- stealth is broken in attackTarget
	no_reload_break = true,
	requires_target = true,
	target = {type="hit", range=1},
	tactical = { ATTACK = { PHYSICAL = 1 } },
	no_unlearn_last = true,
	ignored_by_hotkeyautotalents = true,
	action = function(self, t)
		local t = self.T_RELAXED_SHOT
		local t2 = self:getTalentFromId(t)
		if self:knowTalent(t2) and not self:isTalentCoolingDown(t2) and self.max_stamina - self.stamina > (12 + self:getTalentLevel(t) * 8) then
			self:forceUseTalent(t,{})
			return true
		end
		
		t = self.T_MULTISHOT
		t2 = self:getTalentFromId(t)
		if self:knowTalent(t2) and not self:isTalentCoolingDown(t2) and self.stamina > t2.stamina and self:hasArcheryWeapon("sling")then
			self:forceUseTalent(t,{})
			return true
		end
		t = self.T_STEADY_SHOT
		t2 = self:getTalentFromId(t)
		if self:knowTalent(t2) and not self:isTalentCoolingDown(t2) and self.stamina > t2.stamina then
			self:forceUseTalent(t,{})
			return true
		end
		t = self.T_PIERCING_ARROW
		t2 = self:getTalentFromId(t)
		if self:knowTalent(t2) and not self:isTalentCoolingDown(t2) and self.stamina > t2.stamina and self:hasArcheryWeapon("bow") then
			self:forceUseTalent(t,{})
			return true
		end
		t = self.T_DUAL_ARROWS
		t2 = self:getTalentFromId(t)
		if self:knowTalent(t2) and not self:isTalentCoolingDown(t2) and self:hasArcheryWeapon("bow") then
			self:forceUseTalent(t,{})
			return true
		end
		t = self.T_SHOOT
		t2 = self:getTalentFromId(t)
		self:forceUseTalent(t,{})
		return true
	end,
	info = function(self, t)
		return ([[Shoot good!]])
	end,
}