From fcac7da0a52ac4308ce057bd2cf9fdba48d3f438 Mon Sep 17 00:00:00 2001 From: Timothy Date: Sun, 13 Nov 2016 17:10:03 -0600 Subject: [PATCH 1/9] Removed medical and sentient classes from skills --- code/player/skills/flags.lua | 57 ++++------- code/player/skills/list.lua | 188 ++++++++++++----------------------- scenes/skills.lua | 2 - 3 files changed, 80 insertions(+), 167 deletions(-) diff --git a/code/player/skills/flags.lua b/code/player/skills/flags.lua index 450c57f..47cf7cc 100644 --- a/code/player/skills/flags.lua +++ b/code/player/skills/flags.lua @@ -9,9 +9,8 @@ local skill_flags = { -- Classes military = 1, - medical = 2, - research = 4, - engineering = 8, + research = 2, + engineering = 4, -- General hp_bonus = 1, -- hp_bonus MUST remain flag 1 b/c it's used for both zombies & humans on the bitflag 1 slot @@ -41,25 +40,18 @@ local skill_flags = { smashing = 1024, explosives = 2048, - -- Medical + -- Research healing = 1, major_healing = 2, - major_healing_adv = 4, - minor_healing = 8, - minor_healing_adv = 16, - chemistry = 32, - serium = 64, - stimulants = 128, - antibodies = 256, - recovery = 512, - recovery_adv = 1024, - diagnosis_adv = 2048, - - -- Science - lab_tech = 1, - researcher = 2, - bookworm = 4, - + minor_healing = 4, + diagnosis_adv = 8, + gadgets = 16, + scanner = 32, + syringe = 64, + syringe_adv = 128, + terminal = 256, + terminal_adv = 512, + -- Engineering repairs = 1, repairs_adv = 2, @@ -80,9 +72,8 @@ local skill_flags = { -- Classes brute = 1, - sentient = 2, - hunter = 4, - hive = 8, + hunter = 2, + hive = 4, -- General hp_bonus = 1, -- hp_bonus MUST remain flag 1 b/c it's used for both zombies & humans on the bitflag 1 slot @@ -119,24 +110,12 @@ local skill_flags = { smell_blood_adv = 128, night_vision = 256, mark_prey = 512, - - -- Sentient - open_door = 1, - resurrection = 2, - ankle_bite = 4, - bite = 8, - power_bite = 16, - bite_adv = 32, - jugular = 64, - chew = 128, - speech = 256, - digestion = 512, - -- Hive - stinger = 1, - venom = 2, - venom_adv = 4, + hivemind = 1, + resurrection = 2, + bite = 4, + bite_adv = 8, corrode = 16, acid = 32, acid_adv = 64, diff --git a/code/player/skills/list.lua b/code/player/skills/list.lua index 568a57f..3b5d0e7 100644 --- a/code/player/skills/list.lua +++ b/code/player/skills/list.lua @@ -14,21 +14,19 @@ local band, bor, bxor, bnot = bit.band, bit.bor, bit.bxor, bit.bnot local skill_list = { order = { zombie = { - category = {'classes', 'general', 'brute', 'hunter', 'sentient', 'hive'}, - classes = {'brute', 'hunter', 'sentient', 'hive'}, + category = {'classes', 'general', 'brute', 'hunter', 'hive'}, + classes = {'brute', 'hunter', 'hive'}, general = {'muscle_stimulus', 'hand_stimulus', 'head_stimulus', 'grapple', 'groan', 'gesture', 'hp_bonus', 'ep_bonus', 'drag_prey', 'smell_blood'}, - brute = {'claw', 'dual_claw', 'claw_adv', 'power_claw', 'impale', 'armor', 'liquid_armor', 'ranged_armor', 'pain_armor', 'dying_grasp',}, - sentient = {'open_door', 'resurrection', 'ankle_bite', 'bite', 'power_bite', 'bite_adv', 'jugular', 'chew', 'speech', 'digestion'}, + brute = {'claw', 'dual_claw', 'claw_adv', 'power_claw', 'impale', 'armor', 'liquid_armor', 'ranged_armor', 'pain_armor', 'dying_grasp',}, hunter = {'sprint', 'leap', 'leap_adv', 'track', 'scavenge', 'track_adv', 'dodge', 'smell_blood_adv', 'night_vision', 'mark_prey'}, - hive = {'stinger', 'venom', 'venom_adv', 'corrode', 'acid', 'acid_adv', 'ruin', 'ransack', 'homewrecker'}, + hive = {'resurrection', 'hivemind', 'bite', 'bite_advanced', 'corrode', 'acid', 'acid_adv', 'ruin', 'ransack', 'homewrecker'}, }, human = { - category = {'classes', 'general', 'military', 'medical', 'research', 'engineering'}, - classes = {'military', 'medical', 'research', 'engineering'}, + category = {'classes', 'general', 'military', 'research', 'engineering'}, + classes = {'military', 'research', 'engineering'}, general = {'melee', 'cutting', 'swinging', 'martial_arts', 'martial_arts_adv', 'ranged', 'roof_travel', 'hp_bonus', 'ip_bonus', 'looting', 'diagnosis', 'graffiti'}, military = {'ranged_adv', 'guns', 'light_guns', 'heavy_guns', 'archery', 'archery_adv', 'melee_adv', 'chopping', 'slicing', 'smashing', 'smacking', 'explosives'}, - medical = {'healing', 'major_healing', 'major_healing_adv', 'minor_healing', 'minor_healing_adv', 'chemistry', 'serium', 'stimulants', 'antibodies', 'recovery', 'recovery_adv', 'diagnosis_adv'}, - research = {'bookworm'}, + research = {'healing', 'major_healing', 'minor_healing', 'diagnosis_adv', 'gadgets', 'syringe', 'syringe_adv', 'dna_scanner', 'terminal', 'terminal_adv'}, engineering = {'repairs', 'repairs_adv', 'barricade', 'barricade_adv', 'reinforce', 'renovate', 'tech', 'power_tech', 'radio_tech', 'computer_tech'}, --'construction', 'reserve'}, }, }, @@ -40,11 +38,6 @@ local skill_list = { desc='Unlock Brute skills', icon='lizardman', }, - sentient = { - name='sentient', - desc='Unlock Sentient skills', - icon='frontal-lobe', - }, hunter = { name='hunter', desc='Unlock Hunter skills', @@ -53,7 +46,7 @@ local skill_list = { hive = { name='hive', desc='Unlock Hive skills', - icon='tear-tracks', + icon='frontal-lobe', }, }, @@ -161,58 +154,6 @@ local skill_list = { icon='blade-bite', }, }, - sentient = { - open_door = { - name='open door', - desc='[Not Implemented] Ability to open doors', - icon='brain-stem', - }, - resurrection = { - name='resurrection', - desc='Reviving from being killed now costs 5 ap', - icon='haunting', - }, - ankle_bite = { - name='ankle bite', - desc='[Not Implemented] If any humans are nearby upon reviving a free auto bite attack is performed', - icon='barefoot', - }, - bite = { - name='bite', - desc='Bite attacks +10% to-hit and increased damage', - icon='carnivore-mouth', - }, - power_bite = { - name='power bite', - desc='Bite attacks +15% to-hit and increased damage', - icon='gluttonous-smile' - }, - bite_adv = { - name='bite advanced', - desc='Bite attacks receive a bonus reroll', - icon='sharp-smile', - }, - jugular = { - name='jugular', - desc='[Not Implemented] Bite attacks do triple damage upon a critical hit', - icon='ragged-wound', - }, - chew = { - name='chew', - desc='[Not Implemented] Successful bite attacks regain lost hp', - icon='ent-mouth', - }, - speech = { - name='speech', - desc='Ability to communicate full speech', - icon='conversation', - }, - digestion = { - name='digestion', - desc='Eating from corpses grants a higher xp bonus', - icon='carrion', - }, - }, hunter = { sprint = { name='sprint', @@ -266,6 +207,26 @@ local skill_list = { }, }, hive = { + hivemind = { + name='hivemind', + desc='Ability to communicate full speech', + icon='conversation', + }, + resurrection = { + name='resurrection', + desc='Reviving from being killed now costs 5 ap', + icon='haunting', + }, + bite = { + name='bite', + desc='Bite attacks +10% to-hit and increased damage', + icon='carnivore-mouth', + }, + bite_adv = { + name='bite advanced', + desc='Bite attacks receive a bonus reroll', + icon='gluttonous-smile', + }, stinger = { name = 'stinger', desc = 'Grants ability to attack with a poisonous stinger that injects venom into the bloodstream for a small duration', @@ -331,12 +292,7 @@ local skill_list = { name='research', desc='Unlock Research skills', icon='biohazard', - }, - medical = { - name='medical', - desc='Unlock Medical skills', - icon='hospital-cross', - }, + }, }, general = { melee = { @@ -479,7 +435,7 @@ local skill_list = { icon='molotov', }, }, - medical = { + research = { healing = { name = 'healing', desc = 'Healing items receive bonus', @@ -491,68 +447,48 @@ local skill_list = { icon = 'medical-pack-alt', requires={'healing'}, }, - major_healing_adv={ - name = 'major healing advanced', - desc = 'First aid kits receive major healing bonus', - icon = 'scalpel', - requires={'major_healing'}, - }, minor_healing = { name = 'minor healing', desc = 'Bandages receive minor healing bonus', icon = 'bandage-roll', requires={'healing'}, }, - minor_healing_adv={ - name = 'minor healing advanced', - desc = 'Bandages receive major healing bonus', - icon = 'sewing-needle', - requires={'minor_healing'}, - }, - chemistry = { - name = 'chemistry', - desc = 'Unlocks ability to make chemistry products', - icon = 'fizzing-flask', - }, - serium = { - name = 'serium', - desc = 'Making antidote costs less and better quality', - icon = 'corked-tube', - requires={'chemistry'}, - }, - stimulants = { - name = 'stimulants', - desc = 'Making amphediente costs less and better quality', - icon = 'pill', - requires={'chemistry'}, - }, - antibodies = { - name = 'antibodies', - desc = 'Making syringes costs less and better quality', - icon = 'square-bottle', - requires={'chemistry'}, - }, - recovery = { - name = 'recovery', - desc = 'Unlocks ability to recover 1d2-1 health', - icon = 'health-normal', - }, - recovery_adv = { - name = 'recovery advanced', - desc = 'Recover ability costs less and is now 1d2', - icon = 'health-increase', - requires={'recovery'}, - }, diagnosis_adv = { name='diagnosis advanced', desc='Determine PRECISE health status', icon = 'anatomy', - requires={'diagnosis'},}, - }, - research = { - lab_tech = {name='lab tech', desc='Gain ability to use science equipment',}, - researcher = {name='researcher', desc='Gain ability to tag zombies and track via terminals',}, - bookworm = {name='bookworm',}, + requires={'diagnosis'}, + }, + gadgets = { + name='gadgets', + desc='Provides a bonus when using research items', + icon = 'anatomy', + }, + scanner = { + name='scanner', + desc='Provides a bonus when using research items', + icon = 'anatomy', + }, + syringe = { + name='syringe', + desc='Provides a bonus when using research items', + icon = 'anatomy', + }, + syringe_adv = { + name='syringe advanced', + desc='Provides a bonus when using research items', + icon = 'anatomy', + }, + terminal = { + name='terminal', + desc='Provides a bonus when using research items', + icon = 'anatomy', + }, + terminal_adv = { + name='terminal advanced', + desc='Provides a bonus when using research items', + icon = 'anatomy', + }, }, engineering = { repairs = { diff --git a/scenes/skills.lua b/scenes/skills.lua index c661dfc..ee825f1 100644 --- a/scenes/skills.lua +++ b/scenes/skills.lua @@ -14,7 +14,6 @@ local imageSheet = { classes = {info = require('graphics.icons.skills.human.classes@1x'),}, general = {info = require('graphics.icons.skills.human.general@1x'),}, military = {info = require('graphics.icons.skills.human.military@1x'),}, - medical = {info = require('graphics.icons.skills.human.medical@1x'),}, research = {info = require('graphics.icons.skills.human.research@1x'),}, engineering = {info = require('graphics.icons.skills.human.engineering@1x'),}, }, @@ -23,7 +22,6 @@ local imageSheet = { general = {info = require('graphics.icons.skills.zombie.general@1x'),}, brute = {info = require('graphics.icons.skills.zombie.brute@1x'),}, hunter = {info = require('graphics.icons.skills.zombie.hunter@1x'),}, - sentient = {info = require('graphics.icons.skills.zombie.sentient@1x'),}, hive = {info = require('graphics.icons.skills.zombie.hive@1x'),}, }, } From 016500a9eca7b71f3bfa80d84aea12d9c812df4b Mon Sep 17 00:00:00 2001 From: Timothy Date: Sun, 13 Nov 2016 17:52:11 -0600 Subject: [PATCH 2/9] Modified skill effects for item use --- code/item/use/activate.lua | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/code/item/use/activate.lua b/code/item/use/activate.lua index 67f9a62..f595289 100644 --- a/code/item/use/activate.lua +++ b/code/item/use/activate.lua @@ -1,5 +1,4 @@ local dice = require('code.libs.dice') -local flags = require('code.player.skills.flags') local medical = require('code.item.medical.class') local activate = {} @@ -12,38 +11,38 @@ function activate.FAK(player, condition, target) local FAK_dice = dice:new(medical.FAK:getDice()) local tile = player:getTile() - if player.skills:check(flags.recovery) and tile:isBuilding() and tile:isPowered() and player:isStaged('inside') then + if player.skills:check('healing') and tile:isBuilding() and tile:isPowered() and player:isStaged('inside') then FAK_dice = FAK_dice*1 --print('powered confirmed') --print(tile:getClassName(), tile:getName(), tile:getTileType() ) - if player.skills:check(flags.major_healing) and tile:isClass('hospital') then + if player.skills:check('major_healing') and tile:isClass('hospital') then FAK_dice = FAK_dice*1 --print('hosptial confirmed') end end - if player.skills:check(flags.major_healing_adv) then + if player.skills:check('major_healing') then FAK_dice = FAK_dice^1 FAK_dice = FAK_dice..'^^' - end + end local hp_gained = FAK_dice:roll() target:updateHP(hp_gained) -- target:event trigger - print('You heal with '..FAK:getName()..' for '..hp_gained..' hp.') + print('You heal with the first aid kit for '..hp_gained..' hp.') end function activate.bandage(player, condition, target) local bandage_dice = dice:new(medical.bandage:getDice()) + local tile = player:getTile() + + if tile:isBuilding() and tile:isPowered() and player:isStaged('inside') then bandage_dice = bandage_dice+1 end - if player.skills:check(flags.recovery) then + if player.skills:check('healing') then bandage_dice = bandage_dice+1 - if player.skills:check(flags.minor_healing) then - bandage_dice = bandage_dice+1 - if player.skills:check(flags.major_healing_adv) then - bandage_dice = bandage_dice^1 - bandage_dice = bandage_dice+1 - end + if player.skills:check('minor_healing') then + bandage_dice = bandage_dice+1 + bandage_dice = bandage_dice^1 end end @@ -158,8 +157,7 @@ local book_xp_dice = {'1d3', '1d5', '1d7', '1d10'} function activate.book(player, condition) local xp_dice_str = book_xp_dice[condition-1] local book_dice = dice:new(xp_dice_str) - if player.skills:check(flags.bookworm) then book_dice = book_dice^1 end - if player:isStaged('inside') and player:getSpotCondition() == 'powered' then book_dice = book_dice/2 end + if player:isStaged('inside') and player:getSpotCondition() == 'powered' then book_dice = book_dice^1 end local gained_xp = book_dice:roll() player:updateXP(gained_xp) end From d12c3bd2a5102cf4dccd9448367246c7c95112ff Mon Sep 17 00:00:00 2001 From: Timothy Date: Sun, 13 Nov 2016 19:54:35 -0600 Subject: [PATCH 3/9] Syringes should work properly now --- code/item/use/activate.lua | 28 ++++++++++++---------------- code/player/action/outcome.lua | 32 ++++++++++++++++++++++++-------- code/player/class.lua | 10 ++++------ 3 files changed, 40 insertions(+), 30 deletions(-) diff --git a/code/item/use/activate.lua b/code/item/use/activate.lua index f595289..07b2862 100644 --- a/code/item/use/activate.lua +++ b/code/item/use/activate.lua @@ -52,29 +52,25 @@ function activate.bandage(player, condition, target) print('You heal with '..bandage:getName()..' for '..hp_gained..' hp.') end -function activate.antidote(player, condition, target) - local antidote = medical.antidote - local cure_chance = antidote:getAccuracy() - -- modify chance based on skills? - - local cure_success = cure_chance >= math.random() - -- target:updateStatusEffects? - -- target:event trigger - if cure_success then - print('You cure with the '..antidote:getName()..'.') - else - print('You fail to cure with the '..antidote:getName()..'.') - end -end +local syringe_hp_ranges = {3, 6, 9, 12} function activate.syringe(player, condition, target) local syringe = medical.syringe local inject_chance = syringe:getAccuracy() - -- modify chance based on skills? + if player.skills:check('syringe') then + inject_chance = inject_chance + 0.05 + if player.skills:check("syringe_adv") then + inject_chance = inject_chance + 0.05 + end + end local inject_success = inject_chance >= math.random() - target:killed('syringe') + local target_weak_enough = syringe_hp_ranges[condition] >= target:getStat('hp') + + if inject_success and target_weak_enough then target:killed() end -- target:event trigger + + return {inject_success, target_weak_enough} end --[[ diff --git a/code/player/action/outcome.lua b/code/player/action/outcome.lua index baef392..1003382 100644 --- a/code/player/action/outcome.lua +++ b/code/player/action/outcome.lua @@ -1,7 +1,3 @@ ---[[ -local lookupItem = require('code.item.search') -local lookupWeapon= require('code.item.weapon.search') ---]] local map = require('code.location.map.class') local combat = require('code.player.combat') local entangle = require('code.player.condition.entangle') @@ -10,6 +6,8 @@ local equipmentActivate = require('code.location.building.equipment.operation.ac local skillActivate = require('code.player.skills.activate') local enzyme_list = require('code.player.enzyme_list') local dice = require('code.libs.dice') +local item = require('code.item.class') + Outcome = {} @@ -63,8 +61,8 @@ function Outcome.attack(player, target, weapon, inv_ID) local attack, damage, critical = combat(player, target, weapon) if attack then - if target_class == 'player' then -- what about barricades? buildings? equipment? - if target.armor:isPresent() then -- what if weapon is harmless? + if target_class == 'player' then + if target.armor:isPresent() and not weapon:isHarmless() then local damage_type = weapon:getDamageType() local resistance = target.armor:getProtection(damage_type) damage = damage - resistance @@ -88,6 +86,9 @@ function Outcome.attack(player, target, weapon, inv_ID) if zombie.skills:check('track') then zombie.condition.tracking:addScent(human) end + --elseif target_class == 'building' then + --elseif target_class == 'barricade' then + --elseif target_class == equipment? end local hp_loss = -1*damage @@ -208,8 +209,23 @@ function Outcome.item(item, player, inv_ID, target) local item_INST = player.inventory:lookup(inv_ID) local item_condition = item_INST:getCondition() local result = itemActivate[item](player, item_condition, target) - if item_INST:isSingleUse() then player.inventory:remove(inv_ID) -- no need to do a durability check - elseif item_INST:failDurabilityCheck(player) then item_INST:updateCondition(-1, player, inv_ID) end + + if item_INST:isSingleUse() then -- no need for durability check + if item_INST:getClassName() == 'syringe' then + local inject_success, target_weak_enough = result[1], result[2] + if inject_success then + if target_weak_enough then -- the syringe will be discarded without creating a vaccine if the target is too strong + local vaccine = item.vaccine:new('unpowered') -- should probably make unpowered/powered condition dependent on syringe skills + player.inventory:insert(vaccine) + end + player.inventory:remove(inv_ID) + --else the syringe is not removed from inventory since it didn't hit + end + else -- all other single use items get discarded + player.inventory:remove(inv_ID) + end + elseif item_INST:failDurabilityCheck(player) then item_INST:updateCondition(-1, player, inv_ID) + end return result end diff --git a/code/player/class.lua b/code/player/class.lua index 5f52d0d..004317b 100644 --- a/code/player/class.lua +++ b/code/player/class.lua @@ -12,12 +12,7 @@ local condition = require('code.player.condition.class') local carcass = require('code.player.carcass') local organic_armor = require('code.player.armor.organic_class') local item_armor = require('code.player.armor.item_class') -local flags = require('code.player.skills.flags') local weapon = require('code.item.weapon.class') ---[[ -local lookupWeapon = require('code.item.weapon.search') -- refactored? (delete) -local lookupItem = require('code.item.search') -- refactored? (delete) ---]] local player = class('player') @@ -54,7 +49,10 @@ function player:killed(cause_of_death) #1 - human killed (turns into zombie) [reset skills, xp, sp] #2 - zombie killed (decay) [delete] #3 - zombie killed (regular death) [nothing] ---]] +--]] + + self.hp, self.health_state = 0, {basic=4, advanced=8} -- reset our hp stats to zero + if self:isMobType('human') then self.hp, self.health_state = 0, {basic=4, advanced=8} self:updateMobType('zombie') From 04df0a828e46db289ae6d31300302acb5114224a Mon Sep 17 00:00:00 2001 From: Timothy Date: Sun, 13 Nov 2016 22:54:39 -0600 Subject: [PATCH 4/9] Fixed typos --- code/item/list/medical.lua | 12 ++---------- code/player/action/list.lua | 12 ++++++------ 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/code/item/list/medical.lua b/code/item/list/medical.lua index 26c35e2..7c2524f 100644 --- a/code/item/list/medical.lua +++ b/code/item/list/medical.lua @@ -12,26 +12,18 @@ local medical = {} medical.FAK = {} medical.FAK.full_name = 'first aid kit' medical.FAK.weight = 8 -medical.FAK.class_category = 'medical' medical.bandage = {} medical.bandage.full_name = 'bandage' medical.bandage.weight = 3 -medical.bandage.class_category = 'medical' - -medical.antidote = {} -medical.antidote.full_name = 'vial of antidote' -medical.antidote.weight = 1 -medical.antidote.class_category = 'medical' medical.syringe = {} -medical.syringe.full_name = 'revival syringe' +medical.syringe.full_name = 'syringe' medical.syringe.weight = 5 -medical.syringe.designated_weapon = true -medical.syringe.class_category = 'research' for item in pairs(medical) do medical[item].one_use = true + medical[item].class_category = 'research' end return medical \ No newline at end of file diff --git a/code/player/action/list.lua b/code/player/action/list.lua index 4a05d13..e40f4f4 100644 --- a/code/player/action/list.lua +++ b/code/player/action/list.lua @@ -74,14 +74,14 @@ local action_list = { zombie = { default = { move = {name='move', cost=2, modifier={sprint = -1},}, - enter = {name='enter', cost= 1}, - exit = {name='exit', cost= 1}, + enter = {name='enter', cost=1}, + exit = {name='exit', cost=1}, }, basic = { - respawn = {cost=10, modifier={resurrection = -5},}, - attack = {cost=1}, - speak = {cost=1}, - feed = {cost=1}, + respawn = {cost= 10, modifier={resurrection = -5},}, + attack = {cost= 1}, + speak = {cost= 1}, + feed = {cost= 1}, }, skill = { -- generic skills From c7cddb5e9e0a1cf038efd368034727de68e4a72f Mon Sep 17 00:00:00 2001 From: Timothy Date: Sun, 13 Nov 2016 22:55:32 -0600 Subject: [PATCH 5/9] Added chance of free movement when using GPS --- code/item/use/activate.lua | 9 ++++++++- code/player/action/outcome.lua | 15 ++++++++++++--- code/player/inventory.lua | 12 ++++++++++-- 3 files changed, 30 insertions(+), 6 deletions(-) diff --git a/code/item/use/activate.lua b/code/item/use/activate.lua index 07b2862..2d9144e 100644 --- a/code/item/use/activate.lua +++ b/code/item/use/activate.lua @@ -99,8 +99,15 @@ function activate.sampler(player, condition, target) end -function activate.GPS(player, condition) +local GPS_basic_chance, GPS_advanced_chance = 0.15, 0.20 +function activate.GPS(player, condition) + local GPS_chance = (player.skils:check('gadgets') and GPS_advanced_chance) or GPS_basic_chance + local free_movement_success = GPS_chance >= math.random() + if free_movement_success then -- the GPS has a chance to avoid wasting ap on movement + player:updateStat('ap', 1) -- this is pretty much a hack (if a player's ap is 50 then they will NOT receive the ap) + end + return {free_movement_success} end function activate.loudspeaker(player, condition, message) diff --git a/code/player/action/outcome.lua b/code/player/action/outcome.lua index 1003382..52e51c2 100644 --- a/code/player/action/outcome.lua +++ b/code/player/action/outcome.lua @@ -37,6 +37,7 @@ function Outcome.move(player, dir) local y, x = player:getPos() local map = player:getMap() local dir_y, dir_x = getNewPos(y, x, dir) + local GPS_success if player:isStaged('inside') then map[y][x]:remove(player, 'inside') @@ -45,13 +46,20 @@ function Outcome.move(player, dir) else map[dir_y][dir_x]:insert(player, 'outside') end - else + else -- player is outside + if player:isMobType('human') then + local inventory_has_GPS, inv_ID = player.inventory:search('GPS') + if inventory_has_GPS then + GPS_success = Outcome.item('GPS', player, inv_ID) + end + end + map[y][x]:remove(player) map[dir_y][dir_x]:insert(player) end player:updatePos(dir_y, dir_x) - return {dir} + return {dir, GPS_success} end local ARMOR_DAMAGE_MOD = 2.5 @@ -224,7 +232,8 @@ function Outcome.item(item, player, inv_ID, target) else -- all other single use items get discarded player.inventory:remove(inv_ID) end - elseif item_INST:failDurabilityCheck(player) then item_INST:updateCondition(-1, player, inv_ID) + elseif item_INST:failDurabilityCheck(player) then + item_INST:updateCondition(-1, player, inv_ID) end return result end diff --git a/code/player/inventory.lua b/code/player/inventory.lua index 86449ac..9683810 100644 --- a/code/player/inventory.lua +++ b/code/player/inventory.lua @@ -1,4 +1,3 @@ -local item = require('code.item.class') local class = require('code.libs.middleclass') local inventory = class('code.player.inventory') @@ -16,7 +15,7 @@ function inventory:initialize() self.radio_receivers = {} end -function inventory:insert(obj_INST) self[#self+1] = obj_INST end +function inventory:insert(item_INST) self[#self+1] = item_INST end function inventory:remove(inv_ID) table.remove(self, inv_ID) end @@ -29,6 +28,15 @@ function inventory:lookup(inv_ID) -- get itemClass_INST return self[inv_ID] end +function inventory:search(item_name) + for inv_ID, item_INST in ipairs(self) do + if item_INST:getClassName() == item_name then + return true, inv_ID + end + end + return false +end + function inventory:catalog() local contents = {} for inv_ID=1, #self do contents[#contents + 1] = self[inv_ID] end From 9fb8eeecd183e2c6bce55caadd8d6d7faa9d558c Mon Sep 17 00:00:00 2001 From: Timothy Date: Sun, 13 Nov 2016 23:23:27 -0600 Subject: [PATCH 6/9] Added GPS message to movement --- code/player/action/outcome.lua | 6 +++--- code/player/log/getMessage.lua | 8 ++++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/code/player/action/outcome.lua b/code/player/action/outcome.lua index 52e51c2..7777c07 100644 --- a/code/player/action/outcome.lua +++ b/code/player/action/outcome.lua @@ -37,7 +37,7 @@ function Outcome.move(player, dir) local y, x = player:getPos() local map = player:getMap() local dir_y, dir_x = getNewPos(y, x, dir) - local GPS_success + local GPS_usage if player:isStaged('inside') then map[y][x]:remove(player, 'inside') @@ -50,7 +50,7 @@ function Outcome.move(player, dir) if player:isMobType('human') then local inventory_has_GPS, inv_ID = player.inventory:search('GPS') if inventory_has_GPS then - GPS_success = Outcome.item('GPS', player, inv_ID) + GPS_usage = Outcome.item('GPS', player, inv_ID) end end @@ -59,7 +59,7 @@ function Outcome.move(player, dir) end player:updatePos(dir_y, dir_x) - return {dir, GPS_success} + return {dir, GPS_usage} end local ARMOR_DAMAGE_MOD = 2.5 diff --git a/code/player/log/getMessage.lua b/code/player/log/getMessage.lua index 6611cae..2239b36 100644 --- a/code/player/log/getMessage.lua +++ b/code/player/log/getMessage.lua @@ -28,8 +28,12 @@ end --]]--DIR/COMPASS LAYOUT local compass = {'North', 'NorthEast', 'East', 'SouthEast', 'South', 'SouthWest', 'West', 'NorthWest'} -function description.move(player, dir) - msg[1] = 'You travel '..compass[dir]..'.' +function description.move(player, dir, GPS_usage) + if GPS_usage then + msg[1] = 'You travel '..compass[dir]..' using a GPS.' + else + msg[1] = 'You travel '..compass[dir]..'.' + end end function description.search(player, item) From 6f57663a914de62796ce598880c8bb10a8a379c0 Mon Sep 17 00:00:00 2001 From: Timothy Date: Mon, 14 Nov 2016 14:19:55 -0600 Subject: [PATCH 7/9] Added durability value to flashlight and GPS --- code/item/list/gadget.lua | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/code/item/list/gadget.lua b/code/item/list/gadget.lua index 847bd2f..9f69a17 100644 --- a/code/item/list/gadget.lua +++ b/code/item/list/gadget.lua @@ -16,7 +16,7 @@ gadget.radio.durability = 100 gadget.GPS = {} -- GPS for humans should have a small chance to grant a free AP for movement gadget.GPS.full_name = 'global position system' gadget.GPS.weight = 2 -gadget.GPS.durability = 300 +gadget.GPS.durability = 50 --[[ gadget.cellphone = {} @@ -33,11 +33,13 @@ gadget.loudspeaker = {} gadget.loudspeaker.full_name = 'loudspeaker' gadget.loudspeaker.weight = 1 ---used for searching? give search bonus?! +--]] + gadget.flashlight = {} gadget.flashlight.full_name = 'flashlight' gadget.flashlight.weight = 4 ---]] +gadget.flashlight.durability = 100 + for item in pairs(gadget) do gadget[item].class_category = 'research' end From 2c33bf1364d1226f49ed57507601b0530d2b9aa6 Mon Sep 17 00:00:00 2001 From: Timothy Date: Mon, 14 Nov 2016 14:20:11 -0600 Subject: [PATCH 8/9] Removed old code and typos --- code/item/medical/list.lua | 25 ------------------------- code/item/weapon/chanceToHit.lua | 1 - scenes/action.lua | 2 +- 3 files changed, 1 insertion(+), 27 deletions(-) diff --git a/code/item/medical/list.lua b/code/item/medical/list.lua index e997888..bd58aba 100644 --- a/code/item/medical/list.lua +++ b/code/item/medical/list.lua @@ -3,17 +3,11 @@ local medical = {} --[[ { full_name = 'insert name' - group = { - healing (medkit/bandage) - drugs (pills/antidote) - misc. (special) - } *optional* dice = '?d?' accuracy = 0.00 (base chance to hit) - organic = human/zombie/nil (results in default weapon choice, since weapon is attached to body) one_use = true/nil (is disposed of after one use) } --]] @@ -24,39 +18,20 @@ local medical = {} medical.FAK = {} medical.FAK.full_name = 'first aid kit' -medical.FAK.group = {'healing', 'medkit'} medical.FAK.dice = '1d5' medical.FAK.one_use = true medical.bandage = {} medical.bandage.full_name = 'bandage' -medical.bandage.group = {'healing', 'bandage'} medical.bandage.dice = '1d3' medical.bandage.one_use = true -medical.herb = {} -medical.herb.full_name = 'herb' -medical.herb.group = {'healing', 'herb'} -medical.herb.dice = '1d2' -medical.herb.one_use = true - ---[[ ---- DRUGS ---]] - -medical.antidote = {} -medical.antidote.full_name = 'antidote' -medical.antidote.group = {'drugs', 'antidote'} -medical.antidote.accuracy = 0.50 -medical.antidote.one_use = true - --[[ --- INSTRUMENT --]] medical.syringe = {} medical.syringe.full_name = 'syringe' -medical.syringe.group = {'instrument', 'syringe'} medical.syringe.accuracy = 0.25 medical.syringe.one_use = true diff --git a/code/item/weapon/chanceToHit.lua b/code/item/weapon/chanceToHit.lua index 0ee7c0d..731a4e3 100644 --- a/code/item/weapon/chanceToHit.lua +++ b/code/item/weapon/chanceToHit.lua @@ -30,7 +30,6 @@ 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}, }, } diff --git a/scenes/action.lua b/scenes/action.lua index 5023f14..3689db0 100644 --- a/scenes/action.lua +++ b/scenes/action.lua @@ -103,7 +103,7 @@ local function onRowRender( event ) effect = "fade", time = 400, params = {} - } + } local mob_type = main_player:getMobType() local action_data, params = action_list[mob_type][item_name], options.params From 275f9dcba41f1fbcf08f82b51a7cf009992bb543 Mon Sep 17 00:00:00 2001 From: Timothy Date: Mon, 14 Nov 2016 14:21:41 -0600 Subject: [PATCH 9/9] Revert "Removed old code and typos" This reverts commit 2c33bf1364d1226f49ed57507601b0530d2b9aa6. --- code/item/medical/list.lua | 25 +++++++++++++++++++++++++ code/item/weapon/chanceToHit.lua | 1 + scenes/action.lua | 2 +- 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/code/item/medical/list.lua b/code/item/medical/list.lua index bd58aba..e997888 100644 --- a/code/item/medical/list.lua +++ b/code/item/medical/list.lua @@ -3,11 +3,17 @@ local medical = {} --[[ { full_name = 'insert name' + group = { + healing (medkit/bandage) + drugs (pills/antidote) + misc. (special) + } *optional* dice = '?d?' accuracy = 0.00 (base chance to hit) + organic = human/zombie/nil (results in default weapon choice, since weapon is attached to body) one_use = true/nil (is disposed of after one use) } --]] @@ -18,20 +24,39 @@ local medical = {} medical.FAK = {} medical.FAK.full_name = 'first aid kit' +medical.FAK.group = {'healing', 'medkit'} medical.FAK.dice = '1d5' medical.FAK.one_use = true medical.bandage = {} medical.bandage.full_name = 'bandage' +medical.bandage.group = {'healing', 'bandage'} medical.bandage.dice = '1d3' medical.bandage.one_use = true +medical.herb = {} +medical.herb.full_name = 'herb' +medical.herb.group = {'healing', 'herb'} +medical.herb.dice = '1d2' +medical.herb.one_use = true + +--[[ +--- DRUGS +--]] + +medical.antidote = {} +medical.antidote.full_name = 'antidote' +medical.antidote.group = {'drugs', 'antidote'} +medical.antidote.accuracy = 0.50 +medical.antidote.one_use = true + --[[ --- INSTRUMENT --]] medical.syringe = {} medical.syringe.full_name = 'syringe' +medical.syringe.group = {'instrument', 'syringe'} medical.syringe.accuracy = 0.25 medical.syringe.one_use = true diff --git a/code/item/weapon/chanceToHit.lua b/code/item/weapon/chanceToHit.lua index 731a4e3..0ee7c0d 100644 --- a/code/item/weapon/chanceToHit.lua +++ b/code/item/weapon/chanceToHit.lua @@ -30,6 +30,7 @@ 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}, }, } diff --git a/scenes/action.lua b/scenes/action.lua index 3689db0..5023f14 100644 --- a/scenes/action.lua +++ b/scenes/action.lua @@ -103,7 +103,7 @@ local function onRowRender( event ) effect = "fade", time = 400, params = {} - } + } local mob_type = main_player:getMobType() local action_data, params = action_list[mob_type][item_name], options.params