33 lines
1.2 KiB
GDScript
33 lines
1.2 KiB
GDScript
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
|
|
var double_time = DoubleTimeCard.new()
|
|
double_time.duration = 2
|
|
deck_manager.playEffect(double_time, piece, null, null)
|
|
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 = Utils.LIGHT_CELL if base_is_white else Utils.DARK_CELL
|
|
|
|
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()
|