update
This commit is contained in:
@@ -30,6 +30,7 @@ var situation_pause: float = 0.0 # bis die nächste kommen darf
|
||||
var probleme_bekannt: Dictionary = {} # human_id -> {problem -> true}
|
||||
var problem_stand: Dictionary = {} # "human:problem" -> gelungene Anwendungen
|
||||
var ueberwunden: Dictionary = {} # human_id -> {problem -> true}
|
||||
var gesehen_zaehler: Dictionary = {} # "human:problem" -> wie oft dabeigewesen
|
||||
var completed: Array = []
|
||||
var time_h: float = 7.0
|
||||
var day: int = 1
|
||||
@@ -444,7 +445,7 @@ func ursache_geloest(human_id: String, ursache: String) -> float:
|
||||
|
||||
## Wie schnell kommt der Traum voran? Jede ungelöste Ursache bremst.
|
||||
func traum_tempo(human_id: String) -> float:
|
||||
var t := BASIS_TEMPO
|
||||
var t := BASIS_TEMPO * (1.0 + 0.15 * float(verhalten(human_id, "tempo")))
|
||||
for u in ursachen_von(human_id):
|
||||
var g := ursache_geloest(human_id, str(u))
|
||||
t *= g if g > 0.0 else float(Ursachen.LISTE[u]["faktor"])
|
||||
@@ -490,8 +491,11 @@ func system_setzen(human_id: String, nr: int, tech_id: String, widerstand: bool)
|
||||
if not pruef["geht"]:
|
||||
return {"ok": false, "grund": pruef["grund"]}
|
||||
cooldown[tech_id] = TECHNIK_COOLDOWN
|
||||
var chance := clampf(0.20 + 0.13 * float(skill_of(tech_id)) - (0.25 if widerstand else 0.0),
|
||||
0.05, 0.95)
|
||||
var chance := 0.20 + 0.13 * float(skill_of(tech_id)) - (0.25 if widerstand else 0.0)
|
||||
chance += 0.08 * float(verhalten(human_id, "einrichten"))
|
||||
if TechDB.ist_sozial(tech_id):
|
||||
chance += 0.10 * float(verhalten(human_id, "sozial"))
|
||||
chance = clampf(chance, 0.05, 0.95)
|
||||
var erfolg := randf() < chance
|
||||
if not erfolg:
|
||||
add_xp(tech_id, 1)
|
||||
@@ -499,7 +503,8 @@ func system_setzen(human_id: String, nr: int, tech_id: String, widerstand: bool)
|
||||
return {"ok": true, "erfolg": false, "guete": 0.0}
|
||||
if not systeme.has(human_id):
|
||||
systeme[human_id] = {}
|
||||
systeme[human_id][nr] = {"tech": tech_id, "guete": float(pruef["guete"])}
|
||||
var guete := float(pruef["guete"]) * (1.0 + 0.1 * float(verhalten(human_id, "guete")))
|
||||
systeme[human_id][nr] = {"tech": tech_id, "guete": guete}
|
||||
add_xp(tech_id, 2)
|
||||
notified.emit("System steht: %s um %02d:00" %
|
||||
[TechDB.by_id(tech_id)["name"], int(slots(human_id)[nr][0])], Color(0.6, 1, 0.7))
|
||||
@@ -548,6 +553,12 @@ const PROBLEM_UEBERWINDEN := 3 # so oft muss eine Technik greifen
|
||||
const SITUATION_GEWINN := 6.0 # Prozent, wenn sie früh beendet wird
|
||||
|
||||
|
||||
## Der Verhaltenswert eines Menschen, -2 bis +2 -- aus seinen Wörtern.
|
||||
func verhalten(human_id: String, key: String) -> int:
|
||||
var h := HumanDB.by_id(human_id)
|
||||
return int((h.get("verhalten", {}) as Dictionary).get(key, 0))
|
||||
|
||||
|
||||
func probleme_von(human_id: String) -> Array:
|
||||
var h := HumanDB.by_id(human_id)
|
||||
return h["probleme"] if h.has("probleme") else []
|
||||
@@ -586,8 +597,9 @@ func situationen_ticken(delta: float, wach: bool) -> void:
|
||||
var p := situation_problem()
|
||||
notified.emit("Moment verpasst: %s" % Probleme.name_von(p),
|
||||
Color(1, 0.75, 0.55))
|
||||
var wer := str(situation["mensch"])
|
||||
situation = {}
|
||||
situation_pause = SITUATION_PAUSE
|
||||
situation_pause = _pause_fuer(wer)
|
||||
state_changed.emit()
|
||||
return
|
||||
situation_pause = maxf(0.0, situation_pause - delta)
|
||||
@@ -596,6 +608,11 @@ func situationen_ticken(delta: float, wach: bool) -> void:
|
||||
_situation_starten()
|
||||
|
||||
|
||||
## Luft bis zum nächsten Moment -- ein reizbarer Mensch hat weniger davon.
|
||||
func _pause_fuer(human_id: String) -> float:
|
||||
return SITUATION_PAUSE * (1.0 - 0.25 * float(verhalten(human_id, "momente")))
|
||||
|
||||
|
||||
func _situation_starten() -> void:
|
||||
var offen: Array = []
|
||||
for p in probleme_von(active_mission):
|
||||
@@ -613,8 +630,10 @@ func _situation_starten() -> void:
|
||||
"mensch": active_mission,
|
||||
"key": str(moeglich[randi() % moeglich.size()]),
|
||||
"problem": problem,
|
||||
"rest": SITUATION_DAUER,
|
||||
"rest": SITUATION_DAUER * (1.0 + 0.25 * float(verhalten(active_mission, "dauer"))),
|
||||
}
|
||||
if verhalten(active_mission, "sichtbar") > 0:
|
||||
situation_sehen() # man sieht es ihm sofort an
|
||||
state_changed.emit()
|
||||
|
||||
|
||||
@@ -626,6 +645,11 @@ func situation_sehen() -> void:
|
||||
var p := situation_problem()
|
||||
if problem_bekannt(id, p):
|
||||
return
|
||||
if verhalten(id, "sichtbar") < 0:
|
||||
var schluessel := "%s:%s" % [id, p]
|
||||
gesehen_zaehler[schluessel] = int(gesehen_zaehler.get(schluessel, 0)) + 1
|
||||
if int(gesehen_zaehler[schluessel]) < 2:
|
||||
return # verschlossen: erst beim zweiten Mal zu durchschauen
|
||||
if not probleme_bekannt.has(id):
|
||||
probleme_bekannt[id] = {}
|
||||
probleme_bekannt[id][p] = true
|
||||
@@ -664,7 +688,7 @@ func situation_anwenden(tech_id: String) -> Dictionary:
|
||||
problem_stand[schluessel] = problem_fortschritt(id, problem) + 1
|
||||
situation_sehen()
|
||||
situation = {}
|
||||
situation_pause = SITUATION_PAUSE
|
||||
situation_pause = _pause_fuer(id)
|
||||
if id == active_mission:
|
||||
progress[id] = minf(mission_progress(id) + SITUATION_GEWINN, MISSION_ZIEL)
|
||||
notified.emit("%s trägt durch +%d %%" %
|
||||
|
||||
Reference in New Issue
Block a user