File: fantasy.g

package info (click to toggle)
xconq 7.1.0-7
  • links: PTS
  • area: main
  • in suites: hamm
  • size: 7,056 kB
  • ctags: 7,960
  • sloc: ansic: 88,493; perl: 2,057; sh: 1,766; makefile: 1,110; csh: 81; awk: 47; lisp: 39
file content (1046 lines) | stat: -rw-r--r-- 41,075 bytes parent folder | download
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
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
(game-module "fantasy"
  (title "Swords and Sorcery")
  (blurb "Fantasy warfare period...")
  (variants
   (see-all false)
   (world-seen false)
   (world-size)
   )
)

; movers & fighters
(unit-type W (name "wizard") (char "W")
  (help "Magician, wielder awesome magic"))
(unit-type i (name "light infantry") (char "i")
  (help "Foot soldiers and mercenaries."))
(unit-type b (name "barbarian") (char "b")
  (help "Rugged, ferocious, lightly armoured warriors."))
(unit-type k (name "heavy infantry") (char "k")
  (help "Foot soldiers in heavy armour"))
(unit-type P (name "paladin") (char "P")
  (help "Holy warrior, extremely tough and well equipped"))
(unit-type R (name "longbowmen") (char "R")
  (help "Archers, scouts, rangers"))
(unit-type H (name "priest") (char "H")
  (help "The Spiritual guides of the land"))
(unit-type s (name "serfs") (char "s")
  (help "Mobs of Peasant serfs and levies"))
(unit-type D (name "dragon") (char "D")
  (help "Dragon, lays waste to the lands"))
(unit-type u (name "undead") (char "u")
  (help "Undead warriors, raised by priests or wizards"))
(unit-type h (name "Horse Cavalry") (char "h")
  (help "Knights that ride horses."))

; magical effects
(unit-type A (name "Armageddon spell") (char "A")
  (help "spell of awesome destruction"))
(unit-type L (name "Lightning spell") (char "L")
  (help "spell good for killing tough things"))
(unit-type F (name "Fireball spell") (char "F")
  (help "spell great for causing lots of damage to soft targets"))
(unit-type M (name "Mass Charm") (char "M")
  (help "spell that charms units over to the caster's side!"))
(unit-type E (name "Wizard Eye") (char "E")
  (help "spell for spying on things"))

; transport
(unit-type G (name "wagon") (char "G")
  (help "Wagons, logistical unit"))
(unit-type C (name "flying carpet") (char "C")
  (help "Magical flying carpet"))
(unit-type cloudkeep (char "K") (image-name "city30")
  (help "wizard's floating keep"))
(unit-type S (name "sailing ship") (char "S")
  (help "ship, for traveling the seas"))
(unit-type g (name "galley") (char "g")
  (help "fast, light, not so seaworthy warship"))

; forts, bases and other special places
(unit-type w (name "wall") (char "w")
  (help "fortified walls"))
(unit-type c (name "castle") (char "c")
  (help "walled castle"))
(unit-type tower (char "T")
  (help "fortified mage's tower"))
(unit-type / (name "camp") (char "/")
  (help "campsite, practically a mobile village"))
(unit-type temple (char "t") (image-name "parthenon")
  (help "holy place of spiritual power"))

; cities
(unit-type V (name "village") (char "V")
  (help "small town"))
(unit-type * (name "town") (char "*")
  (help "smaller than a city"))
(unit-type @ (name "city") (char "@")
  (help "Large city, seat of a city-state"))

; magical items
(unit-type r (name "ring of regeneration") (char "r")
  (help "magical ring that makes its wearer heal faster"))
(unit-type B (name "crystal ball") (char "B")
  (help "magical device that scans the local area"))
(unit-type p (name "ring of protection") (char "p")
  (help "protective magical device"))
(unit-type f (name "everfull plate") (char "f")
  (help "magical wondor that creates food!"))
(unit-type a (name "amulet of power") (char "a")
  (help "generates mana for its wearer"))

(material-type food (help "Foodstuffs: an army marches on its stomach!"))
(material-type mana (help "Magical power"))	; used to produce magical effects
(material-type metal (help "Steel, metal, manufacturing capacity for armour and weapons"))

(terrain-type sea (char ".") (color "sky blue"))
(terrain-type swamp (char "=") (color "yellowgreen"))
(terrain-type desert (char "~") (color "yellow"))
(terrain-type plains (char "+") (color "green"))
(terrain-type forest (char "%") (color "forest green"))
(terrain-type hills (char "(") (color "khaki"))
(terrain-type mountains (char "^") (color "sienna"))
(terrain-type ice (char "_") (color "white"))
(terrain-type void (char ":") (color "black"))

(define t temple)
(define T tower)
(define K cloudkeep)

(add W image-name "wizard")
(add i image-name "hoplite")
(add b image-name "viking")
(add k image-name "knight")
(add P image-name "paladin")
(add R image-name "archer")
(add H image-name "holy-man")
(add s image-name "serf")
(add D image-name "dragon")
(add u image-name "undead")

(add A image-name "mininuke")
(add L image-name "lightning")
;"FireBall" F icon-name
(add F image-name "fire")
(add M image-name "charm-spell")
(add E image-name "eye")

(add G image-name "wagon-2")
(add C image-name "flying-carpet")
(add h image-name "cavalry")
(add S image-name "frigate")
(add g image-name "trireme")

(add w image-name "walltown")
(add c image-name "castle")
(add / image-name "camp")
(add V image-name "village")
(add * image-name "town20")
(add @ image-name "city20")

(add r image-name "ring-2")
(add p image-name "ring-2")
(add B image-name "crystal-ball")
(add f image-name "plate")
(add a image-name "amulet")

(define bases ( w c tower temple cloudkeep / V * @ ))
(define cities ( V * @ ))
(define spells ( A L F M E ))
(define forts ( w c tower cloudkeep ))
(define flyers ( D C cloudkeep ))
(define ships ( S g ))
(define ltfoot ( H R b i s w ))
(define hvyfoot ( k P W ))
(define hoof ( h G ))
(define magickers ( W D ))
(define movers ( W i b k P R H s D u G C cloudkeep h S g ))
(define foot ( W i b k P R H s u ))
(define transport ( G C cloudkeep S g ))
(define magicitems ( r B p f a ))

