Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Randomized map generator #30

Merged
Show file tree
Hide file tree
Changes from 50 commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
e3656d9
Added a base template for effects and relevant functions in CardBase
Turtyo Dec 18, 2023
f02be75
Reformated to use a list of targets and moved some functions to other…
Turtyo Dec 18, 2023
4310bd8
Update Battler to have correct function signature
Turtyo Dec 18, 2023
933ed1d
Simplified _damage_entity since the new logic of effects is applied t…
Turtyo Dec 18, 2023
2669640
Simplified can_play_card
Turtyo Dec 18, 2023
0e311fe
Moved the draw to an effect, changed value from float to int
Turtyo Dec 18, 2023
2f6f856
Moved the discard random to an effect
Turtyo Dec 18, 2023
5b39fce
Made the EffectPoison to have a reference for other Status effects
Turtyo Dec 18, 2023
3512e4d
Moved the deal damage to an effect
Turtyo Dec 18, 2023
1256839
Changed effects from Node to Resource
Turtyo Dec 19, 2023
e1963a9
Modified Battler and Enemy to work with the new effect structure
Turtyo Dec 21, 2023
c028d34
Changed EffectData to prevent an init bug | Added basic targeting fun…
Turtyo Dec 21, 2023
6ac8308
Modified EffectDamage
Turtyo Dec 21, 2023
4e58369
Modified damage and draw resources cards to work with new effect system
Turtyo Dec 21, 2023
584d43e
Modified poison to work with new system
Turtyo Dec 21, 2023
221a971
Added a card with multiple effects to test the current structure
Turtyo Dec 21, 2023
c6a1bba
Tried an effect that was a bit more complex
Turtyo Dec 21, 2023
dfe1838
Include `map-implementation` in the CI
Saplings-Projects Dec 21, 2023
d00f2ba
Changed parameter name from entity to target for more clarity
Turtyo Dec 21, 2023
7caeeff
Removed unused commented line in tests
Turtyo Dec 21, 2023
4547f89
Updated README
Turtyo Dec 22, 2023
49815ae
Updated CONTRIBUTING.md
Turtyo Dec 22, 2023
c384093
Issue 20: Events Structure (#29)
Tysterman74 Dec 22, 2023
add90a0
Added a section for commits in CONTRIBUTING.md
Turtyo Dec 22, 2023
5c8085f
Added DOCUMENTATION.md, added sections and wrote the effect part
Turtyo Dec 22, 2023
85cf9f7
Wrote Status section of DOCUMENTATION
Turtyo Dec 22, 2023
214097e
Reworded parts of CONTRIBUTING.md for more clarity
Turtyo Dec 22, 2023
dc4f0e7
Wrote Rooms, Events and light level section in DOCUMENTATION
Turtyo Dec 22, 2023
c963c72
Wrote the Unique events section of DOCUMENTATION
Turtyo Dec 22, 2023
621f51b
Added a guideline for pull request in CONTRIBUTING.md
Turtyo Dec 22, 2023
e88aeaf
very basic classes for room, floor, and map, and a new scene for map …
xone-mi Dec 10, 2023
ea9bc6d
room generator
xone-mi Dec 19, 2023
a3105d4
Last second change
xone-mi Dec 19, 2023
90a4617
Pull request feedback changes
xone-mi Dec 21, 2023
bda52c2
More feedback changes + event classes
xone-mi Dec 23, 2023
08666e9
Added images to the map section of DOCUMENTATION
Turtyo Dec 23, 2023
2e35e02
Merge pull request #27 from Turtyo/14-card_structure
Turtyo Dec 23, 2023
2c9210e
Updated the light mechanic explanation image for the documentation
Turtyo Dec 24, 2023
f7cfb3f
Explaining how players view events on the map
Turtyo Dec 24, 2023
c9a3e94
Added a paragraph to explain light levels and the influence of light …
Turtyo Dec 24, 2023
54fc973
Feedback changes
xone-mi Dec 24, 2023
c11cdfa
Feedback changes: review edition
xone-mi Dec 25, 2023
3e2535a
Merge pull request #33 from Turtyo/documentation
Miniik Dec 27, 2023
f0803c5
Deck animation and layout (#25)
cheesefrycook Dec 27, 2023
0ced3df
Merge branch 'main' into map-implementation-generator
xone-mi Dec 28, 2023
f0d825b
Changed map generation to be more accurate to references
xone-mi Dec 28, 2023
062e93b
Static typing fixes
xone-mi Dec 28, 2023
14ce1f6
Feedback changes
xone-mi Jan 2, 2024
80740f6
Test changes
xone-mi Jan 2, 2024
af51f12
Fixed tests
xone-mi Jan 2, 2024
e40671e
Fixing error in merge where old code in CardBase was readded (#37)
JonaLam Jan 5, 2024
96270d8
Feedback changes
xone-mi Jan 6, 2024
836dd3a
CardPileUicl (#40)
Paper-2 Jan 9, 2024
7754000
Merge branch 'main' into map-implementation-generator
xone-mi Jan 13, 2024
36ad7ec
Feedback changes
xone-mi Jan 13, 2024
b72af11
Test optimizations
xone-mi Jan 17, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 28 additions & 3 deletions #Scenes/TestingScene.tscn
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
[gd_scene load_steps=9 format=3 uid="uid://87fedoq257xg"]
[gd_scene load_steps=17 format=3 uid="uid://b60uabg68ra1l"]

[ext_resource type="PackedScene" uid="uid://clmg3l3n28x38" path="res://Entity/Player/Player.tscn" id="3_4psp7"]
[ext_resource type="PackedScene" uid="uid://dpjfy4pv0vxst" path="res://Cards/CardContainer.tscn" id="3_e7sws"]
[ext_resource type="Resource" uid="uid://dxgoopi1roxu4" path="res://Cards/Resource/Card_Damage.tres" id="4_wvn3v"]
[ext_resource type="Resource" uid="uid://0x385c3nuq8f" path="res://Cards/Resource/Card_DamageAll.tres" id="5_j1lqt"]
[ext_resource type="Resource" uid="uid://5yn4t13kwwoo" path="res://Cards/Resource/Card_DamageHealth.tres" id="6_4124l"]
[ext_resource type="Resource" uid="uid://d4lugn62mmlep" path="res://Cards/Resource/Card_DrawCards.tres" id="7_smkw8"]
[ext_resource type="PackedScene" uid="uid://bcpmrmofcilbn" path="res://Core/Battler.tscn" id="8_qtw1k"]
[ext_resource type="Script" path="res://UI/DrawPileUISetter.gd" id="8_voref"]
[ext_resource type="Resource" uid="uid://ctx8jsvac84so" path="res://Cards/Resource/Card_Poison.tres" id="8_x6t2k"]
[ext_resource type="Resource" uid="uid://d12g33rc6c3u5" path="res://Cards/Resource/Card_Heal.tres" id="9_ojxic"]
[ext_resource type="Script" path="res://UI/DiscardPileUISetter.gd" id="10_pqly7"]
[ext_resource type="Resource" uid="uid://3s4aet1ciesh" path="res://Cards/Resource/Card_damage_and_poison.tres" id="10_w0xgm"]
[ext_resource type="Resource" uid="uid://bsrdu33ukb1ym" path="res://Cards/Resource/Card_EnemyAttack.tres" id="11_3k5t2"]
[ext_resource type="Texture2D" uid="uid://caemucaya30wh" path="res://Cards/draw_pile.png" id="11_pw70x"]
[ext_resource type="Texture2D" uid="uid://d4muqvs3etnr8" path="res://Cards/discard_pile.png" id="12_kxw48"]
[ext_resource type="Script" path="res://UI/EndTurnButton.gd" id="14_dpe64"]
Expand All @@ -16,8 +24,6 @@
[node name="Player" parent="." instance=ExtResource("3_4psp7")]
position = Vector2(595, 284)

[node name="CardContainer" parent="." instance=ExtResource("3_e7sws")]

[node name="CanvasLayer" type="CanvasLayer" parent="."]

[node name="UIControl" type="Control" parent="CanvasLayer"]
Expand All @@ -29,6 +35,25 @@ grow_horizontal = 2
grow_vertical = 2
mouse_filter = 2

[node name="CardContainer" parent="CanvasLayer/UIControl" node_paths=PackedStringArray("draw_pile_ui", "discard_pile_ui") instance=ExtResource("3_e7sws")]
layout_mode = 1
anchors_preset = 7
anchor_left = 0.5
anchor_top = 1.0
anchor_right = 0.5
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 0
default_deck = Array[Resource("res://Cards/CardBase.gd")]([ExtResource("4_wvn3v"), ExtResource("5_j1lqt"), ExtResource("6_4124l"), ExtResource("7_smkw8"), ExtResource("9_ojxic"), ExtResource("8_x6t2k"), ExtResource("10_w0xgm"), ExtResource("11_3k5t2")])
starting_hand_size = 10
max_hand_width = 900.0
min_card_separation = 90.0
max_card_separation = 120.0
hover_offset_max = 100.0
max_rotation = 40.0
draw_pile_ui = NodePath("../DrawPile")
discard_pile_ui = NodePath("../DiscardPile")

[node name="EndTurnButton" type="Button" parent="CanvasLayer/UIControl"]
layout_mode = 1
anchors_preset = 3
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,13 @@ name: CI
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [ main ]
branches:
- main
- map-implementation
pull_request:
branches: [ main ]
branches:
- main
- map-implementation

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
Expand Down
23 changes: 19 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,36 @@ If you want to help with code, first check that there is no issue already opened

For bigger tasks that might need multiple people working on it, a branch for that specific task will be opened. Pull request will be made to this branch and not the main.

## Commits

Make commits in the following way:
- Write a clear title. If for example you decide to change a function you wrote previously, don't just write "changed function X", but explain what you changed in the function. If it's too long in a single title, it might mean you can break your commit in multiple commits. If not you can use the commit description.
- Commits should be of the minimal size possible. If you change multiple files in a single commit and the changes made don't influence each other, please break down your commit in multiple commits.

## Pull requests

Please use the pull request template located at .github/pull_request_template.md . Please link to the issue that the pull request is related to. Here is a (non exhaustive) list of reasons for which your pull request can be closed :
Please use the pull request template located at .github/pull_request_template.md . Please link to the issue that the pull request is related to. **One Pull Request = One Issue.**

Here is a (non exhaustive) list of reasons for which your pull request can be closed :
- you didn't use the pull request template.
- you didn't open an issue related to the code you wrote.
- you didn't open an issue related to the code you wrote or the code you wrote is not compliant with the issue.
- you didn't synchronise your fork after another pull request has been merged and that creates a lot of merge issues. Please deal with those problems locally before opening a pull request.
- you made few very big commits. Please break down your big commits in smaller and more manageable commits if possible.

If you are the last one to approve a pull request, there are no unresolved conversations and the tests are passing, you can merge the pull request yourself.

## Tests

If you are writing code that implements something new, please provide test files written in GDScript (that can be run on GUT), as they will be useful to test future PR.
If you are writing code that implements something new, please provide test files written in GDScript (that can be run on GUT), as they will be useful to test future PR. If you do not know what to write tests on, don't hesitate to ask.

## Code formatting

As of the writing of this CONTRIBUTING.md there is no code formatter for Godot, even though it might come later. Try to follow the code conventions of the [GDScript style guide](https://docs.godotengine.org/en/stable/tutorials/scripting/gdscript/gdscript_styleguide.html)

- Use static typing whenever possible.
- Use static typing whenever possible (for functions parameters, variables and return types).
- Add # @Override for children classes that implement a function declared in a parent class.
- Write class name LikeThis and not like_this.
- Write function name like_this and not LikeThis.
- Write the parent class name as SomethingBase (for example, the base of the cards is `CardBase`)
- If you have C child of B and B child of A, B should not follow the previous convention, only A should. This rule may have exceptions.
- Writing multiple smaller lines is better than writing one big line.
15 changes: 8 additions & 7 deletions Cards/Card.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,26 @@
[ext_resource type="Script" path="res://Cards/CardWorld.gd" id="1_4el5m"]
[ext_resource type="Texture2D" uid="uid://nheutko3fha3" path="res://Cards/card.png" id="2_k6rq5"]
[ext_resource type="Script" path="res://Input/ClickHandler.gd" id="3_du4nn"]
[ext_resource type="Script" path="res://Helpers/LerpComponent.gd" id="4_ujyje"]
[ext_resource type="Script" path="res://UI/CardUISetter.gd" id="5_hkyxd"]
[ext_resource type="Texture2D" uid="uid://bdc5r0w6lyh34" path="res://Cards/card_image.png" id="6_p357x"]
[ext_resource type="Script" path="res://Cards/CardMovementComponent.gd" id="6_qvt2l"]

[sub_resource type="LabelSettings" id="LabelSettings_ooxvf"]
font_color = Color(0, 0, 0, 1)

[node name="Card" type="Node2D"]
[node name="Card" type="Control"]
layout_mode = 3
anchors_preset = 0
script = ExtResource("1_4el5m")

[node name="ClickHandler" type="Node2D" parent="."]
[node name="ClickHandler" type="Node" parent="."]
script = ExtResource("3_du4nn")

[node name="LerpComponent" type="Node2D" parent="."]
script = ExtResource("4_ujyje")
lerp_speed = 7.0
[node name="CardMovementComponent" type="Node" parent="."]
script = ExtResource("6_qvt2l")

[node name="CardUI" type="Control" parent="." node_paths=PackedStringArray("title_label", "description_label", "key_art")]
layout_mode = 3
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
Expand Down
24 changes: 20 additions & 4 deletions Cards/CardBase.gd
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ class_name CardBase
## wish to take damage in some contexts.
## For example, consider the card: "Deal 10 damage to all enemies, but take 3 damage"


@export var damage_to_apply_to_target: float = 0.0
@export var damage_to_apply_to_caster: float = 0.0
@export var status_to_apply_to_target: Array[StatusBase]
Expand All @@ -27,18 +26,35 @@ class_name CardBase
@export var card_key_art: ImageTexture = null
@export var card_description: String = "NULL"

@export var card_effects_data: Array[EffectData] = []

func _ready() -> void:
card_effects_data = []

# Need a parser of some sort to read a plainform card data and translate it to EffectData
# This will call EffectData.add_effect_data() in a loop for every new effect

@warning_ignore("unused_parameter")
func parse_card_data(card_data: Dictionary) -> void:
# TODO
pass

func _apply_all_effects(target: Entity) -> void:
for effect_data: EffectData in card_effects_data:
effect_data.apply_effect_data(target)


func can_play_card(caster: Entity, target: Entity) -> bool:
if caster.get_party_component().can_play_on_entity(application_type, target):
return true
return false
return caster.get_party_component().can_play_on_entity(application_type, target)


func on_card_play(caster: Entity, target: Entity) -> void:
_apply_all_effects(target)
_deal_damage(caster, target)
_apply_status(caster, target)
_draw_cards()
_discard_random_cards()
CardManager.on_card_action_finished.emit(self)
# TODO add other functionality that lots of cards may share (eg: restore AP)


Expand Down
Loading
Loading