Skip to content
Snippets Groups Projects
unarmed-training.lua 4.7 KiB
Newer Older
dg's avatar
dg committed
-- ToME - Tales of Maj'Eyal
-- Copyright (C) 2009 - 2014 Nicolas Casalini
dg's avatar
dg committed
--
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program.  If not, see <http://www.gnu.org/licenses/>.
--
-- Nicolas Casalini "DarkGod"
-- darkgod@te4.org

-- Empty Hand adds extra scaling to gauntlet and glove attacks based on character level.

newTalent{
	name = "Empty Hand",
	type = {"technique/unarmed-other", 1},
	innate = true,
	hide = true,
	mode = "passive",
	points = 1,
dg's avatar
dg committed
	no_unlearn_last = true,
DarkGod's avatar
DarkGod committed
		local fct = function()
			self.before_empty_hands_combat = self.combat
			self.combat = table.clone(self.combat, true)
			self.combat.physspeed = math.min(0.6, self.combat.physspeed or 1000)
			if not self.combat.sound then self.combat.sound = {"actions/punch%d", 1, 4} end
			if not self.combat.sound_miss then self.combat.sound_miss = "actions/melee_miss" end
		end
		if type(self.combat.dam) == "table" then
			game:onTickEnd(fct)
		else
			fct()
		end
	end,
	on_unlearn = function(self, t)
		self.combat = self.before_empty_hands_combat
	end,
dg's avatar
dg committed
	getDamage = function(self, t) return self.level * 0.5 end,
	info = function(self, t)
		local damage = t.getDamage(self, t)
dg's avatar
dg committed
		return ([[Grants %d Physical Power when fightning unarmed (or with gloves or gauntlets).
dg's avatar
dg committed
		This talent's effects will scale with your level.]]):
		format(damage)
	end,
}

-- generic unarmed training
newTalent{
	name = "Unarmed Mastery",
	type = {"technique/unarmed-training", 1},
	points = 5,
	require = { stat = { cun=function(level) return 12 + level * 6 end }, },
dg's avatar
dg committed
	mode = "passive",
	getDamage = function(self, t) return self:getTalentLevel(t) * 10 end,
dg's avatar
dg committed
	getPercentInc = function(self, t) return math.sqrt(self:getTalentLevel(t) / 5) / 2 end,
dg's avatar
dg committed
	info = function(self, t)
		local damage = t.getDamage(self, t)
dg's avatar
dg committed
		local inc = t.getPercentInc(self, t)
dg's avatar
dg committed
		return ([[Increases Physical Power by %d, and increases all unarmed damage by %d%% (including grapples and kicks).
		Note that brawlers naturally gain 0.5 Physical Power per character level while unarmed (current brawler physical power bonus: %0.1f) and attack 40%% faster while unarmed.]]):
dg's avatar
dg committed
	end,
}

newTalent{
	name = "Steady Mind",
	type = {"technique/unarmed-training", 2},
	mode = "passive",
	points = 5,
dg's avatar
dg committed
	require = techs_cun_req2,
	getDefense = function(self, t) return self:combatTalentStatDamage(t, "dex", 5, 35) end,
dg's avatar
dg committed
	getMental = function(self, t) return self:combatTalentStatDamage(t, "cun", 5, 35) end,
dg's avatar
dg committed
	info = function(self, t)
		local defense = t.getDefense(self, t)
		local saves = t.getMental(self, t)
dg's avatar
dg committed
		return ([[Superior cunning and training allows you to outthink and outwit your opponents' physical and mental assaults.  Increases Defense by %d and Mental Save by %d.
dg's avatar
dg committed
		The Defense bonus will scale with your Dexterity, and the save bonus with your Cunning.]]):
dg's avatar
dg committed
		format(defense, saves)
	end,
}

newTalent{
	name = "Heightened Reflexes",
	type = {"technique/unarmed-training", 3},
dg's avatar
dg committed
	require = techs_cun_req3,
dg's avatar
dg committed
	mode = "passive",
	points = 5,
	getPower = function(self, t) return self:combatTalentScale(t, 0.6, 2.5, 0.75) end,
dg's avatar
dg committed
	do_reflexes = function(self, t)
dg's avatar
dg committed
		self:setEffect(self.EFF_REFLEXIVE_DODGING, 1, {power=t.getPower(self, t)})
dg's avatar
dg committed
	end,
	info = function(self, t)
dg's avatar
dg committed
		local power = t.getPower(self, t)
dg's avatar
dg committed
		return ([[When you're targeted by a projectile, your global speed is increased by %d%% for 1 turn.  Taking any action other then movement will break the effect.]]):
dg's avatar
dg committed
		format(power * 100)
dg's avatar
dg committed
	end,
}

newTalent{
	name = "Combo String",
	type = {"technique/unarmed-training", 4},
dg's avatar
dg committed
	require = techs_cun_req4,
dg's avatar
dg committed
	mode = "passive",
	points = 5,
	getDuration = function(self, t) return math.ceil(self:combatTalentScale(t, 0.3, 2.3)) end,
	getChance = function(self, t) return self:combatLimit(self:getTalentLevel(t) * (5 + self:getCun(5, true)), 100, 0, 0, 50, 50) end, -- Limit < 100%
dg's avatar
dg committed
	info = function(self, t)
		local duration = t.getDuration(self, t)
		local chance = t.getChance(self, t)
dg's avatar
dg committed
		return ([[When gaining a combo point, you have a %d%% chance to gain an extra combo point.  Additionally, your combo points will last %d turns longer before expiring.
		The chance of building a second combo point will improve with your Cunning.]]):
dg's avatar
dg committed
		format(chance, duration)
	end,