zombiesurvival-evolved/gamemodes/zombiesurvival/gamemode/zombieclasses/ghoul.lua
JetBoom 53743b1aee Merge with current nox changes.
Random starting loadouts now include things that aren't weapons (ammo,
traits, etc.).
Added an option to disable the automatic suicide when changing zombie
classes.
Zombies will no longer receive damage resistance when only one human
remains.
Players can no longer claim the arsenal crate that gets spawned in the
human spawn when nobody has one. Any player can pack it up though.
The Ghoul's ghoul touch special ability has been changed. It will no
longer slow targets but will debuff them for the next 10 seconds. They
will take 40% more damage (the extra damage is attributed to the person
who ghoul touched them last) for the next 10 seconds as well as slightly
disorienting them.
The Ghoul movement speed has been reduced from 185 to 170.
Added crafting recipe: 'Waraxe' Handgun. Combine two 'Battleaxe'
Handguns to craft this. Slightly better version of the Owens.
The Flesh Creeper model has been changed to one that doesn't have
severely awkward hitboxes.
The Flesh Creeper can no longer jump and attack at the same time.
The Lead Pipe special trait has been changed from a disorientation to a
severe view punch/snap on a global cooldown of 1.5 seconds.
The Regenerative trait is now 1 health every 6 seconds under 50% health
instead of 1 health every 5 seconds under 50% health.
Fast Zombie Legs have been changed to be a slightly faster but slightly
weaker version of Zombie Legs.
Zombies that have just spawned or enter zombie gas will now have a
temporary buff which gives 25% extra speed and 40% damage resistance.
This buff lasts for 3 seconds and is refreshed by entering the gas. Gas
will no longer heal. Zombies with this buff on will strobe dark green.
Added crafting recipe: Bladehack. Combine a saw blade with a manhack to
get this. Slower but has more health, does more damage, and has less of
a knockback when hitting something.
Resupply Boxes now award the owner a point for every 2 people who use
their box instead of every single person (so half as many points).
Fixed Fast Zombie Legs spawning much more abundantly than intended.
Fixed Flesh Creepers not being able to jump over obstacles due to their
insanely low jump height.
Fixed zombies taking themselves in to account when calculating horde
damage resistance (bosses always had full resistance because of this).
Fixed allowing people to use worth menu after redeeming.
2014-11-07 00:03:40 -05:00

199 lines
5 KiB
Lua

