File: flattop.g

package info (click to toggle)
xconq 7.2.2-2
  • links: PTS
  • area: main
  • in suites: slink
  • size: 8,296 kB
  • ctags: 9,199
  • sloc: ansic: 107,849; sh: 2,108; perl: 2,057; makefile: 1,177; sed: 161; csh: 50; awk: 49; lisp: 39
file content (288 lines) | stat: -rw-r--r-- 5,959 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
(game-module "flattop"
  (title "Flattop Battles")
  (blurb "WW II, in the Pacific, aboard a carrier")
  (variants (see-all false))
  )

(unit-type f (name "fighter") (image-name "1e")
  (help "protects ships from aircraft"))
(unit-type d (name "dive bomber") (image-name "1e")
  (help "attacks ships by bombing at close range"))
(unit-type t (name "torpedo bomber") (image-name "torpedo-bomber")
  (help "carries deadly torpedos"))
(unit-type pby (name "PBY") (char "p")
  (help "long-range scout plane"))
(unit-type dd (name "destroyer") (char "D")
  (help "small ship that protects against subs"))
(unit-type sub (name "submarine") (char "S")
  (help ""))
(unit-type cve (name "escort carrier") (char "E") (image-name "cv")
  (help "small aircraft carrier"))
(unit-type cl (name "light cruiser") (char "R") (image-name "ca")
  (help ""))
(unit-type ca (name "heavy cruiser") (char "R")
  (help ""))
(unit-type cv (name "carrier") (char "C")
  (help ""))
(unit-type bb (name "battleship") (char "B")
  (help ""))
(unit-type / (name "base") (image-name "airbase")
  (help ""))

(material-type fuel (char "o") (help "how to get around"))
(material-type ammo (char "a") (help "small stuff"))
(material-type shell (char "A") (help "8 to 16 inch"))
(material-type bomb (char "b") (help "iron bombs"))
(material-type torps (char "!") (help "death to ships"))

(define o fuel)
(define a ammo)
(define A shell)
(define b bomb)
(define ! torps)

(terrain-type sea (char "."))
(terrain-type atoll (char ","))
(terrain-type island (image-name "forest") (char "+"))

(define combat-air (f d t))
(define air (f d t pby))
(define heavy (cl ca bb))
(define carriers (cve cv))
(define ships (dd sub cve cl ca cv bb))

(add sea liquid true)

;;; Static relationships.

(table unit-size-as-occupant
  (u* u* 99)
  (air carriers 1)
  (air / 4)
  (ships / 1)
  )

(add air capacity 0)
(add carriers capacity (4 8))
(add / capacity 32)

(add t* capacity 4)

(table unit-size-in-terrain
  ;; Any number of aircraft can share the same airspace.
  (air t* 0)
  ;; Up to 4 ships (irrespective of size) in a cell.
  (ships t* 1)
  ;; Base takes up entire cell.
  (base t* 4)
  )

(table unit-storage-x
  (ships (fuel ammo) 500)
  (air fuel 24)
  (pby fuel 48)
  (air ammo 2)
  (pby ammo 0)
  (d b 2)
  (t torps 2)
  ((dd sub) torps 12)
  (cve (b torps) 25)
  (cv (b torps) 50)
  (heavy shell 50)
  (/ m* 1000)
  )

(table base-consumption
  (air fuel 12)
  (pby fuel  6)
  (ships fuel 1)
  )

(table hp-per-starve
  ;; Aircraft splash immediately if they run out of fuel.
  (air fuel 1.00)
  ;; Ships have a short grace period.
  (ships fuel 0.10)
  )

;;; Vision.

(table see-chance-at
  (u* sub 50)
  )

(table see-chance-adjacent
  (u* sub 10)
  (dd sub 20)
  )

;;; Actions.

(add air acp-per-turn 12)
(add pby acp-per-turn 6)
(add ships acp-per-turn 3)

(add / acp-per-turn 0)