(define water ( sea ))
(define land ( swamp plains forest desert hills mountains ))

;;; Static relationships.

;; Unit-unit.

;  What units can carry which others
;
; format:
; (#) (units) unit1 capacity -- # of units unit1 can hold.

;FIX unit-size-as-occupant is U1 U2 -> N U1's size as occupant of U2
(table unit-size-as-occupant add (spells u* 1))

;FIX occupant-max is U1 U2 -> N upper limit on occupants by type
(table occupant-max add (W spells 6))
(table occupant-max add (u* magicitems 6))
(table occupant-max add (W u 1))	; wizards can hold the undead they make.
;FIX capacity is N, upper limit on total occupants by size
(add W capacity 10)

(table occupant-max add (D spells 1))
(table occupant-max add (D ( L F ) 3))
(table occupant-max add (D ( W k P ) 1))	; dragonriders?
(add D capacity 3)	; yes, riders take up one of a dragon's spell slots
; odd, but necessary

(table occupant-max add (G ( W i b k P R H s u ) 2))
(add G capacity 2)

(table occupant-max add (H u 1))	; so they can be made!
(add H capacity 1)

(table occupant-max add (S ( W i b k P R H s G h u ) 5))
(add S capacity 5)

(table occupant-max add (C ( W i k P R H s ) 1))
(add C capacity 1)

(table occupant-max add (g ( W i b k P R H s u ) ( 1 1 4 1 1 2 1 1 3 )))
(add g capacity 4)

; bases capacity
(table occupant-max add (w ( W i b k P R H s G h u C ) 2))
(add w capacity 2)

(table occupant-max add (K ( W k P R s D u C ) 4))
(add cloudkeep capacity 8)

(table occupant-max add (c ( W i b k P R H s G h S g u ) 3))
(add c capacity 4)

(table occupant-max add (T ( W i b k P R H s G h u C ) 2))
(add tower capacity 4)

(table occupant-max add (/ ( W i b k P R H s G h S g C ) 6))
(add / capacity 12)

(table occupant-max add (V ( W i b k P R H s G h S g C ) 8))
(add V capacity 16)

(table occupant-max add (t ( W i b k P R H s G h S g C ) 6))
(add temple capacity 10)

(table occupant-max add (* ( W i b k P R H s G h S g C ) 8))
(add * capacity 20)

(table occupant-max add (@ ( W i b k P R H s G h S g C ) 15))
(table occupant-max add (@ D 1))
(add @ capacity 30)

(table occupant-max add (( T cloudkeep ) spells 2))
; 1 A ( T cloudkeep ) capacity ; armageddon spell is 'bigger'?

(table unit-size-as-occupant add (movers u* 1))
(table unit-size-as-occupant add (( D G h S G ) u* ( 3 2 2 4 3 )))	;  the exceptions
(table unit-size-as-occupant add (spells u* 1))

; 90 foot h alter-mobility ; h slowed by holding things?

(table unit-size-as-occupant add (magicitems u* 0))
(table occupant-max add (u* magicitems 5))	; rule of 5 magic items, but everything can hold them
(table occupant-max add (spells magicitems 0))	; except spells
(table occupant-max add (magicitems u* 0))	; and other magic items!

;; Unit-terrain.

;; Unit-material.

(table unit-storage-x 
  (W m* ( 10 100 6 ))
  (i m* ( 16  0 10 ))
  (b m* ( 16  0  6 ))
  (k m* ( 16  0 12 ))
  (P m* ( 12  4  6 ))
  (R m* ( 16  0  6 ))
  (H m* ( 10  8  6 ))
  (s m* ( 10  0  6 ))
  (D m* ( 200 30 6 ))	; dragons can eat alot!
  (u m* (  0  0  4 ))
  (spells food 0)
  (spells metal 0)
  (spells mana 3)
  (L mana 2)
  (E mana 8)	; it has extra duration
  (C m* (  0  10 2 ))
  (G m* ( 150 0  6 ))
  (K m* ( 50 200 10 ))
  (h m* ( 50  0 20 ))
  (S m* ( 100 0 30 ))
  (g m* (  50 0 15 ))
  (w m* (  20 0  6 ))
  (c m* ( 200 0 30 ))
  (T m* ( 100 60 20 ))
  (/ m* ( 100 0 25 ))
  (t m* ( 100 8 20 ))
  (V m* ( 150 0 15 ))
  (* m* ( 300 0 30 ))
  (@ m* ( 600 0 60 ))
  (r m* 10)
  (f food 10)
  (a mana 100)	; holds lots of power, might have it all when found!
  )

;;; Vision.

(add ( V * @ ) see-always 1)
(add D see-always 1)	; Dragons are hard to miss...

;(add u* vision-at 1)
;(add spells vision-at 0)
;(add E vision-at 4)	; the spy-eye!
;(add flyers vision-at 3)
;(add bases vision-at 2)
;(add cloudkeep vision-at 5)
;(add T vision-at 4)	; Towers are good for spotting things
;(add w vision-at 2)	; can see a little ways from walls.
;(add @ vision-at 3)	; cities have tall structures, and people wandering.
;(add * vision-at 2)
;(add c vision-at 3)
;(add R vision-at 2)	; Archers are good at knowing the surrounding land.
;(add ( g S ) vision-at ( 2 3 ))	; ships can see far over flat water

; visibility of stuff
; non 0/1 visibility must be harsh on CPU! keep # of units with this down
;FIX visibility is U T -> N, U's % visibility in T
(table visibility add (K t* 20))	; hard to spot in them clouds!
(table visibility add (C t* 5))	; hard to spot in the clouds
(table visibility add (R t* 50))	; Archers are good at hiding on the land.
(table visibility add (E t* 0))	; invisible spy-eye
(table visibility add (magicitems t* 20))	;  magic items are sometimes hard to spot.

; small forces hidden by rough terrain
;FIX conceal is now visibility, you should subtr these numbers from that table
;FIX ( 80 75 60 40 ) ( forest swamp mountains hills ) R conceal

;;; Actions.

;                         ( W i b k P R H s  D u G C  K h S g ) "movers"
(add movers acp-per-turn (  1 2 3 2 2 3 2 1 10 1 5 12 4 6 5 7 ))

;                         ( A L F M E ) "spells"
(add spells acp-per-turn (  2 9 5 3 6 ))

(add cities acp-per-turn 1)

;;; Movement.

(add bases speed 0)
(add cities speed 0)

(table mp-to-enter-terrain
  (u* t* 99)
  (bases land 1)	; so you can build bases anywhere?
  (ships sea 1)	; seas  -- ships Ok, air OK, most others, no go.
  (flyers t* 1)	; flyers can go almost anywhere.
  (spells t* 1)	; same for spells
  (ships water 1)	; sea is pretty straightforward...
  ; movement on terrain...
  ;( W i b k P R H s  D u A L F G C K h S g ) "movers"
  ; ground units and land terrain:
  ; ( swamp plains forest desert hills mountains ) "land"
  ; ground units ant how they handle terrain:
  (W land (2 1 1 1 1 2))
  (i land (2 1 1 1 1 2))
  (b land (2 1 2 1 1 2))
  (k land (2 1 2 2 2 2))
  (P land (1 1 1 1 2 2))
  (R land (1 1 1 1 1 2))
  (H land (2 1 2 2 2 2))
  (s land (2 1 2 1 2 2))
  (u land (1 1 1 1 1 2))
  (G land (99 1 2 2 3 4))
  (h land (3 1 2 2 3 4))
  (( W b G P R u ) ice 1)	; units that can handle ice!
  (u* void 99)	; nothing can go into the void!
  )

(table consumption-per-move add (movers food 1))	; all units take 1 fuel to move
(table consumption-per-move add (s food 4))	; this is actually lost food production
; Magical things don't require food to move....
(table consumption-per-move add (u food 0))	; undead dont eat!
(table consumption-per-move add (K food 0))
(table consumption-per-move add (K mana 1))	; floating castle requires mana to move
(table consumption-per-move add (spells food 0))
(table consumption-per-move add (C food 0))
(table consumption-per-move add (S food 0))	; they sail!

;;; Construction.

; starting stockpiles
;FIX this used to be % now it is a raw number.
(table supply-on-completion add (u* m* 0))	; we don't start with any resources
(table supply-on-completion add (u* food 100))	; except food...

(table supply-on-completion add (bases food 50))	; bases are only half full. filled units?
(table supply-on-completion add (magickers mana 30))	; magic casters get 30% of their mana capacity

; production by units.
; Unit production time should be starting at a base value, and modified
; by how good the producer is at that particular unit...
; Base times:
;  W  i  b  k  P  R  H  s  D  u  A  L  F  M  G  h  C  K  S  g
; 25  5  8 10 15  9 15  5 30  2  2  2  2  2
; note: short times for spells compensated by large mana costs
;  w  c  T  /  t  V  *  @
;  5 20 15  5 12 30 35 40
;
;
; magickers production
;FIX make is replaced by acp-to-create, cp-per-build and friends
;FIX 2 spells W make
;FIX ( 25 2 10 30 10 ) ( D u C K T ) W make	; wiz's make magic stuff
;FIX 2 ( F L ) D make

; first, production by city-type units
;FIX ( 2 2 30 20 ) ( A L D W ) K make

;FIX 15 temple P make	; paladins can make shrines, eventually

;FIX 7 / R make	; Archers can camp...

;FIX ( 11 5 ) ( temple u ) H make	; 'holy' men can make undead?
;FIX ( 6 25 15 6 10 30 35 40 ) ( w c T / t V * @ ) s make	;serfs make lots of stuff

;FIX ( 10 17 5 15 ) ( k P i h ) c make	; Castles

;FIX ( 12 20 ) ( H P ) temple make
;FIX (  8 25 6 ) ( w c / ) i make


;      i b  R  H s G  h  S  g  W  k  P ) make vector
;FIX ( 6 8 10 18 6 7 18 19 16          ) ( i b R H s G h S g       ) V make
;FIX ( 5 5 11 15 5 7 16 14 13 32  9    ) ( i b R H s G h S g W k   ) * make
;FIX ( 4 4 11 13 5 6 14 13 11 25  7 20 ) ( i b R H s G h S g W k P ) @ make

