fix: minor spelling mistakes

This commit is contained in:
kennetha123 2025-01-26 07:15:58 +07:00
parent ca9c7b8e50
commit 64e79704bf
9 changed files with 32 additions and 35 deletions

View file

@ -1,4 +1,4 @@
[gd_resource type="Resource" script_class="SimpleSupportCard" load_steps=3 format=3 uid="uid://cc0ebl4g4ffyk"] [gd_resource type="Resource" script_class="ImplementedSupportCard" load_steps=3 format=3 uid="uid://be01tdq1fxlct"]
[ext_resource type="Script" path="res://tcg/card/support_card_effect_instance.gd" id="1_mhxdy"] [ext_resource type="Script" path="res://tcg/card/support_card_effect_instance.gd" id="1_mhxdy"]
[ext_resource type="Script" path="res://tcg/card/implemented_support_card.gd" id="2_f6hay"] [ext_resource type="Script" path="res://tcg/card/implemented_support_card.gd" id="2_f6hay"]
@ -6,7 +6,6 @@
[resource] [resource]
script = ExtResource("2_f6hay") script = ExtResource("2_f6hay")
scope = "turn" scope = "turn"
magnitude = 0
type = "red" type = "red"
effects = Array[ExtResource("1_mhxdy")]([]) effects = Array[ExtResource("1_mhxdy")]([])
name = "Absorb" name = "Absorb"

View file

@ -1,4 +1,4 @@
[gd_resource type="Resource" script_class="SimpleSupportCard" load_steps=3 format=3 uid="uid://dgxcvdo6x6kst"] [gd_resource type="Resource" script_class="ImplementedSupportCard" load_steps=3 format=3 uid="uid://dgxcvdo6x6kst"]
[ext_resource type="Script" path="res://tcg/card/support_card_effect_instance.gd" id="1_fd50n"] [ext_resource type="Script" path="res://tcg/card/support_card_effect_instance.gd" id="1_fd50n"]
[ext_resource type="Script" path="res://tcg/card/implemented_support_card.gd" id="2_61mgn"] [ext_resource type="Script" path="res://tcg/card/implemented_support_card.gd" id="2_61mgn"]
@ -6,7 +6,6 @@
[resource] [resource]
script = ExtResource("2_61mgn") script = ExtResource("2_61mgn")
scope = "instant" scope = "instant"
magnitude = 0
type = "green" type = "green"
effects = Array[ExtResource("1_fd50n")]([null]) effects = Array[ExtResource("1_fd50n")]([null])
name = "All-Out Attack" name = "All-Out Attack"

View file

@ -1,4 +1,4 @@
[gd_resource type="Resource" script_class="SimpleSupportCard" load_steps=3 format=3 uid="uid://c0grh1y65e0f3"] [gd_resource type="Resource" script_class="ImplementedSupportCard" load_steps=3 format=3 uid="uid://c0grh1y65e0f3"]
[ext_resource type="Script" path="res://tcg/card/support_card_effect_instance.gd" id="1_pkc1x"] [ext_resource type="Script" path="res://tcg/card/support_card_effect_instance.gd" id="1_pkc1x"]
[ext_resource type="Script" path="res://tcg/card/implemented_support_card.gd" id="2_iq88n"] [ext_resource type="Script" path="res://tcg/card/implemented_support_card.gd" id="2_iq88n"]
@ -6,7 +6,6 @@
[resource] [resource]
script = ExtResource("2_iq88n") script = ExtResource("2_iq88n")
scope = "turn" scope = "turn"
magnitude = 0
type = "green" type = "green"
effects = Array[ExtResource("1_pkc1x")]([null]) effects = Array[ExtResource("1_pkc1x")]([null])
name = "Energy Booster" name = "Energy Booster"

View file

@ -1,4 +1,4 @@
[gd_resource type="Resource" script_class="SimpleSupportCard" load_steps=3 format=3 uid="uid://dfocg5yfh22e8"] [gd_resource type="Resource" script_class="ImplementedSupportCard" load_steps=3 format=3 uid="uid://dfocg5yfh22e8"]
[ext_resource type="Script" path="res://tcg/card/support_card_effect_instance.gd" id="1_gtyqr"] [ext_resource type="Script" path="res://tcg/card/support_card_effect_instance.gd" id="1_gtyqr"]
[ext_resource type="Script" path="res://tcg/card/implemented_support_card.gd" id="2_3ixor"] [ext_resource type="Script" path="res://tcg/card/implemented_support_card.gd" id="2_3ixor"]
@ -6,7 +6,6 @@
[resource] [resource]
script = ExtResource("2_3ixor") script = ExtResource("2_3ixor")
scope = "turn" scope = "turn"
magnitude = 10
type = "red" type = "red"
effects = Array[ExtResource("1_gtyqr")]([null]) effects = Array[ExtResource("1_gtyqr")]([null])
name = "Insurance" name = "Insurance"

View file

@ -1,4 +1,4 @@
[gd_resource type="Resource" script_class="SimpleSupportCard" load_steps=3 format=3 uid="uid://bcrlaam8uq6xt"] [gd_resource type="Resource" script_class="ImplementedSupportCard" load_steps=3 format=3 uid="uid://bcrlaam8uq6xt"]
[ext_resource type="Script" path="res://tcg/card/support_card_effect_instance.gd" id="1_b33y4"] [ext_resource type="Script" path="res://tcg/card/support_card_effect_instance.gd" id="1_b33y4"]
[ext_resource type="Script" path="res://tcg/card/implemented_support_card.gd" id="2_khaf1"] [ext_resource type="Script" path="res://tcg/card/implemented_support_card.gd" id="2_khaf1"]
@ -6,7 +6,6 @@
[resource] [resource]
script = ExtResource("2_khaf1") script = ExtResource("2_khaf1")
scope = "turn" scope = "turn"
magnitude = 0
type = "green" type = "green"
effects = Array[ExtResource("1_b33y4")]([null]) effects = Array[ExtResource("1_b33y4")]([null])
name = "Lifesteal" name = "Lifesteal"

View file

