game: Inventar — Tausch, Traglast, Seiten, Laterne, Tränke, Drag & Drop

This commit is contained in:
torsten 2026-11-17 15:27:37 +01:00
parent a78de0ffec
commit 01c312d918
30 changed files with 539 additions and 58 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

View file

@ -205,3 +205,4 @@ datum,endpoint_id,request_id,prompt,seed,lizenz
2026-11-17,fal-ai/flux-2/klein/9b,01a1e9d9-67b3-7960-bd91-7e85a0ad7b37,"single isolated game item icon, flat color shapes with hard edges, bold silhouette, limited palette of muted ochre, steel blue, olive green, warm cream and deep umber, readable at 64 pixels, isolated on a flat solid magenta background, centered, complete silhouette, no text, no letters, no frame, no cast shadow, a coiled hemp rope",9110,"FLUX.2 [klein] 9B über fal.ai (BFL Non-Commercial License: Gewichte/Selbsthosting; Outputs nach §2d frei nutzbar, keine IP-Indemnity) - 512x512, 0.2621 MP, x-fal-billable-units 1.0 = 0.01 USD, 4 Bilder"
2026-11-17,fal-ai/flux-2/klein/9b,01a1e9d9-7bb3-78e1-85e0-8a42844e0d17,"single isolated game item icon, flat color shapes with hard edges, bold silhouette, limited palette of muted ochre, steel blue, olive green, warm cream and deep umber, readable at 64 pixels, isolated on a flat solid magenta background, centered, complete silhouette, no text, no letters, no frame, no cast shadow, a cloth bundle of dried food, bread and cheese",9111,"FLUX.2 [klein] 9B über fal.ai (BFL Non-Commercial License: Gewichte/Selbsthosting; Outputs nach §2d frei nutzbar, keine IP-Indemnity) - 512x512, 0.2621 MP, x-fal-billable-units 1.0 = 0.01 USD, 4 Bilder"
2026-11-17,fal-ai/flux-2/klein/9b,01a1e9d9-feae-70b2-a91a-d586d61b0eba,"single isolated game item icon, a heavy chainmail hauberk made of small interlocking steel rings, clearly visible metal ring texture, metallic grey, short sleeves, hanging empty as a garment, flat color shapes with hard edges, bold silhouette, limited palette of steel blue, muted ochre and deep umber, readable at 64 pixels, isolated on a flat solid magenta background, centered, complete silhouette, no text, no letters, no frame, no cast shadow",9112,"FLUX.2 [klein] 9B über fal.ai (BFL Non-Commercial License: Gewichte/Selbsthosting; Outputs nach §2d frei nutzbar, keine IP-Indemnity) - 512x512, 0.2621 MP, x-fal-billable-units 1.0 = 0.01 USD, 4 Bilder"
2026-11-17,fal-ai/flux-2/klein/9b,01a1e9e4-cccc-7360-84e8-9d3ec3dbf906,"single isolated game item icon, a round glass vial filled with glowing red healing potion, a cork stopper, a small highlight on the glass, flat color shapes with hard edges, bold silhouette, limited palette of deep red, warm cream and muted ochre, readable at 64 pixels, isolated on a flat solid magenta background, centered, complete silhouette, no text, no letters, no frame, no cast shadow",9113,"FLUX.2 [klein] 9B über fal.ai (BFL Non-Commercial License: Gewichte/Selbsthosting; Outputs nach §2d frei nutzbar, keine IP-Indemnity) - 512x512, 0.2621 MP, x-fal-billable-units 1.0 = 0.01 USD, 4 Bilder"

1 datum endpoint_id request_id prompt seed lizenz
205 2026-11-17 fal-ai/flux-2/klein/9b 01a1e9d9-67b3-7960-bd91-7e85a0ad7b37 single isolated game item icon, flat color shapes with hard edges, bold silhouette, limited palette of muted ochre, steel blue, olive green, warm cream and deep umber, readable at 64 pixels, isolated on a flat solid magenta background, centered, complete silhouette, no text, no letters, no frame, no cast shadow, a coiled hemp rope 9110 FLUX.2 [klein] 9B über fal.ai (BFL Non-Commercial License: Gewichte/Selbsthosting; Outputs nach §2d frei nutzbar, keine IP-Indemnity) - 512x512, 0.2621 MP, x-fal-billable-units 1.0 = 0.01 USD, 4 Bilder
206 2026-11-17 fal-ai/flux-2/klein/9b 01a1e9d9-7bb3-78e1-85e0-8a42844e0d17 single isolated game item icon, flat color shapes with hard edges, bold silhouette, limited palette of muted ochre, steel blue, olive green, warm cream and deep umber, readable at 64 pixels, isolated on a flat solid magenta background, centered, complete silhouette, no text, no letters, no frame, no cast shadow, a cloth bundle of dried food, bread and cheese 9111 FLUX.2 [klein] 9B über fal.ai (BFL Non-Commercial License: Gewichte/Selbsthosting; Outputs nach §2d frei nutzbar, keine IP-Indemnity) - 512x512, 0.2621 MP, x-fal-billable-units 1.0 = 0.01 USD, 4 Bilder
207 2026-11-17 fal-ai/flux-2/klein/9b 01a1e9d9-feae-70b2-a91a-d586d61b0eba single isolated game item icon, a heavy chainmail hauberk made of small interlocking steel rings, clearly visible metal ring texture, metallic grey, short sleeves, hanging empty as a garment, flat color shapes with hard edges, bold silhouette, limited palette of steel blue, muted ochre and deep umber, readable at 64 pixels, isolated on a flat solid magenta background, centered, complete silhouette, no text, no letters, no frame, no cast shadow 9112 FLUX.2 [klein] 9B über fal.ai (BFL Non-Commercial License: Gewichte/Selbsthosting; Outputs nach §2d frei nutzbar, keine IP-Indemnity) - 512x512, 0.2621 MP, x-fal-billable-units 1.0 = 0.01 USD, 4 Bilder
208 2026-11-17 fal-ai/flux-2/klein/9b 01a1e9e4-cccc-7360-84e8-9d3ec3dbf906 single isolated game item icon, a round glass vial filled with glowing red healing potion, a cork stopper, a small highlight on the glass, flat color shapes with hard edges, bold silhouette, limited palette of deep red, warm cream and muted ochre, readable at 64 pixels, isolated on a flat solid magenta background, centered, complete silhouette, no text, no letters, no frame, no cast shadow 9113 FLUX.2 [klein] 9B über fal.ai (BFL Non-Commercial License: Gewichte/Selbsthosting; Outputs nach §2d frei nutzbar, keine IP-Indemnity) - 512x512, 0.2621 MP, x-fal-billable-units 1.0 = 0.01 USD, 4 Bilder

