minor coloring fixes and removed parent of a parent calls
This commit is contained in:
parent
c4c7bfc06d
commit
b20121cba4
5 changed files with 23 additions and 17 deletions
|
|
@ -19,6 +19,8 @@ var effectType: EffectType
|
|||
var remaining_turns: int = 0
|
||||
var unitWhitelist: Array[String] = [] # List of piece types this card can be attached to
|
||||
var id: String = Utils.generate_guid()
|
||||
var stored_board_flow = null
|
||||
var stored_game_state = null
|
||||
|
||||
func _init():
|
||||
remaining_turns = duration
|
||||
|
|
@ -37,6 +39,8 @@ func apply_effect(target_piece = null, board_flow = null, game_state = null):
|
|||
|
||||
remaining_turns = duration
|
||||
attached_piece = target_piece
|
||||
stored_board_flow = board_flow
|
||||
stored_game_state = game_state
|
||||
|
||||
match rank:
|
||||
Rank.RANK_0: burned = true
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@ func _init():
|
|||
|
||||
func apply_effect(target_piece = null, board_flow = null, game_state = null):
|
||||
attached_piece = target_piece
|
||||
stored_board_flow = board_flow
|
||||
stored_game_state = game_state
|
||||
if !target_piece or !board_flow or !game_state:
|
||||
print(cardName, " missing input param ")
|
||||
return false
|
||||
|
|
@ -105,11 +107,10 @@ func setup_persistent_effect(game_state):
|
|||
func on_turn_changed():
|
||||
# print("TURN CHANGED ==================", attached_piece, " | ", remaining_turns, )
|
||||
|
||||
if attached_piece.get_parent().get_parent().owner.isPlayerTurn() and attached_piece and remaining_turns > 0:
|
||||
# print(attached_piece.get_parent().get_parent(), attached_piece.get_parent().get_parent().owner)
|
||||
if attached_piece.stored_game_state.isPlayerTurn() and attached_piece and remaining_turns > 0:
|
||||
var piece = attached_piece
|
||||
var flow = attached_piece.get_parent().get_parent()
|
||||
var state = attached_piece.get_parent().get_parent().owner
|
||||
var flow = stored_board_flow
|
||||
var state = attached_piece.stored_game_state
|
||||
|
||||
# print("Debug values:")
|
||||
# print("- Piece: ", piece, " is null? ", piece == null)
|
||||
|
|
@ -122,7 +123,7 @@ func on_turn_changed():
|
|||
|
||||
func remove_effect():
|
||||
if attached_piece:
|
||||
var game_state = attached_piece.get_parent().get_parent().owner
|
||||
var game_state = attached_piece.stored_game_state
|
||||
if game_state.is_connected("turn_changed", on_turn_changed):
|
||||
game_state.disconnect("turn_changed", on_turn_changed)
|
||||
super.remove_effect()
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ func on_turn_changed():
|
|||
return
|
||||
|
||||
var piece = attached_piece
|
||||
var board_flow = piece.get_parent().get_parent()
|
||||
var board_flow = stored_board_flow
|
||||
var current_pos = piece.get_parent().name
|
||||
|
||||
# If the piece has moved, place fire tiles
|
||||
|
|
@ -72,7 +72,7 @@ func on_turn_changed():
|
|||
|
||||
func remove_effect():
|
||||
if attached_piece:
|
||||
var game_state = attached_piece.get_parent().get_parent().owner
|
||||
var game_state = stored_game_state
|
||||
if game_state.is_connected("turn_changed", on_turn_changed):
|
||||
game_state.disconnect("turn_changed", on_turn_changed)
|
||||
super.remove_effect()
|
||||
|
|
@ -15,6 +15,8 @@ func _init():
|
|||
|
||||
func apply_effect(target_piece = null, board_flow = null, game_state = null):
|
||||
attached_piece = target_piece
|
||||
stored_board_flow = board_flow
|
||||
stored_game_state = game_state
|
||||
if !target_piece or !board_flow or !game_state:
|
||||
print(cardName, " missing input param ")
|
||||
return false
|
||||
|
|
@ -26,10 +28,10 @@ func apply_effect(target_piece = null, board_flow = null, game_state = null):
|
|||
var king_pos = target_piece.get_parent().name.split("-")
|
||||
var king_x = int(king_pos[0])
|
||||
var king_y = int(king_pos[1])
|
||||
|
||||
|
||||
# Collect all tiles within radius to check
|
||||
var tiles_to_check = []
|
||||
|
||||
|
||||
# Check in all directions (up, down, left, right and diagonals)
|
||||
for dx in range(-CAPTURE_RADIUS, CAPTURE_RADIUS + 1):
|
||||
for dy in range(-CAPTURE_RADIUS, CAPTURE_RADIUS + 1):
|
||||
|
|
@ -79,7 +81,7 @@ func apply_effect(target_piece = null, board_flow = null, game_state = null):
|
|||
if piece != null and piece.Item_Color != target_piece.Item_Color:
|
||||
game_state.updatePoints(piece)
|
||||
container.remove_piece()
|
||||
|
||||
|
||||
# Setup timer to remove overlays
|
||||
var timer = Timer.new()
|
||||
board_flow.add_child(timer)
|
||||
|
|
@ -94,7 +96,7 @@ func apply_effect(target_piece = null, board_flow = null, game_state = null):
|
|||
timer.queue_free()
|
||||
)
|
||||
timer.start()
|
||||
|
||||
|
||||
return true
|
||||
|
||||
|
||||
|
|
@ -105,11 +107,10 @@ func setup_persistent_effect(game_state):
|
|||
|
||||
func on_turn_changed():
|
||||
|
||||
if attached_piece.get_parent().get_parent().owner.isPlayerTurn() and attached_piece and remaining_turns > 0:
|
||||
# print(attached_piece.get_parent().get_parent(), attached_piece.get_parent().get_parent().owner)
|
||||
if attached_piece.stored_game_state.isPlayerTurn() and attached_piece and remaining_turns > 0:
|
||||
var piece = attached_piece
|
||||
var flow = attached_piece.get_parent().get_parent()
|
||||
var state = attached_piece.get_parent().get_parent().owner
|
||||
var flow = attached_piece.stored_board_flow
|
||||
var state = attached_piece.stored_game_state
|
||||
|
||||
# print("Debug values:")
|
||||
# print("- Piece: ", piece, " is null? ", piece == null)
|
||||
|
|
@ -122,7 +123,7 @@ func on_turn_changed():
|
|||
|
||||
func remove_effect():
|
||||
if attached_piece:
|
||||
var game_state = attached_piece.get_parent().get_parent().owner
|
||||
var game_state = attached_piece.stored_game_state
|
||||
if game_state.is_connected("turn_changed", Callable(self, "on_turn_changed")):
|
||||
game_state.disconnect("turn_changed", Callable(self, "on_turn_changed"))
|
||||
super.remove_effect()
|
||||
|
|
|
|||
|
|
@ -177,7 +177,7 @@ func parseLocation(location: String) -> void:
|
|||
|
||||
func setupStyles() -> void:
|
||||
lightStyle = StyleBoxFlat.new()
|
||||
lightStyle.bg_color = Color(0.8, 0.8, 0.8, 1)
|
||||
lightStyle.bg_color = Color(0.5, 0.5, 0.5, 1)
|
||||
|
||||
darkStyle = StyleBoxFlat.new()
|
||||
darkStyle.bg_color = Color(0.2, 0.2, 0.2, 1)
|
||||
|
|
|
|||
Loading…
Reference in a new issue