diff --git a/alien-rpg.el b/alien-rpg.el index ddaef0d..e7776cc 100644 --- a/alien-rpg.el +++ b/alien-rpg.el @@ -458,7 +458,7 @@ (:id "GH-komunikacni-vez" :deck "GH" :name "Komunikační věž / DA/UT/UR" :location "Mezi G a H" :note "Komunikační počítač (Daughter)." :desc "Vertikální věž s komunikačním počítačem DA/UT/UR (Daughter). Úzká — snadno bránitelná, ale i past. Alternativa k MU/TH/UR na palubě B." - :connections ("G-shromazdiste" "H-centralni-sachta")) + :connections ("G-shromazdiste" "H-ridici-centrum")) ;; === Paluba H === (:id "H-plasma-sz" :deck "H" :name "Plasmová stanice (SZ)" @@ -508,7 +508,7 @@ (:id "H-ridici-centrum" :deck "H" :name "Řídící centrum" :location "Střed" :note "" :desc "Řídící centrum průmyslové paluby. Konzole pro ovládání tavení, plasmy, destilace. Možnost sabotáže nebo nouzového vypnutí." - :connections ("H-dilny-z" "H-dilny-v" "H-strojovna-z" "H-strojovna-v" "H-centralni-sachta")) + :connections ("H-dilny-z" "H-dilny-v" "H-strojovna-z" "H-strojovna-v" "H-centralni-sachta" "GH-komunikacni-vez")) (:id "H-strojovna-z" :deck "H" :name "Strojovna (Z)" :location "Jih-západ" :note "" :desc "Těžké strojní vybavení. Hlučné, horké, špatná viditelnost od páry." @@ -544,7 +544,7 @@ (:id "H-centralni-sachta" :deck "H" :name "Centrální šachta" :location "Střed" :note "" :desc "Vertikální šachta na NEJVĚTŠÍ palubě stanice (měřítko 10 m). Žebříky a servisní plošiny. Průmyslový hluk ze všech stran." - :connections ("H-ridici-centrum" "GH-komunikacni-vez" + :connections ("H-ridici-centrum" "B-centralni-sachta" "C-centralni-sachta" "D-centralni-sachta" "E-centralni-sachta" "F-centralni-sachta" "G-centralni-sachta" "I-centralni-sachta" "J-centralni-sachta")) @@ -637,11 +637,8 @@ :tiny-items () :injuries () :conditions () - :xp 0 :story-points 0 - :notes () - :buddy nil - :rival nil) + :notes ()) "Dynamický herní stav.") (defvar alien-rpg-state-file @@ -1043,8 +1040,10 @@ Průlezy G<->H: G3<->H3, G4<->H4, G7<->H7, G8<->H8, G9<->H9 (st alien-rpg-state) (room (alien-rpg--current-room)) (attrs (plist-get ch :attributes)) + (skills (plist-get ch :skills)) (health (plist-get st :health)) (stress (plist-get st :stress)) + (resolve (or (plist-get st :resolve) 4)) (weapons (plist-get st :weapons)) (armor (plist-get st :armor)) (gear (plist-get ch :gear)) @@ -1054,37 +1053,32 @@ Průlezy G<->H: G3<->H3, G4<->H4, G7<->H7, G8<->H8, G9<->H9 (with-current-buffer (get-buffer-create "*Alien RPG*") (let ((inhibit-read-only t)) (erase-buffer) - ;; Hlavicka - (insert (format "%s\n" (plist-get ch :name))) - (insert (format "%s, %s let\n" (plist-get ch :career) (plist-get ch :age))) - ;; Atributy - (insert (format "Str %s Agi %s Wit %s Emp %s\n" - (plist-get attrs :strength) (plist-get attrs :agility) - (plist-get attrs :wits) (plist-get attrs :empathy))) - ;; Health / Stress / Resolve - (insert (format "Health: %d/4 | Stress: %d | Resolve: %d\n" - health stress (or (plist-get st :resolve) 4))) - ;; Dovednosti (jen nenulove) - (let ((skills-str - (mapconcat - (lambda (sk) - (let* ((key (car sk)) - (val (plist-get (plist-get ch :skills) key))) - (when (> val 0) - (format "%s %d" (cdr (assq key alien-rpg-skill-names)) val)))) - alien-rpg-skill-attributes ""))) - (insert (format "Dovednosti: %s\n" - (string-join (cl-remove-if #'null - (mapcar (lambda (sk) - (let* ((key (car sk)) - (val (plist-get (plist-get ch :skills) key))) - (when (> val 0) - (format "%s %d" (cdr (assq key alien-rpg-skill-names)) val)))) - alien-rpg-skill-attributes)) ", ")))) + (insert (format "%s — %s, %s let\n\n" + (plist-get ch :name) (plist-get ch :career) (plist-get ch :age))) + ;; Atributy a dovednosti - strukturovane + (insert (format "STRENGTH %d: Close Combat %d, Heavy Machinery %d, Stamina %d\n" + (plist-get attrs :strength) + (plist-get skills :close-combat) (plist-get skills :heavy-machinery) + (plist-get skills :stamina))) + (insert (format "AGILITY %d: Mobility %d, Piloting %d, Ranged Combat %d\n" + (plist-get attrs :agility) + (plist-get skills :mobility) (plist-get skills :piloting) + (plist-get skills :ranged-combat))) + (insert (format "WITS %d: Comtech %d, Observation %d, Survival %d\n" + (plist-get attrs :wits) + (plist-get skills :comtech) (plist-get skills :observation) + (plist-get skills :survival))) + (insert (format "EMPATHY %d: Command %d, Manipulation %d, Medical Aid %d\n\n" + (plist-get attrs :empathy) + (plist-get skills :command) (plist-get skills :manipulation) + (plist-get skills :medical-aid))) + ;; Stav + (insert (format "Health: %d | Stress: %d | Resolve: %d | Story points: %s\n" + health stress resolve (or (plist-get st :story-points) 0))) ;; Talent (insert (format "Talent: %s\n" (plist-get ch :talent))) ;; Pozice - (insert (format "Pozice: %s [%s]\n" (plist-get room :name) (plist-get room :id))) + (insert (format "Pozice: %s [%s]\n\n" (plist-get room :name) (plist-get room :id))) ;; Vybava (let ((all-gear (append gear extra))) (insert (format "Výbava: %s\n" (if all-gear (string-join all-gear ", ") "--")))) @@ -1112,15 +1106,7 @@ Průlezy G<->H: G3<->H3, G4<->H4, G7<->H7, G8<->H8, G9<->H9 ;; Zraneni a stavy (insert (format "Zranění: %s\n" (if injuries (string-join injuries ", ") "--"))) (insert (format "Stavy: %s\n" (if conditions (string-join conditions ", ") "--"))) - ;; Vztahy - (insert (format "Buddy: %s | Rival: %s\n" - (or (plist-get st :buddy) "--") - (or (plist-get st :rival) "--"))) - ;; XP / Story points - (insert (format "XP: %s | Story points: %s\n" - (or (plist-get st :xp) 0) - (or (plist-get st :story-points) 0))) - ;; Signature item + ;; Signature (insert (format "Signature: %s\n" (or (plist-get ch :signature-item) "--")))) (goto-char (point-min)) (special-mode)) @@ -1191,32 +1177,78 @@ Průlezy G<->H: G3<->H3, G4<->H4, G7<->H7, G8<->H8, G9<->H9 (message "Resolve: %d (%s%d)" new-val (if (>= n 0) "+" "") n))) (defun alien-rpg-set-stat () - "Změň atribut nebo dovednost." + "Univerzální editor — změň cokoliv na kartě." (interactive) - (let* ((choices '(("Strength" . (:attributes :strength)) - ("Agility" . (:attributes :agility)) - ("Wits" . (:attributes :wits)) - ("Empathy" . (:attributes :empathy)) - ("Close Combat" . (:skills :close-combat)) - ("Heavy Machinery" . (:skills :heavy-machinery)) - ("Stamina" . (:skills :stamina)) - ("Mobility" . (:skills :mobility)) - ("Piloting" . (:skills :piloting)) - ("Ranged Combat" . (:skills :ranged-combat)) - ("Comtech" . (:skills :comtech)) - ("Observation" . (:skills :observation)) - ("Survival" . (:skills :survival)) - ("Command" . (:skills :command)) - ("Manipulation" . (:skills :manipulation)) - ("Medical Aid" . (:skills :medical-aid)))) - (choice (completing-read "Stat: " choices nil t)) - (path (cdr (assoc choice choices))) - (category (car path)) - (key (cadr path)) - (current-val (plist-get (plist-get alien-rpg-character category) key)) - (new-val (read-number (format "%s [%d]: " choice current-val) current-val))) - (plist-put (plist-get alien-rpg-character category) key new-val) - (message "%s: %d -> %d" choice current-val new-val))) + (let* ((st-choices '(("Health" . :health) + ("Stress" . :stress) + ("Resolve" . :resolve) + ("Story points" . :story-points))) + (attr-choices '(("Strength" . (:attributes :strength)) + ("Agility" . (:attributes :agility)) + ("Wits" . (:attributes :wits)) + ("Empathy" . (:attributes :empathy)))) + (skill-choices '(("Close Combat" . (:skills :close-combat)) + ("Heavy Machinery" . (:skills :heavy-machinery)) + ("Stamina" . (:skills :stamina)) + ("Mobility" . (:skills :mobility)) + ("Piloting" . (:skills :piloting)) + ("Ranged Combat" . (:skills :ranged-combat)) + ("Comtech" . (:skills :comtech)) + ("Observation" . (:skills :observation)) + ("Survival" . (:skills :survival)) + ("Command" . (:skills :command)) + ("Manipulation" . (:skills :manipulation)) + ("Medical Aid" . (:skills :medical-aid)))) + (all-names (append (mapcar #'car st-choices) (mapcar #'car attr-choices) (mapcar #'car skill-choices))) + (choice (completing-read "Editovat: " all-names nil t)) + (st-match (assoc choice st-choices)) + (attr-match (assoc choice attr-choices)) + (skill-match (assoc choice skill-choices))) + (cond + ;; State value (health, stress, resolve, story-points) + (st-match + (let* ((key (cdr st-match)) + (current (or (plist-get alien-rpg-state key) 0)) + (new-val (read-number (format "%s [%d] -> " choice current) current))) + (setq alien-rpg-state (plist-put alien-rpg-state key (max 0 new-val))) + (alien-rpg--autosave) + (message "%s: %d -> %d" choice current new-val))) + ;; Attribute + (attr-match + (let* ((path (cdr attr-match)) + (current (plist-get (plist-get alien-rpg-character (car path)) (cadr path))) + (new-val (read-number (format "%s [%d] -> " choice current) current))) + (plist-put (plist-get alien-rpg-character (car path)) (cadr path) new-val) + (message "%s: %d -> %d" choice current new-val))) + ;; Skill + (skill-match + (let* ((path (cdr skill-match)) + (current (plist-get (plist-get alien-rpg-character (car path)) (cadr path))) + (new-val (read-number (format "%s [%d] -> " choice current) current))) + (plist-put (plist-get alien-rpg-character (car path)) (cadr path) new-val) + (message "%s: %d -> %d" choice current new-val)))))) + +(defun alien-rpg-dice () + "Kolik kostek hodit — vyber dovednost." + (interactive) + (let* ((choices (mapcar (lambda (sk) + (let* ((key (car sk)) + (attr-key (cdr sk)) + (name (cdr (assq key alien-rpg-skill-names))) + (attr-val (plist-get (plist-get alien-rpg-character :attributes) attr-key)) + (skill-val (plist-get (plist-get alien-rpg-character :skills) key)) + (total (+ attr-val skill-val)) + (attr-abbr (cdr (assq attr-key alien-rpg-attr-abbrevs)))) + (cons (format "%-18s %d (%s %d + %d)" name total attr-abbr attr-val skill-val) + (list name total attr-abbr attr-val skill-val)))) + alien-rpg-skill-attributes)) + (choice (completing-read "Hod na: " choices nil t)) + (data (cdr (assoc choice choices))) + (name (nth 0 data)) + (total (nth 1 data)) + (stress (plist-get alien-rpg-state :stress))) + (message "%s: %d základ + %d stress = %d kostek celkem" + name total stress (+ total stress)))) (defun alien-rpg-add-injury (injury) "Přidej zranění." @@ -1270,19 +1302,6 @@ Průlezy G<->H: G3<->H3, G4<->H4, G7<->H7, G8<->H8, G9<->H9 (alien-rpg--autosave) (message "Stav: %s" cond-name))) -(defun alien-rpg-set-buddy (name) - "Nastav Buddy." - (interactive "sBuddy: ") - (setq alien-rpg-state (plist-put alien-rpg-state :buddy name)) - (alien-rpg--autosave) - (message "Buddy: %s" name)) - -(defun alien-rpg-set-rival (name) - "Nastav Rivala." - (interactive "sRival: ") - (setq alien-rpg-state (plist-put alien-rpg-state :rival name)) - (alien-rpg--autosave) - (message "Rival: %s" name)) (defun alien-rpg-add-note (note) "Přidej poznámku." @@ -1326,15 +1345,13 @@ Průlezy G<->H: G3<->H3, G4<->H4, G7<->H7, G8<->H8, G9<->H9 :desc "Dovednosti" "i" #'alien-rpg-skills :desc "Health" "h" #'alien-rpg-set-health :desc "Stress" "S" #'alien-rpg-set-stress - :desc "Resolve" "r" #'alien-rpg-set-resolve - :desc "Upravit stat" "e" #'alien-rpg-set-stat + :desc "Kostky" "r" #'alien-rpg-dice + :desc "Editovat" "e" #'alien-rpg-set-stat :desc "Zraneni" "j" #'alien-rpg-add-injury :desc "Vybava" "g" #'alien-rpg-add-gear :desc "Zbran" "W" #'alien-rpg-add-weapon :desc "Brneni" "a" #'alien-rpg-add-armor :desc "Stav/condition" "c" #'alien-rpg-add-condition - :desc "Buddy" "b" #'alien-rpg-set-buddy - :desc "Rival" "R" #'alien-rpg-set-rival :desc "Poznámka" "n" #'alien-rpg-add-note :desc "Poznamky" "N" #'alien-rpg-show-notes :desc "Uložit" "q" #'alien-rpg-save-state