This repository has been archived by the owner on Jan 23, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
bb_Boss_Nemesis.sma
504 lines (419 loc) · 14.2 KB
/
bb_Boss_Nemesis.sma
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
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <engine>
#include <fun>
#include <basebuilder>
#include <fakemeta>
#include <eG>
#include <hamsandwich>
#include <xs>
#include <dhudmessage>
#define BOSS_ALARM "basebuilder/FAITH/Boss_Alarm.wav" // Alarm Sound
native zp_override_user_model(id, const newmodel[], modelindex = 0)
#define TASK_BOSS_SKILL_COUNTDOWN 100
#define TASK_OFF_SKILL 100
new bool:g_bIsBoss[33]
new bool:g_bBossNoDmg = false
new g_iBossPhase
new g_iBossCountdown[33]
new g_msgScreenShake
new g_spriteSmoke, beam, boom
public plugin_init()
{
g_msgScreenShake = get_user_msgid("ScreenShake")
}
public client_connected(id)
{
g_bIsBoss[id] = false
g_iBossCountdown[id] = 0
g_iBossPhase = 0
}
public plugin_precache()
{
// -- N-1
precache_model("models/stinger/stinger_rocket_frk14.mdl")
precache_model("models/player/RE_Nemesis_frk/RE_Nemesis_frk.mdl")
precache_model("models/player/RE_Nemesis_frk/RE_Nemesis_frkT.mdl")
precache_model("models/stinger/p_stinger_frk14.mdl")
precache_model("models/v_bazooka_nem.mdl")
beam = precache_model("sprites/smoke.spr")
boom = precache_model("sprites/zerogxplode55.spr")
g_spriteSmoke = precache_model("sprites/wall_puff4.spr")
precache_sound("basebuilder/FAITH/nemesis/rpg7_shoot.wav")
// -- N-2
precache_model("models/player/Nemesis_2nd_frk14/Nemesis_2nd_frk14.mdl")
precache_model("models/player/Nemesis_2nd_frk14/Nemesis_2nd_frk14T.mdl")
precache_model("models/v_clow_nem.mdl")
precache_sound("basebuilder/FAITH/nemesis/nemesisgodmode.wav")
register_plugin("[BB] Boss: Nemesis", "1.2", "EmeraldGhost")
register_forward(FM_CmdStart, "fw_CmdStart")
RegisterHam(Ham_Spawn, "player", "fwHam_spawn", 1)
register_clcmd("so9sadbbneme", "Become_Boss")
//register_clcmd("eg_testboss", "Become_Boss")
}
public plugin_natives()
{
register_native("bb_nemesis_me", "Native_Become_Nemesis", 1)
register_native("bb_nemesis_phase2", "Native_Nemesis_Evolution", 1)
}
public Native_Become_Nemesis(id) Become_Boss(id)
public Native_Nemesis_Evolution(id) Nemesis_Phase2(id)
public Become_Boss(id)
{
new players_ct[32], ict
get_players(players_ct,ict,"ae","CT")
g_bIsBoss[id] = true
g_iBossPhase = 1
g_iBossCountdown[id] = 222
set_task(0.5, "boss_skill_reload", id + TASK_BOSS_SKILL_COUNTDOWN, _, _, "b")
set_pev(id, pev_viewmodel2, "models/v_bazooka_nem.mdl")
set_pev(id, pev_weaponmodel2, "models/stinger/p_stinger_frk14.mdl")
zp_override_user_model(id, "RE_Nemesis_frk")
set_user_health(id, ict * 1350 + 520)
set_user_maxspeed(id, 275.0)
set_user_gravity(id, 0.75)
new wjsl = get_playersnum(0)
if(wjsl < 8) client_printc(0, "\y[\g基地建设\y] 由于在线玩家数量小于 8 人, Nemesis 伤害自动削弱 .");
}
public Nemesis_Phase2(id)
{
if(g_iBossPhase != 1 || !g_bIsBoss[id])
return PLUGIN_HANDLED
client_cmd(0, "spk %s", BOSS_ALARM)
set_dhudmessage(200, 0, 0, -1.0, 0.35, 0, 0.0, 3.0, 2.0, 1.0, false)
show_dhudmessage(0, "Nemesis 进化至 Phase 2")
new players_ct[32], ict
get_players(players_ct,ict,"ae","CT")
g_iBossPhase = 2
set_pev(id, pev_viewmodel2, "models/v_clow_nem.mdl")
set_pev(id, pev_weaponmodel2, "")
zp_override_user_model(id, "Nemesis_2nd_frk14")
set_user_health(id, ict * 4790 + 4250)
set_user_maxspeed(id, 285.0)
set_user_gravity(id, 0.8)
g_iBossCountdown[id] = 888
g_bBossNoDmg = true
client_cmd(0, "spk basebuilder/FAITH/nemesis/nemesisgodmode.wav")
//emit_sound(id, CHAN_STATIC, "basebuilder/FAITH/nemesis/nemesisgodmode.wav", VOL_NORM, ATTN_NORM, SND_STOP, PITCH_NORM)
set_user_godmode(id, 1)
set_user_rendering(id, kRenderFxGlowShell, 0, 255, 255, kRenderNormal, 3)
set_task(3.0, "Skill_Godmode_Off", id + TASK_OFF_SKILL)
}
public fwHam_spawn(id)
{
remove_task(id + TASK_BOSS_SKILL_COUNTDOWN)
g_iBossCountdown[id] = 0
if(g_bIsBoss[id])
{
g_bBossNoDmg = false
g_bIsBoss[id] = false
set_user_rendering(id, kRenderFxGlowShell, 0, 0, 0, kRenderNormal, 0)
set_pev(id, pev_weaponmodel2, "")
}
}
public boss_skill_reload(taskid)
{
new id = taskid - TASK_BOSS_SKILL_COUNTDOWN
if(is_user_alive(id) && is_user_connected(id))
{
if(g_iBossCountdown[id] >= 888)
{
g_iBossCountdown[id] = 888
if(g_iBossPhase == 1)
client_print(id, print_center, "【 Reload 完成丨按 'R' 发射火箭】");
else if(g_iBossPhase == 2)
client_print(id, print_center, "【 Reload 完成丨按 'R' 使用无敌】");
}
else
{
if(g_iBossPhase == 1)
g_iBossCountdown[id] += 14;
else if(g_iBossPhase == 2)
g_iBossCountdown[id] += 26;
client_print(id, print_center, "【 Reload: %d / 888 】", g_iBossCountdown[id])
}
}
}
public Skill_Godmode(id)
{
g_bBossNoDmg = true
event_hud(0, 0, 255, 255, "Nemesis 发动技能【无敌】^n所有伤害免疫 5 秒")
client_cmd(0, "spk basebuilder/FAITH/nemesis/nemesisgodmode.wav")
//emit_sound(id, CHAN_STATIC, "basebuilder/FAITH/nemesis/nemesisgodmode.wav", VOL_NORM, ATTN_NORM, SND_STOP, PITCH_NORM)
set_user_godmode(id, 1)
set_user_rendering(id, kRenderFxGlowShell, 0, 255, 255, kRenderNormal, 3)
set_task(5.0, "Skill_Godmode_Off", id + TASK_OFF_SKILL)
}
public Skill_Godmode_Off(taskid)
{
new id = taskid - TASK_OFF_SKILL
if(is_user_alive(id) && is_user_connected(id))
{
g_bBossNoDmg = false
set_user_godmode(id)
set_user_rendering(id, kRenderFxGlowShell, 0, 0, 0, kRenderNormal, 0)
}
}
public fw_CmdStart(id, uc_handle, seed)
{
if (!is_user_alive(id))
return FMRES_IGNORED;
static button, oldbutton
button = get_uc(uc_handle, UC_Buttons)
oldbutton = pev(id, pev_oldbuttons)
if ((button & IN_RELOAD) && !(oldbutton & IN_RELOAD))
{
if(zp_get_user_zombie(id) && is_user_alive(id) && g_bIsBoss[id] && g_iBossCountdown[id] == 888)
{
if(g_iBossPhase == 1)
{
Create_Rocket(id)
g_iBossCountdown[id] = 0
}
else if(g_iBossPhase == 2)
{
if(!g_bBossNoDmg)
{
Skill_Godmode(id)
g_iBossCountdown[id] = 0
}
else client_print(id, print_center, "正在无敌状态, 无法使用无敌!")
}
}
}
return PLUGIN_HANDLED
}
public Create_Rocket(id)
{
new args[16]
new Float:Ori[3], Float:Vel[3], Float:vAngles[3]
new notFloat_vOrigin[3]
entity_get_vector(id, EV_VEC_origin, Ori)
entity_get_vector(id, EV_VEC_v_angle, vAngles)
notFloat_vOrigin[0] = floatround(Ori[0])
notFloat_vOrigin[1] = floatround(Ori[1])
notFloat_vOrigin[2] = floatround(Ori[2])
new NewEnt = create_entity("info_target")
entity_set_model(NewEnt, "models/stinger/stinger_rocket_frk14.mdl")
entity_set_string(NewEnt, EV_SZ_classname, "zm_rocket")
new Float:fl_vecminsx[3] = {-1.0, -1.0, -1.0}
new Float:fl_vecmaxsx[3] = {1.0, 1.0, 1.0}
entity_set_vector(NewEnt, EV_VEC_mins, fl_vecminsx)
entity_set_vector(NewEnt, EV_VEC_maxs, fl_vecmaxsx)
entity_set_edict(NewEnt, EV_ENT_owner, id)
entity_set_float(NewEnt, EV_FL_health, 10000.0)
entity_set_float(NewEnt, EV_FL_takedamage, 100.0)
entity_set_float(NewEnt, EV_FL_dmg_take, 100.0)
entity_set_origin(NewEnt, Ori)
entity_set_vector(NewEnt, EV_VEC_angles, vAngles)
entity_set_int(NewEnt, EV_INT_solid, SOLID_BBOX)
entity_set_int(NewEnt, EV_INT_movetype, MOVETYPE_FLY)
entity_set_size(NewEnt, Float:{-1.0,-1.0,-1.0}, Float:{1.0,1.0,1.0})
VelocityByAim(id, 800, Vel)
entity_set_vector(NewEnt, EV_VEC_velocity, Vel)
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(22)
write_short(NewEnt)
write_short(beam)
write_byte(60)
write_byte(12)
write_byte(220)
write_byte(20) // 0
write_byte(60) // 255
write_byte(255) // 255
message_end();
args[0] = id
args[1] = NewEnt
args[2] = 1000
args[8] = notFloat_vOrigin[0]
args[9] = notFloat_vOrigin[1]
args[10] = notFloat_vOrigin[2]
emit_sound(id, CHAN_STATIC, "basebuilder/FAITH/nemesis/rpg7_shoot.wav", VOL_NORM, ATTN_NORM, SND_STOP, PITCH_NORM)
set_task(0.1, "qigong", 2004+NewEnt, args, 16)
return PLUGIN_HANDLED_MAIN
}
public vexd_pfntouch(pToucher, pTouched)
{
if( !is_valid_ent(pToucher) ) return
new sz[33]
entity_get_string(pToucher, EV_SZ_classname, sz, 32)
if( equal(sz, "zm_rocket") )
{
remove_task(2004+pToucher)
new id
id = entity_get_edict(pToucher, EV_ENT_owner)
new Float:Ori[3], Iori[3]
entity_get_vector(pToucher, EV_VEC_origin, Ori)
FVecIVec(Ori, Iori)
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(3)
write_coord(Iori[0])
write_coord(Iori[1])
write_coord(Iori[2])
write_short(boom)
write_byte(20)
write_byte(10)
write_byte(0)
message_end();
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(3)
write_coord(Iori[0])
write_coord(Iori[1])
write_coord(Iori[2])
write_short(g_spriteSmoke)
write_byte(90)
write_byte(20)
write_byte(10)
message_end();
new wjsl = get_playersnum(0)
if(wjsl > 8) Missile_damage(pToucher, 52.0, 400.0)
else Missile_damage(pToucher, 43.0, 400.0)
remove_entity(pToucher)
}
}
public qigong(args[])
{
new aimvec[3], avgFactor
new Float:fl_origin[3]
new id = args[0]
new ent = args[1]
new speed = args[2]
get_user_origin(id, aimvec, 3)
entity_get_vector(ent, EV_VEC_origin, fl_origin)
new origin[3]
origin[0] = floatround(fl_origin[0])
origin[1] = floatround(fl_origin[1])
origin[2] = floatround(fl_origin[2])
if(speed < 320)
avgFactor = 10
else if(speed < 680)
avgFactor = 4
else
avgFactor = 2
new velocityvec[3], length
velocityvec[0]=aimvec[0]-origin[0]
velocityvec[1]=aimvec[1]-origin[1]
velocityvec[2]=aimvec[2]-origin[2]
length = sqroot(velocityvec[0]*velocityvec[0]+velocityvec[1]*velocityvec[1]+velocityvec[2]*velocityvec[2])
velocityvec[0]=velocityvec[0]*speed/length
velocityvec[1]=velocityvec[1]*speed/length
velocityvec[2]=velocityvec[2]*speed/length
args[8] = origin[0]
args[9] = origin[1]
args[10] = origin[2]
set_task(0.1, "qigong", 2004+ent, args, 16)
new Float:missile_health
missile_health = Float:entity_get_float(ent, EV_FL_health)
if(missile_health < 10000.0)
vexd_pfntouch(ent,0)
return PLUGIN_CONTINUE
}
public Missile_damage(inf, Float:dmg, Float:rad)
{
new players[32], pnum, Float:rng, Float:cd, Float:ori[3], owner, cdi, killdmg, hurtdmg, health, vec[3]
new sz[33]
new owname[33]
entity_get_string(inf, EV_SZ_classname, sz, 32)
new team2, team1, ff = get_cvar_num("mp_friendlyfire")
entity_get_vector(inf, EV_VEC_origin, ori)
FVecIVec(ori, vec)
owner = entity_get_edict(inf, EV_ENT_owner)
team1 = !zp_get_user_zombie(owner)
get_user_name(owner,owname,32)
get_players(players, pnum, "a")
for (new i=0; i < pnum; i++)
{
team2 = !zp_get_user_zombie(players[i])
// if( team2 == team1 && !ff ) continue
rng = Float:entity_range(inf, players[i])
if( rng > rad ) continue
rng = rad - rng
cd = dmg / ( rad * rad ) * ( rng * rng )
cdi = floatround(cd)
Create_ScreenShake(players[i], (1<<14), (1<<13), (1<<14))
health = get_user_health(players[i])
health -= cdi
if(!zp_get_user_zombie(players[i]))
{
if( health <= 0)
{
killdmg += get_user_health(players[i])
set_msg_block(get_user_msgid("DeathMsg"), BLOCK_ONCE)
set_msg_block(get_user_msgid("ScoreInfo"), BLOCK_ONCE)
user_kill(players[i], 1)
entity_set_int(players[i], EV_INT_iuser3, owner)
message_begin(MSG_ALL, get_user_msgid("DeathMsg"))
write_byte(owner)
write_byte(players[i])
write_byte(0)
write_string(sz)
message_end();
message_begin(MSG_ALL, get_user_msgid("ScoreInfo"))
write_byte(players[i])
write_short(get_user_frags(players[i]))
write_short(get_user_deaths(players[i]))
write_short(0)
write_short(get_user_team(players[i]))
message_end();
message_begin(MSG_ALL, get_user_msgid("ScoreInfo"))
write_byte(owner)
write_short((team1 != team2)?(get_user_frags(owner)+1):(get_user_frags(owner)-1))
write_short(get_user_deaths(owner))
write_short(0)
write_short(get_user_team(owner))
message_end();
set_user_frags(owner, (team1 != team2)?(get_user_frags(owner)+1):(get_user_frags(owner)-1))
}
else
{
hurtdmg += cdi
set_user_health(players[i], health)
message_begin(MSG_ONE, get_user_msgid("Damage"), {0,0,0}, players[i])
write_byte(0)
write_byte(cdi)
write_long(DMG_BLAST)
write_coord(vec[0])
write_coord(vec[1])
write_coord(vec[2])
message_end();
new Float:velocity[3]
get_speed_vector_to_entity(inf, players[i], 300.0, velocity) //向量计算推力
velocity[2] += 30.0 // 基础高度
set_pev(players[i], pev_velocity, velocity)
}
//client_printc(players[i], "\g【FAITH】\y你受到来自 \t%s\y 的火箭攻击, 造成伤害 \t%d\y 点!", owname, cdi)
}
}
}
stock get_speed_vector_to_entity(ent1, ent2, Float:speed, Float:new_velocity[3])
{
if (!pev_valid(ent1) || !pev_valid(ent2))
return 0;
static Float:origin1[3]
pev(ent1,pev_origin,origin1)
static Float:origin2[3]
pev(ent2,pev_origin,origin2)
new_velocity[0] = origin2[0] - origin1[0];
new_velocity[1] = origin2[1] - origin1[1];
new_velocity[2] = origin2[2] - origin1[2];
static Float:num
num = speed / vector_length(new_velocity);
new_velocity[0] *= num;
new_velocity[1] *= num;
new_velocity[2] *= num;
return 1;
}
stock Create_ScreenShake(id, amount, duration, frequency)
{
message_begin(MSG_ONE_UNRELIABLE, g_msgScreenShake, {0,0,0}, id)
write_short(amount) // ammount
write_short(duration) // lasts this long
write_short(frequency) // frequency
message_end();
}
stock event_hud(index, red, green, blue, msg[])
{
set_dhudmessage(red, green, blue, -1.0, 0.2, 0, 0.0, 2.0, 0.1, 0.1)
show_dhudmessage(index, msg)
}