Skip to content
Snippets Groups Projects
Commit 414b94f0 authored by dg's avatar dg
Browse files

many fixes

Willful Combat talent


git-svn-id: http://svn.net-core.org/repos/t-engine4@417 51575b47-30f0-44d4-a5cc-537603b46e54
parent ac30d2f4
No related branches found
No related tags found
No related merge requests found
Showing with 127 additions and 23 deletions
......@@ -130,7 +130,7 @@ end
function _M:loadReal(load)
if self.loaded[load] then return self.loaded[load] end
local f = fs.open(self.load_dir..load, "r")
print("loading", load)
-- print("loading", load)
local lines = {}
while true do
local l = f:read()
......
......@@ -173,7 +173,7 @@ local function deserialize(string, src)
if err then print("error deserializing", string, err) end
setfenv(f, {
setLoaded = function(name, t)
print("[setLoaded]", name, t)
-- print("[setLoaded]", name, t)
engine.Savefile.current_save.loaded[name] = t
end,
loadstring = loadstring,
......
......@@ -16,6 +16,7 @@ end
function _M:playMusic(name)
name = name or self.current_music
if not name then return end
local m = self.loaded_musics[name]
if not m then
self.loaded_musics[name] = core.sound.newMusic("/data/music/"..name)
......
......@@ -108,6 +108,8 @@ function _M:act()
t.do_storm(self, t)
end
if self:attr("stunned") then self.energy.value = 0 end
-- Suffocate ?
local air_level = game.level.map:checkEntity(self.x, self.y, Map.TERRAIN, "air_level")
if air_level then self:suffocate(-air_level, self) end
......
......@@ -382,7 +382,7 @@ function _M:setupCommands()
self.key:addCommands{
[{"_d","ctrl"}] = function()
if config.settings.tome.cheat then self:changeLevel(5, "tower-amon-sul") end
if config.settings.tome.cheat then self:changeLevel(7, "sandworm-lair") end
end,
}
self.key:addBinds
......
......@@ -14,6 +14,8 @@ module(..., package.seeall, class.inherit(
))
function _M:init(t, no_default)
t.encumber = t.encumber or 0
engine.Object.init(self, t, no_default)
engine.interface.ObjectActivable.init(self, t)
engine.interface.ObjectIdentify.init(self, t)
......
......@@ -152,7 +152,7 @@ function _M:archeryShoot(damtype, mult, on_hit, tg, params)
dam = rng.range(dam, dam * damrange)
print("[ATTACK] after range", dam)
local crit
dam, crit = self:physicalCrit(dam, ammo)
dam, crit = self:physicalCrit(dam, ammo, target)
print("[ATTACK] after crit", dam)
dam = dam * mult
print("[ATTACK] after mult", dam)
......@@ -233,7 +233,7 @@ function _M:attackTargetWith(target, weapon, damtype, mult)
dam = rng.range(dam, dam * damrange)
print("[ATTACK] after range", dam)
local crit
dam, crit = self:physicalCrit(dam, weapon)
dam, crit = self:physicalCrit(dam, weapon, target)
print("[ATTACK] after crit", dam)
dam = dam * mult
print("[ATTACK] after mult", dam)
......@@ -381,15 +381,16 @@ function _M:combatSpellSpeed()
end
--- Computes physical crit for a damage
function _M:physicalCrit(dam, weapon)
function _M:physicalCrit(dam, weapon, target)
if self:isTalentActive(self.T_STEALTH) and self:knowTalent(self.T_SHADOWSTRIKE) then
return dam * (2 + self:getTalentLevel(self.T_SHADOWSTRIKE) / 5), true
end
local chance = self:combatCrit(weapon)
local crit = false
if self:knowTalent(self.T_BACKSTAB) then chance = chance + self:getTalentLevel(self.T_BACKSTAB) * 10 end
if self:knowTalent(self.T_BACKSTAB) and target:attr("stunned") then chance = chance + self:getTalentLevel(self.T_BACKSTAB) * 10 end
print("[PHYS CRIT %]", chance)
if rng.percent(chance) then
dam = dam * 2
crit = true
......@@ -405,8 +406,9 @@ function _M:spellCrit(dam)
local chance = self:combatSpellCrit()
local crit = false
if self:knowTalent(self.T_BACKSTAB) then chance = chance + self:getTalentLevel(self.T_BACKSTAB) * 10 end
-- if self:knowTalent(self.T_BACKSTAB) then chance = chance + self:getTalentLevel(self.T_BACKSTAB) * 10 end
print("[SPELL CRIT %]", chance)
if rng.percent(chance) then
dam = dam * 2
crit = true
......
......@@ -76,3 +76,39 @@ newTalent{
end,
}
newTalent{
name = "Cripple",
type = {"cunning/dirty", 4},
points = 5,
cooldown = 25,
stamina = 30,
require = cuns_req4,
action = function(self, t)
local tg = {type="hit", range=self:getTalentRange(t)}
local x, y, target = self:getTarget(tg)
if not x or not y or not target then return nil end
if math.floor(core.fov.distance(self.x, self.y, x, y)) > 1 then return nil end
local hitted = self:attackTarget(target, nil, 0.9 + self:getTalentLevel(t) / 9, true)
if hitted then
if target:checkHit(self:combatAttackDex(), target:combatPhysicalResist(), 0, 95, 5 - self:getTalentLevel(t) / 2) then
local tw = target:getInven("MAINHAND")
if tw then
tw = tw[1] and tw[1].combat
end
tw = tw or target.combat
local atk = target:combatAttack(tw) * (10 + self:getTalentLevel(t) * 3) / 100
local dam = target:combatDamage(tw) * (10 + self:getTalentLevel(t) * 4) / 100
target:setEffect(target.EFF_CRIPPLE, 3 + math.ceil(self:getTalentLevel(t)), {atk=atk, dam=dam})
else
game.logSeen(target, "%s is not crippled!", target.name:capitalize())
end
end
return true
end,
info = function(self, t)
return ([[You hit your target doing %d%% damage. If your attack hits the target is cripple for %d turns, losing %d%% attack and %d%% damage.]]):
format(100 * (0.9 + self:getTalentLevel(t) / 9), 3 + math.ceil(self:getTalentLevel(t)), 10 + self:getTalentLevel(t) * 3, 10 + self:getTalentLevel(t) * 4)
end,
}
......@@ -37,4 +37,23 @@ newTalent{
The APR will increase with Cunning.]]):
format(100 * (0.8 + self:getTalentLevel(t) / 10), 4 + (self:getTalentLevel(t) * self:getCun()) / 20, 5 + math.ceil(self:getTalentLevel(t)))
end,
}
\ No newline at end of file
}
newTalent{
name = "Willful Combat",
type = {"cunning/lethality", 3},
points = 5,
cooldown = 60,
stamina = 25,
require = cuns_req3,
action = function(self, t)
local dur = 3 + math.ceil(self:getTalentLevel(t) * 1.5)
local power = self:getWil(70)
self:setEffect(self.EFF_WILLFUL_COMBAT, dur, {power=power})
return true
end,
info = function(self, t)
return ([[For a %d turns you put all your will into your blows, additing %d (based on Willpower) damage to each strikes.]]):
format(3 + math.ceil(self:getTalentLevel(t) * 1.5), self:getWil(70))
end,
}
......@@ -40,3 +40,15 @@ newTalent{
format(self:getTalentLevel(t) * self:getCun(25))
end,
}
newTalent{
name = "Long Strides",
type = {"cunning/survival", 4},
require = cuns_req4,
mode = "passive",
points = 5,
info = function(self, t)
return ([[Reduces the movement penality when moving over dangerous terrain.]]):
format()
end,
}
......@@ -128,7 +128,7 @@ newTalent{
end,
}
-------------------------------- Urtility -----------------------------------
-------------------------------- Utility -----------------------------------
newTalent{
name = "Ammo Creation",
......
......@@ -89,14 +89,10 @@ newEffect{
self.color_b = 155
game.level.map:updateMap(self.x, self.y)
-- Frozen, cannot act
self.energy.value = 0
end,
on_timeout = function(self, eff)
-- Frozen, cannot act
self.energy.value = 0
eff.tmpid = self:addTemporaryValue("stunned", 1)
end,
deactivate = function(self, eff)
self:removeTemporaryValue("stunned", eff.tmpid)
self.color_r = eff.old_r
self.color_g = eff.old_g
self.color_b = eff.old_b
......@@ -112,12 +108,14 @@ newEffect{
on_gain = function(self, err) return "#Target# is stunned by the burning flame!", "+Burning Shock" end,
on_lose = function(self, err) return "#Target# is not stunned anymore.", "-Burning Shock" end,
activate = function(self, eff)
self.energy.value = 0
eff.tmpid = self:addTemporaryValue("stunned", 1)
end,
on_timeout = function(self, eff)
self.energy.value = 0
DamageType:get(DamageType.FIRE).projector(eff.src, self.x, self.y, DamageType.FIRE, eff.power)
end,
deactivate = function(self, eff)
self:removeTemporaryValue("stunned", eff.tmpid)
end,
}
newEffect{
......@@ -129,12 +127,10 @@ newEffect{
on_gain = function(self, err) return "#Target# is stunned!", "+Stunned" end,
on_lose = function(self, err) return "#Target# is not stunned anymore.", "-Stunned" end,
activate = function(self, eff)
-- Frozen, cannot act
self.energy.value = 0
eff.tmpid = self:addTemporaryValue("stunned", 1)
end,
on_timeout = function(self, eff)
-- Frozen, cannot act
self.energy.value = 0
deactivate = function(self, eff)
self:removeTemporaryValue("stunned", eff.tmpid)
end,
}
......@@ -550,3 +546,37 @@ newEffect{
self:removeTemporaryValue("inc_stats", eff.tmpid)
end,
}
newEffect{
name = "CRIPPLE",
desc = "Cripple",
type = "physical",
status = "detrimental",
parameters = { atk=10, dam=10 },
on_gain = function(self, err) return "#Target# is crippled." end,
on_lose = function(self, err) return "#Target# is not cripple anymore." end,
activate = function(self, eff)
eff.atkid = self:addTemporaryValue("combat_atk", -eff.atk)
eff.damid = self:addTemporaryValue("combat_dam", -eff.dam)
end,
deactivate = function(self, eff)
self:removeTemporaryValue("combat_atk", eff.atkid)
self:removeTemporaryValue("combat_dam", eff.damid)
end,
}
newEffect{
name = "WILLFUL_COMBAT",
desc = "Willful Combat",
type = "physical",
status = "beneficial",
parameters = { power=10 },
on_gain = function(self, err) return "#Target# lashes out with pure willpower." end,
on_lose = function(self, err) return "#Target# willpower rush ends.." end,
activate = function(self, eff)
eff.tmpid = self:addTemporaryValue("combat_dam", eff.power)
end,
deactivate = function(self, eff)
self:removeTemporaryValue("combat_dam", eff.tmpid)
end,
}
No preview for this file type
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment