zombiesurvival-evolved/gamemodes/zombiesurvival/gamemode/zombieclasses/boss_howler.lua

148 lines
3.8 KiB
Lua
Raw Normal View History

CLASS.Name = "Howler"
CLASS.TranslationName = "class_howler"
CLASS.Description = "description_howler"
CLASS.Help = "controls_howler"
CLASS.Boss = true
CLASS.KnockbackScale = 0
CLASS.FearPerInstance = 1
CLASS.CanTaunt = true
CLASS.Points = 40
CLASS.SWEP = "weapon_zs_howler"
CLASS.Model = Model("models/player/zombie_classic_hbfix.mdl")
CLASS.OverrideModel = Model("models/player/zombie_lacerator2.mdl")
CLASS.Health = 2750
CLASS.Speed = 175
CLASS.VoicePitch = 0.65
CLASS.ModelScale = 1.2
CLASS.Hull = {Vector(-16, -16, 0), Vector(16, 16, 72)}
CLASS.HullDuck = {Vector(-16, -16, 0), Vector(16, 16, 36)}
CLASS.ViewOffset = DEFAULT_VIEW_OFFSET * CLASS.ModelScale
CLASS.ViewOffsetDucked = DEFAULT_VIEW_OFFSET_DUCKED * CLASS.ModelScale
CLASS.StepSize = 25
CLASS.Mass = DEFAULT_MASS * CLASS.ModelScale
local math_random = math.random
local math_min = math.min
local math_ceil = math.ceil
local CurTime = CurTime
local DIR_BACK = DIR_BACK
local ACT_INVALID = ACT_INVALID
local ACT_HL2MP_SWIM_PISTOL = ACT_HL2MP_SWIM_PISTOL
local ACT_HL2MP_IDLE_CROUCH_ZOMBIE = ACT_HL2MP_IDLE_CROUCH_ZOMBIE
local ACT_HL2MP_WALK_CROUCH_ZOMBIE_01 = ACT_HL2MP_WALK_CROUCH_ZOMBIE_01
local ACT_HL2MP_RUN_ZOMBIE = ACT_HL2MP_RUN_ZOMBIE
local ACT_GMOD_GESTURE_TAUNT_ZOMBIE = ACT_GMOD_GESTURE_TAUNT_ZOMBIE
function CLASS:ScalePlayerDamage(pl, hitgroup, dmginfo)
return true
end
function CLASS:IgnoreLegDamage(pl, dmginfo)
return true
end
function CLASS:PlayerStepSoundTime(pl, iType, bWalking)
return GAMEMODE.BaseClass.PlayerStepSoundTime(GAMEMODE.BaseClass, pl, iType, bWalking) * 1.8
end
function CLASS:PlayDeathSound(pl)
pl:EmitSound("npc/antlion_guard/antlion_guard_die"..math_random(2)..".wav", 100, math_random(80, 90))
return true
end
function CLASS:PlayPainSound(pl)
pl:EmitSound("npc/combine_gunship/gunship_pain.wav", 75, math_random(85, 95))
pl.NextPainSound = CurTime() + 1.5
return true
end
local StepSounds = {
"npc/zombie/foot1.wav",
"npc/zombie/foot2.wav",
"npc/zombie/foot3.wav"
}
function CLASS:PlayerFootstep(pl, vFootPos, iFoot, strSoundName, fVolume, pFilter)
pl:EmitSound(StepSounds[math_random(#StepSounds)], 77, 50)
if iFoot == 0 then
pl:EmitSound("^npc/strider/strider_step4.wav", 90, math_random(95, 115))
else
pl:EmitSound("^npc/strider/strider_step5.wav", 90, math_random(95, 115))
end
return true
end
function CLASS:CalcMainActivity(pl, velocity)
if pl:WaterLevel() >= 3 then
return ACT_HL2MP_SWIM_PISTOL, -1
elseif pl:Crouching() then
if velocity:Length2DSqr() <= 1 then
return ACT_HL2MP_IDLE_CROUCH_ZOMBIE, -1
else
return ACT_HL2MP_WALK_CROUCH_ZOMBIE_01 - 1 + math_ceil((CurTime() / 4 + pl:EntIndex()) % 3), -1
end
else
return ACT_HL2MP_RUN_ZOMBIE, -1
end
return true
end
function CLASS:UpdateAnimation(pl, velocity, maxseqgroundspeed)
local len2d = velocity:Length2D()
if len2d > 1 then
pl:SetPlaybackRate(math_min(len2d / maxseqgroundspeed * 0.5 , 3))
else
pl:SetPlaybackRate(1 / self.ModelScale)
end
return true
end
function CLASS:DoAnimationEvent(pl, event, data)
if event == PLAYERANIMEVENT_ATTACK_PRIMARY then
pl:AnimRestartGesture(GESTURE_SLOT_ATTACK_AND_RELOAD, ACT_GMOD_GESTURE_RANGE_ZOMBIE, true)
return ACT_INVALID
elseif event == PLAYERANIMEVENT_RELOAD then
pl:AnimRestartGesture(GESTURE_SLOT_ATTACK_AND_RELOAD, ACT_GMOD_GESTURE_TAUNT_ZOMBIE, true)
return ACT_INVALID
end
end
if SERVER then
function CLASS:ProcessDamage(pl, dmginfo)
local wep = pl:GetActiveWeapon()
if wep:IsValid() and wep.GetBattlecry and wep:GetBattlecry() > CurTime() then
dmginfo:SetDamage(dmginfo:GetDamage() * 0.5)
end
end
function CLASS:OnKilled(pl, attacker, inflictor, suicide, headshot, dmginfo)
local fakedeath = pl:FakeDeath(234, self.ModelScale)
if fakedeath and fakedeath:IsValid() then
fakedeath:SetModel(self.OverrideModel)
end
return true
end
end
if not CLIENT then return end
CLASS.Icon = "zombiesurvival/killicons/howler"