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

technics

git-svn-id: http://svn.net-core.org/repos/t-engine4@172 51575b47-30f0-44d4-a5cc-537603b46e54
parent f6e18408
No related branches found
No related tags found
No related merge requests found
......@@ -199,15 +199,25 @@ end
-- @return true to continue, false to stop
function _M:preUseTalent(ab, silent)
if not self:enoughEnergy() then print("fail energy") return false end
if ab.mana and self:getMana() < ab.mana * (100 + self.fatigue) / 100 then
game.logPlayer(self, "You do not have enough mana to cast %s.", ab.name)
print("fail mana", self:getMana(), ab.mana, ab.mana * (100 + self.fatigue) / 100)
return false
end
if ab.stamina and self:getStamina() < ab.stamina * (100 + self.fatigue) / 100 then
print("fail stam")
game.logPlayer(self, "You do not have enough stamina to use %s.", ab.name)
return false
if ab.mode == "sustained" then
if ab.sustain_mana and self.max_mana < ab.sustain_mana then
game.logPlayer(self, "You do not have enough mana to cast %s.", ab.name)
return false
end
if ab.sustain_stamina and self.max_stamina < ab.sustain_stamina then
game.logPlayer(self, "You do not have enough stamina to use %s.", ab.name)
return false
end
else
if ab.mana and self:getMana() < ab.mana * (100 + self.fatigue) / 100 then
game.logPlayer(self, "You do not have enough mana to cast %s.", ab.name)
return false
end
if ab.stamina and self:getStamina() < ab.stamina * (100 + self.fatigue) / 100 then
game.logPlayer(self, "You do not have enough stamina to use %s.", ab.name)
return false
end
end
if not silent then
......@@ -242,11 +252,29 @@ function _M:postUseTalent(ab, ret)
self:useEnergy()
end
if ab.mana then
self:incMana(-ab.mana * (100 + self.fatigue) / 100)
end
if ab.stamina then
self:incStamina(-ab.stamina * (100 + self.fatigue) / 100)
if ab.mode == "sustained" then
if not self:isTalentActive(ab.id) then
if ab.sustain_mana then
self.max_mana = self.max_mana - ab.sustain_mana
end
if ab.sustain_stamina then
self.max_stamina = self.max_stamina - ab.sustain_stamina
end
else
if ab.sustain_mana then
self.max_mana = self.max_mana + ab.sustain_mana
end
if ab.sustain_stamina then
self.max_stamina = self.max_stamina + ab.sustain_stamina
end
end
else
if ab.mana then
self:incMana(-ab.mana * (100 + self.fatigue) / 100)
end
if ab.stamina then
self:incStamina(-ab.stamina * (100 + self.fatigue) / 100)
end
end
return true
......
......@@ -204,7 +204,7 @@ function _M:targetMode(v, msg, co, typ)
if self.target_co then
local co = self.target_co
self.target_co = nil
local ok, err = coroutine.resume(co, self.target.target.x, self.target.target.y)
local ok, err = coroutine.resume(co, self.target.target.x, self.target.target.y, self.target.target.entity)
if not ok and err then error(err) end
end
end
......
......@@ -115,7 +115,7 @@ function _M:getTarget(typ)
game:targetMode("exclusive", msg, coroutine.running(), typ)
return coroutine.yield()
end
return game.target.target.x, game.target.target.y, game.level.map(game.target.target.x, game.target.target.y, Map.ACTOR)
return game.target.target.x, game.target.target.y, game.target.target.entity
end
--- Sets the current target
......
......@@ -30,7 +30,7 @@ function _M:display()
self.surface:drawColorString(self.font, ("#7fffd4#Mana: #00ff00#%d/%d"):format(game.player:getMana(), game.player.max_mana), 0, h, 255, 255, 255) h = h + self.font_h
end
if game.player:knowTalent(game.player.T_STAMINA_POOL) then
self.surface:drawColorString(self.font, ("#ffcc80#Stamina: #00ff00#%d/%d"):format(game.player:getMana(), game.player.max_mana), 0, h, 255, 255, 255) h = h + self.font_h
self.surface:drawColorString(self.font, ("#ffcc80#Stamina: #00ff00#%d/%d"):format(game.player:getStamina(), game.player.max_stamina), 0, h, 255, 255, 255) h = h + self.font_h
end
h = h + self.font_h
self.surface:drawColorString(self.font, ("STR: #00ff00#%3d"):format(game.player:getStr()), 0, h, 255, 255, 255) h = h + self.font_h
......
......@@ -39,8 +39,6 @@ The ToME combat system has the following attributes:
- damage: raw damage done
]]
function _M:attackTarget(target, damtype, mult, noenergy)
damtype = damtype or DamageType.PHYSICAL
mult = mult or 1
local speed = nil
-- All weaponsin main hands
......@@ -95,21 +93,27 @@ end
--- Attacks with one weapon
function _M:attackTargetWith(target, weapon, damtype, mult)
damtype = damtype or DamageType.PHYSICAL
mult = mult or 1
-- 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)
-- If hit is over 0 it connects, if it is 0 we still have 50% chance
local hitted = false
if self:checkHit(atk, def) then
local dam = dam - math.max(0, armor - apr)
dam = dam * mult
dam = self:physicalCrit(dam, weapon)
DamageType:get(damtype).projector(self, target.x, target.y, damtype, math.max(0, dam))
hitted = true
else
game.logSeen(target, "%s misses %s.", self.name:capitalize(), target.name)
end
return self:combatSpeed(weapon)
return self:combatSpeed(weapon), hitted
end
--- Gets the defense
......
......@@ -4,7 +4,9 @@ defaultProjector(function(src, x, y, type, dam)
if target then
-- Reduce damage with resistance
local res = target.resists[type] or 0
dam = dam * (100 - res)
if res == 10 then dam = 0
else dam = dam * (100 / (100 - res))
end
game.logSeen(target, "%s hits %s for #aaaaaa#%0.2f %s damage#ffffff#.", src.name:capitalize(), target.name, dam, DamageType:get(type).name)
local sx, sy = game.level.map:getTileToScreen(x, y)
......
......@@ -13,7 +13,7 @@ newEntity{
define_as = "BASE_AMULET",
slot = "NECK",
type = "jewelry", subtype="amulet",
display = "=",
display = '"',
encumber = 0.1,
rarity = 8,
desc = [[Amulets can have magical properties.]],
......
newTalent{
name = "Sword Apprentice",
type = {"physical/weapon-training", 1},
mode = "passive",
info = function(self)
return [[Increases damage and attack with swords.]]
end,
}
newTalent{
name = "Sword Master",
type = {"physical/weapon-training", 2},
mode = "passive",
points = 2,
require = { stat = { str=18 }, level=10 },
info = function(self)
return [[Increases damage and attack with swords.]]
end,
}
newTalent{
name = "Sword Grand Master",
type = {"physical/weapon-training", 3},
mode = "passive",
points = 3,
require = { stat = { str=34 }, level=20 },
info = function(self)
return [[Increases damage and attack with swords.]]
end,
}
newTalent{
name = "Axe Apprentice",
type = {"physical/weapon-training", 1},
mode = "passive",
info = function(self)
return [[Increases damage and attack with axes.]]
end,
}
newTalent{
name = "Axe Master",
type = {"physical/weapon-training", 2},
mode = "passive",
points = 2,
require = { stat = { str=18 }, level=10 },
info = function(self)
return [[Increases damage and attack with axes.]]
end,
}
newTalent{
name = "Axe Grand Master",
type = {"physical/weapon-training", 3},
mode = "passive",
points = 3,
require = { stat = { str=34 }, level=20 },
info = function(self)
return [[Increases damage and attack with axes.]]
end,
}
newTalent{
name = "Mace Apprentice",
type = {"physical/weapon-training", 1},
mode = "passive",
info = function(self)
return [[Increases damage and attack with maces.]]
end,
}
newTalent{
name = "Mace Master",
type = {"physical/weapon-training", 2},
mode = "passive",
points = 2,
require = { stat = { str=18 }, level=10 },
info = function(self)
return [[Increases damage and attack with maces.]]
end,
}
newTalent{
name = "Mace Grand Master",
type = {"physical/weapon-training", 3},
mode = "passive",
points = 3,
require = { stat = { str=34 }, level=20 },
info = function(self)
return [[Increases damage and attack with maces.]]
end,
}
newTalent{
name = "Knife Apprentice",
type = {"physical/weapon-training", 1},
mode = "passive",
info = function(self)
return [[Increases damage and attack with knifes.]]
end,
}
newTalent{
name = "Knife Master",
type = {"physical/weapon-training", 2},
mode = "passive",
points = 2,
require = { stat = { dex=18 }, level=10 },
info = function(self)
return [[Increases damage and attack with knifes.]]
end,
}
newTalent{
name = "Knife Grand Master",
type = {"physical/weapon-training", 3},
mode = "passive",
points = 3,
require = { stat = { dex=34 }, level=20 },
info = function(self)
return [[Increases damage and attack with knifes.]]
end,
}
newTalent{
name = "Shield Bash",
type = {"physical/shield", 1},
cooldown = 6,
stamina = 8,
require = { stat = { str=12 }, },
action = 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 Bash without a shield!")
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, shield.special_combat, nil, 1 + self:getStr(2))
-- Try to stun !
if hit then
if target:checkHit(self:combatAttack(shield.special_combat), target:combatPhysicalResist(), 0, 95, 5) then
target:setEffect(target.EFF_STUNNED, 3, {})
else
game.logSeen(target, "%s resists the shield bash!", target.name:capitalize())
end
end
return true
end,
info = function(self)
return ([[Hits the target with a shield strike, stunning it.
The damage multiplier increases with your strength.]])
end,
}
newTalent{
name = "Overpower",
type = {"physical/shield", 2},
cooldown = 6,
stamina = 16,
require = { stat = { str=16 }, },
action = function(self, t)
local shield = self:getInven("OFFHAND")[1]
if not shield or not shield.special_combat then
game.logPlayer(self, "You cannot use Overpower without a shield!")
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
-- First attack with weapon
self:attackTarget(target, nil, 0.8 + self:getStr(0.8), true)
-- Second attack with shield
self:attackTargetWith(target, shield.special_combat, nil, 0.8 + self:getStr(0.8))
-- Third attack with shield
local speed, hit = self:attackTargetWith(target, shield.special_combat, nil, 0.8 + self:getStr(0.8))
-- Try to stun !
if hit then
if target:checkHit(self:combatAttack(shield.special_combat), target:combatPhysicalResist(), 0, 95, 5) then
target:knockBack(self.x, self.y, 4)
else
game.logSeen(target, "%s resists the knockback!", target.name:capitalize())
end
end
return true
end,
info = function(self)
return ([[Hits the target with your weapon and two shield strikes, trying to overpower your target.
If the last attack hits, the target is knocked back.]])
end,
}
newTalent{
name = "Repulsion",
type = {"physical/shield", 2},
cooldown = 10,
stamina = 30,
require = { stat = { str=22 }, },
action = function(self, t)
local shield = self:getInven("OFFHAND")[1]
if not shield or not shield.special_combat then
game.logPlayer(self, "You cannot use Repulsion without a shield!")
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)
if target:checkHit(self:combatAttack(shield.special_combat), target:combatPhysicalResist(), 0, 95, 5) then
target:knockBack(self.x, self.y, 3)
else
game.logSeen(target, "%s resists the knockback!", target.name:capitalize())
end
end
end end
return true
end,
info = function(self)
return ([[Let all your foes pile up on your shield then put all your strengh in one mighty thurst and repel them all away.]])
end,
}
newTalent{
name = "Shield Wall",
type = {"physical/shield", 3},
mode = "sustained",
cooldown = 30,
sustain_stamina = 100,
require = { stat = { str=28 }, },
activate = function(self, t)
return {
def = self:addTemporaryValue("combat_def", 5 + self:getDex(10)),
armor = self:addTemporaryValue("combat_armor", 5 + self:getCun(10)),
}
end,
deactivate = function(self, t, p)
self:removeTemporaryValue("combat_def", p.def)
self:removeTemporaryValue("combat_armor", p.armor)
return true
end,
info = function(self)
return ([[Enters a protective battle stance, incraesing defense and armor at the cost of attack and damage.]])
end,
}
return {
name = "Tower of Amon Sûl",
level_range = {40, 50},
level_range = {1, 5},
level_scheme = "player",
max_level = 5,
width = 50, height = 50,
......@@ -20,7 +20,7 @@ return {
},
actor = {
class = "engine.generator.actor.Random",
nb_npc = {0, 0},
nb_npc = {20, 30},
ood = {chance=5, range={1, 10}},
adjust_level = {-1, 2},
guardian = "SHADE_OF_ANGMAR",
......
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