@ -1,4 +1,4 @@
[gd_resource type="Resource" script_class="SimpleSupportCard" load_steps=5 format=3 uid="uid://2xeb6keaoabo"] [gd_resource type="Resource" script_class="ImplementedSupportCard" load_steps=5 format=3 uid="uid://2xeb6keaoabo"]
[ext_resource type="Script" path="res://tcg/card/support_card_effect_instance.gd" id="1_y6yvj"] [ext_resource type="Script" path="res://tcg/card/support_card_effect_instance.gd" id="1_y6yvj"]
[ext_resource type="Resource" uid="uid://bs4i85slalkgd" path="res://data/support_effects/sword_mastery.tres" id="2_omhdb"] [ext_resource type="Resource" uid="uid://bs4i85slalkgd" path="res://data/support_effects/sword_mastery.tres" id="2_omhdb"]
@ -12,7 +12,6 @@ effect = ExtResource("2_omhdb")
[resource] [resource]
script = ExtResource("3_37rh4") script = ExtResource("3_37rh4")
scope = "monster" scope = "monster"
magnitude = 20
type = "green" type = "green"
effects = Array[ExtResource("1_y6yvj")]([SubResource("Resource_wwv02")]) effects = Array[ExtResource("1_y6yvj")]([SubResource("Resource_wwv02")])
name = "Sword Mastery" name = "Sword Mastery"

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=12 format=3 uid="uid://bgc0u117jqyr1"] [gd_scene load_steps=19 format=3 uid="uid://bgc0u117jqyr1"]
[ext_resource type="Script" path="res://demo_game.gd" id="1_jn16u"] [ext_resource type="Script" path="res://demo_game.gd" id="1_jn16u"]
[ext_resource type="Script" path="res://player_side.gd" id="2_w4tnt"] [ext_resource type="Script" path="res://player_side.gd" id="2_w4tnt"]
@ -7,10 +7,17 @@
[ext_resource type="Resource" uid="uid://cs7q8i7bvohmj" path="res://data/cards/monster/capytain.tres" id="3_we1tk"] [ext_resource type="Resource" uid="uid://cs7q8i7bvohmj" path="res://data/cards/monster/capytain.tres" id="3_we1tk"]
[ext_resource type="Resource" uid="uid://4eod3m0vc5a8" path="res://data/cards/support/potion.tres" id="4_kkhfk"] [ext_resource type="Resource" uid="uid://4eod3m0vc5a8" path="res://data/cards/support/potion.tres" id="4_kkhfk"]
[ext_resource type="Resource" uid="uid://di76avwc0gn8e" path="res://data/cards/monster/axoluna.tres" id="5_3cm5x"] [ext_resource type="Resource" uid="uid://di76avwc0gn8e" path="res://data/cards/monster/axoluna.tres" id="5_3cm5x"]
[ext_resource type="Resource" uid="uid://bcrlaam8uq6xt" path="res://data/cards/support/lifesteal.tres" id="6_potm8"]
[ext_resource type="PackedScene" uid="uid://bhrelvt51cbp2" path="res://ui/card_template/monster_card.tscn" id="7_4ah45"] [ext_resource type="PackedScene" uid="uid://bhrelvt51cbp2" path="res://ui/card_template/monster_card.tscn" id="7_4ah45"]
[ext_resource type="Resource" uid="uid://dgxcvdo6x6kst" path="res://data/cards/support/all_out_attack.tres" id="7_nvv8k"]
[ext_resource type="PackedScene" uid="uid://b60vuykleugjn" path="res://ui/card_template/skip_card.tscn" id="7_skjyk"] [ext_resource type="PackedScene" uid="uid://b60vuykleugjn" path="res://ui/card_template/skip_card.tscn" id="7_skjyk"]
[ext_resource type="PackedScene" uid="uid://dg5amjm1gqi06" path="res://ui/card_template/support_card_green.tscn" id="8_dytl5"] [ext_resource type="PackedScene" uid="uid://dg5amjm1gqi06" path="res://ui/card_template/support_card_green.tscn" id="8_dytl5"]
[ext_resource type="Resource" uid="uid://be01tdq1fxlct" path="res://data/cards/support/absorb.tres" id="8_ewr4v"]
[ext_resource type="PackedScene" uid="uid://cds50kwwhlgam" path="res://ui/card_template/support_card_red.tscn" id="9_cabcc"] [ext_resource type="PackedScene" uid="uid://cds50kwwhlgam" path="res://ui/card_template/support_card_red.tscn" id="9_cabcc"]
[ext_resource type="Resource" uid="uid://dfocg5yfh22e8" path="res://data/cards/support/insurance.tres" id="9_ga5hf"]
[ext_resource type="Resource" uid="uid://c0grh1y65e0f3" path="res://data/cards/support/energy_booster.tres" id="10_3rg8q"]
[ext_resource type="Resource" uid="uid://2xeb6keaoabo" path="res://data/cards/support/sword_mastery.tres" id="11_seakd"]
[ext_resource type="Resource" uid="uid://bmst884k0myvd" path="res://data/cards/monster/cattogato.tres" id="12_xqqfn"]
[node name="DemoGame" type="Control"] [node name="DemoGame" type="Control"]
layout_mode = 3 layout_mode = 3
@ -20,8 +27,8 @@ anchor_bottom = 1.0
grow_horizontal = 2 grow_horizontal = 2
grow_vertical = 2 grow_vertical = 2
script = ExtResource("1_jn16u") script = ExtResource("1_jn16u")
player_1_deck = Array[ExtResource("2_xuft0")]([ExtResource("3_we1tk"), ExtResource("4_kkhfk"), ExtResource("4_kkhfk"), ExtResource("4_kkhfk"), ExtResource("5_3cm5x")]) player_1_deck = Array[ExtResource("2_xuft0")]([ExtResource("3_we1tk"), ExtResource("4_kkhfk"), ExtResource("5_3cm5x"), ExtResource("6_potm8"), ExtResource("7_nvv8k"), ExtResource("8_ewr4v"), ExtResource("9_ga5hf"), ExtResource("10_3rg8q"), ExtResource("11_seakd")])
player_2_deck = Array[ExtResource("2_xuft0")]([ExtResource("5_3cm5x"), ExtResource("4_kkhfk"), ExtResource("4_kkhfk"), ExtResource("4_kkhfk"), ExtResource("3_we1tk")]) player_2_deck = Array[ExtResource("2_xuft0")]([ExtResource("12_xqqfn"), ExtResource("4_kkhfk"), ExtResource("6_potm8"), ExtResource("7_nvv8k"), ExtResource("8_ewr4v"), ExtResource("9_ga5hf"), ExtResource("10_3rg8q"), ExtResource("11_seakd"), ExtResource("5_3cm5x")])
[node name="Own" type="Control" parent="." node_paths=PackedStringArray("deck", "energy_label")] [node name="Own" type="Control" parent="." node_paths=PackedStringArray("deck", "energy_label")]
layout_mode = 1 layout_mode = 1

