created movement related cards

This commit is contained in:
2ManyProjects 2025-03-17 17:16:30 -05:00
parent 47f46d230b
commit 0cbbd15a60
9 changed files with 96 additions and 19 deletions

View file

@ -0,0 +1,28 @@
class_name HorseCostumeCard extends Card
func _init():
super._init()
# id = Utils.generate_guid()
cardName = "Horse Costume"
rank = Rank.RANK_2
effectType = EffectType.MOVEMENT_MODIFIER
description = "Attached Unit can move and capture in any direction"
duration = 3
unitWhitelist = ["Pawn", "Bishop", "Queen", "Rook", "King"]
is_default = true
# current_movement_string = "mWmFcfF"
func apply_effect(target_piece = null, board_flow = null, game_state = null):
if !super.apply_effect(target_piece, board_flow, game_state):
return false
attached_piece = target_piece
attached_piece.current_movement_string = "N"
return true
func reset():
super.reset()
remaining_turns = duration
attached_piece.reset_current_movement_string()

View file

@ -0,0 +1 @@
uid://nw1oesh7pr48

View file

@ -0,0 +1,28 @@
class_name KingsSquireCard extends Card
func _init():
super._init()
# id = Utils.generate_guid()
cardName = "Kings' Squire"
rank = Rank.RANK_2
effectType = EffectType.MOVEMENT_MODIFIER
description = "Attached Pawn can move and capture in any direction"
duration = 1 # Lasts for 2 turns
unitWhitelist = ["Pawn"]
is_default = false
# current_movement_string = "mWmFcfF"
func apply_effect(target_piece = null, board_flow = null, game_state = null):
if !super.apply_effect(target_piece, board_flow, game_state):
return false
attached_piece = target_piece
attached_piece.current_movement_string = "WF"
return true
func reset():
super.reset()
remaining_turns = duration
attached_piece.reset_current_movement_string()

View file

@ -0,0 +1 @@
uid://ms7wi6dgoqnr

View file

@ -0,0 +1,28 @@
class_name QueensSquireCard extends Card
func _init():
super._init()
# id = Utils.generate_guid()
cardName = "Queens' Squire"
rank = Rank.RANK_3
effectType = EffectType.MOVEMENT_MODIFIER
description = "Attached Pawn can move in any direction, can only capture diagonally forward"
duration = 1 # Lasts for 2 turns
unitWhitelist = ["Pawn"]
is_default = true
# current_movement_string = "mWmFcfF"
func apply_effect(target_piece = null, board_flow = null, game_state = null):
if !super.apply_effect(target_piece, board_flow, game_state):
return false
attached_piece = target_piece
attached_piece.current_movement_string = "mWmFcfF"
return true
func reset():
super.reset()
remaining_turns = duration
attached_piece.reset_current_movement_string()

View file

@ -0,0 +1 @@
uid://8vpac2cx4e0u

View file

@ -552,8 +552,8 @@ func generate_chess_data(node, player):
var unit_string = level_unit_distribution[index]
var pawn_string = ""
var height = 6;
unit_string = level_unit_distribution[level_unit_distribution.size() - 1]
height = 8
# unit_string = level_unit_distribution[level_unit_distribution.size() - 1]
# height = 8
for x in unit_string.length():
pawn_string += "p"

View file

@ -91,18 +91,7 @@ enum LossConditionType {
UNIT_LOST, # Default: King loss
TURN_NUMBER # Turn limit reached
}
static var CardTypes = [
HopscotchCard,
FieryCapeCard,
FieryTrailCard,
ExplosiveBootsCard,
DoubleTimeCard,
DrunkDrivingCard,
SupernovaCard
]
static var CardPrices = {
Card.Rank.RANK_0: 200, # Legendary (Rank 0)
Card.Rank.RANK_1: 100, # Rare (Rank 1)

View file

@ -148,8 +148,8 @@ func getValidMoves(board_flow, current_location: String) -> Dictionary:
"N": # Knight
processKnightMove(board_flow, moves, x, y, dir_vector, can_move, can_capture)
# Add special pawn moves if this is a pawn
if original_movement_string == "mfWcfF":
# Add special pawn moves if this is a pawn and no movement effects currently applied
if self.name == "Pawn" and self.original_movement_string == self.current_movement_string:
addSpecialPawnMoves(board_flow, moves, x, y)
return moves
@ -174,6 +174,9 @@ func can_move_to_cell(board_flow, location: String, is_capture: bool = false) ->
func set_current_movement_string(mvmnt: String):
current_movement_string = mvmnt
func reset_current_movement_string():
original_movement_string = current_movement_string
func get_current_movement_string() -> String:
return current_movement_string
@ -287,13 +290,11 @@ func getDirectionsForAtom(atom) -> Array:
"N": # Knight - directions handled specially
base_directions = ["f", "b", "l", "r"]
# Filter directions based on modifiers - NEW LOGIC HERE
if direction_modifiers:
var filtered_directions = []
for dir in base_directions:
# For each direction, check if it CONTAINS any of the modifiers
# (doesn't need to match all characters)
# For each direction, check if it has any of the modifiers
var contains_modifier = false
for mod in direction_modifiers:
if dir.contains(mod):