class_name DoubleMovementTile extends Tile func _init(button: Button, is_white: bool, d: int) -> void: super._init(button, is_white, d) tile_name = "Double Movement" description = "Any unit that starts its turn here gets double movement for 2 turns, Clears previous card effects" type = TileType.GENERAL tile_owner = TileOwner.GAME duration = d # Permanent tile func apply_effect(piece: Pawn = null) -> void: if piece && is_effect_active(): var deck_manager = game.deckManager # Check for and remove any existing card var piece_id = piece.get_instance_id() if deck_manager.attached_cards.has(piece_id): var existing_card = deck_manager.attached_cards[piece_id] existing_card.remove_effect() deck_manager.attached_cards.erase(piece_id) # Add double movement effect to the piece var double_time = DoubleTimeCard.new() double_time.duration = 2 deck_manager.playCard(double_time, piece, null, null, true) piece.on_card_effect_changed() func update_appearance() -> void: if is_effect_active() && base_button: var style = StyleBoxFlat.new() var tile_color = Color(0, 0.8, 0.8) # Cyan for speed var base_color = Color(0.8, 0.8, 0.8) if base_is_white else Color(0.2, 0.2, 0.2) style.bg_color = Color( (base_color.r + tile_color.r) / 2, (base_color.g + tile_color.g) / 2, (base_color.b + tile_color.b) / 2 ) base_button.add_theme_stylebox_override("normal", style) else: restore_base_appearance()