Skip to content

Commit a18c73b

Browse files
Merged infection/poison features into one
-Removed poison condition -Changed infection to work differently. Whenever a hive zombie bites with infection skills, a human will be infected, causing the condition to be dormant for a period of time and then once active deal continous damage
1 parent 561ed0b commit a18c73b

File tree

9 files changed

+66
-221
lines changed

9 files changed

+66
-221
lines changed

code/item/weapon/class.lua

Lines changed: 7 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@ function weapon:isSingleUse() return self.one_use or false end
2424
function weapon:hasConditionEffect(player)
2525
if self:getClassName() == 'claw' and not player.skills:check('grapple') then
2626
return false -- if attacking with claws and missing grapple skill then no condition effect
27+
elseif self:getClassName() == 'bite' and not player.skills:check('infection') then
28+
return false -- if attacking with bite and missing infection skill then no condition effect
2729
end
30+
2831
return (self.condition_effect and true) or false
2932
end
3033

@@ -96,7 +99,7 @@ local organic_modifier = {
9699
},
97100
bite = {
98101
dice={'1d5+1', '1d5+2'},
99-
included_skills={'bite', 'power_bite'},
102+
included_skills={'bite', 'bite_adv'},
100103
},
101104
fist = {
102105
dice={'1d2'},
@@ -123,9 +126,9 @@ function weapon:getDice(player, condition)
123126
if skill_count > 0 then
124127
local dice_str = organic_modifier.dice[skill_count]
125128
weapon_dice = dice:new(dice_str)
126-
end
127-
end
129+
end
128130
-- else organic weapon has no modifier or player lacks all included skills then use weapons default dice
131+
end
129132
end
130133

131134
local mastered_skill = self:getMasterSkill()
@@ -139,18 +142,6 @@ function weapon:getDice(player, condition)
139142
return tostring(weapon_dice)
140143
end
141144

142-
local skill_effects = {
143-
poison = {
144-
order = {'venom_adv', 'venom', 'stinger'},
145-
stinger = {duration = '1d2+2', amount='1d5+10'},
146-
venom = {duration = '1d3+2', amount='1d7+15'},
147-
venom_adv = {duration = '1d4+3', amount='1d10+20'},
148-
},
149-
entangle = {
150-
151-
}
152-
}
153-
154145
function weapon:getConditionEffect(player) --, condition) maybe for later...?
155146
local effect = self.condition_effect
156147
local duration, bonus_effect
@@ -159,21 +150,9 @@ function weapon:getConditionEffect(player) --, condition) maybe for later...?
159150
if effect == 'burn' then
160151
duration = weapon:getFuelAmount()
161152
bonus_effect = weapon:isCombustionSource()
162-
elseif effect == 'decay' then
163-
164153
end
165154
elseif player:isMobType('zombie') then
166-
if effect == 'poison' then
167-
for _, skill in ipairs(skill_effects.poison.order) do
168-
if player.skills:check(skill) then
169-
duration = skill_effects.poison[skill].duration
170-
bonus_effect = skill_effects.poison[skill].amount
171-
break
172-
end
173-
end
174-
elseif effect == 'infection' then
175-
176-
elseif effect == 'entangle' then
155+
if effect == 'entangle' then
177156
if player.skills:check('impale') then bonus_effect = true end -- possible to impale on crit hit
178157
end
179158
end

code/item/weapon/list.lua

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,7 @@ weapon.claw.critical = 0.05
267267
weapon.claw.organic = 'zombie'
268268
weapon.claw.object_damage = {barricade=1, door=1, equipment=1}
269269
weapon.claw.condition_effect = 'entangle'
270+
weapon.claw.master_skill = 'claw_adv'
270271

271272
weapon.bite = {}
272273
weapon.bite.full_name = 'bite'
@@ -277,22 +278,8 @@ weapon.bite.dice = '1d4+1'
277278
weapon.bite.accuracy = 0.20
278279
weapon.bite.critical = 0.05
279280
weapon.bite.organic = 'zombie'
280-
281-
--[[
282-
--- PROJECTILE
283-
--]]
284-
285-
weapon.sting = {}
286-
weapon.sting.full_name = 'sting'
287-
weapon.sting.attack_style = 'ranged'
288-
weapon.sting.damage_type = 'bullet'
289-
weapon.sting.group = {'stinger'}
290-
weapon.sting.dice = '1d2'
291-
weapon.sting.accuracy = 0.15
292-
weapon.sting.critical = 0.05
293-
weapon.sting.organic = 'zombie'
294-
weapon.sting.condition_effect = 'poison'
295-
weapon.sting.skill_required = 'stinger'
281+
weapon.bite.condition_effect = 'infection'
282+
weapon.bite.master_skill = 'bite_adv'
296283

