update
This commit is contained in:
@@ -384,23 +384,37 @@ func _apply(id: int, action: Dictionary) -> void:
|
||||
if game == null or not seats.has(id):
|
||||
return
|
||||
var p: Game.Player = game.players[seats[id]]
|
||||
if game.current() != p or game.winner != "":
|
||||
if game.winner != "":
|
||||
return
|
||||
if str(action.get("type", "")) == "pick": # wählen geht jederzeit, auch außerhalb des Zugs
|
||||
game.pick(p, int(action.get("index", -1)))
|
||||
action_applied.emit()
|
||||
return
|
||||
if game.current() != p:
|
||||
return
|
||||
match str(action.get("type", "")):
|
||||
"play":
|
||||
var idx := int(action.get("hand", -1))
|
||||
if idx < 0 or idx >= p.hand.size():
|
||||
return
|
||||
game.play_card(p, p.hand[idx], resolve_ref(action.get("target")))
|
||||
game.play_card(p, p.hand[idx], bool(action.get("face_down", false)))
|
||||
"reveal":
|
||||
var cr := game.find_creature(int(action.get("uid", -1)))
|
||||
if cr != null:
|
||||
game.reveal(p, cr)
|
||||
"upgrade":
|
||||
var cr := game.find_creature(int(action.get("uid", -1)))
|
||||
var hi := int(action.get("hand", -1))
|
||||
var target = cr if cr != null else (p.hand[hi] if hi >= 0 and hi < p.hand.size() else null)
|
||||
if target != null:
|
||||
game.upgrade(p, target, str(action.get("keyword", "")))
|
||||
"attack":
|
||||
var cr := game.find_creature(int(action.get("uid", -1)))
|
||||
var t = resolve_ref(action.get("target"))
|
||||
if cr != null and t != null:
|
||||
game.attack(cr, t)
|
||||
"buy":
|
||||
game.buy(p, int(action.get("slot", -1)))
|
||||
"reroll":
|
||||
game.reroll(p)
|
||||
"draw":
|
||||
game.draw(p)
|
||||
"fuse":
|
||||
var a := game.find_creature(int(action.get("uid", -1)))
|
||||
var b := game.find_creature(int(action.get("other", -1)))
|
||||
|
||||
Reference in New Issue
Block a user