From 768895badc1cb641caa494b7df7ddd1061478333 Mon Sep 17 00:00:00 2001 From: shru Date: Fri, 14 Dec 2018 15:38:35 -0500 Subject: [PATCH] Add item deck. --- src/database/items.lua | 21 ++++++++++++++++++++ src/item_deck.lua | 45 ++++++++++++++++++++++++++++++++++++++++++ src/main.lua | 25 +++++------------------ 3 files changed, 71 insertions(+), 20 deletions(-) create mode 100644 src/database/items.lua create mode 100644 src/item_deck.lua diff --git a/src/database/items.lua b/src/database/items.lua new file mode 100644 index 0000000..35bf472 --- /dev/null +++ b/src/database/items.lua @@ -0,0 +1,21 @@ +return { + -- Weapons + wPolar = { + name = "Polar Star", + map = "Pole", + getText = "Got the =Polar Star=!", + command = "= 1, 'No applicable items!') + + -- Select an item. + local selected = _.sample(applicable) + local index = self._indexMap[selected] + table.remove(self._left, index) + self._indexMap[selected] = nil + + return selected +end + +return C diff --git a/src/main.lua b/src/main.lua index af6bf22..0037285 100644 --- a/src/main.lua +++ b/src/main.lua @@ -20,26 +20,6 @@ function logNotice(...) _log(3, 'NOTICE: ', ...) end function logInfo(...) _log(4, 'INFO: ', ...) end function logDebug(...) _log(5, 'DEBUG: ', ...) end -local ITEM_DATA = { - -- Weapons - wPolar = { - name = "Polar Star", - map = "Pole", - getText = "Got the =Polar Star=!", - command = "