diff --git a/scenes/main.tscn b/scenes/main.tscn index d41d33b..e081af5 100644 --- a/scenes/main.tscn +++ b/scenes/main.tscn @@ -470,10 +470,11 @@ opponent_battlefield = NodePath("../../Opponent/OpponentBattlefield") controlled_by_me = true graveyard = NodePath("../MyGraveyard") -[node name="MyHand" type="Node3D" parent="Card Groups/Mine" node_paths=PackedStringArray("opponent_hand_controller", "graveyard")] +[node name="MyHand" type="Node3D" parent="Card Groups/Mine" node_paths=PackedStringArray("opponent_hand_controller", "opponent_battlefield", "graveyard")] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.709553, -9.428, 0) script = ExtResource("7_mqjt8") opponent_hand_controller = NodePath("../../Opponent/OpponentHand") +opponent_battlefield = NodePath("../../Opponent/OpponentBattlefield") controlled_by_me = true graveyard = NodePath("../MyGraveyard") @@ -501,11 +502,12 @@ script = ExtResource("2_rndq6") opponent_battlefield = NodePath("../../Mine/MyBattlefield") graveyard = NodePath("../OpponentGraveyard") -[node name="OpponentHand" type="Node3D" parent="Card Groups/Opponent" node_paths=PackedStringArray("opponent_hand_controller", "graveyard")] +[node name="OpponentHand" type="Node3D" parent="Card Groups/Opponent" node_paths=PackedStringArray("opponent_hand_controller", "opponent_battlefield", "graveyard")] transform = Transform3D(-1, 8.74228e-08, 0, -8.74228e-08, -1, 0, 0, 0, 1, 0.748875, 9.61394, 0) script = ExtResource("7_mqjt8") hidden_hand = true opponent_hand_controller = NodePath("../../Mine/MyHand") +opponent_battlefield = NodePath("../../Mine/MyBattlefield") graveyard = NodePath("../OpponentGraveyard") [node name="OpponentDeck" type="Node3D" parent="Card Groups/Opponent" node_paths=PackedStringArray("graveyard")] diff --git a/scripts/CardController.gd b/scripts/CardController.gd index b439713..9778ab3 100644 --- a/scripts/CardController.gd +++ b/scripts/CardController.gd @@ -248,6 +248,7 @@ func display_toast(msg): self.engine.display_toast(msg) func on_entered_play(): + print(card_name + " came into play") in_play = true show_cost(false) if not tapped: @@ -255,57 +256,71 @@ func on_entered_play(): Audio.play(sound_resource.sounds.get("enter_play")) func on_exited_play(): + print(card_name + " exited play") in_play = false func on_entered_graveyard(): + print(card_name + " entered graveyard") pass func on_played_on(target): + print(card_name + " was played on " + target.card_name) pass func on_drawn(): + print(card_name + " was drawn") pass - -func on_card_draw(card): + +func on_enemy_draw_card(card): + print(card_name + " was was notified that enemy drew " + card.card_name) pass - + + func on_death(killer): + print(card_name + " died") pass func on_attack(target): + print(card_name + " attacked " + target.card_name) pass func on_attacked(attacker): + print(card_name + " was attacked by " + attacker.card_name) pass func on_targeted(attacker): pass func on_damaged(attacker, amount): + print(card_name + " was damaged by " + attacker.card_name + " for " + amount + " damage") pass func on_healed(healer, amount): + print(card_name + " was healed by " + healer.card_name + " for " + amount + " damage") pass func on_turn_start(): + print(card_name + " was was notified of turn start") if tapped: do_tap() func on_turn_end(): + print(card_name + " was was notified of turn end") if tapped: do_tap() func on_neighbors_changed(): + print(card_name + " was was notified its battlefield might have changed") pass func on_enemy_neighbors_changed(): - pass - -func on_enemy_draw_card(): + print(card_name + " was was notified the opponent's battlefield might have changed") pass func on_enemy_turn_start(): + print(card_name + " was was notified of the enemy's turn start") pass func on_enemy_turn_end(): + print(card_name + " was was notified of the enemy's turn end") pass diff --git a/scripts/HandController.gd b/scripts/HandController.gd index bcb15fb..b6a4521 100644 --- a/scripts/HandController.gd +++ b/scripts/HandController.gd @@ -5,6 +5,7 @@ extends "res://scripts/CardGroupController.gd" var original_rotation : Basis @export var is_hovering = false @export var opponent_hand_controller : HandController +@export var opponent_battlefield : BattlefieldController func _ready() -> void: super._ready() @@ -22,6 +23,10 @@ func insert_card(card: Node3D, index: int, global_position: Vector3) -> void: super.insert_card(card, index, global_position) card.show_power_toughness(!hidden_hand) + card.on_drawn() + for c in opponent_battlefield.managed_cards: + c.on_enemy_draw_card() + func get_desired_position(index: int) -> Vector3: var num_cards = get_cards_len() var desired_width = clampf(pow(1.25, float(num_cards)) * 3, 0, 15)