I would be all for this if I didn't have to code it

In other words, something like this would be a lot of tedious work. To give you guys some idea let's take the blind damage type as it is now.
Code: Select all
if target then
if target:checkHit(src:combatSpellpower(), target:combatSpellResist(), 0, 95, 15) and target:canBe("blind") then
target:setEffect(target.EFF_BLINDED, math.ceil(dam), {})
else
game.logSeen(target, "%s resists the blinding light!", target.name:capitalize())
end
end
And as it would be if this idea was implemented.
Code: Select all
newDamageType{
name = "blindness", type = "BLIND",
projector = function(src, x, y, type, dam)
local target = game.level.map(x, y, Map.ACTOR)
if target then
if target:checkHit(src:combatSpellpower(), target:combatSpellResist(), 0, 95, 15) and target:canBe("blind") then
target:setEffect(target.EFF_BLINDED, math.ceil(dam), {})
elseif target:attr("blind_immune") >= 1 then
game.logSeen(target, "%s is immune!", target.name:capitalize())
elseif target:attr("blind_immune") < 1 then
game.logSeen(target, "%s is unaffected by the light!", target.name:capitalize())
else
game.logSeen(target, "%s resists the light!", target.name:capitalize())
end
end
end,
}
Granted there's a third way to do it which would involve a bit less work but still would mean going through every damage type, timed effect, and talent.
Basically this would put a string return on the canBe("blind") function that would say either (X ignores the blindness or X is immune). But as you can see this would still require the blind damage type to be modified so the %resists the light! string is skipped.
Code: Select all
newDamageType{
name = "blindness", type = "BLIND",
projector = function(src, x, y, type, dam)
local target = game.level.map(x, y, Map.ACTOR)
if target then
if target:checkHit(src:combatSpellpower(), target:combatSpellResist(), 0, 95, 15) and target:canBe("blind") then
target:setEffect(target.EFF_BLINDED, math.ceil(dam), {})
elseif not target:attr("blind_immune") then
game.logSeen(target, "%s resists the light!", target.name:capitalize())
end
end
end,
}
I'm sure there might be an easier way but if the job is as tedious as I'm thinking it might be.. I wouldn't personally volunteer to code it.
Can anyone think of an easier way to do it?