From 5d80614b1c0bf1d7cf1c0fe42186e5288cf8e389 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Tue, 3 Dec 2024 12:55:02 +0100 Subject: Notify players of accepted deals too. --- rules.js | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'rules.js') diff --git a/rules.js b/rules.js index 0931f74..a6a64a8 100644 --- a/rules.js +++ b/rules.js @@ -6530,7 +6530,7 @@ states.accept_deal_to = { }, accept() { game.deals.push(game.proposal.deal) - end_accept_deal() + goto_notify_deal() }, reject() { goto_reject_deal() @@ -6538,34 +6538,42 @@ states.accept_deal_to = { } function goto_reject_deal() { + game.proposal.reject = 1 + goto_notify_deal() +} + +function goto_notify_deal() { let from = game.proposal.deal[DI_A_POWER] let to = game.proposal.deal[DI_B_POWER] if (game.power === to) set_active_to_power_keep_undo(from) else set_active_to_power_keep_undo(game.proposal.save_power) - game.state = "reject_deal" + game.state = "notify_deal" } -function next_reject_deal() { +function next_notify_deal() { if (game.power !== game.proposal.save_power) set_active_to_power_keep_undo(game.proposal.save_power) else end_accept_deal() } -states.reject_deal = { +states.notify_deal = { dont_snap: true, inactive: "resume play", prompt() { let from = game.proposal.deal[DI_A_POWER] let to = game.proposal.deal[DI_B_POWER] - prompt(`Deal between ${power_name[from]} and ${power_name[to]} was NOT accepted.`) + if (game.proposal.reject) + prompt(`Deal between ${power_name[from]} and ${power_name[to]} was NOT accepted.`) + else + prompt(`Deal between ${power_name[from]} and ${power_name[to]} accepted.`) view.actions.resume = 1 view.actions.undo = 0 }, resume() { - next_reject_deal() + next_notify_deal() }, } -- cgit v1.2.3