summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2022-05-10 17:33:52 +0200
committerTor Andersson <tor@ccxvii.net>2023-02-18 12:31:29 +0100
commitd0eb4841014cab1927847e2fafae3772a3c74e4e (patch)
treec2a48a3b8bd0a31e9c20828174b1906dbc85f58b
parent2f3227475004b8804e00dacfad7cdae5bc314578 (diff)
downloadpax-pamir-d0eb4841014cab1927847e2fafae3772a3c74e4e.tar.gz
Avoid using card popup menu when possible.
Click card in market to purchase without menu. Use icons on cards as action buttons instead of menu. End turn button.
-rw-r--r--cards.js332
-rw-r--r--rules.js161
2 files changed, 257 insertions, 236 deletions
diff --git a/cards.js b/cards.js
index eb90f61..c67205b 100644
--- a/cards.js
+++ b/cards.js
@@ -6,7 +6,7 @@ const cards = [
"suit": 'Intelligence',
"rank": 3,
"spies": 3,
- "move": true,
+ "move": 1,
"prize": 'Russian',
"number": 1
},
@@ -18,8 +18,8 @@ const cards = [
"armies": 1,
"spies": 2,
"climate": 'Military',
- "move": true,
- "battle": true,
+ "move": 1,
+ "battle": 2,
"prize": 'Russian',
"number": 2
},
@@ -31,7 +31,7 @@ const cards = [
"armies": 1,
"spies": 2,
"climate": 'Military',
- "battle": true,
+ "battle": 1,
"patriot": 'Afghan',
"number": 3
},
@@ -41,8 +41,8 @@ const cards = [
"suit": 'Intelligence',
"rank": 1,
"spies": 1,
- "gift": true,
- "move": true,
+ "gift": 2,
+ "move": 1,
"prize": 'Afghan',
"number": 4
},
@@ -52,7 +52,7 @@ const cards = [
"suit": 'Political',
"rank": 1,
"tribes": 1,
- "build": true,
+ "build": 1,
"prize": 'Afghan',
"number": 5
},
@@ -64,8 +64,8 @@ const cards = [
"armies": 1,
"tribes": 1,
"spies": 1,
- "build": true,
- "battle": true,
+ "build": 2,
+ "battle": 1,
"patriot": 'Afghan',
"number": 6
},
@@ -87,7 +87,7 @@ const cards = [
"roads": 2,
"spies": 1,
"climate": 'Political',
- "tax": true,
+ "tax": 1,
"number": 8
},
{
@@ -96,8 +96,8 @@ const cards = [
"suit": 'Economic',
"rank": 1,
"roads": 1,
- "tax": true,
- "move": true,
+ "tax": 2,
+ "move": 1,
"number": 9
},
{
@@ -107,8 +107,8 @@ const cards = [
"rank": 1,
"roads": 1,
"climate": 'Military',
- "build": true,
- "betray": true,
+ "build": 2,
+ "betray": 1,
"prize": 'Afghan',
"number": 10
},
@@ -118,8 +118,8 @@ const cards = [
"suit": 'Economic',
"rank": 2,
"roads": 2,
- "tax": true,
- "gift": true,
+ "tax": 2,
+ "gift": 1,
"patriot": 'Afghan',
"number": 11
},
@@ -130,7 +130,7 @@ const cards = [
"rank": 3,
"armies": 1,
"roads": 3,
- "gift": true,
+ "gift": 1,
"number": 12
},
{
@@ -139,8 +139,8 @@ const cards = [
"suit": 'Economic',
"rank": 2,
"roads": 2,
- "tax": true,
- "move": true,
+ "tax": 2,
+ "move": 1,
"prize": 'Russian',
"number": 13
},
@@ -151,8 +151,8 @@ const cards = [
"rank": 2,
"roads": 2,
"leveraged": 1,
- "gift": true,
- "build": true,
+ "gift": 2,
+ "build": 1,
"number": 14
},
{
@@ -161,7 +161,7 @@ const cards = [
"suit": 'Military',
"rank": 1,
"armies": 1,
- "betray": true,
+ "betray": 1,
"number": 15
},
{
@@ -170,8 +170,8 @@ const cards = [
"suit": 'Military',
"rank": 1,
"armies": 1,
- "tax": true,
- "betray": true,
+ "tax": 2,
+ "betray": 1,
"number": 16
},
{
@@ -180,7 +180,7 @@ const cards = [
"suit": 'Military',
"rank": 1,
"armies": 1,
- "build": true,
+ "build": 1,
"number": 17
},
{
@@ -189,8 +189,8 @@ const cards = [
"suit": 'Intelligence',
"rank": 1,
"spies": 1,
- "gift": true,
- "betray": true,
+ "gift": 2,
+ "betray": 1,
"number": 18
},
{
@@ -200,8 +200,8 @@ const cards = [
"rank": 2,
"spies": 2,
"climate": 'Economic',
- "move": true,
- "betray": true,
+ "move": 2,
+ "betray": 1,
"patriot": 'British',
"prize": 'Russian',
"number": 19
@@ -213,8 +213,8 @@ const cards = [
"rank": 1,
"spies": 1,
"climate": 'Economic',
- "gift": true,
- "move": true,
+ "gift": 2,
+ "move": 1,
"patriot": 'British',
"prize": 'Russian',
"number": 20
@@ -225,7 +225,7 @@ const cards = [
"suit": 'Intelligence',
"rank": 2,
"spies": 2,
- "move": true,
+ "move": 1,
"prize": 'Afghan',
"number": 21
},
@@ -236,8 +236,8 @@ const cards = [
"rank": 1,
"spies": 1,
"climate": 'Political',
- "gift": true,
- "move": true,
+ "gift": 1,
+ "move": 2,
"patriot": 'British',
"prize": 'Russian',
"number": 22
@@ -249,8 +249,8 @@ const cards = [
"rank": 1,
"spies": 1,
"climate": 'Economic',
- "move": true,
- "battle": true,
+ "move": 1,
+ "battle": 2,
"patriot": 'British',
"prize": 'Russian',
"number": 23
@@ -262,7 +262,7 @@ const cards = [
"rank": 2,
"armies": 1,
"tribes": 2,
- "betray": true,
+ "betray": 1,
"number": 24
},
{
@@ -271,7 +271,7 @@ const cards = [
"suit": 'Political',
"rank": 1,
"tribes": 1,
- "tax": true,
+ "tax": 1,
"patriot": 'Afghan',
"prize": 'British',
"number": 25
@@ -283,7 +283,7 @@ const cards = [
"rank": 1,
"armies": 1,
"tribes": 1,
- "betray": true,
+ "betray": 1,
"prize": 'Afghan',
"number": 26
},
@@ -294,7 +294,7 @@ const cards = [
"rank": 1,
"tribes": 1,
"leveraged": 1,
- "build": true,
+ "build": 1,
"number": 27
},
{
@@ -304,8 +304,8 @@ const cards = [
"rank": 1,
"roads": 1,
"spies": 1,
- "tax": true,
- "build": true,
+ "tax": 2,
+ "build": 1,
"prize": 'Afghan',
"number": 28
},
@@ -315,8 +315,8 @@ const cards = [
"suit": 'Economic',
"rank": 2,
"roads": 2,
- "tax": true,
- "move": true,
+ "tax": 2,
+ "move": 1,
"number": 29
},
{
@@ -327,8 +327,8 @@ const cards = [
"roads": 1,
"spies": 1,
"leveraged": 1,
- "tax": true,
- "gift": true,
+ "tax": 2,
+ "gift": 1,
"number": 30
},
{
@@ -338,8 +338,8 @@ const cards = [
"rank": 1,
"armies": 1,
"climate": 'Intelligence',
- "tax": true,
- "betray": true,
+ "tax": 2,
+ "betray": 1,
"number": 31
},
{
@@ -348,7 +348,7 @@ const cards = [
"suit": 'Military',
"rank": 3,
"armies": 3,
- "move": true,
+ "move": 1,
"patriot": 'British',
"prize": 'Afghan',
"number": 32
@@ -359,8 +359,8 @@ const cards = [
"suit": 'Military',
"rank": 2,
"armies": 2,
- "gift": true,
- "battle": true,
+ "gift": 1,
+ "battle": 2,
"number": 33
},
{
@@ -370,9 +370,9 @@ const cards = [
"rank": 1,
"armies": 1,
"climate": 'Economic',
- "move": true,
- "battle": true,
- "betray": true,
+ "move": 2,
+ "battle": 3,
+ "betray": 1,
"prize": 'British',
"number": 34
},
@@ -383,8 +383,8 @@ const cards = [
"rank": 2,
"armies": 2,
"climate": 'Political',
- "move": true,
- "battle": true,
+ "move": 1,
+ "battle": 2,
"number": 35
},
{
@@ -394,8 +394,8 @@ const cards = [
"rank": 1,
"armies": 1,
"climate": 'Intelligence',
- "battle": true,
- "betray": true,
+ "battle": 2,
+ "betray": 1,
"patriot": 'British',
"prize": 'Afghan',
"number": 36
@@ -407,8 +407,8 @@ const cards = [
"rank": 1,
"armies": 1,
"climate": 'Political',
- "move": true,
- "battle": true,
+ "move": 1,
+ "battle": 2,
"patriot": 'British',
"prize": 'Afghan',
"number": 37
@@ -419,7 +419,7 @@ const cards = [
"suit": 'Military',
"rank": 2,
"armies": 2,
- "battle": true,
+ "battle": 1,
"prize": 'British',
"number": 38
},
@@ -429,8 +429,8 @@ const cards = [
"suit": 'Intelligence',
"rank": 1,
"spies": 1,
- "move": true,
- "battle": true,
+ "move": 2,
+ "battle": 1,
"number": 39
},
{
@@ -440,8 +440,8 @@ const cards = [
"rank": 2,
"spies": 2,
"leveraged": 1,
- "tax": true,
- "move": true,
+ "tax": 2,
+ "move": 1,
"patriot": 'British',
"prize": 'Afghan',
"number": 40
@@ -452,7 +452,7 @@ const cards = [
"suit": 'Intelligence',
"rank": 2,
"spies": 2,
- "build": true,
+ "build": 1,
"number": 41
},
{
@@ -463,7 +463,7 @@ const cards = [
"tribes": 1,
"leveraged": 1,
"climate": 'Economic',
- "build": true,
+ "build": 1,
"patriot": 'Afghan',
"prize": 'Afghan',
"number": 42
@@ -475,7 +475,7 @@ const cards = [
"rank": 1,
"armies": 1,
"tribes": 1,
- "battle": true,
+ "battle": 1,
"prize": 'Afghan',
"number": 43
},
@@ -486,8 +486,8 @@ const cards = [
"rank": 1,
"armies": 1,
"tribes": 1,
- "tax": true,
- "build": true,
+ "tax": 1,
+ "build": 2,
"prize": 'Russian',
"number": 44
},
@@ -498,8 +498,8 @@ const cards = [
"rank": 1,
"armies": 1,
"tribes": 1,
- "gift": true,
- "betray": true,
+ "gift": 1,
+ "betray": 2,
"number": 45
},
{
@@ -510,7 +510,7 @@ const cards = [
"roads": 2,
"leveraged": 1,
"climate": 'Intelligence',
- "gift": true,
+ "gift": 1,
"number": 46
},
{
@@ -520,8 +520,8 @@ const cards = [
"rank": 2,
"armies": 1,
"roads": 2,
- "gift": true,
- "move": true,
+ "gift": 2,
+ "move": 1,
"prize": 'Russian',
"number": 47
},
@@ -532,8 +532,8 @@ const cards = [
"rank": 1,
"roads": 1,
"climate": 'Political',
- "build": true,
- "move": true,
+ "build": 1,
+ "move": 2,
"number": 48
},
{
@@ -543,8 +543,8 @@ const cards = [
"rank": 1,
"roads": 1,
"climate": 'Political',
- "tax": true,
- "build": true,
+ "tax": 2,
+ "build": 1,
"number": 49
},
{
@@ -553,8 +553,8 @@ const cards = [
"suit": 'Military',
"rank": 2,
"armies": 2,
- "move": true,
- "battle": true,
+ "move": 1,
+ "battle": 2,
"patriot": 'British',
"prize": 'Russian',
"number": 50
@@ -565,7 +565,7 @@ const cards = [
"suit": 'Military',
"rank": 1,
"armies": 1,
- "battle": true,
+ "battle": 1,
"patriot": 'British',
"prize": 'Russian',
"number": 51
@@ -577,8 +577,8 @@ const cards = [
"rank": 1,
"armies": 1,
"climate": 'Political',
- "tax": true,
- "battle": true,
+ "tax": 1,
+ "battle": 2,
"number": 52
},
{
@@ -588,7 +588,7 @@ const cards = [
"rank": 2,
"armies": 2,
"spies": 1,
- "betray": true,
+ "betray": 1,
"prize": 'Russian',
"number": 53
},
@@ -599,7 +599,7 @@ const cards = [
"rank": 1,
"spies": 1,
"leveraged": 1,
- "tax": true,
+ "tax": 1,
"number": 54
},
{
@@ -609,9 +609,9 @@ const cards = [
"rank": 1,
"armies": 1,
"tribes": 1,
- "tax": true,
- "move": true,
- "battle": true,
+ "tax": 2,
+ "move": 1,
+ "battle": 3,
"number": 55
},
{
@@ -621,7 +621,7 @@ const cards = [
"rank": 2,
"tribes": 2,
"climate": 'Political',
- "betray": true,
+ "betray": 1,
"prize": 'Afghan',
"number": 56
},
@@ -631,8 +631,8 @@ const cards = [
"suit": 'Political',
"rank": 1,
"tribes": 1,
- "move": true,
- "betray": true,
+ "move": 1,
+ "betray": 2,
"prize": 'British',
"number": 57
},
@@ -643,8 +643,8 @@ const cards = [
"rank": 1,
"tribes": 1,
"climate": 'Economic',
- "gift": true,
- "build": true,
+ "gift": 2,
+ "build": 1,
"patriot": 'Afghan',
"number": 58
},
@@ -654,8 +654,8 @@ const cards = [
"suit": 'Military',
"rank": 2,
"armies": 2,
- "battle": true,
- "betray": true,
+ "battle": 1,
+ "betray": 2,
"number": 59
},
{
@@ -664,9 +664,9 @@ const cards = [
"suit": 'Military',
"rank": 1,
"armies": 1,
- "tax": true,
- "gift": true,
- "battle": true,
+ "tax": 3,
+ "gift": 2,
+ "battle": 1,
"prize": 'Russian',
"number": 60
},
@@ -676,7 +676,7 @@ const cards = [
"suit": 'Economic',
"rank": 2,
"roads": 2,
- "tax": true,
+ "tax": 1,
"number": 61
},
{
@@ -686,8 +686,8 @@ const cards = [
"rank": 1,
"roads": 1,
"climate": 'Political',
- "gift": true,
- "build": true,
+ "gift": 2,
+ "build": 1,
"number": 62
},
{
@@ -696,7 +696,7 @@ const cards = [
"suit": 'Economic',
"rank": 3,
"roads": 3,
- "move": true,
+ "move": 1,
"number": 63
},
{
@@ -707,7 +707,7 @@ const cards = [
"roads": 2,
"spies": 1,
"climate": 'Military',
- "tax": true,
+ "tax": 1,
"number": 64
},
{
@@ -717,9 +717,9 @@ const cards = [
"rank": 1,
"armies": 1,
"roads": 1,
- "tax": true,
- "move": true,
- "battle": true,
+ "tax": 2,
+ "move": 1,
+ "battle": 3,
"number": 65
},
{
@@ -729,7 +729,7 @@ const cards = [
"rank": 2,
"armies": 1,
"roads": 2,
- "battle": true,
+ "battle": 1,
"prize": 'Afghan',
"number": 66
},
@@ -739,8 +739,8 @@ const cards = [
"suit": 'Economic',
"rank": 2,
"roads": 1,
- "gift": true,
- "move": true,
+ "gift": 1,
+ "move": 2,
"number": 67
},
{
@@ -750,7 +750,7 @@ const cards = [
"rank": 2,
"armies": 1,
"spies": 2,
- "tax": true,
+ "tax": 1,
"number": 68
},
{
@@ -759,8 +759,8 @@ const cards = [
"suit": 'Intelligence',
"rank": 2,
"spies": 2,
- "move": true,
- "battle": true,
+ "move": 1,
+ "battle": 2,
"patriot": 'Russian',
"prize": 'British',
"number": 69
@@ -771,7 +771,7 @@ const cards = [
"suit": 'Intelligence',
"rank": 2,
"spies": 2,
- "move": true,
+ "move": 1,
"patriot": 'Russian',
"prize": 'Afghan',
"number": 70
@@ -782,8 +782,8 @@ const cards = [
"suit": 'Intelligence',
"rank": 1,
"spies": 1,
- "gift": true,
- "move": true,
+ "gift": 1,
+ "move": 2,
"patriot": 'British',
"prize": 'Afghan',
"number": 71
@@ -794,7 +794,7 @@ const cards = [
"suit": 'Intelligence',
"rank": 2,
"spies": 2,
- "move": true,
+ "move": 1,
"prize": 'Russian',
"number": 72
},
@@ -805,8 +805,8 @@ const cards = [
"rank": 1,
"spies": 1,
"climate": 'Military',
- "build": true,
- "battle": true,
+ "build": 2,
+ "battle": 1,
"prize": 'British',
"number": 73
},
@@ -817,8 +817,8 @@ const cards = [
"rank": 1,
"tribes": 1,
"climate": 'Intelligence',
- "battle": true,
- "betray": true,
+ "battle": 1,
+ "betray": 2,
"patriot": 'Afghan',
"prize": 'Russian',
"number": 74
@@ -830,8 +830,8 @@ const cards = [
"rank": 1,
"armies": 1,
"tribes": 1,
- "tax": true,
- "battle": true,
+ "tax": 2,
+ "battle": 1,
"number": 75
},
{
@@ -851,8 +851,8 @@ const cards = [
"armies": 1,
"tribes": 1,
"climate": 'Intelligence',
- "build": true,
- "betray": true,
+ "build": 2,
+ "betray": 1,
"number": 77
},
{
@@ -863,7 +863,7 @@ const cards = [
"roads": 2,
"leveraged": 1,
"climate": 'Intelligence',
- "build": true,
+ "build": 1,
"number": 78
},
{
@@ -874,8 +874,8 @@ const cards = [
"roads": 1,
"spies": 1,
"leveraged": 1,
- "tax": true,
- "move": true,
+ "tax": 2,
+ "move": 1,
"prize": 'British',
"number": 79
},
@@ -886,8 +886,8 @@ const cards = [
"rank": 1,
"roads": 1,
"leveraged": 1,
- "tax": true,
- "build": true,
+ "tax": 2,
+ "build": 1,
"patriot": 'British',
"prize": 'Russian',
"number": 80
@@ -899,8 +899,8 @@ const cards = [
"rank": 2,
"roads": 2,
"leveraged": 1,
- "tax": true,
- "build": true,
+ "tax": 2,
+ "build": 1,
"patriot": 'Russian',
"prize": 'British',
"number": 81
@@ -912,8 +912,8 @@ const cards = [
"rank": 2,
"armies": 2,
"climate": 'Intelligence',
- "gift": true,
- "battle": true,
+ "gift": 2,
+ "battle": 1,
"number": 82
},
{
@@ -923,7 +923,7 @@ const cards = [
"rank": 1,
"armies": 1,
"spies": 1,
- "tax": true,
+ "tax": 1,
"number": 83
},
{
@@ -933,7 +933,7 @@ const cards = [
"rank": 2,
"armies": 2,
"climate": 'Economic',
- "battle": true,
+ "battle": 1,
"patriot": 'Russian',
"prize": 'Afghan',
"number": 84
@@ -946,8 +946,8 @@ const cards = [
"spies": 1,
"leveraged": 1,
"climate": 'Economic',
- "gift": true,
- "build": true,
+ "gift": 2,
+ "build": 1,
"prize": 'British',
"number": 85
},
@@ -957,8 +957,8 @@ const cards = [
"suit": 'Intelligence',
"rank": 2,
"spies": 2,
- "build": true,
- "move": true,
+ "build": 1,
+ "move": 2,
"patriot": 'Russian',
"number": 86
},
@@ -968,9 +968,9 @@ const cards = [
"suit": 'Intelligence',
"rank": 1,
"spies": 1,
- "gift": true,
- "build": true,
- "move": true,
+ "gift": 2,
+ "build": 1,
+ "move": 3,
"patriot": 'Russian',
"number": 87
},
@@ -980,8 +980,8 @@ const cards = [
"suit": 'Intelligence',
"rank": 1,
"spies": 1,
- "gift": true,
- "move": true,
+ "gift": 1,
+ "move": 2,
"patriot": 'British',
"number": 88
},
@@ -991,9 +991,9 @@ const cards = [
"suit": 'Intelligence',
"rank": 1,
"spies": 1,
- "move": true,
- "battle": true,
- "betray": true,
+ "move": 3,
+ "battle": 1,
+ "betray": 2,
"patriot": 'Russian',
"number": 89
},
@@ -1003,8 +1003,8 @@ const cards = [
"suit": 'Political',
"rank": 1,
"tribes": 1,
- "tax": true,
- "betray": true,
+ "tax": 2,
+ "betray": 1,
"prize": 'British',
"number": 90
},
@@ -1016,7 +1016,7 @@ const cards = [
"armies": 1,
"tribes": 1,
"spies": 1,
- "betray": true,
+ "betray": 1,
"prize": 'Russian',
"number": 91
},
@@ -1028,9 +1028,9 @@ const cards = [
"tribes": 1,
"spies": 1,
"climate": 'Military',
- "tax": true,
- "move": true,
- "battle": true,
+ "tax": 2,
+ "move": 1,
+ "battle": 3,
"prize": 'British',
"number": 92
},
@@ -1040,8 +1040,8 @@ const cards = [
"suit": 'Political',
"rank": 2,
"tribes": 2,
- "battle": true,
- "betray": true,
+ "battle": 2,
+ "betray": 1,
"prize": 'British',
"number": 93
},
@@ -1053,8 +1053,8 @@ const cards = [
"roads": 1,
"spies": 1,
"leveraged": 1,
- "tax": true,
- "betray": true,
+ "tax": 2,
+ "betray": 1,
"prize": 'British',
"number": 94
},
@@ -1064,8 +1064,8 @@ const cards = [
"suit": 'Economic',
"rank": 1,
"roads": 1,
- "tax": true,
- "move": true,
+ "tax": 2,
+ "move": 1,
"patriot": 'Russian',
"prize": 'Afghan',
"number": 95
@@ -1076,8 +1076,8 @@ const cards = [
"suit": 'Economic',
"rank": 2,
"roads": 2,
- "tax": true,
- "move": true,
+ "tax": 2,
+ "move": 1,
"prize": 'British',
"number": 96
},
@@ -1088,7 +1088,7 @@ const cards = [
"rank": 1,
"armies": 1,
"climate": 'Intelligence',
- "build": true,
+ "build": 1,
"number": 97
},
{
@@ -1097,7 +1097,7 @@ const cards = [
"suit": 'Military',
"rank": 3,
"armies": 3,
- "gift": true,
+ "gift": 1,
"prize": 'British',
"number": 98
},
@@ -1108,7 +1108,7 @@ const cards = [
"rank": 1,
"armies": 1,
"spies": 1,
- "battle": true,
+ "battle": 1,
"patriot": 'Russian',
"prize": 'British',
"number": 99
@@ -1119,7 +1119,7 @@ const cards = [
"suit": 'Military',
"rank": 2,
"armies": 2,
- "battle": true,
+ "battle": 1,
"patriot": 'Russian',
"prize": 'British',
"number": 100
diff --git a/rules.js b/rules.js
index cfbb6f2..15d67f2 100644
--- a/rules.js
+++ b/rules.js
@@ -1,5 +1,7 @@
"use strict";
+// TODO: card actions clickable card regions instead
+
// TODO: check all card data
// TODO: log helpers - piece name (army/road/tribe color/coalition)
// TODO: check if actions are possible: Tax, Move, Battle
@@ -599,7 +601,7 @@ function discard_court_card(c) {
}
}
- log(`${player_names[pidx]} discarded #${c}.`);
+ log(`${player_names[pidx]} discarded #${c} from court.`);
// Return all spies on card
for (let p = 0; p < game.players.length; ++p) {
@@ -815,7 +817,7 @@ states.waive = {
offer_9() { do_offer(9); },
refuse() {
log(`${player_names[game.active]} refused to waive the bribe.`);
- game.state = 'bribe'
+ game.state = 'bribe';
set_active(game.phasing);
},
}
@@ -910,9 +912,9 @@ states.actions = {
prompt() {
// Pass / End turn
if (game.actions > 0) {
- gen_action('pass');
+ gen_action('end_turn_pass');
} else {
- gen_action('next');
+ gen_action('end_turn');
}
// Purchase
@@ -921,7 +923,7 @@ states.actions = {
for (let col = 0; col < 6; ++col) {
let c = game.market_cards[row][col];
if (c && market_cost(col, c) <= player.coins && !game.used_cards.includes(c) && c !== PUBLIC_WITHDRAWAL)
- gen_action('purchase', c);
+ gen_action('card', c);
}
}
}
@@ -994,7 +996,8 @@ states.actions = {
},
- purchase(c) {
+ // Purchase card from market
+ card(c) {
push_undo();
logbr();
@@ -1016,25 +1019,11 @@ states.actions = {
logbr();
- if (cost > 0) {
- /*
- if (cost > 1)
- log(`Paid ${cost} rupees.`);
- else
- log(`Paid ${cost} rupee.`);
- */
+ if (cost > 0)
player.coins -= cost;
- }
- if (game.market_coins[row][col] > 0) {
- /*
- if (game.market_coins[row][col] > 1)
- log(`Took ${game.market_coins[row][col]} rupees.`);
- else
- log(`Took ${game.market_coins[row][col]} rupee.`);
- */
+ if (game.market_coins[row][col] > 0)
player.coins += game.market_coins[row][col];
- }
game.market_coins[row][col] = 0;
game.market_cards[row][col] = 0;
@@ -1050,21 +1039,24 @@ states.actions = {
}
},
+ // Play card to court
+ play_left(c) { do_play_1(c, 0); },
+ play_right(c) { do_play_1(c, 1); },
+
+ // Use card based ability
tax(c) { do_card_action_1(c, "Tax", 0); },
gift(c) { do_card_action_1(c, "Gift", gift_cost()); },
build(c) { do_card_action_1(c, "Build", 2); },
move(c) { do_card_action_1(c, "Move", 0); },
betray(c) { do_card_action_1(c, "Betray", 2); },
battle(c) { do_card_action_1(c, "Battle", 0); },
- play_left(c) { do_play_1(c, 0); },
- play_right(c) { do_play_1(c, 1); },
- pass() {
+ end_turn_pass() {
logbr();
log(`Passed.`);
goto_cleanup_court();
},
- next() {
+ end_turn() {
goto_cleanup_court();
},
}
@@ -1286,17 +1278,31 @@ function goto_play_leveraged() {
logi(`Leveraged.`);
player.coins += 2;
}
- goto_play_climate();
+ goto_play_favored_suit_impact();
}
-function goto_play_climate() {
- // TODO: manual click to set climate
+function goto_play_favored_suit_impact() {
let card = cards[game.card];
if (card.climate && !game.events.pashtunwali_values) {
- logi(`Favored suit to ${card.climate}.`);
- game.favored = card.climate;
+ game.state = 'favored_suit_impact';
+ game.where = card.climate;
+ } else {
+ end_action();
}
- end_action();
+}
+
+states.favored_suit_impact = {
+ inactive: "favored suit",
+ prompt() {
+ view.prompt = `Change the favored suit to ${game.where}.`;
+ gen_action('suit', game.where);
+ },
+ suit(suit) {
+ push_undo();
+ logi(`Favored suit to ${suit}.`);
+ game.favored = suit;
+ end_action();
+ },
}
// CARD-BASED ACTION (COMMON)
@@ -1896,7 +1902,7 @@ function piece_owner(x) {
states.battle = {
prompt() {
if (game.where <= 0) {
- view.prompt = `Start a battle in a single region or on a court card.`
+ view.prompt = `Start a battle in a single region or on a court card.`;
for (let p = 0; p < game.players.length; ++p) {
let court = game.players[p].court;
for (let i = 0; i < court.length; ++i) {
@@ -2200,7 +2206,6 @@ states.cleanup_court = {
},
card(c) {
push_undo();
- log(`${player_names[game.active]} discarded #${c} from their court.`);
discard_court_card(c);
},
next() {
@@ -2232,7 +2237,7 @@ states.cleanup_hand = {
},
card(c) {
push_undo();
- log(`${player_names[game.active]} discarded #${c} from their hand.`);
+ log(`${player_names[game.active]} discarded #${c} from hand.`);
remove_from_array(player.hand, c);
},
next() {
@@ -2328,10 +2333,7 @@ function goto_refill_market() {
const events_if_discarded = {
"Military" () {
- // TODO: manual click to set climate
- logi("Favored suit to Military.");
- game.favor = Military;
- goto_discard_events();
+ goto_favored_suit_event(Military);
},
"Embarrassment of Riches" () {
@@ -2352,13 +2354,11 @@ const events_if_discarded = {
},
"Riots in Punjab" () {
- remove_all_tribes_and_armies(Punjab);
- goto_discard_events();
+ goto_riots(Punjab);
},
"Riots in Herat" () {
- remove_all_tribes_and_armies(Herat);
- goto_discard_events();
+ goto_riots(Herat);
},
"No effect" () {
@@ -2367,13 +2367,11 @@ const events_if_discarded = {
},
"Riots in Kabul" () {
- remove_all_tribes_and_armies(Kabul);
- goto_discard_events();
+ goto_riots(Kabul);
},
"Riots in Persia" () {
- remove_all_tribes_and_armies(Persia);
- goto_discard_events();
+ goto_riots(Persia);
},
"Confidence Failure" () {
@@ -2383,19 +2381,47 @@ const events_if_discarded = {
},
"Intelligence" () {
- // TODO: manual click to set climate
- logi("Favored suit to Intelligence.");
- game.favored = Intelligence;
- goto_discard_events();
+ goto_favored_suit_event(Intelligence);
},
"Political" () {
- // TODO: manual click to set climate
- logi("Favored suit to Political.");
- game.favored = Political;
+ goto_favored_suit_event(Political);
+ },
+
+}
+
+function goto_favored_suit_event(suit) {
+ game.state = 'favored_suit';
+ game.where = suit;
+}
+
+states.favored_suit = {
+ inactive: "favored suit",
+ prompt() {
+ view.prompt = `Change the favored suit to ${game.where}.`;
+ gen_action('suit', game.where);
+ },
+ suit(suit) {
+ logi(`Favored suit to ${suit}.`);
+ game.favored = suit;
goto_discard_events();
},
+}
+function goto_riots(where) {
+ game.state = 'riots';
+ game.where = where;
+}
+
+states.riots = {
+ prompt() {
+ view.prompt = `Riot in ${region_names[game.where]}.`;
+ gen_action('space', game.where);
+ },
+ space(s) {
+ remove_all_tribes_and_armies(s);
+ goto_discard_events();
+ },
}
states.confidence_failure = {
@@ -2406,7 +2432,7 @@ states.confidence_failure = {
gen_action('card', player.hand[i]);
},
card(c) {
- log(`${player_names[game.active]} discarded #${c} from their hand.`);
+ log(`${player_names[game.active]} discarded #${c} from hand.`);
remove_from_array(player.hand, c);
next_confidence_failure();
},
@@ -2547,22 +2573,17 @@ states.pashtunwali_values = {
inactive: "Pastunwali values",
prompt() {
view.prompt = `Pashtunwali Values \u2014 choose a suit to favor.`;
- gen_action('suit_political');
- gen_action('suit_intelligence');
- gen_action('suit_economic');
- gen_action('suit_military');
+ gen_action('suit', Political);
+ gen_action('suit', Intelligence);
+ gen_action('suit', Economic);
+ gen_action('suit', Military);
+ },
+ suit(suit) {
+ log(`Favored suit to ${suit}.`);
+ game.favored = suit;
+ game.events.pashtunwali_values = 1;
+ end_action();
},
- suit_political() { do_pashtunwali_values(Political); },
- suit_intelligence() { do_pashtunwali_values(Intelligence); },
- suit_economic() { do_pashtunwali_values(Economic); },
- suit_military() { do_pashtunwali_values(Military); },
-}
-
-function do_pashtunwali_values(suit) {
- log(`Favored suit to ${suit}.`);
- game.favored = suit;
- game.events.pashtunwali_values = 1;
- end_action();
}
states.rebuke = {