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

archery - bows

git-svn-id: http://svn.net-core.org/repos/t-engine4@359 51575b47-30f0-44d4-a5cc-537603b46e54
parent 15f1a041
No related branches found
No related tags found
No related merge requests found
......@@ -93,25 +93,36 @@ function _M:attackTarget(target, damtype, mult, noenergy)
return hit
end
function _M:archeryShoot(damtype, mult)
function _M:archeryShoot(damtype, mult, on_hit, tg, params)
local weapon, ammo = self:hasArcheryWeapon()
if not weapon then
game.logPlayer(self, "You must wield a bow or a sling (%s)!", ammo)
return nil
end
params = params or {}
print("[SHOOT WITH]", weapon.name, ammo.name)
weapon = weapon.combat
ammo = ammo.combat
local ret = {}
local tg = {type="bolt", range=weapon.range or 10, min_range=5 - self:getTalentLevelRaw(self.T_POINT_BLANK_SHOT)}
local x, y, target = self:getTarget(tg)
if not x or not y or not target then return nil end
local tg = tg or {type="bolt"}
if not tg.range then tg.range=weapon.range or 10 end
local x, y = self:getTarget(tg)
if not x or not y then return nil end
self:project(tg, x, y, function(tx, ty)
local ammo = self:removeObject(self:getInven("QUIVER"), 1)
if not ammo then return end
local ammo = ammo
if not params.one_shot then
ammo = self:removeObject(self:getInven("QUIVER"), 1)
if not ammo then return end
end
if params.limit_shots then
if params.limit_shots <= 0 then return end
params.limit_shots = params.limit_shots - 1
end
local target = game.level.map(tx, ty, game.level.map.ACTOR)
if not target then return end
ammo = ammo.combat
damtype = damtype or ammo.damtype or DamageType.PHYSICAL
......@@ -139,6 +150,8 @@ function _M:archeryShoot(damtype, mult)
DamageType:get(damtype).projector(self, target.x, target.y, damtype, math.max(0, dam))
game.level.map:particleEmitter(target.x, target.y, 1, "archery")
hitted = true
if on_hit then on_hit(target, target.x, target.y) end
else
game.logSeen(target, "%s misses %s.", self.name:capitalize(), target.name)
end
......@@ -150,6 +163,9 @@ function _M:archeryShoot(damtype, mult)
print("[SHOOT] speed", ret.speed, "=>", game.energy_to_act * ret.speed)
self:useEnergy(game.energy_to_act * ret.speed)
-- If we used only one arrow, use it
if params.one_shot then self:removeObject(self:getInven("QUIVER"), 1) end
return ret.hitted
end
......
......@@ -112,6 +112,7 @@ newTalent{
newTalent{
name = "Critical Shot",
type = {"technique/archery-training", 4},
no_energy = true,
points = 5,
cooldown = 20,
stamina = 35,
......@@ -126,3 +127,90 @@ newTalent{
return ([[You concentrate on your aim to produce a guaranted critical hit (with a base damage of %d%%).]]):format((1.2 + self:getTalentLevel(t) / 4) * 100)
end,
}
-------------------------------- Urtility -----------------------------------
newTalent{
name = "Ammo Creation",
type = {"technique/archery-utility", 1},
no_energy = true,
points = 5,
cooldown = 500,
stamina = 30,
require = techs_dex_req1,
action = function(self, t)
return true
end,
info = function(self, t)
return ([[Forage in your immediate environment to try to make ammo for your current weapon.]])
end,
}
newTalent{
name = "Crippling Shot",
type = {"technique/archery-utility", 2},
no_energy = true,
points = 5,
cooldown = 20,
stamina = 15,
require = techs_dex_req2,
action = function(self, t)
self:archeryShoot(nil, 1 + self:getTalentLevel(t) / 6, function(target, x, y)
if target:checkHit(self:combatAttackDex(), target:combatPhysicalResist(), 0, 95, 10) then
target:setEffect(target.EFF_SLOW, 7, {power=util.bound((self:combatAttack() * 0.15 * self:getTalentLevel(t)) / 100, 0.1, 0.4)})
else
game.logSeen(target, "%s resists!", target.name:capitalize())
end
end)
return true
end,
info = function(self, t)
return ([[You fire a crippling shot, doing %d%% damage and reducing your target's speed by %0.2f for 7 turns.]]):format((1 + self:getTalentLevel(t) / 6) * 100, util.bound((5 + 5 * self:getTalentLevel(t)) / 100, 0.1, 0.4))
end,
}
newTalent{
name = "Pinning Shot",
type = {"technique/archery-utility", 3},
no_energy = true,
points = 5,
cooldown = 20,
stamina = 15,
require = techs_dex_req3,
action = function(self, t)
self:archeryShoot(nil, 1 + self:getTalentLevel(t) / 6, function(target, x, y)
if target:checkHit(self:combatAttackDex(), target:combatPhysicalResist(), 0, 95, 10) then
target:setEffect(target.EFF_PINNED, 2 + self:getTalentLevelRaw(t), {})
else
game.logSeen(target, "%s resists!", target.name:capitalize())
end
end)
return true
end,
info = function(self, t)
return ([[You fire a pinning shot, doing %d%% damage and pinning your target to the ground for %d turns.]]):format((1 + self:getTalentLevel(t) / 6) * 100, 2 + self:getTalentLevelRaw(t))
end,
}
newTalent{
name = "Scatter Shot",
type = {"technique/archery-utility", 4},
no_energy = true,
points = 5,
cooldown = 20,
stamina = 15,
require = techs_dex_req4,
action = function(self, t)
self:archeryShoot(nil, 1 + self:getTalentLevel(t) / 6, function(target, x, y)
if target:checkHit(self:combatAttackDex(), target:combatPhysicalResist(), 0, 95, 10) then
target:setEffect(target.EFF_STUNNED, 2 + self:getTalentLevelRaw(t), {})
else
game.logSeen(target, "%s resists!", target.name:capitalize())
end
end, {type="ball", radius=1 + self:getTalentLevel(t) / 3})
return true
end,
info = function(self, t)
return ([[You fire multiple shots at the area, doing %d%% damage and stunning your targets for %d turns.]]):format((0.5 + self:getTalentLevel(t) / 6) * 100, 2 + self:getTalentLevelRaw(t))
end,
}
......@@ -8,3 +8,56 @@ newTalent{
return [[Increases damage with bows.]]
end,
}
newTalent{
name = "Piercing Arrow",
type = {"technique/archery-bow", 2},
no_energy = true,
points = 5,
cooldown = 8,
stamina = 15,
require = techs_dex_req2,
action = function(self, t)
self.combat_apr = self.combat_apr + 1000
self:archeryShoot(nil, 1.2 + self:getTalentLevel(t) / 7, nil, {type="beam"}, {one_shot=true})
self.combat_apr = self.combat_apr - 1000
return true
end,
info = function(self, t)
return ([[You fire an arrow that cuts right throught anything, piercing multiple tagerts if possible with near infinite armor penetration, doing %d%% damage.]]):format(100 * (1.2 + self:getTalentLevel(t) / 7))
end,
}
newTalent{
name = "Dual Arrows",
type = {"technique/archery-bow", 3},
no_energy = true,
points = 5,
cooldown = 8,
stamina = 15,
require = techs_dex_req3,
action = function(self, t)
self:archeryShoot(nil, 1.2 + self:getTalentLevel(t) / 5, nil, {type="ball", radius=1}, {limit_shots=2})
return true
end,
info = function(self, t)
return ([[You fire two arrows at your target, hitting it and a nearby foes if possible, doing %d%% damage.]]):format(100 * (1.2 + self:getTalentLevel(t) / 5))
end,
}
newTalent{
name = "Volley of Arrows",
type = {"technique/archery-bow", 4},
no_energy = true,
points = 5,
cooldown = 20,
stamina = 35,
require = techs_dex_req4,
action = function(self, t)
self:archeryShoot(nil, 0.7 + self:getTalentLevel(t) / 5, nil, {type="ball", radius=2 + self:getTalentLevel(t)/3, firendlyfire=false})
return true
end,
info = function(self, t)
return ([[You fire multiple arrows at the area, doing %d%% damage.]]):format(100 * (0.7 + self:getTalentLevel(t) / 5))
end,
}
......@@ -11,7 +11,7 @@ newTalent{
sustain_stamina = 30,
activate = function(self, t)
return {
speed = self:addTemporaryValue("combat_physspeed", self:combatSpeed(weapon.combat) * (self:getTalentLevel(t) * 0.08)),
speed = self:addTemporaryValue("combat_physspeed", self:combatSpeed() * (self:getTalentLevel(t) * 0.08)),
atk = self:addTemporaryValue("combat_atk", 4 + (self:getTalentLevel(t) * self:getDex()) / 15),
crit = self:addTemporaryValue("combat_physcrit", 4 + (self:getTalentLevel(t) * self:getDex()) / 25),
}
......@@ -24,7 +24,7 @@ newTalent{
end,
info = function(self, t)
return ([[You focus your strikes, reducing your attack speed by %d%% and increasing your attack by %d and critical chance by %d%%.]]):
format(self:combatSpeed(weapon.combat) * (self:getTalentLevel(t) * 8), 4 + (self:getTalentLevel(t) * self:getDex()) / 15, 4 + (self:getTalentLevel(t) * self:getDex()) / 25)
format(self:combatSpeed() * (self:getTalentLevel(t) * 8), 4 + (self:getTalentLevel(t) * self:getDex()) / 15, 4 + (self:getTalentLevel(t) * self:getDex()) / 25)
end,
}
......
......@@ -9,7 +9,7 @@ newTalentType{ type="technique/archery-base", name = "archery - base", descripti
newTalentType{ type="technique/archery-bow", name = "archery - bows", description = "Specialized bow techniques." }
newTalentType{ type="technique/archery-sling", name = "archery - slings", description = "Specialized sling techniques." }
newTalentType{ type="technique/archery-training", name = "archery - common", description = "Generic archery techniques." }
newTalentType{ type="technique/archery-cripple", name = "archery - cripple", description = "Specialized archery techniques to maim your targets." }
newTalentType{ type="technique/archery-utility", name = "archery - utility", description = "Specialized archery techniques to maim your targets." }
newTalentType{ type="technique/combat-techniques-active", name = "combat-techniques", description = "Generic combat oriented techniques." }
newTalentType{ type="technique/combat-techniques-passive", name = "combat-techniques", description = "Generic combat oriented techniques." }
newTalentType{ type="technique/combat-training", name = "combat-training", description = "Teaches to use various armors and improves health." }
......
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