(add ( i b  R  H s G  h  S  g  W  k  P )
  cp ( 6 8 10 18 6 7 18 19 16 30  9 20))

(table acp-to-create
  (T W 1)
  (cities ( i b  R  H s G  h  S  g ) 1)
  (( * @ ) ( W  k  P ) 1)
  )

(table cp-on-creation
  (T W 1)
  (cities ( i b  R  H s G  h  S  g  ) 1)
  ;; Towns and cities build faster by having new units more complete.
  (* ( i b  R  H s G  h  S  g  W  k  P )
     ( 2 2  1  4 2 1  3  6  4  1  1  1 ))
  (@ ( i b  R  H s G  h  S  g  W  k  P )
     ( 3 3  1  6 2 2  5  7  8  6  3  1 ))
  )

(table acp-to-build
  (T W 1)
  (cities ( i b  R  H s G  h  S  g  W  k  P ) 1)
  )

(table cp-per-build
  (T W 1)
  (cities ( i b  R  H s G  h  S  g  W  k  P ) 1)
  )

;; Material needed to make units.

;  mana required for magical stuff
; typical mage should get 2 to 4 mana per turn, dep on site...
(table consumption-per-build
  ;                A  L   F  M  E  spells
  (spells mana (  50 14  12 20  6 ))
  (( D u cloudkeep C ) mana ( 200 10 400 80 ))
  ; most units don't really take food to make...
  ; but armoured ones take metal...
  (i metal 3)
  (k metal 15)
  (P metal 15)
  (G metal 5)
  (S metal 40)
  (g metal 25)
  (w metal 20)
  (c metal 80)
  (T metal 20)
  (/ metal 3)
  (V metal 45)
  (* metal 60)
  (@ metal 120)
  (magicitems mana ( 30 20 25 10 60 ))
  )

; mages must first figure out how to cast their spells!
;FIX 200 spells research
;FIX 300 M research
;FIX 1000 A research

;;; Repair.

; do this by what a unit may repair
;FIX hp-per-repair is U1 U2 -> .01HP that U1 restores to U2 per repair action
; ...and you have to add...
; acp-to-repair is U1 U2 -> ACP to do one repair action
;(table acp-to-repair add ( W 1))
;(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 )))
(table acp-to-repair add (i bases 1))
(table hp-per-repair add (i bases 50))
(table acp-to-repair add (b g 1))
(table hp-per-repair add (b g 50))
(table acp-to-repair add (b bases 1))
(table hp-per-repair add (b bases 33))
(table acp-to-repair add (k c 1))
(table hp-per-repair add (k c 50))
(table acp-to-repair add (P bases 1))
(table hp-per-repair add (P bases 50))
(table acp-to-repair add (P P 1))
(table hp-per-repair add (P P 50))	; paladin's healing powers!
(table acp-to-repair add (R ( R / ) 1))
(table hp-per-repair add (R ( R / ) 50))
(table acp-to-repair add (s s 1))
(table hp-per-repair add (s s 33))
(table acp-to-repair add (H foot 1))
(table hp-per-repair add (H foot 100))
(table acp-to-repair add (s bases 1))
(table hp-per-repair add (s bases 100))
(table acp-to-repair add (s G 1))
(table hp-per-repair add (s G 100))
(table acp-to-repair add (s S 1))
(table hp-per-repair add (s S 50))
(table acp-to-repair add (D D 1))
(table hp-per-repair add (D D 100))
(table acp-to-repair add (h h 1))
(table hp-per-repair add (h h 25))
(table acp-to-repair add (u* u 1))
(table hp-per-repair add (u* u 100))	; undead can't be repaired...
(table acp-to-repair add (W cloudkeep 1))
(table hp-per-repair add (W cloudkeep 50))	;  Wizards slowly repair cloud castles
(table acp-to-repair add (G foot 1))
(table hp-per-repair add (G foot 50))

(table acp-to-repair add (bases u* 1))
(table hp-per-repair add (bases u* 100))
(table acp-to-repair add (forts u* 1))
(table hp-per-repair add (forts u* 100))
(table acp-to-repair add (cities u* 1))
(table hp-per-repair add (cities u* 100))
(table acp-to-repair add (forts forts 1))
(table hp-per-repair add (forts forts 25))	; forts have a few people who can fix them
(table acp-to-repair add (cities cities 1))
(table hp-per-repair add (cities cities 25))	; cities have the people to maintain themselves...
(table acp-to-repair add (c ( i cloudkeep h ) 1))
(table hp-per-repair add (c ( i cloudkeep h ) 100))
(table acp-to-repair add (T ( W ) 1))
(table hp-per-repair add (T ( W ) 100))
(table acp-to-repair add (t foot 1))
(table hp-per-repair add (t foot 100))

(table mp-to-enter-unit add (flyers u* 20))	; aircraft can't sortie again until next turn
(table mp-to-enter-unit add (ships bases 20))
(table mp-to-leave-unit add (ships bases 1))

;;; Combat.

; HP of various units.
(define units ( W i b k P R H s D u h A L F M E G C  cloudkeep S g  w  c  T  /  t  V  *  @ ))
(add units hp-max ( 2 2 2 3 4 2 2 2 8 4 3 1 1 1 2 1 2 1 10 4 3 10 20  8  4  8 15 30 45 ))
;FIX in addition you can set hp-to-repair and other things to cripple a unit
;(add units hp-at-min-speed ( 1 1 1 1 1 0 1 0 3 0 2 1 1 1 1 1 1 0  4 2 1  2  3  4  2  2  8 16 25 ))
; NOTE: crippled is at <= value, not <

(add spells hp-max 2)	; not 1 so that they can survive an attack when attacking.
;(add spells hp-at-min-speed 0)
; 1 M hp ; So mass charm survives the attack to capture!

; split the matrix in half to make it fit on an 80 col screen!
(define u1 (  W   i   b   k   P   R   H   s   D   u   G   C   h ))
(define u2 (  A   L   F   cloudkeep   S   g   w   c   T   /   t   V   *   @ ))
; (chances) u# unit hit
; chances for unit to hit member of u#

; so, here we define the units by how good they are at hitting others
; ranges:  30% is typical attack percent.
; it ranges up and down from there...
;( W   i   b   k   P   R   H   s   D   u   G   C   h ) u1
(table hit-chance add (W u1 ( 25  35  10  30  10  35  20  40  40  30  40  40  30 )))
(table hit-chance add (i u1 ( 50  30  40  20  15  60  25  45  10  20  40  30  20 )))
(table hit-chance add (b u1 ( 45  45  35  25  25  55  35  45  15  30  50  20  25 )))
(table hit-chance add (k u1 ( 35  40  45  25  20  65  30  50  20  30  30  15  30 )))
(table hit-chance add (P u1 ( 40  40  45  35  30  80  30  30  40  50  30  15  30 )))
(table hit-chance add (R u1 ( 30  45  50  25  20  65  30  40  20  15  30  30  25 )))
(table hit-chance add (H u1 ( 30  20  35  20  20  50  35  30  10  45  30  10  20 )))
(table hit-chance add (s u1 ( 20  10  15   5   3  10  10  30   1  10  30   5  10 )))
(table hit-chance add (D u1 ( 40  50  55  35  20  70  40  80  30  40  60  40  80 )))
(table hit-chance add (u u1 ( 20  30  35  20  10  50  10  50  10  30  40  30  30 )))
(table hit-chance add (A u1 ( 50  99  60  90  70  90  80  99  60  99  99  99  99 )))
(table hit-chance add (L u1 ( 50  80  50  90  60  80  80  99  70  99  99  99  99 )))
(table hit-chance add (F u1 ( 50  90  50  80  60  90  80  99  60  99  99  99  99 )))
(table hit-chance add (G u1 (  0   0   0   0   0   0   0   0   0   0   0   0   0 )))	; noncombatants
(table hit-chance add (C u1 (  0   0   0   0   0   0   0   0   0   0   0   0   0 )))	; noncombatants
(table hit-chance add (K u1 ( 10   5   5   5   5   5   5   5  25   5  15  20   5 )))	; Cloudkeep can drop rocks!
(table hit-chance add (h u1 ( 50  45  50  30  30  70  40  60  25  40  50  15  30 )))	; Cavalry
(table hit-chance add (S u1 (  0   0   0   0   0   0   0   0   0   0   0   0   0 )))	; ships can only attack other ships
(table hit-chance add (g u1 (  0   0   0   0   0   0   0   0   0   0   0   0   0 )))
(table hit-chance add (w u1 ( 11  30  35  20  10  40  30  40  20  30   0   0  20 )))
(table hit-chance add (c u1 ( 10  40  40  25  12  40  35  40  25  35   0   0  20 )))
(table hit-chance add (T u1 ( 10  35  35  20  10  40  30  40  20  30   0   0  20 )))
(table hit-chance add (/ u1 (  5  20  17  15  10  25  20  30  10  20   0   0  10 )))
(table hit-chance add (t u1 (  8  25  30  20  18  35  30  40  15  35   0   0  15 )))
(table hit-chance add (V u1 (  9  25  30  20  15  30  30  40  15  20   0   0  25 )))
(table hit-chance add (* u1 ( 10  30  35  25  20  40  35  45  20  25   0   0  30 )))
(table hit-chance add (@ u1 ( 15  35  40  30  25  50  40  50  25  30   0   0  30 )))

;( A   L   F   K   S   g   w   c   T   /   t   V   *   @ ) u2
(table hit-chance add (W u2 (  1   1   1  50  30  40  25  20  25  30  35  40  40  40 )))
(table hit-chance add (i u2 (  1   1   1  10  10  10  10  10  10  25  20  20  20  20 )))
(table hit-chance add (b u2 (  1   1   1  10  10  10   8   5   8  40  30  50  50  50 )))
(table hit-chance add (k u2 (  1   1   1  10  10  10   9   9  10  20  25  30  30  30 )))
(table hit-chance add (P u2 (  1   1   1  11   7   8  15  15  15  20  40  20  20  20 )))
(table hit-chance add (R u2 (  1   1   1   8   5   5   8   8   8  30  30  30  30  30 )))
(table hit-chance add (H u2 (  1   1   1   3   4   4   4   4   4  20  50   5   5   5 )))
(table hit-chance add (s u2 (  1   1   1   1   2   2   1   2   2  20  15  20  20  20 )))
(table hit-chance add (D u2 (  1   1   1  20  60  50  30  25  28  50  40  60  60  60 )))
(table hit-chance add (u u2 (  1   1   1   2  10  10  11  11  10  30  20  30  30  30 )))
; there is some value in chances >100%, since may be adjusted downwards by other factors,
; but for now they're not allowed.
;(table hit-chance add (A u2 (  1   1   1  30 199 199 199 150 150 299  70 130 110 100 )))
(table hit-chance add (A u2 (  1   1   1  30 100 100 100 100 100 100  70 100 100 100 )))
(table hit-chance add (L u2 (  1   1   1  30  40  40  80  80  80  99  70  90  90  80 )))
(table hit-chance add (F u2 (  1   1   1  30  99  99  60  50  69  99  75  90  90  90 )))
(table hit-chance add (G u2 (  1   1   1   0   0   0   0   0   0   0   0   0   0   0 )))	; noncombatat
(table hit-chance add (C u2 (  1   1   1   0   0   0   0   0   0   0   0   0   0   0 )))	; noncombatant
(table hit-chance add (K u2 (  1   1   1  40   0   0   0   0   0   0   0   0   0   0 )))
(table hit-chance add (h u2 (  1   1   1  10  10  10   6   6   9  40  35  30  30  30 )))	;
(table hit-chance add (S u2 (  1   1   1   0  20  10   0   0   0   0   0   0   0   0 )))	; ships ramming each other!
(table hit-chance add (g u2 (  1   1   1   0  50  30   0   0   0   0   0   0   0   0 )))
(table hit-chance add (w u2 (  1   1   1   0   0   0   0   0   0   0   0   0   0   0 )))	; matrix here and below  is all non-movers vs non-movers!
(table hit-chance add (c u2 (  1   1   1   0   0   0   0   0   0   0   0   0   0   0 )))
(table hit-chance add (T u2 (  0   1   0   0   0   0   0   0   0   0   0   0   0   0 )))
(table hit-chance add (/ u2 (  0   0   0   0   0   0   0   0   0   0   0   0   0   0 )))
(table hit-chance add (t u2 (  0   0   0   0   0   0   0   0   0   0   0   0   0   0 )))
(table hit-chance add (V u2 (  0   0   0   0   0   0   0   0   0   0   0   0   0   0 )))
(table hit-chance add (* u2 (  0   0   0   0   0   0   0   0   0   0   0   0   0   0 )))
(table hit-chance add (@ u2 (  0   0   0   0   0   0   0   0   0   0   0   0   0   0 )))

(table hit-chance add (E u* 0))
(table hit-chance add (M u* 10))	; can do some damage as it attempts to capture

; and this allows ti to even attack...
(table hit-chance add (movers spells 50))	;  spells can be killed by attacking them, but
(table hit-chance add (movers M 10))	;
; they shouldn't have much time where they can be attacked.
; they are either in-flight, or stored on someone!

; terrain effects
(table defend-terrain-effect add (foot ( forest swamp mountains hills ) 85))
(table defend-terrain-effect add (hvyfoot ( forest swamp mountains hills ) 90))

(table defend-terrain-effect add (R ( forest swamp mountains hills desert ) (25 40 40 60 90)))
; archers are good at using terrain to hide in.

(table defend-terrain-effect add (forts ( hills mountains ) 60))
(table defend-terrain-effect add (T ( hills mountains ) (80 50)))
(table defend-terrain-effect add (c ( hills mountains ) (80 50)))

(table damage
  (u* u* 1)	; default
  (D u* 2)
  (u* magicitems 0)	;  otherwise, items are always destroyed by capture
  (D bases 3)
  (D cities 4)
  (b bases 3)	; barbarians torch them cities!
  (R D 4)	; rangers with those special arrows!
  (g ships 2)
  (( P H ) u 3)
  (h ltfoot 1)
  (F ships 4)
  (F cities 4)
  (F u* 2)
  (F / 4)
  (L u* 3)
  (M u* 1)	; it might do some damage as the victim struggles
  (A u* 21)	; Armageddon spells are nuclear!
  (magicitems u* 0)	; magic items can't hurt anything
  )

;FIX true capturemoves	; gotta secure newly captured units first
; false capturemoves is buggy?

;FIX true counterattack

(table acp-to-defend add (spells u* false))	; they're specifically targeted!
(table acp-to-defend add (w u* false))	; walls don't fight back! They're just walls!
(add spells acp-to-detonate 1)


; stuff that can change sides when captured
(add u* acp-to-change-side 0)	; most units are fanatically loyal beings
(add transport acp-to-change-side 100)	;  inanimate units that may be captured
(add magicitems acp-to-change-side 100)	;
(add ( W i b s D ) acp-to-change-side ( 20 20 40 80 20 ))

; these units may be persuaded to go traitor

(table capture-chance
  (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 ))

  ;                                 ( s  G h  S  g  w c  T  /  t  V  *  @ )
  (i ( s G h S g w c T / t V * @ ) ( 40 50 5 30 30 10 5  8 30 20 40 25 15 ))
  (b ( s G h S g w c T / t V * @ ) ( 40 50 5 45 40  8 3  7 40 25 20 10  7 ))
  (R ( s G h S g w c T / t V * @ ) ( 10 20 5 10 10  8 3  7 40 25 45 25 10 ))
  (k ( s G h S g w c T / t V * @ ) ( 45 40 5 15 10 12 6  9 35 25 45 25 13 ))
  (P ( s G h S g w c T / t V * @ ) ( 50 30 8 20 20 11 7 10 36 45 40 20 10 ))
  (h ( s G h S g w c T / t V * @ ) ( 50 40 5  5  5  5 1  5 60 30 40 20 10 ))
  (H ( s G h           / t V * @ ) ( 60 10 10              20 35 40 15 15 ))
  (u ( G S   S g w c T / t V * @ ) ( 40 50   25 30 11 6  9 20 10 15 10  5 ))

  (H ( i b u ) ( 20 15 40 ))	; priests can convert people!
  (s ( s G cloudkeep / V * @ ) ( 20 30 45 30 30 20 15 ))

  ; the Charm Spell...
  (M u* 100)	; the standard default

  ; the 200% of M vs / is not accepted, though perhaps it should be.
  (M ( w c T / t V * @ ) ( 100 50 100 100 #|200|# 25 60 50 40 ))
  ; works better against low populations

  (M ( W P H D cloudkeep T ) ( 50 10 40 50 25 80 ))
  (u* magicitems 100)	;  magical items don't have loyalty
  )

;FIX ferry-on-entry is U1 U2 -> FTYPE how much terrain U2 crosses to board U1
(table ferry-on-entry add (u* u* over-all))	; lets everything attack everywhere: no terrain immunity

; protect: # u1 u2 protect: protection offered to u1 by u2
(table protection add (bases u* 70))	; general bases protect their occupants ok
(table protection add (forts u* 20))	; forts prottect their occupants very well
(table protection add (/ movers 80))
(table protection add (V movers 80))
(table protection add (* movers 70))
(table protection add (@ movers 60))
(table protection add (( i k P W ) forts 50))
(table protection add (u forts 60))
(table protection add (( i k P W ) bases 70))
(table protection add (H temple 50))	; priests and their temples...
(table protection add (W ( cloudkeep tower ) 20))	; wiz's protect their towers and keeps very well

;FIX true u* neutral
;FIX false i neutral

;FIX U1 U2 -> % that U2 withdraws before U1 attacks
(table withdraw-chance-per-attack add (u* movers 10))
(table withdraw-chance-per-attack add (u* R 33))	; those rangers like to run away!
(table withdraw-chance-per-attack add (u* ships 0))	; boats can't retreat!

(table consumption-per-attack add (D food -5))	; dragon feeds on enemies!
(table consumption-per-attack add (W mana 1))	; mages use spells in combat!
(table consumption-per-attack add (K metal 1))	; Cloudcastles throw stuff down to attack

;FIX spy-chance is now on a per unit basis...
; and spy-range specifies how far a unit can spy
(add u* spy-chance false)	; we don't spontaneously see all the enemies
;FIX spy-quality is U1 U2 -> % that U1 returns info about U2
(table spy-quality (u* u* false))	; and we don't see any of them if we do!

;FIX I guess nuked is damaged-terrain now, T1 T2 -> N
;FIX t* t* nuked	; most terrain won't actually change when nuked
;FIX desert ( plains forest ) nuked	; except forest, plains turn to desert.
;FIX mountains ice nuked	; ice gets nuked into mountains.

;FIX "defeats" land destroy-message
;FIX "sinks" ships destroy-message
;FIX "knocks down" flyers destroy-message
;FIX "sacks" cities destroy-message
;FIX "slays" ( D h ) destroy-message

; NIY? 100 u* max-quality ;  what's the range of this?
; NIY? 100 u* veteran ;
; NIY? 1000 u* max-morale ;  what's the range of this?
;FIX 50 u* efficiency	; disbanding units for their parts?

;FIX true u* neutral	;everything can become neutral

;FIX hp-per-disband is U1 U2 -> HP lost in a disband action performed by U2
; you might add U1 acp-to-disband U2 as well, U1 U2 -> ACP
; (table hp-per-disband add (u* u* 100))	; perhaps they're not so fanatic?
; (table hp-per-disband add (( W i b k D u A L F G h C S g / ) u* 100))

(add magicitems hp-max 1)	;

; combat stats should be irrelevant, since they're always occupants
(table hit-chance add (u* magicitems 100))	; everything can hit them
(table hit-chance add (magicitems u* 0))	; they can't hit back!
(table acp-to-defend add (magicitems u* 0))
(table capture-chance add (u* magicitems 100))	; just pick them up!

(add magicitems acp-to-change-side 100)
(table protection add (u* p 80))	; ring of protection, reduces hit-chance by 20%

; (table hp-per-disband add (magicitems u* 100))	; they can' be destroyed!
;FIX true magicitems neutral

;;; Scoring.

(add bases point-value ( 1 20 8 8 30 2 8 10 50 ))	;  territory values for victory pts.
(add s point-value 5)	; serfs are valuable!

(scorekeeper (do last-side-wins))

;( r B p f a ) magicitems
; magic items stats tacked on at the end!
(table independent-density add (magicitems t* 5))	; some random ones to be lying around easy to capture
(table favored-terrain add (magicitems sea 0))	; they'd sink!
(table supply-on-completion add (magicitems m* 100))	; they're usually statically full
;FIX ( 10 6 8 6 15 ) magicitems W make	; wizards make them only
;FIX ( 12 12 9 4 0 ) magicitems H make	; priests can make some items
;FIX 50 magicitems research	; discover the magic formulae?
;FIX 25 magicitems magicitems research-contrib

(table acp-to-repair add (r u* 1))
(table hp-per-repair add (r u* 100))	; ring of regeneration magically fixes everything!
; ring must be able to hold supplies to perform repairs! Sheesh!

(table base-production add (r m* 1))	; ring produces everything, just in case...
(table base-production add (f food 6))	; FOOD!
(table base-production add (a mana 6))	; amulet of power generates mana

(table productivity add (magicitems t* 100))

(table consumption-as-occupant add (magicitems m* 0))	; they dont consume anyway!
(table mp-to-enter-terrain add (magicitems sea 99))
(table mp-to-enter-terrain add (magicitems land 1))

;(add B vision-at 10)	; that's what its for!

;;; Backdrop economy.

(table base-production add (W mana 5))	; * very terrain dependent
(table base-production add (D mana 4))	; *
(table base-production add (H mana 2))
(table base-production add (K mana 12))
(table base-production add (T mana 5))	; *
(table base-production add (t mana 2))
(table base-production add (P mana 1))

; food production
; i b k P R H  s c T / t V  *  @ K )
(table base-production add (( i b k P R H s c T / t V * @ K ) food ( 2 4 2 3 6 4 10 2 1 3 6 8 12 16 3 )))
(table base-production add (W food 1))

