Skip to content

Commit 68a749e

Browse files
Merge branch 'release-v0.4.0'
2 parents 9958c7b + dbecd62 commit 68a749e

File tree

19 files changed

+388
-19
lines changed

19 files changed

+388
-19
lines changed

code/item/class.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ local j_list = require('code.item.list.junk')
55
local m_list = require('code.item.list.medical')
66
local w_list = require('code.item.list.weaponry')
77
local a_list = require('code.item.list.ammo')
8+
local arm_list=require('code.item.list.armor')
89
local order = require('code.item.order')
910
local bit = require('plugin.bit')
1011
local lshift, rshift, bor = bit.lshift, bit.rshift, bit.bor
@@ -127,6 +128,6 @@ function item:dataToClass(...) -- this should be a middleclass function (fix lat
127128
end
128129

129130
-- turn our list of objs into item class
130-
item:dataToClass(e_list, g_list, j_list, m_list, w_list, a_list)
131+
item:dataToClass(e_list, g_list, j_list, m_list, w_list, a_list, arm_list)
131132

132133
return item

code/item/list/armor.lua

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,14 @@ armor.leather.resistance = {
2020
[3] = {blunt=1},
2121
}
2222

23+
armor.firesuit = {}
24+
armor.firesuit.full_name = 'firesuit'
25+
armor.firesuit.durability = 4
26+
armor.firesuit.resistance = {
27+
[0] = {acid=1},
28+
[1] = {acid=2},
29+
[2] = {acid=3},
30+
[3] = {acid=4},
31+
}
32+
2333
return armor

code/item/order.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ local order = {
1111
'book', 'bottle', 'newspaper',
1212
-- AMMO
1313
'pistol_mag', 'shotgun_shell', 'rifle_clip', 'quiver',
14+
-- ARMOR
15+
'firesuit', 'leather',
1416
}
1517

1618
return order

code/item/weapon/chanceToHit.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ local skill_attack_bonus = {
2929

3030
arm = {hand_stimulus=0.10, claw=0.10, claw_adv=0.15},
3131
teeth = {head_stimulus=0.10, bite=0.10, bite_adv=0.15},
32-
acid = {acid=0.05, acid_adv=0.05},
33-
stinger = {venom=0.05, venom_adv=0.10},
32+
--acid = {acid=0.05, acid_adv=0.05},
33+
--stinger = {venom=0.05, venom_adv=0.10},
3434
},
3535
}
3636

code/item/weapon/list.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,7 @@ weapon.bite.master_skill = 'bite_adv'
285285
--- BURN
286286
--]]
287287

288+
--[[ Moved to skill activation
288289
weapon.acid = {}
289290
weapon.acid.full_name = 'stomach acid'
290291
weapon.acid.attack_style = 'ranged'
@@ -294,5 +295,6 @@ weapon.acid.dice = '5d2'
294295
weapon.acid.accuracy = 0.15
295296
weapon.acid.critical = 0.30
296297
weapon.acid.organic = 'zombie'
298+
--]]
297299

298300
return weapon

code/player/action/list.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ local action_list = {
9393
armor = {name='armor', cost=1},
9494
-- hive skills
9595
ruin = {name='ruin', cost=1},
96+
acid = {name='acid', cost=1},
9697
-- hunter skills
9798
mark_prey = {name='mark prey', cost=1},
9899
track = {name='track', cost=1},

code/player/action/outcome.lua

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -112,15 +112,8 @@ function Outcome.attack(player, target, weapon, inv_ID)
112112
if player.skills:check('infection_adv') or (player.skills:check('infection') and entangle.isTangledTogether(player, target)) then
113113
if not target.condition.infection:isImmune() and not target.condition.infection:isActive() then --target cannot be immune or infection already active
114114
target.condition.infection:add()
115-
print('--------------------------------')
116-
print('A zombie has infected the target')
117-
print('--------------------------------')
118115
-- should probably add an infection message to the ZOMBIE only! A human shouldn't be notfied immediately until damage is taken
119-
-- also should probably look at refactoring the msg system for player.log to make this easier
120-
else
121-
print('--------------------------------')
122-
print('Bite was successful, but no infection')
123-
print('--------------------------------')
116+
-- also should probably look at refactoring the msg system for player.log to make this easier
124117
end
125118
end
126119
else -- normal effect process

code/player/action/zone.lua

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,12 @@ function setupZone.track(player)
138138
zone.tile = player:getTile()
139139
end
140140

141+
function setupZone.acid(player, target)
142+
zone.player = player
143+
zone.type = 'pair'
144+
zone.target = target
145+
end
146+
141147
---------------------------------------
142148
---------------------------------------
143149
-- JUST A DIVIDER --

code/player/armor/item_class.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,4 @@ function item_armor:degrade(player)
2727
self.protection = item_armor_list[self.name].resistance[self.condition]
2828
end
2929

30-
return armor
30+
return item_armor

code/player/inventory.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ local inventory = class('code.player.inventory')
77
[1] = crowbar,
88
[2] = bandage,
99
[3] = pistol,
10-
..., -- (inv_ID = inv_CL)
10+
..., -- (inv_ID = itemClass_INST)
1111
}
1212
--]]
1313

