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 1 commit
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
16 changes: 0 additions & 16 deletions #Scenes/TestingScene.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -22,29 +22,13 @@

[sub_resource type="Resource" id="Resource_82ci8"]
script = ExtResource("10_qowiy")
damage_to_apply_to_target = 0.0
damage_to_apply_to_caster = 0.0
status_to_apply_to_target = Array[Resource("res://Status/StatusBase.gd")]([])
status_to_apply_to_caster = Array[Resource("res://Status/StatusBase.gd")]([])
affect_all_targets = false
affect_all_casters = false
amount_of_cards_to_draw = 0
amount_of_cards_to_discard = 0
application_type = 1
card_title = "NULL"
card_description = "NULL"
card_effects_data = Array[Resource("res://Cards/Effects/EffectData.gd")]([])

[sub_resource type="Resource" id="Resource_bjuo7"]
script = ExtResource("10_qowiy")
damage_to_apply_to_target = 0.0
damage_to_apply_to_caster = 0.0
status_to_apply_to_target = Array[Resource("res://Status/StatusBase.gd")]([])
status_to_apply_to_caster = Array[Resource("res://Status/StatusBase.gd")]([])
affect_all_targets = false
affect_all_casters = false
amount_of_cards_to_draw = 0
amount_of_cards_to_discard = 0
application_type = 1
card_title = "NULL"
card_description = "NULL"
Expand Down
15 changes: 7 additions & 8 deletions Map/MapManager.gd
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
extends Node2D
## Class to manage backend for rooms (generation and such)

#layout changes the width of the map's floors
static func create_map(floors_width: Array[int]) -> MapBase: ## Generates and Populates a map with rooms that have random room types. More in depth algorithms will be added in the future
#map_floors_width changes the width of the map's floors
static func create_map(map_floors_width: Array[int]) -> MapBase: ## Generates and Populates a map with rooms that have random room types. More in depth algorithms will be added in the future
var _map: MapBase = MapBase.new()
var _grid: Array[Array] = [] ## 2d array to return. this will be populated with rooms
var _max_floor_size: int = floors_width.max()
for index_height: int in range(floors_width.size()): ## loop through the floor and append null to create a square grid
var _max_floor_size: int = map_floors_width.max()
for index_height: int in range(map_floors_width.size()): ## loop through the floor and append null to create a square grid


var _floor_width : int = floors_width[index_height]
var _floor_width : int = map_floors_width[index_height]
var _padding_size : int = (_max_floor_size - _floor_width)/2

var _padding:Array = []
Expand All @@ -18,12 +17,12 @@ static func create_map(floors_width: Array[int]) -> MapBase: ## Generates and Po
_grid.append([])
_grid[index_height].append_array(_padding)

for index_width: int in range(floors_width[index_height]):## loop through elements of the grid and assign a room type
for index_width: int in range(map_floors_width[index_height]):## loop through elements of the grid and assign a room type
var _rand_type_index: int = randi_range(0, GlobalVar.EVENTS_CLASSIFICATION.size() - 1)
var _room_event: EventBase = GlobalVar.EVENTS_CLASSIFICATION[_rand_type_index].new()
var _generated_room: RoomBase = RoomBase.new()
_generated_room.room_event = _room_event
_grid[index_height].insert(index_width+_padding_size,_generated_room as RoomBase)
_grid[index_height].append(_generated_room as RoomBase)
_grid[index_height].append_array(_padding)
_map.rooms = _grid
return _map as MapBase
3 changes: 3 additions & 0 deletions Map/RoomBase.gd
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ class_name RoomBase
@export var light_level: int = 0
@export var has_torch: bool = false
@export var room_event: EventBase

func _to_string() -> String:
return "RoomBase"
8 changes: 5 additions & 3 deletions Tests/test_map.gd
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ func test_map_gen():
var expected_null_array: Array[Array] = [[0,0], [0,1], [0,3],[0,4],[1,0],[1,4],[3,0],[3,4],[4,0],[4,1],[4,3],[4,4]]
var expected_exists_array: Array[Array] = [[0,2],[1,1],[1,2],[1,3],[2,0],[2,1],[2,2],[2,3],[2,4],[3,1],[3,2],[3,3],[4,2]]
for couple: Array[int] in expected_null_array:
assert_null(test_map.rooms[couple[0]][couple[1]], "expected null at"+str(couple))

var _room = test_map.rooms[couple[0]][couple[1]]
assert_null(test_map.rooms[couple[0]][couple[1]], "Expected null at %s but got %s" % [couple, _room])
Turtyo marked this conversation as resolved.
Show resolved Hide resolved

for couple: Array[int] in expected_exists_array:
assert_not_null(test_map.rooms[couple[0]][couple[1]], "expected not null at"+str(couple))
var _room = test_map.rooms[couple[0]][couple[1]]
assert_not_null(test_map.rooms[couple[0]][couple[1]], "Expected not null at %s but got %s" % [couple, _room])
Turtyo marked this conversation as resolved.
Show resolved Hide resolved
Loading