Fixed tile ownership fore FieryCap
This commit is contained in:
parent
e8042a2c44
commit
75cd2fbe79
6 changed files with 17 additions and 9 deletions
|
|
@ -1,16 +1,16 @@
|
||||||
class_name FireyCapeCard extends Card
|
class_name FieryCapeCard extends Card
|
||||||
|
|
||||||
var previous_position: String = ""
|
var previous_position: String = ""
|
||||||
var fire_tiles: Array[String] = []
|
var fire_tiles: Array[String] = []
|
||||||
|
|
||||||
func _init():
|
func _init():
|
||||||
super._init()
|
super._init()
|
||||||
cardName = "Firey Cape"
|
cardName = "Fiery Cape"
|
||||||
rank = Rank.RANK_2
|
rank = Rank.RANK_2
|
||||||
effectType = EffectType.PIECE_EFFECT
|
effectType = EffectType.PIECE_EFFECT
|
||||||
description = "Leaves a trail of fire that lasts 4 turns. Owner's pieces can pass safely."
|
description = "Leaves a trail of fire that lasts 4 turns. Owner's pieces can pass safely."
|
||||||
duration = 3 # Card effect lasts 3 turns
|
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):
|
func apply_effect(target_piece = null, board_flow = null, game_state = null):
|
||||||
if !super.apply_effect(target_piece, board_flow, game_state):
|
if !super.apply_effect(target_piece, board_flow, game_state):
|
||||||
|
|
@ -22,7 +22,7 @@ func initializeStartingDeck():
|
||||||
deck.clear();
|
deck.clear();
|
||||||
# for i in range(2):
|
# for i in range(2):
|
||||||
# deck.append(DoubleTimeCard.new())
|
# deck.append(DoubleTimeCard.new())
|
||||||
deck.append(FireyCapeCard.new())
|
deck.append(FieryCapeCard.new())
|
||||||
deck.append(ExplosiveBootsCard.new())
|
deck.append(ExplosiveBootsCard.new())
|
||||||
deck.append(DoubleTimeCard.new())
|
deck.append(DoubleTimeCard.new())
|
||||||
deck.append(DrunkDrivingCard.new())
|
deck.append(DrunkDrivingCard.new())
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ func _ready() -> void:
|
||||||
|
|
||||||
|
|
||||||
func initializeTiles() -> void:
|
func initializeTiles() -> void:
|
||||||
tileManager = TileManager.new()
|
tileManager = TileManager.new($Flow, self)
|
||||||
add_child(tileManager)
|
add_child(tileManager)
|
||||||
await get_tree().process_frame
|
await get_tree().process_frame
|
||||||
tileManager.initialize(boardContainer)
|
tileManager.initialize(boardContainer)
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ enum TileOwner {
|
||||||
ENEMY, # Black player
|
ENEMY, # Black player
|
||||||
GAME # Neutral/game-owned
|
GAME # Neutral/game-owned
|
||||||
}
|
}
|
||||||
|
var game: ChessGame
|
||||||
var tile_name: String = ""
|
var tile_name: String = ""
|
||||||
var description: String = ""
|
var description: String = ""
|
||||||
var duration: int = -1 # -1 for permanent tiles
|
var duration: int = -1 # -1 for permanent tiles
|
||||||
|
|
|
||||||
|
|
@ -3,14 +3,17 @@ extends Node
|
||||||
|
|
||||||
var active_tiles: Dictionary = {} # location: Tile
|
var active_tiles: Dictionary = {} # location: Tile
|
||||||
var board_flow: FlowContainer
|
var board_flow: FlowContainer
|
||||||
|
var game: ChessGame
|
||||||
|
|
||||||
const DoubleMovementTile = preload("res://Systems/Tiles/DoubleMovement.gd")
|
const DoubleMovementTile = preload("res://Systems/Tiles/DoubleMovement.gd")
|
||||||
const FireWallTile = preload("res://Systems/Tiles/FireWall.gd")
|
const FireWallTile = preload("res://Systems/Tiles/FireWall.gd")
|
||||||
const PawnBoostTile = preload("res://Systems/Tiles/PawnBoost.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:
|
if flow:
|
||||||
initialize(flow)
|
initialize(flow)
|
||||||
|
|
||||||
|
game = chess_game
|
||||||
|
|
||||||
func initialize(flow: FlowContainer) -> void:
|
func initialize(flow: FlowContainer) -> void:
|
||||||
board_flow = flow
|
board_flow = flow
|
||||||
clear_tiles()
|
clear_tiles()
|
||||||
|
|
@ -28,6 +31,7 @@ func add_tile(location: String, tile: Tile) -> void:
|
||||||
# Remove any existing tile
|
# Remove any existing tile
|
||||||
remove_tile(location)
|
remove_tile(location)
|
||||||
|
|
||||||
|
tile.game = game
|
||||||
# Add new tile
|
# Add new tile
|
||||||
active_tiles[location] = tile
|
active_tiles[location] = tile
|
||||||
tile.effect_expired.connect(func(): remove_tile(location))
|
tile.effect_expired.connect(func(): remove_tile(location))
|
||||||
|
|
|
||||||
|
|
@ -7,13 +7,17 @@ func _init(button: Button, is_white: bool, d: int, owner: TileOwner = TileOwner.
|
||||||
description = "Captures any piece that moves through"
|
description = "Captures any piece that moves through"
|
||||||
type = TileType.GENERAL
|
type = TileType.GENERAL
|
||||||
duration = d
|
duration = d
|
||||||
|
tile_owner = owner
|
||||||
|
|
||||||
func apply_effect(piece: Pawn = null) -> void:
|
func apply_effect(piece: Pawn = null) -> void:
|
||||||
if piece && is_effect_active():
|
if piece && is_effect_active():
|
||||||
# Only affect enemy pieces based on tile owner
|
# Only affect enemy pieces based on tile owner
|
||||||
var is_enemy = false
|
var is_enemy = false
|
||||||
|
print("--------___CHECKING FIREWALL")
|
||||||
|
print(tile_owner, " ", piece.Item_Color)
|
||||||
match tile_owner:
|
match tile_owner:
|
||||||
TileOwner.PLAYER: # White
|
TileOwner.PLAYER: # White
|
||||||
|
print("PLAYER OWNER")
|
||||||
is_enemy = piece.Item_Color == 1 # Black pieces are enemy
|
is_enemy = piece.Item_Color == 1 # Black pieces are enemy
|
||||||
TileOwner.ENEMY: # Black
|
TileOwner.ENEMY: # Black
|
||||||
is_enemy = piece.Item_Color == 0 # White pieces are enemy
|
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
|
is_enemy = true # Game-owned fire affects all
|
||||||
|
|
||||||
if is_enemy:
|
if is_enemy:
|
||||||
|
|
||||||
var container = piece.get_parent() as PieceContainer
|
var container = piece.get_parent() as PieceContainer
|
||||||
if container:
|
if container:
|
||||||
var board = container.get_parent().get_parent() as ChessGame
|
game.updatePoints(piece)
|
||||||
board.updatePoints(piece)
|
|
||||||
container.remove_piece()
|
container.remove_piece()
|
||||||
|
|
||||||
func update_appearance() -> void:
|
func update_appearance() -> void:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue