1(game-module "fantasy"
2  (title "Fantasy and Magic")
3  (blurb "Long-ago times, that perhaps never were...")
4  (variants
5   (see-all false)
6   (world-seen false)
7   (sequential false)
8   (world-size)
9   ("Alternate economy" model1
10    "Use a different algorithm for moving materials among units."
11    (true (set backdrop-model 1)))
12   ("AltEcon uses doctrine" model1doctrine
13    "When using alternate economy, don't drain units below doctrine levels."
14    (true (set backdrop-ignore-doctrine 0))
15    (false (set backdrop-ignore-doctrine 1)))
16   )
17  )
18
19;;; Unit types.
20
21;; Movers & fighters.
22
23(unit-type wizard (char "W")
24  (help "magician, wielder of awesome magic"))
25(unit-type i (name "light infantry") (image-name "peltast") (char "i")
26  (help "foot soldiers and mercenaries"))
27(unit-type barbarian (image-name "viking") (char "b")
28  (help "rugged, ferocious, lightly armoured warriors"))
29(unit-type k (name "heavy infantry") (image-name "hoplite") (char "k")
30  (help "foot soldiers in heavy armour"))
31(unit-type paladin (char "P")
32  (help "holy warrior, extremely tough and well equipped"))
33(unit-type longbowmen (image-name "archer") (char "R")
34  (help "archers, scouts, rangers"))
35(unit-type priest (char "H")
36  (help "the spiritual guides of the land"))
37(unit-type serfs (image-name "serf")
38  (help "mobs of peasant serfs and levies"))
39(unit-type dragon (char "D")
40  (help "lays waste to the lands"))
41(unit-type undead
42  (help "undead warriors, raised by priests or wizards"))
43(unit-type cavalry (char "h")
44  (help "knights that ride horses"))
45
46;; Magic spells.
47
48(unit-type A (name "Armageddon spell") (image-name "mininuke") (char "A")
49  (help "spell of awesome destruction"))
50(unit-type lightning (char "L")
51  (help "spell good for killing tough things"))
52(unit-type fireball (char "F")
53  (help "spell great for causing lots of damage to soft targets"))
54(unit-type M (name "mass charm") (image-name "charm-spell") (char "M")
55  (help "spell that charms units over to the caster's side!"))
56(unit-type wizard-eye (name "wizard eye") (image-name "eye") (char "E")
57  (help "spell for spying on things"))
58
59;; Transport.
60
61(unit-type wagon (image-name "wagon-2") (char "G")
62  (help "wagons, logistical unit"))
63(unit-type flying-carpet (name "flying carpet") (char "C")
64  (help "magical flying carpet"))
65(unit-type cloudkeep (image-name "city30") (char "K")
66  (help "wizard's floating stronghold"))
67(unit-type sailing-ship (name "sailing ship") (image-name "frigate") (char "S")
68  (help "for traveling the seas"))
69(unit-type galley (image-name "trireme")
70  (help "fast, light, not so seaworthy warship"))
71
72;; Forts, bases and other special places.
73
74(unit-type wall (image-name "walltown")
75  (help "fortified walls"))
76(unit-type castle
77  (help "walled castle"))
78(unit-type tower (char "T")
79  (help "mage's fortified tower"))
80(unit-type camp (char "/")
81  (help "campsite, practically a mobile village"))
82(unit-type temple (image-name "parthenon")
83  (help "holy place of spiritual power"))
84
85; Cities.
86
87(unit-type village (image-name "village-2") (char "V")
88  (help "small town"))
89(unit-type town (image-name "village") (char "*")
90  (help "smaller than a city"))
91(unit-type city (name "city") (image-name "city15") (char "@")
92  (help "large city, capital of a city-state"))
93
94;; Magical items.
95
96(unit-type r (name "ring of regeneration") (image-name "ring-2") (char "r")
97  (help "magical ring that makes its wearer heal faster"))
98(unit-type crystal-ball (name "crystal ball") (char "B")
99  (help "magical device that scans the local area"))
100(unit-type p (name "ring of protection") (image-name "ring-2") (char "p")
101  (help "protective magical device"))
102(unit-type f (name "everfull plate") (image-name "plate") (char "f")
103  (help "magical wonder that creates food!"))
104(unit-type a (name "amulet of power") (image-name "amulet") (char "a")
105  (help "generates mana for its wearer"))
106
107;; Material types.
108
109(material-type food
110  (help "foodstuffs: an army marches on its stomach!"))
111(material-type mana
112  (help "magical power"))	; used to produce magical effects
113(material-type metal
114  (help "steel, metal, manufacturing capacity for armour and weapons"))
115
116;; Terrain types.
117
118(terrain-type sea (char "."))
119(terrain-type swamp (char "="))
120(terrain-type desert (char "~")(image-name "adv-desert"))
121(terrain-type plains (char "+")(image-name "adv-plain"))
122(terrain-type forest (char "%")(image-name "adv-forest"))
123(terrain-type hills (char "(")(image-name "adv-hills"))
124(terrain-type mountains (char "^")(image-name "adv-mountains"))
125(terrain-type ice (char "_")(image-name "adv-ice"))
126(terrain-type void (image-name "black") (char ":"))
127
128(define W wizard)
129
130(define b barbarian)
131
132(define P paladin)
133(define R longbowmen)
134(define H priest)
135(define s serfs)
136(define D dragon)
137(define u undead)
138(define h cavalry)
139
140(define L lightning)
141(define F fireball)
142(define E wizard-eye)
143
144(define G wagon)
145(define C flying-carpet)
146(define S sailing-ship)
147(define g galley)
148
149(define w wall)
150(define c castle)
151(define T tower)
152(define K cloudkeep)
153(define _ camp)
154(define t temple)
155(define V village)
156(define ~ town)
157(define @ city)
158
159(define B crystal-ball)
160
161(define creatures (W i b k P R H s D u h))
162(define spells (A lightning fireball M wizard-eye))
163(define bases (wall castle tower temple cloudkeep camp village town city))
164(define transport (wagon flying-carpet cloudkeep sailing-ship galley))
165(define cities (village town city))
166(define magic-items ( r crystal-ball p f a ))
167
168(define forts (wall castle tower cloudkeep))
169(define flyers (dragon flying-carpet cloudkeep))
170(define ships (sailing-ship galley))
171(define ltfoot (priest longbowmen barbarian i serfs))
172(define hvyfoot ( k paladin wizard ))
173(define hoof (cavalry wagon))
174(define magickers (wizard dragon))
175(define movers (append creatures transport))
176(define foot ( W i b k P R H s u ))
177(define mundanes (i b k P R H s h G S g))
178
179(define water ( sea ))
180(define land ( swamp plains forest desert hills mountains ))
181
182(add water liquid true)
183
184;;; Static relationships.
185
186;; Unit-unit.
187
188(add wizard capacity 10)
189(add priest capacity 1)		; for repair?
190(add dragon capacity 3)
191
192(add transport capacity (2 1 8 5 4))
193
194(add bases capacity (2 4 4 4 12 10 16 20 30))
195
196(table unit-size-as-occupant
197  (u* u* 99)
198  ((i k serfs) galley 4)
199  (longbowmen galley 2)
200  (spells wizard 1)
201  (fireball dragon 1)
202  (spells (tower cloudkeep) 1)	; resident mages handle these
203  (movers bases 1)
204  (movers transport 1)
205  ((dragon wagon cavalry sailing-ship galley ) u* ( 3 2 2 4 3 ))
206  ((wizard paladin) dragon 1)	; dragonriders
207  (magic-items u* 0)		; magic items are negligible in size
208  (magic-items spells 99)	; ..but not to spells
209  )
210
211(table occupant-max
212  (wizard spells 6)
213  (dragon spells 1)
214  (u* magic-items 6)
215  )
216
217;; Unit-terrain relationships.
218
219;; Unit-material relationships.
220
221(table unit-storage-x
222  (wizard m* ( 10 100 6 ))
223  (i m* ( 16  0 10 ))
224  (b m* ( 16  0  6 ))
225  (k m* ( 16  0 12 ))
226  (P m* ( 12  4  6 ))
227  (R m* ( 16  0  6 ))
228  (H m* ( 10  8  6 ))
229  (s m* ( 10  0  6 ))
230  (dragon m* ( 200 30 6 ))	; dragons can eat alot!
231  (u m* (  0  0  4 ))
232  (spells food 0)
233  (spells metal 0)
234  (spells mana 3)
235  (L mana 2)
236  (E mana 8)	; it has extra duration
237  (C m* (  0  10 2 ))
238  (G m* ( 150 0  6 ))
239  (K m* ( 50 200 10 ))
240  (h m* ( 50  0 20 ))
241  (S m* ( 100 0 30 ))
242  (g m* (  50 0 15 ))
243  (w m* (  20 0  6 ))
244  (c m* ( 200 0 30 ))
245  (T m* ( 100 60 20 ))
246  (_ m* ( 100 0 25 ))
247  (t m* ( 100 8 20 ))
248  (village m* ( 150 0 15 ))
249  (town m* ( 300 0 30 ))
250  (city m* ( 600 0 60 ))
251  (r m* 10)
252  (f food 10)
253  (a mana 100)	; holds lots of power, might have it all when found!
254  )
255
256;;; Vision.
257
258(add cities see-always 1)
259
260;; Dragons are hard to miss...
261
262(add dragon see-always 1)
263
264(add flyers vision-range 3)
265(add spells vision-range -1)
266(add wizard-eye vision-range 4)
267(add magic-items vision-range -1)
268(add bases vision-range 2)
269(add cloudkeep vision-range 5)
270(add tower vision-range 4)
271(add wall vision-range 2)	; can see a little ways from walls.
272(add city vision-range 3)	; Cities have tall structures.
273(add town vision-range 2)
274(add castle vision-range 3)
275(add longbowmen vision-range 2)	; Archers are good at knowing the surrounding land.
276(add (galley sailing-ship) vision-range ( 2 3 ))	; ships can see far over flat water
277(add crystal-ball vision-range 10)
278
279; visibility of stuff
280; non 0/1 visibility must be harsh on CPU! keep # of units with this down
281;FIX visibility is U T -> N, U's % visibility in T
282(table visibility add (cloudkeep t* 20))	; hard to spot in them clouds!
283(table visibility add (C t* 5))	; hard to spot in the clouds
284(table visibility add (R t* 50))	; Archers are good at hiding on the land.
285(table visibility add (E t* 0))	; invisible spy-eye
286(table visibility add (magic-items t* 20))	;  magic items are sometimes hard to spot.
287
288; small forces hidden by rough terrain
289;FIX conceal is now visibility, you should subtr these numbers from that table
290;FIX ( 80 75 60 40 ) ( forest swamp mountains hills ) R conceal
291
292;;; Actions.
293
294;                         W i b k P R H s  D u h G C  K S g
295(add movers acp-per-turn (1 2 3 2 2 3 2 1 10 1 6 5 12 4 5 7))
296
297;                         A L F M E
298(add spells acp-per-turn (2 9 5 3 6))
299
300(add cities acp-per-turn 1)
301
302;;; Movement.
303
304(add bases speed 0)
305(add cloudkeep speed 1.00)
306(add magic-items speed 0)
307
308(table mp-to-enter-terrain
309  (u* t* 99)
310  (bases land 1)
311  (ships water 1)
312  ;; Flyers can go almost anywhere.
313  (flyers t* 1)
314  ;; Spells can "go" almost anywhere.
315  (spells t* 1)
316  (wizard land (2 1 1 1 1 2))
317  (i land (2 1 1 1 1 2))
318  (b land (2 1 2 1 1 2))
319  (k land (2 1 2 2 2 2))
320  (P land (1 1 1 1 2 2))
321  (R land (1 1 1 1 1 2))
322  (H land (2 1 2 2 2 2))
323  (s land (2 1 2 1 2 2))
324  (u land (1 1 1 1 1 2))
325  (G land (99 1 2 2 3 4))
326  (h land (3 1 2 2 3 4))
327  ;; Some type can handle ice!
328  (( wizard barbarian paladin longbowmen undead ) ice 1)
329  ;; Nothing can go into the void!
330  (u* void 99)
331  )
332
333(table consumption-per-move
334  ;; All units take 1 fuel to move.
335  (movers food 1)
336  ;; This is actually lost food production.
337  (s food 4)
338  ;; Magical things don't require food to move....
339  (u food 0)
340  (cloudkeep food 0)
341  (cloudkeep mana 1)	; floating castle requires mana to move
342  (spells food 0)
343  (spells mana 1)
344  (C food 0)
345  (S food 0)	; they sail!
346  )
347
348(table mp-to-enter-unit
349  (flyers u* 20)
350  ;; Once launched, spells can't be recovered.
351  (spells u* 99)
352  (ships bases 20)
353  (ships bases 1)
354  )
355
356;; Let everything attack everywhere, no terrain immunity.
357
358(table ferry-on-entry (u* u* over-all))
359
360;;; Construction.
361
362;; Mages must first figure out how to cast their spells!
363#|
364(add spells tech-max 200)
365(add M tech-max 300)
366(add A tech-max 1000)
367(add magic-items tech-max 50)
368(add spells tech-to-build 200)
369(add M tech-to-build 300)
370(add A tech-to-build 1000)
371(add magic-items tech-to-build 50)
372
373(table acp-to-develop
374  (wizard spells 1)
375  (wizard magic-items 1)
376  )
377
378(table tech-per-develop
379  (wizard spells 1.00)
380  (wizard magic-items 1.00)
381  )
382|#
383
384(add spells cp 2)
385
386(add (dragon undead flying-carpet cloudkeep tower) cp (25 2 10 30 10))
387
388(add bases cp (6 25 15 20 20 6 30 35 40))
389
390(add ( i b  R  H s G  h  S  g  W  k  P )
391  cp ( 6 8 10 18 6 7 18 19 16 30  9 20))
392
393(add camp cp 7)
394(add temple cp 15)
395(add magic-items cp (12 12 9 6 15))
396
397(table can-create
398  (wizard spells 1)
399  (wizard (dragon undead flying-carpet cloudkeep tower) 1)
400  (wizard magic-items 1)
401  ((i k R) camp 1)
402  ;; Paladins and priests can make shrines.
403  ((paladin priest) temple 1)
404  ;; Priest can raise the dead, despite dubious holiness of it...
405  (priest undead 1)
406  (priest magic-items 1)
407  (priest a 0)
408  (dragon fireball 1)
409  (serfs bases 1)
410  (serfs cloudkeep 0)
411  (castle (i k paladin cavalry) 1)
412  (tower wizard 1)
413  (cloudkeep spells 1)
414  (temple (paladin priest) 1)
415  (cities mundanes 1)
416  ;; Villages have some limitations on the training possible.
417  (village (k paladin) 0)
418  (city wizard 1)
419  )
420
421(table acp-to-create
422  (wizard spells 1)
423  (wizard (dragon undead flying-carpet cloudkeep tower) 1)
424  (wizard magic-items 1)
425  ((i k R) camp 1)
426  ;; Paladins and priests can make shrines.
427  ((paladin priest) temple 1)
428  ;; Priest can raise the dead, despite dubious holiness of it...
429  (priest undead 1)
430  (priest magic-items 1)
431  (priest a 0)
432  (dragon fireball 1)
433  (serfs bases 1)
434  (serfs cloudkeep 0)
435  (castle (i k paladin cavalry) 1)
436  (tower wizard 1)
437  (cloudkeep spells 1)
438  (temple (paladin priest) 1)
439  (cities mundanes 1)
440  ;; Villages have some limitations on the training possible.
441  (village (k paladin) 0)
442  (city wizard 1)
443  )
444
445(table cp-on-creation
446  (wizard magic-items (3 7 2 1 1))
447  (priest magic-items (1 1 1 3 1))
448  ;; Castles are well-equipped to train military units.
449  (castle (i k paladin cavalry) (2 2 4 4))
450  ;; Towns and cities build faster by having new units more complete.
451  (town ( i b  R  H s G  h  S  g  W  k  P )
452        ( 2 2  1  4 2 1  3  6  4  1  1  1 ))
453  (city ( i b  R  H s G  h  S  g  W  k  P )
454        ( 3 3  1  6 2 2  5  7  8  6  3  1 ))
455  )
456
457(table can-build
458  (wizard spells 1)
459  (wizard (dragon undead flying-carpet cloudkeep tower) 1)
460  (wizard magic-items 1)
461  ((i k R) camp 1)
462  (dragon fireball 1)
463  ((paladin priest) temple 1)
464  (priest undead 1)
465  (priest magic-items 1)
466  (priest a 0)
467  (serfs bases 1)
468  (serfs cloudkeep 0)
469  (castle (i k paladin cavalry) 1)
470  (tower wizard 1)
471  (cloudkeep spells 1)
472  (temple (paladin priest) 1)
473  (cities mundanes 1)
474  (village (k paladin) 0)
475  (city wizard 1)
476  )
477
478(table acp-to-build
479  (wizard spells 1)
480  (wizard (dragon undead flying-carpet cloudkeep tower) 1)
481  (wizard magic-items 1)
482  ((i k R) camp 1)
483  (dragon fireball 1)
484  ((paladin priest) temple 1)
485  (priest undead 1)
486  (priest magic-items 1)
487  (priest a 0)
488  (serfs bases 1)
489  (serfs cloudkeep 0)
490  (castle (i k paladin cavalry) 1)
491  (tower wizard 1)
492  (cloudkeep spells 1)
493  (temple (paladin priest) 1)
494  (cities mundanes 1)
495  (village (k paladin) 0)
496  (city wizard 1)
497  )
498
499(table cp-per-build
500  ;; Temples are very good at educating the priesthood.
501  (temple priest 2)
502  )
503
504;; Material needed to make units.
505
506;  mana required for magical stuff
507; typical mage should get 2 to 4 mana per turn, dep on site...
508
509(table consumption-per-built
510  ;               A  L   F  M  E
511  (spells mana ( 50 14  12 20  6 ))
512  ((dragon undead cloudkeep flying-carpet ) mana ( 200 10 400 80 ))
513  ; most units don't really take food to make...
514  ; but armoured ones take metal...
515  (i metal 3)
516  (k metal 15)
517  (P metal 15)
518  (G metal 5)
519  (S metal 40)
520  (g metal 25)
521  (w metal 20)
522  (c metal 80)
523  (T metal 20)
524  (_ metal 3)
525  (cities metal (45 60 120))
526  (magic-items mana ( 30 20 25 10 60 ))
527  )
528
529;; Newly-created units start out with nothing, but magic-related things
530;; get some or all of their mana for free.
531
532(table supply-on-completion
533  (magickers mana (30 10)) ; magic casters get about 1/3 of their mana capacity
534  (spells mana 9999)
535  (magic-items mana 9999)
536  )
537
538;;; Repair.
539
540(add cavalry hp-recovery 0.25)
541(add serfs hp-recovery 0.33)
542(add (paladin R) hp-recovery 0.50)
543(add dragon hp-recovery 1.00)
544(add cities hp-recovery 0.25)
545
546#| need to fix this up still
547;(table acp-to-repair add ( W 1))
548;(table hp-per-repair add ( W ( 33 33 33 25 50 33 33 33 33 50 33 33 33 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 )))
549(table acp-to-repair add (i bases 1))
550(table hp-per-repair add (i bases 50))
551(table acp-to-repair add (b galley 1))
552(table hp-per-repair add (b galley 50))
553(table acp-to-repair add (b bases 1))
554(table hp-per-repair add (b bases 33))
555(table acp-to-repair add (k castle 1))
556(table hp-per-repair add (k castle 50))
557(table acp-to-repair add (P bases 1))
558(table hp-per-repair add (P bases 50))
559(table acp-to-repair add (R _ 1))
560(table hp-per-repair add (R _ 50))
561(table acp-to-repair add (H foot 1))
562(table hp-per-repair add (H foot 100))
563(table acp-to-repair add (s bases 1))
564(table hp-per-repair add (s bases 100))
565(table acp-to-repair add (s G 1))
566(table hp-per-repair add (s G 100))
567(table acp-to-repair add (s S 1))
568(table hp-per-repair add (s S 50))
569(table acp-to-repair add (W cloudkeep 1))
570(table hp-per-repair add (W cloudkeep 50))	;  Wizards slowly repair cloud castles
571(table acp-to-repair add (G foot 1))
572(table hp-per-repair add (G foot 50))
573
574(table acp-to-repair add (bases u* 1))
575(table hp-per-repair add (bases u* 100))
576(table acp-to-repair add (forts u* 1))
577(table hp-per-repair add (forts u* 100))
578(table acp-to-repair add (cities u* 1))
579(table hp-per-repair add (cities u* 100))
580(table acp-to-repair add (forts forts 1))
581(table hp-per-repair add (forts forts 25))	; forts have a few people who can fix them
582(table acp-to-repair add (c ( i cloudkeep cavalry ) 1))
583(table hp-per-repair add (c ( i cloudkeep cavalry ) 100))
584(table acp-to-repair add (T wizard 1))
585(table hp-per-repair add (T wizard 100))
586(table acp-to-repair add (t foot 1))
587(table hp-per-repair add (t foot 100))
588|#
589
590;;; Combat.
591
592;                    W i b k P R H s D u h G  C K S  g
593(add movers hp-max ( 2 2 2 3 4 2 2 2 8 4 3 1 10 4 3 10))
594
595;; Spells need more than 1 hp so they can survive an attack when attacking.
596
597(add spells hp-max 2)
598
599;                    w  c T t K _  V  ~  @
600(add bases hp-max ( 10 20 8 4 4 8 15 30 45 ))
601
602(add magic-items hp-max 1)
603
604(add W speed-damage-effect ((1 50) (2 100)))
605(add i speed-damage-effect ((1 50) (2 100)))
606(add b speed-damage-effect ((1 50) (2 100)))
607(add k speed-damage-effect ((1 50) (2 100)))
608(add P speed-damage-effect ((2 50) (3 100)))
609(add R speed-damage-effect ((1 50) (2 100)))
610;; should add more?
611(add D speed-damage-effect ((2 20)))
612
613;; Split the matrix in half to make it fit on an 80 col screen.
614
615(define u1 (  W   i   b   k   P   R   H   s   D   u   G   C   h ))
616(define u2 (  A   L   F   K   S   g   w   c   T   _   t   V   ~   @ ))
617
618; so, here we define the units by how good they are at hitting others
619; ranges:  30% is typical attack percent.
620; it ranges up and down from there...
621
622(table hit-chance
623  ;        W   i   b   k   P   R   H   s   D   u   G   C   h
624  (W u1 ( 25  35  10  30  10  35  20  40  40  30  40  40  30 ))
625  (i u1 ( 50  30  40  20  15  60  25  45  10  20  40  30  20 ))
626  (b u1 ( 45  45  35  25  25  55  35  45  15  30  50  20  25 ))
627  (k u1 ( 35  40  45  25  20  65  30  50  20  30  30  15  30 ))
628  (P u1 ( 40  40  45  35  30  80  30  30  40  50  30  15  30 ))
629  (R u1 ( 30  45  50  25  20  65  30  40  20  15  30  30  25 ))
630  (H u1 ( 30  20  35  20  20  50  35  30  10  45  30  10  20 ))
631  (s u1 ( 20  10  15   5   3  10  10  30   1  10  30   5  10 ))
632  (D u1 ( 40  50  55  35  20  70  40  80  30  40  60  40  80 ))
633  (u u1 ( 20  30  35  20  10  50  10  50  10  30  40  30  30 ))
634  (A u1 ( 50  99  60  90  70  90  80  99  60  99  99  99  99 ))
635  (L u1 ( 50  80  50  90  60  80  80  99  70  99  99  99  99 ))
636  (F u1 ( 50  90  50  80  60  90  80  99  60  99  99  99  99 ))
637  (G u1 (  0   0   0   0   0   0   0   0   0   0   0   0   0 ))
638  (C u1 (  0   0   0   0   0   0   0   0   0   0   0   0   0 ))
639  (K u1 ( 10   5   5   5   5   5   5   5  25   5  15  20   5 ))
640  (h u1 ( 50  45  50  30  30  70  40  60  25  40  50  15  30 ))
641  (S u1 (  0   0   0   0   0   0   0   0   0   0   0   0   0 ))
642  (g u1 (  0   0   0   0   0   0   0   0   0   0   0   0   0 ))
643  (w u1 ( 11  30  35  20  10  40  30  40  20  30   0   0  20 ))
644  (c u1 ( 10  40  40  25  12  40  35  40  25  35   0   0  20 ))
645  (T u1 ( 10  35  35  20  10  40  30  40  20  30   0   0  20 ))
646  (_ u1 (  5  20  17  15  10  25  20  30  10  20   0   0  10 ))
647  (t u1 (  8  25  30  20  18  35  30  40  15  35   0   0  15 ))
648  (V u1 (  9  25  30  20  15  30  30  40  15  20   0   0  25 ))
649  (~ u1 ( 10  30  35  25  20  40  35  45  20  25   0   0  30 ))
650  (@ u1 ( 15  35  40  30  25  50  40  50  25  30   0   0  30 ))
651
652  ;        A   L   F   K   S   g   w   c   T   _   t   V   ~   @
653  (W u2 (  1   1   1  50  30  40  25  20  25  30  35  40  40  40 ))
654  (i u2 (  1   1   1  10  10  10  10  10  10  25  20  20  20  20 ))
655  (b u2 (  1   1   1  10  10  10   8   5   8  40  30  50  50  50 ))
656  (k u2 (  1   1   1  10  10  10   9   9  10  20  25  30  30  30 ))
657  (P u2 (  1   1   1  11   7   8  15  15  15  20  40  20  20  20 ))
658  (R u2 (  1   1   1   8   5   5   8   8   8  30  30  30  30  30 ))
659  (H u2 (  1   1   1   3   4   4   4   4   4  20  50   5   5   5 ))
660  (s u2 (  1   1   1   1   2   2   1   2   2  20  15  20  20  20 ))
661  (D u2 (  1   1   1  20  60  50  30  25  28  50  40  60  60  60 ))
662  (u u2 (  1   1   1   2  10  10  11  11  10  30  20  30  30  30 ))
663  ; there is some value in chances >100%, since may be adjusted
664  ; downwards by other factors, but for now they're not allowed.
665  ;(A u2 (  1   1   1  30 199 199 199 150 150 299  70 130 110 100 ))
666  (A u2 (  1   1   1  30 100 100 100 100 100 100  70 100 100 100 ))
667  (L u2 (  1   1   1  30  40  40  80  80  80  99  70  90  90  80 ))
668  (F u2 (  1   1   1  30  99  99  60  50  69  99  75  90  90  90 ))
669  (G u2 (  1   1   1   0   0   0   0   0   0   0   0   0   0   0 ))
670  (C u2 (  1   1   1   0   0   0   0   0   0   0   0   0   0   0 ))
671  (K u2 (  1   1   1  40   0   0   0   0   0   0   0   0   0   0 ))
672  (h u2 (  1   1   1  10  10  10   6   6   9  40  35  30  30  30 ))
673  (S u2 (  1   1   1   0  20  10   0   0   0   0   0   0   0   0 ))
674  (g u2 (  1   1   1   0  50  30   0   0   0   0   0   0   0   0 ))
675  (w u2 (  1   1   1   0   0   0   0   0   0   0   0   0   0   0 ))
676  (c u2 (  1   1   1   0   0   0   0   0   0   0   0   0   0   0 ))
677  (T u2 (  0   1   0   0   0   0   0   0   0   0   0   0   0   0 ))
678  (_ u2 (  0   0   0   0   0   0   0   0   0   0   0   0   0   0 ))
679  (t u2 (  0   0   0   0   0   0   0   0   0   0   0   0   0   0 ))
680  (V u2 (  0   0   0   0   0   0   0   0   0   0   0   0   0   0 ))
681  (~ u2 (  0   0   0   0   0   0   0   0   0   0   0   0   0   0 ))
682  (@ u2 (  0   0   0   0   0   0   0   0   0   0   0   0   0   0 ))
683
684  (E u* 0)
685  (M u* 10)	; can do some damage as it attempts to capture
686
687  ; and this allows ti to even attack...
688  (movers spells 50)	;  spells can be killed by attacking them, but
689  (movers M 10)
690  ; they shouldn't have much time where they can be attacked.
691  ; they are either in-flight, or stored on someone!
692  (u* magic-items 100)
693  (magic-items u* 0)
694  )
695
696(table defend-terrain-effect
697  (foot ( forest swamp mountains hills ) 85)
698  (hvyfoot ( forest swamp mountains hills ) 90)
699  ;; Archers are good at using terrain to hide in.
700  (R ( forest swamp mountains hills desert ) (25 40 40 60 90))
701  (forts ( hills mountains ) 60)
702  (tower ( hills mountains ) (80 50))
703  (castle ( hills mountains ) (80 50))
704  )
705
706(table damage
707  (u* u* 1)		; default
708  (dragon u* 2)
709  (u* magic-items 0)	;  otherwise, items are always destroyed by capture
710  (dragon bases 3)
711  (dragon cities 4)
712  (barbarian bases 3)	; barbarians torch them cities!
713  (R dragon 4)		; rangers with those special arrows!
714  (g ships 2)
715  ((paladin priest) undead 3)
716  (cavalry ltfoot 1)
717  (fireball ships 4)
718  (fireball cities 4)
719  (fireball u* 2)
720  (fireball camp 4)
721  (lightning u* 3)
722  (M u* 1)		; it might do some damage as the victim struggles
723  (A u* 21)		; Armageddon spells are nuclear!
724  (magic-items u* 0)	; magic items can't hurt anything
725  )
726
727(table acp-to-defend
728  (spells u* 0)		; they're specifically targeted!
729  (w u* 0)		; walls don't fight back! They're just walls!
730  (magic-items u* 0)
731  )
732
733; these units may be persuaded to go traitor
734
735(table capture-chance
736  (W ( W i k s D u A L F G K T ) ( 20 20 20 40 20 40 30 30 30 20 50 40 ))
737  ;                                   s  G h  S  g  w c  T  _  t  V  ~  @
738  (i ( s G h S g w c T _ t V ~ @ ) ( 40 50 5 30 30 10 5  8 30 20 40 25 15 ))
739  (b ( s G h S g w c T _ t V ~ @ ) ( 40 50 5 45 40  8 3  7 40 25 20 10  7 ))
740  (R ( s G h S g w c T _ t V ~ @ ) ( 10 20 5 10 10  8 3  7 40 25 45 25 10 ))
741  (k ( s G h S g w c T _ t V ~ @ ) ( 45 40 5 15 10 12 6  9 35 25 45 25 13 ))
742  (P ( s G h S g w c T _ t V ~ @ ) ( 50 30 8 20 20 11 7 10 36 45 40 20 10 ))
743  (h ( s G h S g w c T _ t V ~ @ ) ( 50 40 5  5  5  5 1  5 60 30 40 20 10 ))
744  (H ( s G h           _ t V ~ @ ) ( 60 10 10              20 35 40 15 15 ))
745  (u ( G S   S g w c T _ t V ~ @ ) ( 40 50   25 30 11 6  9 20 10 15 10  5 ))
746  (H ( i barbarian undead ) ( 20 15 40 ))	; priests can convert people!
747  (s ( serfs wagon cloudkeep camp V ~ @ ) ( 20 30 45 30 30 20 15 ))
748  ; the Charm Spell...
749  (M u* 100)	; the standard default
750  ; the 200% of M vs _ is not accepted, though perhaps it should be.
751  (M ( w c T _ t V ~ @ ) ( 100 50 100 100 #|200|# 25 60 50 40 ))
752  ; works better against low populations
753  (M ( wizard paladin priest dragon cloudkeep tower ) ( 50 10 40 50 25 80 ))
754  ;; Magical items don't have loyalty.
755  (u* magic-items 100)
756  )
757
758(table protection
759  ;; Generic bases protect their occupants ok.
760  (bases u* 70)
761  ;; Forts protect their occupants very well.
762  (forts u* 20)
763  (camp movers 80)
764  (village movers 80)
765  (town movers 70)
766  (city movers 60)
767  (( i k paladin wizard ) forts 50)
768  (u forts 60)
769  (( i k paladin wizard ) bases 70)
770  (H temple 50)	; priests and their temples...
771  ;; wiz's protect their towers and keeps very well
772  (wizard ( cloudkeep tower ) 20)
773  ;; Ring of protection reduces hit-chance by 20%.
774  (u* p 80)
775  )
776
777(table withdraw-chance-per-attack
778  (u* movers 10)
779  (u* longbowmen 33)	; those rangers like to run away!
780  (u* ships 0)		; boats can't retreat!
781  )
782
783(table consumption-per-attack
784  ;; Dragon feeds on enemies!
785  (dragon food -5)
786  ;; Mages use spells in combat!
787  (wizard mana 1)
788  ;; Cloudcastles throw stuff down to attack.
789  (cloudkeep metal 1)
790  )
791
792;;; Detonation.
793
794;; Nuke spell works by detonation rather than by conventional attack actions.
795
796(add A acp-to-detonate 1)
797
798(add A hp-per-detonation 2)
799
800(table detonation-damage-at (A u* 60))
801
802(table detonation-damage-adjacent (A u* 1))
803
804(table detonation-terrain-damage-chance
805  (A (plains forest ice) 100)
806  )
807
808(table terrain-damaged-type
809  (plains desert 1)	; plains become desert always
810  (forest plains 1)	; trees are all blown down
811  (ice mountains 1)	; ice melts
812  )
813
814;;; Texts.
815
816(set action-notices '(
817  ((destroy A u*) (actor " vaporizes " actee "!"))
818  ((destroy lightning u*) (actor " electrocutes " actee "!"))
819  ((destroy fireball u*) (actor " incinerates " actee "!"))
820  ((destroy u* wizard) (actor " slays " actee "!"))
821  ((destroy u* paladin) (actor " slays " actee "!"))
822  ((destroy u* priest) (actor " slays " actee "!"))
823  ((destroy u* dragon) (actor " slays " actee "!"))
824  ((destroy u* land) (actor " defeats " actee "!"))
825  ((destroy u* ships) (actor " sinks " actee "!"))
826  ((destroy u* flyers) (actor " knocks down " actee "!"))
827  ((destroy u* bases) (actor " sacks " actee "!"))
828  ))
829
830(set event-notices '(
831  ((unit-died-in-accident wizard) (0 " disappears in a puff of smoke!"))
832  ((unit-died-in-accident D) (0 " returns to its lair to hibernate and disappear into legend"))
833  ((unit-died-in-accident S) (0 " was lost in a storm"))
834  ((unit-died-in-accident g) (0 " was lost in a storm"))
835  ))
836
837;;; Other Actions.
838
839(add u* acp-to-disband 1)
840
841(add u* hp-per-disband 100)
842
843;; Magic items can't be destroyed!
844
845(add magic-items hp-per-disband 0)
846
847;;; Scoring.
848
849(add bases point-value ( 1 20 8 8 30 2 8 10 50 ))
850(add serfs point-value 5)	; serfs are valuable!
851
852(scorekeeper (do last-side-wins))
853
854(table acp-to-repair add (r u* 1))
855(table hp-per-repair add (r u* 100))	; ring of regeneration magically fixes everything!
856; ring must be able to hold supplies to perform repairs! Sheesh!
857
858;;; Backdrop.
859
860(table base-production
861  (wizard mana 5)
862  (dragon mana 4)
863  (H mana 2)
864  (cloudkeep mana 12)
865  (tower mana 5)
866  (t mana 2)
867  (paladin mana 1)
868  (r m* 1)	; ring produces everything, just in case...
869  (f food 6)	; FOOD!
870  (a mana 6)	; amulet of power generates mana
871  (( priest serfs tower castle ) metal ( 2 4 1 2 ))
872  (cities metal (4 8 16))
873  ((W i b k P R H s c T _ t K) food (1 2 4 2 3 6 4 10 2 1 3 6 3))
874  (cities food (8 12 16))
875  )
876
877(table productivity
878  (u* t* 100)
879  (foot sea 0)
880  (hoof sea 0)
881  ((paladin priest) sea 50)
882  (magic-items t* 100)
883  ;           sea swp des pln for hil mtn ice voi
884  ;            .   =   -   +   %   ~   ^   _   :
885  (wizard t* ( 60  60  60  40  60  80 100 120  0 ))	; 1 per 20%
886  (dragon t* ( 75  50  50  50  75  75 100 125  0 ))	; 1 per 25%
887  (T t* (  0  60  40  40  60  80 100 120  0 ))	; 1 per 20%
888  ; considerable advantage for mana production on 'ice' and other
889  ; difficult terrain.
890  ; ice is usually highest mountain.
891  ; note, building a tower on ice is a pain, as a wiz must do it!
892  ; swamp/plains/forest/desert/hills/mountains = land
893  (i land (  50 100  90 20  25  50 ))	; one arg must be a scalar...
894  (b land (  50 100  90 20  25  50 ))
895  (k land (  00 100  90 20  25  50 ))
896  (P land (  50 100 100 50 100  75 ))
897  (R land ( 100 100 100 50 100 100 ))
898  (H land (  75 100 100 50  75  75 ))
899  (s land (  50 100  90 70  75  50 ))
900  (_ land (  50 100  90 70  75  50 ))
901  (t land (  50 100  90 70  75  50 ))
902  (V land (  50 100  90 25  75  50 ))
903  (town land (  50 100  90 25  75  50 ))
904  (city land (  50 100  90 25  75  50 ))
905  (ships sea 100)
906  (cloudkeep t* 100)
907  )
908
909(table base-consumption
910  (movers food 1)	; all consume 1 food per turn, except...
911  (( i k ) food 2)	; many infantry per unit, knights are pigs
912  (dragon food 2)	; dragons are voracious!
913  (undead food 0)	; just skeletons, not ghouls!
914  (spells food 0)
915  (C food 0)
916  ((cavalry wagon) food 2)	; horses eat a lot
917  (g food 1)		; crew needs to eat more when active
918  (spells mana 1)	; spells burn mana in-flight
919  (C mana 1)		; magic carpet burns mana in flight
920  )
921
922(table consumption-as-occupant
923  (u* m* 1)
924  (spells m* 0)	; spells in storage require no mana support
925  (ships m* 0)	; ships not at sea need no food...
926  (magic-items m* 0)	; they dont consume anyway!
927  )
928
929(table out-length
930  (movers m* 0)		; most movables can't supply other things
931  (bases m* 1)		; bases somewhat supply neighbors
932  (cities m* 2)		; cities trade with surrounding lands
933  (wizard mana 0)	; mages selfishly hoard magic to themselves
934  (wagon food 2)	; wagons are supply vehicles
935  (serfs m* 1)		; serfs will trade supplies to units near them
936  (cloudkeep mana 3)	; flying citadel magically transmits its mana
937  (magic-items m* 0)
938  (a mana 2)
939  )
940
941(table in-length
942  (movers m* 1)		; but they can be supplied by nearby things.
943  (bases m* 1)		; bases can receive things from neighbors.
944  (cities m* 2)		; cities trade more widely
945  (spells mana -1)	; you have to charge the spells yourself
946  (serfs m* 1)
947  (magic-items m* 0)
948  (a mana -1)		; amulet doesn't take mana, just gives it!
949  )
950
951(table hp-per-starve
952  ;; In general, lack of food is a problem.
953  (u* food 1.00)
954  (undead food 0)
955  (spells food 0)
956  (magic-items food 0)
957  ;; Archer, barbarian can live off the land.
958  ((longbowmen barbarian) food 75)
959  ;; Holy dudes are used to fasting.
960  ((paladin priest) food 50)
961  ;; ... so are peasants.
962  (serfs food 33)
963  ;; When the mana is gone, so is the spell.
964  (spells mana 1.00)
965  )
966
967;;; Random events.
968
969(add magickers revolt-chance 5)	; sure, tell wizards and dragons orders! Good luck!
970(add barbarian revolt-chance 5)	; those crazy barbarians
971(add serfs revolt-chance 50)	; serfs don't enjoy being oppressed
972
973(table surrender-chance
974  (forts u* 50)
975  (cities u* ( 100 60 30 ))
976  (cloudkeep u* 0)
977  )
978
979;FIX 1500 bases siege	; most things could be sieged easily
980;FIX 350 forts siege	; rare for a siege to take a fort...
981;FIX ( 1500 3000 3000 ) cities siege	; medieval cities fell easily
982;FIX 0 cloudkeep siege
983
984;; Attrition. Mostly ships at sea.
985
986(table attrition
987  (ships sea ( 50  200 ))
988  (foot ( mountains  swamp ) 100)
989  (hvyfoot ( mountains swamp ) 200)
990  (hoof ( mountains swamp ) 300)
991;  (magickers t* 50)
992  )
993
994;FIX "gets caught in a storm" ships attrition-message
995;FIX "had a dangerous Arcane accident" magickers attrition-message
996
997(table accident-hit-chance
998  ;; ships aren't too seaworthy...
999  (ships sea (10 50))
1000  ;; heavy-foot units should have accidents in swamp and/or mountains.
1001  (foot (mountains swamp) 50)
1002  (hoof (mountains swamp) 100)
1003  ;; Magickers should have 'accidents'.
1004  (magickers t* 5)
1005  )
1006
1007(table accident-damage
1008  (ships sea (1 2))
1009  (foot (mountains swamp) 1)
1010  (hoof (mountains swamp) 1)
1011  (magickers t* 1)
1012  )
1013
1014;FIX "fell down and couldn't get up!" foot accident-message
1015;FIX "broke down and had to be destroyed." hoof accident-message
1016
1017;;; Setup.
1018
1019;                            sea swp des pln for hil mtn ice voi
1020;                             .   =   -   +   %   ~   ^   _   :
1021(add t* alt-percentile-min (   0  29  70  70  70  75  93  99   0 ))
1022(add t* alt-percentile-max (  69  71  93  93  93  98  99 100   0 ))
1023
1024(add t* wet-percentile-min (   0  50   0  20  80   0   0   0   0 ))
1025(add t* wet-percentile-max ( 100 100  20  80 100  99 100 100   0 ))
1026
1027(set edge-terrain void)
1028
1029(set country-radius-min 4)
1030(set country-separation-min 17)
1031(set country-separation-max 90)
1032
1033(add cities start-with ( 1 2 1 ))
1034(add (castle serfs temple wizard) start-with ( 1 4 1 1 ))
1035
1036(table independent-density
1037  (village land 60)
1038  (town land 30)
1039  (city land 15)
1040  ;; some rare freaks to find
1041  (cloudkeep t* 1)
1042  (serfs plains 50)
1043  (wizard land 2)
1044  (flying-carpet land 5)
1045  (tower land 10)
1046  (temple land 20)
1047  (dragon (plains mountains) 5)
1048  ;; Some random ones to be lying around easy to capture.
1049  (magic-items t* 5)
1050  (magic-items water 0)
1051  )
1052
1053(table favored-terrain
1054  (u* sea 0)
1055  (u* land 30)
1056  (forts land 100)
1057  ;; Flying citadels could be anywhere!
1058  (cloudkeep t* 100)
1059  (cloudkeep void 0)
1060  (magickers land 30)
1061  (magickers hills 60)
1062  (magickers mountains 100)
1063  (serfs land ( 20 100 80 10 40 20 ))
1064  (hoof mountains 0)	; just in case...
1065  (cities land 20)
1066  (cities plains 100)
1067  (magic-items water 0)	; they'd sink!
1068  ;; Nothing goes in the void.
1069  (u* void 0)
1070  )
1071
1072(add u* already-seen 100)
1073
1074;; Don't let rare magical stuff be visible.
1075
1076(add flying-carpet already-seen 0)
1077(add cloudkeep already-seen 0)
1078(add magic-items already-seen 0)
1079
1080(add u* initial-seen-radius 5)
1081
1082(include "ng-weird")
1083
1084(add (wizard dragon) namer "short-generic-names")
1085(add cities namer "short-generic-names")
1086
1087(doctrine magicker-doctrine
1088  (construction-run (spells 1))
1089  )
1090
1091(side-defaults
1092  (doctrines (magickers magicker-doctrine))
1093  )
1094
1095;;; Documentation.
1096
1097(game-module (instructions (
1098  )))
1099
1100(game-module (notes (
1101  )))
1102
1103(game-module (design-notes (
1104  )))
1105