Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. $('#str').on('input', function (){
  2. let modificador = $('.str-mod');
  3. let rank = $('.str-rank');
  4.  
  5. if (this.value == '' || this.value == 0) {
  6. rank.text('F');
  7. modificador.text('-10 ');
  8. }
  9. else {
  10.  
  11. let modificadorStatusBase = -5;
  12. let modificadorBase = Math.floor(this.value / 2) + modificadorStatusBase;
  13.  
  14. modificador.text( (modificadorBase < 0 ? '' :'+') + modificadorBase + ' ');
  15.  
  16. switch (this.value) {
  17. case this.value >= 4 && this.value <= 9:
  18. rank.text('D');
  19. break;
  20. case this.value >= 10 && this.value <= 15:
  21. rank.text('C');
  22. break;
  23. case this.value >= 16 && this.value <= 21:
  24. rank.text('B');
  25. default:
  26. rank.text('E');
  27. break;
  28. }
  29. }
  30. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement