Advertisement
KujiUn

TAKE DAMAGE WITH DR

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