update
This commit is contained in:
@@ -93,9 +93,9 @@ static func best_element(own: Array, other: Array) -> String:
|
||||
return best
|
||||
|
||||
|
||||
## Kosten einer Karte: zwei Drittel Angriff plus ein Drittel Leben, abgerundet (0/2 kostet nichts).
|
||||
## Kosten einer Karte: zwei Drittel Angriff plus ein Drittel Leben, abgerundet, höchstens 10 (0/2 kostet nichts).
|
||||
static func cost_of(attack: int, health: int) -> int:
|
||||
return (2 * attack + health) / 3
|
||||
return mini(10, (2 * attack + health) / 3)
|
||||
|
||||
|
||||
## Wert eines verschmolzenen Wesens: der bessere Wert plus ein Drittel des schwächeren (mindestens 1),
|
||||
@@ -132,8 +132,7 @@ static func fused(a: Card, b: Card, attack: int = -1, health: int = -1) -> Card:
|
||||
for k in KEYWORDS:
|
||||
if k in a.keywords or k in b.keywords:
|
||||
c.keywords.append(k)
|
||||
c.fusions = maxi(a.fusions, b.fusions) + 1
|
||||
c.look = maxi(a.look, b.look) # die höhere Stufe gewinnt; Game.fuse rechnet die Sammlung ein
|
||||
c.look = maxi(a.look, b.look) # die höhere Stufe gewinnt
|
||||
return c
|
||||
|
||||
|
||||
@@ -157,19 +156,18 @@ class Card extends RefCounted:
|
||||
var elements: Array
|
||||
var attack: int = 0
|
||||
var health: int = 0
|
||||
var cost: int = 0 # abgeleitet: (2 · Angriff + Leben) / 3, abgerundet
|
||||
var cost: int = 0 # abgeleitet: (2 · Angriff + Leben) / 3, abgerundet, höchstens 10 (aus den Grundwerten)
|
||||
var keywords: Array = [] # feste Eigenschaften der Karte (Elementpaare geben ihre zur Laufzeit)
|
||||
var fusions := 0 # wie oft verschmolzen (Verschmelzen kostet 1, 2, 4, 8 …)
|
||||
var look := -1 # Seltenheitsstufe verschmolzener Karten (die höhere der Eltern); -1: aus der Sammlung des Besitzers
|
||||
var look := -1 # Seltenheitsstufe des Exemplars (gibt +1/+1 je Stufe); -1: Grundkarte aus dem Pool
|
||||
|
||||
func to_dict() -> Dictionary:
|
||||
var d := {"id": id, "name": name, "name_en": name_en, "elements": elements, "attack": attack, "health": health}
|
||||
if not keywords.is_empty():
|
||||
d["keywords"] = keywords
|
||||
if fusions > 0:
|
||||
d["fusions"] = fusions
|
||||
if look >= 0:
|
||||
d["look"] = look
|
||||
if cost != Cards.cost_of(attack, health):
|
||||
d["cost"] = cost
|
||||
return d
|
||||
|
||||
## Stufe dieser Karte für einen Besitzer mit dieser Sammlung (Game.Player.looks).
|
||||
@@ -184,9 +182,8 @@ class Card extends RefCounted:
|
||||
c.elements = Array(d.elements)
|
||||
c.attack = int(d.get("attack", 0))
|
||||
c.health = int(d.get("health", 0))
|
||||
c.cost = Cards.cost_of(c.attack, c.health)
|
||||
c.cost = int(d.get("cost", Cards.cost_of(c.attack, c.health)))
|
||||
c.keywords = Array(d.get("keywords", []))
|
||||
c.fusions = int(d.get("fusions", 0))
|
||||
c.look = int(d.get("look", -1))
|
||||
return c
|
||||
|
||||
@@ -194,6 +191,15 @@ class Card extends RefCounted:
|
||||
func copy() -> Card:
|
||||
return Card.from_dict(to_dict())
|
||||
|
||||
## Exemplar in einer Seltenheitsstufe: +1/+1 je Stufe, die Kosten bleiben die der Grundkarte.
|
||||
func leveled(level: int) -> Card:
|
||||
var c := copy()
|
||||
c.look = level
|
||||
c.attack += level
|
||||
c.health += level
|
||||
c.cost = cost
|
||||
return c
|
||||
|
||||
## Anzeigename in der aktuellen Sprache.
|
||||
func title() -> String:
|
||||
if name_en != "" and TranslationServer.get_locale().begins_with("en"):
|
||||
@@ -206,10 +212,6 @@ class Card extends RefCounted:
|
||||
func combo() -> String:
|
||||
return Cards.combo_name(elements)
|
||||
|
||||
## Mana für die nächste Verschmelzung mit dieser Karte.
|
||||
func fusion_cost() -> int:
|
||||
return 1 << fusions
|
||||
|
||||
## Kartentext: die festen Eigenschaften.
|
||||
func text() -> String:
|
||||
if keywords.is_empty():
|
||||
|
||||
Reference in New Issue
Block a user