From 72bd7a444bffaea97ceb2d8fb69304753a6d8307 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Wed, 13 Dec 2023 02:25:02 +0100 Subject: take_1_from and make_take_from. little round top. --- data.js | 6 +++--- rules.js | 37 ++++++++++++++++++++++++++++++++++++- tools/cards.csv | 4 ++-- tools/scenarios.csv | 6 +++--- 4 files changed, 44 insertions(+), 9 deletions(-) diff --git a/data.js b/data.js index 95a9a70..f981389 100644 --- a/data.js +++ b/data.js @@ -9049,7 +9049,7 @@ cards: [ } ], "rules": { - "take_from": [ + "take_1_from": [ 270 ] } @@ -9350,7 +9350,7 @@ cards: [ } ], "rules": { - "may_take_dice_from": [ + "may_take_from": [ 281 ] } @@ -18643,4 +18643,4 @@ cards: [ } ], } -if (typeof module!=='undefined') module.exports = data +if (typeof module!=='undefined') module.exports = data \ No newline at end of file diff --git a/rules.js b/rules.js index 91d0a4e..dc4796a 100644 --- a/rules.js +++ b/rules.js @@ -408,6 +408,17 @@ function move_dice(from, to) { } } +function take_one_die(from, to) { + for (let i = 0; i < 12; ++i) { + if (get_dice_location(i) === from) { + set_dice_location(i, to) + if (to === POOL) + set_dice_value(i, 0) + to = POOL + } + } +} + function take_wild_die(from, to) { for (let i = 0; i < 12; ++i) { if (get_dice_location(i) === from) { @@ -1501,7 +1512,15 @@ function goto_attack(target) { let take_from = card_has_rule(game.selected, "take_from") if (take_from) { for (let from of take_from) - move_dice(from, game.selected) + if (has_any_dice_on_card(from)) + move_dice(from, game.selected) + } + + let take_1_from = card_has_rule(game.selected, "take_1_from") + if (take_1_from) { + for (let from of take_1_from) + if (has_any_dice_on_card(from)) + take_one_die(from, game.selected) } game.state = "attack" @@ -1564,6 +1583,12 @@ states.attack = { if (w >= 0) gen_action_dice_on_card(w) + let may_take_from = card_has_rule(game.selected, "may_take_from") + if (may_take_from) { + for (let from of may_take_from) + gen_action_dice_on_card(from) + } + view.actions.attack = 1 }, attack() { @@ -1585,6 +1610,11 @@ states.attack = { log("Wild die from C" + w + ".") take_wild_die(w, game.selected) } + let may_take_from = card_has_rule(game.selected, "may_take_from") + if (may_take_from) { + move_dice(get_dice_location(d), game.selected) + goto_attack(game.target) // recompute hits + } } } @@ -1873,6 +1903,7 @@ function goto_absorb(c, a) { case "When target suffers Hits, this unit suffers them instead.": break case "When target suffers Hits, this card suffers 1 hit ONLY instead.": + case "When target suffers Hits, this unit suffers 1 hit ONLY instead.": game.hits = 1 break case "When target suffers Hits, this card suffers 1 less hit per die.": @@ -1972,6 +2003,8 @@ function get_attack_hits(c, a) { case "1 hit per die. Ignore first target until it comes out of Reserve.": case "1 hit per die (but see below). 1 self per action.": case "1 hit per die (plus dice from E. Phalanx).": + case "1 hit per die. 1 self per action. (But see Sharpshooters.)": + case "1 hit per die. 1 self per action. (But see 4th Alabama.)": return count_dice_on_card(c) case "1 hit per pair.": case "1 hit per pair. 1 self per action.": @@ -2000,6 +2033,8 @@ function get_attack_self(c, a) { case "1 hit per action. 1 self per action.": case "1 hit per die. 1 self per action.": case "1 hit per die (but see below). 1 self per action.": + case "1 hit per die. 1 self per action. (But see Sharpshooters.)": + case "1 hit per die. 1 self per action. (But see 4th Alabama.)": case "1 hit per pair. 1 self per action.": case "1 hit, PLUS 1 hit per die. 1 self per action.": return 1 diff --git a/tools/cards.csv b/tools/cards.csv index 6c52c6c..7f41083 100644 --- a/tools/cards.csv +++ b/tools/cards.csv @@ -331,7 +331,7 @@ EXPANSION 3 - GETTYSBURG,,,,,,,,,,,,,,,,,,,, ,,,,,,,,,,,,,,,,,,,, LITTLE ROUND TOP,,,,,,,,,,,,,,,,,,,, 24,136A,blue,Sharpshooters,,,1,Doubles,,,,,,,Screen,Pair,15th Alabama,,remove_with=149A,"If there are dice on this card when the 20th Maine attacks, remove these dice and deal one additional hit.

When the 15th Alabama Routs, remove this card from play (this does not constitute a Rout).", -24,137A,dkblue,20th Maine,,,4*,(5)/(6),,,Attack,,"15th Alabama, 47th Alabama",1 hit per die. 1 self per action. (But see Sharpshooters.),Counterattack,Pair,15th Alabama,"1 hit. Additionally, this unit suffers one less hit.",take_from=136A,, +24,137A,dkblue,20th Maine,,,4*,(5)/(6),,,Attack,,"15th Alabama, 47th Alabama",1 hit per die. 1 self per action. (But see Sharpshooters.),Counterattack,Pair,15th Alabama,"1 hit. Additionally, this unit suffers one less hit.",take_1_from=136A,, 24,138A,dkblue,83rd Pennsylvania,,,4,(4),,,Attack,,"47th Alabama, 4th Alabama, 15th Alabama",1 hit per die. 1 self per action.,Counterattack,Pair,"47th Alabama, 4th Alabama",1 hit.,,, 24,139A,dkblue,44th New York,,,4*,(3),,,Attack,,"5th Texas, 4th Texas, 4th Alabama",1 hit per die. 1 self per action.,Counterattack,Pair,5th Texas,1 hit.,,, 24,140A,dkblue,16th Michigan,,,4*,(2),,,Attack,,"4th Texas, 5th Texas",1 hit per die. 1 self per action.,Counterattack,Pair,4th Texas,1 hit.,,,"Hurray, Michigan!" @@ -342,7 +342,7 @@ LITTLE ROUND TOP,,,,,,,,,,,,,,,,,,,, 24,145A,pink,4th Texas,,,5,(1)/(2),,,Attack,,"16th Michigan, 44th New York",1 hit per die. 1 self per action.,Counterattack,Pair,16th Michigan,1 hit.,,, 24,146A,pink,5th Texas,,,5,(2)/(3),,,Attack,,"44th New York, 16th Michigan",1 hit per die. 1 self per action.,Counterattack,Pair,44th New York,1 hit.,,, 24,147A,red,4th Alabama,,,5,(3)/(4),,,Attack,,"83rd Pennsylvania, 44th New York",1 hit per die. 1 self per action.,,,,,,"Whenever the 47th Alabama makes an Attack, you MAY remove the dice from this card and use them as part of the Attack.", -24,148A,red,47th Alabama,,,5,(4)/(5),,,Attack,,"83rd Pennsylvania, 20th Maine",1 hit per die. 1 self per action. (But see 4th Alabama.),Counterattack,Pair,83rd Pennsylvania,1 hit.,may_take_dice_from=147A,, +24,148A,red,47th Alabama,,,5,(4)/(5),,,Attack,,"83rd Pennsylvania, 20th Maine",1 hit per die. 1 self per action. (But see 4th Alabama.),Counterattack,Pair,83rd Pennsylvania,1 hit.,may_take_from=147A,, 24,149A,red,15th Alabama,,,5,(5)/(6),,,Attack,,"20th Maine, 83rd Pennsylvania",1 hit per die. 1 self per action.,Counterattack,Pair,20th Maine,1 hit.,,, ,,,,,,,,,,,,,,,,,,,, THE WHEATFIELD,,,,,,,,,,,,,,,,,,,, diff --git a/tools/scenarios.csv b/tools/scenarios.csv index 7fe413a..6bbdd35 100644 --- a/tools/scenarios.csv +++ b/tools/scenarios.csv @@ -24,9 +24,9 @@ status,expansion,number,name,date,player1,cards1,morale1,tactical1,player2,cards 1,Age of Alexander,18,The Granicus,May 334 BCE,Various Squabbling Satraps,102A-108A,3,,Alexander III,109A-114A,1,,,,"Persia's light cavalry is no match for our boy's infantry and Companions, and it doesn't help the Persian cause that no one is really in charge. About the only thing they have going for them is they're on the other side of a river. Will it be enough?" 1,Age of Alexander,19,Issus,5 November 333 BCE,Darius III,115A-121A,3,,Alexander III,122A-129A,1,,,,"Darius had a numerical advantage – how much exactly is impossible to say – but most of his troops were ineffectual light infantry that weren't actually engaged. Both sides concentrated their strength on their right, and it was a race to see which side's left would collapse first." 1,Age of Alexander,20,Gaugamela,1 October 331 BCE,Alexander III,130A-135A,1,,Darius III,92B-100B,4,,,,"Numbering somewhere between 100,000 and one million (!), Darius's army vastly outnumbered Alexander's. But he was still trying to fight the Macedonians with Persian methods, and after some hard fighting, Alexander broke the Persian left." -,Age of Alexander,21,The Hydaspes,May 326 BCE,Alexander III,101B-107B,1,,Porus,108B-113B,3,,,,"Crossing the river with a small part of his army, Alexander was initially outnumbered, and the enemy's fearsome elephants threatened to break the phalanx. But daring and complicated maneuvers threw the Indian army into disarray, securing victory for Alexander in his last major battle." -,Age of Alexander,22,Gabiene,316 BCE,Eumenes,114B-119B,2,,Antigonus,120B-123B,2,,,,"One of the many battles fought by Alexander's successors (the Diadochi), this one proved tactically inconclusive. But the capture of Eumenes's baggage was enough for his Silver Shields to turn him over to Antigonus for execution." -,Age of Alexander,23,Ipsus,301 BCE,Antigonus,124B-129B,2,,Seleucus,130B-135B,2,,,,"Like Gabiene and many other battles from the Wars of the Diadochi, this battle saw two armies that were mostly identical in structure and tactics. And like many ancient battles, the death of a single man, the enemy commander (in this case Antigonus), was sufficient to secure victory." +1,Age of Alexander,21,The Hydaspes,May 326 BCE,Alexander III,101B-107B,1,,Porus,108B-113B,3,,,,"Crossing the river with a small part of his army, Alexander was initially outnumbered, and the enemy's fearsome elephants threatened to break the phalanx. But daring and complicated maneuvers threw the Indian army into disarray, securing victory for Alexander in his last major battle." +1,Age of Alexander,22,Gabiene,316 BCE,Eumenes,114B-119B,2,,Antigonus,120B-123B,2,,,,"One of the many battles fought by Alexander's successors (the Diadochi), this one proved tactically inconclusive. But the capture of Eumenes's baggage was enough for his Silver Shields to turn him over to Antigonus for execution." +1,Age of Alexander,23,Ipsus,301 BCE,Antigonus,124B-129B,2,,Seleucus,130B-135B,2,,,,"Like Gabiene and many other battles from the Wars of the Diadochi, this battle saw two armies that were mostly identical in structure and tactics. And like many ancient battles, the death of a single man, the enemy commander (in this case Antigonus), was sufficient to secure victory." ,,,,,,,,,,,,,,, ,Gettysburg,24,Little Round Top,2 July 1863,Union,136A-143A,1,,Confederate,144A-149A,2,,,,"One of the most famous actions of the day saw fewer than three thousand men mount a desperate, hard-fought, and ingenious defense of the Union left flank against the repeated assaults of nearly five thousand butternuts." ,Gettysburg,25,The Wheatfield,2 July 1863,Confederate,150A-156A,3,,Union,157A-167A,3,,,,"Confederate assaults caused the Union to retreat, then Union assoults caused the rebs to fall back, and on and on, back and forth, possession of the Wheatfield changing hands repeatedly, neither side gaining any real advantage, with thousands of casualties" -- cgit v1.2.3