wrath.qc 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363
  1. /* Copyright (C) 1996-2022 id Software LLC
  2. This program is free software; you can redistribute it and/or modify
  3. it under the terms of the GNU General Public License as published by
  4. the Free Software Foundation; either version 2 of the License, or
  5. (at your option) any later version.
  6. This program is distributed in the hope that it will be useful,
  7. but WITHOUT ANY WARRANTY; without even the implied warranty of
  8. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  9. GNU General Public License for more details.
  10. You should have received a copy of the GNU General Public License
  11. along with this program; if not, write to the Free Software
  12. Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  13. See file, 'COPYING', for details.
  14. */
  15. // wrath.qc
  16. $skin wrthskin
  17. $frame wrthfrme
  18. $frame wrthwk01 wrthwk02 wrthwk03 wrthwk04 wrthwk05 wrthwk06
  19. $frame wrthwk07 wrthwk08 wrthwk09 wrthwk10 wrthwk11 wrthwk12
  20. $frame wrthaa01 wrthaa02 wrthaa03 wrthaa04 wrthaa05 wrthaa06 wrthaa07
  21. $frame wrthaa08 wrthaa09 wrthaa10 wrthaa11 wrthaa12 wrthaa13 wrthaa14
  22. $frame wrthab01 wrthab02 wrthab03 wrthab04 wrthab05 wrthab06 wrthab07
  23. $frame wrthab08 wrthab09 wrthab10 wrthab11 wrthab12 wrthab13
  24. $frame wrthac01 wrthac02 wrthac03 wrthac04 wrthac05
  25. $frame wrthac06 wrthac07 wrthac08 wrthac09 wrthac10
  26. $frame wrthac11 wrthac12 wrthac13 wrthac14 wrthac15
  27. $frame wrthpa01 wrthpa02 wrthpa03 wrthpa04 wrthpa05 wrthpa06
  28. $frame wrthpb01 wrthpb02 wrthpb03 wrthpb04 wrthpb05 wrthpb06
  29. $frame wrthpb07 wrthpb08 wrthpb09 wrthpb10 wrthpb11
  30. $frame wrthdt01 wrthdt02 wrthdt03 wrthdt04 wrthdt05
  31. $frame wrthdt06 wrthdt07 wrthdt08 wrthdt09 wrthdt10
  32. $frame wrthdt11 wrthdt12 wrthdt13 wrthdt14 wrthdt15
  33. void() WrathMissileTouch;
  34. void() WrathHome;
  35. void(float AttackNumber) WrathMissile;
  36. void() wrath_stand1 =[ $wrthwk01, wrath_stand1 ] { ai_stand();};
  37. void() wrath_walk01 =[ $wrthwk01, wrath_walk02 ] { ai_walk(8); };
  38. void() wrath_walk02 =[ $wrthwk02, wrath_walk03 ] { ai_walk(8); };
  39. void() wrath_walk03 =[ $wrthwk03, wrath_walk04 ] { ai_walk(8); };
  40. void() wrath_walk04 =[ $wrthwk04, wrath_walk05 ] { ai_walk(8); };
  41. void() wrath_walk05 =[ $wrthwk05, wrath_walk06 ] { ai_walk(8); };
  42. void() wrath_walk06 =[ $wrthwk06, wrath_walk07 ] { ai_walk(8); };
  43. void() wrath_walk07 =[ $wrthwk07, wrath_walk08 ] { ai_walk(8); };
  44. void() wrath_walk08 =[ $wrthwk08, wrath_walk09 ] { ai_walk(8); };
  45. void() wrath_walk09 =[ $wrthwk09, wrath_walk10 ] { ai_walk(8); };
  46. void() wrath_walk10 =[ $wrthwk10, wrath_walk11 ] { ai_walk(8); };
  47. void() wrath_walk11 =[ $wrthwk11, wrath_walk12 ] { ai_walk(8); };
  48. void() wrath_walk12 =[ $wrthwk12, wrath_walk01 ] { ai_walk(8); };
  49. void() wrath_run01 =[ $wrthwk01, wrath_run02 ] { ai_run(12); };
  50. void() wrath_run02 =[ $wrthwk02, wrath_run03 ] { ai_run(12); };
  51. void() wrath_run03 =[ $wrthwk03, wrath_run04 ] { ai_run(12); };
  52. void() wrath_run04 =[ $wrthwk04, wrath_run05 ] { ai_run(12); };
  53. void() wrath_run05 =[ $wrthwk05, wrath_run06 ] { ai_run(12); };
  54. void() wrath_run06 =[ $wrthwk06, wrath_run07 ] { ai_run(12); };
  55. void() wrath_run07 =[ $wrthwk07, wrath_run08 ] { ai_run(12); };
  56. void() wrath_run08 =[ $wrthwk08, wrath_run09 ] { ai_run(12); };
  57. void() wrath_run09 =[ $wrthwk09, wrath_run10 ] { ai_run(12); };
  58. void() wrath_run10 =[ $wrthwk10, wrath_run11 ] { ai_run(12); };
  59. void() wrath_run11 =[ $wrthwk11, wrath_run12 ] { ai_run(12); };
  60. void() wrath_run12 =[ $wrthwk12, wrath_run01 ] { ai_run(12); };
  61. void() wrath_at_a01 =[ $wrthaa01, wrath_at_a02 ] {ai_charge(12);};
  62. void() wrath_at_a02 =[ $wrthaa02, wrath_at_a03 ] {ai_charge(12);};
  63. void() wrath_at_a03 =[ $wrthaa03, wrath_at_a04 ] {ai_charge(12);};
  64. void() wrath_at_a04 =[ $wrthaa04, wrath_at_a05 ] {ai_charge(12);};
  65. void() wrath_at_a05 =[ $wrthaa05, wrath_at_a06 ] {ai_charge(12);};
  66. void() wrath_at_a06 =[ $wrthaa06, wrath_at_a07 ] {ai_charge(12);};
  67. void() wrath_at_a07 =[ $wrthaa07, wrath_at_a08 ] {ai_charge(12);};
  68. void() wrath_at_a08 =[ $wrthaa08, wrath_at_a09 ] {ai_charge(12);};
  69. void() wrath_at_a09 =[ $wrthaa09, wrath_at_a10 ] {ai_charge(12);};
  70. void() wrath_at_a10 =[ $wrthaa10, wrath_at_a11 ] {ai_charge(12);};
  71. void() wrath_at_a11 =[ $wrthaa11, wrath_at_a12 ] {WrathMissile(1);};
  72. void() wrath_at_a12 =[ $wrthaa12, wrath_at_a13 ] {ai_charge(12);};
  73. void() wrath_at_a13 =[ $wrthaa13, wrath_at_a14 ] {ai_charge(12);};
  74. void() wrath_at_a14 =[ $wrthaa14, wrath_run01 ] {ai_charge(12);};
  75. void() wrath_at_b01 =[ $wrthab01, wrath_at_b02 ] {ai_charge(12);};
  76. void() wrath_at_b02 =[ $wrthab02, wrath_at_b03 ] {ai_charge(12);};
  77. void() wrath_at_b03 =[ $wrthab03, wrath_at_b04 ] {ai_charge(12);};
  78. void() wrath_at_b04 =[ $wrthab04, wrath_at_b05 ] {ai_charge(12);};
  79. void() wrath_at_b05 =[ $wrthab05, wrath_at_b06 ] {ai_charge(12);};
  80. void() wrath_at_b06 =[ $wrthab06, wrath_at_b07 ] {WrathMissile(2);};
  81. void() wrath_at_b07 =[ $wrthab07, wrath_at_b08 ] {ai_charge(12);};
  82. void() wrath_at_b08 =[ $wrthab08, wrath_at_b09 ] {ai_charge(12);};
  83. void() wrath_at_b09 =[ $wrthab09, wrath_at_b10 ] {ai_charge(12);};
  84. void() wrath_at_b10 =[ $wrthab10, wrath_at_b11 ] {ai_charge(12);};
  85. void() wrath_at_b11 =[ $wrthab11, wrath_at_b12 ] {ai_charge(12);};
  86. void() wrath_at_b12 =[ $wrthab12, wrath_at_b13 ] {ai_charge(12);};
  87. void() wrath_at_b13 =[ $wrthab13, wrath_run01 ] {ai_charge(12);};
  88. void() wrath_at_c01 =[ $wrthac01, wrath_at_c02 ] {ai_charge(12);};
  89. void() wrath_at_c02 =[ $wrthac02, wrath_at_c03 ] {ai_charge(12);};
  90. void() wrath_at_c03 =[ $wrthac03, wrath_at_c04 ] {ai_charge(12);};
  91. void() wrath_at_c04 =[ $wrthac04, wrath_at_c05 ] {ai_charge(12);};
  92. void() wrath_at_c05 =[ $wrthac05, wrath_at_c06 ] {ai_charge(12);};
  93. void() wrath_at_c06 =[ $wrthac06, wrath_at_c07 ] {ai_charge(12);};
  94. void() wrath_at_c07 =[ $wrthac07, wrath_at_c08 ] {WrathMissile(3);};
  95. void() wrath_at_c08 =[ $wrthac08, wrath_at_c09 ] {ai_charge(12);};
  96. void() wrath_at_c09 =[ $wrthac09, wrath_at_c10 ] {ai_charge(12);};
  97. void() wrath_at_c10 =[ $wrthac10, wrath_at_c11 ] {ai_charge(12);};
  98. void() wrath_at_c11 =[ $wrthac11, wrath_at_c12 ] {ai_charge(12);};
  99. void() wrath_at_c12 =[ $wrthac12, wrath_at_c13 ] {ai_charge(12);};
  100. void() wrath_at_c13 =[ $wrthac13, wrath_at_c14 ] {ai_charge(12);};
  101. void() wrath_at_c14 =[ $wrthac14, wrath_at_c15 ] {ai_charge(12);};
  102. void() wrath_at_c15 =[ $wrthac15, wrath_run01 ] {ai_charge(12);};
  103. void() wrath_attack =
  104. {
  105. local float r;
  106. r = random();
  107. if (r < 0.25)
  108. {
  109. wrath_at_a01 ();
  110. }
  111. else if (r < 0.65)
  112. {
  113. wrath_at_b01 ();
  114. }
  115. else
  116. {
  117. wrath_at_c01 ();
  118. }
  119. sound (self, CHAN_VOICE, "wrath/watt.wav", 1, ATTN_NORM);
  120. };
  121. void() wrath_pn_a01 =[ $wrthpa01, wrath_pn_a02 ] {};
  122. void() wrath_pn_a02 =[ $wrthpa02, wrath_pn_a03 ] {};
  123. void() wrath_pn_a03 =[ $wrthpa03, wrath_pn_a04 ] {};
  124. void() wrath_pn_a04 =[ $wrthpa04, wrath_pn_a05 ] {};
  125. void() wrath_pn_a05 =[ $wrthpa05, wrath_pn_a06 ] {};
  126. void() wrath_pn_a06 =[ $wrthpa06, wrath_run01 ] {};
  127. void() wrath_pn_b01 =[ $wrthpb01, wrath_pn_b02 ] {};
  128. void() wrath_pn_b02 =[ $wrthpb02, wrath_pn_b03 ] {};
  129. void() wrath_pn_b03 =[ $wrthpb03, wrath_pn_b04 ] {};
  130. void() wrath_pn_b04 =[ $wrthpb04, wrath_pn_b05 ] {};
  131. void() wrath_pn_b05 =[ $wrthpb05, wrath_pn_b06 ] {};
  132. void() wrath_pn_b06 =[ $wrthpb06, wrath_pn_b07 ] {};
  133. void() wrath_pn_b07 =[ $wrthpb07, wrath_pn_b08 ] {};
  134. void() wrath_pn_b08 =[ $wrthpb08, wrath_pn_b09 ] {};
  135. void() wrath_pn_b09 =[ $wrthpb09, wrath_pn_b10 ] {};
  136. void() wrath_pn_b10 =[ $wrthpb10, wrath_pn_b11 ] {};
  137. void() wrath_pn_b11 =[ $wrthpb11, wrath_run01 ] {};
  138. void() wrath_pain =
  139. {
  140. local float r;
  141. if (self.pain_finished > time)
  142. return;
  143. r = random();
  144. if (r > 0.1)
  145. {
  146. self.pain_finished = time + 0.5;
  147. return;
  148. }
  149. if (r < 0.07)
  150. wrath_pn_a01 ();
  151. else
  152. wrath_pn_b01 ();
  153. self.pain_finished = time + 3;
  154. sound (self, CHAN_VOICE, "wrath/wpain.wav", 1, ATTN_NORM);
  155. };
  156. void() wrath_die02 =[ $wrthdt02, wrath_die03 ]
  157. { sound (self, CHAN_VOICE, "wrath/wdthc.wav", 1, ATTN_NORM); };
  158. void() wrath_die03 =[ $wrthdt03, wrath_die04 ] {};
  159. void() wrath_die04 =[ $wrthdt04, wrath_die05 ] {};
  160. void() wrath_die05 =[ $wrthdt05, wrath_die07 ] {};
  161. void() wrath_die07 =[ $wrthdt07, wrath_die09 ] {};
  162. void() wrath_die09 =[ $wrthdt09, wrath_die11 ] {};
  163. void() wrath_die11 =[ $wrthdt11, wrath_die13 ] {};
  164. void() wrath_die13 =[ $wrthdt13, wrath_die15 ] {};
  165. void() wrath_die15 =[ $wrthdt15, wrath_die15 ]
  166. {
  167. ThrowGib ("progs/wrthgib1.mdl", self.health);
  168. ThrowGib ("progs/wrthgib2.mdl", self.health);
  169. ThrowGib ("progs/wrthgib3.mdl", self.health);
  170. T_RadiusDamage (self, self, 80, world);
  171. self.origin = self.origin + '0 0 24';
  172. WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
  173. WriteByte (MSG_BROADCAST, TE_EXPLOSION2);
  174. WriteCoord (MSG_BROADCAST, self.origin_x);
  175. WriteCoord (MSG_BROADCAST, self.origin_y);
  176. WriteCoord (MSG_BROADCAST, self.origin_z);
  177. WriteByte (MSG_BROADCAST, 0);
  178. WriteByte (MSG_BROADCAST, 4);
  179. remove (self);
  180. };
  181. /*QUAKED monster_wrath (1 0 0) (-16 -16 -24) (16 16 32) Ambush
  182. */
  183. void() monster_wrath =
  184. {
  185. if (deathmatch)
  186. {
  187. remove(self);
  188. return;
  189. }
  190. precache_model ("progs/wrath.mdl");
  191. precache_model ("progs/w_ball.mdl");
  192. precache_model ("progs/wrthgib1.mdl");
  193. precache_model ("progs/wrthgib2.mdl");
  194. precache_model ("progs/wrthgib3.mdl");
  195. precache_sound ("wrath/wsee.wav");
  196. precache_sound ("wrath/watt.wav");
  197. precache_sound ("wrath/wpain.wav");
  198. precache_sound ("wrath/wdthc.wav");
  199. self.solid = SOLID_SLIDEBOX;
  200. self.movetype = MOVETYPE_STEP;
  201. setmodel (self, "progs/wrath.mdl");
  202. setsize (self, VEC_HULL_MIN, VEC_HULL_MAX);
  203. self.health = 400;
  204. self.yaw_speed = 35;
  205. self.th_stand = wrath_stand1;
  206. self.th_walk = wrath_walk01;
  207. self.th_run = wrath_run01;
  208. self.th_missile = wrath_attack;
  209. self.th_pain = wrath_pain;
  210. self.th_die = wrath_die02;
  211. flymonster_start ();
  212. };
  213. /*
  214. ================
  215. WrathMissile
  216. ================
  217. */
  218. void(float AttackNumber) WrathMissile =
  219. {
  220. local entity missile;
  221. local vector dir, org;
  222. local float dist, flytime;
  223. dir = normalize((self.enemy.origin + '0 0 10') - self.origin);
  224. dist = vlen (self.enemy.origin - self.origin);
  225. flytime = dist * 0.002;
  226. if (flytime < 0.1)
  227. flytime = 0.1;
  228. self.effects = self.effects | EF_MUZZLEFLASH;
  229. makevectors (self.angles);
  230. missile = spawn ();
  231. missile.owner = self;
  232. missile.solid = SOLID_BBOX;
  233. missile.movetype = MOVETYPE_FLYMISSILE;
  234. setmodel (missile, "progs/w_ball.mdl");
  235. setsize (missile, '0 0 0', '0 0 0');
  236. if ( AttackNumber == 1)
  237. {
  238. org = self.origin + v_forward*20 + v_up*12; // 20 // 44;
  239. }
  240. else if ( AttackNumber == 2)
  241. {
  242. org = self.origin + v_forward*18 + v_up*10; // 18 // 42;
  243. }
  244. else if ( AttackNumber == 3)
  245. {
  246. org = self.origin + v_forward*12 + v_up*12 + v_right*20;
  247. // up20
  248. }
  249. else if ( AttackNumber == 4)
  250. {
  251. org = self.origin + v_forward*20 + v_up*16;
  252. }
  253. setorigin ( missile, org );
  254. missile.velocity = dir * 400;
  255. missile.avelocity = '300 300 300';
  256. missile.enemy = self.enemy;
  257. missile.touch = WrathMissileTouch;
  258. missile.nextthink = time + 0.1;
  259. missile.think = WrathHome;
  260. self.attack_finished = time + 2;
  261. };
  262. void() WrathHome =
  263. {
  264. if (self.enemy.health < 1)
  265. {
  266. remove(self);
  267. return;
  268. }
  269. if (skill == 3)
  270. ai_track (self.enemy, 550);
  271. else
  272. ai_track (self.enemy, 400);
  273. self.nextthink = time + 0.1;
  274. self.think = WrathHome;
  275. };
  276. void() WrathMissileTouch =
  277. {
  278. if (other == self.owner ||
  279. other.classname == "monster_wrath" ||
  280. other.classname == "monster_super_wrath")
  281. {
  282. remove(self);
  283. return; // don't explode on any wraths
  284. }
  285. if (other.classname == "monster_zombie")
  286. T_Damage (other, self, self, 110);
  287. T_RadiusDamage (self, self.owner, 20, world);
  288. sound (self, CHAN_WEAPON, "weapons/r_exp3.wav", 1, ATTN_NORM);
  289. WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
  290. WriteByte (MSG_BROADCAST, TE_EXPLOSION);
  291. WriteCoord (MSG_BROADCAST, self.origin_x);
  292. WriteCoord (MSG_BROADCAST, self.origin_y);
  293. WriteCoord (MSG_BROADCAST, self.origin_z);
  294. self.velocity = '0 0 0';
  295. self.touch = SUB_Null;
  296. setmodel (self, "progs/s_explod.spr");
  297. self.solid = SOLID_NOT;
  298. s_explode1 ();
  299. };