impact.gno
3.52 Kb · 105 lines
1package engine
2
3// PenaltyKind names the combat results of the IMPACT TABLE (rules 14.11,
4// 14.12).
5type PenaltyKind string
6
7const (
8 Kill PenaltyKind = "kill" // killed, out of the game
9 Stun PenaltyKind = "stun" // draws N wound cards and loses aim
10 Stagger PenaltyKind = "stagger" // thrown to a hex and facing drawn on two direction cards, then drops
11 Serious PenaltyKind = "serious" // N fatigue cards at the start of every turn; may kill at the end
12 DropGunHand PenaltyKind = "gun_hand" // the weapon in the gun hand drops in the hex
13 GunArm PenaltyKind = "gun_arm" // -N aim time with the gun hand
14 DropOtherHand PenaltyKind = "other_hand" // the weapon in the other hand drops in the hex
15 OtherArm PenaltyKind = "other_arm" // -N aim time with the other hand
16 LegWound PenaltyKind = "leg" // N fatigue cards per hex moved while upright
17 Light PenaltyKind = "light" // draws N fatigue cards
18 LoseAimHit PenaltyKind = "lose_aim" // loses the aim (STRIKING TABLE)
19)
20
21// Penalty is one combat result, with its number when the kind takes one.
22type Penalty struct {
23 Kind PenaltyKind
24 N int
25}
26
27// Impact is the IMPACT TABLE: the penalties a hit location inflicts for a
28// gun's table line (rule 13.8). Only line B, the Colt 45's, is transcribed
29// (from the VASSAL module's table); other lines come with their guns.
30func Impact(line byte, loc HitLoc) []Penalty {
31 if line != 'B' {
32 return nil
33 }
34 switch loc {
35 case VitalHit, CritHit:
36 return []Penalty{{Kill, 0}}
37 case BodyHit:
38 return []Penalty{{Stun, 4}, {Stagger, 0}, {Serious, 2}}
39 case SideHit:
40 return []Penalty{{Stun, 2}, {Stagger, 0}}
41 case HeadHit:
42 return []Penalty{{Stun, 8}}
43 case GunHit:
44 return []Penalty{{Stun, 4}, {DropGunHand, 0}, {Serious, 1}, {GunArm, 4}}
45 case ArmHit:
46 return []Penalty{{Stun, 3}, {DropOtherHand, 0}, {Serious, 1}, {OtherArm, 4}}
47 case LegHit:
48 return []Penalty{{Stun, 3}, {Stagger, 0}, {Serious, 2}, {LegWound, 4}}
49 }
50 return nil
51}
52
53// Striking is the STRIKING TABLE (16.23): the penalties a throw (or, later,
54// an attack) inflicts for a weapon's table line and the hit location. Only
55// line B, the one-handed guns' (with the pail, dynamite, bottle and ammo
56// sources), is transcribed; other lines come with their weapons.
57func Striking(line byte, loc HitLoc) []Penalty {
58 if line != 'B' {
59 return nil
60 }
61 switch loc {
62 case VitalHit:
63 return []Penalty{{Light, 5}, {LoseAimHit, 0}}
64 case CritHit:
65 return []Penalty{{Light, 4}, {LoseAimHit, 0}}
66 case BodyHit:
67 return []Penalty{{Light, 3}}
68 case SideHit:
69 return []Penalty{{Light, 1}}
70 case HeadHit:
71 return []Penalty{{Light, 6}, {LoseAimHit, 0}}
72 case GunHit:
73 return []Penalty{{Light, 2}, {DropGunHand, 0}}
74 case ArmHit:
75 return []Penalty{{Light, 2}, {DropOtherHand, 0}}
76 case LegHit:
77 return []Penalty{{Light, 2}}
78 }
79 return nil
80}
81
82// StrikingBullseye is where a thrower's bullseye lands, its choice (the
83// summary of actions): the location of the weapon's STRIKING TABLE line
84// that hurts most, the HEAD for line B (LIGHT 6 and LOSE AIM).
85func StrikingBullseye(line byte) HitLoc {
86 return HeadHit
87}
88
89// Strengthen adds a STRENGTH's damage to each GUN ARM, OTHER ARM, LEG,
90// SERIOUS, LIGHT and STUN penalty of a hit (20.21); the others are left as
91// they are.
92func Strengthen(pens []Penalty, n int) []Penalty {
93 if n == 0 {
94 return pens
95 }
96 out := make([]Penalty, len(pens))
97 for i, pen := range pens {
98 switch pen.Kind {
99 case GunArm, OtherArm, LegWound, Serious, Light, Stun:
100 pen.N += n
101 }
102 out[i] = pen
103 }
104 return out
105}