-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
123 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,33 @@ | ||
local class = require('code.libs.middleclass') | ||
local class = require('code.libs.middleclass') | ||
local item_armor_list = require('code.item.list.armor') | ||
local armor = require('code.player.armor.class') | ||
local item = require('code.item.class') | ||
local armor = require('code.player.armor.class') | ||
|
||
local item_armor = class('item_armor', armor) | ||
|
||
function item_armor:initialize(player) | ||
armor.initialize(self, player) | ||
end | ||
|
||
function item_armor:equip(name, condition, inv_ID) | ||
self.protection = item_armor_list[name].resistance[condition] | ||
self.name, self.inv_ID, self.condition = name, inv_ID, condition | ||
self.durability = item_armor_list[name].durability | ||
function item_armor:equip(name, condition) | ||
if self:isPresent() then self:remove() end -- unequips the old armor and puts it back into the inventory | ||
self.name, self.condition = name, condition | ||
end | ||
|
||
function item_armor:degrade(player) | ||
local item_INST = player.inventory:lookup(self.inv_ID) | ||
item_INST:updateCondition(-1, player, self.inv_ID) | ||
function item_armor:remove() | ||
local player, armor_type, condition = self.player, self.name, self.condition | ||
local armor_INST = item[armor_type]:new(condition) | ||
|
||
player.inventory:insert(armor_INST) | ||
self.name, self.condition = nil, nil | ||
end | ||
|
||
function item_armor:degrade(player) | ||
self.condition = self.condition - 1 | ||
if 0 > self.condition then -- armor is destroyed | ||
local player = self.player | ||
player.armor = item_armor:new(player) | ||
self.name, self.condition = nil, nil | ||
return -- something to tell that armor is destroyed? | ||
end | ||
self.protection = item_armor_list[self.name].resistance[self.condition] | ||
end | ||
|
||
return item_armor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
local armor = {} | ||
|
||
--[[ | ||
full_name = 'insert name' | ||
durability = num (average # of attacks it takes to wear armor out) | ||
resistance = { | ||
condition = {protection=num}, | ||
} | ||
** As condition becomes worse armor starts to lose resistance (with the exception of a few armors) | ||
--]] | ||
|
||
armor.leather = {} | ||
armor.leather.durability = 32 | ||
armor.leather.resistance = { | ||
[1] = {blunt=1}, | ||
[2] = {blunt=1}, | ||
[3] = {blunt=1}, | ||
[4] = {blunt=1}, | ||
} | ||
|
||
armor.firesuit = {} | ||
armor.firesuit.durability = 4 | ||
armor.firesuit.resistance = { | ||
[1] = {acid=1}, | ||
[2] = {acid=2}, | ||
[3] = {acid=3}, | ||
[4] = {acid=4}, | ||
} | ||
|
||
return armor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters