Advertisement
Guest User

Untitled

a guest
Nov 8th, 2019
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 5.02 KB | None | 0 0
  1. newTalent{
  2.     name = "Blood Shield", short_name = "DEMON_SEED_BLOOD_SHIELD",
  3.     type = {"corruption/demon-seeds",1},
  4.     points = 5,
  5.     mode = "sustained",
  6.     drain_vim = 2,
  7.     cooldown = 10,
  8.     tactical = { BUFF = 10, },
  9.     no_energy = true,
  10.     getPercent = function(self, t) return self:combatTalentScale(t, 100, 220) end,
  11.     on_pre_use = function(self, t, silent) if not self:hasShield() then if not silent then game.logPlayer(self, "You require a weapon and a shield to use this talent.") end return false end return true end,
  12.     callbackOnRest = function(self, t)  -- Make sure we've actually started resting/running before disabling the sustain
  13.         if self.resting.cnt and self.resting.cnt <= 0 then return end
  14.         self:forceUseTalent(t.id, {ignore_cooldown=true, ignore_energy=true})
  15.     end,
  16.     callbackOnRun = function(self, t)
  17.         if self.running.cnt and self.running.cnt <= 0 then return end
  18.         self:forceUseTalent(t.id, {ignore_cooldown=true, ignore_energy=true})
  19.     end,
  20.     callbackOnMeleeHit = function(self, t, src, dam)
  21.         if not src.x then return end
  22.         local block = self:combatShieldBlock()
  23.         if not block then return end
  24.  
  25.         DamageType:get(DamageType.SHADOWFLAME).projector(src, src.x, src.y, DamageType.SHADOWFLAME, block * 0.35 * t.getPercent(self, t) / 100)
  26.     end,
  27.     activate = function(self, t)
  28.         local block = self:combatShieldBlock()
  29.         if not block then return end
  30.  
  31.         local ret = {}
  32.         self:talentTemporaryValue(ret, "flat_damage_armor", {all=block * 0.15})
  33.         local h2x, h2y = self:attachementSpot("hand2", true) if h2x then ret.particle = self:addParticles(Particles.new("blood_shield", 1, {x=h2x, y=h2y-0.1})) end
  34.         return ret
  35.     end,
  36.     deactivate = function(self, t, p)
  37.         self:removeParticles(p.particle)
  38.         return true
  39.     end,
  40.     info = function(self, t)
  41.         return ([[By channeling doom forces in your shield you constantly apply 15%% of its block value as a flat damage reduction against all damage.
  42.         Whenever you are hit in melee your shield retaliates automatically for %d%% of its block value as fire and darkness damage.]]):
  43.         format(0.35 * t.getPercent(self, t))
  44.     end,
  45. }
  46.  
  47. ---
  48.  
  49. newTalent{
  50.     name = "Last Stand",
  51.     type = {"technique/shield-defense", 4},
  52.     require = techs_req4,
  53.     mode = "sustained",
  54.     points = 5,
  55.     cooldown = 8,
  56.     sustain_stamina = 30,
  57.     tactical = { DEFEND = 3 },
  58.     callbackOnRest = function(self, t)  -- Make sure we've actually started resting/running before disabling the sustain
  59.         if self.resting.cnt and self.resting.cnt <= 0 then return end
  60.         self:forceUseTalent(t.id, {ignore_cooldown=true, ignore_energy=true})
  61.     end,
  62.     callbackOnRun = function(self, t)
  63.         if self.running.cnt and self.running.cnt <= 0 then return end
  64.         self:forceUseTalent(t.id, {ignore_cooldown=true, ignore_energy=true})
  65.     end,
  66.     no_npc_use = true,
  67.     no_energy = true,
  68.     on_pre_use = function(self, t, silent) if not self:hasShield() then if not silent then game.logPlayer(self, "You require a weapon and a shield to use this talent.") end return false end return true end,
  69.     lifebonus = function(self,t, base_life) -- Scale bonus with max life
  70.         return self:combatTalentStatDamage(t, "con", 30, 500) + (base_life or self.max_life) * self:combatTalentLimit(t, 1, 0.02, 0.10) -- Limit <100% of base life
  71.     end,
  72.     getDefense = function(self, t) return self:combatTalentStatDamage(t, "dex", 6, 20) end,
  73.     getArmor = function(self, t) return self:combatTalentStatDamage(t, "dex", 6, 20) end,
  74.     activate = function(self, t)
  75.         local shield = self:hasShield()
  76.         if not shield then
  77.             game.logPlayer(self, "You cannot use Last Stand without a shield!")
  78.             return nil
  79.         end
  80.         local hp = t.lifebonus(self,t)
  81.         local ret = {
  82.             base_life = self.max_life,
  83.             max_life = self:addTemporaryValue("max_life", hp),
  84.             def = self:addTemporaryValue("combat_def", t.getDefense(self, t)),
  85.             armor = self:addTemporaryValue("combat_armor", t.getArmor(self, t)),
  86.             nomove = self:addTemporaryValue("never_move", 1),
  87.             dieat = self:addTemporaryValue("die_at", -hp),
  88.             extra_life = self:addTemporaryValue("life", hp), -- Avoid healing effects
  89.         }
  90.         return ret
  91.     end,
  92.     deactivate = function(self, t, p)
  93.         self:removeTemporaryValue("combat_def", p.def)
  94.         self:removeTemporaryValue("combat_armor", p.armor)
  95.         self:removeTemporaryValue("max_life", p.max_life)
  96.         self:removeTemporaryValue("never_move", p.nomove)
  97.         self:removeTemporaryValue("die_at", p.dieat)
  98.         self:removeTemporaryValue("life", p.extra_life)
  99.         return true
  100.     end,
  101.     info = function(self, t)
  102.         local hp = self:isTalentActive(self.T_LAST_STAND)
  103.         if hp then
  104.             hp = t.lifebonus(self, t, hp.base_life)
  105.         else
  106.             hp = t.lifebonus(self,t)
  107.         end
  108.         return ([[You brace yourself for the final stand, increasing Defense and Armor by %d, maximum and current life by %d, but making you unable to move.
  109.         Your stand lets you concentrate on every blow, allowing you to avoid death from normally fatal wounds. You can only die when reaching -%d life.
  110.         The increase in Defense and Armor is based on your Dexterity, and the increase in life is based on your Constitution and normal maximum life.]]):
  111.         format(t.getDefense(self, t), hp, hp)
  112.     end,
  113. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement