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

colored damage text

git-svn-id: http://svn.net-core.org/repos/t-engine4@479 51575b47-30f0-44d4-a5cc-537603b46e54
parent 6d6220ed
No related branches found
No related tags found
No related merge requests found
......@@ -69,6 +69,9 @@ function _M:init(t, no_default)
-- Resistances
t.resists = t.resists or {}
-- % Increase damage
t.inc_damage = t.inc_damage or {}
-- Default regen
t.air_regen = t.air_regen or 3
t.mana_regen = t.mana_regen or 0.5
......
......@@ -2,6 +2,10 @@
setDefaultProjector(function(src, x, y, type, dam)
local target = game.level.map(x, y, Map.ACTOR)
if target then
-- Increases damage
local inc = src.inc_damage[type] or 0
dam = dam + (dam * inc / 100)
-- Reduce damage with resistance
local res = target.resists[type] or 0
print("[PROJECTOR] res", res, (100 - res) / 100, " on dam", dam)
......@@ -14,7 +18,7 @@ setDefaultProjector(function(src, x, y, type, dam)
if target == game.player then flash = game.flash.BAD end
if src == game.player then flash = game.flash.GOOD end
game.logSeen(target, flash, "%s hits %s for #aaaaaa#%0.2f %s damage#ffffff#.", src.name:capitalize(), target.name, dam, DamageType:get(type).name)
game.logSeen(target, flash, "%s hits %s for %s%0.2f %s damage#LAST#.", src.name:capitalize(), target.name, DamageType:get(type).text_color or "#aaaaaa#", dam, DamageType:get(type).name)
local sx, sy = game.level.map:getTileToScreen(x, y)
if target:takeHit(dam, src) then
if src == game.player or target == game.player then
......@@ -48,11 +52,11 @@ newDamageType{
-- Arcane is basic (usualy) unresistable damage
newDamageType{
name = "arcane", type = "ARCANE",
name = "arcane", type = "ARCANE", text_color = "#PURPLE#",
}
-- The elemental damges
newDamageType{
name = "fire", type = "FIRE",
name = "fire", type = "FIRE", text_color = "#LIGHT_RED#",
projector = function(src, x, y, type, dam)
DamageType.defaultProjector(src, x, y, type, dam)
local target = game.level.map(x, y, Map.ACTOR)
......@@ -62,7 +66,7 @@ newDamageType{
end,
}
newDamageType{
name = "cold", type = "COLD",
name = "cold", type = "COLD", text_color = "#BLUE#",
projector = function(src, x, y, type, dam)
DamageType.defaultProjector(src, x, y, type, dam)
local target = game.level.map(x, y, Map.ACTOR)
......@@ -74,14 +78,14 @@ newDamageType{
-- Nature & Blight: Opposing damage types
newDamageType{
name = "nature", type = "NATURE",
name = "nature", type = "NATURE", text_color = "#LIGHT_GREEN#",
}
newDamageType{
name = "blight", type = "BLIGHT",
name = "blight", type = "BLIGHT", text_color = "#DARK_GREEN#",
}
newDamageType{
name = "lightning", type = "LIGHTNING",
name = "lightning", type = "LIGHTNING", text_color = "#ROYAL_BLUE#",
projector = function(src, x, y, type, dam)
DamageType.defaultProjector(src, x, y, type, dam)
local target = game.level.map(x, y, Map.ACTOR)
......@@ -92,7 +96,7 @@ newDamageType{
}
-- Acid detroys potions
newDamageType{
name = "acid", type = "ACID",
name = "acid", type = "ACID", text_color = "#GREEN#",
projector = function(src, x, y, type, dam)
DamageType.defaultProjector(src, x, y, type, dam)
local target = game.level.map(x, y, Map.ACTOR)
......@@ -104,12 +108,17 @@ newDamageType{
-- Light up the room
newDamageType{
name = "light", type = "LIGHT",
name = "light", type = "LIGHT", text_color = "#YELLOW#",
projector = function(src, x, y, type, dam)
game.level.map.lites(x, y, true)
end,
}
-- Irresistible fire damage
newDamageType{
name = "netherflame", type = "NETHERFLAME", text_color = "#FIREBRICK#",
}
-- Blinds
newDamageType{
name = "blindness", type = "BLIND",
......@@ -137,6 +146,7 @@ newDamageType{
end
end,
}
-- Fire DOT + Stun
newDamageType{
name = "flameshock", type = "FLAMESHOCK",
......@@ -164,11 +174,6 @@ newDamageType{
end,
}
-- Irresistible fire damage
newDamageType{
name = "netherflame", type = "NETHERFLAME",
}
-- Freezes target, chcks for spellresistance
newDamageType{
name = "freeze", type = "FREEZE",
......
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