Advertisement
Guest User

cults damage types

a guest
Apr 24th, 2019
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 8.65 KB | None | 0 0
  1. -- ToME - Tales of Maj'Eyal
  2. -- Copyright (C) 2009, 2010, 2011, 2012 Nicolas Casalini
  3. --
  4. -- This program is free software: you can redistribute it and/or modify
  5. -- it under the terms of the GNU General Public License as published by
  6. -- the Free Software Foundation, either version 3 of the License, or
  7. -- (at your option) any later version.
  8. --
  9. -- This program is distributed in the hope that it will be useful,
  10. -- but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12. -- GNU General Public License for more details.
  13. --
  14. -- You should have received a copy of the GNU General Public License
  15. -- along with this program.  If not, see <http://www.gnu.org/licenses/>.
  16. --
  17. -- Nicolas Casalini "DarkGod"
  18. -- darkgod@te4.org
  19.  
  20. local initState = engine.DamageType.initState
  21. local useImplicitCrit = engine.DamageType.useImplicitCrit
  22.  
  23.  
  24. newDamageType{
  25.     name = "unstable rift", type="RIFT",
  26.     projector = function(src, x, y, type, dam, state)
  27.         state = initState(state)
  28.         useImplicitCrit(src, state)
  29.         local target = game.level.map(x, y, Map.ACTOR)
  30.         if target and src:reactionToward(target) < 0 then
  31.             if dam.edam > 0 then DamageType:get(DamageType.TEMPORAL).projector(src, x, y, DamageType.TEMPORAL, dam.edam, state) end
  32.             if dam.pin > 0 and target:canBe("pin") then
  33.                 target:setEffect(target.EFF_PINNED, dam.pin, {apply_power=src:combatSpellpower()})
  34.             end
  35.         end
  36.     end,
  37. }
  38.  
  39. newDamageType{
  40.     name = "rift explosion", type = "RIFT_EXPLOSION",
  41.     projector = function(src, x, y, type, dam, state)
  42.         state = initState(state)
  43.         useImplicitCrit(src, state)
  44.         local target = game.level.map(x, y, Map.ACTOR)
  45.         if target and not target.turn_procs.rift_explosion then
  46.             target.turn_procs.rift_explosion = true
  47.             DamageType:get(DamageType.TEMPORAL).projector(src, x, y, DamageType.TEMPORAL, dam, state)
  48.             return dam
  49.         end
  50.     end,
  51. }
  52.  
  53. newDamageType{
  54.     name = "voidburn", type = "VOIDBURN",
  55.     projector = function(src, x, y, type, dam, state)
  56.         state = initState(state)
  57.         useImplicitCrit(src, state)
  58.         DamageType:get(DamageType.VOID).projector(src, x, y, DamageType.VOID, dam.dam, state)
  59.         local target = game.level.map(x, y, Map.ACTOR)
  60.         if target then
  61.             -- Set on fire!
  62.             local finaldam = dam.dam * dam.perc
  63.             target:setEffect(target.EFF_VOIDBURN, dam.dur, {src=src, power=finaldam / dam.dur, no_ct_effect=true})
  64.         end
  65.         return init_dam
  66.     end,
  67. }
  68.  
  69. newDamageType{
  70.     name = "slowing void", type = "VOID_SLOW",
  71.     projector = function(src, x, y, type, dam, state)
  72.         state = initState(state)
  73.         useImplicitCrit(src, state)
  74.        
  75.         local target = game.level.map(x, y, Map.ACTOR)
  76.         if not target or target.dead then return end
  77.         DamageType:get(DamageType.VOID).projector(src, x, y, DamageType.VOID, dam.dam, state)      
  78.         local dur = dam.dur or 4
  79.         if target:canBe("slow") then
  80.             target:setEffect(target.EFF_SLOW, dam.dur, {power=0.4, src:combatSpellpower()})
  81.         end
  82.     end,
  83. }
  84.  
  85. newDamageType{
  86.     name = "draining void", type = "VOID_DRAIN",
  87.     projector = function(src, x, y, type, dam, state)
  88.         state = initState(state)
  89.         useImplicitCrit(src, state)
  90.         if _G.type(dam) == "number" then dam = {dam=dam, healfactor=0.1} end
  91.         local target = game.level.map(x, y, Map.ACTOR) -- Get the target first to make sure we heal even on kill
  92.         local realdam1 = DamageType:get(DamageType.TEMPORAL).projector(src, x, y, DamageType.TEMPORAL, dam.dam / 2, state)
  93.         local realdam2 = DamageType:get(DamageType.DARKNESS).projector(src, x, y, DamageType.DARKNESS, dam.dam / 2, state) 
  94.         local realdam = realdam1 + realdam2
  95.         if target and realdam > 0 and not src:attr("dead") then
  96.             src.reverse_entropy = true
  97.             src:heal(realdam * dam.healfactor, target)
  98.             src:logCombat(target, "#Source# drains life from #Target#!")
  99.             src.reverse_entropy = nil
  100.         end
  101.         return realdam
  102.     end,
  103. }
  104.  
  105. newDamageType{
  106.     name = "mesmerize", type = "MESMERIZE",
  107.     projector = function(src, x, y, type, dam, state)
  108.         state = initState(state)
  109.         useImplicitCrit(src, state)
  110.         local target = game.level.map(x, y, Map.ACTOR)
  111.         if target then
  112.             if target:canBe("stun") then
  113.                 game:onTickEnd(function() target:setEffect(target.EFF_DAZED, 2, {apply_power=dam.apply_power, no_ct_effect=true}) end) --onTickEnd to avoid breaking the daze
  114.             end
  115.         end
  116.     end,
  117. }
  118.  
  119. -- Darkness+Temporal damage, sets any negative magical effect under 3 duration to 3 duration
  120. newDamageType{
  121.     name = "obliterating void", type = "OBLIVION",
  122.     projector = function(src, x, y, type, dam, state)
  123.         state = initState(state)
  124.         useImplicitCrit(src, state)
  125.         local target = game.level.map(x, y, Map.ACTOR)
  126.         if target then
  127.             if _G.type(dam) == "table" then dam, dur, perc = dam.dam, dam.dur, (dam.initial or perc) end
  128.             local init_dam = dam
  129.             if init_dam > 0 then DamageType:get(DamageType.DARKNESS).projector(src, x, y, DamageType.DARKNESS, init_dam, state) end
  130.             if init_dam > 0 then DamageType:get(DamageType.TEMPORAL).projector(src, x, y, DamageType.TEMPORAL, init_dam, state) end
  131.  
  132.             local effects = target:effectsFilter({types={magical=true}, status="detrimental"}, 10)
  133.             for _, effect in ipairs(effects) do
  134.                 if target.tmp[effect].dur < 3 then target.tmp[effect].dur = 3 end
  135.             end
  136.             return init_dam
  137.         end
  138.     end,
  139. }
  140.  
  141. newDamageType{
  142.     name = "aging temporal", type = "TEMPORAL_AGING",
  143.     projector = function(src, x, y, type, dam, state)
  144.         state = initState(state)
  145.         useImplicitCrit(src, state)
  146.  
  147.         if _G.type(dam) == "number" then dam = {dam=dam, chance=25, apply=src:combatSpellpower()} end
  148.        
  149.         local target = game.level.map(x, y, Map.ACTOR)
  150.         if not target or target.dead then return end
  151.        
  152.         local eff = rng.range(1, 3)
  153.         local power = dam.apply_power or src:combatSpellpower()
  154.         local dur = dam.dur or 2
  155.         -- Pull random effect
  156.         if eff == 1 then
  157.             if target:canBe("blind") then
  158.                 target:setEffect(target.EFF_BLINDED, dur, {apply_power=power, no_ct_effect=true})
  159.             else
  160.                 game.logSeen(target, "%s resists the blindness!", target.name:capitalize())
  161.             end
  162.         elseif eff == 2 then
  163.             if target:canBe("pin") then
  164.                 target:setEffect(target.EFF_PINNED, dur, {apply_power=power, no_ct_effect=true})
  165.             else
  166.                 game.logSeen(target, "%s resists the pin!", target.name:capitalize())
  167.             end
  168.         elseif eff == 3 then
  169.             if target:canBe("confusion") then
  170.                 target:setEffect(target.EFF_CONFUSED, dur, {power=50, apply_power=power, no_ct_effect=true})
  171.             else
  172.                 game.logSeen(target, "%s resists the confusion!", target.name:capitalize())
  173.             end
  174.         end
  175.         DamageType:get(DamageType.TEMPORAL).projector(src, x, y, DamageType.TEMPORAL, dam.dam, state)      
  176.     end,
  177. }
  178.  
  179. -- Scourge drake
  180. newDamageType{
  181.     name = "decaying ground", type = "DECAYING_GROUND", text_color = "#DARK_GREEN#",
  182.     projector = function(src, x, y, type, dam, state)
  183.         state = initState(state)
  184.         useImplicitCrit(src, state)
  185.         if _G.type(dam) == "number" then dam = {dam=dam} end
  186.         DamageType:get(DamageType.BLIGHT).projector(src, x, y, DamageType.BLIGHT, dam.dam)
  187.         local target = game.level.map(x, y, Map.ACTOR)
  188.         if target and target:canBe("slow") then
  189.             target:setEffect(target.EFF_DECAYING_GROUND, 3, { power=dam.power or 10 })
  190.         end
  191.     end,
  192. }
  193.  
  194. newDamageType{
  195.     name = "defiled blood", type = "DEFILED_BLOOD", text_color = "#BLACK#",
  196.     projector = function(src, x, y, type, dam, state)
  197.         state = initState(state)
  198.         useImplicitCrit(src, state)
  199.  
  200.         local target = game.level.map(x, y, Map.ACTOR)
  201.         if not target then return end
  202.  
  203.         local tentacle = src:callTalent(src.T_MUTATED_HAND, "getTentacleCombat")
  204.         if not tentacle then return end
  205.  
  206.         local speed, hit = src:attackTargetWith(target, tentacle, DamageType.DARKNESS, dam)
  207.         if hit then
  208.             target:setEffect(target.EFF_DEFILED_BLOOD, 2, {power=src:callTalent(src.T_DEFILED_BLOOD, "getHeal")})
  209.         end
  210.         game.level.map:particleEmitter(x, y, 1, "tentacle_ground", {img="tentacle_black"})
  211.     end,
  212. }
  213.  
  214. newDamageType{
  215.     name = "antropy energies", type = "ENTROPIC_VOID_HELPER", text_color = "#GOLD#",
  216.     projector = function(src, x, y, type, dam, state)
  217.         state = initState(state)
  218.         useImplicitCrit(src, state)
  219.  
  220.         local target = game.level.map(x, y, Map.ACTOR)
  221.         if not target then return end
  222.  
  223.         target:removeEffect(target.EFF_TOTAL_COLLAPSE, false, true)
  224.  
  225.         local npc = game.level:findEntity{define_as="HYPOSTASIS"}
  226.         if not npc then return end
  227.  
  228.         game.level.data.antropic_accumulation = (game.level.data.antropic_accumulation or 0) + 1
  229.         if game.level.data.antropic_accumulation > 10 then
  230.             game.logSeen(npc, "#PURPLE#The %s fully awakens as you absorb antropic forces!", npc.name)
  231.             npc:awakenAntropic()
  232.             game.level.data.antropic_accumulation = 0
  233.         else
  234.             game.logSeen(npc, "#PURPLE#The %s seems to shudder as you absorb some antropic forces.", npc.name)
  235.         end
  236.     end,
  237. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement