PageRenderTime 37ms CodeModel.GetById 24ms RepoModel.GetById 1ms app.codeStats 0ms

/scripts/globals/abilities/feral_howl.lua

https://gitlab.com/Gas-Giant/Gas-Giant-Server
Lua | 87 lines | 39 code | 12 blank | 36 comment | 8 complexity | fcea8cc89c72eaa755cbc8cdb825ac2e MD5 | raw file
Possible License(s): GPL-3.0
  1. ---------------------------------------------------
  2. -- Ability: Feral Howl
  3. -- Terrorizes the target.
  4. -- Obtained: Beastmaster Level 75
  5. -- Recast Time: 0:05:00
  6. -- Duration: Apprx. 0:00:01 - 0:00:10
  7. ---------------------------------------------------
  8. require("scripts/globals/settings");
  9. require("scripts/globals/status");
  10. -----------------------------------
  11. -- onAbilityCheck
  12. -----------------------------------
  13. function onAbilityCheck(player,target,ability)
  14. return 0,0;
  15. end;
  16. -----------------------------------
  17. -- onUseAbility
  18. -----------------------------------
  19. function onUseAbility(player,target,ability)
  20. local modAcc = player:getMerit(MERIT_FERAL_HOWL);
  21. --printf("modAcc : %u",modAcc);
  22. local feralHowlMod = player:getMod(MOD_FERAL_HOWL_DURATION);
  23. --printf("feralHowlMod : %u",feralHowlMod);
  24. local duration = 10;
  25. --printf("Duration : %u",duration);
  26. if target:hasStatusEffect(EFFECT_TERROR) == true or target:hasStatusEffect(EFFECT_STUN) == true then -- effect already on, or target stunned, do nothing
  27. -- reserved for miss based on target already having stun or terror effect active
  28. else
  29. -- Calculate duration.
  30. if feralHowlMod >= 1 then
  31. -- http://wiki.ffxiclopedia.org/wiki/Monster_Jackcoat_(Augmented)_%2B2
  32. -- add 20% duration per merit level if wearing Augmented Monster Jackcoat +2
  33. duration = (duration + (duration * modAcc * 0.04)); -- modAcc returns intervals of 5. (0.2 / 5 = 0.04)
  34. --printf("Duration post merit : %u",duration);
  35. end
  36. end
  37. -- Leaving potency at 1 since I am not sure it applies with this ability... no known way to increase resistance
  38. local potency = 1;
  39. --printf("Potency : %u",potency);
  40. -- Grabbing variables for terror accuracy. Unknown if ability is stat based. Using Beastmaster's level versus Target's level
  41. local pLvl = player:getMainLvl();
  42. --printf("player level : %u",pLvl);
  43. local mLvl = target:getMainLvl();
  44. --printf("mob level : %u",mLvl);
  45. -- Checking level difference between the target and the BST
  46. local dLvl = (mLvl - pLvl);
  47. --printf("level difference : %u",dLvl);
  48. -- Determining what level of resistance the target will have to the ability
  49. local resist = 0
  50. dLvl = (10 * dLvl) - modAcc; -- merits increase accuracy by 5% per level
  51. if dLvl <= 0 then -- default level difference to 1 if mob is equal to the Beastmaster's level or less.
  52. resist = 1;
  53. --printf("resist : %u",resist);
  54. else
  55. resist = math.random(1,(dLvl + 100)); -- calculate chance of missing based on number of levels mob is higher than you. Target gets 10% resist per level over BST
  56. --printf("resist : %u",resist);
  57. end
  58. -- Adjusting duration based on resistance. Only fair way I could see to do it...
  59. if resist >= 20 then
  60. if (resist / 10) >= (duration) then
  61. duration = (duration - math.random(1,(duration - 2)));
  62. --printf("Duration post resist : %u",duration);
  63. else
  64. duration = (duration - math.random(1,(resist / 10)));
  65. --printf("Duration post resist : %u",duration);
  66. end
  67. end
  68. -- execute ability based off of resistance value; space reserved for resist message
  69. if resist <= 90 then -- still experimental. not exactly sure how to calculate hit %
  70. target:addStatusEffect(EFFECT_TERROR,potency,0,duration);
  71. else
  72. -- reserved for text related to resist
  73. end
  74. return EFFECT_TERROR;
  75. end;