Fixed DoubleMovement Tiles
This commit is contained in:
parent
75cd2fbe79
commit
b0ff6ddd89
3 changed files with 17 additions and 9 deletions
|
|
@ -54,8 +54,8 @@ signal hand_updated
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
func playCard(card: Card, target_piece: Pawn, board_flow = null, game_state = null):
|
func playCard(card: Card, target_piece: Pawn, board_flow = null, game_state = null, avoidHand = false):
|
||||||
if !hand.has(card):
|
if !avoidHand and !hand.has(card):
|
||||||
# print("Failed Play Card 1")
|
# print("Failed Play Card 1")
|
||||||
return false
|
return false
|
||||||
if card.duration > 0:
|
if card.duration > 0:
|
||||||
|
|
|
||||||
|
|
@ -108,10 +108,10 @@ func place_random_game_tiles(num_tiles: int = 6) -> void:
|
||||||
var tile: Tile
|
var tile: Tile
|
||||||
match tile_type:
|
match tile_type:
|
||||||
0: # DoubleMovementTile tile
|
0: # DoubleMovementTile tile
|
||||||
tile = FireWallTile.new(container, is_white, 3)
|
tile = DoubleMovementTile.new(container, is_white, -1)
|
||||||
1: # FireWallTile
|
1: # FireWallTile
|
||||||
tile = FireWallTile.new(container, is_white, 3)
|
tile = DoubleMovementTile.new(container, is_white, -1)
|
||||||
2: # PawnBoostTile tile
|
2: # PawnBoostTile tile
|
||||||
tile = FireWallTile.new(container, is_white, 3)
|
tile = DoubleMovementTile.new(container, is_white, -1)
|
||||||
|
|
||||||
add_tile(pos, tile)
|
add_tile(pos, tile)
|
||||||
|
|
@ -4,19 +4,27 @@ extends Tile
|
||||||
func _init(button: Button, is_white: bool, d: int) -> void:
|
func _init(button: Button, is_white: bool, d: int) -> void:
|
||||||
super._init(button, is_white, d)
|
super._init(button, is_white, d)
|
||||||
tile_name = "Double Movement"
|
tile_name = "Double Movement"
|
||||||
description = "Any unit that starts its turn here gets double movement for 2 turns"
|
description = "Any unit that starts its turn here gets double movement for 2 turns, Clears previous card effects"
|
||||||
type = TileType.GENERAL
|
type = TileType.GENERAL
|
||||||
tile_owner = TileOwner.GAME
|
tile_owner = TileOwner.GAME
|
||||||
duration = d # Permanent tile
|
duration = d # Permanent tile
|
||||||
|
|
||||||
func apply_effect(piece: Pawn = null) -> void:
|
func apply_effect(piece: Pawn = null) -> void:
|
||||||
print("APPLY DoubleMovementTile")
|
|
||||||
if piece && is_effect_active():
|
if piece && is_effect_active():
|
||||||
|
var deck_manager = game.deckManager
|
||||||
|
|
||||||
|
# Check for and remove any existing card
|
||||||
|
var piece_id = piece.get_instance_id()
|
||||||
|
if deck_manager.attached_cards.has(piece_id):
|
||||||
|
var existing_card = deck_manager.attached_cards[piece_id]
|
||||||
|
existing_card.remove_effect()
|
||||||
|
deck_manager.attached_cards.erase(piece_id)
|
||||||
|
|
||||||
# Add double movement effect to the piece
|
# Add double movement effect to the piece
|
||||||
var deck_manager = piece.get_parent().get_parent().get_parent().deckManager
|
|
||||||
var double_time = DoubleTimeCard.new()
|
var double_time = DoubleTimeCard.new()
|
||||||
double_time.duration = 2
|
double_time.duration = 2
|
||||||
deck_manager.playCard(double_time, piece)
|
deck_manager.playCard(double_time, piece, null, null, true)
|
||||||
|
piece.on_card_effect_changed()
|
||||||
|
|
||||||
func update_appearance() -> void:
|
func update_appearance() -> void:
|
||||||
if is_effect_active() && base_button:
|
if is_effect_active() && base_button:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue