|
3 | 3 | ;; -------------------------------------------------------------- |
4 | 4 |
|
5 | 5 | (require |
6 | | - hyrule [unless do-n list-n defmacro-kwargs case pun] |
| 6 | + hyrule [unless do-n list-n defmacro-kwargs case ecase pun block] |
7 | 7 | simalq.macros [field-defaults pop-integer-part defmeth] |
8 | 8 | simalq.tile [deftile]) |
9 | 9 | (import |
|
13 | 13 | hyrule [thru xor] |
14 | 14 | toolz [unique] |
15 | 15 | simalq.util [DamageType StatusEffect next-in-cycle mixed-number] |
16 | | - simalq.geometry [Direction at dist adjacent? adj-or-eq? dir-to turn-and-pos-seed ray] |
| 16 | + simalq.geometry [Direction at dist adjacent? adj-or-eq? dir-to turn-and-pos-seed ray burst] |
17 | 17 | simalq.game-state [G] |
18 | 18 | simalq.tile [Tile Actor Damageable] |
19 | 19 | simalq.tile.scenery [Scenery walkability can-occupy?]) |
|
53 | 53 | ; If true, the monster kills itself upon attacking. |
54 | 54 | sees-invisible F |
55 | 55 | ; If true, the monster is unaffected by the player being invisible. |
| 56 | + vampirizable F |
| 57 | + ; If true, a vampire can turn this monster into another vampire. |
56 | 58 | flavor-for-generator "In defiance of thermodynamics, this device pumps out monsters endlessly.") |
57 | 59 | ; Flavor text for generators of this monster type. |
58 | 60 |
|
|
175 | 177 | #("Kamikaze" "When the monster attacks, it dies. You get no points for this.")) |
176 | 178 | (when @sees-invisible |
177 | 179 | #("Invisibility detection" "The monster is unaffected by you being invisible.")) |
| 180 | + (when @vampirizable |
| 181 | + #("Vampirizable" "This monster can be turned by a vampire.")) |
178 | 182 | (@dod "Effect when damaged" 'hook-damaged Damageable) |
179 | 183 | (@dod "Effect on death" 'hook-normal-destruction Damageable) |
180 | 184 | #* extra |
|
471 | 475 | :points-mon 3 :points-gen 12 |
472 | 476 |
|
473 | 477 | :damage-melee #(3 6 9) |
| 478 | + :vampirizable T |
474 | 479 |
|
475 | 480 | :flavor-mon "A green-skinned, muscle-bound, porcine humanoid with a pointy spear and a bad attitude." |
476 | 481 | :flavor-gen "A sort of orcish clown car, facetiously called a village.") |
|
480 | 485 | :points-mon 2 :points-gen 8 |
481 | 486 |
|
482 | 487 | :damage-melee #(2 4 6) |
| 488 | + :vampirizable T |
483 | 489 |
|
484 | 490 | :flavor-mon "Goblins are a smaller, uglier, smellier, and worse-equipped cousin of orcs that try to make up for it with even more sadistic malice. It almost works." |
485 | 491 | :flavor-gen "Oops, somebody gave the goblins a bath. Now there's a lot more of them, and they still stink.") |
|
529 | 535 |
|
530 | 536 | :damage-melee 4 |
531 | 537 | :damage-shot #(4 8 12) |
| 538 | + :vampirizable T |
532 | 539 |
|
533 | 540 | :flavor-mon "This fresh-faced would-be scholar has finished sewing the stars onto his robe and is starting to grow a beard. Idok has told the whole class that whoever kills you gets tenure. Considering what the rest of the academic job market is like, the offer has proven irresistible to many." |
534 | 541 | :flavor-gen "The Pigpimples Institute of Thaumaturgy and Dweomercraft: a shameless diploma mill that happily takes students' money to teach them one spell, then sends them on a suicide mission against a much smarter and tougher opponent.") |
|
1057 | 1064 | :flavor #[[A feudal lord of Dark Knights. Her armor is covered with long spikes, and her massive halberd means business. When she sees you, she cries out "Fight me!". But first, she'd like to soften you up with some of her subordinates.]]) |
1058 | 1065 |
|
1059 | 1066 |
|
| 1067 | +(deftile "V " "a vampire" [Wanderer Summoner] |
| 1068 | + :iq-ix 204 |
| 1069 | + :destruction-points 100 |
| 1070 | +
|
| 1071 | + :field-defaults (dict |
| 1072 | + :action-i 0) |
| 1073 | + :mutable-fields #("action_i") |
| 1074 | +
|
| 1075 | + :immune undead-immunities |
| 1076 | + :damage-melee 10 |
| 1077 | +
|
| 1078 | + :$summon-frequency 2 |
| 1079 | + :$summon-hp 3 |
| 1080 | + :$action-list #( |
| 1081 | + ; For simplicity, vampires don't also sometimes apporach as in IQ. |
| 1082 | + 'wander |
| 1083 | + 'wander |
| 1084 | + 'vampirize |
| 1085 | + 'wander |
| 1086 | + 'bats |
| 1087 | + 'vampirize |
| 1088 | + 'wander |
| 1089 | + 'wander |
| 1090 | + 'vampirize |
| 1091 | + 'bats) |
| 1092 | +
|
| 1093 | + :info-bullets (meth [] |
| 1094 | + (.info-bullets (super) |
| 1095 | + #("Action list" (.join ", " (map str @action-list))) |
| 1096 | + #("Action index" @action-i))) |
| 1097 | +
|
| 1098 | + :suffix-dict (meth [] |
| 1099 | + { |
| 1100 | + #** (Monster.suffix-dict @) |
| 1101 | + "wd" (:wd (Wanderer.suffix-dict @)) |
| 1102 | + ; Summoner.suffix-dict is skipped on purpose, because the |
| 1103 | + ; displayed summon power will always be 0, because the summon |
| 1104 | + ; frequency is an integer. |
| 1105 | + "act" (hy.repr (str (get @action-list @action-i)))}) |
| 1106 | +
|
| 1107 | + :act (meth [] |
| 1108 | + (doc f"Idiosyncratic — If the monster can attack, it does. Otherwise, it rotates among its list of actions. `wander` works per `Wander`. `bats` summons {@summon-frequency} bats, each with {@summon-hp} HP. `vampirize` attempts to turn an adjacent monster into a vampire, and works per `Wander` if no eligible monster is present.") |
| 1109 | + (when (@try-to-attack-player) |
| 1110 | + (return)) |
| 1111 | + (ecase (get @action-list @action-i) |
| 1112 | + 'wander |
| 1113 | + (@wander) |
| 1114 | + 'bats |
| 1115 | + (@summon "bat" @summon-frequency @summon-hp) |
| 1116 | + 'vampirize |
| 1117 | + (block (for [p (burst @pos 1 :exclude-center T) tile (at p)] |
| 1118 | + (when (and |
| 1119 | + (isinstance tile Monster) |
| 1120 | + tile.vampirizable |
| 1121 | + (in (get (walkability @pos (dir-to @pos p) :monster? T) 1) |
| 1122 | + ['bump 'walk])) |
| 1123 | + (.replace tile "vampire" :hp tile.hp) |
| 1124 | + (block-ret)) |
| 1125 | + (else |
| 1126 | + (@wander))))) |
| 1127 | + (setv @action-i (% (+ 1 @action-i) (len @action-list)))) |
| 1128 | +
|
| 1129 | + :hook-normal-destruction (meth [] |
| 1130 | + (doc f"A bat with {@summon-hp} HP is created in its square.") |
| 1131 | + (@replace "bat" :hp @summon-hp)) |
| 1132 | +
|
| 1133 | + :flavor "An aristocratic gentleman in a long black cloak with an infectious personality. A steady diet of the blood of the living makes him appear much more vivacious than other undead. Though he looks young, he is in fact somewhat long in the tooth.") |
| 1134 | +
|
| 1135 | +
|
1060 | 1136 | (deftile "@ " "a doppelganger" Approacher |
1061 | 1137 | :iq-ix 177 |
1062 | 1138 | :destruction-points 100 |
|
0 commit comments