Skip to content
Snippets Groups Projects
unarmed-training.lua 6.08 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,
}

DarkGod's avatar
DarkGod committed
-- This is by far the most powerful weapon tree in the game, loosely because you lose 2 weapon slots to make use of it and weapon stats are huge
-- Regardless, it gives much less damage than most weapon trees and is slightly more frontloaded
dg's avatar
dg committed
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",
DarkGod's avatar
DarkGod committed
	--getDamage = function(self, t) return self:getTalentLevel(t) * 10 end,
	getDamage = function(self, t) return self:combatTalentScale(t, 10, 30, 0.25) end,
	getPercentInc = function(self, t) return math.sqrt(self:getTalentLevel(t) / 5) / 4 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,
}

DarkGod's avatar
DarkGod committed
-- Not thoroughly tested yet
dg's avatar
dg committed
newTalent{
DarkGod's avatar
DarkGod committed
	name = "Unified Body",
dg's avatar
dg committed
	type = {"technique/unarmed-training", 2},
dg's avatar
dg committed
	require = techs_cun_req2,
DarkGod's avatar
DarkGod committed
	mode = "passive",
DarkGod's avatar
DarkGod committed
	points = 5,
	tactical = { BUFF = 2 },
	getStr = function(self, t) return math.ceil(self:combatTalentScale(t, 1.5, 7.5, 0.75) + self:combatTalentStatDamage(t, "cun", 2, 10)) end,
DarkGod's avatar
DarkGod committed
	getCon = function(self, t) return math.ceil(self:combatTalentScale(t, 1.5, 7.5, 0.75) + self:combatTalentStatDamage(t, "dex", 5, 25)) end,
DarkGod's avatar
DarkGod committed

	passives = function(self, t, tmptable)
			self:talentTemporaryValue(tmptable, "inc_stats", {[self.STAT_CON] = t.getCon(self, t)})
			self:talentTemporaryValue(tmptable, "inc_stats", {[self.STAT_STR] = t.getStr(self, t)})	
dg's avatar
dg committed
	end,
DarkGod's avatar
DarkGod committed
	callbackOnStatChange = function(self, t, stat, v)
		if self.turn_procs.unified_body then return end
		if stat == self.STAT_DEX or stat == self.STAT_CUN then
			self.turn_procs.unified_body = true
			self:updateTalentPassives(t)
		end
DarkGod's avatar
DarkGod committed
	end,
	info = function(self, t)
		return ([[Your mastery of unarmed combat unifies your body.  Increases your Strength by %d based on Cunning and your Constitution by %d based on Dexterity.]]):format(t.getStr(self, t), t.getCon(self, t))
	end
dg's avatar
dg committed
}

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,
DarkGod's avatar
DarkGod committed
	getPower = function(self, t) return self:combatTalentScale(t, 0.3, 2, 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{
DarkGod's avatar
DarkGod committed
	name = "Reflex Defense",
dg's avatar
dg committed
	type = {"technique/unarmed-training", 4},
DarkGod's avatar
DarkGod committed
	require = techs_cun_req4, -- bit icky since this is clearly dex, but whatever, cun turns defense special *handwave*
dg's avatar
dg committed
	points = 5,
DarkGod's avatar
DarkGod committed
	mode = "sustained",
	cooldown = 10,
DarkGod's avatar
DarkGod committed
	no_energy = true,
DarkGod's avatar
DarkGod committed
	tactical = { BUFF = 2 },
	getDefensePct = function(self, t)
DarkGod's avatar
DarkGod committed
		return self:combatTalentScale(t, 0.15, 0.8) -- God scaling this is weird
DarkGod's avatar
DarkGod committed
	end,
	getDamageReduction = function(self, t) 
DarkGod's avatar
DarkGod committed
		return math.min(0.8, t.getDefensePct(self, t) * self:combatDefense() / 100)
DarkGod's avatar
DarkGod committed
	end,
	getDamagePct = function(self, t)
		return 0.2
	end,
	activate = function(self, t)
		
		return {}
	end,
	deactivate = function(self, t, p)
		return true
	end,
	callbackOnHit = function(self, t, cb)
		if ( cb.value > (t.getDamagePct(self, t) * self.max_life) ) then
			local damageReduction = cb.value * t.getDamageReduction(self, t)
			cb.value = cb.value - damageReduction
DarkGod's avatar
DarkGod committed
			game.logPlayer(self, "#GREEN#You twist your body in complex ways mitigating the blow by #ORCHID#" .. math.ceil(damageReduction) .. "#LAST#.")
DarkGod's avatar
DarkGod committed
		end
		return cb.value
	end, 
dg's avatar
dg committed
	info = function(self, t)
DarkGod's avatar
DarkGod committed
		return ([[Your understanding of physiology allows you to apply your reflexes in new ways.  Whenever you would receive damage greater than %d%% of your maximum life you reduce that damage by %d%% based on your defense.]]):
DarkGod's avatar
DarkGod committed
		format(t.getDamagePct(self, t)*100, t.getDamageReduction(self, t)*100 )
dg's avatar
dg committed
	end,