void gunner_attack(edict_t *self) { float chance, r; monster_done_dodge(self); // PMM if (self->monsterinfo.attack_state == AS_BLIND) { // setup shot probabilities if (self->monsterinfo.blind_fire_delay < 1.0) chance = 1.0; else if (self->monsterinfo.blind_fire_delay < 7.5) chance = 0.4; else chance = 0.1; r = random(); // minimum of 2 seconds, plus 0-3, after the shots are done self->monsterinfo.blind_fire_delay += 2.1 + 2.0 + random()*3.0; // don't shoot at the origin if (VectorCompare (self->monsterinfo.blind_fire_target, vec3_origin)) return; // don't shoot if the dice say not to if (r > chance) { return; } // turn on manual steering to signal both manual steering and blindfire self->monsterinfo.aiflags |= AI_MANUAL_STEERING; if (gunner_grenade_check(self)) { // if the check passes, go for the attack self->monsterinfo.currentmove = &gunner_move_attack_grenade; self->monsterinfo.attack_finished = level.time + 2*random(); } // turn off blindfire flag self->monsterinfo.aiflags &= ~AI_MANUAL_STEERING; return; } // pmm // PGM - gunner needs to use his chaingun if he's being attacked by a tesla. if ((range (self, self->enemy) == RANGE_MELEE) || self->bad_area) { self->monsterinfo.currentmove = &gunner_move_attack_chain; } else { if (random() <= 0.5 && gunner_grenade_check(self)) self->monsterinfo.currentmove = &gunner_move_attack_grenade; else self->monsterinfo.currentmove = &gunner_move_attack_chain; } }
void gunner_attack(edict_t *self) { if (range (self, self->enemy) == RANGE_MELEE) { self->monsterinfo.currentmove = &gunner_move_attack_chain; } else { // Lazarus: Added bit of logic to check whether grenades are good to fire, // and made it more likely to fire grenades on harder skill levels if (random() <= (0.5 + 0.05*skill->value) && gunner_grenade_check(self) ) self->monsterinfo.currentmove = &gunner_move_attack_grenade; else self->monsterinfo.currentmove = &gunner_move_attack_chain; } }
void gunner_duck_down (edict_t *self) { if (self->monsterinfo.aiflags & AI_DUCKED) return; self->monsterinfo.aiflags |= AI_DUCKED; if (skill->value >= 2) { // Lazarus: Added check for goodness of grenade firing if (random() > 0.5 && gunner_grenade_check(self)) GunnerGrenade (self); } self->maxs[2] -= 32; self->takedamage = DAMAGE_YES; self->monsterinfo.pausetime = level.time + 1; gi.linkentity (self); }