diff options
| author | El-BG-1970 <elouangros@hotmail.com> | 2022-08-04 11:13:32 +0200 |
|---|---|---|
| committer | El-BG-1970 <elouangros@hotmail.com> | 2022-08-04 11:13:32 +0200 |
| commit | 164b961cdd97c4ef324bbb0ae5f46b394201183b (patch) | |
| tree | 0051bfc0d5c91e150eec85f8860f3244332a0764 /src/game.lisp | |
| parent | 8104b4db1c5752b777d17e1f84f8a575587c735f (diff) | |
| download | transacc-164b961cdd97c4ef324bbb0ae5f46b394201183b.tar.gz | |
implemented game:buy-item and game:sell-item
Diffstat (limited to 'src/game.lisp')
| -rw-r--r-- | src/game.lisp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/game.lisp b/src/game.lisp index 7c2cbbb..2f7ce88 100644 --- a/src/game.lisp +++ b/src/game.lisp @@ -1,6 +1,8 @@ (defpackage game (:use :cl) - (:export :new-game)) + (:export :new-game + :buy-item + :sell-item)) (in-package :game) @@ -17,3 +19,15 @@ :player player :zones zones :start-zone start-zone)) + +(defmethod buy-item ((g game) name amount) + (with-slots (player curzone) g + (let ((item (zone:get-commodity curzone name))) + (when item + (player:buy-item player name amount))))) + +(defmethod sell-item ((g game) name amount) + (with-slots (player curzone) g + (let ((item (zone:get-commodity curzone name))) + (when item + (player:sell-item player name amount))))) |
