Skip to content

Commit

Permalink
Merge branch 'release-v0.4.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
timothymtorres committed Aug 12, 2017
2 parents 9958c7b + dbecd62 commit 68a749e
Show file tree
Hide file tree
Showing 19 changed files with 388 additions and 19 deletions.
3 changes: 2 additions & 1 deletion code/item/class.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ local j_list = require('code.item.list.junk')
local m_list = require('code.item.list.medical')
local w_list = require('code.item.list.weaponry')
local a_list = require('code.item.list.ammo')
local arm_list=require('code.item.list.armor')
local order = require('code.item.order')
local bit = require('plugin.bit')
local lshift, rshift, bor = bit.lshift, bit.rshift, bit.bor
Expand Down Expand Up @@ -127,6 +128,6 @@ function item:dataToClass(...) -- this should be a middleclass function (fix lat
end

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

return item
10 changes: 10 additions & 0 deletions code/item/list/armor.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,14 @@ armor.leather.resistance = {
[3] = {blunt=1},
}

armor.firesuit = {}
armor.firesuit.full_name = 'firesuit'
armor.firesuit.durability = 4
armor.firesuit.resistance = {
[0] = {acid=1},
[1] = {acid=2},
[2] = {acid=3},
[3] = {acid=4},
}

return armor
2 changes: 2 additions & 0 deletions code/item/order.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ local order = {
'book', 'bottle', 'newspaper',
-- AMMO
'pistol_mag', 'shotgun_shell', 'rifle_clip', 'quiver',
-- ARMOR
'firesuit', 'leather',
}

return order
4 changes: 2 additions & 2 deletions code/item/weapon/chanceToHit.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ local skill_attack_bonus = {

arm = {hand_stimulus=0.10, claw=0.10, claw_adv=0.15},
teeth = {head_stimulus=0.10, bite=0.10, bite_adv=0.15},
acid = {acid=0.05, acid_adv=0.05},
stinger = {venom=0.05, venom_adv=0.10},
--acid = {acid=0.05, acid_adv=0.05},
--stinger = {venom=0.05, venom_adv=0.10},
},
}

Expand Down
2 changes: 2 additions & 0 deletions code/item/weapon/list.lua
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ weapon.bite.master_skill = 'bite_adv'
--- BURN
--]]

--[[ Moved to skill activation
weapon.acid = {}
weapon.acid.full_name = 'stomach acid'
weapon.acid.attack_style = 'ranged'
Expand All @@ -294,5 +295,6 @@ weapon.acid.dice = '5d2'
weapon.acid.accuracy = 0.15
weapon.acid.critical = 0.30
weapon.acid.organic = 'zombie'
--]]

return weapon
1 change: 1 addition & 0 deletions code/player/action/list.lua
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ local action_list = {
armor = {name='armor', cost=1},
-- hive skills
ruin = {name='ruin', cost=1},
acid = {name='acid', cost=1},
-- hunter skills
mark_prey = {name='mark prey', cost=1},
track = {name='track', cost=1},
Expand Down
9 changes: 1 addition & 8 deletions code/player/action/outcome.lua
Original file line number Diff line number Diff line change
Expand Up @@ -112,15 +112,8 @@ function Outcome.attack(player, target, weapon, inv_ID)
if player.skills:check('infection_adv') or (player.skills:check('infection') and entangle.isTangledTogether(player, target)) then
if not target.condition.infection:isImmune() and not target.condition.infection:isActive() then --target cannot be immune or infection already active
target.condition.infection:add()
print('--------------------------------')
print('A zombie has infected the target')
print('--------------------------------')
-- should probably add an infection message to the ZOMBIE only! A human shouldn't be notfied immediately until damage is taken
-- also should probably look at refactoring the msg system for player.log to make this easier
else
print('--------------------------------')
print('Bite was successful, but no infection')
print('--------------------------------')
-- also should probably look at refactoring the msg system for player.log to make this easier
end
end
else -- normal effect process
Expand Down
6 changes: 6 additions & 0 deletions code/player/action/zone.lua
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,12 @@ function setupZone.track(player)
zone.tile = player:getTile()
end

function setupZone.acid(player, target)
zone.player = player
zone.type = 'pair'
zone.target = target
end

---------------------------------------
---------------------------------------
-- JUST A DIVIDER --
Expand Down
2 changes: 1 addition & 1 deletion code/player/armor/item_class.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ function item_armor:degrade(player)
self.protection = item_armor_list[self.name].resistance[self.condition]
end

return armor
return item_armor
2 changes: 1 addition & 1 deletion code/player/inventory.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ local inventory = class('code.player.inventory')
[1] = crowbar,
[2] = bandage,
[3] = pistol,
..., -- (inv_ID = inv_CL)
..., -- (inv_ID = itemClass_INST)
}
--]]