View file

@ -46,14 +46,14 @@ func _on_update(transition):
return return
energy_label.text = "Energy: " + str(player.energy) energy_label.text = "Energy: " + str(player.energy)
if match_manager.support_cards_1.has(player): if match_manager.players[player.id].active_support_cards.size() > 0:
support1_green.visible = true support1_green.visible = true
support1_green.card = match_manager.support_cards_1[player] support1_green.card = match_manager.players[player.id].active_support_cards[0]
else: else:
support1_green.visible = false support1_green.visible = false
if match_manager.support_cards_2.has(player): if match_manager.players[player.id].active_support_cards.size() > 1:
var card: SupportCard = match_manager.support_cards_2[player] var card: SupportCard = match_manager.players[player.id].active_support_cards[1]
if card.type == "green": if card.type == "green":
support2_green.visible = true support2_green.visible = true
support2_green.card = card support2_green.card = card

View file

@ -35,14 +35,12 @@ func init(decks: Dictionary, actual_p1_id: int, actual_p2_id: int):
cleanup() cleanup()
for player_id in [PLAYER_1_ID, PLAYER_2_ID]: for player_id in [PLAYER_1_ID, PLAYER_2_ID]:
var deck_shuffled = decks[player_id].duplicate() as Array[Card] var deck_shuffled = decks[player_id].duplicate() as Array[Card]
deck_shuffled.shuffle()
var first_monster = deck_shuffled.filter(func(card): return card is MonsterCard)[0] var first_monster = deck_shuffled.filter(func(card): return card is MonsterCard)[0]
var first_monster_idx = deck_shuffled.find(first_monster) var first_monster_idx = deck_shuffled.find(first_monster)
deck_shuffled.pop_at(first_monster_idx) deck_shuffled.pop_at(first_monster_idx)
var zero_idx_card = deck_shuffled.pop_at(0) deck_shuffled.push_back(first_monster)
deck_shuffled.insert(0, first_monster)
deck_shuffled.insert(first_monster_idx, zero_idx_card)
deck_shuffled.shuffle()
players[player_id] = MatchPlayer.new(player_id, deck_shuffled) players[player_id] = MatchPlayer.new(player_id, deck_shuffled)
@ -97,12 +95,11 @@ func resolve(action_by_player_id: Dictionary) -> PhaseTransition:
"card": player_2_action.card "card": player_2_action.card
}) })
player_2.hand.erase(player_2_action.card) player_2.hand.erase(player_2_action.card)
support_cards.sort_custom(func(a, b): return a.card.priority < b.card.priority)
for played_card in support_cards: for played_card in support_cards:
var player: MatchPlayer = played_card.player var player: MatchPlayer = played_card.player
var card: SupportCard = played_card.card var card: SupportCard = played_card.card
if played_card is ImplementedSupportCard and played_card.scope != 'instant': if card is ImplementedSupportCard and card.scope != 'instant':
player.active_support_cards.append(played_card) player.active_support_cards.append(card)
var executed_instant_effects_events = _execute_support_card_instant_effects(player, card) var executed_instant_effects_events = _execute_support_card_instant_effects(player, card)
events.append_array(executed_instant_effects_events) events.append_array(executed_instant_effects_events)
phase = Match.Phase.RPS phase = Match.Phase.RPS
@ -116,7 +113,7 @@ func resolve(action_by_player_id: Dictionary) -> PhaseTransition:
if tie or player_2_win: if tie or player_2_win:
damage_pairs.append({"from": player_2, "to": player_1}) damage_pairs.append({"from": player_2, "to": player_1})
for pair in damage_pairs: for pair in damage_pairs:
var computed_damage = pair.from.monster.card.damage[pair.from.move] var computed_damage = pair.from.monster.card.damage[action_by_player_id[pair.from.id].move]
if _player_has_active_support_card(pair.from, "all_out_attack"): if _player_has_active_support_card(pair.from, "all_out_attack"):
var rps = [pair.from.monster.card.rock, pair.from.monster.card.paper, pair.from.monster.card.scissors] var rps = [pair.from.monster.card.rock, pair.from.monster.card.paper, pair.from.monster.card.scissors]
computed_damage = rps.reduce(func (a, b): return a + b, 0) computed_damage = rps.reduce(func (a, b): return a + b, 0)
@ -142,12 +139,11 @@ func resolve(action_by_player_id: Dictionary) -> PhaseTransition:
"card": player_2_action.card "card": player_2_action.card
}) })
player_2.hand.erase(player_2_action.card) player_2.hand.erase(player_2_action.card)
support_cards.sort_custom(func(a, b): return a.card.priority < b.card.priority)
for played_card in support_cards: for played_card in support_cards:
var player: MatchPlayer = played_card.player var player: MatchPlayer = played_card.player
var card: SupportCard = played_card.card var card: SupportCard = played_card.card
if played_card is ImplementedSupportCard and played_card.scope != 'instant': if card is ImplementedSupportCard and card.scope != 'instant':
player.active_support_cards.append(played_card) player.active_support_cards.append(card)
events.append_array(_execute_support_card_instant_effects(player, card)) events.append_array(_execute_support_card_instant_effects(player, card))
for player: MatchPlayer in players.values(): for player: MatchPlayer in players.values():
@ -161,10 +157,10 @@ func resolve(action_by_player_id: Dictionary) -> PhaseTransition:
if monster_final_health <= 0: if monster_final_health <= 0:
player.monster = null player.monster = null
var card_expires_with_monster = func(card): return card is ImplementedSupportCard and card.scope == 'monster' var card_expires_with_monster = func(card): return card is ImplementedSupportCard and card.scope == 'monster'
player.active_support_cards = player.active_support_cards.filter(card_expires_with_monster) player.active_support_cards = player.active_support_cards.filter(func (card): return not card_expires_with_monster.call(card))
events.append(EventMonsterDied.new(player.id)) events.append(EventMonsterDied.new(player.id))
else: else:
player.monster.health += player.monster.health_delta player.monster.health = monster_final_health
player.monster.health_delta = 0 player.monster.health_delta = 0
var drawn_card = player.deck.pop_back() var drawn_card = player.deck.pop_back()
if drawn_card: if drawn_card:
@ -172,7 +168,7 @@ func resolve(action_by_player_id: Dictionary) -> PhaseTransition:
events.append(EventCardDrawn.new(player.id, drawn_card)) events.append(EventCardDrawn.new(player.id, drawn_card))
var card_expires_this_turn = func(card): return card is ImplementedSupportCard and card.scope == 'turn' var card_expires_this_turn = func(card): return card is ImplementedSupportCard and card.scope == 'turn'
player.active_support_cards = player.active_support_cards.filter(card_expires_this_turn) player.active_support_cards = player.active_support_cards.filter(func (card): return not card_expires_this_turn.call(card))
var players_without_monster = players.values().filter(func(player): return player.monster == null) var players_without_monster = players.values().filter(func(player): return player.monster == null)
if players_without_monster.size() == 0: if players_without_monster.size() == 0:
@ -197,9 +193,9 @@ func _execute_support_card_instant_effects(player: MatchPlayer, card: SupportCar
if card is ImplementedSupportCard: if card is ImplementedSupportCard:
match card.id: match card.id:
"potion": "potion":
player.monster.health_delta += card.magnitude player.monster.health_delta += 20
"energy_booster": "energy_booster":
player.energy += card.magnitude player.energy += 1
# events.append(Event) # events.append(Event)
return events return events