71 lines
3.4 KiB
GDScript
71 lines
3.4 KiB
GDScript
class_name CheatScreen
|
|
extends Control
|
|
## Cheats zum Ausprobieren: Münzen, Staub, Level, Skills, Kampagnenkapitel und Sammlung direkt setzen.
|
|
## Jeder Knopf speichert sofort; oben steht der aktuelle Stand.
|
|
|
|
var app
|
|
var status_label: Label
|
|
var msg_label: Label
|
|
|
|
|
|
func _ready() -> void:
|
|
Style.header(self, "Cheats", func(): app.show_screen(MenuScreen.new()))
|
|
status_label = Style.label(self, "", 16, Style.GOLD, Rect2(40, 90, 1200, 48), "left", true)
|
|
status_label.autowrap_mode = TextServer.AUTOWRAP_WORD
|
|
var groups := [
|
|
["Währung", [["+1.000 Münzen", func(): app.profile.coins += 1000], ["+10.000 Münzen", func(): app.profile.coins += 10000],
|
|
["+1.000 Staub", func(): app.profile.dust += 1000], ["+10.000 Staub", func(): app.profile.dust += 10000]]],
|
|
["Erfahrung", [["+1 Level", func(): app.profile.xp = Skills.xp_for_level(app.profile.player_level() + 1)],
|
|
["+5 Level", func(): app.profile.xp = Skills.xp_for_level(app.profile.player_level() + 5)],
|
|
["Skills zurücksetzen", func(): app.profile.skills = {}], ["Erfahrung auf 0", func():
|
|
app.profile.xp = 0
|
|
app.profile.skills = {}]]],
|
|
["Kampagne", [["Kapitel 2 frei", func(): app.profile.campaign_stage = maxi(app.profile.campaign_stage, 10)],
|
|
["Kapitel 3 frei", func(): app.profile.campaign_stage = maxi(app.profile.campaign_stage, 20)],
|
|
["Kapitel 4 frei", func(): app.profile.campaign_stage = maxi(app.profile.campaign_stage, 30)],
|
|
["Kapitel 5 frei", func(): app.profile.campaign_stage = maxi(app.profile.campaign_stage, 40)],
|
|
["Werkstatt frei", func(): app.profile.campaign_stage = maxi(app.profile.campaign_stage, 50)],
|
|
["Kampagne zurücksetzen", func(): app.profile.campaign_stage = 0]]],
|
|
["Sammlung", [["Alle Karten (Common)", func(): _give_all(0)], ["Alle Karten Ultimate Rare", func(): _give_all(4)],
|
|
["Eigene Karten +1 Stufe", func():
|
|
for id in app.profile.collection:
|
|
app.profile.collection[id] = mini(int(app.profile.collection[id]) + 1, Cards.RARITIES.size() - 1)],
|
|
["Sammlung zurücksetzen", func(): app.profile.give_start()]]],
|
|
]
|
|
var y := 160
|
|
for g in groups:
|
|
Style.label(self, g[0], 18, Style.TEXT, Rect2(40, y, 200, 30), "left", true)
|
|
var x := 250
|
|
for entry in g[1]:
|
|
var b := Style.button(self, entry[0], Rect2(x, y - 4, 160, 40), _apply.bind(entry[1]))
|
|
b.add_theme_font_size_override("font_size", 13)
|
|
x += 168
|
|
y += 70
|
|
msg_label = Style.label(self, "", 15, Style.GREEN, Rect2(40, y + 10, 1200, 24), "left")
|
|
refresh()
|
|
|
|
|
|
func _input(event: InputEvent) -> void:
|
|
if event.is_action_pressed("ui_cancel"):
|
|
app.show_screen(MenuScreen.new())
|
|
|
|
|
|
## Alle Karten der Sammlung geben, in Stufe level; der Stapel bleibt.
|
|
func _give_all(level: int) -> void:
|
|
for c in Cards.all():
|
|
app.profile.collection[c.id] = level
|
|
|
|
|
|
func _apply(action: Callable) -> void:
|
|
action.call()
|
|
app.save()
|
|
app.sfx.play("click")
|
|
msg_label.text = tr("Gespeichert")
|
|
refresh()
|
|
|
|
|
|
func refresh() -> void:
|
|
var p: Profile = app.profile
|
|
status_label.text = tr("Münzen %d · Staub %d · EP %d (Level %d, %d Skillpunkte frei) · Kampagne %d/%d · Sammlung %d Karten, Stapel %d") % [
|
|
p.coins, p.dust, p.xp, p.player_level(), p.skill_points(), p.campaign_stage, Campaign.total(), p.collection.size(), p.deck.size()]
|