; metal production
(table base-production add (( H s T c V * @ ) metal ( 2 4 1 2 4 8 16 )))

(table productivity add (u* t* 100))	;the default anyway!
(table productivity add (foot sea 0))
(table productivity add (hoof sea 0))
(table productivity add (( H P ) sea 50))

; sea swp des pln for hil mtn ice vac
;(  .   =   -   +   %   ~   ^   _  : ) t*
(table productivity add (W t* ( 60  60  60  40  60  80 100 120  0 )))	; 1 per 20%
(table productivity add (D t* ( 75  50  50  50  75  75 100 125  0 )))	; 1 per 25%
(table productivity add (T t* (  0  60  40  40  60  80 100 120  0 )))	; 1 per 20%
; considerable advantage for mana production on 'ice' and other
; difficult terrain.
; ice is usually highest mountain.
; note, building a T on ice is a pain, as a wiz must do it!

; swamp/plains/forest/desert/hills/mountains = land
(table productivity add (i land (  50 100  90 20  25  50 )))	; one arg must be a scalar...
(table productivity add (b land (  50 100  90 20  25  50 )))
(table productivity add (k land (  00 100  90 20  25  50 )))
(table productivity add (P land (  50 100 100 50 100  75 )))
(table productivity add (R land ( 100 100 100 50 100 100 )))
(table productivity add (H land (  75 100 100 50  75  75 )))
(table productivity add (s land (  50 100  90 70  75  50 )))
(table productivity add (/ land (  50 100  90 70  75  50 )))
(table productivity add (t land (  50 100  90 70  75  50 )))
(table productivity add (V land (  50 100  90 25  75  50 )))
(table productivity add (* land (  50 100  90 25  75  50 )))
(table productivity add (@ land (  50 100  90 25  75  50 )))

(table productivity add (ships sea 100))
(table productivity add (K t* 100))


; units' comsumption
(table base-consumption add (movers food 1))	; all consume 1 food per turn, except...
(table base-consumption add (( i k ) food 2))	; many infantry per unit, knights are pigs
(table base-consumption add (D food 2))	; dragons are voracious!
(table base-consumption add (undead food 0))	; just skeletons, not ghouls!
(table base-consumption add (spells food 0))
(table base-consumption add (C food 0))
(table base-consumption add (( h G ) food 2))	; horses eat a lot
(table base-consumption add (g food 1))	; crew needs to eat more when active

(table base-consumption add (spells mana 1))	; spells burn mana in-flight
(table base-consumption add (C mana 1))	; magic carpet burns mana in flight.

; mutual supply rules:
; consume-as-occupant is cool!  1 means they do consume!
(table consumption-as-occupant add (u* m* 1))
(table consumption-as-occupant add (spells m* 0))	; spells in storage require no mana support
(table consumption-as-occupant add (ships m* 0))	; ships not at sea need no food...

; inlength is how far away a unit can receive fuel from
; out-length is how far away a unit can deliver fuel.  Should be kept
; small, as it can waste much CPU time
;
;set the supply line the defaults...

