summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2022-01-17 19:30:25 +0100
committerTor Andersson <tor@ccxvii.net>2023-02-18 12:12:42 +0100
commit5ecaccd4eb5abbf78a516fe234d49560addc7888 (patch)
tree8b6ee15a2e09853ed382406ac4e35d3894ac1e72
parent292edb7ccd11a0e69e2674c13ea78f786f3e8b8c (diff)
downloadshores-of-tripoli-5ecaccd4eb5abbf78a516fe234d49560addc7888.tar.gz
Fortress Tripoli variant.
-rw-r--r--create.html13
-rw-r--r--rules.js15
2 files changed, 27 insertions, 1 deletions
diff --git a/create.html b/create.html
index e69de29..6d9c428 100644
--- a/create.html
+++ b/create.html
@@ -0,0 +1,13 @@
+<dl>
+<dt>
+<i>Standard</i>
+<dd>
+Rules as written. US score is 25 minus Tripolitan score.
+<dd>
+<dt>
+<i>Fortress Tripoli</i>
+<dd>
+Whenever there is a battle in the harbor of Tripoli, the Tripolitan player gets six extra dice in the one round of combat.
+During "Assault on Tripoli" these six dice are only rolled in the first round of the naval battle,
+but they are also rolled in the first round of the ground battle.
+</dl>
diff --git a/rules.js b/rules.js
index a449555..cd5af15 100644
--- a/rules.js
+++ b/rules.js
@@ -10,6 +10,7 @@ const { SPACES, PIECES } = require('./data');
exports.scenarios = [
"Standard",
+ "Fortress Tripoli"
];
function get_piece_id(name) {
@@ -1207,6 +1208,7 @@ function end_naval_bombardment() {
function goto_naval_battle(space) {
game.save_active = game.active;
game.where = space;
+ game.round = 0;
log("Naval battle in " + SPACES[game.where] + ".");
goto_naval_battle_american_card();
}
@@ -1273,6 +1275,7 @@ states.naval_battle_tripolitan_card = {
function goto_naval_battle_round() {
game.active = game.save_active;
+ game.round ++;
let n_us_frigates = count_american_frigates(game.where);
let n_us_gunboats = count_american_gunboats(game.where);
@@ -1290,6 +1293,8 @@ function goto_naval_battle_round() {
game.n_us_hits = 0;
if (game.the_guns_of_tripoli)
game.n_us_hits += roll_many_dice("The Guns of Tripoli:\n", 12, 6);
+ if (game.fortress && game.where === TRIPOLI && game.round === 1)
+ game.n_us_hits += roll_many_dice("Fortress Tripoli:\n", 6, 6);
game.n_us_hits += roll_many_dice("Tripolitan frigates:\n", n_tr_frigates * 2, 6);
game.n_us_hits += roll_many_dice("Tripolitan corsairs:\n", n_tr_corsairs, 6);
game.n_us_hits += roll_many_dice("Allied corsairs:\n", n_al_corsairs, 6);
@@ -1559,6 +1564,7 @@ states.land_battle_bombardment_results = {
}
function goto_land_battle() {
+ game.round = 0;
move_all_pieces(US_FRIGATES, game.where, MALTA);
move_all_pieces(US_GUNBOATS, game.where, MALTA);
goto_land_battle_american_card();
@@ -1665,6 +1671,7 @@ states.mercenaries_desert_results = {
function goto_land_battle_round() {
delete game.flash;
game.active = US;
+ game.round ++;
let n_us_mar = count_american_marines(game.where);
let n_ar_inf = count_arab_infantry(game.where);
@@ -1706,6 +1713,9 @@ function goto_land_battle_round() {
let n_us_hits = roll_many_dice("Tripolitan infantry: ", n_tr_inf);
+ if (game.fortress && game.where === TRIPOLI && game.round === 1)
+ n_us_hits += roll_many_dice("Fortress Tripoli: ", 6, 6);
+
game.flash = apply_tr_hits(n_tr_hits) + apply_us_hits(n_us_hits);
log("Losses: " + game.flash + ".");
game.state = 'land_battle_results';
@@ -2802,6 +2812,9 @@ exports.setup = function (seed, scenario, options) {
undo: [],
};
+ if (scenario === "Fortress Tripoli")
+ game.fortress = 1;
+
if (typeof scenario === 'number')
game.year = scenario;
@@ -2923,7 +2936,7 @@ exports.view = function(state, current) {
draw: game.us.draw.length,
discard: game.us.discard.length + (game.us.queue ? game.us.queue.length : 0),
hand: game.us.hand.length,
- score: 30 - tr_score,
+ score: 25 - tr_score,
},
card: game.active_card,
where: game.where,