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

Antimagic infused objects are usable without knowing antimagic, but they will...

Antimagic infused objects are usable without knowing antimagic, but they will incur heavy penalties on spellcasting (failure chances, reduced spellpower)


git-svn-id: http://svn.net-core.org/repos/t-engine4@4900 51575b47-30f0-44d4-a5cc-537603b46e54
parent a81a7380
No related branches found
No related tags found
No related merge requests found
......@@ -2100,12 +2100,18 @@ function _M:onWear(o, bypass_set)
end
end
-- apply any special cursed logic
-- Apply any special cursed logic
if self:knowTalent(self.T_DEFILING_TOUCH) then
local t = self:getTalentFromId(self.T_DEFILING_TOUCH)
t.on_onWear(self, t, o)
end
-- Apply antimagic
if o.power_source and o.power_source.antimagic then
self:attr("spellpower_reduction", 1)
self:attr("spell_failure", (o.material_level or 1) * 10)
end
self:breakReloading()
self:updateModdableTile()
......@@ -2160,6 +2166,12 @@ function _M:onTakeoff(o, bypass_set)
t.on_onTakeOff(self, t, o)
end
-- Apply antimagic
if o.power_source and o.power_source.antimagic then
self:attr("spellpower_reduction", -1)
self:attr("spell_failure", -(o.material_level or 1) * 10)
end
self:breakReloading()
self:updateModdableTile()
......@@ -2208,9 +2220,9 @@ function _M:canWearObject(o, try_slot)
if self:attr("forbid_arcane") and o.power_source and o.power_source.arcane then
return nil, "antimagic"
end
if o.power_source and o.power_source.antimagic and not self:attr("forbid_arcane") then
return nil, "requires antimagic"
end
-- if o.power_source and o.power_source.antimagic and not self:attr("forbid_arcane") then
-- return nil, "requires antimagic"
-- end
return engine.interface.ActorInventory.canWearObject(self, o, try_slot)
end
......@@ -2554,6 +2566,15 @@ function _M:preUseTalent(ab, silent, fake)
end
end
-- Spells can fail
if (ab.is_spell and not self:isTalentActive(ab.id)) and not fake and self:attr("spell_failure") then
if rng.percent(self:attr("spell_failure")) then
if not silent then game.logPlayer(self, "You fail to cast %s!", ab.name) end
self:useEnergy()
return false
end
end
-- Paradox is special, it has no max, but the higher it is the higher the chance of something bad happening
if (ab.paradox and ab.paradox > 0 or (ab.sustain_paradox and ab.sustain_paradox > 0 and not self:isTalentActive(ab.id))) and not fake and not self:attr("force_talent_ignore_ressources") then
-- Check anomalies first since they can reduce paradox, this way paradox is a self correcting resource
......
......@@ -967,7 +967,10 @@ function _M:combatSpellpower(mod)
add = add + self:hasEffect(self.EFF_BLOODLUST).dur
end
return self:rescaleCombatStats((self.combat_spellpower > 0 and self.combat_spellpower or 0) + add + self:getMag()) * mod
local am = 1
if self:attr("spellpower_reduction") then am = 1 / (1 + self:attr("spellpower_reduction")) end
return self:rescaleCombatStats((self.combat_spellpower > 0 and self.combat_spellpower or 0) + add + self:getMag()) * mod * am
end
--- Gets damage based on talent
......
......@@ -458,6 +458,7 @@ newEntity{ base = "BASE_LITE",
rarity = 300,
desc = [[Said to have once belonged to Inquisitor Marcus Dunn during the Spellhunt this fist sized quartz crystal glows constantly with a soft white light and was rumoured to be a great aid in meditation, helping focus the mind, body, and soul of the owner as well as protecting them from the foulest of magics.]],
cost = 100,
material_level = 4,
wielder = {
lite = 4,
......
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