fixed pawn boost
This commit is contained in:
parent
b0ff6ddd89
commit
16b099b6b4
2 changed files with 27 additions and 5 deletions
|
|
@ -108,10 +108,10 @@ func place_random_game_tiles(num_tiles: int = 6) -> void:
|
||||||
var tile: Tile
|
var tile: Tile
|
||||||
match tile_type:
|
match tile_type:
|
||||||
0: # DoubleMovementTile tile
|
0: # DoubleMovementTile tile
|
||||||
tile = DoubleMovementTile.new(container, is_white, -1)
|
tile = PawnBoostTile.new(container, is_white, -1)
|
||||||
1: # FireWallTile
|
1: # FireWallTile
|
||||||
tile = DoubleMovementTile.new(container, is_white, -1)
|
tile = PawnBoostTile.new(container, is_white, -1)
|
||||||
2: # PawnBoostTile tile
|
2: # PawnBoostTile tile
|
||||||
tile = DoubleMovementTile.new(container, is_white, -1)
|
tile = PawnBoostTile.new(container, is_white, -1)
|
||||||
|
|
||||||
add_tile(pos, tile)
|
add_tile(pos, tile)
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
class_name PawnBoostTile
|
class_name PawnBoostTile
|
||||||
extends Tile
|
extends Tile
|
||||||
|
|
||||||
|
var boosted_pawns: Array[int] = []
|
||||||
func _init(button: Button, is_white: bool, d: int) -> void:
|
func _init(button: Button, is_white: bool, d: int) -> void:
|
||||||
super._init(button, is_white, d)
|
super._init(button, is_white, d)
|
||||||
tile_name = "Pawn Boost"
|
tile_name = "Pawn Boost"
|
||||||
|
|
@ -13,8 +14,29 @@ func _init(button: Button, is_white: bool, d: int) -> void:
|
||||||
func apply_effect(piece: Pawn = null) -> void:
|
func apply_effect(piece: Pawn = null) -> void:
|
||||||
print("APPLY PawnBoostTile")
|
print("APPLY PawnBoostTile")
|
||||||
if piece && is_effect_active() && piece.name == "Bishop":
|
if piece && is_effect_active() && piece.name == "Bishop":
|
||||||
# This would be implemented in the pawn movement calculation
|
# Get all pawns of the same color as the bishop
|
||||||
pass
|
var bishop_color = piece.Item_Color
|
||||||
|
|
||||||
|
# Clear previous boosts
|
||||||
|
boosted_pawns.clear()
|
||||||
|
|
||||||
|
# Find all pawns of the same color
|
||||||
|
for child in game.boardContainer.get_children():
|
||||||
|
if child is PieceContainer:
|
||||||
|
var pawn = child.get_piece()
|
||||||
|
if pawn && pawn.name == "Pawn" && pawn.Item_Color == bishop_color:
|
||||||
|
var pawn_id = pawn.get_instance_id()
|
||||||
|
if !boosted_pawns.has(pawn_id):
|
||||||
|
# Add double movement effect
|
||||||
|
var double_time = DoubleTimeCard.new()
|
||||||
|
double_time.duration = 1 # Just for this turn
|
||||||
|
game.deckManager.playCard(double_time, pawn, null, game, true)
|
||||||
|
pawn.on_card_effect_changed()
|
||||||
|
boosted_pawns.append(pawn_id)
|
||||||
|
|
||||||
|
func remove_effect(piece: Pawn = null) -> void:
|
||||||
|
# Clean up any remaining boosts
|
||||||
|
boosted_pawns.clear()
|
||||||
|
|
||||||
func update_appearance() -> void:
|
func update_appearance() -> void:
|
||||||
if is_effect_active() && base_button:
|
if is_effect_active() && base_button:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue