Fixed tile ownership fore FieryCap

This commit is contained in:
2ManyProjects 2025-02-05 18:38:54 -06:00
parent e8042a2c44
commit 75cd2fbe79
6 changed files with 17 additions and 9 deletions

View file

@ -1,16 +1,16 @@
class_name FireyCapeCard extends Card
class_name FieryCapeCard extends Card
var previous_position: String = ""
var fire_tiles: Array[String] = []
func _init():
super._init()
cardName = "Firey Cape"
cardName = "Fiery Cape"
rank = Rank.RANK_2
effectType = EffectType.PIECE_EFFECT
description = "Leaves a trail of fire that lasts 4 turns. Owner's pieces can pass safely."
duration = 3 # Card effect lasts 3 turns
unitWhitelist = [] # Any piece can wear the cape
unitWhitelist = ["Pawn", "Bishop", "Queen", "King", "Rook"] # Any piece can wear the cape
func apply_effect(target_piece = null, board_flow = null, game_state = null):
if !super.apply_effect(target_piece, board_flow, game_state):

View file

@ -22,7 +22,7 @@ func initializeStartingDeck():
deck.clear();
# for i in range(2):
# deck.append(DoubleTimeCard.new())
deck.append(FireyCapeCard.new())
deck.append(FieryCapeCard.new())
deck.append(ExplosiveBootsCard.new())
deck.append(DoubleTimeCard.new())
deck.append(DrunkDrivingCard.new())

View file

@ -49,7 +49,7 @@ func _ready() -> void:
func initializeTiles() -> void:
tileManager = TileManager.new()
tileManager = TileManager.new($Flow, self)
add_child(tileManager)
await get_tree().process_frame
tileManager.initialize(boardContainer)

View file

@ -12,7 +12,7 @@ enum TileOwner {
ENEMY, # Black player
GAME # Neutral/game-owned
}
var game: ChessGame
var tile_name: String = ""
var description: String = ""
var duration: int = -1 # -1 for permanent tiles

View file

@ -3,14 +3,17 @@ extends Node
var active_tiles: Dictionary = {} # location: Tile
var board_flow: FlowContainer
var game: ChessGame
const DoubleMovementTile = preload("res://Systems/Tiles/DoubleMovement.gd")
const FireWallTile = preload("res://Systems/Tiles/FireWall.gd")
const PawnBoostTile = preload("res://Systems/Tiles/PawnBoost.gd")
func _init(flow: FlowContainer = null) -> void:
func _init(flow: FlowContainer = null, chess_game: ChessGame = null) -> void:
if flow:
initialize(flow)
game = chess_game
func initialize(flow: FlowContainer) -> void:
board_flow = flow
clear_tiles()
@ -28,6 +31,7 @@ func add_tile(location: String, tile: Tile) -> void:
# Remove any existing tile
remove_tile(location)
tile.game = game
# Add new tile
active_tiles[location] = tile
tile.effect_expired.connect(func(): remove_tile(location))

View file

@ -7,13 +7,17 @@ func _init(button: Button, is_white: bool, d: int, owner: TileOwner = TileOwner.
description = "Captures any piece that moves through"
type = TileType.GENERAL
duration = d
tile_owner = owner
func apply_effect(piece: Pawn = null) -> void:
if piece && is_effect_active():
# Only affect enemy pieces based on tile owner
var is_enemy = false
print("--------___CHECKING FIREWALL")
print(tile_owner, " ", piece.Item_Color)
match tile_owner:
TileOwner.PLAYER: # White
print("PLAYER OWNER")
is_enemy = piece.Item_Color == 1 # Black pieces are enemy
TileOwner.ENEMY: # Black
is_enemy = piece.Item_Color == 0 # White pieces are enemy
@ -21,10 +25,10 @@ func apply_effect(piece: Pawn = null) -> void:
is_enemy = true # Game-owned fire affects all
if is_enemy:
var container = piece.get_parent() as PieceContainer
if container:
var board = container.get_parent().get_parent() as ChessGame
board.updatePoints(piece)
game.updatePoints(piece)
container.remove_piece()
func update_appearance() -> void: