Skip to content

Commit 4f618df

Browse files
committed
1. improved bot inventory weight handling. for example, knights and poltergeists won't bother searching for ammo and weapons that they don't need.
2. fixed bots ignoring obstacle. made them view magnetic obstacles as special hazards to keep out of their radius. 3. bots will no longer pick up runes. 4. bots will always prioritize targetting players over monsters, with spreeing players having the highest priority.
1 parent 196b357 commit 4f618df

15 files changed

Lines changed: 174 additions & 81 deletions

File tree

src/ai/ai_class_dmbot.c

Lines changed: 119 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1263,7 +1263,7 @@ qboolean BOT_DMclass_FindEnemy(edict_t* self)
12631263
if (AIEnemies[i] == NULL || AIEnemies[i] == self)
12641264
continue;
12651265

1266-
if (!G_ValidTargetEnt(AIEnemies[i], true))
1266+
if (!G_ValidTargetEnt(self, AIEnemies[i], true))
12671267
continue;
12681268

12691269
dist = entdist(self, AIEnemies[i]);
@@ -1756,10 +1756,17 @@ void BOT_DMclass_WeightPlayers(edict_t *self)
17561756
{
17571757
// GHz: chase enemies!
17581758
if (self->enemy && self->enemy->inuse && AIEnemies[i] == self->enemy)
1759-
self->ai.status.playersWeights[i] = 0.9;
1759+
self->ai.status.playersWeights[i] = 0.9; // active enemy always has the highest priority/weight
1760+
else if (AIEnemies[i]->client)
1761+
{
1762+
if (AIEnemies[i]->myskills.streak >= SPREE_START)
1763+
self->ai.status.playersWeights[i] = 0.6; // spreeing players are weighed much higher
1764+
else
1765+
self->ai.status.playersWeights[i] = 0.3; // players have more weight than non-clients (e.g. monsters)
1766+
}
17601767
else
17611768
//if not at ctf every player has some value
1762-
self->ai.status.playersWeights[i] = 0.3;
1769+
self->ai.status.playersWeights[i] = 0.2;
17631770
}
17641771
}
17651772

@@ -1840,10 +1847,14 @@ void AI_AdjustAmmoNeedFactor(edict_t *self, gitem_t *ammoItem, ...)
18401847
}
18411848

18421849
// does the bot need cells for power screen/shield?
1843-
if (ammo_index == cell_index && AI_GetPSlevel(self))
1850+
if (ammo_index == cell_index && AI_GetPSlevel(self) && self->client->pers.inventory[cell_index] < self->client->pers.max_cells)
1851+
{
1852+
self->ai.status.inventoryWeights[ammo_index] = 0.5;
18441853
return; // don't reduce cells weight
1854+
}
18451855

18461856
// morphed players don't typically need ammo (except for summoners, e.g. engy)
1857+
// note: this adjustment may be redundant if the bot is a poltergeist, since the weight should already be 0 in ai.pers.inventoryWeights
18471858
if (self->mtype || PM_PlayerHasMonster(self))
18481859
{
18491860
self->ai.status.inventoryWeights[ammo_index] = 0.0;
@@ -1998,6 +2009,8 @@ void BOT_DMclass_WeightInventory(edict_t *self)
19982009
//shards are ALWAYS accepted but still...
19992010
if (!AI_CanUseArmor ( FindItemByClassname("item_armor_shard"), self ))
20002011
self->ai.status.inventoryWeights[armor_shard_index] = 0.0;
2012+
else if (self->client->pers.inventory[power_cube_index] < 50) // low on power cubes?
2013+
self->ai.status.inventoryWeights[armor_shard_index] *= 2.0; // increase weight of armor shards
20012014

20022015
if (!AI_CanUseArmor ( FindItemByClassname("item_armor_jacket"), self ))
20032016
self->ai.status.inventoryWeights[jacket_armor_index] = 0.0;
@@ -2007,7 +2020,8 @@ void BOT_DMclass_WeightInventory(edict_t *self)
20072020

20082021
if (!AI_CanUseArmor ( FindItemByClassname("item_armor_body"), self ))
20092022
self->ai.status.inventoryWeights[body_armor_index] = 0.0;
2010-
2023+
//gi.dprintf("sh:%.1f ja:%.1f co:%.1f bo:%.1f\n", self->ai.status.inventoryWeights[armor_shard_index], self->ai.status.inventoryWeights[jacket_armor_index],
2024+
// self->ai.status.inventoryWeights[combat_armor_index], self->ai.status.inventoryWeights[body_armor_index]);
20112025

20122026
//TECH :
20132027
//-----------------------------------------------------
@@ -2218,6 +2232,105 @@ void BOT_DMclass_RunFrame( edict_t *self )
22182232
self->nextthink = level.time + FRAMETIME;
22192233
}
22202234

2235+
void BOT_PrintItemWeights(edict_t* self)
2236+
{
2237+
gi.dprintf("sh:%.1f bu:%.1f ce:%.1f ro:%.1f sl:%.1f gr:%.1f\n", self->ai.pers.inventoryWeights[shell_index], self->ai.pers.inventoryWeights[bullet_index],
2238+
self->ai.pers.inventoryWeights[cell_index], self->ai.pers.inventoryWeights[rocket_index], self->ai.pers.inventoryWeights[slug_index],
2239+
self->ai.pers.inventoryWeights[grenade_index]);
2240+
}
2241+
2242+
void BOT_DMclass_InitPersistantWeights(edict_t* self)
2243+
{
2244+
//Persistant Inventory Weights (0 = can not pick)
2245+
memset(self->ai.pers.inventoryWeights, 0, sizeof(self->ai.pers.inventoryWeights));
2246+
2247+
// note: the weights below are baseline and will later be adjusted based on bot status/need by BOT_DMclass_WeightInventory
2248+
2249+
if (self->myskills.class_num == CLASS_KNIGHT || self->myskills.class_num == CLASS_POLTERGEIST) // knights and poltergeists don't use weapons and ammo
2250+
{
2251+
//weapons
2252+
self->ai.pers.inventoryWeights[blaster_index] = 0.0;
2253+
self->ai.pers.inventoryWeights[sword_index] = 0.0;
2254+
self->ai.pers.inventoryWeights[_20mmcannon_index] = 0.0;
2255+
self->ai.pers.inventoryWeights[shotgun_index] = 0.0;
2256+
self->ai.pers.inventoryWeights[supershotgun_index] = 0.0;
2257+
self->ai.pers.inventoryWeights[machinegun_index] = 0.0;
2258+
self->ai.pers.inventoryWeights[chaingun_index] = 0.0;
2259+
self->ai.pers.inventoryWeights[grenadelauncher_index] = 0.0;
2260+
self->ai.pers.inventoryWeights[rocketlauncher_index] = 0.0;
2261+
self->ai.pers.inventoryWeights[hyperblaster_index] = 0.0;
2262+
self->ai.pers.inventoryWeights[railgun_index] = 0.0;
2263+
self->ai.pers.inventoryWeights[bfg10k_index] = 0.0;
2264+
2265+
//ammo
2266+
self->ai.pers.inventoryWeights[shell_index] = 0.0;
2267+
self->ai.pers.inventoryWeights[bullet_index] = 0.0;
2268+
self->ai.pers.inventoryWeights[cell_index] = 0.0;
2269+
self->ai.pers.inventoryWeights[rocket_index] = 0.0;
2270+
self->ai.pers.inventoryWeights[slug_index] = 0.0;
2271+
self->ai.pers.inventoryWeights[grenade_index] = 0.0;
2272+
}
2273+
else
2274+
{
2275+
//weapons
2276+
self->ai.pers.inventoryWeights[blaster_index] = 0.0;
2277+
self->ai.pers.inventoryWeights[sword_index] = 0.0;
2278+
self->ai.pers.inventoryWeights[_20mmcannon_index] = 0.0;
2279+
self->ai.pers.inventoryWeights[shotgun_index] = 0.5;
2280+
self->ai.pers.inventoryWeights[supershotgun_index] = 0.7;
2281+
self->ai.pers.inventoryWeights[machinegun_index] = 0.5;
2282+
self->ai.pers.inventoryWeights[chaingun_index] = 0.7;
2283+
self->ai.pers.inventoryWeights[ITEM_INDEX(AIWeapons[WEAP_GRENADES].weaponItem)] = 0.5;// isn't this redundant with grenade_index below?
2284+
self->ai.pers.inventoryWeights[grenadelauncher_index] = 0.6;
2285+
self->ai.pers.inventoryWeights[rocketlauncher_index] = 0.8;
2286+
self->ai.pers.inventoryWeights[hyperblaster_index] = 0.7;
2287+
self->ai.pers.inventoryWeights[railgun_index] = 0.8;
2288+
self->ai.pers.inventoryWeights[bfg10k_index] = 0.5;
2289+
2290+
//ammo
2291+
self->ai.pers.inventoryWeights[shell_index] = 0.5;
2292+
self->ai.pers.inventoryWeights[bullet_index] = 0.5;
2293+
self->ai.pers.inventoryWeights[cell_index] = 0.5;
2294+
self->ai.pers.inventoryWeights[rocket_index] = 0.5;
2295+
self->ai.pers.inventoryWeights[slug_index] = 0.5;
2296+
self->ai.pers.inventoryWeights[grenade_index] = 0.5;
2297+
}
2298+
2299+
//armor
2300+
if (self->myskills.class_num == CLASS_POLTERGEIST) // poltergeists don't use body armor
2301+
{
2302+
self->ai.pers.inventoryWeights[body_armor_index] = 0.0;
2303+
self->ai.pers.inventoryWeights[combat_armor_index] = 0.0;
2304+
self->ai.pers.inventoryWeights[jacket_armor_index] = 0.0;
2305+
self->ai.pers.inventoryWeights[armor_shard_index] = 0.2; // for powercubes
2306+
}
2307+
else
2308+
{
2309+
self->ai.pers.inventoryWeights[body_armor_index] = 0.9;
2310+
self->ai.pers.inventoryWeights[combat_armor_index] = 0.8;
2311+
self->ai.pers.inventoryWeights[jacket_armor_index] = 0.5;
2312+
self->ai.pers.inventoryWeights[armor_shard_index] = 0.2;
2313+
}
2314+
2315+
//techs
2316+
self->ai.pers.inventoryWeights[resistance_index] = 0.5;
2317+
self->ai.pers.inventoryWeights[strength_index] = 0.5;
2318+
self->ai.pers.inventoryWeights[regeneration_index] = 0.5;
2319+
self->ai.pers.inventoryWeights[haste_index] = 0.5;
2320+
2321+
//GHz: misc items and powerups
2322+
self->ai.pers.inventoryWeights[ITEM_INDEX(FindItemByClassname("item_pack"))] = 0.6;
2323+
self->ai.pers.inventoryWeights[ITEM_INDEX(FindItemByClassname("item_quad"))] = 2.0;
2324+
self->ai.pers.inventoryWeights[ITEM_INDEX(FindItemByClassname("item_invulnerability"))] = 2.0;
2325+
2326+
if (ctf->value) {
2327+
redflag = FindItemByClassname("item_flag_team1"); // store pointers to flags gitem_t, for
2328+
blueflag = FindItemByClassname("item_flag_team2");// simpler comparisons inside this archive
2329+
self->ai.pers.inventoryWeights[ITEM_INDEX(FindItemByClassname("item_flag_team1"))] = 3.0;
2330+
self->ai.pers.inventoryWeights[ITEM_INDEX(FindItemByClassname("item_flag_team2"))] = 3.0;
2331+
}
2332+
//BOT_PrintItemWeights(self);//TESTING!!!!!!!!!!!!!!!
2333+
}
22212334

22222335
//==========================================
22232336
// BOT_DMclass_InitPersistant
@@ -2242,54 +2355,7 @@ void BOT_DMclass_InitPersistant(edict_t *self)
22422355
//available moveTypes for this class
22432356
self->ai.pers.moveTypesMask = (LINK_MOVE|LINK_STAIRS|LINK_FALL|LINK_WATER|LINK_WATERJUMP|LINK_JUMPPAD|LINK_PLATFORM|LINK_TELEPORT|LINK_LADDER|LINK_JUMP|LINK_CROUCH);
22442357

2245-
//Persistant Inventory Weights (0 = can not pick)
2246-
memset(self->ai.pers.inventoryWeights, 0, sizeof (self->ai.pers.inventoryWeights));
2247-
2248-
//weapons
2249-
self->ai.pers.inventoryWeights[ITEM_INDEX(AIWeapons[WEAP_BLASTER].weaponItem)] = 0.0;
2250-
self->ai.pers.inventoryWeights[ITEM_INDEX(AIWeapons[WEAP_SWORD].weaponItem)] = 0.0;
2251-
//self->bot.pers.inventoryWeights[ITEM_INDEX(FindItemByClassname("weapon_blaster"))] = 0.0; //it's the same thing
2252-
self->ai.pers.inventoryWeights[ITEM_INDEX(AIWeapons[WEAP_20MM].weaponItem)] = 0.0;
2253-
self->ai.pers.inventoryWeights[ITEM_INDEX(AIWeapons[WEAP_SHOTGUN].weaponItem)] = 0.5;
2254-
self->ai.pers.inventoryWeights[ITEM_INDEX(AIWeapons[WEAP_SUPERSHOTGUN].weaponItem)] = 0.7;
2255-
self->ai.pers.inventoryWeights[ITEM_INDEX(AIWeapons[WEAP_MACHINEGUN].weaponItem)] = 0.5;
2256-
self->ai.pers.inventoryWeights[ITEM_INDEX(AIWeapons[WEAP_CHAINGUN].weaponItem)] = 0.7;
2257-
self->ai.pers.inventoryWeights[ITEM_INDEX(AIWeapons[WEAP_GRENADES].weaponItem)] = 0.5;
2258-
self->ai.pers.inventoryWeights[ITEM_INDEX(AIWeapons[WEAP_GRENADELAUNCHER].weaponItem)] = 0.6;
2259-
self->ai.pers.inventoryWeights[ITEM_INDEX(AIWeapons[WEAP_ROCKETLAUNCHER].weaponItem)] = 0.8;
2260-
self->ai.pers.inventoryWeights[ITEM_INDEX(AIWeapons[WEAP_HYPERBLASTER].weaponItem)] = 0.7;
2261-
self->ai.pers.inventoryWeights[ITEM_INDEX(AIWeapons[WEAP_RAILGUN].weaponItem)] = 0.8;
2262-
self->ai.pers.inventoryWeights[ITEM_INDEX(AIWeapons[WEAP_BFG].weaponItem)] = 0.5;
2263-
2264-
//ammo
2265-
self->ai.pers.inventoryWeights[shell_index] = 0.5;
2266-
self->ai.pers.inventoryWeights[bullet_index] = 0.5;
2267-
self->ai.pers.inventoryWeights[cell_index] = 0.5;
2268-
self->ai.pers.inventoryWeights[rocket_index] = 0.5;
2269-
self->ai.pers.inventoryWeights[slug_index] = 0.5;
2270-
self->ai.pers.inventoryWeights[grenade_index] = 0.5;
2271-
2272-
//armor
2273-
self->ai.pers.inventoryWeights[body_armor_index] = 0.9;
2274-
self->ai.pers.inventoryWeights[ITEM_INDEX(FindItemByClassname("item_armor_combat"))] = 0.8;
2275-
self->ai.pers.inventoryWeights[ITEM_INDEX(FindItemByClassname("item_armor_jacket"))] = 0.5;
2276-
self->ai.pers.inventoryWeights[ITEM_INDEX(FindItemByClassname("item_armor_shard"))] = 0.2;
2277-
2278-
//techs
2279-
self->ai.pers.inventoryWeights[ITEM_INDEX(FindItemByClassname("tech_resistance"))] = 0.5;
2280-
self->ai.pers.inventoryWeights[ITEM_INDEX(FindItemByClassname("tech_strength"))] = 0.5;
2281-
self->ai.pers.inventoryWeights[ITEM_INDEX(FindItemByClassname("tech_regeneration"))] = 0.5;
2282-
self->ai.pers.inventoryWeights[ITEM_INDEX(FindItemByClassname("tech_haste"))] = 0.5;
2283-
2284-
//GHz: misc
2285-
self->ai.pers.inventoryWeights[ITEM_INDEX(FindItemByClassname("item_pack"))] = 0.6;
2286-
2287-
if( ctf->value ) {
2288-
redflag = FindItemByClassname("item_flag_team1"); // store pointers to flags gitem_t, for
2289-
blueflag = FindItemByClassname("item_flag_team2");// simpler comparisons inside this archive
2290-
self->ai.pers.inventoryWeights[ITEM_INDEX(FindItemByClassname("item_flag_team1"))] = 3.0;
2291-
self->ai.pers.inventoryWeights[ITEM_INDEX(FindItemByClassname("item_flag_team2"))] = 3.0;
2292-
}
2358+
//BOT_DMclass_InitPersistantWeights(self);
22932359
}
22942360

22952361
//==========================================

src/ai/ai_items.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,10 @@ qboolean AI_CanUseArmor(gitem_t* item, edict_t* other)//GHz - mostly a copy & pa
124124
if (!other->client)
125125
return false;
126126

127+
// morphed players can only use armor shards
128+
if (item->tag != ARMOR_SHARD && (other->mtype || PM_PlayerHasMonster(other)))
129+
return false;
130+
127131
//gi.dprintf("%d: %s\n", (int)level.framenum, __func__);
128132
// get info on new armor
129133
newinfo = (gitem_armor_t*)item->info;
@@ -346,14 +350,14 @@ float AI_ItemWeight(edict_t *self, edict_t *it)
346350
return weight;//GHz
347351
}
348352

349-
if (self->health >= 250 && it->count > 25)
353+
if (self->health >= 250 && it->count > 25)//FIXME
350354
return 0;
351355

352356
//find the weight
353357
weight = 0;
354358
if (self->health < 100)
355359
weight = ((100 - self->health) + it->count)*0.01;
356-
else if (self->health <= 250 && it->count == 100)//mega
360+
else if (self->health <= 250 && it->count == 100)//mega//FIXME
357361
weight = 8.0;
358362

359363
weight += (self->health < 25);//we just NEED IT!!!
@@ -366,7 +370,7 @@ float AI_ItemWeight(edict_t *self, edict_t *it)
366370

367371
//IT_POWERUP
368372
if (it->item->flags & IT_POWERUP)
369-
return 0.7;
373+
return self->ai.status.inventoryWeights[ITEM_INDEX(it->item)];
370374

371375
//IT_TECH
372376
if (it->item->flags & IT_TECH)

src/ai/ai_movement.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,10 @@ qboolean AI_DodgeProjectiles(edict_t* self, usercmd_t* ucmd)
468468
if (self->movetarget->mtype == M_BARREL && !self->enemy)
469469
return false;
470470

471+
// obstacles aren't dangerous if they're dead!
472+
//if (self->movetarget->mtype == M_OBSTACLE && self->movetarget->health < 1)
473+
// return false;
474+
471475
// copy projectile's origin to start
472476
VectorCopy(self->movetarget->s.origin, start);
473477
// is it moving?

src/ai/ai_util.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66
qboolean AI_IsProjectile(edict_t* ent)
77
{
8+
if (ent->mtype == M_OBSTACLE && ent->health > 0)
9+
return true;
810
if (ent->mtype == M_LIGHTNINGSTORM || ent->mtype == M_BARREL)
911
return true;
1012
return ent->clipmask == MASK_SHOT && (ent->solid == SOLID_BBOX || ent->solid == SOLID_TRIGGER) && ent->s.modelindex && (ent->dmg || ent->radius_dmg);
@@ -57,7 +59,11 @@ qboolean AI_ValidMoveTarget(edict_t* self, edict_t* target, qboolean check_range
5759
dist = entdist(self, target);
5860
// projectiles
5961
if (AI_IsProjectile(target) && dist <= AI_RANGE_LONG)
62+
{
63+
//if (target->mtype == M_OBSTACLE && target->health < 1)
64+
// return false; // don't worry about dead obstacles!
6065
return true;
66+
}
6167
// reachable summons
6268
if (AI_IsOwnedSummons(self, target) && AI_ClearWalkingPath(self, self->s.origin, target->s.origin))
6369
return true;

src/ai/bot_abilities.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,7 @@ qboolean BOT_DMclass_TargetBarrel(edict_t* self)
609609
// Find Enemy
610610
for (int i = 0;i < num_AIEnemies;i++)
611611
{
612-
if (!G_ValidTargetEnt(AIEnemies[i], true))
612+
if (!G_ValidTargetEnt(self, AIEnemies[i], true))
613613
continue;
614614
// not a barrel
615615
if (AIEnemies[i]->mtype != M_BARREL)

src/ai/bot_common.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ typedef struct {
4040
} bot_selection_t;
4141

4242
bot_selection_t botlist[] = {
43+
{"abort-retry-fail", "poltergeist"},
44+
{"BSOD", "poltergeist"},
45+
{"ctrl-alt-del", "poltergeist"},
46+
{"kernel panic", "poltergeist"},
4347
{"robotico", "soldier"},
4448
{"faildozer", "soldier"},
4549
{"T-800", "soldier"},

src/ai/bot_spawn.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -614,6 +614,9 @@ void BOT_Touchdown(edict_t* self)
614614
gi.dprintf("jump landed, dist: %f\n", VectorLength(v));
615615
gi.sound(self, CHAN_VOICE, gi.soundindex("world/land.wav"), 1, ATTN_IDLE, 0);
616616
}
617+
618+
void BOT_DMclass_InitPersistantWeights(edict_t* self);
619+
617620
//==========================================
618621
// BOT_DMClass_JoinGame
619622
// put the bot into the game.
@@ -695,6 +698,7 @@ void BOT_DMClass_JoinGame (edict_t *ent, char *team_name)
695698
ent->svflags &= ~SVF_NOCLIENT;
696699
ent->client->ps.gunindex = 0;
697700

701+
BOT_DMclass_InitPersistantWeights(ent);//GHz: moved here because weights are adjusted based on class selection
698702
PutClientInServer(ent);
699703

700704
if (!KillBox (ent))
@@ -791,7 +795,7 @@ void BOT_SpawnBot (char *team, char *name, char *skin, char *userinfo, char *cla
791795
AI_ResetWeights(bot);
792796
AI_ResetNavigation(bot);
793797

794-
bot->think = BOT_JoinGame;
798+
bot->think = BOT_JoinGame; // note: this randomly assigns a class if one is not already set
795799

796800
// players should join before bots
797801
float delay = 0;

src/combat/abilities/gloom.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1518,6 +1518,8 @@ edict_t *CreateObstacle (edict_t *ent, int skill_level, int talent_level)
15181518
e->light_level = talent_level; // Talent: Magnetism
15191519
e->monsterinfo.sight_range = (0.2 * MAGMINE_RANGE) * talent_level; // range
15201520
e->count = MAGMINE_DEFAULT_PULL + (2 * MAGMINE_ADDON_PULL * talent_level); // pull
1521+
e->radius_dmg = e->dmg; // for bot AI hazard detection
1522+
e->dmg_radius = e->monsterinfo.sight_range; // for bot AI hazard detection
15211523
//gi.dprintf("magnetism: level: %d range: %.0f pull: %d\n", e->light_level, e->monsterinfo.sight_range, e->style);
15221524
}
15231525
e->gib_health = -2 * BASE_GIB_HEALTH;
@@ -2690,7 +2692,7 @@ void cocoon_touch (edict_t *ent, edict_t *other, cplane_t *plane, csurface_t *su
26902692
return;
26912693
if (level.framenum < ent->monsterinfo.nextattack)
26922694
return;
2693-
if (!G_ValidTargetEnt(other, true) || !OnSameTeam(ent, other))
2695+
if (!G_ValidTargetEnt(ent, other, true) || !OnSameTeam(ent, other))
26942696
return;
26952697
if (other->mtype == M_SPIKEBALL)//4.4
26962698
return;

src/combat/abilities/magic.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ void StaticFieldAttack (edict_t* ent, int cripple_level)
563563

564564
while ((target = findradius(target, ent->s.origin, STATICFIELD_RANGE)) != NULL)
565565
{
566-
if (!G_ValidTargetEnt(target, false) || OnSameTeam(ent, target))
566+
if (!G_ValidTargetEnt(ent, target, false) || OnSameTeam(ent, target))
567567
continue;
568568
// limit maximum damage inflicted to bosses and others to a percentage of max health
569569
if (target->monsterinfo.control_cost >= 3)

src/combat/abilities/meteor.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ void MeteorAttack (edict_t *ent, int damage, int radius, int speed, float skill_
175175
tr = gi.trace (start, NULL, NULL, end, ent, MASK_SHOT);
176176

177177
// aimed at something?
178-
if (G_ValidTargetEnt(tr.ent, false))
178+
if (G_ValidTargetEnt(ent, tr.ent, false))
179179
VectorCopy(tr.ent->s.origin, start);
180180
else
181181
VectorCopy(tr.endpos, start);

0 commit comments

Comments
 (0)