update
This commit is contained in:
@@ -201,7 +201,7 @@ static func choose_action(game: Game, p: Game.Player) -> Dictionary:
|
||||
best = firsts[i].action
|
||||
if best.type == "end":
|
||||
if game.can_draw(p)[0]:
|
||||
return {"type": "draw", "index": pick_index(game, p)} # Mana übrig und Platz auf der Hand: lieber ziehen als passen
|
||||
return {"type": "draw"} # Mana übrig und Platz auf der Hand: lieber ziehen als passen
|
||||
return best
|
||||
return map_action(game, view, best)
|
||||
|
||||
@@ -258,24 +258,10 @@ static func choose_action_greedy(game: Game, p: Game.Player) -> Dictionary:
|
||||
if t != null:
|
||||
return {"type": "attack", "creature": cr, "target": t}
|
||||
if game.can_draw(p)[0]:
|
||||
return {"type": "draw", "index": pick_index(game, p)}
|
||||
return {"type": "draw"}
|
||||
return {"type": "end"}
|
||||
|
||||
|
||||
## Welche der offenen Karten: die wertvollste, die nach dem Ziehen noch bezahlbar wäre, sonst die billigste.
|
||||
static func pick_index(game: Game, p: Game.Player) -> int:
|
||||
var left: int = p.energy - game.draw_cost(p)
|
||||
var best := 0
|
||||
var best_score := -INF
|
||||
for i in p.offer.size():
|
||||
var c: Cards.Card = p.offer[i]
|
||||
var score := float(c.attack + c.health) if c.cost <= left else -10.0 - c.cost
|
||||
if score > best_score:
|
||||
best_score = score
|
||||
best = i
|
||||
return best
|
||||
|
||||
|
||||
## Ziel eines Angriffs: sichere Abtausche, dann gute Abtausche, dann das schwächste Wesen;
|
||||
## der Held nur, wenn kein Wesen mehr steht.
|
||||
static func pick_attack_target(game: Game, p: Game.Player, cr: Game.Creature):
|
||||
@@ -302,7 +288,7 @@ static func apply_action(game: Game, p: Game.Player, action: Dictionary) -> void
|
||||
"play":
|
||||
game.play_card(p, action.card, bool(action.get("face_down", false)))
|
||||
"draw":
|
||||
game.draw(p, int(action.get("index", 0)))
|
||||
game.draw(p)
|
||||
"reveal":
|
||||
game.reveal(p, action.creature)
|
||||
"attack":
|
||||
|
||||
Reference in New Issue
Block a user