297284
--[[
298285
--- BURN

code/player/action/outcome.lua

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,16 @@ function Outcome.attack(player, target, weapon, inv_ID)
107107
if effect == 'entangle' then
108108
local impale_bonus = bonus_effect and critical
109109
entangle.add(player, target, impale_bonus)
110+
elseif effect == 'infection' then
111+
-- infection_adv skill makes bites auto infect, infection skill requires a zombie to be entagled with the target to infect with bite
112+
if player.skills:check('infection_adv') or (player.skills:check('infection') and entangle.isTangledTogether(player, target)) then
113+
if not target.condition.infection:isImmune() or target.condition.infection:isActive() then --target cannot be immune or infection already active
114+
target.condition.infection:add()
115+
--print('A zombie has infected the target')
116+
-- should probably add an infection message to the ZOMBIE only! A human shouldn't be notfied immediately until damage is taken
117+
-- also should probably look at refactoring the msg system for player.log to make this easier
118+
end
119+
end
110120
else -- normal effect process
111121
target.condition[effect]:add(duration, bonus_effect)
112122
end

code/player/condition/class.lua

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
local class = require('code.libs.middleclass')
2-
local poison = require('code.player.condition.poison')
32
local infection = require('code.player.condition.infection')
43
local burn = require('code.player.condition.burn')
54
local decay = require('code.player.condition.decay')
@@ -14,7 +13,6 @@ local condition = class('condition')
1413
function condition:initialize(player)
1514
if player:isMobType('human') then
1615
-- insert status conditions?
17-
self.poison = poison:new()
1816
self.infection = infection:new()
1917
elseif player:isMobType('zombie') then
2018
self.burn = burn:new()
@@ -30,7 +28,7 @@ function condition:isActive(effect)
3028
end
3129

3230
local condition_list = {
33-
human = {'poison', 'infection'},
31+
human = {'infection'},
3432
zombie = {'burn', 'decay'},
3533
-- tracking:elapse() is used ONLY during server ticks, not during players actions
3634
}

code/player/condition/infection.lua

Lines changed: 29 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,44 @@
11
local class = require('code.libs.middleclass')
2+
local dice = require('code.libs.dice')
23

34
local infection = class('infection')
45

5-
local MAX_TIME = 1023
6+
local MAX_TIME = 511
7+
local INCUBATION_DEFAULT = '1d1' --'1d80+20'
8+
local INFECTION_DAMAGE_PER_TICK = -1
69

710
function infection:initialize()
8-
self.time = 0
11+
self.incubation_timer = 0
12+
self.is_infected = false
913
end
1014

11-
function infection:add(amount, player)
12-
self.time = math.max(self.time + amount, 0)
13-
if self.time >= MAX_TIME then
14-
player:killed('infection')
15-
end
15+
function infection:add()
16+
print('Player has just been infected!')
17+
self.incubation_timer = dice.roll(INCUBATION_DEFAULT)
18+
self.is_infected = true
1619
end
1720

18-
function infection:elapse(player, time)
19-
self:add(time, player)
21+
function infection:remove(player)
22+
print('Player has been cured of infection!')
23+
self.incubation_timer = 0
24+
self.is_infected = false
2025
end
2126

22-
function infection:getTime() return self.time end
27+
function infection:addImmunity(time) self.incubation_timer = math.min(MAX_TIME, self.incubation_timer + time) end
28+
29+
function infection:isActive() return self.is_infected end
2330

24-
return infection
31+
function infection:isImmune() return (self.is_infected and self.incubation_timer > 0) end
2532

26-
--[[
27-
you have 0 infection = aka 21 days to live
28-
you get attacked lose about 30 hp from bites
29-
ie... make infection 1d2, 1d3, 1d4 from bites?
33+
function infection:elapse(player, time)
34+
if not self.is_infected then return end
35+
36+
if self.incubation_timer > 0 then
37+
self.incubation_timer = math.max(self.incubation_timer - time, 0)
38+
else -- infection is no longer dormant
39+
player:updateStat('hp', INFECTION_DAMAGE_PER_TICK)
40+
print('Player takes damage for infection!')
41+
end
42+
end
3043

31-
21 days
32-
knockoff @ 60 hp (ie. 59 damage) should remove 5/7 days?
33-
7x50 = 350
34-
5x50 = 250
35-
3x50 = 150
36-
--]]
44+
return infection

code/player/condition/poison.lua

Lines changed: 0 additions & 126 deletions
This file was deleted.

code/player/skills/flags.lua

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,8 @@ local skill_flags = {
120120
acid_adv = 32,
121121
ruin = 64,
122122
ransack = 128,
123-
homewrecker = 256,
124-
stinger = 512,
125-
venom = 1024,
126-
venom_adv = 2048,
123+
infection = 256,
124+
infection_adv = 512,
127125
}
128126

129127
return skill_flags

0 commit comments

Comments
 (0)