From 485d2c31241dff0d67c9c6979c3160f95828c022 Mon Sep 17 00:00:00 2001 From: Relintai Date: Wed, 29 Jul 2020 14:38:53 +0200 Subject: [PATCH] Update the engine, and ESS to get the backend support for EntityResource mods. Reimplemented speed changing aura, and consequently fixed Nature's Swiftness. --- HEADS | 2 +- .../auras/17_natures_swiftness_rank_1.tres | 4 +- game/scripts/auras/SpeedModAura.gd | 26 ++++++ game/scripts/auras/aura_script.gd | 82 +++++++++++-------- 4 files changed, 76 insertions(+), 38 deletions(-) create mode 100644 game/scripts/auras/SpeedModAura.gd diff --git a/HEADS b/HEADS index c87ecd7a..3e090fa7 100644 --- a/HEADS +++ b/HEADS @@ -1 +1 @@ -{"engine": {"3.2": "fe4aa393f093cd4e37409e2d1b0b68e8e05abd35", "master": "8c73e813134001e575b6f59e3b0100471c007410"}, "world_generator": {"master": "bc2ee7171a29d02a4687eaddd91374e127cf2b88"}, "entity_spell_system": {"master": "7b6097d95c5cc13bc9b511a9470c5858759aa2dd"}, "ui_extensions": {"master": "6db99122c27e87840f2da2cfa8934b0d0510004e"}, "voxelman": {"master": "768728139ede479dad006913e2f86d3f85edae57"}, "texture_packer": {"master": "f98b7410cd3f2a743cb57456910ad9f93ef89937"}, "fastnoise": {"master": "d0e3f1c759332cf0d9a5d7e0e71d0b0278310651"}, "mesh_data_resource": {"master": "a9bab9896de71966b9c9056869871e618c64cba7"}, "procedural_animations": {"master": "8426e2c976e9f9cb82bca636c0ec6e79ad7b3bcb"}, "ess_data": {"master": "3bd637fdd3304b64a18287a49a6b7387acf2f5de"}, "props": {"master": "0ed644e4a4e7867a49fbe7c727b500305f7077f8"}, "mesh_utils": {"master": "65a802ff39a601bd1a55675023871e09500943ef"}, "broken_seals_module": {"master": "8c4b32d3932ccb043b8f6c92c1277547750fe391"}, "thread_pool": {"master": "164ad82feb05842cb944c2907b65e521f8c7c465"}} \ No newline at end of file +{"engine": {"3.2": "36b746d90393299b81ecb991f4aa94a8d742fd11", "master": "8c73e813134001e575b6f59e3b0100471c007410"}, "world_generator": {"master": "bc2ee7171a29d02a4687eaddd91374e127cf2b88"}, "entity_spell_system": {"master": "e45d109d7f366a22a8e39c90ab9898741ca38182"}, "ui_extensions": {"master": "6db99122c27e87840f2da2cfa8934b0d0510004e"}, "voxelman": {"master": "768728139ede479dad006913e2f86d3f85edae57"}, "texture_packer": {"master": "f98b7410cd3f2a743cb57456910ad9f93ef89937"}, "fastnoise": {"master": "d0e3f1c759332cf0d9a5d7e0e71d0b0278310651"}, "mesh_data_resource": {"master": "a9bab9896de71966b9c9056869871e618c64cba7"}, "procedural_animations": {"master": "8426e2c976e9f9cb82bca636c0ec6e79ad7b3bcb"}, "ess_data": {"master": "3bd637fdd3304b64a18287a49a6b7387acf2f5de"}, "props": {"master": "0ed644e4a4e7867a49fbe7c727b500305f7077f8"}, "mesh_utils": {"master": "65a802ff39a601bd1a55675023871e09500943ef"}, "broken_seals_module": {"master": "8c4b32d3932ccb043b8f6c92c1277547750fe391"}, "thread_pool": {"master": "164ad82feb05842cb944c2907b65e521f8c7c465"}} \ No newline at end of file diff --git a/game/modules/entity_classes/naturalist/auras/17_natures_swiftness_rank_1.tres b/game/modules/entity_classes/naturalist/auras/17_natures_swiftness_rank_1.tres index b5e0cd0a..f7273282 100644 --- a/game/modules/entity_classes/naturalist/auras/17_natures_swiftness_rank_1.tres +++ b/game/modules/entity_classes/naturalist/auras/17_natures_swiftness_rank_1.tres @@ -1,6 +1,6 @@ [gd_resource type="Aura" load_steps=4 format=2] -[ext_resource path="res://scripts/auras/aura_script.gd" type="Script" id=1] +[ext_resource path="res://scripts/auras/SpeedModAura.gd" type="Script" id=1] [ext_resource path="res://modules/entity_classes/naturalist/effect_data/natures_swiftness.tres" type="SpellEffectVisual" id=2] [ext_resource path="res://modules/entity_classes/naturalist/icons/natures_swiftness.tres" type="Texture" id=3] @@ -14,3 +14,5 @@ text_name = "Nature's Swiftness" text_description = "Increases your movement speed by 60% for 6 sec. This spell is not on the global cooldown." visual_spell_effects = ExtResource( 2 ) script = ExtResource( 1 ) +does_stack = true +mod_speed = 40.0 diff --git a/game/scripts/auras/SpeedModAura.gd b/game/scripts/auras/SpeedModAura.gd new file mode 100644 index 00000000..c233d9d2 --- /dev/null +++ b/game/scripts/auras/SpeedModAura.gd @@ -0,0 +1,26 @@ +extends "aura_script.gd" + +export(bool) var does_stack : bool = true +export(float) var mod_speed : float = 0 + +func apply_mods(ad : AuraData): + #slows never stack + if mod_speed < 0: + ad.owner.gets_speed().add_non_stacking_mod(mod_speed) + return + + if does_stack: + ad.owner.gets_speed().add_stacking_mod(mod_speed) + else: + ad.owner.gets_speed().add_non_stacking_mod(mod_speed) + +func deapply_mods(ad : AuraData): + #slows never stack + if mod_speed < 0: + ad.owner.gets_speed().remove_non_stacking_mod(mod_speed) + return + + if does_stack: + ad.owner.gets_speed().remove_stacking_mod(mod_speed) + else: + ad.owner.gets_speed().remove_non_stacking_mod(mod_speed) diff --git a/game/scripts/auras/aura_script.gd b/game/scripts/auras/aura_script.gd index bb30f994..f575249b 100644 --- a/game/scripts/auras/aura_script.gd +++ b/game/scripts/auras/aura_script.gd @@ -21,43 +21,53 @@ class_name AuraGD # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -#func _sapply(info : AuraApplyInfo) -> void: -## var add : bool = false -# var ad : AuraData = info.target.aura_gets_by(info.caster, info.aura.id) -# -# if ad == null: -## add = true -# ad = AuraData.new() -# -# setup_aura_data(ad, info); -# -# for i in range(stat_attribute_get_count()): -# info.target.stat_mod(id, stat_attribute_get_base_mod(i), stat_attribute_get_bonus_mod(i), stat_attribute_get_percent_mod(i)) -# -# if states_add != 0: -# for i in range(EntityEnums.ENTITY_STATE_TYPE_INDEX_MAX): -# var t : int = 1 << i -# -# if states_add & t != 0: -# info.target.adds_state_ref(i) -# -# -# info.target.aura_adds(ad); -# else: -# ad.remaining_time = time -# -# -#func _sdeapply(data : AuraData) -> void: -# for i in range(stat_attribute_get_count()): -# data.owner.stat_mod(id, stat_attribute_get_base_mod(i), stat_attribute_get_bonus_mod(i), stat_attribute_get_percent_mod(i)) -# -# if states_add != 0: -# for i in range(EntityEnums.ENTITY_STATE_TYPE_INDEX_MAX): -# var t : int = 1 << i -# -# if states_add & t != 0: -# data.owner.removes_state_ref(i) +func _sapply(info : AuraApplyInfo) -> void: +# var add : bool = false + var ad : AuraData = info.target.aura_gets_by(info.caster, info.aura.id) + if ad == null: +# add = true + ad = AuraData.new() + + setup_aura_data(ad, info); + + for i in range(stat_attribute_get_count()): + info.target.stat_mod(stat_attribute_get_stat(id), stat_attribute_get_base_mod(i), stat_attribute_get_bonus_mod(i), stat_attribute_get_percent_mod(i)) + + if states_add != 0: + for i in range(EntityEnums.ENTITY_STATE_TYPE_INDEX_MAX): + var t : int = 1 << i + + if states_add & t != 0: + info.target.adds_state_ref(i) + + + info.target.aura_adds(ad); + + apply_mods(ad) + else: + ad.remaining_time = time + + +func _sdeapply(data : AuraData) -> void: + for i in range(stat_attribute_get_count()): + data.owner.stat_mod(stat_attribute_get_stat(id), -stat_attribute_get_base_mod(i), -stat_attribute_get_bonus_mod(i), -stat_attribute_get_percent_mod(i)) + + if states_add != 0: + for i in range(EntityEnums.ENTITY_STATE_TYPE_INDEX_MAX): + var t : int = 1 << i + + if states_add & t != 0: + data.owner.removes_state_ref(i) + + deapply_mods(data) + +func apply_mods(ad : AuraData): + pass + +func deapply_mods(ad : AuraData): + pass + func _con_aura_added(data : AuraData) -> void: if data.owner.get_character_skeleton() == null or data.owner.get_character_skeleton().root_attach_point == null: return