From 5185e97d654139b9c5d9c31aa4bc1ce7105be4c3 Mon Sep 17 00:00:00 2001 From: Relintai Date: Thu, 20 Feb 2020 12:21:31 +0100 Subject: [PATCH] Update to the latest ESS, to get the update to class and character level separation. --- HEADS | 2 +- game/autoload/Entities.gd | 21 ++++++++----- game/data/xp/xp_data.tres | 47 +++++++++++++++++----------- game/player/Mob.gd | 40 ++++++++++------------- game/scenes/CharacterSelectorMenu.gd | 2 +- game/scripts/auras/aura_script.gd | 4 +-- game/ui/unitframes/UnitframeBase.gd | 8 ++--- 7 files changed, 67 insertions(+), 57 deletions(-) diff --git a/HEADS b/HEADS index e9c4e6a1..d652d0d1 100644 --- a/HEADS +++ b/HEADS @@ -1 +1 @@ -{"engine": {"3.2": "eb22bcead7f643f9099ddab3307521520e1143db", "master": "8c73e813134001e575b6f59e3b0100471c007410"}, "world_generator": {"master": "a08917370cdef0884042bdb49fb80ece0b2e76ec"}, "entity_spell_system": {"master": "a2d4df0c89dc398756630a12f8ea5ac823cef680"}, "ui_extensions": {"master": "38acc650db260a831dc26ca96fe9d9a087230bdc"}, "voxelman": {"master": "509d45a66281c87e3136ea7252e062208fc64555"}, "texture_packer": {"master": "b17c174906f84de93d84aa60d010ffe603efaa28"}, "fastnoise": {"master": "41b7ea05a1f7aa2b8ecddaa1fd739e64d6970f7e"}, "mesh_data_resource": {"master": "4bda19b12be2c2a79a6121de6d22e48f3934e726"}, "procedural_animations": {"master": "00f6c128bd0e9799b7f7f86e118ed68277fbe27d"}, "fast_quadratic_mesh_simplifier": {"master": "898d3a212c41d14bc5cc0262c82ad30049ddd45b"}, "ess_data": {"master": "3bd637fdd3304b64a18287a49a6b7387acf2f5de"}, "prop_tool": {"master": "df438053ebc900966f8f842fc65f0264f1271d49"}} \ No newline at end of file +{"engine": {"3.2": "1bc1939c63e07c6a03dbb258d765e0f450559706", "master": "8c73e813134001e575b6f59e3b0100471c007410"}, "world_generator": {"master": "a08917370cdef0884042bdb49fb80ece0b2e76ec"}, "entity_spell_system": {"master": "581127cde57c5c019f58be787d300308f18e08d4"}, "ui_extensions": {"master": "38acc650db260a831dc26ca96fe9d9a087230bdc"}, "voxelman": {"master": "509d45a66281c87e3136ea7252e062208fc64555"}, "texture_packer": {"master": "b17c174906f84de93d84aa60d010ffe603efaa28"}, "fastnoise": {"master": "41b7ea05a1f7aa2b8ecddaa1fd739e64d6970f7e"}, "mesh_data_resource": {"master": "4bda19b12be2c2a79a6121de6d22e48f3934e726"}, "procedural_animations": {"master": "00f6c128bd0e9799b7f7f86e118ed68277fbe27d"}, "fast_quadratic_mesh_simplifier": {"master": "898d3a212c41d14bc5cc0262c82ad30049ddd45b"}, "ess_data": {"master": "3bd637fdd3304b64a18287a49a6b7387acf2f5de"}, "prop_tool": {"master": "df438053ebc900966f8f842fc65f0264f1271d49"}} \ No newline at end of file diff --git a/game/autoload/Entities.gd b/game/autoload/Entities.gd index e916328d..5931f13d 100644 --- a/game/autoload/Entities.gd +++ b/game/autoload/Entities.gd @@ -121,8 +121,10 @@ func spawn_player_for_menu(class_id : int, name : String, parent : Node) -> Enti createinfo.class_id = class_id createinfo.entity_data = cls createinfo.player_name = name - createinfo.level = level - createinfo.xp = class_profile.xp + createinfo.character_level = 1 + createinfo.class_level = level + createinfo.character_xp = 0 + createinfo.class_xp = class_profile.xp createinfo.entity_controller = EntityEnums.ENITIY_CONTROLLER_PLAYER createinfo.entity_player_type = EntityEnums.ENTITY_PLAYER_TYPE_DISPLAY createinfo.networked = false @@ -164,8 +166,10 @@ func spawn_networked_player(class_id : int, position : Vector3, name : String, createinfo.class_id = class_id createinfo.entity_data = cls createinfo.player_name = name - createinfo.level = level - createinfo.xp = class_profile.xp + createinfo.character_level = 1 + createinfo.class_level = level + createinfo.character_xp = 0 + createinfo.class_xp = class_profile.xp createinfo.entity_controller = EntityEnums.ENITIY_CONTROLLER_PLAYER createinfo.entity_player_type = EntityEnums.ENTITY_PLAYER_TYPE_NETWORKED createinfo.network_owner = sid @@ -192,8 +196,10 @@ func spawn_player(class_id : int, position : Vector3, name : String, node_name createinfo.class_id = class_id createinfo.entity_data = cls createinfo.player_name = name - createinfo.level = level - createinfo.xp = class_profile.xp + createinfo.character_level = 1 + createinfo.class_level = level + createinfo.character_xp = 0 + createinfo.class_xp = class_profile.xp createinfo.entity_controller = EntityEnums.ENITIY_CONTROLLER_PLAYER createinfo.entity_player_type = EntityEnums.ENTITY_PLAYER_TYPE_PLAYER createinfo.network_owner = network_owner @@ -215,7 +221,8 @@ func spawn_mob(class_id : int, level : int, position : Vector3) -> void: createinfo.class_id = class_id createinfo.entity_data = cls createinfo.player_name = "Mob" - createinfo.level = level + createinfo.character_level = level + createinfo.class_level = level createinfo.entity_controller = EntityEnums.ENITIY_CONTROLLER_AI createinfo.entity_player_type = EntityEnums.ENTITY_PLAYER_TYPE_AI createinfo.transform.origin = position diff --git a/game/data/xp/xp_data.tres b/game/data/xp/xp_data.tres index bb2b758f..115b61d3 100644 --- a/game/data/xp/xp_data.tres +++ b/game/data/xp/xp_data.tres @@ -1,22 +1,31 @@ [gd_resource type="XPData" format=2] [resource] -level_2 = 600 -level_3 = 1000 -level_4 = 1000 -level_5 = 1000 -level_6 = 1000 -level_7 = 1000 -level_8 = 1000 -level_9 = 1000 -level_10 = 1000 -level_11 = 1000 -level_12 = 1000 -level_13 = 1000 -level_14 = 1000 -level_15 = 1000 -level_16 = 1000 -level_17 = 1000 -level_18 = 1000 -level_19 = 1000 -level_20 = 1000 +character_level_1 = 22 +character_level_2 = 34 +character_level_3 = 43 +character_level_4 = 4345 +character_level_5 = 554 +character_level_6 = 545 +character_level_7 = 45 +character_level_8 = 45 +character_level_9 = 4 +character_level_10 = 45 +character_level_11 = 54 +character_level_12 = 56 +character_level_13 = 56 +character_level_14 = 56 +class_level_1 = 355 +class_level_2 = 5 +class_level_3 = 5 +class_level_4 = 5 +class_level_5 = 5555 +class_level_6 = 555 +class_level_7 = 555 +class_level_8 = 55 +class_level_9 = 55 +class_level_10 = 5 +class_level_11 = 5 +class_level_12 = 5 +class_level_13 = 5 +class_level_14 = 55 diff --git a/game/player/Mob.gd b/game/player/Mob.gd index 668225b0..4bb5f4cb 100644 --- a/game/player/Mob.gd +++ b/game/player/Mob.gd @@ -223,7 +223,7 @@ func _son_death(): dead = true - var ldiff : float = slevel - starget.slevel + 10.0 + var ldiff : float = scharacter_level - starget.scharacter_level + 10.0 if ldiff < 0: ldiff = 0 @@ -233,7 +233,7 @@ func _son_death(): ldiff /= 10.0 - starget.adds_xp(int(5.0 * slevel * ldiff)) + starget.adds_xp(int(5.0 * scharacter_level * ldiff)) starget = null @@ -273,38 +273,32 @@ func set_max_visible_distance(var value : float) -> void: # sentity_name = sentity_data.text_name func _son_xp_gained(value : int) -> void: - if not EntityDataManager.get_xp_data().can_level_up(gets_level()): + if not EntityDataManager.get_xp_data().can_character_level_up(gets_character_level()): return - var xpr : int = EntityDataManager.get_xp_data().get_xp(gets_level()); + var xpr : int = EntityDataManager.get_xp_data().get_character_xp(gets_character_level()); - if xpr <= sxp: + if xpr <= scharacter_xp: scharacter_levelup(1) - sxp = 0 + scharacter_xp = 0 -func _son_level_up(value: int) -> void: - if sentity_data == null: - return +func _son_class_level_up(value: int): + ._son_class_level_up(value) + refresh_spells(value) + +func _son_character_level_up(value: int) -> void: + ._son_character_level_up(value) + refresh_spells(value) +func refresh_spells(value: int): + if gets_free_spell_points() == 0 and gets_free_talent_points() == 0: + return + var ecd : EntityClassData = sentity_data.entity_class_data if ecd == null: return - sfree_spell_points += ecd.spell_points_per_level * value - sfree_talent_points += value - - for i in range(Stat.MAIN_STAT_ID_COUNT): - var st : int = sentity_data.entity_class_data.get_stat_data().get_level_stat_data().get_stat_diff(i, slevel - value, slevel) - - var statid : int = i + Stat.MAIN_STAT_ID_START - - var stat : Stat = get_stat_int(statid) - - var sm : StatModifier = stat.get_modifier(0) - sm.base_mod += st - - var arr : Array = Array() for i in range(ecd.get_num_spells()): diff --git a/game/scenes/CharacterSelectorMenu.gd b/game/scenes/CharacterSelectorMenu.gd index 6646b0dd..da4bbf03 100644 --- a/game/scenes/CharacterSelectorMenu.gd +++ b/game/scenes/CharacterSelectorMenu.gd @@ -90,7 +90,7 @@ func refresh(): centry.group = character_button_group centry.connect("pressed", self, "character_selection_changed") - centry.setup(file_name, display.sentity_name, "", display.slevel, display) + centry.setup(file_name, display.sentity_name, "", display.scharacter_level, display) if first_entry == null: first_entry = centry diff --git a/game/scripts/auras/aura_script.gd b/game/scripts/auras/aura_script.gd index 411e4607..164f0bd8 100644 --- a/game/scripts/auras/aura_script.gd +++ b/game/scripts/auras/aura_script.gd @@ -26,7 +26,7 @@ func _handle_aura_damage(aura_data : AuraData, damage_info : SpellDamageInfo) -> randomize() damage_info.damage = damage_min + (randi() % (damage_max - damage_min)) - damage_info.damage *= damage_info.dealer.gets_level() / float(EntityEnums.MAX_CHARACTER_LEVEL) + damage_info.damage *= damage_info.dealer.scharacter_level / float(EntityEnums.MAX_CHARACTER_LEVEL) damage_info.damage_source_type = aura_data.aura.damage_type if (is_instance_valid(damage_info.dealer)): @@ -36,7 +36,7 @@ func _handle_aura_heal(aura_data : AuraData, shi : SpellHealInfo) -> void: randomize() shi.heal = heal_min + (randi() % (heal_max - heal_min)) - shi.damage *= shi.dealer.gets_level() / float(EntityEnums.MAX_CHARACTER_LEVEL) + shi.damage *= shi.dealer.scharacter_level / float(EntityEnums.MAX_CHARACTER_LEVEL) shi.heal_source_type = aura_data.aura.aura_type shi.dealer.sdeal_heal_to(shi) diff --git a/game/ui/unitframes/UnitframeBase.gd b/game/ui/unitframes/UnitframeBase.gd index 65043c1b..1e5eae13 100644 --- a/game/ui/unitframes/UnitframeBase.gd +++ b/game/ui/unitframes/UnitframeBase.gd @@ -68,7 +68,7 @@ func set_player(p_player: Entity) -> void: health.connect("c_changed", self, "_on_player_health_changed") _name_text.text = _player.centity_name - _level_text.text = str(_player.clevel) + _level_text.text = str(_player.ccharacter_level) clevel_changed(_player, 0) con_xp_gained(_player, 0) @@ -93,13 +93,13 @@ func cname_changed(entity: Entity) -> void: _name_text.text = _player.centity_name func clevel_changed(entity: Entity, value : int) -> void: - _level_text.text = str(_player.clevel) + _level_text.text = str(_player.ccharacter_level) _xp_range.min_value = 0 - _xp_range.max_value = EntityDataManager.get_xp_data().get_xp(_player.clevel) + _xp_range.max_value = EntityDataManager.get_xp_data().get_character_xp(_player.ccharacter_level) func con_xp_gained(entity: Entity, val: int) -> void: - _xp_range.value = _player.cxp + _xp_range.value = _player.ccharacter_xp func centity_data_changed(data: EntityData) -> void: var health = _player.get_health()