Conditions: toggle system with known states + panic table
Replace free-text conditions with toggle checkboxes: - SPC G c -> choose: Přepnout stav / Panická reakce / Vlastní - Known conditions: Starving, Dehydrated, Exhausted, Freezing, Fatigued, Radiation — shown as [X]/[ ] toggles - Panic table: Jumpy, Freeze, Tunnel Vision, etc. with stress level - Status display shows all known conditions with checkbox state Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
111
alien-rpg.el
111
alien-rpg.el
@@ -1095,7 +1095,15 @@ Průlezy G<->H: G3<->H3, G4<->H4, G7<->H7, G8<->H8, G9<->H9
|
|||||||
"--")))
|
"--")))
|
||||||
;; Zraneni a stavy
|
;; Zraneni a stavy
|
||||||
(insert (format "Zranění: %s\n" (if injuries (string-join injuries ", ") "--")))
|
(insert (format "Zranění: %s\n" (if injuries (string-join injuries ", ") "--")))
|
||||||
(insert (format "Stavy: %s\n" (if conditions (string-join conditions ", ") "--")))
|
(insert (format "Stavy: %s"
|
||||||
|
(mapconcat (lambda (c)
|
||||||
|
(format "[%s] %s"
|
||||||
|
(if (member c conditions) "X" " ") c))
|
||||||
|
alien-rpg-known-conditions ", ")))
|
||||||
|
(let ((extra-conds (cl-remove-if (lambda (c) (member c alien-rpg-known-conditions)) conditions)))
|
||||||
|
(when extra-conds
|
||||||
|
(insert (format ", %s" (mapconcat (lambda (c) (format "[X] %s" c)) extra-conds ", ")))))
|
||||||
|
(insert "\n")
|
||||||
;; Signature
|
;; Signature
|
||||||
(insert (format "Signature: %s\n" (or (plist-get ch :signature-item) "--"))))
|
(insert (format "Signature: %s\n" (or (plist-get ch :signature-item) "--"))))
|
||||||
(goto-char (point-min))
|
(goto-char (point-min))
|
||||||
@@ -1530,29 +1538,92 @@ FORMAT-FN dostane item, vrátí string. Bez FORMAT-FN se item použije přímo."
|
|||||||
(alien-rpg--autosave)
|
(alien-rpg--autosave)
|
||||||
(message "Vyléčeno: %s" (nth idx injuries)))))))
|
(message "Vyléčeno: %s" (nth idx injuries)))))))
|
||||||
|
|
||||||
|
(defvar alien-rpg-known-conditions
|
||||||
|
'("Starving" "Dehydrated" "Exhausted" "Freezing" "Fatigued" "Radiation")
|
||||||
|
"Standardní stavy z herní karty.")
|
||||||
|
|
||||||
|
(defvar alien-rpg-panic-effects
|
||||||
|
'(("7 lichá: Jumpy" . "Jumpy")
|
||||||
|
("7 sudá: Freeze" . "Freeze")
|
||||||
|
("8 lichá: Tunnel Vision" . "Tunnel Vision")
|
||||||
|
("8 sudá: Seek Cover" . "Seek Cover")
|
||||||
|
("9 lichá: Aggravated" . "Aggravated")
|
||||||
|
("9 sudá: Scream" . "Scream")
|
||||||
|
("10 lichá: Shakes" . "Shakes")
|
||||||
|
("10 sudá: Flee" . "Flee")
|
||||||
|
("11 lichá: Frantic" . "Frantic")
|
||||||
|
("11 sudá: Frenzy" . "Frenzy")
|
||||||
|
("12 lichá: Deflated" . "Deflated")
|
||||||
|
("12 sudá: Catatonic" . "Catatonic")
|
||||||
|
("13-14 lichá: Paranoid" . "Paranoid")
|
||||||
|
("13-14 sudá: Hesitant" . "Hesitant"))
|
||||||
|
"Panické reakce podle stress levelu.")
|
||||||
|
|
||||||
(defun alien-rpg-condition ()
|
(defun alien-rpg-condition ()
|
||||||
"Stav/podmínka — přidat nebo odebrat."
|
"Přepni stav/podmínku — zaškrtni nebo odškrtni."
|
||||||
(interactive)
|
(interactive)
|
||||||
(let* ((conditions (plist-get alien-rpg-state :conditions))
|
(let* ((conditions (plist-get alien-rpg-state :conditions))
|
||||||
(actions (if conditions '("Přidat" "Odebrat") '("Přidat")))
|
(action (completing-read "Podmínky: "
|
||||||
(action (if conditions
|
'("Přepnout stav" "Panická reakce" "Vlastní") nil t)))
|
||||||
(completing-read "Podmínka: " actions nil t)
|
|
||||||
"Přidat")))
|
|
||||||
(cond
|
(cond
|
||||||
((string= action "Přidat")
|
((string= action "Přepnout stav")
|
||||||
(let ((cond-name (read-string "Stav: ")))
|
(let* ((candidates
|
||||||
(setq alien-rpg-state (plist-put alien-rpg-state :conditions
|
(mapcar (lambda (c)
|
||||||
(append conditions (list cond-name))))
|
(format "[%s] %s"
|
||||||
(alien-rpg--autosave)
|
(if (member c conditions) "X" " ") c))
|
||||||
(message "Stav: %s" cond-name)))
|
alien-rpg-known-conditions))
|
||||||
((string= action "Odebrat")
|
(choice (completing-read "Stav: " candidates nil t))
|
||||||
(let* ((candidates (alien-rpg--numbered-candidates conditions))
|
(cond-name (substring choice 4)))
|
||||||
(choice (completing-read "Odebrat: " candidates nil t))
|
(if (member cond-name conditions)
|
||||||
(idx (cdr (assoc choice candidates))))
|
(progn
|
||||||
(setq alien-rpg-state (plist-put alien-rpg-state :conditions
|
(setq alien-rpg-state
|
||||||
(alien-rpg--remove-nth idx conditions)))
|
(plist-put alien-rpg-state :conditions
|
||||||
(alien-rpg--autosave)
|
(remove cond-name conditions)))
|
||||||
(message "Odebráno: %s" (nth idx conditions)))))))
|
(alien-rpg--autosave)
|
||||||
|
(message "[ ] %s" cond-name))
|
||||||
|
(setq alien-rpg-state
|
||||||
|
(plist-put alien-rpg-state :conditions
|
||||||
|
(append conditions (list cond-name))))
|
||||||
|
(alien-rpg--autosave)
|
||||||
|
(message "[X] %s" cond-name))))
|
||||||
|
((string= action "Panická reakce")
|
||||||
|
(let* ((candidates
|
||||||
|
(mapcar (lambda (p)
|
||||||
|
(let ((label (car p))
|
||||||
|
(name (cdr p)))
|
||||||
|
(format "[%s] %s"
|
||||||
|
(if (member name conditions) "X" " ")
|
||||||
|
label)))
|
||||||
|
alien-rpg-panic-effects))
|
||||||
|
(choice (completing-read "Panika: " candidates nil t))
|
||||||
|
(idx (cl-position choice candidates :test #'string=))
|
||||||
|
(cond-name (cdr (nth idx alien-rpg-panic-effects))))
|
||||||
|
(if (member cond-name conditions)
|
||||||
|
(progn
|
||||||
|
(setq alien-rpg-state
|
||||||
|
(plist-put alien-rpg-state :conditions
|
||||||
|
(remove cond-name conditions)))
|
||||||
|
(alien-rpg--autosave)
|
||||||
|
(message "[ ] %s" cond-name))
|
||||||
|
(setq alien-rpg-state
|
||||||
|
(plist-put alien-rpg-state :conditions
|
||||||
|
(append conditions (list cond-name))))
|
||||||
|
(alien-rpg--autosave)
|
||||||
|
(message "[X] %s" cond-name))))
|
||||||
|
((string= action "Vlastní")
|
||||||
|
(let ((cond-name (read-string "Název: ")))
|
||||||
|
(if (member cond-name conditions)
|
||||||
|
(progn
|
||||||
|
(setq alien-rpg-state
|
||||||
|
(plist-put alien-rpg-state :conditions
|
||||||
|
(remove cond-name conditions)))
|
||||||
|
(alien-rpg--autosave)
|
||||||
|
(message "[ ] %s" cond-name))
|
||||||
|
(setq alien-rpg-state
|
||||||
|
(plist-put alien-rpg-state :conditions
|
||||||
|
(append conditions (list cond-name))))
|
||||||
|
(alien-rpg--autosave)
|
||||||
|
(message "[X] %s" cond-name)))))))
|
||||||
|
|
||||||
;; ====================================================================
|
;; ====================================================================
|
||||||
;; DISPATCH, HELP, VIEW MODE
|
;; DISPATCH, HELP, VIEW MODE
|
||||||
|
|||||||
Reference in New Issue
Block a user