ChessBuilder/Systems/Tiles/PawnBoost.gd

29 lines
No EOL
1 KiB
GDScript

class_name PawnBoostTile
extends Tile
func _init(button: Button, is_white: bool) -> void:
super._init(button, is_white)
tile_name = "Pawn Boost"
description = "While a Bishop is here, friendly pawns can move 2 spots"
type = TileType.GLOBAL
target_piece_type = "Bishop"
tile_owner = TileOwner.GAME
duration = -1
func apply_effect(piece: Pawn = null) -> void:
if piece && is_effect_active() && piece.name == "Bishop":
# This would be implemented in the pawn movement calculation
pass
func update_appearance() -> void:
if is_effect_active() && base_button:
var style = StyleBoxFlat.new()
var tile_color = Color(0, 0.8, 0) # Green for boost
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)