Expand Down
13 changes: 13 additions & 0 deletions code/player/log/getMessage.lua
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,19 @@ function description.speak(player, message)
msg[3] = player:getUsername()..' said: "'..message..'"'
end

function description.acid(player, target, acid_successful, acid_immunity)
if acid_successful and acid_immunity then
msg[1] = 'You spray '..target:getUsername()..' with acid but it has no effect.'
msg[2] = 'A zombie sprays you with acid but your inventory is protected by a firesuit.'
elseif acid_successful then
msg[1] = 'You spray '..target:getUsername()..' with acid.'
msg[2] = 'A zombie sprays you with acid.'
else
msg[1] = 'You attempt to spray '..target:getUsername()..' with acid but are unsuccessful.'
msg[2] = 'A zombie attempts to spray acid at you but is unsuccessful.'
end
end

---------------------------------------
---------------------------------------
-- JUST A DIVIDER --
Expand Down
30 changes: 30 additions & 0 deletions code/player/skills/activate.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
--local outcome = require('code.player.action.outcome')
local dice = require('code.libs.dice')

local activate = {}

Expand Down Expand Up @@ -37,4 +38,33 @@ function activate.track(player)
return {targets, targets_ranges}
end

local ACID = {
DEFAULT = {CHANCE = 0.15, DICE = '1d2'},
CORRODE = {CHANCE = 0.20, DICE = '1d3'},
ACID_ADV = {CHANCE = 0.30, DICE = '1d4'},
}

function activate.acid(player, target)
local n_items = #target.inventory
local acid_resistance = target.armor:isPresent() and target.armor:getProtection('acid') or 0
local target_acid_immune = acid_resistance == 4

local acid_type = (player.skills:check('acid_adv') and 'ACID_ADV') or (player.skills:check('corrode') and 'CORRODE') or 'DEFAULT'
local to_hit_chance = ACID[acid_type].CHANCE
local acid_successful = to_hit_chance >= math.random()

if acid_successful and not target_acid_immune and n_items > 0 then
local acid_dice = dice:new(ACID[acid_type].DICE, 0) - acid_resistance
for i=n_items, 1, -1 do -- count backwards due to table.remove being used in item_INST:updateCondition
local item_INST = target.inventory:lookup(i)
local acid_damage = acid_dice:roll()

-- firesuits are immune from acid
if item_INST:getClassName() ~= 'firesuit' and acid_damage > 0 then item_INST:updateCondition(-1 * acid_damage, target, i) end
end
end

return {acid_successful, target_acid_immune}
end

return activate
6 changes: 6 additions & 0 deletions code/player/skills/check.lua
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,10 @@ function check.track(player)

end

function check.acid(player)
local p_tile = player:getTile()
local human_n = p_tile:countPlayers('human', player:getStage())
assert(human_n > 0, 'Must have humans nearby to use acid')
end

return check
8 changes: 8 additions & 0 deletions code/player/skills/criteria.lua
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,12 @@ function criteria.track(player)

end

function criteria.acid(player)
local p_tile = player:getTile()
local human_n = p_tile:countPlayers('human', player:getStage())
assert(human_n > 0, 'Must have humans nearby to use acid')
end

error_list[#error_list+1] = 'Must have humans nearby to use acid'

return criteria
15 changes: 13 additions & 2 deletions main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ player = require('code.player.class')
table.copy = require('code.libs.copy')
table.inspect = require('code.libs.inspect')




local arm_CL = require('code.player.armor.item_class')

--[[
local building = require('code.location.building.class')
lookupItem = require('code.item.search')
Expand All @@ -39,8 +44,14 @@ alt_player = player:new('Tim', 'human', city, 4, 4)

main_player:updateStat('hp', -49)

local syringe_INST = item.syringe:new('powered')
alt_player.inventory:insert(syringe_INST)
for i=1, 10 do
local syringe_INST = item.syringe:new('powered')
alt_player.inventory:insert(syringe_INST)
end

local firesuit_INST = item.firesuit:new('ruined')
alt_player.inventory:insert(firesuit_INST)
alt_player.armor:equip('firesuit', firesuit_INST:getCondition(), #alt_player.inventory)

--[[
print('---------')
Expand Down
3 changes: 2 additions & 1 deletion scenes/action.lua
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,8 @@ print(event.target.id, 'action cost is - ', main_player:getCost('ap', event.targ
params.icon = action_data.icon
params.cost = main_player:getCost('ap', event.target.id)

composer.showOverlay( "scenes.action_perform", options )
composer.showOverlay("scenes.action."..event.target.id, options) -- this SERIOUSLY needs to be refactored and renamed!!!
--composer.showOverlay( "scenes.action_perform", options )
print( "Button was pressed and released" )
end
end
Expand Down
Loading

0 comments on commit 68a749e

Please sign in to comment.