Skip to content

Commit 58beefe

Browse files
committed
Improved plague to make it more summoner-friendly. It can now infect player and monster corpses!
1 parent a99e7bc commit 58beefe

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+129
-97
lines changed

src/characters/v_utils.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1994,6 +1994,7 @@ qboolean V_ArmorCache(edict_t *ent, int max_per_second, int update_frequency) {
19941994
}
19951995

19961996
void vrx_reset_player_state(edict_t *ent) {
1997+
//gi.dprintf("vrx_reset_player_state\n");
19971998
if (PM_PlayerHasMonster(ent) || ent->mtype) {
19981999
// restore the player to original state
19992000
V_RestoreMorphed(ent, 0);
@@ -2057,8 +2058,8 @@ void vrx_reset_player_state(edict_t *ent) {
20572058
// reset their velocity
20582059
VectorClear(ent->velocity);
20592060

2060-
// remove curses
2061-
CurseRemove(ent, 0);
2061+
// remove all curses except plague, which will be transferred to a body upon player respawn
2062+
CurseRemove(ent, 0, CURSE_PLAGUE);
20622063
// remove auras
20632064
AuraRemove(ent, 0);
20642065

@@ -2347,10 +2348,6 @@ void V_NonShellEffects(edict_t *ent) {
23472348
ent->s.effects |= EF_POWERSCREEN;
23482349
}
23492350

2350-
// plague flies
2351-
if (que_typeexists(ent->curses, CURSE_PLAGUE))
2352-
ent->s.effects |= EF_FLIES;
2353-
23542351
// ********** CLIENT-SPECIFIC EFFECTS BELOW **********
23552352
if (ent->client) {
23562353
// shield ability effect
@@ -2431,6 +2428,10 @@ void V_SetEffects(edict_t *ent) {
24312428
// clear all effects
24322429
ent->s.effects = ent->s.renderfx = 0;
24332430

2431+
// plague flies
2432+
if (que_typeexists(ent->curses, CURSE_PLAGUE))
2433+
ent->s.effects |= EF_FLIES;
2434+
24342435
if (ent->mtype != M_MAGMINE && ent->health < 1)
24352436
return;
24362437

src/combat/abilities/auras.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ qboolean que_addent (que_t *que, edict_t *other, float duration)
260260
return false;
261261
}
262262

263-
void CurseRemove (edict_t *ent, int type)
263+
void CurseRemove (edict_t *ent, int type, int ignore)
264264
{
265265
int i;
266266
que_t *slot;
@@ -277,6 +277,10 @@ void CurseRemove (edict_t *ent, int type)
277277
if (type && slot->ent->inuse && slot->ent->mtype != type && slot->ent->atype != type)
278278
continue;
279279

280+
// ignore this type
281+
if (ignore && slot->ent->inuse && (slot->ent->mtype == ignore || slot->ent->atype == ignore))
282+
continue;
283+
280284
// this curse is specifically targetting us, so destroy it
281285
if (!slot->ent->takedamage // make sure that the curse is really a curse!
282286
&& slot->ent->enemy && slot->ent->enemy->inuse && (slot->ent->enemy == ent))
@@ -351,7 +355,7 @@ void holyfreeze_think (edict_t *self)
351355
slot = NULL;
352356
if (target == self->owner)
353357
continue;
354-
if (!G_ValidTarget(self->owner, target, true))
358+
if (!G_ValidTarget(self->owner, target, true, true))
355359
continue;
356360
// FIXME: make this into a loop search if we plan to allow
357361
// more than one curse of the same type

src/combat/abilities/auras.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ que_t *que_findtype(const que_t *src, que_t *dst, int type);
2626

2727
void que_removeent(que_t *que, edict_t *other, qboolean free);
2828
void que_empty (que_t *que);
29-
void CurseRemove (edict_t *ent, int type);
29+
void CurseRemove (edict_t *ent, int type, int ignore);
3030
void AuraRemove (edict_t *ent, int type);
3131

3232
#endif

src/combat/abilities/autoaim.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ qboolean autoaim_findtarget (edict_t *ent)
1414

1515
while ((target = findclosestreticle(target, ent, AUTOAIM_TARGET_RADIUS)) != NULL)
1616
{
17-
if (!G_ValidTarget(ent, target, true))
17+
if (!G_ValidTarget(ent, target, true, true))
1818
continue;
1919
if (!nearfov(ent, target, 0, 20))
2020
continue;
@@ -120,7 +120,7 @@ void V_AutoAim (edict_t *player)
120120
}
121121
}
122122
// we've got an invalid target
123-
else if (!G_ValidTarget(player, player->enemy, true) || !infront(player, player->enemy))
123+
else if (!G_ValidTarget(player, player->enemy, true, true) || !infront(player, player->enemy))
124124
{
125125
//gi.dprintf("have invalid target");
126126

src/combat/abilities/bombspell.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,6 @@ void Cmd_BombPlayer(edict_t *ent, float skill_mult, float cost_mult)
424424
VectorMA(start, BOMBPERSON_RANGE, forward, end);
425425
tr = gi.trace(start, NULL, NULL, end, ent, MASK_SHOT);
426426

427-
if (G_ValidTarget(ent, tr.ent, false))
427+
if (G_ValidTarget(ent, tr.ent, false, true))
428428
BombPerson(tr.ent, ent, skill_mult);
429429
}

src/combat/abilities/conversion.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ qboolean ConvertOwner (edict_t *ent, edict_t *other, float duration, qboolean pr
1818

1919
// don't convert to a player if they are not a valid target
2020
//FIXME: this fails on players with godmode :(
21-
if (ent->client && !G_ValidTarget(NULL, ent, false))
21+
if (ent->client && !G_ValidTarget(NULL, ent, false, true))
2222
{
2323
// gi.dprintf("%s is not a valid target\n", ent->client->pers.netname);
2424
return false;

src/combat/abilities/curses.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,7 @@ char *GetCurseName (int type)
388388
case WEAKEN: return "weaken";
389389
case LIFE_DRAIN: return "life drain";
390390
case CURSE_BURN: return "burning";
391+
case CURSE_PLAGUE: return "plague";
391392
default: return "";
392393
}
393394
}
@@ -696,7 +697,7 @@ void Bleed (edict_t *curse)
696697
if (level.time < curse->wait)
697698
return;
698699

699-
if (!G_ValidTarget(caster, curse->enemy, false))
700+
if (!G_ValidTarget(caster, curse->enemy, false, true))
700701
{
701702
// remove the curse if the target dies
702703
que_removeent(curse->enemy->curses, curse, true);
@@ -737,7 +738,7 @@ void LifeDrain (edict_t *curse)
737738
if (level.time < curse->wait)
738739
return;
739740

740-
if (!G_ValidTarget(caster, curse->enemy, false))
741+
if (!G_ValidTarget(caster, curse->enemy, false, true))
741742
{
742743
// remove the curse if the target dies
743744
que_removeent(curse->enemy->curses, curse, true);

src/combat/abilities/detector.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ edict_t *detector_findprojtarget (edict_t *self, edict_t *projectile)
4747
//if (G_ValidTarget_Lite(self, target, true) && entdist(self, target) < self->dmg_radius)
4848
// valid target must be visible and within range of the projectile
4949
//gi.dprintf("detector_findprojtarget found a target in range of %s\n", projectile->classname);
50-
if (G_ValidTarget(self, target, false) && visible(projectile, target) && entdist(projectile, target) < self->dmg_radius && target->detected_time > level.time)
50+
if (G_ValidTarget(self, target, false, true) && visible(projectile, target) && entdist(projectile, target) < self->dmg_radius && target->detected_time > level.time)
5151
return target;
5252
}
5353
//gi.dprintf("no targets\n");

src/combat/abilities/emp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ qboolean EMP_ValidTarget (edict_t *self, edict_t *other)
172172
&& !(other->flags & FL_CHATPROTECT) && visible(self, other))
173173
return true;
174174

175-
return G_ValidTarget(self, other, true);
175+
return G_ValidTarget(self, other, true, true);
176176
}
177177

178178

src/combat/abilities/explodingarmor.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ qboolean NearbyEnemy (edict_t *self, float radius)
8585

8686
while ((e = findradius(e, self->s.origin, radius)) != NULL)
8787
{
88-
if (!G_ValidTarget(self, e, true))
88+
if (!G_ValidTarget(self, e, true, true))
8989
continue;
9090
return true;
9191
}

src/combat/abilities/fireball.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ void fireball_explode (edict_t *self, cplane_t *plane)
99
// burn targets within explosion radius
1010
while ((e = findradius(e, self->s.origin, self->dmg_radius)) != NULL)
1111
{
12-
if (!G_ValidTarget(self, e, true))
12+
if (!G_ValidTarget(self, e, true, true))
1313
continue;
1414
burn_person(e, self->owner, self->radius_dmg);
1515
}
@@ -144,7 +144,7 @@ void icebolt_explode (edict_t *self, cplane_t *plane)
144144
// chill targets within explosion radius
145145
while ((e = findradius(e, self->s.origin, self->dmg_radius)) != NULL)
146146
{
147-
if (!G_ValidTarget(self, e, true))
147+
if (!G_ValidTarget(self, e, true, true))
148148
continue;
149149
e->chill_level = self->chill_level;
150150
e->chill_time = level.time + self->chill_time;

src/combat/abilities/flying_skull.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ void skull_think (edict_t *self)
496496

497497
//if (!self->enemy)
498498
// skull_findtarget(self);
499-
if (G_ValidTarget(self, self->enemy, false) // is the target still valid?
499+
if (G_ValidTarget(self, self->enemy, false, true) // is the target still valid?
500500
&& entdist(self->activator, self->enemy) <= SKULL_MAX_RANGE) // make sure the target isn't too far from activator (don't wander)
501501
{
502502
if (!visible(self, self->enemy))
@@ -675,7 +675,7 @@ void skull_attackcmd (edict_t *self)
675675

676676
tr = gi.trace(start, NULL, NULL, end, self->activator, MASK_SHOT);
677677

678-
if (G_ValidTarget(self, tr.ent, false))
678+
if (G_ValidTarget(self, tr.ent, false, true))
679679
{
680680
self->enemy = tr.ent;
681681
self->monsterinfo.search_frames = 0;

src/combat/abilities/gloom.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -632,7 +632,7 @@ void spiker_attack (edict_t *self)
632632

633633
while ((e = findradius(e, self->s.origin, range)) != NULL)
634634
{
635-
if (!G_ValidTarget(self, e, true))
635+
if (!G_ValidTarget(self, e, true, true))
636636
continue;
637637

638638
// copy target location
@@ -1102,7 +1102,7 @@ void obstacle_attack(edict_t* self)
11021102
VectorCopy(end, self->move_origin); // save current position
11031103
end[2] -= 8192;
11041104
tr = gi.trace(self->s.origin, self->mins, self->maxs, end, self, MASK_SHOT);
1105-
if (G_ValidTarget(self, tr.ent, false))
1105+
if (G_ValidTarget(self, tr.ent, false, true))
11061106
self->movetype = MOVETYPE_STEP;
11071107
}
11081108
else
@@ -1430,7 +1430,7 @@ void gascloud_attack (edict_t *self)
14301430

14311431
while ((e = findradius(e, self->s.origin, self->dmg_radius)) != NULL)
14321432
{
1433-
if (G_ValidTarget(self, e, true))
1433+
if (G_ValidTarget(self, e, true, true))
14341434
{
14351435
// otherwise, update the attack frequency to once per server frame
14361436
if ((slot = que_findtype(e->curses, NULL, POISON)) != NULL)
@@ -1523,7 +1523,7 @@ void gasser_acidattack (edict_t *self)
15231523

15241524
while ((e = findradius(e, self->s.origin, range)) != NULL)
15251525
{
1526-
if (!G_ValidTarget(self, e, true))
1526+
if (!G_ValidTarget(self, e, true, true))
15271527
continue;
15281528

15291529
// copy target location
@@ -2232,7 +2232,7 @@ void spikeball_findtarget (edict_t *self)
22322232
{
22332233
edict_t *e=NULL;
22342234

2235-
if (!G_ValidTarget(self, self->enemy, true))
2235+
if (!G_ValidTarget(self, self->enemy, true, true))
22362236
{
22372237
while ((e = findclosestradius_targets(e, self, self->dmg_radius)) != NULL)
22382238
{

src/combat/abilities/lasertrap.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ qboolean lasertrap_validtarget (edict_t *self, edict_t *target, float dist, qboo
6565
vec3_t v;
6666

6767
// basic check
68-
if (!G_ValidTarget(self, target, vis))
68+
if (!G_ValidTarget(self, target, vis, true))
6969
return false;
7070

7171
// check distance on a 2-D plane
@@ -149,7 +149,7 @@ void lasertrap_firelaser (edict_t *self, vec3_t dir)
149149
gi.multicast(start, MULTICAST_PVS);
150150

151151
// hurt any valid target that touches the laser
152-
if (G_ValidTarget(self, tr.ent, false))
152+
if (G_ValidTarget(self, tr.ent, false, true))
153153
{
154154
// calculate attack vector
155155
VectorSubtract(tr.ent->s.origin, start, forward);// up

src/combat/abilities/magic.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ void LeapAttack (edict_t *ent)
254254

255255
while ((e = findradius (e, ent->s.origin, 128)) != NULL)
256256
{
257-
if (!G_ValidTarget(ent, e, true))
257+
if (!G_ValidTarget(ent, e, true, true))
258258
continue;
259259
if (!infront(ent, e))
260260
continue;
@@ -913,7 +913,7 @@ void Cmd_Purge_f (edict_t *ent)
913913
ent->client->ability_delay = level.time + PURGE_DELAY;
914914

915915
//Remove all curses
916-
CurseRemove(ent, 0);
916+
CurseRemove(ent, 0, 0);
917917

918918
ent->client->pers.inventory[power_cube_index] -= PURGE_COST;
919919
ent->client->ability_delay = level.time + PURGE_DELAY;

src/combat/abilities/magmine.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ qboolean magmine_findtarget(edict_t *self) {
3131
//while ((other = findclosestradius_targets(other, self, self->dmg_radius)) != NULL) {
3232
if (other == self)
3333
continue;
34-
if (!G_ValidTarget(self, other, true))
34+
if (!G_ValidTarget(self, other, true, true))
3535
continue;
3636
self->enemy = other;
3737
return true;
@@ -149,7 +149,7 @@ void magmine_think(edict_t *self)
149149
shouldCallThrowSparks = true;
150150
}
151151
}
152-
else if (G_ValidTarget(self, self->enemy, true)
152+
else if (G_ValidTarget(self, self->enemy, true, true)
153153
&& (entdist(self, self->enemy) <= self->dmg_radius)) {
154154
magmine_attack(self);
155155
shouldCallThrowSparks = true;

src/combat/abilities/meteor.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ void meteor_touch (edict_t *self, edict_t *other, cplane_t *plane, csurface_t *s
77
// burn targets within explosion radius
88
while ((e = findradius(e, self->s.origin, self->dmg_radius)) != NULL)
99
{
10-
if (!G_ValidTarget(self, e, true))
10+
if (!G_ValidTarget(self, e, true, true))
1111
continue;
1212
burn_person(e, self->owner, (int)(self->dmg*0.1));
1313
}

src/combat/abilities/minisentry.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
void minisentry_pain (edict_t *self, edict_t *other, float kick, int damage)
1616
{
17-
if (!self->enemy && G_ValidTarget(self, other, true)
17+
if (!self->enemy && G_ValidTarget(self, other, true, true)
1818
&& (entdist(self, other) < SENTRY_ATTACK_RANGE))
1919
{
2020
//gi.dprintf("minisentry_pain is targetting %s\n", other->classname);
@@ -638,7 +638,7 @@ void minisentry_think (edict_t *self)
638638
else
639639
{
640640
// valid target and in range or detected?
641-
if (G_ValidTarget(self, self->enemy, true) && (entdist(self, self->enemy)<=SENTRY_ATTACK_RANGE || self->enemy->flags & FL_DETECTED))
641+
if (G_ValidTarget(self, self->enemy, true, true) && (entdist(self, self->enemy)<=SENTRY_ATTACK_RANGE || self->enemy->flags & FL_DETECTED))
642642
{
643643
minisentry_attack(self);
644644
}

src/combat/abilities/plaguecloud.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ void PlagueCloudSpawn(edict_t *ent) {
4242

4343
// find someone nearby to infect
4444
while ((e = findradius(e, ent->s.origin, radius)) != NULL) {
45-
if (!G_ValidTarget(ent, e, true))
45+
if (!G_ValidTarget(ent, e, true, false))
4646
continue;
4747
// if (HasActiveCurse(e, CURSE_PLAGUE))
4848
if (que_typeexists(e->curses, CURSE_PLAGUE))
@@ -61,7 +61,7 @@ void plague_think(edict_t *self) {
6161
edict_t *e = NULL;
6262

6363
// plague self-terminates if:
64-
if (!G_EntIsAlive(self->owner) || !G_EntIsAlive(self->enemy) //someone dies
64+
if (!G_EntIsAlive(self->owner) || !G_EntExists(self->enemy)// || !G_EntIsAlive(self->enemy) //someone dies
6565
|| (self->owner->flags & FL_WORMHOLE) // owner enters a wormhole
6666
|| (self->owner->client->tball_delay > level.time) //owner tballs away
6767
|| (self->owner->flags & FL_CHATPROTECT) //3.0 owner is in chatprotect
@@ -70,6 +70,7 @@ void plague_think(edict_t *self) {
7070
|| que_findtype(self->enemy->curses, NULL, HEALING) != NULL) //3.0 player is blessed with healing
7171
{
7272
que_removeent(self->enemy->curses, self, true);
73+
//gi.dprintf("que_removeent\n");
7374
return;
7475
}
7576

@@ -84,7 +85,7 @@ void plague_think(edict_t *self) {
8485
while ((e = findradius(e, self->s.origin, radius)) != NULL) {
8586
if (e == self->enemy)
8687
continue;
87-
if (!G_ValidTarget(self, e, true))
88+
if (!G_ValidTarget(self, e, true, false))
8889
continue;
8990
// don't allow more than one curse of the same type
9091
if (que_typeexists(e->curses, CURSE_PLAGUE))
@@ -96,7 +97,7 @@ void plague_think(edict_t *self) {
9697
PlagueCloud(self->owner, e);
9798
}
9899

99-
if (level.time > self->wait) {
100+
if (level.time > self->wait && self->enemy->health > 0) {
100101
int maxlevel;
101102

102103
if (self->owner->mtype == M_MYPARASITE)
@@ -135,7 +136,7 @@ void PlagueCloud(edict_t *ent, edict_t *target) {
135136
plague->nextthink = level.time + FRAMETIME;
136137
plague->think = plague_think;
137138
plague->classname = "curse";
138-
plague->mtype = CURSE_PLAGUE;
139+
plague->mtype = plague->atype = CURSE_PLAGUE;
139140
VectorCopy(ent->s.origin, plague->s.origin);
140141

141142
// abort if the target has too many curses

src/combat/abilities/playermonster/playertoberserk.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ void p_berserk_crush (edict_t *self, int damage, float range, int mod)
9999

100100
while ((other = findradius(other, self->s.origin, range)) != NULL)
101101
{
102-
if (!G_ValidTarget(self, other, true))
102+
if (!G_ValidTarget(self, other, true, true))
103103
continue;
104104
if (!nearfov(self, other, 0, 30))
105105
continue;

0 commit comments

Comments
 (0)