CLASS.Name = "Ghoul"
CLASS.TranslationName = "class_ghoul"
CLASS.Description = "description_ghoul"
CLASS.Help = "controls_ghoul"
CLASS.Wave = 0
CLASS.Unlocked = true
CLASS.Health = 150
CLASS.Speed = 160
CLASS.Points = 4
CLASS.CanTaunt = true
CLASS.SWEP = "weapon_zs_ghoul"
CLASS.Model = Model("models/player/corpse1.mdl")
CLASS.VoicePitch = 0.7
CLASS.CanFeignDeath = true
function CLASS:PlayPainSound(pl)
pl:EmitSound("npc/zombie_poison/pz_warn"..math.random(2)..".wav", 75, math.Rand(137, 143))
return true
end
function CLASS:PlayDeathSound(pl)
pl:EmitSound("npc/zombie_poison/pz_die2.wav", 75, math.Rand(122, 128))
return true
end
local mathrandom = math.random
local StepSounds = {
"npc/zombie/foot1.wav",
"npc/zombie/foot2.wav",
"npc/zombie/foot3.wav"
}
local ScuffSounds = {
"npc/zombie/foot_slide1.wav",
"npc/zombie/foot_slide2.wav",
"npc/zombie/foot_slide3.wav"
}
function CLASS:PlayerFootstep(pl, vFootPos, iFoot, strSoundName, fVolume, pFilter)
if mathrandom() < 0.15 then
pl:EmitSound(ScuffSounds[mathrandom(#ScuffSounds)], 70)
else
pl:EmitSound(StepSounds[mathrandom(#StepSounds)], 70)
end
return true
end
function CLASS:PlayerStepSoundTime(pl, iType, bWalking)
if iType == STEPSOUNDTIME_NORMAL or iType == STEPSOUNDTIME_WATER_FOOT then
return 625 - pl:GetVelocity():Length()
elseif iType == STEPSOUNDTIME_ON_LADDER then
return 600
elseif iType == STEPSOUNDTIME_WATER_KNEE then
return 750
end
return 450
end
function CLASS:KnockedDown(pl, status, exists)
pl:AnimResetGestureSlot(GESTURE_SLOT_ATTACK_AND_RELOAD)
end
function CLASS:CalcMainActivity(pl, velocity)
local feign = pl.FeignDeath
if feign and feign:IsValid() then
if feign:GetDirection() == DIR_BACK then
pl.CalcSeqOverride = pl:LookupSequence("zombie_slump_rise_02_fast")
else
pl.CalcIdeal = ACT_HL2MP_ZOMBIE_SLUMP_RISE
end
return true
end
if pl:WaterLevel() >= 3 then
pl.CalcIdeal = ACT_HL2MP_SWIM_PISTOL
return true
end
if velocity:Length2D() <= 0.5 then
if pl:Crouching() then
pl.CalcIdeal = ACT_HL2MP_IDLE_CROUCH_ZOMBIE
else
pl.CalcIdeal = ACT_HL2MP_IDLE_ZOMBIE
end
elseif pl:Crouching() then
pl.CalcIdeal = ACT_HL2MP_WALK_CROUCH_ZOMBIE_01 - 1 + math.ceil((CurTime() / 4 + pl:EntIndex()) % 3)
else
pl.CalcIdeal = ACT_HL2MP_WALK_ZOMBIE_01 - 1 + math.ceil((CurTime() / 4 + pl:EntIndex()) % 3)
end
return true
end
function CLASS:UpdateAnimation(pl, velocity, maxseqgroundspeed)
local feign = pl.FeignDeath
if feign and feign:IsValid() then
if feign:GetState() == 1 then
pl:SetCycle(1 - math.max(feign:GetStateEndTime() - CurTime(), 0) * 0.666)
else
pl:SetCycle(math.max(feign:GetStateEndTime() - CurTime(), 0) * 0.666)
end
pl:SetPlaybackRate(0)
return true
end
local len2d = velocity:Length2D()
if len2d > 0.5 then
pl:SetPlaybackRate(math.min(len2d / maxseqgroundspeed * 0.666, 3))
else
pl:SetPlaybackRate(1)
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
end
end
function CLASS:DoesntGiveFear(pl)
return pl.FeignDeath and pl.FeignDeath:IsValid()
end
--[[local function CreateFlesh(pl, damage, damagepos, damagedir)
damage = math.min(damage, 100)
pl:EmitSound("physics/body/body_medium_break"..math.random(2, 4)..".wav", 74, 125 - damage * 0.50)
if SERVER then
local damagepos = pl:LocalToWorld(damagepos)
for i=1, math.max(1, math.floor(damage / 15)) do
local ent = ents.Create("projectile_poisonflesh")
if ent:IsValid() then
local heading = (damagedir + VectorRand() * 0.3):GetNormalized()
ent:SetPos(damagepos + heading)
ent:SetOwner(pl)
ent:Spawn()
ent:SetTeamID(TEAM_UNDEAD)
local phys = ent:GetPhysicsObject()
if phys:IsValid() then
phys:Wake()
phys:SetVelocityInstantaneous(math.min(350, 16 + damage ^ math.Rand(1.15, 1.25)) * heading)
end
end
end
end
end
function CLASS:ProcessDamage(pl, dmginfo)
local attacker, damage = dmginfo:GetAttacker(), dmginfo:GetDamage()
if attacker ~= pl and damage >= 5 and damage < pl:Health() and CurTime() >= (pl.m_NextGhoulEmit or 0) then
pl.m_NextGhoulEmit = CurTime() + 0.25
local pos = pl:WorldToLocal(dmginfo:GetDamagePosition())
local norm = dmginfo:GetDamageForce():GetNormalized() * -1
timer.Simple(0, function()
if pl:IsValid() then
CreateFlesh(pl, damage, pos, norm)
end
end)
end
end]]
if SERVER then
function CLASS:AltUse(pl)
pl:StartFeignDeath()
end
--[[function CLASS:OnKilled(pl, attacker, inflictor, suicide, headshot, dmginfo, assister)
local damage = dmginfo:GetDamage()
if damage >= 5 then
local pos = pl:WorldToLocal(dmginfo:GetDamagePosition())
local norm = dmginfo:GetDamageForce():GetNormalized() * -1
timer.Simple(0, function()
if pl:IsValid() then
CreateFlesh(pl, math.max(30, damage * 2), pos, norm)
end
end)
end
end]]
end
if not CLIENT then return end
CLASS.Icon = "zombiesurvival/killicons/ghoul"