;;;; ;;;; Naledi ya Africa ("Star of Africa") is a rogue-like survival game ;;;; set in Africa. ;;;; ;;;; This file defines in-game items. ;;;; ;;;; (c) 2018 Daniel Vedder, MIT license ;;;; (let ((item-list NIL)) (defun register-item (symbol-name item-object) (setf item-list (cons (list symbol-name item-object) item-list))) (defun get-item-type (symbol-name) (cassoc symbol-name item-list)) (defun get-item (symbol-name) ;;FIXME copy-item doesn't work with CLOS (copy-item (get-item-type symbol-name)))) (defmacro new-item (type name &body body) `(register-item ,name (make-instance ,type ,@body))) ;;; RESOURCE ITEMS ;;TODO sand, glass, clay, bricks (new-item 'resource 'wood :name "wood" :weight 1 :description "A block of wood, just right for working with" :burning-product 'charcoal) (new-item 'resource 'charcoal :name "charcoal" :weight 1 :description "A black lump of charcoal. Burns better than wood.") (new-item 'resource 'stone :name "stone" :weight 2 :description "A fist-sized stone. What are you going to do with it?") (new-item 'resource 'iron-ore :name "iron ore" :weight 4 :description "A lump of iron ore - still needs to be smelted." :burning-product 'iron) (new-item 'resource 'iron :name "iron" :weight 3 :description "An iron ingot, ready for further crafting.") ;;; LANDSCAPE FEATURES (new-item 'feature 'acacia :name "acacia" :description "A tall acacia tree, spreading its branches wide." :destroy-with '(wood) :drops '(wood) :weight 2000 :char #\T :color :green) (new-item 'feature 'miombo :name "miombo" :description "A small, crooked miombo tree." :destroy-with '(wood) :drops '(wood) :weight 500 :char #\Y :color :green) (new-item 'feature 'boulder :name "boulder" :description "A huge lump of grey basalt, sticking out of the ground." :destroy-with '(stone) :drops '(stone) :weight 5000 :char #\8 :color :gray) ;;TODO termite hill, palm, baobab, cactus, pond ;;; TOOL ITEMS ;;TODO bronze tools, weapons (new-item 'tool 'stone-axe :name "stone axe" :description "An axe, crudely but effectively fashioned out of stone." :type 'wood :level 1 :weight 2 :craft-with '(stone wood)) (new-item 'tool 'iron-axe :name "iron axe" :description "A finely honed iron axe, just right for chopping wood." :type 'wood :level 3 :weight 3 :craft-with '(iron wood)) (new-item 'tool 'stone-pickaxe :name "stone pickaxe" :description "A pickaxe, somewhat helplessly made from stone." :type 'stone :level 1 :weight 3 :craft-with '(stone stone wood)) (new-item 'tool 'iron-pickaxe :name "iron pickaxe" :description "A solid iron pickaxe. Prepare to split rock!" :type 'stone :level 3 :weight 4 :craft-with '(iron iron wood))