source: abuse/trunk/data/addon/claudio/claudio.lsp @ 590

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

data: remove exact duplicate Lisp files, merge all main space Lisp files,
and move most frabs addons to the main data directory.

File size: 47.5 KB
Line 
1/******************************************************************************************
2*                                                                                         *
3* New characters and tiles by                                                             *
4* Claudio Bolzoni, version 1.5,    claudio.bolzoni@mbox300.swipnet.se                     *
5*                                                                                         *
6* NOTE: This and all other files by Claudio Bolzoni contained in the archive              *
7* claudio(1.5).zip  can be used and modified freely for non-commercial purposes,          *
8* but credits must be given to the author.                                                *
9* If you intend to distribute any file, however, contact Claudio Bolzoni.                 *
10* If you want to use work done by other people than Claudio Bolzoni, contact the author   *
11* of that work (credits are given to those authors in this file).                         *
12*                                                                                         *
13*                                                                                         *
14*                                                                                         *
15******************************************************************************************/
16
17
18
19;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
20;;                                                                                       ;;
21;; SOUNDS                                                                                ;;
22;;                                                                                       ;;
23;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
24
25
26(def_sound 'DROIDMOV_SND    (sfxdir "apain01.wav"))
27(def_sound 'TREX1_SND    "addon/claudio/trex1.wav")
28(def_sound 'STOMP_SND    (sfxdir "poof06.wav"))
29(def_sound 'TREX2_SND    "addon/claudio/trex2.wav")
30(def_sound 'TREX3_SND    (sfxdir "adie03.wav"))
31(def_sound 'FIRE_SND    "addon/claudio/fire.wav")
32(def_sound 'SWISH_SND    "addon/claudio/spaceo.wav")
33(def_sound 'SEWER1_SND    "addon/claudio/sewers.wav")
34(def_sound 'GLASS1_SND    "addon/claudio/glass1.wav")
35(def_sound 'UNHEALTH_UP_SND    "addon/claudio/unhealth.wav")
36(def_sound 'WFALL_SND    "addon/claudio/wfall.wav")
37(def_sound 'DRILL_SND    "addon/claudio/drill.wav")
38(def_sound 'SKULL_SND    "addon/claudio/skull.wav")
39(def_sound 'ASHIP_SND    "addon/claudio/aship.wav")
40
41;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
42;;                                                                                       ;;
43;; CHAR 1: droid - jugger version                                                        ;;
44;;                                                                                       ;;
45;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
46
47(defun droidjug_ai ()
48  (if (<= (hp) 0);;*
49      (if (eq (state) dieing)
50          (next_picture)
51          (set_state dieing)
52      )
53       (if (activated);; **
54             (progn       ;; ***
55               (set_targetable T)
56               (push_char 35 40)
57               (select (aistate)
58
59                    (0 ;; prepare to walk toward player
60                       (if (eq stationary 0)
61                         (progn
62                              (set_state running)
63                              (go_state 1)
64                     )
65                         (if (> (state_time) (aitype))
66                              (progn
67                                 (set_state weapon_fire)
68                                 (set_aistate 2)
69                         )
70                     )
71                   )
72                 );;end aistate 0
73
74                  (1 ;; walk toward player
75                   (if (eq stationary 0)
76                     (progn
77                         (set_direction (toward))
78                       (let (
79                         (curx (x));; save position in case we fall off a cliff
80                               (cury (y))
81                        )
82                       (if (next_picture)
83                            (if (eq (current_frame) 8)
84                                  (play_sound DROIDMOV_SND 127 (x) (y))
85                      )
86                            (progn
87                               (play_sound DROIDMOV_SND 127 (x) (y))
88                               (set_state weapon_fire)
89                               (set_aistate 2)
90                      )
91                   )
92                       (if (can_see (x) (y) (x) (+ (y) 5) nil)
93                           (progn
94                                 (set_x curx)
95                                 (set_y cury)
96                                 (try_move 0 10)
97                     )
98                   )
99                 )
100                )
101                    (if (> (state_time) (aitype))
102                         (progn
103                           (set_state weapon_fire)
104                           (set_aistate 2)
105                   )
106                 )
107               )
108              );; end aistate 1
109
110                  (2 ;; start fire
111                   (if (> (state_time) 3)
112                       (let (
113                        (myself (me))
114                              (xspeed (* throw_xvel (direction)))
115                              (yspeed throw_yvel)
116                         )
117                         (with_object
118                        (add_object GRENADE (+ (x) (* (direction) 16)) (- (y) 24) 1)
119                                (progn
120                                (user_fun myself)
121                                  (set_xvel xspeed)
122                                  (set_yvel yspeed)
123                        )
124                   )
125                         (go_state 3)
126               )
127                   (next_picture)
128               )
129             );; end aistate 2
130
131             (3 ;; wait for fire animation
132                   (if (next_picture) nil (set_aistate 0))
133              );; end aistate 3
134           );; end select
135          T);; end *** progn
136      (progn (set_targetable nil)
137        T)
138);; end ** if
139);; end * if
140);; end droidjug_ai ()
141
142(defun jug_cons ()
143  (setq throw_xvel 13)
144  (setq throw_yvel -10)
145  (set_aitype 10))
146
147(defun explo_damage_cache (type)
148  (list (list EXPLODE6) nil))
149
150(def_char DROID_JUGGER
151  (range 200 0)
152  (funs (ai_fun     droidjug_ai)
153        (constructor jug_cons)
154        (get_cache_list_fun explo_damage_cache)
155        (damage_fun explo_damage))
156  (flags (hurtable T)(unactive_shield T))
157  (abilities (start_hp    50)
158             (push_xrange 1))
159  (vars throw_xvel throw_yvel stationary)
160  (fields ("hp"            ai_health)
161          ("aitype"        jug_throw_spd)
162          ("throw_xvel"    jug_throw_xv)
163          ("throw_yvel"    jug_throw_yv)
164          ("stationary"    jug_stat)
165          ("aistate"       ai_state))
166
167  (states "addon/claudio/droid.spe"
168          (stopped "ds0002.pcx")
169          (running (seq "d" 1 4))
170          (weapon_fire (seq "df" 1 10))
171          (dieing (seq "dd" 1 8))))
172
173;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
174;;                                                                                       ;;
175;; CHAR 2: droid - walking version                                                       ;;
176;;                                                                                       ;;
177;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
178
179(defun burst_fire (firex firey angle)
180
181  (if (> fire_time 0);; if we need to wait till next burst
182      (progn
183        (setq fire_time (- fire_time 1))
184        (if (eq fire_time 0)
185            (progn
186              (setq burst_left burst_total)
187              (setq burst_wait 0))))
188    (if (eq burst_wait 0)
189        (progn
190          (if (or (eq burst_left 1) (eq burst_left 0))
191              (setq fire_time fire_delay)
192            (setq burst_left (- burst_left 1)))
193          (setq burst_wait burst_delay)
194          (fire_object (me) (aitype) firex firey angle (bg)))
195      (setq burst_wait (- burst_wait 1)))))
196
197(defun wrob_cons ()
198  (setq fire_delay 4)
199  (setq burst_delay 1)
200  (setq max_xvel 10)
201  (setq max_yvel 5)
202  (set_aitype 0)
203  ;;(set_hp 70)
204  (setq burst_total 5)
205);; end wrob_cons
206
207(defun droid_ai ()
208  (if (<= (hp) 0) ;; *
209
210      (if (eq (state) dieing)
211          (next_picture)
212          (set_state dieing)
213       )
214
215       (if (activated)         ;; **
216          (progn                  ;;***
217               (set_targetable T)
218               (push_char 35 40)
219             (select (aistate)
220                  (0;; walk toward player
221                    (if (or  (> (distx) 120) (or (<(disty) -5)(>(disty) 20)) (not (eq (direction) (toward))))
222                         (progn
223                          (if (eq (mod (state_time) 6) 0)        ;; play sound every 6 ticks
224                            (play_sound DROIDMOV_SND 127 (x) (y))
225                        )
226                            (move (toward) 0 0)
227                            (next_picture)
228                     )
229                         (progn
230                            (set_state stopped)
231                            (set_aistate 1)
232                     )
233                  )
234                 );; end aistate 0
235
236                  (1;; stop and fire
237                     (burst_fire  (+ (x) (* (direction) 16)) (- (y) 22)
238                            (if (> (direction) 0)
239                                (mod (- 375 (/ (* burst_left 30) burst_total)) 360)
240                              (+ 165 (/ (* burst_left 30) burst_total))
241                       )
242                    )
243                      (if (not (eq fire_time 0))
244                            (set_aistate 0)
245                    )
246                );; end aistate 1
247             );; end select
248
249               (if (<= (hp) 0)                        ;; are we dead, if so blow up
250                   (progn
251                        (add_object EXPLODE6 (+ (x) 5) (- (y) 10)     0)
252                        (add_object EXPLODE6 (+ (x) -5) (- (y) 15)    2)  ;; wait 2 frames before appearing
253                        (add_object EXPLODE6 (+ (x) 10) (- (y) 2)     1)
254                        (add_object EXPLODE6 (+ (x) -10) (- (y) 20)   3)
255                        (add_object EXPLODE6 (+ (x) 20) (- (y) 27)    4)
256                        (add_object EXPLODE6 (+ (x) -25) (- (y) 30)   2)
257                        (add_object EXPLODE6 (+ (x) 20) (- (y) 5)     4)
258                        (add_object EXPLODE6 (+ (x) -3) (- (y) 1)     5)
259                        (set_aistate 0)
260                  )
261             )
262
263      T);; end of *** progn
264    T);; end of ** if activated
265  );; end of * if
266);; end of ai
267
268(def_char DROID
269
270  (funs (ai_fun droid_ai)
271          (constructor wrob_cons)
272          (get_cache_list_fun explo_damage_cache)
273        (damage_fun explo_damage)
274  );; end funs
275
276  (abilities (run_top_speed 8)
277             (start_hp 70)
278  );; end abilities
279
280  (flags (hurtable T)
281         (can_block T)
282         (unactive_shield T)
283  );; end flags
284
285  (range 300 100)
286
287  (vars fire_delay
288        burst_delay
289        burst_total
290        burst_wait
291        burst_left
292          max_xvel
293        max_yvel
294        smoke_time
295        fire_time
296  );; end vars
297
298  (fields ("fire_delay"   wrob_fdelay)
299          ("burst_delay"  wrob_bdelay)
300          ("burst_total"  wrob_btotal)
301          ("max_xvel"     wrob_mxv)
302          ("max_yvel"     wrob_myv)
303          ("hp"           ai_health)
304          ("aitype"       ai_type)
305          ("aistate"      ai_state)
306  );; end fields
307
308  (states "addon/claudio/droid.spe"
309          (stopped "ds0001.pcx")
310          (running (seq "d" 1 10))
311          (start_run_jump "d0001.pcx")
312          (flinch_up      "ds0002.pcx")
313          (run_jump       "d0003.pcx")
314          (dieing (seq "dd" 1 8))
315  );; end states
316
317);; end def_char DROID
318
319;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
320;;                                                                                       ;;
321;; CHAR 3: Tyrannosaurus Rex                                                              ;;
322;;                                                                                       ;;
323;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
324
325(defun trex_ai ()
326  (if (<= (hp) 0) ;; *
327
328      (if (eq (state) dieing)
329        (progn
330             (next_picture)
331             (play_sound TREX3_SND 127 (x) (y))
332        )
333          (set_state dieing)
334
335       )
336
337       (if (activated)         ;; **
338          (progn                  ;;***
339               (set_targetable T)
340             (if (and (touching_bg) (eq (mod (state_time) 20) 0))
341                (do_damage 10 (bg)))
342             (select (aistate)
343                  (0;; walk toward player
344                     (if  (or (< (disty) -5) (> (disty) 5) (< (distx) -10) (> (distx) 10) (not (eq (direction) (toward))) )
345                       (progn
346                          (if (eq (mod (state_time) 6) 0) ;; play sound every 6 ticks
347                            (play_sound JSTOMP_SND 60 (x) (y))
348                        )
349                          (if (eq (mod (state_time) 235) 0)        ;; play sound every 235 ticks
350                            (play_sound TREX1_SND 127 (x) (y))
351                        )
352                              (move (toward) 0 0)
353                              (next_picture)
354                       )
355                         ;; (progn
356                            (set_aistate 1)
357                   ;;   )
358                     )
359                 );; end aistate 0
360
361                  (1;; stop and eat
362                    (if  (or (< (disty) -5) (> (disty) 5) (< (distx) -10) (> (distx) 10) (not (eq (direction) (toward))) )
363                       (set_aistate 0)
364                       (progn
365                          (set_state eating)
366                          (if (eq (mod (state_time) 66) 0)     ;; play sound every 66 ticks
367                              (play_sound TREX2_SND  127 (x) (y))
368                          )
369                        )
370                      )
371                    (with_object (bg)
372                      (if (< (hp)0)
373                            (set_state stopped)
374                      )
375                     )
376                );; end aistate 1
377             );; end select
378      T);; end of *** progn
379    T);; end of ** if activated
380  );; end of * if
381);; end of ai
382
383(def_char T_REX
384
385  (funs (ai_fun trex_ai)
386        ;;  (constructor wrob_cons)
387        ;;  (get_cache_list_fun explo_damage_cache)
388      ;;  (damage_fun explo_damage)
389  );; end funs
390
391  (abilities (run_top_speed 8)
392             (start_hp 70)
393  );; end abilities
394
395  (flags (hurtable T)
396         (can_block T)
397         (unactive_shield T)
398  );; end flags
399
400  (range 300 100)
401
402  (vars fire_delay
403        burst_delay
404        burst_total
405        burst_wait
406        burst_left
407          max_xvel
408        max_yvel
409        smoke_time
410        fire_time
411  );; end vars
412
413  (fields
414          ("hp"           ai_health)
415          ("aistate"      ai_state)
416  );; end fields
417
418  (states "addon/claudio/trex1.spe"
419          (stopped "stand")
420          (running (seq "w" 1 10))
421          (start_run_jump "jumpflitch")
422          (flinch_up      "jumpflitch")
423          (run_jump       "jumpflitch")
424        (blocking (seq "w" 1 5)"jumpflitch")
425        (eating  (seq "e" 2 10))
426          (dieing (seq "d" 1 5))
427  );; end states
428
429);; end def_char T_REX
430
431;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
432;;                                                                                       ;;
433;; CHAR 4: Big walking robot                                                             ;;
434;;                                                                                       ;;
435;; this char comes in three versions which can be shifted between by                     ;;
436;; activating/deactivating code sections in wrob_ai and in the char                      ;;
437;; definition (def_char WALK_ROB), by putting and removing ";;" before code lines        ;;
438;; --- version 1: exploding and disappearing when dead                                   ;;
439;; --- version 2: burned debris left when dead (not blocking)                            ;;
440;; --- version 2: as in version 2, but the debris are will block the player              ;;
441;;                                                                                       ;;
442;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
443
444(defun wrob_ai ()
445  (if (<= (hp) 0) ;; *
446
447       nil   ;; inactivate this "nil" and activate the following if-section when using versions 2 and 3
448
449    ;; if (eq (state) dieing)
450    ;;   (next_picture)
451    ;;   (set_aistate 0)
452    ;; )
453
454       (if (activated)         ;; **
455          (progn                  ;;***
456               (set_targetable T)
457               (push_char 35 40)
458             (select (aistate)
459                  (0;; walk toward player
460                    (if (or  (> (distx) 120) (or (<(disty) -5)(>(disty) 20)) (not (eq (direction) (toward))))
461                         (progn
462                          (if (eq (mod (state_time) 6) 0)        ;; play sound every 6 ticks
463                            (play_sound STOMP_SND 127 (x) (y))
464                        )
465                            (move (toward) 0 0)
466                            (next_picture)
467                     )
468                         (progn
469                            (set_state stopped)
470                            (set_aistate 1)
471                     )
472                  )
473                 );; end aistate 0
474
475                  (1;; stop and fire
476                     (burst_fire  (+ (x) (* (direction) 16)) (- (y) 22)
477                            (if (> (direction) 0)
478                                (mod (- 375 (/ (* burst_left 30) burst_total)) 360)
479                              (+ 165 (/ (* burst_left 30) burst_total))
480                       )
481                    )
482                      (if (not (eq fire_time 0))
483                            (set_aistate 0)
484                    )
485                );; end aistate 1
486                (2 ;; dead robot
487                   (set_state dieing)
488                   (set_aistate 0)
489                );; end aistate 2
490             );; end select
491
492               (if (<= (hp) 0)                        ;; are we dead, if so blow up
493                   (progn
494                        (add_object EXPLODE6 (+ (x) 5) (- (y) 10)     0)
495                        (add_object EXPLODE6 (+ (x) -5) (- (y) 15)    2)  ;; wait 2 frames before appearing
496                        (add_object EXPLODE6 (+ (x) 10) (- (y) 2)     1)
497                        (add_object EXPLODE6 (+ (x) -10) (- (y) 20)   3)
498                        (add_object EXPLODE6 (+ (x) 20) (- (y) 27)    4)
499                        (add_object EXPLODE6 (+ (x) -25) (- (y) 30)   2)
500                        (add_object EXPLODE6 (+ (x) 20) (- (y) 5)     4)
501                        (add_object EXPLODE6 (+ (x) -3) (- (y) 1)     5)
502                        (set_aistate 0)
503                  )
504             )
505
506      T);; end of *** progn
507    T);; end of ** if activated
508  );; end of * if
509);; end of ai
510
511(def_char WALK_ROB
512
513  (funs (ai_fun wrob_ai)
514          (constructor wrob_cons)
515          (get_cache_list_fun explo_damage_cache)
516        (damage_fun explo_damage)
517  );; end funs
518
519  (abilities (run_top_speed 6)
520             (start_hp 70)
521  );; end abilities
522
523  (flags (hurtable T)
524         (can_block T)
525         (unactive_shield T)
526  );; end flags
527
528  (range 300 100)
529
530  (vars fire_delay
531        burst_delay
532        burst_total
533        burst_wait
534        burst_left
535          max_xvel
536        max_yvel
537        smoke_time
538        fire_time
539   );; end vars
540
541  (fields ("fire_delay"   wrob_fdelay)
542          ("burst_delay"  wrob_bdelay)
543          ("burst_total"  wrob_btotal)
544          ("max_xvel"     wrob_mxv)
545          ("max_yvel"     wrob_myv)
546          ("hp"           ai_health)
547        ("aitype"       ai_type)
548          ("aistate"      ai_state)
549
550  );; end fields
551
552  (states "addon/claudio/rob2.spe"
553          (stopped "wwlk0001.pcx")
554          (running (seq "wwlk" 1 10))
555          (start_run_jump "wstart_jump")
556          (flinch_up      "wflinch")
557        ;;(flinch_up      "wwflinch")  ;;<--- use this line instead of the one above when using version 2
558          (run_jump       "wwlk0009.pcx")
559        (dieing         "wflinch")
560        ;;(dieing      "wwflinch")  ;;<--- use this line instead of the one above when using version 2
561  );; end states
562
563);; end def_char WALK_ROB
564
565;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
566;;                                                                                       ;;
567;; CHAR 5 and 6: Space doors                                                                   ;;
568;;                                                                                       ;;
569;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
570
571(defun other_sdoor_opening ()
572  (if (eq (total_objects) 0)
573      nil
574    (with_object (get_object 0)
575                 (if (eq (otype) SPACE_DOOR)
576                     (if (eq is_opening 0)
577                         (if (and (< (distx) 50) (< (disty) 40))
578                             T
579                           nil)
580                       T)
581                   nil))))
582
583(defun open_spacedoor ()
584
585  (setq is_opening 1)
586  (if (eq (current_frame) 4)
587      (setq is_opening 0)
588    (progn
589      (if (eq (current_frame) 0)
590          (play_sound SWISH 70 (x) (y)))
591      (next_picture))))
592
593(defun close_spacedoor ()
594  (setq is_opening 0)
595  (if (eq (current_frame) 0)
596      nil
597    (progn
598      (if (eq (current_frame) 4)
599          (play_sound SWISH 70 (x) (y)))
600      (set_current_frame (- (current_frame) 1)))))
601
602(defun tpdspace_ai ()     ;; teleporting door ai
603  (if (or (and (< (distx) 50) (< (disty) 40))
604          (other_sdoor_opening))
605      (open_spacedoor)
606    (close_spacedoor))
607
608  (let ((player (bg)))
609    (if (has_object player)
610        (if (not (with_object player (pressing_action_key)))
611            (remove_object player))
612      (if (and (< (distx) 20) (< (disty) 30) (with_object player (pressing_action_key))
613               (> (total_objects) 0))
614          (let ((otherx (with_object (get_object 0) (x)))
615                (othery (with_object (get_object 0) (y))))
616            (with_object (get_object 0) (link_object player))
617            (with_object player (progn
618                                  (set_x otherx)
619                                  (set_y othery)))))))
620T)
621
622(def_char SPACE_DOOR_WIDE
623  (range 0 0)
624  (vars is_opening)
625  (funs (ai_fun      tpdspace_ai)
626        (constructor tp_door_cons)
627        (reload_fun lower_reload)
628        (draw_fun   tp_door_draw))
629  (fields ("xvel"   tp_amb))
630  (states "addon/claudio/spaced.spe" (stopped (seq "vv" 1 6))))
631
632(def_char SPACE_DOOR
633  (funs (ai_fun sdoor_ai)
634        (reload_fun lower_reload))
635  (flags (can_block T))
636  (range 250 60)
637  (draw_range 30 50)
638  (abilities (push_xrange 1))
639  (states "addon/claudio/spaced.spe"
640          (stopped "sp0001.pcx")
641          (running (seq "sp" 1 6))
642          (walking (seq "sp" 6 1))
643          (blocking "sp0006.pcx")))
644
645;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
646;;                                                                                       ;;
647;; CHAR 7, 8 and 9: Smart platforms                                                      ;;
648;;                                                                                       ;;
649;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
650
651(defun make_my_smart_plat (symbol off_frame on_frame snap_yoffset)
652  (eval (list 'def_char symbol
653              '(flags (can_block T))
654              `(abilities (start_accel ,snap_yoffset))
655              `(fields ("xacel" ,plat_speed)
656                       ("yacel" ,plat_2speed)
657                       ("xvel"  ,plat_pos)
658                       ("yvel"  ,plat_wait))
659              '(funs (ai_fun      platform_ai)
660                     (constructor platform_cons))
661              '(range 50 500)
662              '(draw_range 30 60)
663              `(states "addon/claudio/nplatfor.spe"
664                       (stopped   ,off_frame)
665                       (running   (list ,off_frame ,on_frame) )))))
666
667(make_my_smart_plat 'SMART_PLAT_ELEV "ele_off" "ele_on" 22)
668(make_my_smart_plat 'SMART_PLAT_MEDIUM   "med_off" "med_on" 22)
669(make_my_smart_plat 'SMART_PLAT_ELEV_SPACE   "ele1_off" "ele1_on" 26)
670
671;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
672;;                                                                                       ;;
673;; CHAR 10: Burning fire                                                                 ;;
674;;                                                                                       ;;
675;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
676
677(defun fire_ai ()
678  (if (and (touching_bg) (eq (mod (state_time) 20) 0))
679      (do_damage 20 (bg)))
680  (select (aistate)
681          (0
682
683            (if (eq (random 100) 0)
684                 (progn
685                   (play_sound FIRE_SND 127 (x) (y))
686                   (set_aistate 1)))
687             (next_picture))
688          (1
689
690           (next_picture)
691             (if (eq (state_time) 5)
692                 (progn
693                   (hurt_radius (x) (y) 20 20 nil 10)
694                   (set_aistate 0)))))
695  T)
696
697
698(def_char FIRE_C
699  (funs (ai_fun fire_ai))
700  (states  "addon/claudio/fire.spe"
701           (stopped (seq "f" 1 33))))
702
703;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
704;;                                                                                       ;;
705;; CHAR 11-15 Space objects                                                              ;;
706;;                                                                                       ;;
707;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
708
709(def_char COMP_PANELS
710  (funs (ai_fun   do_nothing))
711  (states "addon/claudio/mypanels.spe" (stopped (seq "c" 1 10))))
712
713
714(def_char COMP_SCREEN1
715  (funs (ai_fun   do_nothing))
716  (states "addon/claudio/mypanels.spe" (stopped (seq "p" 1 18))))
717
718(def_char COMP_SCREEN2
719  (funs (ai_fun   do_nothing))
720  (states "addon/claudio/mypanels.spe" (stopped (seq "s" 1 4))))
721
722(def_char COMP_SCREEN3
723  (funs (ai_fun   do_nothing))
724  (states "addon/claudio/mypanels.spe" (stopped "p0001.pcx")))
725
726(def_char COMP_CONSOLE1
727  (funs (ai_fun   do_nothing))
728  (states "addon/claudio/mypanels.spe" (stopped (seq "t" 1 2))))
729
730;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
731;;                                                                                       ;;
732;; CHAR 16-21: Water objects                                                             ;;
733;;                                                                                       ;;
734;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
735
736(defun sewer_ai ()
737
738  (select (aistate)
739          (0
740
741            (if (eq (random 100) 0)
742                 (progn
743                   (play_sound SEWER1_SND 127 (x) (y))
744                   (set_aistate 1)))
745             (next_picture))
746          (1
747
748           (next_picture)
749             (if (eq (state_time) 5)
750                 (progn
751                   (set_aistate 0)))))
752  T)
753
754(defun deepw_cons ()
755        (set_fade_count 5))
756
757(defun deepw_ai ()
758  (if (and (touching_bg) (eq (mod (state_time) 20) 0))
759      (do_damage 2 (bg)))
760  (select (aistate)
761          (0
762
763            (if (eq (random 100) 0)
764                 (progn
765                   (play_sound SEWER1_SND 127 (x) (y))
766                   (set_aistate 1)))
767             (next_picture))
768          (1
769
770           (next_picture)
771             (if (eq (state_time) 5)
772                 (progn
773                   (hurt_radius (x) (y) 20 20 nil 10)
774                   (set_aistate 0)))))
775  T)
776
777(defun wfall_ai ()
778  (select (aistate)
779          (0
780
781            (if (eq (random 100) 0)
782                 (progn
783                   (play_sound WFALL_SND 127 (x) (y))
784                   (set_aistate 1)))
785             (next_picture))
786          (1
787
788           (next_picture)
789             (if (eq (state_time) 5)
790                 (progn
791                   (hurt_radius (x) (y) 20 20 nil 10)
792                   (set_aistate 0)))))
793  T)
794
795(def_char WATER_DEEP1
796  (funs (ai_fun deepw_ai)
797        (constructor deepw_cons)
798  )
799  (states  "addon/claudio/deepw1.spe"
800           (stopped (seq "w" 1 5))))
801
802(def_char WATER_DEEP2
803  (funs (ai_fun deepw_ai)
804        (constructor deepw_cons)
805  )
806  (states  "addon/claudio/deepw1.spe"
807           (stopped (seq "wc" 1 5))))
808
809(def_char WATER_SURF1
810  (funs (ai_fun deepw_ai)
811        (constructor deepw_cons)
812  )
813  (states  "addon/claudio/deepw1.spe"
814           (stopped (seq "ws" 1 5))))
815
816(def_char WATER_SURF2
817  (funs (ai_fun deepw_ai)
818        (constructor deepw_cons)
819  )
820  (states  "addon/claudio/deepw1.spe"
821           (stopped (seq "wcs" 1 5))))
822
823(def_char WATER_FALL1 ;; This char must be used together with the foretiles contained in extiles.spe, see watert.spe for examples
824  (funs (ai_fun wfall_ai))
825  (states  "addon/claudio/deepw2.spe"
826           (stopped (seq "dw" 1 5))))
827
828(def_char SEWER_FALL_THIN ;; original art by Mike Moss
829  (funs (ai_fun   sewer_ai))
830  (states "addon/claudio/watem.spe" (stopped (seq "sf" 1 4))))
831
832;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
833;;                                                                                       ;;
834;; CHAR 22, 23 and 24: Lamps: big, small and exploding                                   ;;
835;;                                                                                       ;;
836;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
837
838
839(defun exlamp_ai ()
840  (if (<= (hp) 0)
841      (if (eq (state) dieing)
842          (next_picture)
843        (progn
844          (play_sound GLASS1_SND 127 (x) (y))
845          (set_state dieing)
846          T))
847    T))
848
849
850(def_char LAMP_EX1
851
852  (funs (ai_fun  exlamp_ai))
853  (flags (can_block T)
854         (hurtable  T))
855  (abilities (start_hp 30))
856  (states "addon/claudio/lamp.spe"
857          (stopped       "l0001.pcx")
858          (dieing        (seq "l" 1 10))))
859
860
861(defun slamp_ai ()
862(if (activated)
863 (set_state running)
864 (set_state stopped)
865)
866)
867
868
869(def_char LAMP_BIG
870  (funs (ai_fun   slamp_ai))
871  (states "addon/claudio/lamp.spe"
872     (stopped "l0002.pcx")
873     (running "l0001.pcx")
874  )
875)
876
877;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
878;;                                                                                       ;;
879;; CHAR 25 and 26: materia (health) and anti-materia (unhealth)                          ;;
880;;                                                                                       ;;
881;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
882
883;; Removed
884
885;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
886;;                                                                                       ;;
887;; CHARS 27 and 28: Space switch and (Lava burst - Removed                               ;;
888;;                                                                                       ;;
889;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
890
891(def_char SPACE_SWITCH
892  (funs (ai_fun switcher_ai)
893        (reload_fun lower_reload))
894  (range 0 0)
895  (states "addon/claudio/sswitch.spe"
896          (stopped '("ssw0001" "ssw0002"))
897          (running '("ssw0003"  "ssw0004"))))
898
899;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
900;;                                                                                       ;;
901;; CHAR 29 and 30: Ant boss v.2 and Super ant  - not working yet                         ;;
902;;                                                                                       ;;
903;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
904
905;;(load "addon/claudio/antextra.lsp")
906
907;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
908;;                                                                                       ;;
909;; CHAR 31: Death Umbrella                                                               ;;
910;;                                                                                       ;;
911;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
912
913
914(defun dumbrel_ai ()
915
916  (if (not (eq smoke_time 0))
917      (progn
918        (setq smoke_time (- smoke_time 1))
919        (if (eq (mod smoke_time 2) 0)
920            (add_object SMALL_DARK_CLOUD (x) (y)))))
921
922  (if (eq (aistate) 0)
923      (if (or (eq (total_objects) 0) (not (eq (with_object (get_object 0) (aistate)) 0)))
924          (if (next_picture) T
925            (progn
926              (set_targetable T)
927              (set_state running)
928              (set_aistate 1)))
929        (progn
930          (set_targetable nil)
931          (set_state stopped)
932          T))
933    (if (eq (hp) 0)
934        (progn
935        (play_sound GRENADE_SND 127 (x) (y))
936          (add_object EXPLODE1 (+ (x) (random 10)) (+ (+ (random 10) (y)) -20)     0)
937          (add_object EXPLODE1 (- (x) (random 10)) (+ (- (y) (random 10)) -20)     2)
938          (add_object EXPLODE1 (x) (+ (- (y) (random 20)) -20)                     4)
939          nil)
940      (progn
941        (if (eq (mod (state_time) 5) 0)
942            (play_sound DRILL_SND 127 (x) (y)))
943        (if (> (with_object (bg) (x)) (x))
944            (progn
945              (set_xvel (+ (xvel) 1))
946              (if (> (xvel) max_xvel) (set_xvel max_xvel))
947              (if (eq (direction) -1)
948                  (progn
949                    (set_direction 1)
950                    (set_state turn_around))))
951          (if (< (with_object (bg) (x)) (x))
952              (progn
953                (set_xvel (- (xvel) 1))
954                (if (< (xvel) (- 0 max_xvel)) (set_xvel (- 0 max_xvel)))
955                (if (eq (direction) 1)
956                    (progn
957                      (set_direction -1)
958                      (set_state turn_around))))))
959        (if (> (with_object (bg) (- (y) 70)) (y))
960            (if (> (yvel) max_yvel)
961                (set_yvel (- (yvel) 1))
962              (set_yvel (+ (yvel) 1)))
963
964          (if (< (with_object (bg) (- (y) 50)) (y))
965              (if (< (yvel) (- 0 max_yvel))
966                  (set_yvel (+ (yvel) 1))
967                (set_yvel (- (yvel) 1)))))
968
969        (if (eq (random 5) 0)
970            (set_xvel (+ (xvel) 1))
971          (if (eq (random 5) 0)
972              (set_xvel (- (xvel) 1))))
973        (if (eq (random 5) 0)
974            (set_yvel (+ (yvel) 1))
975          (if (eq (random 5) 0)
976              (set_yvel (- (yvel) 1))))
977
978        (if (next_picture) T (set_state running))
979
980        (bounce_move '(set_xvel (/ (xvel) 2)) '(set_xvel (/ (xvel) 2))
981                     '(set_yvel (/ (yvel) 2)) '(set_yvel (/ (yvel) 2)) nil)
982
983        (if (> fire_time 0)              ;; if we need to wait till next burst
984            (progn
985              (setq fire_time (- fire_time 1))
986              (if (eq fire_time 0)
987                  (progn
988                    (setq burst_left burst_total)
989                    (setq burst_wait 0))))
990          (if (eq burst_wait 0)
991              (if (and (< (distx) 150) (eq (direction) (facing)))
992                  (let ((firex (+ (x) (* (direction) 10)) )
993                        (firey (y))
994                        (playerx (+ (with_object (bg) (x)) (with_object (bg) (* (xvel) 4))))
995                        (playery (+ (- (with_object (bg) (y)) 15) (with_object (bg) (* (yvel) 2)))))
996                    (if (and (can_see (x) (y) firex firey nil) (can_see firex firey playerx playery nil))
997                        (progn
998                          (let ((angle (atan2 (- firey playery)
999                                              (- playerx firex))))
1000                            (if (or (eq burst_left 1) (eq burst_left 0))
1001                                (setq fire_time fire_delay)
1002                              (setq burst_left (- burst_left 1)))
1003                            (setq burst_wait burst_delay)
1004                            (fire_object (me) (aitype) firex firey angle (bg))
1005                            )))))
1006            (setq burst_wait (- burst_wait 1))))
1007        T))))
1008
1009(defun dumbrel_damage (amount from hitx hity push_xvel push_yvel)
1010  (if (and from (with_object from (and (> (total_objects) 0)
1011                                       (with_object (get_object 0)
1012                                                    (or (eq (otype) FLYER)
1013                                                        (eq (otype) GREEN_FLYER))
1014                                                        ))))
1015      nil
1016    (if (eq (state) stopped) nil
1017      (progn
1018        (setq smoke_time 30)
1019        (set_yvel (- (yvel) 14))
1020        (set_state flinch_up)
1021        (damage_fun amount from hitx hity push_xvel push_yvel)
1022        (if (and(< (hp) 100)(>(hp) 85))
1023              (set_aitype 1)
1024      )
1025        (if (and(< (hp) 85)(>(hp) 70))
1026              (set_aitype 9)
1027      )
1028        (if (and(< (hp) 70)(>(hp) 45))
1029              (set_aitype 4)
1030      )
1031        (if (and(< (hp) 45) (>(hp)20))
1032              (set_aitype 3)
1033      )
1034        (if (and(< (hp) 20)(>(hp)0))
1035              (set_aitype 5)
1036      )
1037))))
1038
1039(defun dumbrel_cons ()
1040  (setq fire_delay 20)
1041  (setq burst_delay 5)
1042  (setq max_xvel 2)
1043  (setq max_yvel 1)
1044  (set_aitype 0)
1045  (setq burst_total 2))
1046
1047(def_char DEATH_UMBRELLA
1048
1049  (funs (ai_fun dumbrel_ai)
1050          (constructor dumbrel_cons)
1051          (get_cache_list_fun explo_damage_cache)
1052        (damage_fun dumbrel_damage)
1053  );; end funs
1054
1055  (abilities (start_hp 100)
1056  );; end abilities
1057
1058  (flags (hurtable T)
1059         (can_block T)
1060         (unactive_shield T)
1061  );; end flags
1062
1063  (range 300 100)
1064
1065  (vars fire_delay
1066        burst_delay
1067        burst_total
1068        burst_wait
1069        burst_left
1070          max_xvel
1071        max_yvel
1072        smoke_time
1073        fire_time
1074   );; end vars
1075
1076  (states "addon/claudio/umbrel3.spe"
1077          (stopped "u0001.pcx")
1078          (running (seq "u" 1 4))
1079        ;;(dieing  (seq "u" 7 12))
1080  );; end states
1081
1082);; end def_char
1083
1084
1085;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1086;;                                                                                       ;;
1087;; CHAR 32: Ant Ship                                                                     ;;
1088;;                                                                                       ;;
1089;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1090
1091(defun antship_ai ()
1092
1093  (if (not (eq smoke_time 0))
1094      (progn
1095          (setq smoke_time (- smoke_time 1))
1096          (if (eq (mod smoke_time 2) 0)
1097            (add_object SMALL_DARK_CLOUD (x) (y))
1098        )
1099      )
1100  )
1101
1102  (if (eq (aistate) 0)
1103
1104      (if  (or  (eq (total_objects) 0)  (not(eq (with_object(get_object 0)(aistate))0)))
1105          (if (next_picture) T
1106            (progn
1107              (set_targetable T)
1108              (set_state running)
1109              (set_aistate 1)
1110          )
1111        )
1112          (progn
1113            (set_targetable nil)
1114            (set_state stopped)
1115          T)
1116      )
1117
1118      (if (<= (hp) 0)
1119
1120         (progn
1121
1122          (if (eq (state) dieing)
1123              (next_picture)
1124
1125              (progn
1126                (set_state dieing)
1127                (play_sound GRENADE_SND 127 (x) (y))
1128                  (add_object EXPLODE1 (+ (x) (random 10)) (+ (+ (random 10) (y)) -20)     0)
1129                  (add_object EXPLODE1 (- (x) (random 10)) (+ (- (y) (random 10)) -20)     2)
1130                  (add_object EXPLODE0 (x) (+ (- (y) (random 20)) -20)                     6)
1131              )
1132
1133          )
1134        )
1135        (progn
1136            (if (eq (mod (state_time) 5) 0)
1137              (play_sound ASHIP_SND 127 (x) (y))
1138          )
1139            (if (> (with_object (bg) (x)) (x))
1140            (progn
1141              (set_xvel (+ (xvel) 1))
1142              (if (> (xvel) max_xvel)
1143               (set_xvel max_xvel)
1144            )
1145              (if (eq (direction) -1)
1146                  (progn
1147                    (set_direction 1)
1148                    (set_state turn_around)
1149               )
1150             )
1151           )
1152             (if (< (with_object (bg) (x)) (x))
1153                (progn
1154                (set_xvel (- (xvel) 1))
1155                (if (< (xvel) (- 0 max_xvel))
1156                   (set_xvel (- 0 max_xvel))
1157                  )
1158                (if (eq (direction) 1)
1159                         (progn
1160                           (set_direction -1)
1161                           (set_state turn_around)
1162                     )
1163                  )
1164               )
1165           )
1166        )
1167
1168        (if (> (with_object (bg) (- (y) 70)) (y))
1169            (if (> (yvel) max_yvel)
1170                (set_yvel (- (yvel) 1))
1171              (set_yvel (+ (yvel) 1))
1172          )
1173            (if (< (with_object (bg) (- (y) 50)) (y))
1174              (if (< (yvel) (- 0 max_yvel))
1175                  (set_yvel (+ (yvel) 1))
1176                  (set_yvel (- (yvel) 1))
1177            )
1178          )
1179       )
1180
1181        (if (eq (random 5) 0)
1182            (set_xvel (+ (xvel) 1))
1183            (if (eq (random 5) 0)
1184              (set_xvel (- (xvel) 1))))
1185        (if (eq (random 5) 0)
1186            (set_yvel (+ (yvel) 1))
1187          (if (eq (random 5) 0)
1188              (set_yvel (- (yvel) 1))))
1189
1190        (if (next_picture) T (set_state running))
1191
1192        (bounce_move '(set_xvel (/ (xvel) 8)) '(set_xvel (/ (xvel) 8))
1193                     '(set_yvel (/ (yvel) 8)) '(set_yvel (/ (yvel) 8)) nil)
1194
1195        (if (> fire_time 0)
1196            (progn
1197              (setq fire_time (- fire_time 1))
1198              (if (eq fire_time 0)
1199                  (progn
1200                    (setq burst_left burst_total)
1201                    (setq burst_wait 0))))
1202          (if (eq burst_wait 0)
1203              (if (and (< (distx) 150) (eq (direction) (facing)))
1204                  (let ((firex (+ (x) (* (direction) 10)) )
1205                        (firey (y))
1206                        (playerx (+ (with_object (bg) (x)) (with_object (bg) (* (xvel) 4))))
1207                        (playery (+ (- (with_object (bg) (y)) 15) (with_object (bg) (* (yvel) 2)))))
1208                    (if (and (can_see (x) (y) firex firey nil) (can_see firex firey playerx playery nil))
1209                        (progn
1210                          (let ((angle (atan2 (- firey playery)
1211                                              (- playerx firex))))
1212                            (if (or (eq burst_left 1) (eq burst_left 0))
1213                                (setq fire_time fire_delay)
1214                              (setq burst_left (- burst_left 1)))
1215                            (setq burst_wait burst_delay)
1216                            (fire_object (me) (aitype) firex firey angle (bg))
1217                            )))))
1218            (setq burst_wait (- burst_wait 1))))
1219        T)))
1220
1221);; end ai
1222
1223(defun antship_damage (amount from hitx hity push_xvel push_yvel)
1224  (if (and from (with_object from (and (> (total_objects) 0)
1225                                       (with_object (get_object 0)
1226                                                    (or (eq (otype) FLYER)
1227                                                        (eq (otype) GREEN_FLYER))
1228                                                        ))))
1229      nil
1230    (if (eq (state) stopped) nil
1231      (progn
1232        (setq smoke_time 30)
1233        (set_yvel (- (yvel) 1))
1234        (set_state flinch_up)
1235        (damage_fun amount from hitx hity push_xvel push_yvel)
1236        (if (and(< (hp) 300)(>(hp) 250))
1237              (set_aitype 1)
1238      )
1239        (if (and(< (hp) 250)(>(hp) 200))
1240              (set_aitype 9)
1241      )
1242        (if (and(< (hp) 200)(>(hp) 150))
1243              (set_aitype 4)
1244      )
1245        (if (and(< (hp) 150) (>(hp)100))
1246              (set_aitype 3)
1247      )
1248        (if (and(< (hp) 100) (>(hp)50))
1249              (set_aitype 2)
1250      )
1251        (if (and(< (hp) 50)(>(hp)0))
1252              (set_aitype 5)
1253      )
1254))))
1255
1256(defun antship_cons ()
1257  (setq fire_delay 30)
1258  (setq burst_delay 8)
1259  (setq max_xvel 2)
1260  (setq max_yvel 1)
1261  (set_aitype 0)
1262  (setq burst_total 3))
1263
1264
1265(def_char ANT_SHIP  ;; original art by Steven Chan, schan@eecs.berkeley.edu
1266
1267
1268  (funs (ai_fun antship_ai)
1269          (constructor antship_cons)
1270          (get_cache_list_fun explo_damage_cache)
1271        (damage_fun antship_damage)
1272  );; end funs
1273
1274  (abilities (start_hp 300)
1275  );; end abilities
1276
1277  (flags (hurtable T)
1278         (can_block T)
1279         (unactive_shield T)
1280  );; end flags
1281
1282  (range 400 200)
1283
1284  (vars fire_delay
1285        burst_delay
1286        burst_total
1287        burst_wait
1288        burst_left
1289          max_xvel
1290        max_yvel
1291        smoke_time
1292        fire_time
1293   );; end vars
1294
1295  (states "addon/claudio/antship.spe"
1296          (stopped "s0001.pcx")
1297          (running (seq "s" 2 6))
1298        (flinch_up (seq "s" 1 6))
1299        (dieing  (seq "s" 7 12))
1300  );; end states
1301
1302);; end def_char
1303
1304
1305;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1306;;                                                                                       ;;
1307;; CHAR 33: Death Skull                                                                  ;;
1308;;                                                                                       ;;
1309;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1310
1311(defun dskull_ai ()
1312  (if (not (eq smoke_time 0))
1313      (progn
1314        (setq smoke_time (- smoke_time 1))
1315        (if (eq (mod smoke_time 2) 0)
1316         (add_object EXPLODE1 (+ (x) (random 10)) (+ (+ (random 10) (y)) -20)     0)
1317      )
1318       )
1319 )
1320
1321  (if (eq (aistate) 0)
1322      (if (or (eq (total_objects) 0) (not (eq (with_object (get_object 0) (aistate)) 0)))
1323          (if (next_picture) T
1324            (progn
1325              (set_targetable T)
1326              (set_state running)
1327              (set_aistate 1)))
1328        (progn
1329          (set_targetable nil)
1330          (set_state stopped)
1331          T))
1332    (if (eq (hp) 0)
1333        (progn
1334        (play_sound GRENADE_SND 127 (x) (y))
1335          (add_object EXPLODE1 (+ (x) (random 10)) (+ (+ (random 10) (y)) -20)     0)
1336          (add_object EXPLODE1 (- (x) (random 10)) (+ (- (y) (random 10)) -20)     2)
1337          (add_object EXPLODE1 (x) (+ (- (y) (random 20)) -20)                     4)
1338          nil)
1339      (progn
1340        (if (eq (mod (state_time) 10) 0)
1341            (play_sound SKULL_SND 127 (x) (y)))
1342        (if (> (with_object (bg) (x)) (x))
1343            (progn
1344              (set_xvel (+ (xvel) 1))
1345              (if (> (xvel) max_xvel) (set_xvel max_xvel))
1346              (if (eq (direction) -1)
1347                  (progn
1348                    (set_direction 1)
1349                    (set_state turn_around))))
1350          (if (< (with_object (bg) (x)) (x))
1351              (progn
1352                (set_xvel (- (xvel) 1))
1353                (if (< (xvel) (- 0 max_xvel)) (set_xvel (- 0 max_xvel)))
1354                (if (eq (direction) 1)
1355                    (progn
1356                      (set_direction -1)
1357                      (set_state turn_around))))))
1358        (if (> (with_object (bg) (- (y) 70)) (y))
1359            (if (> (yvel) max_yvel)
1360                (set_yvel (- (yvel) 1))
1361              (set_yvel (+ (yvel) 1)))
1362
1363          (if (< (with_object (bg) (- (y) 50)) (y))
1364              (if (< (yvel) (- 0 max_yvel))
1365                  (set_yvel (+ (yvel) 1))
1366                (set_yvel (- (yvel) 1)))))
1367
1368        (if (eq (random 5) 0)
1369            (set_xvel (+ (xvel) 1))
1370          (if (eq (random 5) 0)
1371              (set_xvel (- (xvel) 1))))
1372        (if (eq (random 5) 0)
1373            (set_yvel (+ (yvel) 1))
1374          (if (eq (random 5) 0)
1375              (set_yvel (- (yvel) 1))))
1376
1377        (if (next_picture) T (set_state running))
1378
1379        (bounce_move '(set_xvel (/ (xvel) 2)) '(set_xvel (/ (xvel) 2))
1380                     '(set_yvel (/ (yvel) 2)) '(set_yvel (/ (yvel) 2)) nil)
1381
1382        (if (> fire_time 0)
1383            (progn
1384              (setq fire_time (- fire_time 1))
1385              (if (eq fire_time 0)
1386                  (progn
1387                    (setq burst_left burst_total)
1388                    (setq burst_wait 0))))
1389          (if (eq burst_wait 0)
1390              (if (and (< (distx) 150) (eq (direction) (facing)))
1391                  (let ((firex (+ (x) (* (direction) 10)) )
1392                        (firey (y))
1393                        (playerx (+ (with_object (bg) (x)) (with_object (bg) (* (xvel) 4))))
1394                        (playery (+ (- (with_object (bg) (y)) 15) (with_object (bg) (* (yvel) 2)))))
1395                    (if (and (can_see (x) (y) firex firey nil) (can_see firex firey playerx playery nil))
1396                        (progn
1397                          (let ((angle (atan2 (- firey playery)
1398                                              (- playerx firex))))
1399                            (if (or (eq burst_left 1) (eq burst_left 0))
1400                                (setq fire_time fire_delay)
1401                              (setq burst_left (- burst_left 1)))
1402                            (setq burst_wait burst_delay)
1403                            (fire_object (me) (aitype) firex firey angle (bg))
1404                            )))))
1405            (setq burst_wait (- burst_wait 1))))
1406        T))))
1407
1408
1409(defun dskull_damage (amount from hitx hity push_xvel push_yvel)
1410  (if (and from (with_object from (and (> (total_objects) 0)
1411                                       (with_object (get_object 0)
1412                                                    (or (eq (otype) FLYER)
1413                                                        (eq (otype) GREEN_FLYER))
1414                                                        ))))
1415      nil
1416    (if (eq (state) stopped) nil
1417      (progn
1418        (setq smoke_time 30)
1419        (set_yvel (- (yvel) 14))
1420        (set_state flinch_up)
1421        (damage_fun amount from hitx hity push_xvel push_yvel)
1422        (if (and(< (hp) 100)(>(hp) 50))
1423              (set_aitype 9)
1424      )
1425        (if (and(< (hp) 50)(>(hp)0))
1426              (set_aitype 5)
1427      )
1428
1429))))
1430
1431(defun dskull_cons ()
1432  (setq fire_delay 20)
1433  (setq burst_delay 5)
1434  (setq max_xvel 2)
1435  (setq max_yvel 1)
1436  (set_aitype 9)
1437  (setq burst_total 2))
1438
1439
1440(def_char DEATH_SKULL
1441  (funs (ai_fun dskull_ai)
1442          (constructor dskull_cons)
1443          (get_cache_list_fun explo_damage_cache)
1444        (damage_fun dskull_damage)
1445  );; end funs
1446
1447  (abilities (start_hp 100)
1448  );; end abilities
1449
1450  (flags (hurtable T)
1451         (can_block T)
1452         (unactive_shield T)
1453  );; end flags
1454
1455  (range 300 100)
1456
1457  (vars fire_delay
1458        burst_delay
1459        burst_total
1460        burst_wait
1461        burst_left
1462          max_xvel
1463        max_yvel
1464        smoke_time
1465        fire_time
1466   );; end vars
1467
1468  (states "addon/claudio/skull.spe"
1469          (stopped "s0001.pcx")
1470          (running '("s0001.pcx" "s0001.pcx" "s0001.pcx" "s0001.pcx" "s0001.pcx" "s0001.pcx" "s0001.pcx" "s0001.pcx"
1471                   "s0002.pcx" "s0002.pcx" "s0002.pcx" "s0002.pcx" "s0002.pcx" "s0002.pcx" "s0002.pcx" "s0002.pcx"
1472                   "s0001.pcx" "s0001.pcx" "s0001.pcx" "s0001.pcx" "s0001.pcx" "s0001.pcx" "s0001.pcx" "s0001.pcx"
1473                   "s0024.pcx" "s0024.pcx" "s0024.pcx" "s0024.pcx" "s0024.pcx" "s0024.pcx" "s0024.pcx" "s0024.pcx"))
1474        (flinch_up  (seq "s" 2 18))
1475        (turn_around (seq "s" 1 24))
1476
1477  );; end states
1478
1479);; end def_char
1480
1481(def_explo 'EXPLODE0 "addon/claudio/bigexp.spe" "fire"           7)
1482
1483
1484;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1485;;                                                                                       ;;
1486;; TILES   (foreground and background tiles)                                             ;;
1487;;                                                                                       ;;
1488;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1489
1490(load_tiles
1491          "addon/claudio/pal81f.spe"    ;; space foretiles 1, numbered from 2200,  palette space1
1492            "addon/claudio/pal82f.spe"    ;; space foretiles 2, numbered from 2250,  palette space2
1493            ;; "addon/claudio/pal83.spe" ;; space foretiles 3, numbered from 8300,  palette space3
1494            "addon/claudio/pal90.spe"    ;; stars backtiles 1, numbered from 475,
1495            "addon/claudio/pal2.spe"     ;; sewers backtiles,  numbered from 380,
1496            "addon/claudio/pal21.spe"    ;; stars backtiles 2, numbered from 500,
1497            "addon/claudio/pal5.spe"     ;; corallo backtiles, numbered from 430,
1498            ;; "addon/claudio/extiles.spe"  ;; extra foretiles,   numbered from 10000, palette extra1
1499)
1500
1501;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1502;;                                                                                       ;;
1503;; Characters and Tiles by other people                                                  ;;
1504;;                                                                                       ;;
1505;; WARNING: this section assumes that you have the following files:                      ;;
1506;; - aliens.spe,                                                                         ;;
1507;; - albtiles.spe,                                                                       ;;
1508;; - alftiles.spe by Mike Moss to be put in the folder Abuse\addon\mike                  ;;
1509;; - craig.spe  by Craig to be put in the folder Abuse\addon\craig                       ;;
1510;; - justin.spe by Justin Cassidy to be put in the folder Abuse\addon\justin             ;;
1511;;                                                                                       ;;
1512;; Contact these authors if you want to get more infor about their work.                 ;;
1513;; Otherwise, deactivate                                                                 ;;
1514;; the following section as indicated below in order to use the characters               ;;
1515;; and tiles by Claudio Bolzoni only.                                                    ;;
1516;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1517
1518
1519;;  /*THIS IS LINE "A": DELETE THE ";;" AT THE BEGINNING OF THIS LINE AND OF LINE "B" BELOW TO DEACTIVATE THE FOLLOWING SECTION
1520
1521;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1522
1523;;  */THIS IS LINE "B": DELETE THE ";;" AT THE BEGINNING OF THIS LINE AND OF LINE "A" ABOVE TO DEACTIVATE THIS SECTION
1524
1525
1526;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1527
Note: See TracBrowser for help on using the repository browser.