diff --git a/DungeonShooting_Godot/excel/excelFile/ActivityObject.xlsx b/DungeonShooting_Godot/excel/excelFile/ActivityObject.xlsx index 5fcd5ae..f016fc3 100644 --- a/DungeonShooting_Godot/excel/excelFile/ActivityObject.xlsx +++ b/DungeonShooting_Godot/excel/excelFile/ActivityObject.xlsx Binary files differ diff --git a/DungeonShooting_Godot/excel/excelFile/Sound.xlsx b/DungeonShooting_Godot/excel/excelFile/Sound.xlsx index 4ebfabe..46ebb13 100644 --- a/DungeonShooting_Godot/excel/excelFile/Sound.xlsx +++ b/DungeonShooting_Godot/excel/excelFile/Sound.xlsx Binary files differ diff --git a/DungeonShooting_Godot/excel/excelFile/Weapon.xlsx b/DungeonShooting_Godot/excel/excelFile/Weapon.xlsx index 0b0b3cf..6d09cbe 100644 --- a/DungeonShooting_Godot/excel/excelFile/Weapon.xlsx +++ b/DungeonShooting_Godot/excel/excelFile/Weapon.xlsx Binary files differ diff --git a/DungeonShooting_Godot/prefab/prop/buff/Buff0008.tscn b/DungeonShooting_Godot/prefab/prop/buff/Buff0008.tscn new file mode 100644 index 0000000..f27da49 --- /dev/null +++ b/DungeonShooting_Godot/prefab/prop/buff/Buff0008.tscn @@ -0,0 +1,40 @@ +[gd_scene load_steps=7 format=3 uid="uid://3cwfaycb436j"] + +[ext_resource type="Script" path="res://src/game/activity/prop/buff/Buff0008.cs" id="1_apsyo"] +[ext_resource type="Shader" path="res://resource/material/Blend.gdshader" id="2_g22ai"] +[ext_resource type="SpriteFrames" uid="uid://bs41p1hpkpucb" path="res://resource/spriteFrames/prop/buff/Buff0008.tres" id="3_bko6m"] + +[sub_resource type="ShaderMaterial" id="ShaderMaterial_mrkt4"] +resource_local_to_scene = true +shader = ExtResource("2_g22ai") +shader_parameter/blend = Color(0, 0, 0, 0.470588) +shader_parameter/schedule = 1.0 +shader_parameter/alpha = 1.0 + +[sub_resource type="ShaderMaterial" id="ShaderMaterial_b6ii6"] +resource_local_to_scene = true +shader = ExtResource("2_g22ai") +shader_parameter/blend = Color(1, 1, 1, 1) +shader_parameter/schedule = 0.0 +shader_parameter/alpha = 1.0 + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_cpqup"] +size = Vector2(12, 10) + +[node name="Buff0008" type="CharacterBody2D" node_paths=PackedStringArray("ShadowSprite", "AnimatedSprite", "Collision")] +collision_layer = 4 +script = ExtResource("1_apsyo") +ShadowSprite = NodePath("ShadowSprite") +AnimatedSprite = NodePath("AnimatedSprite") +Collision = NodePath("Collision") + +[node name="ShadowSprite" type="Sprite2D" parent="."] +z_index = -1 +material = SubResource("ShaderMaterial_mrkt4") + +[node name="AnimatedSprite" type="AnimatedSprite2D" parent="."] +material = SubResource("ShaderMaterial_b6ii6") +sprite_frames = ExtResource("3_bko6m") + +[node name="Collision" type="CollisionShape2D" parent="."] +shape = SubResource("RectangleShape2D_cpqup") diff --git a/DungeonShooting_Godot/prefab/prop/buff/Buff0009.tscn b/DungeonShooting_Godot/prefab/prop/buff/Buff0009.tscn new file mode 100644 index 0000000..1696e25 --- /dev/null +++ b/DungeonShooting_Godot/prefab/prop/buff/Buff0009.tscn @@ -0,0 +1,40 @@ +[gd_scene load_steps=7 format=3 uid="uid://cuqwvioe545bl"] + +[ext_resource type="Script" path="res://src/game/activity/prop/buff/Buff0009.cs" id="1_fu5ca"] +[ext_resource type="Shader" path="res://resource/material/Blend.gdshader" id="2_680mi"] +[ext_resource type="SpriteFrames" uid="uid://sqcibio78nwc" path="res://resource/spriteFrames/prop/buff/Buff0009.tres" id="3_mtbwe"] + +[sub_resource type="ShaderMaterial" id="ShaderMaterial_mrkt4"] +resource_local_to_scene = true +shader = ExtResource("2_680mi") +shader_parameter/blend = Color(0, 0, 0, 0.470588) +shader_parameter/schedule = 1.0 +shader_parameter/alpha = 1.0 + +[sub_resource type="ShaderMaterial" id="ShaderMaterial_b6ii6"] +resource_local_to_scene = true +shader = ExtResource("2_680mi") +shader_parameter/blend = Color(1, 1, 1, 1) +shader_parameter/schedule = 0.0 +shader_parameter/alpha = 1.0 + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_cpqup"] +size = Vector2(12, 10) + +[node name="Buff0009" type="CharacterBody2D" node_paths=PackedStringArray("ShadowSprite", "AnimatedSprite", "Collision")] +collision_layer = 4 +script = ExtResource("1_fu5ca") +ShadowSprite = NodePath("ShadowSprite") +AnimatedSprite = NodePath("AnimatedSprite") +Collision = NodePath("Collision") + +[node name="ShadowSprite" type="Sprite2D" parent="."] +z_index = -1 +material = SubResource("ShaderMaterial_mrkt4") + +[node name="AnimatedSprite" type="AnimatedSprite2D" parent="."] +material = SubResource("ShaderMaterial_b6ii6") +sprite_frames = ExtResource("3_mtbwe") + +[node name="Collision" type="CollisionShape2D" parent="."] +shape = SubResource("RectangleShape2D_cpqup") diff --git a/DungeonShooting_Godot/prefab/prop/buff/Buff0010.tscn b/DungeonShooting_Godot/prefab/prop/buff/Buff0010.tscn new file mode 100644 index 0000000..d0f45d5 --- /dev/null +++ b/DungeonShooting_Godot/prefab/prop/buff/Buff0010.tscn @@ -0,0 +1,40 @@ +[gd_scene load_steps=7 format=3 uid="uid://ddv5nfndgp2lr"] + +[ext_resource type="Script" path="res://src/game/activity/prop/buff/Buff0010.cs" id="1_fti4v"] +[ext_resource type="Shader" path="res://resource/material/Blend.gdshader" id="2_bmg36"] +[ext_resource type="SpriteFrames" uid="uid://dxqtm7xgn2wms" path="res://resource/spriteFrames/prop/buff/Buff0010.tres" id="3_oi74m"] + +[sub_resource type="ShaderMaterial" id="ShaderMaterial_mrkt4"] +resource_local_to_scene = true +shader = ExtResource("2_bmg36") +shader_parameter/blend = Color(0, 0, 0, 0.470588) +shader_parameter/schedule = 1.0 +shader_parameter/alpha = 1.0 + +[sub_resource type="ShaderMaterial" id="ShaderMaterial_b6ii6"] +resource_local_to_scene = true +shader = ExtResource("2_bmg36") +shader_parameter/blend = Color(1, 1, 1, 1) +shader_parameter/schedule = 0.0 +shader_parameter/alpha = 1.0 + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_cpqup"] +size = Vector2(12, 10) + +[node name="Buff0010" type="CharacterBody2D" node_paths=PackedStringArray("ShadowSprite", "AnimatedSprite", "Collision")] +collision_layer = 4 +script = ExtResource("1_fti4v") +ShadowSprite = NodePath("ShadowSprite") +AnimatedSprite = NodePath("AnimatedSprite") +Collision = NodePath("Collision") + +[node name="ShadowSprite" type="Sprite2D" parent="."] +z_index = -1 +material = SubResource("ShaderMaterial_mrkt4") + +[node name="AnimatedSprite" type="AnimatedSprite2D" parent="."] +material = SubResource("ShaderMaterial_b6ii6") +sprite_frames = ExtResource("3_oi74m") + +[node name="Collision" type="CollisionShape2D" parent="."] +shape = SubResource("RectangleShape2D_cpqup") diff --git a/DungeonShooting_Godot/resource/config/ActivityObject.json b/DungeonShooting_Godot/resource/config/ActivityObject.json index b78df1b..a70178d 100644 --- a/DungeonShooting_Godot/resource/config/ActivityObject.json +++ b/DungeonShooting_Godot/resource/config/ActivityObject.json @@ -147,6 +147,27 @@ "Prefab": "res://prefab/prop/buff/Buff0007.tscn" }, { + "Id": "prop0008", + "Type": 9, + "Name": "\u773C\u955C", + "Remark": "\u63D0\u9AD8\u6B66\u5668\u7CBE\u51C6\u5EA6", + "Prefab": "res://prefab/prop/buff/Buff0008.tscn" + }, + { + "Id": "prop0009", + "Type": 9, + "Name": "\u9AD8\u901F\u5B50\u5F39", + "Remark": "\u63D0\u9AD8\u5B50\u5F39\u901F\u5EA6\u548C\u5C04\u7A0B", + "Prefab": "res://prefab/prop/buff/Buff0009.tscn" + }, + { + "Id": "prop0010", + "Type": 9, + "Name": "\u5206\u88C2\u5B50\u5F39", + "Remark": "\u5B50\u5F39\u6570\u91CF\u7FFB\u500D, \u4F46\u662F\u7CBE\u51C6\u5EA6\u548C\u4F24\u5BB3\u964D\u4F4E", + "Prefab": "res://prefab/prop/buff/Buff0010.tscn" + }, + { "Id": "other_door_e", "Type": 99, "Name": "", diff --git a/DungeonShooting_Godot/resource/map/tileMaps/testGroup/inlet/Room1.tscn b/DungeonShooting_Godot/resource/map/tileMaps/testGroup/inlet/Room1.tscn index fb7179c..02b1565 100644 --- a/DungeonShooting_Godot/resource/map/tileMaps/testGroup/inlet/Room1.tscn +++ b/DungeonShooting_Godot/resource/map/tileMaps/testGroup/inlet/Room1.tscn @@ -71,3 +71,24 @@ Type = 9 ItemExpression = "0007" WaveNumber = 2 + +[node name="ActivityMark15" type="Node2D" parent="."] +position = Vector2(56, 55) +script = ExtResource("3_m4jrh") +Type = 9 +ItemExpression = "0008" +WaveNumber = 2 + +[node name="ActivityMark16" type="Node2D" parent="."] +position = Vector2(27, 76) +script = ExtResource("3_m4jrh") +Type = 9 +ItemExpression = "0009" +WaveNumber = 2 + +[node name="ActivityMark17" type="Node2D" parent="."] +position = Vector2(49, 79) +script = ExtResource("3_m4jrh") +Type = 9 +ItemExpression = "0010" +WaveNumber = 2 diff --git a/DungeonShooting_Godot/resource/sprite/prop/buff/Buff0008.png b/DungeonShooting_Godot/resource/sprite/prop/buff/Buff0008.png new file mode 100644 index 0000000..a4bcdd9 --- /dev/null +++ b/DungeonShooting_Godot/resource/sprite/prop/buff/Buff0008.png Binary files differ diff --git a/DungeonShooting_Godot/resource/sprite/prop/buff/Buff0008.png.import b/DungeonShooting_Godot/resource/sprite/prop/buff/Buff0008.png.import new file mode 100644 index 0000000..25fcbee --- /dev/null +++ b/DungeonShooting_Godot/resource/sprite/prop/buff/Buff0008.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://cn8f56vjb02u2" +path="res://.godot/imported/Buff0008.png-ecd91d54a17d95369afbfc71a13b1169.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://resource/sprite/prop/buff/Buff0008.png" +dest_files=["res://.godot/imported/Buff0008.png-ecd91d54a17d95369afbfc71a13b1169.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/DungeonShooting_Godot/resource/sprite/prop/buff/Buff0009.png b/DungeonShooting_Godot/resource/sprite/prop/buff/Buff0009.png new file mode 100644 index 0000000..924de09 --- /dev/null +++ b/DungeonShooting_Godot/resource/sprite/prop/buff/Buff0009.png Binary files differ diff --git a/DungeonShooting_Godot/resource/sprite/prop/buff/Buff0009.png.import b/DungeonShooting_Godot/resource/sprite/prop/buff/Buff0009.png.import new file mode 100644 index 0000000..e234265 --- /dev/null +++ b/DungeonShooting_Godot/resource/sprite/prop/buff/Buff0009.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://csak48bvrnws" +path="res://.godot/imported/Buff0009.png-979bb78617d9bc313dff43a0eaf20cfe.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://resource/sprite/prop/buff/Buff0009.png" +dest_files=["res://.godot/imported/Buff0009.png-979bb78617d9bc313dff43a0eaf20cfe.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/DungeonShooting_Godot/resource/sprite/prop/buff/Buff0010.png b/DungeonShooting_Godot/resource/sprite/prop/buff/Buff0010.png new file mode 100644 index 0000000..93884d3 --- /dev/null +++ b/DungeonShooting_Godot/resource/sprite/prop/buff/Buff0010.png Binary files differ diff --git a/DungeonShooting_Godot/resource/sprite/prop/buff/Buff0010.png.import b/DungeonShooting_Godot/resource/sprite/prop/buff/Buff0010.png.import new file mode 100644 index 0000000..f37f1fa --- /dev/null +++ b/DungeonShooting_Godot/resource/sprite/prop/buff/Buff0010.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dlsfun6svqfmm" +path="res://.godot/imported/Buff0010.png-a06964d9e3d5d952bb98001bfcb26102.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://resource/sprite/prop/buff/Buff0010.png" +dest_files=["res://.godot/imported/Buff0010.png-a06964d9e3d5d952bb98001bfcb26102.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/DungeonShooting_Godot/resource/spriteFrames/prop/buff/Buff0008.tres b/DungeonShooting_Godot/resource/spriteFrames/prop/buff/Buff0008.tres new file mode 100644 index 0000000..d41f23c --- /dev/null +++ b/DungeonShooting_Godot/resource/spriteFrames/prop/buff/Buff0008.tres @@ -0,0 +1,14 @@ +[gd_resource type="SpriteFrames" load_steps=2 format=3 uid="uid://bs41p1hpkpucb"] + +[ext_resource type="Texture2D" uid="uid://cn8f56vjb02u2" path="res://resource/sprite/prop/buff/Buff0008.png" id="1_7efyb"] + +[resource] +animations = [{ +"frames": [{ +"duration": 1.0, +"texture": ExtResource("1_7efyb") +}], +"loop": true, +"name": &"default", +"speed": 5.0 +}] diff --git a/DungeonShooting_Godot/resource/spriteFrames/prop/buff/Buff0009.tres b/DungeonShooting_Godot/resource/spriteFrames/prop/buff/Buff0009.tres new file mode 100644 index 0000000..be6489f --- /dev/null +++ b/DungeonShooting_Godot/resource/spriteFrames/prop/buff/Buff0009.tres @@ -0,0 +1,14 @@ +[gd_resource type="SpriteFrames" load_steps=2 format=3 uid="uid://sqcibio78nwc"] + +[ext_resource type="Texture2D" uid="uid://csak48bvrnws" path="res://resource/sprite/prop/buff/Buff0009.png" id="1_78egk"] + +[resource] +animations = [{ +"frames": [{ +"duration": 1.0, +"texture": ExtResource("1_78egk") +}], +"loop": true, +"name": &"default", +"speed": 5.0 +}] diff --git a/DungeonShooting_Godot/resource/spriteFrames/prop/buff/Buff0010.tres b/DungeonShooting_Godot/resource/spriteFrames/prop/buff/Buff0010.tres new file mode 100644 index 0000000..c5a3629 --- /dev/null +++ b/DungeonShooting_Godot/resource/spriteFrames/prop/buff/Buff0010.tres @@ -0,0 +1,14 @@ +[gd_resource type="SpriteFrames" load_steps=2 format=3 uid="uid://dxqtm7xgn2wms"] + +[ext_resource type="Texture2D" uid="uid://dlsfun6svqfmm" path="res://resource/sprite/prop/buff/Buff0010.png" id="1_w8rnu"] + +[resource] +animations = [{ +"frames": [{ +"duration": 1.0, +"texture": ExtResource("1_w8rnu") +}], +"loop": true, +"name": &"default", +"speed": 5.0 +}] diff --git a/DungeonShooting_Godot/src/framework/activity/ActivityObject_Init.cs b/DungeonShooting_Godot/src/framework/activity/ActivityObject_Init.cs index e3b624d..08962d5 100644 --- a/DungeonShooting_Godot/src/framework/activity/ActivityObject_Init.cs +++ b/DungeonShooting_Godot/src/framework/activity/ActivityObject_Init.cs @@ -116,6 +116,21 @@ /// public const string Id_prop0007 = "prop0007"; /// + /// 名称: 眼镜
+ /// 备注: 提高武器精准度 + ///
+ public const string Id_prop0008 = "prop0008"; + /// + /// 名称: 高速子弹
+ /// 备注: 提高子弹速度和射程 + ///
+ public const string Id_prop0009 = "prop0009"; + /// + /// 名称: 分裂子弹
+ /// 备注: 子弹数量翻倍, 但是精准度和伤害降低 + ///
+ public const string Id_prop0010 = "prop0010"; + /// /// 名称:
/// 备注: 地牢房间的门(东侧) ///
@@ -159,6 +174,9 @@ _activityRegisterMap.Add("prop0005", new RegisterActivityData("res://prefab/prop/buff/Buff0005.tscn", ExcelConfig.ActivityObject_Map["prop0005"])); _activityRegisterMap.Add("prop0006", new RegisterActivityData("res://prefab/prop/buff/Buff0006.tscn", ExcelConfig.ActivityObject_Map["prop0006"])); _activityRegisterMap.Add("prop0007", new RegisterActivityData("res://prefab/prop/buff/Buff0007.tscn", ExcelConfig.ActivityObject_Map["prop0007"])); + _activityRegisterMap.Add("prop0008", new RegisterActivityData("res://prefab/prop/buff/Buff0008.tscn", ExcelConfig.ActivityObject_Map["prop0008"])); + _activityRegisterMap.Add("prop0009", new RegisterActivityData("res://prefab/prop/buff/Buff0009.tscn", ExcelConfig.ActivityObject_Map["prop0009"])); + _activityRegisterMap.Add("prop0010", new RegisterActivityData("res://prefab/prop/buff/Buff0010.tscn", ExcelConfig.ActivityObject_Map["prop0010"])); _activityRegisterMap.Add("other_door_e", new RegisterActivityData("res://prefab/map/RoomDoor_E.tscn", ExcelConfig.ActivityObject_Map["other_door_e"])); _activityRegisterMap.Add("other_door_w", new RegisterActivityData("res://prefab/map/RoomDoor_W.tscn", ExcelConfig.ActivityObject_Map["other_door_w"])); _activityRegisterMap.Add("other_door_s", new RegisterActivityData("res://prefab/map/RoomDoor_S.tscn", ExcelConfig.ActivityObject_Map["other_door_s"])); diff --git a/DungeonShooting_Godot/src/game/activity/bullet/Bullet.cs b/DungeonShooting_Godot/src/game/activity/bullet/Bullet.cs index 262ea8d..16bf6b7 100644 --- a/DungeonShooting_Godot/src/game/activity/bullet/Bullet.cs +++ b/DungeonShooting_Godot/src/game/activity/bullet/Bullet.cs @@ -109,7 +109,9 @@ var damage = Utils.RandomRangeInt(MinHarm, MaxHarm); if (Role != null) { + var d = damage; damage = Role.RoleState.CallCalcDamageEvent(damage); + GD.Print($"原伤害: {d}, 计算伤害: {damage}"); } role.CallDeferred(nameof(Role.Hurt), damage, Rotation); Destroy(); diff --git a/DungeonShooting_Godot/src/game/activity/prop/buff/Buff0005.cs b/DungeonShooting_Godot/src/game/activity/prop/buff/Buff0005.cs index 7e31228..e97fbaf 100644 --- a/DungeonShooting_Godot/src/game/activity/prop/buff/Buff0005.cs +++ b/DungeonShooting_Godot/src/game/activity/prop/buff/Buff0005.cs @@ -17,8 +17,8 @@ master.RoleState.CalcDamageEvent -= CalcDamage; } - private void CalcDamage(RefValue refValue) + private void CalcDamage(int originDamage, RefValue refValue) { - refValue.Value = Mathf.CeilToInt(refValue.Value * 1.2f); + refValue.Value += Mathf.CeilToInt(originDamage * 0.2f); } } \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/activity/prop/buff/Buff0007.cs b/DungeonShooting_Godot/src/game/activity/prop/buff/Buff0007.cs index 1438212..b6c1be7 100644 --- a/DungeonShooting_Godot/src/game/activity/prop/buff/Buff0007.cs +++ b/DungeonShooting_Godot/src/game/activity/prop/buff/Buff0007.cs @@ -17,7 +17,7 @@ master.RoleState.CalcHurtDamageEvent -= CalcHurtDamageEvent; } - private void CalcHurtDamageEvent(RefValue refValue) + private void CalcHurtDamageEvent(int originDamage, RefValue refValue) { if (refValue.Value > 0 && Utils.RandomBoolean(0.15f)) { diff --git a/DungeonShooting_Godot/src/game/activity/prop/buff/Buff0008.cs b/DungeonShooting_Godot/src/game/activity/prop/buff/Buff0008.cs new file mode 100644 index 0000000..800a2cc --- /dev/null +++ b/DungeonShooting_Godot/src/game/activity/prop/buff/Buff0008.cs @@ -0,0 +1,31 @@ + +using Godot; + +/// +/// 眼镜, 提高武器50%精准度 +/// +[GlobalClass, Tool] +public partial class Buff0008 : Buff +{ + protected override void OnPickUp(Role master) + { + master.RoleState.CalcStartScatteringEvent += CalcStartScatteringEvent; + master.RoleState.CalcFinalScatteringEvent += CalcFinalScatteringEvent; + } + + protected override void OnRemove(Role master) + { + master.RoleState.CalcStartScatteringEvent -= CalcStartScatteringEvent; + master.RoleState.CalcFinalScatteringEvent -= CalcFinalScatteringEvent; + } + + private void CalcStartScatteringEvent(Weapon weapon, float originValue, RefValue refValue) + { + refValue.Value *= 0.5f; + } + + private void CalcFinalScatteringEvent(Weapon weapon, float originValue, RefValue refValue) + { + refValue.Value *= 0.5f; + } +} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/activity/prop/buff/Buff0009.cs b/DungeonShooting_Godot/src/game/activity/prop/buff/Buff0009.cs new file mode 100644 index 0000000..aad07a2 --- /dev/null +++ b/DungeonShooting_Godot/src/game/activity/prop/buff/Buff0009.cs @@ -0,0 +1,31 @@ + +using Godot; + +/// +/// 高速子弹 子弹速度和射程提升25% +/// +[GlobalClass, Tool] +public partial class Buff0009 : Buff +{ + protected override void OnPickUp(Role master) + { + master.RoleState.CalcBulletSpeedEvent += CalcBulletSpeedEvent; + master.RoleState.CalcBulletDistanceEvent += CalcBulletDistanceEvent; + } + + protected override void OnRemove(Role master) + { + master.RoleState.CalcBulletSpeedEvent -= CalcBulletSpeedEvent; + master.RoleState.CalcBulletDistanceEvent -= CalcBulletDistanceEvent; + } + + private void CalcBulletSpeedEvent(Weapon weapon, float originSpeed, RefValue speed) + { + speed.Value += originSpeed * 0.25f; + } + + private void CalcBulletDistanceEvent(Weapon weapon, float originDistance, RefValue distance) + { + distance.Value += originDistance * 0.25f; + } +} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/activity/prop/buff/Buff0010.cs b/DungeonShooting_Godot/src/game/activity/prop/buff/Buff0010.cs new file mode 100644 index 0000000..14195a6 --- /dev/null +++ b/DungeonShooting_Godot/src/game/activity/prop/buff/Buff0010.cs @@ -0,0 +1,43 @@ + +using Godot; + +/// +/// 分裂子弹 子弹数量翻倍, 但是精准度和伤害降低 +/// +[GlobalClass, Tool] +public partial class Buff0010 : Buff +{ + protected override void OnPickUp(Role master) + { + master.RoleState.CalcBulletCountEvent += CalcBulletCountEvent; + master.RoleState.CalcBulletDeviationAngleEvent += CalcBulletDeviationAngleEvent; + master.RoleState.CalcDamageEvent += CalcDamageEvent; + } + + protected override void OnRemove(Role master) + { + master.RoleState.CalcBulletCountEvent -= CalcBulletCountEvent; + master.RoleState.CalcBulletDeviationAngleEvent -= CalcBulletDeviationAngleEvent; + master.RoleState.CalcDamageEvent -= CalcDamageEvent; + } + + private void CalcBulletCountEvent(Weapon weapon, int originCount, RefValue refValue) + { + refValue.Value += originCount; + } + + private void CalcBulletDeviationAngleEvent(Weapon weapon, float originAngle, RefValue refValue) + { + refValue.Value += Utils.RandomRangeFloat(-10, 10); + } + + private void CalcDamageEvent(int originDamage, RefValue refValue) + { + if (refValue.Value <= 0) + { + return; + } + + refValue.Value = Mathf.Max(1, refValue.Value - Mathf.FloorToInt(originDamage * 0.4f)); + } +} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/activity/role/RoleState.cs b/DungeonShooting_Godot/src/game/activity/role/RoleState.cs index 9123c9c..0585f25 100644 --- a/DungeonShooting_Godot/src/game/activity/role/RoleState.cs +++ b/DungeonShooting_Godot/src/game/activity/role/RoleState.cs @@ -39,13 +39,13 @@ /// /// 攻击/发射后计算伤害 /// - public event Action> CalcDamageEvent; + public event Action> CalcDamageEvent; public int CallCalcDamageEvent(int damage) { if (CalcDamageEvent != null) { var result = new RefValue(damage); - CalcDamageEvent(result); + CalcDamageEvent(damage, result); return result.Value; } @@ -55,13 +55,13 @@ /// /// 受伤后计算受到的伤害 /// - public event Action> CalcHurtDamageEvent; + public event Action> CalcHurtDamageEvent; public int CallCalcHurtDamageEvent(int damage) { if (CalcHurtDamageEvent != null) { var result = new RefValue(damage); - CalcHurtDamageEvent(result); + CalcHurtDamageEvent(damage, result); return result.Value; } @@ -71,23 +71,46 @@ /// /// 武器初始散射值增量 /// - public float WeaponMinScatteringRangeIncrement = 0; + public event Action> CalcStartScatteringEvent; + + public float CallCalcStartScatteringEvent(Weapon weapon, float value) + { + if (CalcStartScatteringEvent != null) + { + var result = new RefValue(value); + CalcStartScatteringEvent(weapon, value, result); + return result.Value; + } + + return value; + } /// /// 武器最终散射值增量 /// - public float WeaponFinalScatteringRangeIncrement = 0; + public event Action> CalcFinalScatteringEvent; + public float CallCalcFinalScatteringEvent(Weapon weapon, float value) + { + if (CalcFinalScatteringEvent != null) + { + var result = new RefValue(value); + CalcFinalScatteringEvent(weapon, value, result); + return result.Value; + } + + return value; + } /// - /// 武器开火发射子弹最大数量 + /// 武器开火发射子弹数量 /// - public event Action> CalcWeaponFireBulletCount; - public int CallCalcWeaponFireBulletCount(Weapon weapon, int count) + public event Action> CalcBulletCountEvent; + public int CallCalcBulletCountEvent(Weapon weapon, int count) { - if (CalcWeaponFireBulletCount != null) + if (CalcBulletCountEvent != null) { var result = new RefValue(count); - CalcWeaponFireBulletCount(weapon, result); + CalcBulletCountEvent(weapon, count, result); return result.Value; } @@ -95,15 +118,31 @@ } /// + /// 子弹偏移角度, 角度制 + /// + public event Action> CalcBulletDeviationAngleEvent; + public float CallCalcBulletDeviationAngleEvent(Weapon weapon, float angle) + { + if (CalcBulletDeviationAngleEvent != null) + { + var result = new RefValue(angle); + CalcBulletDeviationAngleEvent(weapon, angle, result); + return result.Value; + } + + return angle; + } + + /// /// 子弹速度 /// - public event Action> CalcBulletSpeed; - public float CallCalcBulletSpeed(Weapon weapon, float speed) + public event Action> CalcBulletSpeedEvent; + public float CallCalcBulletSpeedEvent(Weapon weapon, float speed) { - if (CalcBulletSpeed != null) + if (CalcBulletSpeedEvent != null) { var result = new RefValue(speed); - CalcBulletSpeed(weapon, result); + CalcBulletSpeedEvent(weapon, speed, result); return result.Value; } @@ -113,13 +152,13 @@ /// /// 子弹射程 /// - public event Action> CalcBulletDistance; - public float CallBulletDistance(Weapon weapon, float distance) + public event Action> CalcBulletDistanceEvent; + public float CallCalcBulletDistanceEvent(Weapon weapon, float distance) { - if (CalcBulletDistance != null) + if (CalcBulletDistanceEvent != null) { var result = new RefValue(distance); - CalcBulletDistance(weapon, result); + CalcBulletDistanceEvent(weapon, distance, result); return result.Value; } diff --git a/DungeonShooting_Godot/src/game/activity/weapon/Weapon.cs b/DungeonShooting_Godot/src/game/activity/weapon/Weapon.cs index 6d05203..4103b8c 100644 --- a/DungeonShooting_Godot/src/game/activity/weapon/Weapon.cs +++ b/DungeonShooting_Godot/src/game/activity/weapon/Weapon.cs @@ -916,8 +916,7 @@ //触发开火函数 OnFire(); - //开火发射的子弹数量 - var bulletCount = Utils.RandomRangeInt(Attribute.MaxFireBulletCount, Attribute.MinFireBulletCount); + //武器口角度 var angle = new Vector2(GameConfig.ScatteringDistance, CurrScatteringRange).Angle(); @@ -926,7 +925,16 @@ var tempAngle = Mathf.RadToDeg(tempRotation); //开火时枪口角度 - var fireRotation = Mathf.DegToRad(Master.MountPoint.RealRotationDegrees) + tempRotation; + var fireRotation = tempRotation; + + //开火发射的子弹数量 + var bulletCount = Utils.RandomRangeInt(Attribute.MaxFireBulletCount, Attribute.MinFireBulletCount); + if (Master != null) + { + bulletCount = Master.RoleState.CallCalcBulletCountEvent(this, bulletCount); + fireRotation += Mathf.DegToRad(Master.MountPoint.RealRotationDegrees); + } + //创建子弹 for (int i = 0; i < bulletCount; i++) { @@ -1302,8 +1310,8 @@ var finalScatteringRange = Attribute.FinalScatteringRange; if (Master != null) { - startScatteringRange += Master.RoleState.WeaponMinScatteringRangeIncrement; - finalScatteringRange += Master.RoleState.WeaponFinalScatteringRangeIncrement; + startScatteringRange = Master.RoleState.CallCalcStartScatteringEvent(this, startScatteringRange); + finalScatteringRange = Master.RoleState.CallCalcFinalScatteringEvent(this, finalScatteringRange); } if (startScatteringRange <= finalScatteringRange) { @@ -1324,8 +1332,8 @@ var finalScatteringRange = Attribute.FinalScatteringRange; if (Master != null) { - startScatteringRange += Master.RoleState.WeaponMinScatteringRangeIncrement; - finalScatteringRange += Master.RoleState.WeaponFinalScatteringRangeIncrement; + startScatteringRange = Master.RoleState.CallCalcStartScatteringEvent(this, startScatteringRange); + finalScatteringRange = Master.RoleState.CallCalcFinalScatteringEvent(this, finalScatteringRange); } if (startScatteringRange <= finalScatteringRange) { @@ -1697,14 +1705,24 @@ /// protected Bullet ShootBullet(float fireRotation, string bulletId) { + var speed = Utils.RandomRangeFloat(Attribute.BulletMinSpeed, Attribute.BulletMaxSpeed); + var distance = Utils.RandomRangeFloat(Attribute.BulletMinDistance, Attribute.BulletMaxDistance); + var deviationAngle = + Utils.RandomRangeFloat(Attribute.BulletMinDeviationAngle, Attribute.BulletMaxDeviationAngle); + if (Master != null) + { + speed = Master.RoleState.CallCalcBulletSpeedEvent(this, speed); + distance = Master.RoleState.CallCalcBulletDistanceEvent(this, distance); + deviationAngle = Master.RoleState.CallCalcBulletDeviationAngleEvent(this, deviationAngle); + } //创建子弹 var bullet = Create(bulletId); bullet.Init( this, - Utils.RandomRangeFloat(Attribute.BulletMinSpeed, Attribute.BulletMaxSpeed), - Utils.RandomRangeFloat(Attribute.BulletMinDistance, Attribute.BulletMaxDistance), + speed, + distance, FirePoint.GlobalPosition, - fireRotation + Mathf.DegToRad(Utils.RandomRangeFloat(Attribute.BulletMinDeviationAngle, Attribute.BulletMaxDeviationAngle)), + fireRotation + Mathf.DegToRad(deviationAngle), GetAttackLayer() ); bullet.MinHarm = Attribute.BulletMinHarm;