source: abuse/trunk/data/register/ant.lsp @ 583

Last change on this file since 583 was 582, checked in by Sam Hocevar, 12 years ago

data: remove \r and trailing spaces and tabs from all Lisp sources.

File size: 3.3 KB
Line 
1;; Copyright 1995 Crack dot Com,  All Rights reserved
2;; See licencing information for more details on usage rights
3
4
5(defun boss_damage (amount from hitx hity push_xvel push_yvel)
6  (if (and (eq (fade_count) 0) (not (eq (aistate) 0)) (< (aitype) 6))
7      (progn
8        (damage_fun amount from hitx hity push_xvel push_yvel)
9        (if (eq (hp) 0)
10            (progn
11              (set_hp 1)
12              (set_aitype (+ (aitype) 1))
13              (if (eq (aitype) 6)         ;; go to next alien type
14                  (set_aistate 10)        ;; end game
15                (set_aistate 5)))))))         ;; fade out
16
17(defun boss_cons ()
18  (set_hp 1)
19  (setq taunt_time 20))
20
21(defun boss_fire ()
22  (let ((firex (+ (x) (* (direction) 17)) )
23        (firey (- (y) 25))
24        (playerx (+ (with_object (bg) (x)) (with_object (bg) (* (xvel) 8))))
25        (playery (+ (- (with_object (bg) (y)) 15) (with_object (bg) (* (yvel) 2)))))
26
27    (if (and (can_see (x) (y) firex firey nil) (can_see firex firey playerx playery nil))
28        (progn
29          (let ((angle (atan2 (- firey playery)
30                              (- playerx firex))))
31            (fire_object (me) (aitype) firex firey angle (bg))
32            (set_state weapon_fire))
33
34          ))))
35
36
37(defun boss_ai ()
38  (if (total_objects)
39
40      (if (eq (aistate) 11)
41          nil
42        (progn
43          (select (aistate)
44                  (0;; wait for turn on
45                   (set_state hiding);; can't see us
46                   (set_targetable nil)
47                   (if (activated)
48                       (set_aistate 1)))
49                  (1;; taunt for a while
50                   (set_targetable nil)
51                   (if (eq taunt_time 0)
52                       (progn
53                         (set_fade_count 14)
54                         (set_state stopped)
55                         (play_sound APPEAR_SND 127 (x) (y))
56                         (set_aistate 2)));; fade in
57                   (progn
58                     (setq taunt_time (- taunt_time 1))
59                     (if (eq (mod taunt_time 25) 0)
60                         (play_sound TAUNT_SND 127 (x) (y)))))
61
62                  (2;; fade in
63                   (set_direction (toward))
64                   (if (eq (fade_count) 0)
65                       (progn
66                         (set_state weapon_fire)
67                         (go_state 3))
68                     (set_fade_count (- (fade_count) 2))))
69
70                  (3;; wait to fire
71                   (set_targetable T)
72                   (if (next_picture) T
73                     (go_state 4)))
74
75                  (4;; fire1
76                   (boss_fire)
77                   (set_aistate 5)
78                   (set_state weapon_fire))
79
80                  (5;; wait to fire
81                   (set_targetable T)
82                   (if (next_picture) T
83                     (go_state 6)))
84
85                  (6;; fire1
86                   (boss_fire)
87                   (set_aistate 7)
88                   (set_state stopped))
89
90                  (7;; fade out
91                   (set_targetable nil)
92                   (set_fade_count (+ (fade_count) 2))
93                   (if (eq (fade_count) 14)
94                       (progn
95                         (set_state hiding)
96                         (let ((to_object (get_object (random (total_objects)))))
97                           (set_x (with_object to_object (x)))
98                           (set_y (with_object to_object (y))))
99                         (setq taunt_time (- 30 (* (aitype) 2)))
100                         (go_state 0))))
101
102                  (10;; game over
103                   (set_state hiding)
104                   (set_targetable nil)
105                   (if (eq (state_time) 60)
106                       (go_state 11))
107                   (if (not (eq (state_time) 0))
108                       (progn
109                         (if (eq (mod (state_time) 8) 0)
110                             (play_sound GRENADE_SND 127 (x) (y)))
111                         (add_object EXPLODE1 (+ (x) (random (* (state_time) 2))) (+ (random (state_time)) (y)))
112                         (add_object EXPLODE1 (- (x) (random (* (state_time) 2))) (- (y) (random (state_time)))))))
113                  )
114
115          T))))
116
117
118
119
120(def_char BOSS_ANT
121  (funs (ai_fun boss_ai)
122        (draw_fun ant_draw)
123        (damage_fun boss_damage))
124  (vars taunt_time)
125  (flags (hurtable T)
126         (unlistable T))
127  (fields ("taunt_time" "taunt_tint")
128         ("aistate" "aistate"))
129  (states  "register/boss.spe"
130   (stopped "awlk0001.pcx")
131   (hiding  "hidden")
132   (weapon_fire  (seq "asht" 2 5))))
133
134
135
136
137
138
Note: See TracBrowser for help on using the repository browser.