void MoveClientToIntermission (edict_t *ent) { ent->client->showscores = true; // VectorCopy (level.intermission_origin, ent->s.origin); ent->client->ps.pmove.origin[0] = level.intermission_origin[0]*8; ent->client->ps.pmove.origin[1] = level.intermission_origin[1]*8; ent->client->ps.pmove.origin[2] = level.intermission_origin[2]*8; VectorCopy (level.intermission_angle, ent->client->ps.viewangles); ent->client->ps.pmove.pm_type = PM_FREEZE; ent->client->ps.gunindex = 0; ent->client->ps.blend[3] = 0; VectorCopy (level.intermission_origin, ent->s.origin); // clean up powerup info ent->client->quad_framenum = 0; ent->client->invincible_framenum = 0; ent->client->breather_framenum = 0; ent->client->enviro_framenum = 0; ent->client->grenade_blew_up = false; ent->client->grenade_time = 0; // RemoveAllAuras(ent); // RemoveAllCurses(ent); AuraRemove(ent, 0); CurseRemove(ent, 0); // RAFAEL ent->client->quadfire_framenum = 0; // RAFAEL //ent->client->trap_blew_up = false; //ent->client->trap_time = 0; ent->viewheight = 0; ent->s.modelindex = 0; ent->s.modelindex2 = 0; ent->s.modelindex3 = 0; ent->s.modelindex = 0; ent->s.effects = 0; ent->s.sound = 0; ent->solid = SOLID_NOT; // add the layout if (deathmatch->value && !(ent->svflags & SVF_MONSTER)) { DeathmatchScoreboardMessage (ent, NULL); gi.unicast (ent, true); } }
void Cmd_Purge_f (edict_t *ent) { //Talent: Purge int talentLevel = getTalentLevel(ent, TALENT_PURGE); if (talentLevel < 1) { safe_cprintf(ent, PRINT_HIGH, "You need to upgrade this talent before you can use it!\n"); return; } if (ent->client->ability_delay > level.time) { safe_cprintf(ent, PRINT_HIGH, "You must wait %.1f seconds before you can use this talent.\n", ent->client->ability_delay-level.time); return; } if (ent->client->pers.inventory[power_cube_index] < PURGE_COST) { safe_cprintf(ent, PRINT_HIGH, "You need %d cubes before you can use this talent.\n", PURGE_COST-ent->client->pers.inventory[power_cube_index]); return; } //Give them a short period of total immunity ent->client->invincible_framenum = level.framenum + 3*talentLevel; //up to 2 seconds at level 5 //Give them a short period of curse immunity ent->holywaterProtection = level.time + talentLevel; //up to 5 seconds at level 5 //You can only drink 1/sec ent->client->ability_delay = level.time + PURGE_DELAY; //Remove all curses CurseRemove(ent, 0); ent->client->pers.inventory[power_cube_index] -= PURGE_COST; ent->client->ability_delay = level.time + PURGE_DELAY; gi.sound(ent, CHAN_AUTO, gi.soundindex("spells/purification.wav"), 1, ATTN_NORM, 0); }
void p_medic_heal (edict_t *ent) { vec3_t forward, right, offset, start, end, org; trace_t tr; if (!p_medic_healframe(ent)) return; if (ent->s.frame == 218) gi.sound (ent, CHAN_WEAPON, gi.soundindex("medic/medatck2.wav"), 1, ATTN_NORM, 0); else if (ent->s.frame == 227) gi.sound (ent, CHAN_WEAPON, gi.soundindex("medic/medatck5.wav"), 1, ATTN_NORM, 0); // get muzzle location AngleVectors (ent->s.angles, forward, right, NULL); VectorCopy(p_medic_cable_offsets[ent->s.frame - 218], offset); G_ProjectSource(ent->s.origin, offset, forward, right, org); // get end position VectorCopy(ent->s.origin, start); start[2] += ent->viewheight; AngleVectors (ent->client->v_angle, forward, NULL, NULL); VectorMA(start, MEDIC_CABLE_RANGE, forward, end); tr = gi.trace (org, NULL, NULL, end, ent, MASK_SHOT); // bfg laser effect gi.WriteByte (svc_temp_entity); gi.WriteByte (TE_BFG_LASER); gi.WritePosition (org); gi.WritePosition (tr.endpos); gi.multicast (ent->s.origin, MULTICAST_PHS); if (G_EntExists(tr.ent)) { // try to heal them if they are alive if ((tr.ent->deadflag != DEAD_DEAD) && (tr.ent->health > 0)) { int frames = floattoint(600/(float)ent->myskills.abilities[MEDIC].current_level); if (!M_NeedRegen(tr.ent)) return; if (ent->s.frame == 220) gi.sound (ent, CHAN_WEAPON, gi.soundindex ("medic/medatck4.wav"), 1, ATTN_NORM, 0); // heal them M_Regenerate(tr.ent, frames, 0, 1.0, true, true, false, &tr.ent->monsterinfo.regen_delay2); // hold monsters in-place if (tr.ent->svflags & SVF_MONSTER) tr.ent->holdtime = level.time + 0.2; // remove all curses CurseRemove(tr.ent, 0); //Give them a short period of curse immunity tr.ent->holywaterProtection = level.time + 2.0; //2 seconds immunity } else { // try to reanimate/resurrect the corpse p_medic_reanimate(ent, tr.ent); } } }
void mymedic_cable_attack (edict_t *self) { vec3_t forward, right, start, offset, end; trace_t tr; // need a valid target and activator if (!self || !self->inuse || !self->activator || !self->activator->inuse || !self->enemy || !self->enemy->inuse) return; // make sure target is still in range if (entdist(self, self->enemy) > 256) return; // get muzzle location AngleVectors(self->s.angles, forward, right, NULL); VectorCopy(mymedic_cable_offsets[self->s.frame - FRAME_attack42], offset); G_ProjectSource(self->s.origin, offset, forward, right, start); // get end position //VectorCopy(self->enemy->s.origin, end); //end[2] = self->enemy->absmax[2]-8; G_EntMidPoint(self->enemy, end); tr = gi.trace (start, NULL, NULL, end, self, MASK_SHOT); if (tr.ent != self->enemy) return; // cable is blocked // cable effect gi.WriteByte (svc_temp_entity); gi.WriteByte (TE_MEDIC_CABLE_ATTACK); gi.WriteShort (self - g_edicts); gi.WritePosition (start); gi.WritePosition (tr.endpos); gi.multicast (self->s.origin, MULTICAST_PVS); // the target needs healing if (M_NeedRegen(self->enemy)) { int frames = 6000/(12*self->monsterinfo.level); if (!frames) frames = 1; // remove all curses CurseRemove(self->enemy, 0); //Give them a short period of curse immunity self->enemy->holywaterProtection = level.time + 2.0; //2 seconds immunity // heal them M_Regenerate(self->enemy, frames, 0, 1.0, true, true, false, &self->enemy->monsterinfo.regen_delay2); // hold monsters in-place if (self->enemy->svflags & SVF_MONSTER) self->enemy->holdtime = level.time + 0.2; } // the target is a dead monster and needs resurrection else if (self->enemy->health < 1) { M_Reanimate(self->activator, self->enemy, self->monsterinfo.level, 0.33, false); } }
void NatureTotem_think(edict_t *self, edict_t *caster) { edict_t *target = NULL; qboolean isSomeoneHealed = false; float cdmult = 1.0; //Find players in radius and attack them. while ((target = findradius(target, self->s.origin, TOTEM_MAX_RANGE)) != NULL) { if (G_ValidAlliedTarget(self, target, true)) { int maxHP;// = MAX_HEALTH(target); int maxArmor;// = MAX_ARMOR(target); int maxcubes;// = target->client->pers.max_powercubes; int *armor;// = &target->client->pers.inventory[body_armor_index]; int *cubes;// = &target->client->pers.inventory[ITEM_INDEX(Fdi_POWERCUBE)]; int regen_frames;//4.2 regen for non-clients if (!target->client) { regen_frames = 1000 / self->monsterinfo.level; // full-regeneration in 15 seconds at level 10 M_Regenerate(target, regen_frames, 50, 1.0, true, true, false, &target->monsterinfo.regen_delay2); continue; } maxHP = MAX_HEALTH(target); maxArmor = MAX_ARMOR(target); maxcubes = target->client->pers.max_powercubes; armor = &target->client->pers.inventory[body_armor_index]; cubes = &target->client->pers.inventory[ITEM_INDEX(Fdi_POWERCUBE)]; //Heal their health. if(target->health < maxHP) { target->health += NATURETOTEM_HEALTH_BASE + self->monsterinfo.level * NATURETOTEM_HEALTH_MULT; if(target->health > maxHP) target->health = maxHP; isSomeoneHealed = true; } //Heal their armor. if(*armor < maxArmor) { *armor += NATURETOTEM_ARMOR_BASE + self->monsterinfo.level * NATURETOTEM_ARMOR_MULT; if(*armor > maxArmor) *armor = maxArmor; isSomeoneHealed = true; } //Talent: Peace. if(*cubes < maxcubes) { //Give them 5 cubes per talent point. *cubes += getTalentLevel(caster, TALENT_PEACE) * 10; if(*cubes > maxcubes) *cubes = maxcubes; isSomeoneHealed = true; } // We remove curses. -az CurseRemove(target, 0); } } //Play a sound or something. if(isSomeoneHealed) { gi.sound(self, CHAN_ITEM, gi.soundindex("items/n_health.wav"), 1, ATTN_NORM, 0); } cdmult = level.time + NATURETOTEM_REFIRE_BASE + NATURETOTEM_REFIRE_MULT * self->monsterinfo.level; if (cdmult <= level.time) cdmult = level.time + 0.1; //Next think. self->delay = cdmult; }