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

more physical talents

git-svn-id: http://svn.net-core.org/repos/t-engine4@174 51575b47-30f0-44d4-a5cc-537603b46e54
parent 3e254c03
No related branches found
No related tags found
No related merge requests found
Showing with 178 additions and 12 deletions
......@@ -3,7 +3,7 @@ require "engine.class"
module(..., package.seeall, class.make)
function _M:init(fontname, fontsize)
self.font = core.display.newFont(fontname or "/data/font/Vera.ttf", fontsize or 8)
self.font = core.display.newFont(fontname or "/data/font/Vera.ttf", fontsize or 12)
self.font_h = self.font:lineSkip()
self.flyers = {}
end
......
......@@ -9,7 +9,7 @@ function _M:init(x, y, w, h, max, fontname, fontsize, color, bgcolor)
self.bgcolor = bgcolor or {0,0,0}
self.display_x, self.display_y = x, y
self.w, self.h = w, h
self.font = core.display.newFont(fontname or "/data/font/Vera.ttf", fontsize or 10)
self.font = core.display.newFont(fontname or "/data/font/Vera.ttf", fontsize or 12)
self.font_h = self.font:lineSkip()
self.surface = core.display.newSurface(w, h)
self.log = {}
......
......@@ -2,6 +2,7 @@ require "engine.class"
local DamageType = require "engine.DamageType"
local Map = require "engine.Map"
local Target = require "engine.Target"
local Talents = require "engine.interface.ActorTalents"
--- Interface to add ToME combat system
module(..., package.seeall, class.make)
......@@ -99,7 +100,7 @@ function _M:attackTargetWith(target, weapon, damtype, mult)
-- Does the blow connect? yes .. complex :/
local atk, def = self:combatAttack(weapon), target:combatDefense()
local dam, apr, armor = self:combatDamage(weapon), self:combatAPR(weapon), target:combatArmor()
print("[ATTACK] with", weapon, " to ", target, " :: ", dam, apr, armor, "::", mult)
print("[ATTACK] with", weapon.name, " to ", target.name, " :: ", dam, apr, armor, "::", mult)
-- If hit is over 0 it connects, if it is 0 we still have 50% chance
local hitted = false
......@@ -116,6 +117,29 @@ function _M:attackTargetWith(target, weapon, damtype, mult)
return self:combatSpeed(weapon), hitted
end
local weapon_talents = {
sword = { Talents.T_SWORD_APPRENTICE, Talents.T_SWORD_MASTER, Talents.T_SWORD_GRAND_MASTER },
axe = { Talents.T_AXE_APPRENTICE, Talents.T_AXE_MASTER, Talents.T_AXE_GRAND_MASTER },
mace = { Talents.T_MACE_APPRENTICE, Talents.T_MACE_MASTER, Talents.T_MACE_GRAND_MASTER },
knife = { Talents.T_KNIFE_APPRENTICE, Talents.T_KNIFE_MASTER, Talents.T_KNIFE_GRAND_MASTER },
}
--- Checks weapon training
function _M:combatCheckTraining(weapon)
if not weapon.talented then return 0 end
local max = 0
for i, tid in ipairs(weapon_talents[weapon.talented] or {}) do
print("Try", i, tid)
if not self:knowTalent(tid) then
break
end
max = i
end
print("Talented with", weapon.talented, "at", max, "using", #weapon_talents[weapon.talented])
return max
end
--- Gets the defense
function _M:combatDefense()
return self.combat_def + self:getDex() - 10
......@@ -129,7 +153,19 @@ end
--- Gets the attack
function _M:combatAttack(weapon)
weapon = weapon or self.combat
return self.combat_atk + (weapon.atk or 0) + (self:getStr(50) - 5) + (self:getDex(50) - 5)
return self.combat_atk + self:combatCheckTraining(weapon) * 10 + (weapon.atk or 0) + (self:getStr(50) - 5) + (self:getDex(50) - 5)
end
--- Gets the attack using only strength
function _M:combatAttackStr(weapon)
weapon = weapon or self.combat
return self.combat_atk + self:combatCheckTraining(weapon) * 10 + (weapon.atk or 0) + (self:getStr(100) - 10)
end
--- Gets the attack using only dexterity
function _M:combatAttackDex(weapon)
weapon = weapon or self.combat
return self.combat_atk + self:combatCheckTraining(weapon) * 10 + (weapon.atk or 0) + (self:getDex(100) - 10)
end
--- Gets the armor penetration
......@@ -159,7 +195,8 @@ function _M:combatDamage(weapon)
add = add + (self:getStat(stat) - 10) * mod
end
end
return self.combat_dam + (weapon.dam or 1) + add
local talented_mod = self:combatCheckTraining(weapon)
return self.combat_dam + (weapon.dam or 1) * (1 + talented_mod / 3) + add
end
--- Gets spellpower
......
......@@ -6,6 +6,7 @@ newEntity{
display = "/", color=colors.SLATE,
encumber = 3,
rarity = 3,
combat = { talented = "sword", },
desc = [[Massive two-handed swords.]],
twohanded = true,
}
......
......@@ -159,7 +159,7 @@ newEntity{ base = "BASE_POTION",
game.logSeen(who, "%s quaff the slime juice. Yuck.", who.name:capitalize())
-- 1% chance of gaining slime mold powers
if rng.percent(1) then
who:learnTalentType("physical/slime")
who:learnTalentType("physical/slime", true)
game.logSeen(who, "%s is transformed by the slime mold juice.", who.name:capitalize())
game.logPlayer(who, "#00FF00#You gain an affinity for the molds. You can now learn new slime talents (press G).")
end
......
......@@ -5,6 +5,7 @@ newEntity{
display = "/", color=colors.SLATE,
encumber = 3,
rarity = 3,
combat = { talented = "sword", },
desc = [[Sharp, long, and deadly.]],
-- egos = "/data/general/objects/egos/swords.lua", egos_chance = resolvers.mbonus(40, 5),
}
......
load("/data/talents/misc/misc.lua")
load("/data/talents/spells/spells.lua")
load("/data/talents/physical/physical.lua")
load("/data/talents/misc/npcs.lua")
load("/data/talents/misc/misc.lua")
-- Load other misc things
load("/data/talents/misc/npcs.lua")
load("/data/talents/misc/random.lua")
-- race & classes
newTalentType{ type="base/class", name = "class", hide = true, description = "The basic talents defining a class." }
newTalentType{ type="base/race", name = "race", hide = true, description = "The various racial bonuses a character can have." }
......
......@@ -13,8 +13,8 @@ newTalent{
range = 1,
action = function(self, t)
local t = {type="hit", range=self:getTalentRange(t)}
local x, y = self:getTarget(t)
if not x or not y then return nil end
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
self:attackTarget(target, DamageType.POISON, 1.5, true)
return true
......
......@@ -15,11 +15,11 @@ newTalent{
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)
local speed, hit = self:attackTargetWith(target, weapon.combat, nil, 1)
-- Try to stun !
if hit then
if target:checkHit(self:combatAttack(weapon), target:combatPhysicalResist(), 0, 95, 5) and target:canBe("stun") then
if target:checkHit(self:combatAttackStr(weapon.combat), 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())
......@@ -32,3 +32,122 @@ newTalent{
return ([[Hits the target with your weapon, if the atatck hits, the target is stunned.]])
end,
}
newTalent{
name = "Death Blow",
type = {"physical/2hweapon", 2},
cooldown = 8,
stamina = 15,
require = { stat = { str=22 }, },
action = function(self, t)
local weapon = self:getInven("MAINHAND")[1]
if not weapon or not weapon.twohanded then
game.logPlayer(self, "You cannot use Death 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 inc = self.stamina / 2
if self:knowTalent(Talents.T_MIGHTY_BLOWS) then
self.combat_dam = self.combat_dam + inc
end
local speed, hit = self:attackTargetWith(target, weapon.combat, nil, 1)
if self:knowTalent(Talents.T_MIGHTY_BLOWS) then
self.combat_dam = self.combat_dam - inc
self.stamina = 0
end
-- Try to insta-kill
if hit then
if target:checkHit(self:combatAttackStr(weapon.combat), target:combatPhysicalResist(), 0, 95, 5) and target:canBe("instadeath") and target.life > 0 and target.life < target.max_life * 0.2 then
-- KILL IT !
game.logSeen(target, "%s feels the pain of the death blow!", target.name:capitalize())
target:takeHit(100000, self)
elseif target.life > 0 and target.life < target.max_life * 0.2 then
game.logSeen(target, "%s resists the death 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,
}
newTalent{
name = "Death Danse",
type = {"physical/2hweapon", 3},
cooldown = 10,
stamina = 30,
require = { stat = { str=30 }, },
action = function(self, t)
local weapon = self:getInven("MAINHAND")[1]
if not weapon or not weapon.twohanded then
game.logPlayer(self, "You cannot use Death Danse without a two handed weapon!")
return nil
end
for i = -1, 1 do for j = -1, 1 do
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)
self:attackTargetWith(target, weapon.combat, nil, 1)
end
end end
return true
end,
info = function(self)
return ([[Spin around, extending your weapon and damaging all targets aruond.]])
end,
}
newTalent{
name = "Berserker",
type = {"physical/2hweapon", 3},
mode = "sustained",
cooldown = 30,
sustain_stamina = 100,
require = { stat = { str=20 }, },
activate = function(self, t)
local weapon = self:getInven("MAINHAND")[1]
if not weapon or not weapon.twohanded then
game.logPlayer(self, "You cannot use Berserker without a two handed weapon!")
return nil
end
return {
atk = self:addTemporaryValue("combat_dam", 5 + self:getStr(20)),
dam = self:addTemporaryValue("combat_atk", 5 + self:getDex(20)),
def = self:addTemporaryValue("combat_def", -5),
armor = self:addTemporaryValue("combat_armor", -5),
}
end,
deactivate = function(self, t, p)
self:removeTemporaryValue("combat_def", p.def)
self:removeTemporaryValue("combat_armor", p.armor)
self:removeTemporaryValue("combat_atk", p.atk)
self:removeTemporaryValue("combat_dam", p.dam)
return true
end,
info = function(self)
return ([[Enters a protective battle stance, increasing attack and damage at the cost of defense and armor.]])
end,
}
newTalent{
name = "Mighty Blows",
type = {"physical/2hweapon", 4},
mode = "passive",
require = { stat = { str=40 }, talent = { Talents.T_DEATH_BLOW } },
info = function(self)
return ([[You put all your strength into your Death Blows, increasing attack and consuming all remaining stamina to increase damage.]])
end,
}
......@@ -4,7 +4,7 @@ newTalentType{ type="physical/dualweapon", name = "dual wielding", description =
newTalentType{ type="physical/shield", name = "weapon and shields", description = "Allows the user to be more proficient with shields and one handed weapons." }
newTalentType{ type="physical/dirty", name = "dirty fighting", description = "Teaches various physical talents to criple your foes." }
newTalentType{ type="physical/weapon-training", name = "weapon-training", description = "Grants bonuses to the different weapon types." }
newTalentType{ type="physical/combat-training", name = "wombat-training", description = "Teaches to use various armors and improves health." }
newTalentType{ type="physical/combat-training", name = "combat-training", description = "Teaches to use various armors and improves health." }
load("/data/talents/physical/2hweapon.lua")
load("/data/talents/physical/dualweapon.lua")
......
......@@ -128,6 +128,8 @@ newTalent{
knock = self:addTemporaryValue("knockback_immune", 1)
end
return {
atk = self:addTemporaryValue("combat_dam", -5),
dam = self:addTemporaryValue("combat_atk", -5),
def = self:addTemporaryValue("combat_def", 5 + self:getDex(10)),
armor = self:addTemporaryValue("combat_armor", 5 + self:getCun(10)),
stun = stun,
......@@ -137,6 +139,8 @@ newTalent{
deactivate = function(self, t, p)
self:removeTemporaryValue("combat_def", p.def)
self:removeTemporaryValue("combat_armor", p.armor)
self:removeTemporaryValue("combat_atk", p.atk)
self:removeTemporaryValue("combat_dam", p.dam)
if p.stun then self:removeTemporaryValue("stun_immune", p.stun) end
if p.knock then self:removeTemporaryValue("knockback_immune", p.knock) end
return true
......
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