code/player/log/getMessage.lua

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,19 @@ function description.speak(player, message)
199199
msg[3] = player:getUsername()..' said: "'..message..'"'
200200
end
201201

202+
function description.acid(player, target, acid_successful, acid_immunity)
203+
if acid_successful and acid_immunity then
204+
msg[1] = 'You spray '..target:getUsername()..' with acid but it has no effect.'
205+
msg[2] = 'A zombie sprays you with acid but your inventory is protected by a firesuit.'
206+
elseif acid_successful then
207+
msg[1] = 'You spray '..target:getUsername()..' with acid.'
208+
msg[2] = 'A zombie sprays you with acid.'
209+
else
210+
msg[1] = 'You attempt to spray '..target:getUsername()..' with acid but are unsuccessful.'
211+
msg[2] = 'A zombie attempts to spray acid at you but is unsuccessful.'
212+
end
213+
end
214+
202215
---------------------------------------
203216
---------------------------------------
204217
-- JUST A DIVIDER --

code/player/skills/activate.lua

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
--local outcome = require('code.player.action.outcome')
2+
local dice = require('code.libs.dice')
23

34
local activate = {}
45

@@ -37,4 +38,33 @@ function activate.track(player)
3738
return {targets, targets_ranges}
3839
end
3940

41+
local ACID = {
42+
DEFAULT = {CHANCE = 0.15, DICE = '1d2'},
43+
CORRODE = {CHANCE = 0.20, DICE = '1d3'},
44+
ACID_ADV = {CHANCE = 0.30, DICE = '1d4'},
45+
}
46+
47+
function activate.acid(player, target)
48+
local n_items = #target.inventory
49+
local acid_resistance = target.armor:isPresent() and target.armor:getProtection('acid') or 0
50+
local target_acid_immune = acid_resistance == 4
51+
52+
local acid_type = (player.skills:check('acid_adv') and 'ACID_ADV') or (player.skills:check('corrode') and 'CORRODE') or 'DEFAULT'
53+
local to_hit_chance = ACID[acid_type].CHANCE
54+
local acid_successful = to_hit_chance >= math.random()
55+
56+
if acid_successful and not target_acid_immune and n_items > 0 then
57+
local acid_dice = dice:new(ACID[acid_type].DICE, 0) - acid_resistance
58+
for i=n_items, 1, -1 do -- count backwards due to table.remove being used in item_INST:updateCondition
59+
local item_INST = target.inventory:lookup(i)
60+
local acid_damage = acid_dice:roll()
61+
62+
-- firesuits are immune from acid
63+
if item_INST:getClassName() ~= 'firesuit' and acid_damage > 0 then item_INST:updateCondition(-1 * acid_damage, target, i) end
64+
end
65+
end
66+
67+
return {acid_successful, target_acid_immune}
68+
end
69+
4070
return activate

code/player/skills/check.lua

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,10 @@ function check.track(player)
4545

4646
end
4747

48+
function check.acid(player)
49+
local p_tile = player:getTile()
50+
local human_n = p_tile:countPlayers('human', player:getStage())
51+
assert(human_n > 0, 'Must have humans nearby to use acid')
52+
end
53+
4854
return check

code/player/skills/criteria.lua

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,12 @@ function criteria.track(player)
5151

5252
end
5353

54+
function criteria.acid(player)
55+
local p_tile = player:getTile()
56+
local human_n = p_tile:countPlayers('human', player:getStage())
57+
assert(human_n > 0, 'Must have humans nearby to use acid')
58+
end
59+
60+
error_list[#error_list+1] = 'Must have humans nearby to use acid'
61+
5462
return criteria

main.lua

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ player = require('code.player.class')
2323
table.copy = require('code.libs.copy')
2424
table.inspect = require('code.libs.inspect')
2525

26+
27+
28+
29+
local arm_CL = require('code.player.armor.item_class')
30+
2631
--[[
2732
local building = require('code.location.building.class')
2833
lookupItem = require('code.item.search')
@@ -39,8 +44,14 @@ alt_player = player:new('Tim', 'human', city, 4, 4)
3944

4045
main_player:updateStat('hp', -49)
4146

42-
local syringe_INST = item.syringe:new('powered')
43-
alt_player.inventory:insert(syringe_INST)
47+
for i=1, 10 do
48+
local syringe_INST = item.syringe:new('powered')
49+
alt_player.inventory:insert(syringe_INST)
50+
end
51+
52+
local firesuit_INST = item.firesuit:new('ruined')
53+
alt_player.inventory:insert(firesuit_INST)
54+
alt_player.armor:equip('firesuit', firesuit_INST:getCondition(), #alt_player.inventory)
4455

4556
--[[
4657
print('---------')

scenes/action.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,8 @@ print(event.target.id, 'action cost is - ', main_player:getCost('ap', event.targ
251251
params.icon = action_data.icon
252252
params.cost = main_player:getCost('ap', event.target.id)
253253

254-
composer.showOverlay( "scenes.action_perform", options )
254+
composer.showOverlay("scenes.action."..event.target.id, options) -- this SERIOUSLY needs to be refactored and renamed!!!
255+
--composer.showOverlay( "scenes.action_perform", options )
255256
print( "Button was pressed and released" )
256257
end
257258
end

0 commit comments

Comments
 (0)