;;; Movement.

(add / speed 0)

(add air free-mp 12)
(add pby free-mp 6)

(table mp-to-enter-terrain
  (ships atoll 2)
  (ships island 10)
  )

(table mp-to-enter-unit
  ;; Aircraft cannot sortie again until next turn.
  (air ships 12)
  (pby ships 6)
  )

(table zoc-range
  ;; PBYs can never block anyone.
  (u* pby -1)
  (pby u* -1)
  ;; Nor can subs.
  (u* sub -1)
  (sub u* -1)
  )

;; Everybody needs fuel.

(table material-to-move
  (u* fuel 1)
  )

(table consumption-per-move
  (u* fuel 1)
  )

;;; Combat.

(add ships hp-max (5 5 5 5 10 10 20))
(add / hp-max 100)

(table acp-to-attack
  (air u* 3)
  )

(table hit-chance
  (u* u* 50)
  (f air 80)
  (f f 60)
  ;; PBYs have no combat capability.
  (pby u* 0)
  (f carriers 20)
  (sub air 20)
  (dd sub 70)
  (carriers u* 10)
  ;; Only combat aircraft and heavy ships can hit the base.
  (u* / 0)
  ;; ...and they always hit.
  (combat-air / 100)
  (heavy / 100)
  )

(table damage
  (u* u* 1)
  (pby u* 0)
  (heavy u* 3)
  ((t dd sub) ships 1d4+1)
  ((t dd sub) (cv bb) 1d5+6)
  (bb / 1d10+5)
  )

(table consumption-per-attack
  (air ammo 1)
  (carriers ammo 1)
  ((t dd sub) torps 1)
  (heavy shell 1)
  )

(table hit-by
  (ships (b torps) 1)
  (air ammo 1)
  (u* shell 1)
  )

;50 air carriers protect

(set action-notices '(
  ((destroy u* air) (actor " shoots down " actee "!"))
  ((destroy u* ships) (actor " sinks " actee "!"))
  ))

;; 0 air control

;;; Random setup.

(add t* alt-percentile-min (  0  96  98))
(add t* alt-percentile-max ( 96  98 100))
(add t* wet-percentile-min 0)
(add t* wet-percentile-max 100)

(set edge-terrain sea)

(set country-radius-min 4)
(set country-separation-min 30)
(set country-separation-max 32)

(add u* start-with (8 8 8 4 6 2 4 2 2 2 2 1))

(table favored-terrain
  (u* t* 0)
  (ships sea 100)
  (/ (atoll island) 100)
  )

(set advantage-min 1)
(set advantage-default 2)
(set advantage-max 8)

;;; Everybody starts out full.

(table unit-initial-supply (u* m* 9999))

(set terrain-seen true)
(add / already-seen 100)

;; Note that there are no default namers for unit types, so any type
;; not mentioned in the side's own namers will simply not be named.

(set side-library '(
  ((noun "American") (emblem-name "flag-usa")
   (unit-namers
    (cl  "us-cl-names")
    (ca  "us-ca-names")
    (cve "us-cve-names")
    (cv  "us-cv-names")
    (bb  "us-bb-names"))
   )
  ((noun "Japanese") (emblem-name "flag-japan")
   (unit-namers
    (ca  "japanese-ca-names")
    (cve "japanese-cve-names")
    (cv  "japanese-cv-names")
    (bb  "japanese-bb-names"))
   )
  ))

(include "ng-ships")

;; Also worthwhile to have generator for names like "LC-1", "CA6", etc?

(scorekeeper (do last-side-wins))

(game-module (notes (
  "This is a somewhat expanded version of the navy in the standard game. "
  "Each side commands a large fleet, and the sole objective is to wipe out "
  "the enemy's fleet.  There are different kinds of planes and ships, but "
  "nothing else."

  "Speeds of ships are uniform, so that formations work better (don't want "
  "the carriers outstripping their escorts). "
  )))