diff options
author | Tor Andersson <tor@ccxvii.net> | 2023-03-13 00:44:54 +0100 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2023-05-03 18:48:15 +0200 |
commit | d9504cf1e4d57be6d5a31d1b80810bc4333c9b41 (patch) | |
tree | ce9dc6aec053f56644869df5ea243ee9afe478d9 | |
parent | f72333d6145cd58d81a0486f21e0951be9c9d20b (diff) | |
download | andean-abyss-d9504cf1e4d57be6d5a31d1b80810bc4333c9b41.tar.gz |
Negotiation.
-rw-r--r-- | play.html | 4 | ||||
-rw-r--r-- | rules.js | 95 |
2 files changed, 51 insertions, 48 deletions
@@ -41,8 +41,8 @@ <div class="menu_title"><img src="images/shaking-hands.svg"></div> <div class="menu_popup"> <div id="remove_pieces_menu" class="menu_item" onclick="send_action('remove_pieces')">Remove Pieces</div> - <div id="ask_resources_menu" class="menu_item" onclick="send_action('ask_resources')">Ask for Resources...</div> - <div id="ask_shipment_menu" class="menu_item" onclick="send_action('ask_shipment')">Ask for Shipment...</div> + <div id="ask_resources_menu" class="menu_item" onclick="send_action('ask_resources')">Ask for Resources</div> + <div id="ask_shipment_menu" class="menu_item" onclick="send_action('ask_shipment')">Ask for Shipment</div> </div> </div> </div> @@ -1306,7 +1306,7 @@ states.remove_pieces = { }, done() { game.state = game.transfer - game.transfer = 0 + game.transfer = null transfer_or_remove_shipments() }, } @@ -1353,9 +1353,7 @@ function resume_transfer_dropped_shipments() { return } } - game.current = game.transfer.current - game.state = game.transfer.state - game.transfer = 0 + end_negotiation() } states.transfer_dropped_shipments = { @@ -1377,43 +1375,7 @@ states.transfer_dropped_shipments = { }, } -function goto_drug_bust() { - game.transfer = game.state - resume_drug_bust() -} - -function resume_drug_bust() { - if (has_dropped_shipments()) { - game.state = "drug_bust" - } else { - game.state = game.transfer - game.transfer = 0 - } -} - -states.drug_bust = { - prompt() { - view.prompt = "Drug Bust: Gain 6 resources per removed Shipment." - gen_action_resources(GOVT) - for (let sh = 0; sh < 4; ++sh) - if (is_shipment_dropped(sh)) - gen_action_shipment(sh) - }, - shipment(sh) { - add_resources(GOVT, 6) - remove_shipment(sh) - resume_drug_bust() - }, - resources(_) { - for (let sh = 0; sh < 4; ++sh) { - if (is_shipment_dropped(sh)) { - add_resources(GOVT, 6) - remove_shipment(sh) - } - } - resume_drug_bust() - }, -} +// === SHIP FOR EXTRA LIMOP === states.ship = { prompt() { @@ -1478,11 +1440,11 @@ states.ask_resources = { }, resources(faction) { game.current = faction - game.state = "give_resources" + game.state = "transfer_resources" }, } -states.give_resources = { +states.transfer_resources = { disable_negotiation: true, prompt() { view.prompt = `${faction_name[game.transfer.current]} asked for Resources.` @@ -1546,12 +1508,12 @@ states.ask_shipment = { shipment(sh) { let p = game.shipments[sh] >> 2 game.current = piece_faction(p) - game.state = "give_shipment" + game.state = "transfer_shipment" game.transfer.shipment = sh }, } -states.give_shipment = { +states.transfer_shipment = { disable_negotiation: true, prompt() { view.prompt = `${faction_name[game.transfer.current]} asked for Shipment.` @@ -1575,9 +1537,50 @@ states.give_shipment = { function end_negotiation() { game.current = game.transfer.current game.state = game.transfer.state - game.transfer = 0 + game.transfer = null } +// === DRUG BUST === + +function goto_drug_bust() { + game.transfer = game.state + resume_drug_bust() +} + +function resume_drug_bust() { + if (has_dropped_shipments()) { + game.state = "drug_bust" + } else { + game.state = game.transfer + game.transfer = null + } +} + +states.drug_bust = { + prompt() { + view.prompt = "Drug Bust: Gain 6 resources per removed Shipment." + gen_action_resources(GOVT) + for (let sh = 0; sh < 4; ++sh) + if (is_shipment_dropped(sh)) + gen_action_shipment(sh) + }, + shipment(sh) { + add_resources(GOVT, 6) + remove_shipment(sh) + resume_drug_bust() + }, + resources(_) { + for (let sh = 0; sh < 4; ++sh) { + if (is_shipment_dropped(sh)) { + add_resources(GOVT, 6) + remove_shipment(sh) + } + } + resume_drug_bust() + }, +} + + // === OPERATIONS === states.op = { |