Guest User

swallownilcompare

a guest
May 19th, 2015
286
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.38 KB | None | 0 0
  1.  
  2. newTalent{
  3.     short_name = "X_SWALLOW",
  4.     name = "Earth Swallow",
  5.     --adapted from Swallow talent
  6.     type = {"race/Xorn_Infusions", 1},
  7.     image = "talents/swallow.png",
  8.     require = gifts_req1,
  9.     points = 4,
  10.     equilibrium = 5,
  11.     cooldown = function(self, t) return math.ceil(self:combatTalentLimit(t, 4, 10, 7)) end,
  12.     range = 1,
  13.     no_message = true,
  14.     tactical = { ATTACK = { weapon = 1 }, EQUILIBRIUM = 0.5},
  15.     requires_target = true,
  16.     no_npc_use = true,
  17.     is_melee = true,
  18.     target = function(self, t) return {type="hit", range=self:getTalentRange(t)} end,
  19.     maxSwallow = function(self, t, target) return -- Limit < 50%
  20.         self:combatLimit(self:getTalentLevel(t)*(self.size_category or 3)/(target.size_category or 3), 50, 13, 1, 25, 5)
  21.     end,
  22.     getPassiveCrit = function(self, t) return self:combatTalentScale(t, 2, 10, 0.5) end,
  23.     on_learn = function(self, t) self.resists[DamageType.PHYSICAL] = (self.resists[DamageType.PHYSICAL] or 0) + 0.5 end,
  24.     on_unlearn = function(self, t) self.resists[DamageType.PHYSICAL] = (self.resists[DamageType.PHYSICAL] or 0) - 0.5 end,
  25.     passives = function(self, t, p)
  26.         self:talentTemporaryValue(p, "combat_physcrit", t.getPassiveCrit(self, t))
  27.         self:talentTemporaryValue(p, "combat_mindcrit", t.getPassiveCrit(self, t))
  28.     end,
  29.     action = function(self, t)
  30.         local tg = self:getTalentTarget(t)
  31.         local x, y, target = self:getTarget(tg)
  32.         if not target or not self:canProject(tg, x, y) then return nil end
  33.  
  34.         self:logCombat(target, "#Source# tries to swallow #Target#!")
  35.         local hit = self:attackTarget(target, DamageType.NATURE, self:combatTalentWeaponDamage(t, 1.6, 2.5), true)
  36.         if not hit then return true end
  37.  
  38.         if (target.life * 100 / target.max_life > t.maxSwallow(self, t, target)) and not target.dead then
  39.             return true
  40.         end
  41.  
  42.         if (target:checkHit(self:combatPhysicalpower(), target:combatPhysicalResist(), 0, 95, 15) or target.dead) and (target:canBe("instakill") or target.life * 100 / target.max_life <= 5) then
  43.             if not target.dead then target:die(self) end
  44.             world:gainAchievement("EAT_BOSSES", self, target)
  45.             self:incEquilibrium(-target.level - 5)
  46.             self:attr("allow_on_heal", 1)
  47.             self:heal(target.level * 2 + 5, target)
  48.             if core.shader.active(4) then
  49.                 self:addParticles(Particles.new("shader_shield_temp", 1, {toback=true ,size_factor=1.5, y=-0.3, img="healgreen", life=25}, {type="healing", time_factor=2000, beamsCount=20, noup=2.0}))
  50.                 self:addParticles(Particles.new("shader_shield_temp", 1, {toback=false,size_factor=1.5, y=-0.3, img="healgreen", life=25}, {type="healing", time_factor=2000, beamsCount=20, noup=1.0}))
  51.             end
  52.             self:attr("allow_on_heal", -1)
  53.         else
  54.             game.logSeen(target, "%s resists!", target.name:capitalize())
  55.         end
  56.         return true
  57.     end,
  58.     info = function(self, t)
  59.         return ([[Fuse with the surrounding earth elements and attack the target for %d%% Nature weapon damage.
  60.         If the attack brings your target below %d%% life or kills it, you can try to swallow it, killing it automatically and regaining life and equilibrium depending on its level.
  61.         The chance to swallow depends on your talent level and the relative size of the target.
  62.         Levels in Swallow additionally raises your Physical and Mental critical rate by %d%%, passively.
  63.         Each point also increases your physical resistance by 0.5%%.]]):
  64.         format(100 * self:combatTalentWeaponDamage(t, 1.6, 2.5), t.maxSwallow(self, t, self), t.getPassiveCrit(self, t))
  65.     end,
  66. }
Advertisement
Add Comment
Please, Sign In to add comment