View file

@ -10,7 +10,9 @@ stummen Knopfs.
| Bild | Zeigt |
|---|---|
| [`_inventar_1920x1080.png`](_inventar_1920x1080.png) | Aldric: Schwert/Kette/Schild ausgerüstet, Rucksack mit Vorrat, Seil, Leder (gewählt), Dolch; Gold 20 |
| [`_inventar_1920x1080.png`](_inventar_1920x1080.png) | Aldric: Schwert/Kette/Schild, Rucksack mit Vorrat, Seil, Heiltrank, Dolch, Leder (gewählt); Gold 20, Last 9/26 |
| [`_geben_1920x1080.png`](_geben_1920x1080.png) | „Geben an": Bruna, Cael, Dorn (Aldric ist gesperrt) |
| [`_laterne_stadt_1920x1080.png`](_laterne_stadt_1920x1080.png) | Laterne an: warmer Lichtkreis folgt der Figur in der Stadt |
## Aufbau
@ -18,13 +20,18 @@ stummen Knopfs.
- Partei-Reiter oben (bis sechs Figuren), ausgewählter Reiter gold.
- Links **AUSGERÜSTET**: Waffe, Rüstung, Schild als Icon + Name, mit „Ablegen".
- Rechts **RUCKSACK**: 5×3-Raster à 88 px, 64er-Icon, Zähler unten rechts.
Ein Klick wählt den Gegenstand; die Detailbox zeigt Name, Typ, RK/Schaden
und die Aktion.
Mehr als 15 Gegenstände → **Seitenwechsel** mit `<` / `>`; der Titel zeigt
„RUCKSACK 1/2". Ein Klick wählt den Gegenstand; die Detailbox zeigt Name,
Typ, RK/Schaden und die Aktionen.
- **Ausrüsten** ist gesperrt, wenn die Klasse den Gegenstand nicht tragen darf
(`classes.json`: `weapons`, `armor`). Die Box nennt den Grund.
- **Benutzen** bei Verbrauchsgütern: Vorrat heilt 1d6 TP und verschwindet;
Laterne schaltet `flags["licht"]`; Seil meldet „noch keine Anwendung".
- Fußzeile: RK, Angriff, TP der gewählten Figur.
- **Geben an** öffnet die Partei-Auswahl; die Zielkapazität steht im Tooltip.
**Drag & Drop**: Gegenstand auf einen Partei-Reiter ziehen = tauschen,
auf einen ausgerüsteten Slot ziehen = ausrüsten.
- **Benutzen**: Vorrat heilt 1d6 TP, Heiltrank 2d6+2, jeweils verbraucht;
Laterne schaltet `flags["licht"]` und die echte Stadtlaterne; Seil meldet
„noch keine Anwendung".
- Fußzeile: **Last x/y** (10 + STÄ), RK, Angriff, TP der gewählten Figur.
Öffnen: Taste **I** oder der Knopf **INVENTAR** oben links in der Stadt.
Schließen: **I**, **Esc** oder „Schließen".
@ -40,8 +47,12 @@ Schließen: **I**, **Esc** oder „Schließen".
Rucksack und legt das vorher ausgerüstete Stück zurück. `Game.ablegen()`
macht das Gegenteil. `Game.rk()` rechnet sofort neu.
- `Game.gold` ist Parteigold (Start 20) und liegt im Spielstand.
- `Game.gewicht()` zählt Rucksack und ausgerüstete Stücke; `Game.kapazitaet()`
= 10 + STÄ. `Game.geben()` prüft die Zielkapazität und meldet „überladen".
- `Game.benutzen()` behandelt Verbrauchsgüter und gibt die Meldung für die UI
zurück.
- `Game.flags["licht"]` steuert den `PointLight2D` am Spieler; die Stadt liest
das Flag beim Schließen des Inventars.
```bash
godot --headless --path game -- --check
@ -52,9 +63,7 @@ godot --path game res://tools/schuss.tscn -- \
## Offen
- **Tausch zwischen Figuren**, Gewicht/Traglast.
- **Mehr als 15 Gegenstände**: Das Raster zeigt die erste Seite; Seitenwechsel
fehlt noch.
- **Echte Lichtwirkung** der Laterne (bisher nur ein Flag) und weitere
Verbrauchsgüter (Tränke).
- **Drag & Drop** statt Klick + Aktionsknopf.
- **Gewicht als Bewegungseinschränkung** (bisher nur Kapazitätsgrenze beim
Tausch, keine Mali).
- **Container, Werfen, Fallenlassen**; Tausch nur zwischen Parteifiguren.
- **Weitere Verbrauchsgüter** (Gifttrank, Elixier) nach demselben Rezept.

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 35 KiB

Before After
Before After

Binary file not shown.

After

Width:  |  Height:  |  Size: 937 KiB

View file

@ -1,7 +1,7 @@
# Item-Icons — elf Gegenstände in 64 px
# Item-Icons — zwölf Gegenstände in 64 px
Stand: 17.11.2026 · fal `klein/9b`, 512², 4 Varianten je Gegenstand.
**48 Rohbilder (11 + Kette-Nachlauf), 11 gewählt, 0,076 $**
**52 Rohbilder (11 + Kette-Nachlauf + Heiltrank), 12 gewählt, 0,082 $**
(Lizenzzeilen in [`../../license-log.csv`](../../license-log.csv)).
**Frage:** Trägt ein 64er-Iconsatz das Inventar-Raster, ohne dass die Liste
@ -29,6 +29,7 @@ bleibt der Gegenstand auch ohne Text lesbar.
| Laterne | 1 | warmes Licht, klarer Rahmen |
| Seil | 1 | geschlossener Ring, nicht zerrissen |
| Vorrat | 1 | Bündel mit Brot und Käse |
| Heiltrank | 9113/3 | runde Glasflasche, roter Trank |
Die erste Kette (9111) las sich als Stoffhemd. Der Nachlauf mit *„interlocking
steel rings, clearly visible metal ring texture"* hat es korrigiert.
@ -55,5 +56,5 @@ python3 art/tools/pixelize.py <roh> -o art/final/Objects/item_<id>_64.png \
## Offen
- Weitere Gegenstände (Tränke, Zauberkomponenten) bekommen beim Anlegen eine
- Weitere Gegenstände (Gifttrank, Zauberkomponenten) bekommen beim Anlegen eine
Zeile in `items.json` und ein Icon nach demselben Rezept.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 887 KiB

After

Width:  |  Height:  |  Size: 967 KiB

Before After
Before After

Binary file not shown.

After

Width:  |  Height:  |  Size: 181 KiB

View file

@ -0,0 +1 @@
single isolated game item icon, a round glass vial filled with glowing red healing potion, a cork stopper, a small highlight on the glass, flat color shapes with hard edges, bold silhouette, limited palette of deep red, warm cream and muted ochre, readable at 64 pixels, isolated on a flat solid magenta background, centered, complete silhouette, no text, no letters, no frame, no cast shadow

View file

@ -547,9 +547,10 @@ Struktur, Datenmodell und Effekt-Vokabel stehen in [`engine.md`](engine.md).
(384 px) und vier Klassen-Embleme (64 px) sind in Maske und Roster —
Entwurf in [`charaktererstellung.md`](charaktererstellung.md).
- [x] **Inventar**: Modal über der Karte, Partei-Reiter, 5×3-Raster mit
64er-Item-Icons, Ausrüsten/Ablegen, Klassenbeschränkung, Gold und
Verbrauchsgüter; Startgepäck in `classes.json`.
Belege: `prep/inventar/`, `prep/item-icons/`.
64er-Icons und Seitenwechsel, Ausrüsten/Ablegen, Klassenbeschränkung,
Tausch (Klick und Drag & Drop), Traglast (10 + STÄ), Gold, Heiltränke und
die echte Laterne in der Stadt. Belege: `prep/inventar/`,
`prep/item-icons/`.
- [ ] **Kartenwechsel** (Overland ↔ Stadt ↔ Dungeon).
- [x] **Titelschirm** (`scenes/title/titel.tscn`): gemaltes Titelbild,
vorgerenderte Wortmarke `ui/titel_taloria.png`, Neu/Weiter/Laden/Beenden.

View file

@ -67,7 +67,8 @@ bespielbar (Ortsbild → Gebiet → zurück).
| `art/final/Creatures/` | 11 Kreaturen **1:1** in Anzeigegröße (84/108/144/288/384/480) |
| `game/scripts/systems/charakter.gd` | Punktekauf, Volksbonus, Ableitung und Prüfung der Erstellung |
| `game/scenes/title/titel.*` | Titelschirm: Neu, Weiter, Laden (3 Slots), Beenden |
| `game/scenes/ui/inventar.*` | Inventar-Modal: Partei-Reiter, 5×3-Raster, Slots, Klassenprüfung |
| `game/scenes/ui/inventar.*` | Inventar: Partei-Reiter, 5×3-Raster, Seiten, Tausch, Klassenprüfung |
| `game/scenes/ui/{item_slot,drop_reiter,drop_slot}.gd` | Drag & Drop für Rucksack, Partei-Reiter und Slots |
| `art/prep/inventar/` | Beleg des Inventars: Screenshot, Datenmodell, offene Punkte |
| `art/prep/item-icons/` | Beleg der elf Item-Icons (64 px): Auswahl, Kette-Nachlauf |
| `game/scenes/creation/erstellung.*` | Roster (1–6) und Figurenmaske; Einstieg nach „Neu" |
@ -166,6 +167,6 @@ Ohne Raws läuft das Spiel; sie fehlen nur, wenn `pixelize.py` oder
Renderings: **≈ 1,41 $** über 57 FLUX-Läufe (14.–17.11.). Davon
**0,372 $** Kreaturen (44 Rohbilder), **0,101 $** vier Volk-Porträts,
**0,038 $** vier Klassen-Embleme, **0,373 $** fünf Vollbilder in 1920×1080
(sechs erfolgreiche [pro]-Läufe) und **0,076 $** elf Item-Icons (inkl.
Kette-Nachlauf). Jede Zeile steht mit `request_id` in
(sechs erfolgreiche [pro]-Läufe) und **0,082 $** zwölf Item-Icons (inkl.
Kette-Nachlauf und Heiltrank). Jede Zeile steht mit `request_id` in
[`../art/license-log.csv`](../art/license-log.csv).

View file

@ -83,6 +83,9 @@ Zuwachs (d8→5, d6→4, d4→3) + KON-Mod (mind. 1 pro Stufe).
Natürliche 20 = kritisch (Schadenwürfel doppelt), natürliche 1 = Fehlschlag.
- **Rettung** = d20 + Attributsmod (Zäh=KON, Ref=GES, Wil=WEI)
+ Klassenbonus + halbe Stufe (abgerundet) gegen SG.
- **Traglast** = **10 + STÄ** in Gewichtspunkten. Waffe/Ausrüstung 1,
Leder/Kette 2, Platte 3, Schild 1. Überlast verhindert die Annahme beim
Tausch; Bewegungsmali gibt es noch nicht.
- **Initiative** = d20 + GES-Mod, absteigend; Gleichstand: höhere GES, dann Partei.
- **Bewegung** = 4 Felder pro Runde (Rennen 8).

View file

@ -60,9 +60,10 @@ Fenster liegen mittig über der abgedunkelten Karte; die Partyspalte bleibt
sichtbar. Mock: [`../art/prep/map-mock/`](../art/prep/map-mock/) (`_mock_inventar`).
> **Umsetzung 17.11.2026:** Das 5×3-Raster steht — 88er-Slots, 64er-Icons,
> Zähler unten rechts, Detailbox mit Ausrüsten/Ablegen/Benutzen und
> Klassenprüfung. Belege: [`../art/prep/inventar/`](../art/prep/inventar/README.md)
> und [`../art/prep/item-icons/`](../art/prep/item-icons/README.md).
> Zähler, Seitenwechsel, Detailbox mit Ausrüsten/Ablegen/Benutzen/Geben an,
> Klassenprüfung, Traglast und Drag & Drop auf Reiter/Slots. Belege:
> [`../art/prep/inventar/`](../art/prep/inventar/README.md) und
> [`../art/prep/item-icons/`](../art/prep/item-icons/README.md).
### Kampf

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

View file

@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://vgnmwi3egm3f"
path="res://.godot/imported/item_trank_heilung_64.png-a656b1af47b2deb952b6a823c725359e.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/objects/item_trank_heilung_64.png"
dest_files=["res://.godot/imported/item_trank_heilung_64.png-a656b1af47b2deb952b6a823c725359e.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

View file

@ -47,7 +47,8 @@
"weapon": "schwert",
"items": [
"vorrat",
"seil"
"seil",
"trank_heilung"
]
}
},
@ -126,7 +127,8 @@
"weapon": "keule",
"items": [
"vorrat",
"seil"
"seil",
"trank_heilung"
]
}
},
@ -198,7 +200,8 @@
"weapon": "stab",
"items": [
"vorrat",
"laterne"
"laterne",
"trank_heilung"
]
}
},
@ -253,7 +256,8 @@
"weapon": "dolch",
"items": [
"vorrat",
"laterne"
"laterne",
"trank_heilung"
]
}
}

View file

@ -1,25 +1,97 @@
{
"schema": 1,
"entries": {
"schwert": {"name": "Schwert", "type": "weapon", "damage": "1d8",
"value": 10, "weight": 1},
"dolch": {"name": "Dolch", "type": "weapon", "damage": "1d4",
"value": 3, "weight": 1},
"stab": {"name": "Stab", "type": "weapon", "damage": "1d6",
"value": 2, "weight": 1},
"keule": {"name": "Keule", "type": "weapon", "damage": "1d6",
"value": 2, "weight": 1},
"leder": {"name": "Lederrüstung", "type": "armor", "ac_bonus": 2,
"value": 5, "weight": 1},
"kette": {"name": "Kettenhemd", "type": "armor", "ac_bonus": 4,
"value": 40, "weight": 2},
"platte": {"name": "Plattenpanzer", "type": "armor", "ac_bonus": 6,
"value": 60, "weight": 3},
"schild": {"name": "Schild", "type": "shield", "ac_bonus": 1,
"value": 10, "weight": 1},
"laterne": {"name": "Laterne", "type": "misc", "value": 7, "weight": 1,
"effects": [{"op": "light", "radius": 4}]},
"seil": {"name": "Seil (15 m)", "type": "misc", "value": 1, "weight": 1},
"vorrat": {"name": "Vorrat (1 Tag)", "type": "misc", "value": 1, "weight": 1}
"schwert": {
"name": "Schwert",
"type": "weapon",
"damage": "1d8",
"value": 10,
"weight": 1
},
"dolch": {
"name": "Dolch",
"type": "weapon",
"damage": "1d4",
"value": 3,
"weight": 1
},
"stab": {
"name": "Stab",
"type": "weapon",
"damage": "1d6",
"value": 2,
"weight": 1
},
"keule": {
"name": "Keule",
"type": "weapon",
"damage": "1d6",
"value": 2,
"weight": 1
},
"leder": {
"name": "Lederrüstung",
"type": "armor",
"ac_bonus": 2,
"value": 5,
"weight": 1
},
"kette": {
"name": "Kettenhemd",
"type": "armor",
"ac_bonus": 4,
"value": 40,
"weight": 2
},
"platte": {
"name": "Plattenpanzer",
"type": "armor",
"ac_bonus": 6,
"value": 60,
"weight": 3
},
"schild": {
"name": "Schild",
"type": "shield",
"ac_bonus": 1,
"value": 10,
"weight": 1
},
"laterne": {
"name": "Laterne",
"type": "misc",
"value": 7,
"weight": 1,
"effects": [
{
"op": "light",
"radius": 4
}
]
},
"seil": {
"name": "Seil (15 m)",
"type": "misc",
"value": 1,
"weight": 1
},
"vorrat": {
"name": "Vorrat (1 Tag)",
"type": "misc",
"value": 1,
"weight": 1
},
"trank_heilung": {
"name": "Heiltrank",
"type": "misc",
"value": 25,
"weight": 1,
"effects": [
{
"op": "heal",
"amount": "2d6+2"
}
]
}
}
}

View file

@ -0,0 +1,16 @@
class_name DropReiter
extends Button
## Partei-Reiter als Tauschziel: ein gezogener Gegenstand wechselt die Figur.
signal figur_bekommen(index: int, id: String)
var index := 0
func _can_drop_data(_at: Vector2, data: Variant) -> bool:
return typeof(data) == TYPE_DICTIONARY and data.get("art") == "inventar" \
and not str(data.get("id", "")).is_empty()
func _drop_data(_at: Vector2, data: Variant) -> void:
figur_bekommen.emit(index, str(data.get("id", "")))

View file

@ -0,0 +1 @@
uid://6tsl7jsq81yf

View file

@ -0,0 +1,21 @@
class_name DropSlot
extends Panel
## Ausgerüsteter Slot als Ziel: nur der passende Gegenstandstyp wird genommen.
signal slot_bekommen(slot: String, id: String)
var slot := "" ## "weapon", "armor" oder "shield"
func _can_drop_data(_at: Vector2, data: Variant) -> bool:
if typeof(data) != TYPE_DICTIONARY or data.get("art") != "inventar":
return false
var id := str(data.get("id", ""))
var typ := str(Content.entry("items", id).get("type", ""))
if slot == "shield":
return typ == "shield"
return typ == slot
func _drop_data(_at: Vector2, data: Variant) -> void:
slot_bekommen.emit(slot, str(data.get("id", "")))

View file

@ -0,0 +1 @@
uid://c1rgq40opn47a

View file

@ -25,6 +25,8 @@ var _wurzel: Control
var _sel_id := ""
var _sel_quelle := "" ## "inventar" oder "slot"
var _meldung := ""
var _seite := 0
var _geben_ebene: Control
func _ready() -> void:
@ -38,6 +40,7 @@ func _ready() -> void:
func _bauen() -> void:
_leeren(_wurzel)
_geben_ebene = null
var dimm := UiTheme.dimmung()
dimm.color = Color(0.04, 0.03, 0.02, 0.72)
@ -67,6 +70,8 @@ func _bauen() -> void:
Game.rk(figur), Game.angriffsbonus(figur),
int(figur["hp"]["current"]), int(figur["hp"]["max"])],
Vector2(40, 680), Vector2(700, 40))
_label(p, "Last %d / %d" % [Game.gewicht(figur), Game.kapazitaet(figur)],
Vector2(40, 640), Vector2(400, 36), UiTheme.CREAM_D)
_schliessen_knopf(p)
@ -92,14 +97,16 @@ func _gold(p: Panel) -> void:
func _reiter(p: Panel) -> void:
var x := 40
for i in Game.party.size():
var b := Button.new()
var b := DropReiter.new()
b.text = str(Game.party[i].get("name", "?"))
b.index = i
b.position = Vector2(x, 80)
b.size = Vector2(170, 52)
b.focus_mode = Control.FOCUS_NONE
b.clip_text = true
b.modulate = Color(1.45, 1.25, 0.95) if i == _index else Color(1, 1, 1)
b.pressed.connect(_waehlen_figur.bind(i))
b.figur_bekommen.connect(_geben_drop)
p.add_child(b)
x += 180
@ -121,8 +128,19 @@ func _ausgeruestet(p: Panel, figur: Dictionary) -> void:
else:
id = str(equipment.get(slot["key"], ""))
var ziel := DropSlot.new()
ziel.slot = str(slot["key"])
ziel.position = Vector2(40, y)
ziel.size = Vector2(64, 64)
var rahmen := StyleBoxFlat.new()
rahmen.bg_color = Color(0, 0, 0, 0)
rahmen.border_color = Color(UiTheme.LINE, 0.7)
rahmen.set_border_width_all(2)
ziel.add_theme_stylebox_override("panel", rahmen)
ziel.slot_bekommen.connect(_auf_slot)
p.add_child(ziel)
if not id.is_empty():
_icon(p, id, Vector2(40, y))
_icon(ziel, id, Vector2.ZERO)
_label(p, str(slot["label"]), Vector2(120, y + 12),
Vector2(260, 40), UiTheme.CREAM_D)
_label(p, _item_name(id) if not id.is_empty() else "—",
@ -142,15 +160,39 @@ func _ausgeruestet(p: Panel, figur: Dictionary) -> void:
# ---------------------------------------------------------------- Rucksack --
func _rucksack(p: Panel, figur: Dictionary) -> void:
_label(p, "RUCKSACK", RASTER + Vector2(0, -40),
Vector2(300, 40), UiTheme.GOLD)
var inventar: Array = figur.get("inventory", [])
var seiten := maxi(1, ceili(float(inventar.size()) / float(SPALTEN * ZEILEN)))
_seite = clampi(_seite, 0, seiten - 1)
_label(p, "RUCKSACK %d/%d" % [_seite + 1, seiten],
RASTER + Vector2(0, -40), Vector2(340, 40), UiTheme.GOLD)
if seiten > 1:
var zurueck := Button.new()
zurueck.text = "<"
zurueck.position = Vector2(980, 144)
zurueck.size = Vector2(72, 56)
zurueck.focus_mode = Control.FOCUS_NONE
zurueck.clip_text = true
zurueck.disabled = _seite == 0
zurueck.pressed.connect(_seite_wechseln.bind(-1))
p.add_child(zurueck)
var vor := Button.new()
vor.text = ">"
vor.position = Vector2(1060, 144)
vor.size = Vector2(72, 56)
vor.focus_mode = Control.FOCUS_NONE
vor.clip_text = true
vor.disabled = _seite >= seiten - 1
vor.pressed.connect(_seite_wechseln.bind(1))
p.add_child(vor)
for i in SPALTEN * ZEILEN:
var x := RASTER.x + (i % SPALTEN) * (KACHEL + ABSTAND)
var y := RASTER.y + (i / SPALTEN) * (KACHEL + ABSTAND)
if i < inventar.size():
var eintrag = inventar[i]
var index := _seite * SPALTEN * ZEILEN + i
if index < inventar.size():
var eintrag = inventar[index]
var id := ""
var anzahl := 1
if typeof(eintrag) == TYPE_DICTIONARY:
@ -164,7 +206,8 @@ func _rucksack(p: Panel, figur: Dictionary) -> void:
func _slot_knopf(p: Panel, id: String, anzahl: int, pos: Vector2) -> void:
var b := Button.new()
var b := ItemSlot.new()
b.item_id = id
b.position = pos
b.size = Vector2(KACHEL, KACHEL)
b.focus_mode = Control.FOCUS_NONE
@ -228,7 +271,7 @@ func _slot_style(b: Button, gewaehlt: bool) -> void:
func _details(p: Panel, figur: Dictionary) -> void:
var box := Panel.new()
box.position = Vector2(640, 510)
box.size = Vector2(720, 150)
box.size = Vector2(720, 160)
box.add_theme_stylebox_override("panel", THEME.flaeche(Color(1, 1, 1)))
p.add_child(box)
@ -267,8 +310,17 @@ func _details(p: Panel, figur: Dictionary) -> void:
else:
_aktions_knopf(box, "Benutzen", _benutzen.bind(_sel_id))
var geben := Button.new()
geben.text = "Geben an"
geben.position = Vector2(450, 96)
geben.size = Vector2(250, 52)
geben.focus_mode = Control.FOCUS_NONE
geben.clip_text = true
geben.pressed.connect(_geben_panel)
box.add_child(geben)
if not _meldung.is_empty():
_label(box, _meldung, Vector2(20, 104), Vector2(660, 36),
_label(box, _meldung, Vector2(20, 110), Vector2(420, 36),
Color(0.88, 0.78, 0.55))
@ -287,6 +339,7 @@ func _aktions_knopf(box: Panel, text: String, cb: Callable) -> void:
func _waehlen_figur(index: int) -> void:
_index = index
_seite = 0
_sel_id = ""
_sel_quelle = ""
_meldung = ""
@ -340,6 +393,109 @@ func _benutzen(id: String) -> void:
_bauen()
func _seite_wechseln(delta: int) -> void:
_seite += delta
_bauen()
func _geben_drop(index: int, id: String) -> void:
_sel_id = id
_sel_quelle = "inventar"
_geben_an(index)
func _geben_panel() -> void:
if _sel_id.is_empty() or _geben_ebene != null:
return
_geben_ebene = Control.new()
_geben_ebene.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
_wurzel.add_child(_geben_ebene)
var dimm := UiTheme.dimmung()
dimm.color = Color(0.03, 0.02, 0.01, 0.78)
_geben_ebene.add_child(dimm)
var p := Panel.new()
p.position = Vector2(610, 340)
p.size = Vector2(700, 400)
p.add_theme_stylebox_override("panel", THEME.flaeche(Color(1, 1, 1)))
_geben_ebene.add_child(p)
var kopf := Label.new()
kopf.text = "GEBEN AN"
kopf.position = Vector2(30, 24)
kopf.add_theme_color_override("font_color", UiTheme.GOLD)
p.add_child(kopf)
var gegen := Label.new()
gegen.text = _item_name(_sel_id)
gegen.position = Vector2(30, 64)
gegen.size = Vector2(620, 40)
gegen.clip_text = true
p.add_child(gegen)
for i in Game.party.size():
var b := Button.new()
var ziel: Dictionary = Game.party[i]
b.text = str(ziel.get("name", "?"))
b.position = Vector2(30 + (i % 2) * 320, 120 + (i / 2) * 72)
b.size = Vector2(300, 56)
b.focus_mode = Control.FOCUS_NONE
b.clip_text = true
b.disabled = i == _index
b.tooltip_text = "Last %d / %d" % [
Game.gewicht(ziel), Game.kapazitaet(ziel)]
b.pressed.connect(_geben_an.bind(i))
p.add_child(b)
var ab := Button.new()
ab.text = "Abbrechen"
ab.position = Vector2(230, 320)
ab.size = Vector2(240, 56)
ab.focus_mode = Control.FOCUS_NONE
ab.clip_text = true
ab.pressed.connect(_geben_schliessen)
p.add_child(ab)
func _geben_an(index: int) -> void:
if index == _index or _sel_id.is_empty() or Game.party.is_empty():
return
_meldung = Game.geben(Game.party[_index], Game.party[index], _sel_id)
if Game.inventar_hat(Game.party[_index], _sel_id) <= 0:
_sel_id = ""
_sel_quelle = ""
_bauen()
func _geben_schliessen() -> void:
if _geben_ebene != null:
_geben_ebene.queue_free()
_geben_ebene = null
func _auf_slot(slot: String, id: String) -> void:
if Game.party.is_empty():
return
var typ := _item_typ(id)
var passt: bool
if slot == "shield":
passt = typ == "shield"
else:
passt = typ == slot
if not passt:
_meldung = "Passt nicht in den Slot."
else:
var figur: Dictionary = Game.party[_index]
if Game.ausruesten(figur, id):
_meldung = "%s ausgerüstet." % _item_name(id)
_sel_id = ""
_sel_quelle = ""
else:
_meldung = "Diese Klasse darf das nicht tragen."
_bauen()
func _schliessen_knopf(p: Panel) -> void:
var b := Button.new()
b.text = "Schließen"

View file

@ -0,0 +1,20 @@
class_name ItemSlot
extends Button
## Rucksack-Slot: klickbar (Auswahl) und ziehbar (Tausch/Ausrüsten).
var item_id := ""
func _get_drag_data(_at: Vector2) -> Variant:
if item_id.is_empty():
return null
var pfad := "res://assets/objects/item_%s_64.png" % item_id
if ResourceLoader.exists(pfad):
var bild := TextureRect.new()
bild.texture = load(pfad)
bild.size = Vector2(64, 64)
bild.expand_mode = TextureRect.EXPAND_IGNORE_SIZE
bild.stretch_mode = TextureRect.STRETCH_KEEP_ASPECT_CENTERED
bild.texture_filter = CanvasItem.TEXTURE_FILTER_NEAREST
set_drag_preview(bild)
return {"art": "inventar", "id": item_id}

View file

@ -0,0 +1 @@
uid://1bb8fk8pafj8

View file

@ -56,6 +56,7 @@ var _texturen: Dictionary = {}
var _kanten_cache: Dictionary = {}
var _welt: Node2D
var _leute: Node2D
var _licht: PointLight2D
func _ready() -> void:
@ -83,6 +84,10 @@ func _ready() -> void:
gedaempft = false
if arg == "--gedaempft":
gedaempft = true
if arg == "--licht":
Game.flags["licht"] = true
if arg == "--schnellstart":
Game.party_schnellstart()
if gemalt:
_platte = true
_figuren_gemalt = gemalt or gedaempft
@ -397,6 +402,7 @@ func _spieler_zeichnen() -> void:
_spieler.material = mat
_leute.add_child(_spieler)
_leute.add_child(sch)
_licht_bauen()
# Was auf dem Feld steht, blockiert — inklusive der Figur selbst.
_blockiert[Vector2i(_spieler_kachel)] = true
for eintrag in _karte.get("objects", []):
@ -407,6 +413,33 @@ func _spieler_zeichnen() -> void:
## Begehbar ist, was im Legend ein Boden ist — Wand, Dach und Steinplatte
## tragen keine Figur, und was im `_blockiert` steht, auch nicht.
func _licht_bauen() -> void:
_licht = PointLight2D.new()
_licht.name = "Laterne"
var g := Gradient.new()
g.set_color(0, Color(1.0, 0.86, 0.58, 1.0))
g.set_color(1, Color(1.0, 0.62, 0.24, 0.0))
var tex := GradientTexture2D.new()
tex.gradient = g
tex.width = 256
tex.height = 256
tex.fill = GradientTexture2D.FILL_RADIAL
tex.fill_from = Vector2(0.5, 0.5)
tex.fill_to = Vector2(0.5, 0.0)
_licht.texture = tex
_licht.blend_mode = Light2D.BLEND_MODE_ADD
_licht.energy = 0.85
_licht.texture_scale = 1.4
_licht.position = Vector2(0, -48)
_spieler.add_child(_licht)
_licht_aktualisieren()
func _licht_aktualisieren() -> void:
if _licht != null:
_licht.visible = bool(Game.flags.get("licht", false))
func _begehbar(x: int, y: int) -> bool:
if gemalt:
# Gemalte Karte: die Fläche steht als Rechteckliste in den Daten,
@ -496,6 +529,7 @@ func _inventar_schliessen() -> void:
_inventar_ebene.queue_free()
_inventar = null
_inventar_ebene = null
_licht_aktualisieren()
## Sprechen mit dem nächsten NSC (ein Feld Abstand, auch diagonal).

View file

@ -285,6 +285,29 @@ func _selbstpruefung() -> bool:
int(figur["hp"]["current"]) > 1
and Game.inventar_hat(figur, "vorrat") == 0
and vorrat_text.begins_with("Vorrat")) and ok
figur["hp"]["current"] = 1
var trank_text: String = Game.benutzen(figur, "trank_heilung")
ok = _pruefe("Verbrauch: Heiltrank heilt und verschwindet",
int(figur["hp"]["current"]) > 1
and Game.inventar_hat(figur, "trank_heilung") == 0
and trank_text.begins_with("Heiltrank")) and ok
Game.geben(figur, magier, "schwert")
ok = _pruefe("Tausch: Schwert an den Magier",
Game.inventar_hat(magier, "schwert") == 1
and Game.inventar_hat(figur, "schwert") == 0) and ok
Game.geben(magier, figur, "schwert")
var ziel := Game.neue_figur("pc_ziel", {
"name": "Ziel", "race": "human", "class": "fighter",
"attributes": {"str": 16, "dex": 10, "con": 10, "int": 10,
"wis": 10, "cha": 10}})
for i in 8:
Game.inventar_hinzufuegen(ziel, "platte")
Game.inventar_hinzufuegen(figur, "laterne")
var last_text: String = Game.geben(figur, ziel, "laterne")
ok = _pruefe("Traglast: überladenes Ziel nimmt nichts",
last_text.contains("überladen")
and Game.inventar_hat(ziel, "laterne") == 0
and Game.inventar_hat(figur, "laterne") == 1) and ok
# Roster: 1..6, siebte Figur abgelehnt, Entfernen gibt den Platz frei.
var sicherung: Array = Game.party.duplicate(true)

View file

@ -35,6 +35,7 @@ func _neue_party() -> void:
"attributes": {"str": 11, "dex": 17, "con": 12, "int": 12, "wis": 10, "cha": 13}},
]
party = []
gold = START_GOLD
for i in vorgabe.size():
party.append(neue_figur("pc_%d" % (i + 1), vorgabe[i]))
@ -44,6 +45,7 @@ func _neue_party() -> void:
func party_leeren() -> void:
party = []
gold = START_GOLD
## Nimmt eine Figur auf. Bei vollem Roster (6) kommt `{}` zurück — der Aufrufer
## fragt vorher `party_bereit()` oder prüft das Ergebnis.
@ -231,6 +233,53 @@ func ausruesten(figur: Dictionary, id: String) -> bool:
return true
## Gesamtgewicht inklusive ausgerüsteter Stücke.
func gewicht(figur: Dictionary) -> int:
var summe := 0
for eintrag in figur.get("inventory", []):
var id := ""
var anzahl := 1
if typeof(eintrag) == TYPE_DICTIONARY:
id = str(eintrag.get("id", ""))
anzahl = int(eintrag.get("count", 1))
else:
id = str(eintrag)
summe += int(Content.entry("items", id).get("weight", 1)) * anzahl
var equipment: Dictionary = figur.get("equipment", {})
for feld in ["weapon", "armor"]:
var id := str(equipment.get(feld, ""))
if not id.is_empty():
summe += int(Content.entry("items", id).get("weight", 1))
if bool(equipment.get("shield", false)):
summe += int(Content.entry("items", "schild").get("weight", 1))
return summe
## Traglast: 10 + STÄ. Kein Feld in den Daten, weil sie aus den Attributen folgt.
func kapazitaet(figur: Dictionary) -> int:
return 10 + int(figur.get("attributes", {}).get("str", 10))
## Ein Gegenstand wandert zwischen zwei Figuren; die Traglast des Ziels zählt.
func geben(von: Dictionary, an: Dictionary, id: String, anzahl: int = 1) -> String:
if str(von.get("id", "")) == str(an.get("id", "")):
return "Das ist dieselbe Figur."
if inventar_hat(von, id) < anzahl:
return "Nicht genug im Rucksack."
var einzel := int(Content.entry("items", id).get("weight", 1))
var last := gewicht(an) + einzel * anzahl
if last > kapazitaet(an):
return "%s ist überladen (%d/%d)." % [
str(an.get("name", "?")), last, kapazitaet(an)]
inventar_entfernen(von, id, anzahl)
inventar_hinzufuegen(an, id, anzahl)
return "%s → %s." % [_item_name(id), str(an.get("name", "?"))]
func _item_name(id: String) -> String:
return str(Content.entry("items", id).get("name", id))
## Verbrauchsgüter. Gibt eine Meldung für die UI zurück.
func benutzen(figur: Dictionary, id: String) -> String:
if inventar_hat(figur, id) <= 0:
@ -249,6 +298,16 @@ func benutzen(figur: Dictionary, id: String) -> String:
"laterne":
flags["licht"] = not bool(flags.get("licht", false))
return "Laterne %s." % ("an" if flags["licht"] else "aus")
"trank_heilung":
var tp: Dictionary = figur.get("hp", {})
if int(tp.get("current", 0)) >= int(tp.get("max", 0)):
return "TP sind voll."
var heilung: int = Dice.roll("2d6+2")
tp["current"] = mini(int(tp.get("max", 0)),
int(tp.get("current", 0)) + heilung)
figur["hp"] = tp
inventar_entfernen(figur, id)
return "Heiltrank: +%d TP." % heilung
"seil":
return "Seil: noch keine Anwendung."
return "Nicht benutzbar."

View file

@ -37,6 +37,21 @@ func _ready() -> void:
Game.ausruesten(figur, "schwert")
ui.call("_waehlen_item", "leder")
# Seitenwechsel: zwölf eindeutige Proben füllen die zweite Seite.
for i in 12:
Game.inventar_hinzufuegen(figur, "probe_%d" % i)
ui.call("_bauen")
ui.call("_seite_wechseln", 1)
ok("Raster: zweite Seite", int(ui.get("_seite")) == 1)
for i in 12:
Game.inventar_entfernen(figur, "probe_%d" % i)
ui.call("_seite_wechseln", -1)
ui.call("_geben_panel")
ok("Geben-Dialog öffnet", ui.get("_geben_ebene") != null)
if not OS.get_cmdline_user_args().has("--geben"):
ui.call("_geben_schliessen")
print("\nProbe: %s" % ("bestanden" if fehler == 0 else "FEHLGESCHLAGEN"))
if OS.get_cmdline_user_args().has("--check"):
get_tree().quit(0 if fehler == 0 else 1)