added reward checking
This commit is contained in:
parent
71665f6984
commit
f03997c4a4
6 changed files with 90 additions and 18 deletions
|
@ -7,6 +7,7 @@ function RollOnInterface(muteSound = false, animation = true, times = 1) {
|
|||
|
||||
|
||||
if (animation) {
|
||||
if (muteSound == false) {soundEffects.hit.play();};
|
||||
app_dice_appearanceToggle(false);
|
||||
};
|
||||
|
||||
|
@ -19,8 +20,6 @@ function RollOnInterface(muteSound = false, animation = true, times = 1) {
|
|||
function playSound() {
|
||||
if (roll.result) {
|
||||
soundEffects.ding.play()
|
||||
} else {
|
||||
soundEffects.fallout.play()
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -43,7 +42,7 @@ function RollOnInterface(muteSound = false, animation = true, times = 1) {
|
|||
$(dice_identifier).addClass(dice_className);
|
||||
|
||||
if ((value_dices_current == 4) || (value_dices_current == 1)) {
|
||||
$(dice_identifier).addClass('orange-text');
|
||||
$(dice_identifier).addClass('red-text text-accent-1');
|
||||
} else {
|
||||
$(dice_identifier).addClass('white-text');
|
||||
}
|
||||
|
@ -51,6 +50,25 @@ function RollOnInterface(muteSound = false, animation = true, times = 1) {
|
|||
|
||||
};
|
||||
|
||||
function showReward() {
|
||||
let results = roll.result;
|
||||
|
||||
switch (results) {
|
||||
case 1: M.toast({text: '', html: '<h4>Six fours!</h4>'}); break;
|
||||
case 1.1: M.toast({text: '', html: '<h4>Six ones!</h4>'}); break;
|
||||
case 1.2: M.toast({text: '', html: '<h4>Six of a kind!</h4>'}); break;
|
||||
case 1.3: M.toast({text: '', html: '<h4>Five fours!</h4>'}); break;
|
||||
case 1.4: M.toast({text: '', html: '<h4>Five of a kind!</h4>'}); break;
|
||||
case 1.5: M.toast({text: '', html: '<h4>Four fours!</h4>'}); break;
|
||||
case 2: M.toast({text: '', html: '<h4>Straight!</h4>'}); break;
|
||||
case 2.1: M.toast({text: '', html: '<h4>Three of a kind!</h4>'}); break;
|
||||
case 3: M.toast({text: '', html: '<h4>Four of a kind!</h4>'}); break;
|
||||
case 4: M.toast({text: '', html: '<h4>Three fours!</h4>'}); break;
|
||||
case 5: M.toast({text: '', html: '<h4>Two fours!</h4>'}); break;
|
||||
case 6: M.toast({text: '', html: '<h4>One four!</h4>'}); break;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
function rollEffect() {
|
||||
$('.btn-floating').removeClass('pulse');
|
||||
|
@ -61,10 +79,8 @@ function RollOnInterface(muteSound = false, animation = true, times = 1) {
|
|||
};
|
||||
|
||||
setTimeout(function() {
|
||||
rollEffect();
|
||||
rollEffect(); showReward();
|
||||
}, 750);
|
||||
|
||||
instance.next();
|
||||
|
||||
return (roll);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue