Advertisement
KujiUn

Take Damage (now with DR)

Sep 13th, 2016
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.79 KB | None | 0 0
  1. /me
  2. [h:setProperty("None", 0)]
  3. [h:input(
  4. "damage|0|Amount of damage or healing done",
  5. "reduce|DEF,SPDEF,None|Defense Type|RADIO|VALUE=STRING",
  6. "type|x0.25,x0.5,x0.75,x1,x1.25,x1.5,x2|Type Resistance or Weakness|LIST|SELECT=3"
  7. )]
  8.  
  9. [h,switch(type):
  10. case 0: eff = 0.25;
  11. case 1: eff = 0.5;
  12. case 2: eff = 0.75;
  13. case 4: eff = 1.25;
  14. case 5: eff = 1.5;
  15. case 6: eff = 2;
  16. default: eff = 1
  17. ]
  18.  
  19. [h,if(damage<0), CODE:
  20. {
  21. [h:HP = min(HP - damage,MaxHP)]
  22. [h,if(HP>0): setState("KO",0)]
  23. [h,if(HP==MaxHP): newline=add("<br>", token.name, " has been healed to full HP!"); newline=""]
  24. [h:message=add("has been healed for ", abs(damage), "HP!", newline)]
  25. };
  26. {
  27. [h,if(getProperty(reduce) == 0):reduction = 0; reduction = getProperty(reduce) + DR]
  28. [h,if(damage > 0):actualDamage = max(floor((damage-reduction)*eff), 1); actualDamage = 0]
  29. [h:oldInjuries = Injuries]
  30. [h,if(actualDamage >= NormalMaxHP/2):Injuries = Injuries + 1]
  31. [h:oldHPCount = ceil(HP/NormalMaxHP*2)]
  32. [h:HP = (HP - actualDamage)]
  33. [h:HPCount = ceil(HP/NormalMaxHP*2)]
  34. [h:Injuries = Injuries - HPCount + oldHPCount]
  35. [h,if(HP<1): setState("KO",1)]
  36. [h:message=add("has been hit with ", actualDamage, " damage!")]
  37. [h:injuriesTaken=Injuries-oldInjuries]
  38. [h,if(injuriesTaken>0):message = add(message, "<br>", token.name, " has taken ", injuriesTaken, " injuries!")]
  39. [h,if(Injuries<10 && HP<=-2*NormalMaxHP && HP<=-50): message = add(message, "<br>", token.name, " might be dead...")]
  40. [h,if(Injuries>=10):message = add(message, "<br>", token.name, " has died from injuries...")]
  41. [h,if(Injuries>=10):setState("KO",0)]
  42. [h,if(Injuries>=10):setState("Dead",1)]
  43. }]
  44. [h,if(Injuries>=10):setBar("Health",0);setBar("Health",HP/MaxHP)]
  45. [r:message]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement