Advertisement
Guest User

Untitled

a guest
Jan 21st, 2018
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.74 KB | None | 0 0
  1. -- Solipsism speed effects; calculated before the actor gets energy
  2. local current_psi_percentage = self:getPsi() / self:getMaxPsi()
  3. local clarity
  4. if self:knowTalent(self.T_CLARITY) then
  5. clarity = self:callTalent(self.T_CLARITY,"getClarityThreshold")
  6. end
  7. local eff_solipsis = math.min(self:attr("solipsism_threshold") or 0,clarity or 1) -- effective solipsism_threshold
  8. if self:attr("solipsism_threshold") and current_psi_percentage < eff_solipsis then
  9. local solipsism_power = eff_solipsis - current_psi_percentage
  10. if self:hasEffect(self.EFF_CLARITY) then
  11. self:removeEffect(self.EFF_CLARITY)
  12. end
  13. local p = self:hasEffect(self.EFF_SOLIPSISM)
  14. if (p and p.power ~= solipsism_power) or not p then
  15. self:setEffect(self.EFF_SOLIPSISM, 1, {power = solipsism_power})
  16. end
  17. elseif clarity and current_psi_percentage > clarity then
  18. local clarity_power = math.min(1, current_psi_percentage - clarity)
  19. if self:hasEffect(self.EFF_SOLIPSISM) then
  20. self:removeEffect(self.EFF_SOLIPSISM)
  21. end
  22. local p = self:hasEffect(self.EFF_CLARITY)
  23. if (p and p.power ~= clarity_power) or not p then
  24. self:setEffect(self.EFF_CLARITY, 1, {power = math.min(1, current_psi_percentage - clarity)})
  25. end
  26. elseif self:hasEffect(self.EFF_SOLIPSISM) then
  27. self:removeEffect(self.EFF_SOLIPSISM)
  28. elseif self:hasEffect(self.EFF_CLARITY) then
  29. self:removeEffect(self.EFF_CLARITY)
  30. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement