Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $('#str').on('input', function (){
- let modificador = $('.str-mod');
- let rank = $('.str-rank');
- if (this.value == '' || this.value == 0) {
- rank.text('F');
- modificador.text('-10 ');
- }
- else {
- let modificadorStatusBase = -5;
- let modificadorBase = Math.floor(this.value / 2) + modificadorStatusBase;
- modificador.text( (modificadorBase < 0 ? '' :'+') + modificadorBase + ' ');
- switch (this.value) {
- case this.value >= 4 && this.value <= 9:
- rank.text('D');
- break;
- case this.value >= 10 && this.value <= 15:
- rank.text('C');
- break;
- case this.value >= 16 && this.value <= 21:
- rank.text('B');
- default:
- rank.text('E');
- break;
- }
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement