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 remaining_turns: int = 0
|
||||||
var unitWhitelist: Array[String] = [] # List of piece types this card can be attached to
|
var unitWhitelist: Array[String] = [] # List of piece types this card can be attached to
|
||||||
var id: String = Utils.generate_guid()
|
var id: String = Utils.generate_guid()
|
||||||
|
var stored_board_flow = null
|
||||||
|
var stored_game_state = null
|
||||||
|
|
||||||
func _init():
|
func _init():
|
||||||
remaining_turns = duration
|
remaining_turns = duration
|
||||||
|
|
@ -37,6 +39,8 @@ func apply_effect(target_piece = null, board_flow = null, game_state = null):
|
||||||
|
|
||||||
remaining_turns = duration
|
remaining_turns = duration
|
||||||
attached_piece = target_piece
|
attached_piece = target_piece
|
||||||
|
stored_board_flow = board_flow
|
||||||
|
stored_game_state = game_state
|
||||||
|
|
||||||
match rank:
|
match rank:
|
||||||
Rank.RANK_0: burned = true
|
Rank.RANK_0: burned = true
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,8 @@ func _init():
|
||||||
|
|
||||||
func apply_effect(target_piece = null, board_flow = null, game_state = null):
|
func apply_effect(target_piece = null, board_flow = null, game_state = null):
|
||||||
attached_piece = target_piece
|
attached_piece = target_piece
|
||||||
|
stored_board_flow = board_flow
|
||||||
|
stored_game_state = game_state
|
||||||
if !target_piece or !board_flow or !game_state:
|
if !target_piece or !board_flow or !game_state:
|
||||||
print(cardName, " missing input param ")
|
print(cardName, " missing input param ")
|
||||||
return false
|
return false
|
||||||
|
|
@ -105,11 +107,10 @@ func setup_persistent_effect(game_state):
|
||||||
func on_turn_changed():
|
func on_turn_changed():
|
||||||
# print("TURN CHANGED ==================", attached_piece, " | ", remaining_turns, )
|
# print("TURN CHANGED ==================", attached_piece, " | ", remaining_turns, )
|
||||||
|
|
||||||
if attached_piece.get_parent().get_parent().owner.isPlayerTurn() and attached_piece and remaining_turns > 0:
|
if attached_piece.stored_game_state.isPlayerTurn() and attached_piece and remaining_turns > 0:
|
||||||
# print(attached_piece.get_parent().get_parent(), attached_piece.get_parent().get_parent().owner)
|
|
||||||
var piece = attached_piece
|
var piece = attached_piece
|
||||||
var flow = attached_piece.get_parent().get_parent()
|
var flow = stored_board_flow
|
||||||
var state = attached_piece.get_parent().get_parent().owner
|
var state = attached_piece.stored_game_state
|
||||||
|
|
||||||
# print("Debug values:")
|
# print("Debug values:")
|
||||||
# print("- Piece: ", piece, " is null? ", piece == null)
|
# print("- Piece: ", piece, " is null? ", piece == null)
|
||||||
|
|
@ -122,7 +123,7 @@ func on_turn_changed():
|
||||||
|
|
||||||
func remove_effect():
|
func remove_effect():
|
||||||
if attached_piece:
|
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):
|
if game_state.is_connected("turn_changed", on_turn_changed):
|
||||||
game_state.disconnect("turn_changed", on_turn_changed)
|
game_state.disconnect("turn_changed", on_turn_changed)
|
||||||
super.remove_effect()
|
super.remove_effect()
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ func on_turn_changed():
|
||||||
return
|
return
|
||||||
|
|
||||||
var piece = attached_piece
|
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
|
var current_pos = piece.get_parent().name
|
||||||
|
|
||||||
# If the piece has moved, place fire tiles
|
# If the piece has moved, place fire tiles
|
||||||
|
|
@ -72,7 +72,7 @@ func on_turn_changed():
|
||||||
|
|
||||||
func remove_effect():
|
func remove_effect():
|
||||||
if attached_piece:
|
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):
|
if game_state.is_connected("turn_changed", on_turn_changed):
|
||||||
game_state.disconnect("turn_changed", on_turn_changed)
|
game_state.disconnect("turn_changed", on_turn_changed)
|
||||||
super.remove_effect()
|
super.remove_effect()
|
||||||
|
|
@ -15,6 +15,8 @@ func _init():
|
||||||
|
|
||||||
func apply_effect(target_piece = null, board_flow = null, game_state = null):
|
func apply_effect(target_piece = null, board_flow = null, game_state = null):
|
||||||
attached_piece = target_piece
|
attached_piece = target_piece
|
||||||
|
stored_board_flow = board_flow
|
||||||
|
stored_game_state = game_state
|
||||||
if !target_piece or !board_flow or !game_state:
|
if !target_piece or !board_flow or !game_state:
|
||||||
print(cardName, " missing input param ")
|
print(cardName, " missing input param ")
|
||||||
return false
|
return false
|
||||||
|
|
@ -105,11 +107,10 @@ func setup_persistent_effect(game_state):
|
||||||
|
|
||||||
func on_turn_changed():
|
func on_turn_changed():
|
||||||
|
|
||||||
if attached_piece.get_parent().get_parent().owner.isPlayerTurn() and attached_piece and remaining_turns > 0:
|
if attached_piece.stored_game_state.isPlayerTurn() and attached_piece and remaining_turns > 0:
|
||||||
# print(attached_piece.get_parent().get_parent(), attached_piece.get_parent().get_parent().owner)
|
|
||||||
var piece = attached_piece
|
var piece = attached_piece
|
||||||
var flow = attached_piece.get_parent().get_parent()
|
var flow = attached_piece.stored_board_flow
|
||||||
var state = attached_piece.get_parent().get_parent().owner
|
var state = attached_piece.stored_game_state
|
||||||
|
|
||||||
# print("Debug values:")
|
# print("Debug values:")
|
||||||
# print("- Piece: ", piece, " is null? ", piece == null)
|
# print("- Piece: ", piece, " is null? ", piece == null)
|
||||||
|
|
@ -122,7 +123,7 @@ func on_turn_changed():
|
||||||
|
|
||||||
func remove_effect():
|
func remove_effect():
|
||||||
if attached_piece:
|
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")):
|
if game_state.is_connected("turn_changed", Callable(self, "on_turn_changed")):
|
||||||
game_state.disconnect("turn_changed", Callable(self, "on_turn_changed"))
|
game_state.disconnect("turn_changed", Callable(self, "on_turn_changed"))
|
||||||
super.remove_effect()
|
super.remove_effect()
|
||||||
|
|
|
||||||
|
|
@ -177,7 +177,7 @@ func parseLocation(location: String) -> void:
|
||||||
|
|
||||||
func setupStyles() -> void:
|
func setupStyles() -> void:
|
||||||
lightStyle = StyleBoxFlat.new()
|
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 = StyleBoxFlat.new()
|
||||||
darkStyle.bg_color = Color(0.2, 0.2, 0.2, 1)
|
darkStyle.bg_color = Color(0.2, 0.2, 0.2, 1)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue