/* * $Header: /HexenWorld/HCode/COMBAT.hc 4 4/23/98 5:15p Mgummelt $ */ void(vector org, vector vel, float damage, entity victim) SpawnPuff; float MetalHitSound (float targettype) { if(targettype==THINGTYPE_FLESH) { sound (self, CHAN_WEAPON, "weapons/met2flsh.wav", 1, ATTN_NORM); return TRUE; } else if(targettype==THINGTYPE_WOOD||targettype==THINGTYPE_DIRT) { sound (self, CHAN_WEAPON, "weapons/met2wd.wav", 1, ATTN_NORM); return TRUE; } else if(targettype==THINGTYPE_METAL) { sound (self, CHAN_WEAPON, "weapons/met2met.wav", 1, ATTN_NORM); return TRUE; } else if(targettype==THINGTYPE_BROWNSTONE||targettype==THINGTYPE_GREYSTONE) { sound (self, CHAN_WEAPON, "weapons/met2stn.wav", 1, ATTN_NORM); return TRUE; } return FALSE; } /* ================ FireMelee ================ */ void FireMelee (float damage_base,float damage_mod,float attack_radius) { vector source; vector org; float damg, backstab; float chance,point_chance; makevectors (self.v_angle); source = self.origin+self.proj_ofs; traceline (source, source + v_forward*64, FALSE, self); if (trace_fraction == 1.0) { traceline (source, source + v_forward*64 - (v_up * 30), FALSE, self); // 30 down if (trace_fraction == 1.0) { traceline (source, source + v_forward*64 + v_up * 30, FALSE, self); // 30 up if (trace_fraction == 1.0) return; } } org = trace_endpos + (v_forward * 4); if (trace_ent.takedamage) { //FIXME:Add multiplier for level and strength if(trace_ent.flags2&FL_ALIVE&&!infront_of_ent(self,trace_ent)&&self.playerclass==CLASS_ASSASSIN&&self.weapon==IT_WEAPON1&&random(1,10) random()) { point_chance = self.level; point_chance *= random(); if (point_chance < 1) point_chance = 1; sound (self, CHAN_BODY, "weapons/drain.wav", 1, ATTN_NORM); self.health += point_chance; if (self.health>self.max_health) self.health = self.max_health; } } } } else { // hit wall sound (self, CHAN_WEAPON, "weapons/hitwall.wav", 1, ATTN_NORM); WriteByte (MSG_BROADCAST, SVC_TEMPENTITY); WriteByte (MSG_BROADCAST, TE_GUNSHOT); WriteByte (MSG_BROADCAST, 1); WriteCoord (MSG_BROADCAST, org_x); WriteCoord (MSG_BROADCAST, org_y); WriteCoord (MSG_BROADCAST, org_z); } }