Erfolge entfernt, der Bildschirm zeigt nur noch Statistik
- Die dreizehn Erfolge samt Belohnungen, Meldungen und Spielstandfeld sind weg - Der bisherige Erfolgs-Bildschirm heißt Statistik und zeigt Kämpfe, Tagesaufgabe, Bestenliste, beste Karten und den CSV-Export Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QPgKvy5W9WRNFHjkm5QsHx
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
class_name Profile
|
||||
extends RefCounted
|
||||
## Spielstand: Sammlung, Münzen, Decks, Staub, Booster, Statistik, Erfolge, Tagesaufgabe, Einstellungen.
|
||||
## Spielstand: Sammlung, Münzen, Decks, Staub, Booster, Statistik, Tagesaufgabe, Einstellungen.
|
||||
|
||||
const SAVE_VERSION := 5
|
||||
const PITY_BOOSTERS := 20 # danach ist eine mythische Karte garantiert
|
||||
@@ -24,22 +24,6 @@ const DIFFICULTIES := {
|
||||
const DUST_DISMANTLE := {"gewöhnlich": 5, "selten": 20, "episch": 100, "legendär": 400, "mythisch": 1600}
|
||||
const DUST_CRAFT := {"gewöhnlich": 40, "selten": 100, "episch": 400, "legendär": 1600, "mythisch": 3200}
|
||||
|
||||
const ACHIEVEMENTS := [
|
||||
{"id": "erster_sieg", "name": "Erster Sieg", "text": "Gewinne einen Kampf.", "reward": 50},
|
||||
{"id": "duellant", "name": "Duellant", "text": "Gewinne ein Duell.", "reward": 50},
|
||||
{"id": "tischherr", "name": "Herr des Tisches", "text": "Gewinne gegen 3 oder mehr Gegner.", "reward": 100},
|
||||
{"id": "chaosmeister", "name": "Chaosmeister", "text": "Gewinne gegen 5 Gegner.", "reward": 200},
|
||||
{"id": "sammler", "name": "Sammler", "text": "Besitze 50 verschiedene Karten.", "reward": 100},
|
||||
{"id": "vollstaendig", "name": "Vollständig", "text": "Besitze jede Karte.", "reward": 500},
|
||||
{"id": "boosterfreund", "name": "Boosterfreund", "text": "Öffne 10 Booster.", "reward": 100},
|
||||
{"id": "elementarist", "name": "Elementarist", "text": "Gewinne mit einem Deck aus nur einem Element.", "reward": 100},
|
||||
{"id": "kombokoenig", "name": "Kombokönig", "text": "Gewinne mit mindestens 6 Kombokarten im Deck.", "reward": 100},
|
||||
{"id": "kampagnenheld", "name": "Kampagnenheld", "text": "Schließe Kapitel 1 der Kampagne ab.", "reward": 300},
|
||||
{"id": "elementmeister", "name": "Meister der Elemente", "text": "Schließe Kapitel 2 der Kampagne ab.", "reward": 500},
|
||||
{"id": "archimagier", "name": "Archimagier", "text": "Schließe Kapitel 3 der Kampagne ab.", "reward": 800},
|
||||
{"id": "serie", "name": "Siegesserie", "text": "Gewinne fünf Kämpfe in Folge.", "reward": 150},
|
||||
]
|
||||
|
||||
const DAILY_TASKS := [
|
||||
{"id": "sieg", "kind": "win", "text": "Gewinne einen Kampf", "goal": 1, "reward": 80},
|
||||
{"id": "kaempfe", "kind": "game", "text": "Bestreite zwei Kämpfe", "goal": 2, "reward": 60},
|
||||
@@ -63,11 +47,10 @@ var collection := {} # id -> Anzahl
|
||||
var decks: Array = [] # DECK_SLOTS Einträge {"name": String, "cards": Array von ids}
|
||||
var active_deck := 0
|
||||
var stats := {"games": 0, "wins": 0, "boosters": 0, "wins_by_opp": {}}
|
||||
var achievements: Array = []
|
||||
var campaign_stage := 0 # Anzahl abgeschlossener Kampagnenstufen
|
||||
var daily := {"date": "", "task": "", "progress": 0, "done": false}
|
||||
var settings := {"volume": 0.8, "music": 0.5, "ai_speed": 1.0, "animations": true, "language": "de", "difficulty": "normal", "big_font": false}
|
||||
var notices: Array[String] = [] # Meldungen für die Oberfläche (Erfolge, Tagesaufgabe)
|
||||
var notices: Array[String] = [] # Meldungen für die Oberfläche (Tagesaufgabe, Fortschritt)
|
||||
var card_stats := {} # id -> {"played", "games", "wins"}
|
||||
var booster_since_mythic := 0
|
||||
var tutorial_done := false
|
||||
@@ -151,8 +134,6 @@ static func from_dict(d: Dictionary) -> Profile:
|
||||
p.stats.boosters = int(st.get("boosters", 0))
|
||||
for k in st.get("wins_by_opp", {}):
|
||||
p.stats.wins_by_opp[str(k)] = int(st.wins_by_opp[k])
|
||||
for a in d.get("achievements", []):
|
||||
p.achievements.append(str(a))
|
||||
p.campaign_stage = int(d.get("campaign_stage", 0))
|
||||
var dl = d.get("daily", {})
|
||||
p.daily = {"date": str(dl.get("date", "")), "task": str(dl.get("task", "")),
|
||||
@@ -186,7 +167,7 @@ static func from_dict(d: Dictionary) -> Profile:
|
||||
func to_dict() -> Dictionary:
|
||||
return {"version": SAVE_VERSION, "coins": coins, "dust": dust, "collection": collection,
|
||||
"decks": decks, "active_deck": active_deck,
|
||||
"stats": stats, "achievements": achievements, "campaign_stage": campaign_stage,
|
||||
"stats": stats, "campaign_stage": campaign_stage,
|
||||
"daily": daily, "settings": settings, "card_stats": card_stats,
|
||||
"booster_since_mythic": booster_since_mythic, "tutorial_done": tutorial_done,
|
||||
"perk": perk, "records": records, "tutorial2_done": tutorial2_done}
|
||||
@@ -320,7 +301,6 @@ func craft(cid: String) -> String:
|
||||
dust -= cost
|
||||
collection[cid] = collection.get(cid, 0) + 1
|
||||
daily_event("craft")
|
||||
check_achievements()
|
||||
return ""
|
||||
|
||||
|
||||
@@ -404,11 +384,10 @@ func open_booster(r: RandomNumberGenerator = null, element: String = "") -> Arra
|
||||
collection[c.id] = collection.get(c.id, 0) + 1
|
||||
stats.boosters += 1
|
||||
daily_event("booster")
|
||||
check_achievements()
|
||||
return cards
|
||||
|
||||
|
||||
# --- Kampfergebnis, Erfolge, Tagesaufgabe -------------------------------------------
|
||||
# --- Kampfergebnis, Tagesaufgabe -------------------------------------------
|
||||
|
||||
## Verbucht ein Kampfergebnis und gibt die Münzbelohnung zurück.
|
||||
## stage >= 0: Kampagnenstufe; ein erster Sieg schaltet die nächste Stufe frei.
|
||||
@@ -459,7 +438,6 @@ func record_battle(won: bool, n_opp: int, deck_used: Array, stage: int = -1, pla
|
||||
daily_event("win_vs3")
|
||||
for e in Game.deck_elements(deck_used):
|
||||
daily_event("win_element:" + e)
|
||||
check_achievements({"won": won, "n_opp": n_opp, "deck": deck_used})
|
||||
return reward
|
||||
|
||||
|
||||
@@ -469,53 +447,6 @@ func _stat(cid: String) -> Dictionary:
|
||||
return card_stats[cid]
|
||||
|
||||
|
||||
func check_achievements(ctx: Dictionary = {}) -> Array:
|
||||
var unlocked := []
|
||||
for a in ACHIEVEMENTS:
|
||||
if a.id in achievements:
|
||||
continue
|
||||
if _achieved(a.id, ctx):
|
||||
achievements.append(a.id)
|
||||
coins += a.reward
|
||||
unlocked.append(a)
|
||||
notices.append("Erfolg: %s (+%d Münzen)" % [a.name, a.reward])
|
||||
return unlocked
|
||||
|
||||
|
||||
func _achieved(id: String, ctx: Dictionary) -> bool:
|
||||
var won: bool = ctx.get("won", false)
|
||||
var n: int = ctx.get("n_opp", 0)
|
||||
var deck_used: Array = ctx.get("deck", [])
|
||||
match id:
|
||||
"erster_sieg":
|
||||
return stats.wins >= 1
|
||||
"duellant":
|
||||
return won and n == 1
|
||||
"tischherr":
|
||||
return won and n >= 3
|
||||
"chaosmeister":
|
||||
return won and n == 5
|
||||
"sammler":
|
||||
return distinct_owned() >= 50
|
||||
"vollstaendig":
|
||||
return distinct_owned() >= Cards.all().size()
|
||||
"boosterfreund":
|
||||
return stats.boosters >= 10
|
||||
"elementarist":
|
||||
return won and Game.deck_elements(deck_used).size() == 1
|
||||
"kombokoenig":
|
||||
return won and deck_used.filter(func(c): return c.is_combo()).size() >= 6
|
||||
"kampagnenheld":
|
||||
return campaign_stage >= Campaign.STAGES.size()
|
||||
"elementmeister":
|
||||
return campaign_stage >= 2 * Campaign.STAGES.size()
|
||||
"archimagier":
|
||||
return campaign_stage >= Campaign.total()
|
||||
"serie":
|
||||
return records.best_streak >= 5
|
||||
return false
|
||||
|
||||
|
||||
func difficulty() -> Dictionary:
|
||||
return DIFFICULTIES.get(settings.get("difficulty", "normal"), DIFFICULTIES.normal)
|
||||
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
uid://cw4rtcukefdl8
|
||||
@@ -46,7 +46,7 @@ func _ready() -> void:
|
||||
Style.cbutton(grid, "Booster öffnen", sz, func(): app.show_screen(BoosterScreen.new()))
|
||||
Style.cbutton(grid, "Deck bauen", sz, func(): app.show_screen(DeckScreen.new()))
|
||||
Style.cbutton(grid, "Werkstatt", sz, func(): app.show_screen(WorkshopScreen.new()))
|
||||
Style.cbutton(grid, "Erfolge", sz, func(): app.show_screen(AchievementsScreen.new()))
|
||||
Style.cbutton(grid, "Statistik", sz, func(): app.show_screen(StatsScreen.new()))
|
||||
Style.cbutton(grid, "Regeln", sz, func(): app.show_screen(RulesScreen.new()))
|
||||
Style.cbutton(grid, "Einstellungen", sz, func(): app.show_screen(SettingsScreen.new()))
|
||||
Style.cbutton(grid, "Beenden", sz, func(): get_tree().quit())
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
class_name AchievementsScreen
|
||||
class_name StatsScreen
|
||||
extends Control
|
||||
## Statistik: Kämpfe, Tagesaufgabe, Bestenliste, beste Karten und CSV-Export.
|
||||
|
||||
var app
|
||||
var export_label: Label
|
||||
@@ -8,7 +9,7 @@ var export_label: Label
|
||||
func _ready() -> void:
|
||||
var p: Profile = app.profile
|
||||
var col := Style.column(self, 900, 12, 4)
|
||||
Style.clabel(col, "Erfolge", 32, Style.GOLD, "center", true)
|
||||
Style.clabel(col, "Statistik", 32, Style.GOLD, "center", true)
|
||||
var st: Dictionary = p.stats
|
||||
Style.clabel(col, "Kämpfe %d · Siege %d · Booster %d · Kampagne %d/%d" % [
|
||||
st.games, st.wins, st.boosters, p.campaign_stage, Campaign.total()], 16, Style.MUTED)
|
||||
@@ -19,17 +20,6 @@ func _ready() -> void:
|
||||
Style.clabel(col, "Serie: %d (beste %d) · Schnellster Sieg: %s" % [p.records.streak, p.records.best_streak,
|
||||
("%d Züge" % p.records.fastest_win) if p.records.fastest_win > 0 else "–"], 15, Style.MUTED)
|
||||
Style.spacer(col, 4)
|
||||
for a in Profile.ACHIEVEMENTS:
|
||||
var done: bool = a.id in p.achievements
|
||||
var panel := PanelContainer.new()
|
||||
panel.add_theme_stylebox_override("panel", Style.box(Style.PANEL if done else Style.darker(Style.PANEL, 0.8), 6))
|
||||
col.add_child(panel)
|
||||
var r := Style.row(panel, 12)
|
||||
r.custom_minimum_size = Vector2(0, 36)
|
||||
Style.clabel(r, "✓" if done else "·", 22, Style.GREEN if done else Style.MUTED, "center", true, 40)
|
||||
Style.clabel(r, a.name, 18, Style.TEXT if done else Style.MUTED, "left", true, 250)
|
||||
Style.clabel(r, a.text, 15, Style.MUTED, "left", false, 380)
|
||||
Style.clabel(r, "+%d" % a.reward, 16, Style.GOLD, "right", true, 90)
|
||||
var top := p.top_cards(5)
|
||||
if not top.is_empty():
|
||||
Style.spacer(col, 4)
|
||||
@@ -52,5 +42,5 @@ func export_stats() -> void:
|
||||
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
if event is InputEventKey and event.pressed and event.keycode == KEY_ESCAPE:
|
||||
if event.is_action_pressed("ui_cancel"):
|
||||
app.show_screen(MenuScreen.new())
|
||||
1
scripts/ui/stats_screen.gd.uid
Normal file
1
scripts/ui/stats_screen.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://t0h7fpmpeuq4
|
||||
Reference in New Issue
Block a user