Revert item action bar
This commit is contained in:
@@ -11,8 +11,8 @@
|
|||||||
let itemActionDelayDuration = 0;
|
let itemActionDelayDuration = 0;
|
||||||
let itemActionDelayStart = 0;
|
let itemActionDelayStart = 0;
|
||||||
let itemActionDelayEnabled = false;
|
let itemActionDelayEnabled = false;
|
||||||
let itemActionDelayPosition = toVector2(0, game.height - 10);
|
let itemActionDelayPosition = toVector2(game.width / 2 - 100, game.height - 10);
|
||||||
let itemActionDelaySize = toVector2(game.width, 10);
|
let itemActionDelaySize = toVector2(200, 5);
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
|
|||||||
@@ -118,20 +118,7 @@ function blackJackHitCommand(command, params, client) {
|
|||||||
|
|
||||||
hand.push(deck.pop());
|
hand.push(deck.pop());
|
||||||
|
|
||||||
let tempHandValue = 0;
|
let tempHandValue = getValueOfBlackJackHand(hand);
|
||||||
|
|
||||||
for (let i in hand) {
|
|
||||||
if (hand[i].value == 1) {
|
|
||||||
|
|
||||||
if ((tempHandValue + 11) > 21) {
|
|
||||||
tempHandValue += 1;
|
|
||||||
} else {
|
|
||||||
tempHandValue += 11;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
tempHandValue += hand[i].value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (handValue > 21) {
|
if (handValue > 21) {
|
||||||
playerBustBlackJack(client);
|
playerBustBlackJack(client);
|
||||||
@@ -155,14 +142,6 @@ function blackJackStandCommand(command, params, client) {
|
|||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function blackJackHit(hand, deck) {
|
|
||||||
|
|
||||||
|
|
||||||
return handValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ===========================================================================
|
|
||||||
|
|
||||||
function dealPlayerBlackJackHand(deck, players) {
|
function dealPlayerBlackJackHand(deck, players) {
|
||||||
// Alternate handing cards to each player, 2 cards each
|
// Alternate handing cards to each player, 2 cards each
|
||||||
for (var i = 0; i < 2; i++) {
|
for (var i = 0; i < 2; i++) {
|
||||||
@@ -175,3 +154,22 @@ function dealPlayerBlackJackHand(deck, players) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
|
function calculateValueOfBlackJackHand(hand) {
|
||||||
|
let tempHandValue = 0;
|
||||||
|
|
||||||
|
for (let i in hand) {
|
||||||
|
if (hand[i].value == 1) {
|
||||||
|
|
||||||
|
if ((tempHandValue + 11) > 21) {
|
||||||
|
tempHandValue += 1;
|
||||||
|
} else {
|
||||||
|
tempHandValue += 11;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
tempHandValue += hand[i].value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ===========================================================================
|
||||||
Reference in New Issue
Block a user