Skip to content
Snippets Groups Projects
Commit e6f53c63 authored by DarkGod's avatar DarkGod
Browse files

Wards are now correctly colored by damage type

still not done ..
parent 971ffb40
No related branches found
No related tags found
No related merge requests found
...@@ -51,6 +51,17 @@ function _M:newDamageType(t) ...@@ -51,6 +51,17 @@ function _M:newDamageType(t)
t.type = t.type:upper() t.type = t.type:upper()
t.projector = t.projector or self.defaultProjector t.projector = t.projector or self.defaultProjector
if not t.color and type(t.text_color) == "string" then
local ts = t.text_color:toTString()
if type(ts[2]) == "table" and ts[2][1] == "color" then
if type(ts[2][2]) == "string" then
t.color = colors[ts[2][2]]
elseif type(ts[2][2]) == "string" then
t.color = {r=ts[2][2], g=ts[2][3], b=ts[2][4]}
end
end
end
table.insert(self.dam_def, t) table.insert(self.dam_def, t)
self[t.type] = #self.dam_def self[t.type] = #self.dam_def
end end
......
...@@ -34,7 +34,7 @@ return { generator = function() ...@@ -34,7 +34,7 @@ return { generator = function()
local da = math.rad(rng.range(0, 360)) local da = math.rad(rng.range(0, 360))
return { return {
life = core.particles.ETERNAL, life = core.particles.ETERNAL,
size = rng.range(3,8), sizev = 0, sizea = 0, size = rng.range(9,12), sizev = 0, sizea = 0,
x = r * math.cos(a) + dr * math.cos(da), xv = 0, xa = 0, x = r * math.cos(a) + dr * math.cos(da), xv = 0, xa = 0,
y = r * math.sin(a) + dr * math.cos(da), yv = 0, ya = 0, y = r * math.sin(a) + dr * math.cos(da), yv = 0, ya = 0,
...@@ -44,10 +44,10 @@ return { generator = function() ...@@ -44,10 +44,10 @@ return { generator = function()
r = color.r/255, rv = 0, ra = 0, r = color.r/255, rv = 0, ra = 0,
g = color.g/255, gv = 0, ga = 0, g = color.g/255, gv = 0, ga = 0,
b = color.b/255, gv = 0, ga = 0, b = color.b/255, gv = 0, ga = 0,
a = rng.range(230, 225)/255, av = 0, aa = 0, a = rng.range(130, 165)/255, av = 0, aa = 0,
} }
end, }, end, },
function(self) function(self)
if first then self.ps:emit(10) first = false end if first then self.ps:emit(10) first = false end
end, end,
10 10, "particles_images/shieldimg"
game/modules/tome/data/gfx/particles_images/shieldimg.png

2.66 KiB

...@@ -247,6 +247,7 @@ function _M:atEnd(v) ...@@ -247,6 +247,7 @@ function _M:atEnd(v)
self:setTile(self.has_custom_tile.f, self.has_custom_tile.w, self.has_custom_tile.h, true) self:setTile(self.has_custom_tile.f, self.has_custom_tile.w, self.has_custom_tile.h, true)
self.actor.has_custom_tile = self.has_custom_tile.f self.actor.has_custom_tile = self.has_custom_tile.f
end end
self:resetAttachementSpots()
-- Prevent the game from auto-assigning talents if necessary. -- Prevent the game from auto-assigning talents if necessary.
if (not config.settings.tome.autoassign_talents_on_birth) and not game.state.birth.always_learn_birth_talents then if (not config.settings.tome.autoassign_talents_on_birth) and not game.state.birth.always_learn_birth_talents then
for _, d in pairs(self.descriptors) do for _, d in pairs(self.descriptors) do
...@@ -1031,6 +1032,28 @@ function _M:fakeEquip(v) ...@@ -1031,6 +1032,28 @@ function _M:fakeEquip(v)
end end
end end
function _M:resetAttachementSpots()
self.actor.attachement_spots = nil
if self.has_custom_tile then return end
local dbr = self.birth_descriptor_def.race[self.descriptors_by_type.race or "Human"]
local dr = self.birth_descriptor_def.subrace[self.descriptors_by_type.subrace or "Cornac"]
local ds = self.birth_descriptor_def.sex[self.descriptors_by_type.sex or "Female"]
local moddable_attachement_spots = dr.moddable_attachement_spots or dbr.moddable_attachement_spots
if moddable_attachement_spots then
local base = moddable_attachement_spots.base
local b = moddable_attachement_spots.all
if not b then b = self.actor.female and moddable_attachement_spots.female or moddable_attachement_spots.male end
local t = {}
self.actor.attachement_spots = t
for kind, d in pairs(b) do
t[kind] = {}
for o, p in pairs(d) do t[kind][o] = p / base end
end
end
end
function _M:setTile(f, w, h, last) function _M:setTile(f, w, h, last)
self.actor:removeAllMOs() self.actor:removeAllMOs()
if not f then if not f then
...@@ -1045,24 +1068,10 @@ function _M:setTile(f, w, h, last) ...@@ -1045,24 +1068,10 @@ function _M:setTile(f, w, h, last)
self.actor.moddable_tile = dr.copy.moddable_tile self.actor.moddable_tile = dr.copy.moddable_tile
self.actor.moddable_tile_base = dr.copy.moddable_tile_base self.actor.moddable_tile_base = dr.copy.moddable_tile_base
self.actor.moddable_tile_ornament = dr.copy.moddable_tile_ornament self.actor.moddable_tile_ornament = dr.copy.moddable_tile_ornament
self.actor.attachement_spots = nil
local moddable_attachement_spots = dr.moddable_attachement_spots or dbr.moddable_attachement_spots
if moddable_attachement_spots then
local base = moddable_attachement_spots.base
local b = moddable_attachement_spots.all
if not b then b = self.actor.female and moddable_attachement_spots.female or moddable_attachement_spots.male end
local t = {}
self.actor.attachement_spots = t
for kind, d in pairs(b) do
t[kind] = {}
for o, p in pairs(d) do t[kind][o] = p / base end
end
end
end end
else else
self.actor.make_tile = nil self.actor.make_tile = nil
self.actor.moddable_tile = nil self.actor.moddable_tile = nil
self.actor.attachement_spots = nil
if h > w then if h > w then
self.actor.image = "invis.png" self.actor.image = "invis.png"
self.actor.add_mos = {{image=f, display_h=2, display_y=-1}} self.actor.add_mos = {{image=f, display_h=2, display_y=-1}}
...@@ -1072,6 +1081,7 @@ function _M:setTile(f, w, h, last) ...@@ -1072,6 +1081,7 @@ function _M:setTile(f, w, h, last)
end end
self.has_custom_tile = {f=f,w=w,h=h} self.has_custom_tile = {f=f,w=w,h=h}
end end
self:resetAttachementSpots()
self:applyCosmeticActor() self:applyCosmeticActor()
......
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