Skip to content
Snippets Groups Projects
Commit 3e254c03 authored by dg's avatar dg
Browse files

2h

git-svn-id: http://svn.net-core.org/repos/t-engine4@173 51575b47-30f0-44d4-a5cc-537603b46e54
parent 3814e7e6
No related branches found
No related tags found
No related merge requests found
......@@ -121,6 +121,7 @@ function _M:useTalent(id)
else
error("Activating non activable or sustainable talent: "..id.." :: "..ab.name.." :: "..ab.mode)
end
self.changed = true
return true
end
......
......@@ -295,3 +295,11 @@ function _M:canSee(actor)
end
return true, 100
end
--- Can the target be applied some effects
-- @param what a string describing what is being tried
function _M:canBe(what)
if what == "stun" and self:attr("stun_immune") then return false end
if what == "knockback" and self:attr("knockback_immune") then return false end
return true
end
......@@ -41,6 +41,14 @@ function _M:display()
s:alpha(128)
s:drawString(self.font, txt, 2, 2, 255, 0, 0)
elseif a:isTalentActive(t.id) then
local txt = ("%s) %s"):format(string.char(acode + i - 1), t.name)
local w, h = self.font:size(txt)
s = core.display.newSurface(w + 4, h + 4)
s:erase(40, 40, 40)
s:alpha(255)
s:drawString(self.font, txt, 2, 2, 255, 255, 0)
else
local txt = ("%s) %s"):format(string.char(acode + i - 1), t.name)
local w, h = self.font:size(txt)
......
......@@ -159,7 +159,7 @@ function _M:combatDamage(weapon)
add = add + (self:getStat(stat) - 10) * mod
end
end
return self.combat_armor + (weapon.dam or 1) + add
return self.combat_dam + (weapon.dam or 1) + add
end
--- Gets spellpower
......
......@@ -100,7 +100,7 @@ newDamageType{
DamageType:get(DamageType.COLD).projector(src, x, y, DamageType.COLD, dam)
local target = game.level.map(x, y, Map.ACTOR)
if target then
if target:checkHit(src:combatSpellpower(), target:combatPhysicalResist(), 0, 95, 15) then
if target:checkHit(src:combatSpellpower(), target:combatPhysicalResist(), 0, 95, 15) and target:canBe("knockback") then
target:knockBack(src.x, src.y, 1)
game.logSeen(target, "%s is knocked back!", target.name:capitalize())
else
......@@ -117,7 +117,7 @@ newDamageType{
DamageType:get(DamageType.PHYSICAL).projector(src, x, y, DamageType.PHYSICAL, dam)
local target = game.level.map(x, y, Map.ACTOR)
if target then
if target:checkHit(src:combatSpellpower(), target:combatPhysicalResist(), 0, 95, 15) then
if target:checkHit(src:combatSpellpower(), target:combatPhysicalResist(), 0, 95, 15) and target:canBe("knockback") then
target:knockBack(src.x, src.y, 2)
game.logSeen(target, "%s is knocked back!", target.name:capitalize())
else
......
......@@ -7,6 +7,7 @@ newEntity{
encumber = 3,
rarity = 3,
desc = [[Massive two-handed swords.]],
twohanded = true,
}
newEntity{ base = "BASE_GREATSWORD",
......
newTalent{
name = "Stunning Blow",
type = {"physical/2hweapon", 1},
cooldown = 6,
stamina = 8,
require = { stat = { str=12 }, },
action = function(self, t)
local weapon = self:getInven("MAINHAND")[1]
if not weapon or not weapon.twohanded then
game.logPlayer(self, "You cannot use Stunning Blow without a two handed weapon!")
return nil
end
local t = {type="hit", range=self:getTalentRange(t)}
local x, y, target = self:getTarget(t)
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 speed, hit = self:attackTargetWith(target, weapon, nil, 1)
-- Try to stun !
if hit then
if target:checkHit(self:combatAttack(weapon), target:combatPhysicalResist(), 0, 95, 5) and target:canBe("stun") then
target:setEffect(target.EFF_STUNNED, 2 + self:getStr(4), {})
else
game.logSeen(target, "%s resists the stunning blow!", target.name:capitalize())
end
end
return true
end,
info = function(self)
return ([[Hits the target with your weapon, if the atatck hits, the target is stunned.]])
end,
}
......@@ -19,7 +19,7 @@ newTalent{
-- Try to stun !
if hit then
if target:checkHit(self:combatAttack(shield.special_combat), target:combatPhysicalResist(), 0, 95, 5) then
if target:checkHit(self:combatAttack(shield.special_combat), target:combatPhysicalResist(), 0, 95, 5) and target:canBe("stun") then
target:setEffect(target.EFF_STUNNED, 3, {})
else
game.logSeen(target, "%s resists the shield bash!", target.name:capitalize())
......@@ -61,7 +61,7 @@ newTalent{
-- Try to stun !
if hit then
if target:checkHit(self:combatAttack(shield.special_combat), target:combatPhysicalResist(), 0, 95, 5) then
if target:checkHit(self:combatAttack(shield.special_combat), target:combatPhysicalResist(), 0, 95, 5) and target:canBe("knockback") then
target:knockBack(self.x, self.y, 4)
else
game.logSeen(target, "%s resists the knockback!", target.name:capitalize())
......@@ -93,7 +93,7 @@ newTalent{
local x, y = self.x + i, self.y + j
if (self.x ~= x or self.y ~= y) and game.level.map:isBound(x, y) and game.level.map(x, y, Map.ACTOR) then
local target = game.level.map(x, y, Map.ACTOR)
if target:checkHit(self:combatAttack(shield.special_combat), target:combatPhysicalResist(), 0, 95, 5) then
if target:checkHit(self:combatAttack(shield.special_combat), target:combatPhysicalResist(), 0, 95, 5) and target:canBe("knockback") then
target:knockBack(self.x, self.y, 3)
else
game.logSeen(target, "%s resists the knockback!", target.name:capitalize())
......@@ -116,17 +116,42 @@ newTalent{
sustain_stamina = 100,
require = { stat = { str=28 }, },
activate = function(self, t)
local shield = self:getInven("OFFHAND")[1]
if not shield or not shield.special_combat then
game.logPlayer(self, "You cannot use Shield Wall without a shield!")
return nil
end
local stun, knock
if self:knowTalent(Talents.T_SHIELD_MASTERY) then
stun = self:addTemporaryValue("stun_immune", 1)
knock = self:addTemporaryValue("knockback_immune", 1)
end
return {
def = self:addTemporaryValue("combat_def", 5 + self:getDex(10)),
armor = self:addTemporaryValue("combat_armor", 5 + self:getCun(10)),
stun = stun,
knock = knock
}
end,
deactivate = function(self, t, p)
self:removeTemporaryValue("combat_def", p.def)
self:removeTemporaryValue("combat_armor", p.armor)
if p.stun then self:removeTemporaryValue("stun_immune", p.stun) end
if p.knock then self:removeTemporaryValue("knockback_immune", p.knock) end
return true
end,
info = function(self)
return ([[Enters a protective battle stance, incraesing defense and armor at the cost of attack and damage.]])
end,
}
newTalent{
name = "Shield Mastery",
type = {"physical/shield", 4},
mode = "passive",
require = { stat = { str=40 }, talent = { Talents.T_SHIELD_WALL } },
info = function(self)
return ([[Your Shield Wall now renders you immune to stuns and knockbacks.]])
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