§0.3 entschieden: OSE-ähnliche Basis, Punktekauf, Volk + Klasse, Stufen 1-5 mit Meilensteinen. Eigene Formulierungen und Tabellen, kein Regeltext übernommen. docs/systeme.md: Attribute und Modifikatoren, vier Völker, vier Klassen, abgeleitete Werte, einheitliche d20-Proben, Rasterkampf (18x9, 4 Felder, eine Aktion, Reichweiten 1/4/6/8, keine Gelegenheitsangriffe), Vancian-Magie mit drei Graden, acht Gegnerwerte für die gebaute Kreaturen-Serie, Reise/Rast und das JSON-Datenmodell. Papierprobe als Simulation (tools/regelprobe.py, 5000 Läufe): 3-4 Goblins 96-99 % Sieg in 3,6-4,7 Runden, 5 Goblins 88 % in 5,7, 3 Orks 64 % in 7,0. Kein Treffer tötet; die Encounter-Richtwerte stehen im Dokument. Roadmap 0.3 abgehakt, 0.4 nennt nur noch docs/ui.md (8x10-Neusatz); Projektbeschreibung verweist auf systeme.md. Offen sind Inhalte (Zauberlisten, Gegenstände), keine Regeln.
119 lines
3.9 KiB
Python
119 lines
3.9 KiB
Python
#!/usr/bin/env python3
|
|
"""Regelprobe — Kampfbalance der Stufe-1-Gruppe gegen Gegnergruppen.
|
|
|
|
Kein Teil der Engine: eine Papierprobe als Simulation. Vier Figuren der
|
|
Stufe 1 (Kämpfer, Kleriker, Magier, Dieb) treten gegen die Gruppen aus
|
|
`docs/systeme.md` §11 an. Modelliert ist nur Bewegung, Nahkampf und ein
|
|
Magisches Geschoss — Heilung, Deckung und Positionierung fehlen, echte
|
|
Kämpfe sind also eher günstiger.
|
|
|
|
python3 tools/regelprobe.py [LÄUFE]
|
|
"""
|
|
from __future__ import annotations
|
|
|
|
import random
|
|
import statistics
|
|
import sys
|
|
|
|
SEED = 20261114
|
|
SCENARIOS = {
|
|
"3 Goblins": [("Goblin", 5, 12, 1, 1, 6, 4)] * 3,
|
|
"4 Goblins": [("Goblin", 5, 12, 1, 1, 6, 4)] * 4,
|
|
"5 Goblins": [("Goblin", 5, 12, 1, 1, 6, 4)] * 5,
|
|
"3 Orks": [("Ork", 11, 13, 2, 1, 8, 4)] * 3,
|
|
"2 Orks + 2 Goblins": [("Ork", 11, 13, 2, 1, 8, 4)] * 2
|
|
+ [("Goblin", 5, 12, 1, 1, 6, 4)] * 2,
|
|
}
|
|
|
|
|
|
def d(n: int) -> int:
|
|
return random.randint(1, n)
|
|
|
|
|
|
class Unit:
|
|
def __init__(self, name, hp, ac, ab, n, sides, move, side, spell=False):
|
|
self.name, self.hp, self.ac, self.ab = name, hp, ac, ab
|
|
self.hp = hp
|
|
self.dice, self.sides = n, sides
|
|
self.move, self.side = move, side
|
|
self.spell = spell
|
|
self.slots = 1 if spell else 0
|
|
self.down = False
|
|
self.x = self.y = 0
|
|
|
|
def attack(self, target: "Unit") -> None:
|
|
if self.spell and self.slots > 0:
|
|
self.slots -= 1
|
|
target.hp -= d(4) + 1
|
|
elif d(20) + self.ab >= target.ac:
|
|
target.hp -= sum(d(self.sides) for _ in range(self.dice))
|
|
if target.hp <= 0:
|
|
target.down = True
|
|
|
|
|
|
def dist(a: Unit, b: Unit) -> int:
|
|
return max(abs(a.x - b.x), abs(a.y - b.y))
|
|
|
|
|
|
def fight(mobs: list[Unit]) -> tuple[int, int, bool]:
|
|
pcs = [
|
|
Unit("Kämpfer", 9, 15, 3, 1, 8, 4, "pc"),
|
|
Unit("Kleriker", 7, 15, 1, 1, 6, 4, "pc"),
|
|
Unit("Magier", 4, 11, 1, 1, 6, 4, "pc", spell=True),
|
|
Unit("Dieb", 6, 13, 3, 1, 6, 4, "pc"),
|
|
]
|
|
for i, p in enumerate(pcs):
|
|
p.x, p.y = 1, 1 + i
|
|
for i, m in enumerate(mobs):
|
|
m.x, m.y = 11, 2 + i * 2
|
|
|
|
rounds = 0
|
|
while rounds < 20:
|
|
rounds += 1
|
|
order = sorted((u for u in pcs + mobs if not u.down),
|
|
key=lambda u: d(20) + (2 if u.name == "Dieb" else 0),
|
|
reverse=True)
|
|
for u in order:
|
|
if u.down:
|
|
continue
|
|
foes = [f for f in (mobs if u.side == "pc" else pcs) if not f.down]
|
|
if not foes:
|
|
break
|
|
target = min(foes, key=lambda f: dist(u, f))
|
|
steps = u.move
|
|
while steps > 0 and dist(u, target) > 1:
|
|
if u.x < target.x:
|
|
u.x += 1
|
|
elif u.x > target.x:
|
|
u.x -= 1
|
|
elif u.y < target.y:
|
|
u.y += 1
|
|
elif u.y > target.y:
|
|
u.y -= 1
|
|
steps -= 1
|
|
if dist(u, target) <= 1 or (u.spell and dist(u, target) <= 6):
|
|
u.attack(target)
|
|
if all(p.down for p in pcs) or all(m.down for m in mobs):
|
|
break
|
|
return rounds, sum(p.down for p in pcs), all(m.down for m in mobs)
|
|
|
|
|
|
def main() -> int:
|
|
n = int(sys.argv[1]) if len(sys.argv) > 1 else 5000
|
|
random.seed(SEED)
|
|
print(f"{'Gegner':22s} {'Sieg':>6s} {'Runden':>7s} {'gefallen':>9s}")
|
|
for name, spec in SCENARIOS.items():
|
|
results = []
|
|
for _ in range(n):
|
|
mobs = [Unit(m[0], m[1], m[2], m[3], m[4], m[5], m[6], "mob")
|
|
for m in spec]
|
|
results.append(fight(mobs))
|
|
wins = sum(1 for _, _, w in results if w)
|
|
rounds = statistics.mean(r for r, _, _ in results)
|
|
down = statistics.mean(dd for _, dd, _ in results)
|
|
print(f"{name:22s} {wins / n:6.1%} {rounds:7.1f} {down:9.2f}")
|
|
return 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
sys.exit(main())
|