(table out-length add (movers m* 0))	; most movables can't supply other things.
(table out-length add (bases m* 1))	; bases somewhat supply neighbors
(table out-length add (cities m* 2))	; cities trade with surrounding lands
(table out-length add (W mana 0))	; mages selfishly hoard magic to themselves.
(table out-length add (G food 2))	; wagons are supply vehicles
(table out-length add (s m* 1))	; serfs will trade supplies to units near them
(table out-length add (K m* ( 0 3 0 )))	; flying citadel magically transmits its mana
(table out-length add (magicitems m* 0))
(table out-length add (a mana 2))

(table in-length add (movers m* 1))	; but they can be supplied by nearby things.
(table in-length add (bases m* 1))	; bases can recieve things from neighbors.
(table in-length add (spells mana -1))	; you have to charge the spells yourself
(table in-length add (s m* 1))
; 0 mana bases in-length ; They generate it, not take it!
; leave it with normal  in-length -- bases can exchange with each other.
(table in-length add (magicitems m* 0))
(table in-length add (a mana -1))	; it doesn't take mana, just give it!

;FIX survival is now hp-per-starve U M -> HP
(table hp-per-starve add (( R b ) m* 75))	; archer, barbarian can live off the land.
(table hp-per-starve add (( H P ) m* 50))	; holy dudes are used to fasting
(table hp-per-starve add (s m* 33))	; peasants don't need the food that badly... :-)

;;; Random events.

; disasters: units are in HUNDREDTHS of a percent each TURN
(add magickers revolt-chance 5)	; sure, tell wizards and dragons orders! Good luck!
(add b revolt-chance 5)	; those crazy barbarians
(add s revolt-chance 100)	; Serfs dont' enjoy being oppressed

;FIX surrender is U1 U2 -> .01N chance that U1 surrenders to U2
; and surrender-range is distance at which it can occur
(table surrender-chance add (forts u* 50))
(table surrender-chance add (cities u* ( 100 60 30 )))
;FIX 1500 bases siege	; most things could be sieged easily
;FIX 350 forts siege	; rare for a siege to take a fort...
;FIX ( 1500 3000 3000 ) ( V * @ ) siege	; medieval cities fell easily
;FIX 0 cloudkeep siege
(table surrender-chance add (K u* 0))

; attrition. Mostly ships at sea
;FIX attrition is U T -> .01HP (rate of loss, hp/turn)
(table attrition add (ships sea ( 200  1000  )))
;FIX "gets caught in a storm" ships attrition-message


;FIX accident is U T -> .01N chance that an accident happens to U
; and you can set accident-damage
(table accident-hit-chance add (ships sea ( 10 50 )))	; ships arent too seaworthy...
;FIX "lost in a storm" ships accident-message

;heavy-foot units should have accidents in swamp and/or mountains
(table attrition add (foot ( mountains  swamp ) 100))
(table accident-hit-chance add (foot ( mountains  swamp ) 50))
(table attrition add (hvyfoot ( mountains swamp ) 200))
(table accident-hit-chance add (hoof ( mountains swamp ) 100))
(table attrition add (hoof ( mountains swamp ) 300))
;FIX "fell down and couldn't get up!" foot accident-message
;FIX "broke down and had to be destroyed." hoof accident-message


;and magickers should have 'accidents'
(table attrition add (magickers t* 50))
;FIX "had a dangerous Arcane accident" magickers attrition-message
(table accident-hit-chance add (magickers t* 5))
;FIX "returns to its lair to hibernate and disappear into legend" D accident-message
;FIX "disappears into a puff of smoke" W accident-message

;;; Setup.

; sea swp des pln for hil mtn ice vac
;(  .   =   -   +   %   ~   ^   _  : )
(add t* alt-percentile-min (   0  29  70  70  70  75  93  99  0 ))
(add t* alt-percentile-max (  69  71  93  93  93  98  99 100  0 ))

(add t* wet-percentile-min (   0  50   0  20  80   0   0   0  0 ))
(add t* wet-percentile-max ( 100 100  20  80 100  99 100 100  0 ))
; ranges at which we see the various terrain types
; units are altitude
; first is for altitude
; next is for  wetness

;FIX this is broken into alt-blob-size, etc. etc.
;FIX 45 alt-roughness	; 0-100  the higher this is, the more altitude roughness
;FIX this is broken into wet-blob-size, etc. etc.
;FIX 80 wet-roughness	; Similar to alt-roughness

(set edge-terrain void)	; Edge of the world: you'll fall off!

(set country-radius-min 4)	;  the radius of a 'country'
(set country-separation-min 17)	;  the closest a country may be
(set country-separation-max 90)	;  the furthest apart a country may be.

(add cities start-with ( 1 2 1 ))	; units player starts with
(add ( c s temple W ) start-with ( 1 4 1 1 ))	; some more misc units

(table independent-density 
  (V land 60)
  (* land 30)
  (@ land 15)
  ; some rare freaks to find
  (K t* 1)
  (s plains 50)
  (W land 2)
  (C land 5)
  (T land 10)
  (t land 20)
  (D (plains mountains) 5)
  )

(table favored-terrain 
  (u* sea 0)
  (u* land 30)

  (forts land 100)

  (K t* 100)	; the flying citadel(s) could be anywhere!
  (K void 0)	; but the void, of course

  (magickers land 30)
  (magickers hills 60)
  (magickers mountains 100)

  (s land ( 20 100 80 10 40 20 ))

  (hoof mountains 0)	; just in case...

  (cities land 20)
  (cities plains 100)

  (u* void 0)	; nothing goes in void
  )

(add u* already-seen 100)
(add cloudkeep already-seen 0)	; the K's shouldn't be seen

(add u* initial-seen-radius 5)

(include "ng-weird")

(add (W D) namer "short-generic-names")
(add cities namer "short-generic-names")

;(set random-events (units-revolt units-revolt units-revolt))

;;; Documentation.

(game-module (instructions (
  )))

(game-module (notes (
  )))

(game-module (design-notes (
  )))