Bläddra i källkod

Add status line support for attacks

Lily Carpenter 9 år sedan
förälder
incheckning
b84519fdf2
2 ändrade filer med 15 tillägg och 10 borttagningar
  1. 3 1
      NOTES.org
  2. 12 9
      src/crypts-and-corpses.lisp

+ 3 - 1
NOTES.org

@@ -6,9 +6,11 @@ http://www.utf8-chartable.de/unicode-utf8-table.pl?utf8=0x
6 6
 ** DONE Get bearlibterminal autowrapped and basic window working.
7 7
 CLOSED: [2016-01-01 Fri 22:52]
8 8
 ** High Priority
9
-*** TODO Add status line section for current attack
10 9
 *** TODO Tweak health, regen, and damage values.
11 10
 *** TODO Fix mana being allowed to go negative.
11
+*** TODO Add instructions page (auto show after start, h key to show later)
12
+*** DONE Add status line section for current attack
13
+CLOSED: [2016-01-12 Tue 18:52]
12 14
 *** DONE Create enemy AI
13 15
 CLOSED: [2016-01-11 Mon 23:57]
14 16
 - [X] Detect whether player can be seen

+ 12 - 9
src/crypts-and-corpses.lisp

@@ -599,18 +599,21 @@
599 599
    'enemy-map-value (game-map-terrain map)))
600 600
 
601 601
 (defun write-status-to-terminal (player prev-key map)
602
-  (declare (ignore prev-key))
603 602
   (multiple-value-bind (width height) (get-window-size)
604 603
     (declare (ignore width))
605 604
     (multiple-value-bind (x y) (calc-coord (get-location player) map)
606
-      (terminal-color (color-from-name "white"))
607
-      (terminal-print 0 (1- height) (format nil "Health: ~d Mana: ~d Location: (~d, ~d)"
608
-                                            (slot-value player 'health)
609
-                                            (slot-value player 'mana)
610
-                                            x y)))))
611
-
612
-(defun ally-p (mobile)
613
-  (typep mobile 'minion))
605
+      (let ((attack-string (cond
606
+                             ((= prev-key bearlibterminal-ffi:+tk-r+) "Choose ranged attack direction or press enter.")
607
+                             ((= prev-key bearlibterminal-ffi:+tk-m+) "Choose melee attack direction or press enter.")
608
+                             (:otherwise ""))))
609
+        (terminal-color (color-from-name "white"))
610
+        (terminal-print 0 (1- height) (format nil "Health: ~d Mana: ~d Location: (~d, ~d) ~A"
611
+                                              (slot-value player 'health)
612
+                                              (slot-value player 'mana)
613
+                                              x y attack-string)))))
614
+
615
+  (defun ally-p (mobile)
616
+    (typep mobile 'minion)))
614 617
 
615 618
 (defun bash (basher bashee)
616 619
   (decf (slot-value bashee 'health) (slot-value basher 'melee-attack-damage)))