diff options
-rw-r--r-- | images/die_black_pips.svg | 37 | ||||
-rw-r--r-- | play.css | 24 | ||||
-rw-r--r-- | play.js | 28 | ||||
-rw-r--r-- | rules.js | 34 |
4 files changed, 83 insertions, 40 deletions
diff --git a/images/die_black_pips.svg b/images/die_black_pips.svg new file mode 100644 index 0000000..d641f28 --- /dev/null +++ b/images/die_black_pips.svg @@ -0,0 +1,37 @@ +<svg xmlns="http://www.w3.org/2000/svg" width="336" height="56"> +<g fill="black"> +<g transform="translate(0 0)"> +<circle r="6" cx="28" cy="28"/> +</g> +<g transform="translate(56 0)"> +<circle r="6" cx="12" cy="12"/> +<circle r="6" cx="44" cy="44"/> +</g> +<g transform="translate(112 0)"> +<circle r="6" cx="12" cy="44"/> +<circle r="6" cx="44" cy="12"/> +<circle r="6" cx="28" cy="28"/> +</g> +<g transform="translate(168 0)"> +<circle r="6" cx="12" cy="12"/> +<circle r="6" cx="12" cy="44"/> +<circle r="6" cx="44" cy="12"/> +<circle r="6" cx="44" cy="44"/> +</g> +<g transform="translate(224 0)"> +<circle r="6" cx="12" cy="12"/> +<circle r="6" cx="12" cy="44"/> +<circle r="6" cx="44" cy="12"/> +<circle r="6" cx="44" cy="44"/> +<circle r="6" cx="28" cy="28"/> +</g> +<g transform="translate(280 0)"> +<circle r="6" cx="12" cy="12"/> +<circle r="6" cx="12" cy="28"/> +<circle r="6" cx="12" cy="44"/> +<circle r="6" cx="44" cy="12"/> +<circle r="6" cx="44" cy="28"/> +<circle r="6" cx="44" cy="44"/> +</g> +</g> +</svg> @@ -18,7 +18,6 @@ header.your_turn { background-color: orange; } }
#deck_stat {padding-left: 5px; padding-bottom: 5px;}
-#tank {margin-right: 0;}
#log { background-color: whitesmoke; }
#log .h1 { font-weight: bold; padding-top:2px; padding-bottom:2px; text-align: center; }
@@ -43,10 +42,25 @@ header.your_turn { background-color: orange; } #log .card_name:hover { text-decoration: underline; }
#log .space_tip:hover { cursor: pointer; text-decoration: underline; }
-/* Below currently not used
-#log .lord_tip:hover { cursor: pointer; text-decoration: underline; }
-
-#log .way_tip:hover { cursor: pointer; text-decoration: underline; } */
+#log .die {
+ display: inline-block;
+ vertical-align: -3px;
+ width: 12px;
+ height: 12px;
+ background-size: 600% 100%;
+ background-repeat: no-repeat;
+ background-image: url(images/die_black_pips.svg);
+ background-color: #fff;
+ border: 1px solid #444;
+}
+
+#log .d0 { background-position: -100% 0 }
+#log .d1 { background-position: 0% 0; }
+#log .d2 { background-position: 20% 0; }
+#log .d3 { background-position: 40% 0; }
+#log .d4 { background-position: 60% 0; }
+#log .d5 { background-position: 80% 0; }
+#log .d6 { background-position: 100% 0; }
.selected {
cursor: pointer;
@@ -228,17 +228,6 @@ function on_log(text) { // eslint-disable-line no-unused-vars let p = document.createElement("div")
-
-/*
- let last_text = last_log_entry ? last_log_entry.split(' ') : []
- console.log('last text', last_text, 'text', text.split(' ')[3])
- if (last_text[0] === 'Added' && last_text[4] === text.split(' ')[4]) {
- let new_influence = parseInt(last_text[1]) + 1
- new_text = `Added ${new_influence} influence in ${last_text[4]}`
- console.log('new_influence', new_influence, 'new_text', new_text)
- } */
-
-
if (text.match(/^>/)) {
text = text.substring(1)
p.className = 'i'
@@ -249,6 +238,7 @@ function on_log(text) { // eslint-disable-line no-unused-vars text = text.replace(/P(\d+)/g, sub_power_card_name)
text = text.replace(/V(\d+)/g, sub_power_card_value)
text = text.replace(/%(\d+)/g, sub_space_name)
+ text = text.replace(/\b[D][1-6]\b/g, sub_die)
if (text.match(/^\.h1/)) {
@@ -272,13 +262,6 @@ function on_log(text) { // eslint-disable-line no-unused-vars p.className = 'h3'
}
- //console.log('view.log', view.log)
- /*console.log('new text', text)
- if (last_log_entry_text) {
- console.log('log = text', last_log_entry_text === text)
- }
-
-*/
p.innerHTML = text
return p
}
@@ -741,6 +724,15 @@ function sub_die(match) { return die[match] || match
}
+const die = {
+ D1: '<span class="die white d1"></span>',
+ D2: '<span class="die white d2"></span>',
+ D3: '<span class="die white d3"></span>',
+ D4: '<span class="die white d4"></span>',
+ D5: '<span class="die white d5"></span>',
+ D6: '<span class="die white d6"></span>'
+}
+
// =========================== VISUAL FUNCTIONS ==========================================#
function on_focus_card_tip(card_number) {
@@ -1406,7 +1406,7 @@ states.power_struggle = { },
roll () {
let roll = Math.floor(Math.random() * 6) + 1
- log(`Rolled a ${roll}`)
+ log(`Roll: D${roll}`)
if (roll >= power_cards[game.played_power_card].value) {
log('Initiative roll successful')
game.phase = 0
@@ -1516,7 +1516,7 @@ states.support_loss ={ let roll = Math.floor(Math.random() * 6) + 1
let rally_win = 0
let petition_win = 0
- log(`Rolled a ${roll}`)
+ log(`Roll: D${roll}`)
if ((game.played_power_card >= 25 && game.played_power_card <= 30) || game.played_power_card === 53) { rally_win = 2}
if ((game.played_power_card >= 31 && game.played_power_card <= 36) || game.played_power_card === 54) { petition_win = 2}
let modified_roll = roll + game.raised_stakes + rally_win - petition_win
@@ -1585,7 +1585,7 @@ states.vp_roll = { },
roll () {
let roll = Math.floor(Math.random() * 6) + 1
- log(`Rolled a ${roll}`)
+ log(`Roll: D${roll}`)
let rally_win = 0
let petition_win = 0
if ((game.played_power_card >= 25 && game.played_power_card <= 30) || game.played_power_card === 53) {rally_win = 2}
@@ -1906,7 +1906,7 @@ states.general_strike = { roll() {
clear_undo()
let roll = Math.floor(Math.random() * 6) + 1
- log(`Rolled a ${roll}`)
+ log(`Roll: D${roll}`)
log(`+${game.available_ops} from card ops`)
@@ -2285,7 +2285,7 @@ function do_sc(space) { // Continue with Support Check Logic
let roll = Math.floor(Math.random() * 6) + 1
- log(`Rolled a ${roll}`)
+ log(`Roll: D${roll}`)
console.log('game.vm_event', game.vm_event)
console.log('game.is_pwr_struggle', game.is_pwr_struggle)
/*
@@ -2761,7 +2761,7 @@ function check_com_control(space_id) { function do_tst_attempt() {
let roll = Math.floor(Math.random() * 6) + 1;
- log(`Rolled a ${roll}`);
+ log(`Roll: D${roll}`);
roll += game.available_ops
log(`+${game.available_ops} from card ops`)
@@ -6414,7 +6414,7 @@ states.vm_adamec = { roll() {
clear_undo()
let roll = Math.floor(Math.random() * 6) + 1
- log(`Rolled a ${roll}`)
+ log(`Roll: D${roll}`)
let worker_spaces = spaces.filter(space => space && space.country === 'Czechoslovakia' && space.socio === 4 && check_dem_control(space.space_id)).length
if (worker_spaces > 0) {
log(`-${worker_spaces} from Democrat controlled worker spaces`)
@@ -6601,7 +6601,7 @@ states.vm_dash_for_the_west = { roll() {
clear_undo()
let roll = Math.floor(Math.random() * 6) + 1
- log(`Rolled a ${roll}`)
+ log(`Roll: D${roll}`)
let com_control = check_presence('East_Germany').com_spaces
if (roll > com_control) {
@@ -7366,7 +7366,7 @@ states.vm_malta_summit = { roll() {
clear_undo()
let roll = Math.floor(Math.random() * 6) + 1
- log(`Rolled a ${roll}`)
+ log(`Roll: D${roll}`)
if (game.stability > 0) {
log(`+${game.stability} from USSR Stability Track`)
log(`Modified roll: ${roll + game.stability}`)
@@ -7412,11 +7412,11 @@ states.vm_modrow = { let roll = Math.floor(Math.random() * 6) + 1
let dem_spaces = spaces.filter(space => space && space.country === 'East_Germany' && check_dem_control(space.space_id)).length
if (roll > dem_spaces) {
- log(`Rolled a ${roll}`)
+ log(`Roll: D${roll}`)
log(`Success. More than the ${dem_spaces} Democratically controlled spaces`)
vm_next()
} else {
- log(`Rolled a ${roll}`)
+ log(`Roll: D${roll}`)
log(`Fail. More than ${dem_spaces} required`)
permanently_remove(83)
vm_return()
@@ -7441,13 +7441,13 @@ states.vm_nepotism = { clear_undo()
let roll = Math.floor(Math.random() * 6) + 1
if (roll < 3) {
- log(`Rolled a ${roll}: adds 4 SPs`)
+ log(`Roll: D${roll} adds 4 SPs`)
game.vm_available_ops = 4}
else if (roll < 5 ) {
- log(`Rolled a ${roll}: adds 3 SPs`)
+ log(`Roll: D${roll} adds 3 SPs`)
game.vm_available_ops = 3}
else {
- log(`Rolled a ${roll}: adds 1 SP`)
+ log(`Roll: D${roll} adds 1 SP`)
game.vm_available_ops = 1}
//game.phase = 2
vm_next()
@@ -7697,7 +7697,7 @@ states.vm_shock_therapy = { worker_farmer++
}
}
- log(`Rolled a ${roll}`)
+ log(`Roll: D${roll}`)
log(`-${worker_farmer} from Communist controlled Worker and Farmer spaces`)
log(`Modified roll: ${roll - worker_farmer}`)
if ((roll - worker_farmer) > 2) {
@@ -7924,7 +7924,7 @@ states.vm_the_wall_must_go = { }
let roll = Math.floor(Math.random() * 6) + 1
- log(`Rolled a ${roll}`)
+ log(`Roll: D${roll}`)
if (game.active === DEM) {
let controlled_spaces = spaces.filter(space => space && space.country === 'East_Germany' && check_dem_control(space.space_id)).length
if (controlled_spaces > 0) {
@@ -8142,7 +8142,7 @@ states.vm_workers_revolt_finish = { roll() {
clear_undo()
let roll = Math.floor(Math.random() * 6) + 1
- log(`Rolled a ${roll}`)
+ log(`Roll: D${roll}`)
let adj = count_adj(spaces[game.selected_space].name_unique)
if (game.active === DEM) {
log(`-${adj.com_adj} from opponent controlled spaces`)
|