Guest User

cults damage types

a guest
Apr 24th, 2019
145
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.  
  19. local initState = engine.DamageType.initState
  20. local useImplicitCrit = engine.DamageType.useImplicitCrit
  21.  
  22.  
  23. newDamageType{
  24.     name = "unstable rift", type="RIFT",
  25.     projector = function(src, x, y, type, dam, state)
  26.         state = initState(state)
  27.         useImplicitCrit(src, state)
  28.         local target = game.level.map(x, y, Map.ACTOR)
  29.         if target and src:reactionToward(target) < 0 then
  30.             if dam.edam > 0 then DamageType:get(DamageType.TEMPORAL).projector(src, x, y, DamageType.TEMPORAL, dam.edam, state) end
  31.             if dam.pin > 0 and target:canBe("pin") then
  32.                 target:setEffect(target.EFF_PINNED, dam.pin, {apply_power=src:combatSpellpower()})
  33.             end
  34.         end
  35.     end,
  36. }
  37.  
  38. newDamageType{
  39.     name = "rift explosion", type = "RIFT_EXPLOSION",
  40.     projector = function(src, x, y, type, dam, state)
  41.         state = initState(state)
  42.         useImplicitCrit(src, state)
  43.         local target = game.level.map(x, y, Map.ACTOR)
  44.         if target and not target.turn_procs.rift_explosion then
  45.             target.turn_procs.rift_explosion = true
  46.             DamageType:get(DamageType.TEMPORAL).projector(src, x, y, DamageType.TEMPORAL, dam, state)
  47.             return dam
  48.         end
  49.     end,
  50. }
  51.  
  52. newDamageType{
  53.     name = "voidburn", type = "VOIDBURN",
  54.     projector = function(src, x, y, type, dam, state)
  55.         state = initState(state)
  56.         useImplicitCrit(src, state)
  57.         DamageType:get(DamageType.VOID).projector(src, x, y, DamageType.VOID, dam.dam, state)
  58.         local target = game.level.map(x, y, Map.ACTOR)
  59.         if target then
  60.             -- Set on fire!
  61.             local finaldam = dam.dam * dam.perc
  62.             target:setEffect(target.EFF_VOIDBURN, dam.dur, {src=src, power=finaldam / dam.dur, no_ct_effect=true})
  63.         end
  64.         return init_dam
  65.     end,
  66. }
  67.  
  68. newDamageType{
  69.     name = "slowing void", type = "VOID_SLOW",
  70.     projector = function(src, x, y, type, dam, state)
  71.         state = initState(state)
  72.         useImplicitCrit(src, state)
  73.        
  74.         local target = game.level.map(x, y, Map.ACTOR)
  75.         if not target or target.dead then return end
  76.         DamageType:get(DamageType.VOID).projector(src, x, y, DamageType.VOID, dam.dam, state)      
  77.         local dur = dam.dur or 4
  78.         if target:canBe("slow") then
  79.             target:setEffect(target.EFF_SLOW, dam.dur, {power=0.4, src:combatSpellpower()})
  80.         end
  81.     end,
  82. }
  83.  
  84. newDamageType{
  85.     name = "draining void", type = "VOID_DRAIN",
  86.     projector = function(src, x, y, type, dam, state)
  87.         state = initState(state)
  88.         useImplicitCrit(src, state)
  89.         if _G.type(dam) == "number" then dam = {dam=dam, healfactor=0.1} end
  90.         local target = game.level.map(x, y, Map.ACTOR) -- Get the target first to make sure we heal even on kill
  91.         local realdam1 = DamageType:get(DamageType.TEMPORAL).projector(src, x, y, DamageType.TEMPORAL, dam.dam / 2, state)
  92.         local realdam2 = DamageType:get(DamageType.DARKNESS).projector(src, x, y, DamageType.DARKNESS, dam.dam / 2, state) 
  93.         local realdam = realdam1 + realdam2
  94.         if target and realdam > 0 and not src:attr("dead") then
  95.             src.reverse_entropy = true
  96.             src:heal(realdam * dam.healfactor, target)
  97.             src:logCombat(target, "#Source# drains life from #Target#!")
  98.             src.reverse_entropy = nil
  99.         end
  100.         return realdam
  101.     end,
  102. }
  103.  
  104. newDamageType{
  105.     name = "mesmerize", type = "MESMERIZE",
  106.     projector = function(src, x, y, type, dam, state)
  107.         state = initState(state)
  108.         useImplicitCrit(src, state)
  109.         local target = game.level.map(x, y, Map.ACTOR)
  110.         if target then
  111.             if target:canBe("stun") then
  112.                 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
  113.             end
  114.         end
  115.     end,
  116. }
  117.  
  118. -- Darkness+Temporal damage, sets any negative magical effect under 3 duration to 3 duration
  119. newDamageType{
  120.     name = "obliterating void", type = "OBLIVION",
  121.     projector = function(src, x, y, type, dam, state)
  122.         state = initState(state)
  123.         useImplicitCrit(src, state)
  124.         local target = game.level.map(x, y, Map.ACTOR)
  125.         if target then
  126.             if _G.type(dam) == "table" then dam, dur, perc = dam.dam, dam.dur, (dam.initial or perc) end
  127.             local init_dam = dam
  128.             if init_dam > 0 then DamageType:get(DamageType.DARKNESS).projector(src, x, y, DamageType.DARKNESS, init_dam, state) end
  129.             if init_dam > 0 then DamageType:get(DamageType.TEMPORAL).projector(src, x, y, DamageType.TEMPORAL, init_dam, state) end
  130.  
  131.             local effects = target:effectsFilter({types={magical=true}, status="detrimental"}, 10)
  132.             for _, effect in ipairs(effects) do
  133.                 if target.tmp[effect].dur < 3 then target.tmp[effect].dur = 3 end
  134.             end
  135.             return init_dam
  136.         end
  137.     end,
  138. }
  139.  
  140. newDamageType{
  141.     name = "aging temporal", type = "TEMPORAL_AGING",
  142.     projector = function(src, x, y, type, dam, state)
  143.         state = initState(state)
  144.         useImplicitCrit(src, state)
  145.  
  146.         if _G.type(dam) == "number" then dam = {dam=dam, chance=25, apply=src:combatSpellpower()} end
  147.        
  148.         local target = game.level.map(x, y, Map.ACTOR)
  149.         if not target or target.dead then return end
  150.        
  151.         local eff = rng.range(1, 3)
  152.         local power = dam.apply_power or src:combatSpellpower()
  153.         local dur = dam.dur or 2
  154.         -- Pull random effect
  155.         if eff == 1 then
  156.             if target:canBe("blind") then
  157.                 target:setEffect(target.EFF_BLINDED, dur, {apply_power=power, no_ct_effect=true})
  158.             else
  159.                 game.logSeen(target, "%s resists the blindness!", target.name:capitalize())
  160.             end
  161.         elseif eff == 2 then
  162.             if target:canBe("pin") then
  163.                 target:setEffect(target.EFF_PINNED, dur, {apply_power=power, no_ct_effect=true})
  164.             else
  165.                 game.logSeen(target, "%s resists the pin!", target.name:capitalize())
  166.             end
  167.         elseif eff == 3 then
  168.             if target:canBe("confusion") then
  169.                 target:setEffect(target.EFF_CONFUSED, dur, {power=50, apply_power=power, no_ct_effect=true})
  170.             else
  171.                 game.logSeen(target, "%s resists the confusion!", target.name:capitalize())
  172.             end
  173.         end
  174.         DamageType:get(DamageType.TEMPORAL).projector(src, x, y, DamageType.TEMPORAL, dam.dam, state)      
  175.     end,
  176. }
  177.  
  178. -- Scourge drake
  179. newDamageType{
  180.     name = "decaying ground", type = "DECAYING_GROUND", text_color = "#DARK_GREEN#",
  181.     projector = function(src, x, y, type, dam, state)
  182.         state = initState(state)
  183.         useImplicitCrit(src, state)
  184.         if _G.type(dam) == "number" then dam = {dam=dam} end
  185.         DamageType:get(DamageType.BLIGHT).projector(src, x, y, DamageType.BLIGHT, dam.dam)
  186.         local target = game.level.map(x, y, Map.ACTOR)
  187.         if target and target:canBe("slow") then
  188.             target:setEffect(target.EFF_DECAYING_GROUND, 3, { power=dam.power or 10 })
  189.         end
  190.     end,
  191. }
  192.  
  193. newDamageType{
  194.     name = "defiled blood", type = "DEFILED_BLOOD", text_color = "#BLACK#",
  195.     projector = function(src, x, y, type, dam, state)
  196.         state = initState(state)
  197.         useImplicitCrit(src, state)
  198.  
  199.         local target = game.level.map(x, y, Map.ACTOR)
  200.         if not target then return end
  201.  
  202.         local tentacle = src:callTalent(src.T_MUTATED_HAND, "getTentacleCombat")
  203.         if not tentacle then return end
  204.  
  205.         local speed, hit = src:attackTargetWith(target, tentacle, DamageType.DARKNESS, dam)
  206.         if hit then
  207.             target:setEffect(target.EFF_DEFILED_BLOOD, 2, {power=src:callTalent(src.T_DEFILED_BLOOD, "getHeal")})
  208.         end
  209.         game.level.map:particleEmitter(x, y, 1, "tentacle_ground", {img="tentacle_black"})
  210.     end,
  211. }
  212.  
  213. newDamageType{
  214.     name = "antropy energies", type = "ENTROPIC_VOID_HELPER", text_color = "#GOLD#",
  215.     projector = function(src, x, y, type, dam, state)
  216.         state = initState(state)
  217.         useImplicitCrit(src, state)
  218.  
  219.         local target = game.level.map(x, y, Map.ACTOR)
  220.         if not target then return end
  221.  
  222.         target:removeEffect(target.EFF_TOTAL_COLLAPSE, false, true)
  223.  
  224.         local npc = game.level:findEntity{define_as="HYPOSTASIS"}
  225.         if not npc then return end
  226.  
  227.         game.level.data.antropic_accumulation = (game.level.data.antropic_accumulation or 0) + 1
  228.         if game.level.data.antropic_accumulation > 10 then
  229.             game.logSeen(npc, "#PURPLE#The %s fully awakens as you absorb antropic forces!", npc.name)
  230.             npc:awakenAntropic()
  231.             game.level.data.antropic_accumulation = 0
  232.         else
  233.             game.logSeen(npc, "#PURPLE#The %s seems to shudder as you absorb some antropic forces.", npc.name)
  234.         end
  235.     end,
  236. }
Advertisement
Add Comment
Please, Sign In to add comment