diff --git a/DungeonShooting_Godot/excel/excelFile/ActivityObject.xlsx b/DungeonShooting_Godot/excel/excelFile/ActivityObject.xlsx
index 7863c17..5fcd5ae 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 897fd3a..4ebfabe 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 90e5bef..0b0b3cf 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/Buff0005.tscn b/DungeonShooting_Godot/prefab/prop/buff/Buff0005.tscn
new file mode 100644
index 0000000..6d2f135
--- /dev/null
+++ b/DungeonShooting_Godot/prefab/prop/buff/Buff0005.tscn
@@ -0,0 +1,40 @@
+[gd_scene load_steps=7 format=3 uid="uid://b4u8ichb44htn"]
+
+[ext_resource type="Script" path="res://src/game/activity/prop/buff/Buff0005.cs" id="1_kxndg"]
+[ext_resource type="Shader" path="res://resource/material/Blend.gdshader" id="2_85pkn"]
+[ext_resource type="SpriteFrames" uid="uid://bvqp46degt1rg" path="res://resource/spriteFrames/prop/buff/Buff0005.tres" id="3_1p404"]
+
+[sub_resource type="ShaderMaterial" id="ShaderMaterial_mrkt4"]
+resource_local_to_scene = true
+shader = ExtResource("2_85pkn")
+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_85pkn")
+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="Buff0005" type="CharacterBody2D" node_paths=PackedStringArray("ShadowSprite", "AnimatedSprite", "Collision")]
+collision_layer = 4
+script = ExtResource("1_kxndg")
+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_1p404")
+
+[node name="Collision" type="CollisionShape2D" parent="."]
+shape = SubResource("RectangleShape2D_cpqup")
diff --git a/DungeonShooting_Godot/prefab/prop/buff/Buff0006.tscn b/DungeonShooting_Godot/prefab/prop/buff/Buff0006.tscn
new file mode 100644
index 0000000..9f51b00
--- /dev/null
+++ b/DungeonShooting_Godot/prefab/prop/buff/Buff0006.tscn
@@ -0,0 +1,40 @@
+[gd_scene load_steps=7 format=3 uid="uid://co5v2gncs0i6g"]
+
+[ext_resource type="Script" path="res://src/game/activity/prop/buff/Buff0006.cs" id="1_lf3k7"]
+[ext_resource type="SpriteFrames" uid="uid://bxn65oovekw6k" path="res://resource/spriteFrames/prop/buff/Buff0006.tres" id="2_clye6"]
+[ext_resource type="Shader" path="res://resource/material/Blend.gdshader" id="2_pir38"]
+
+[sub_resource type="ShaderMaterial" id="ShaderMaterial_mrkt4"]
+resource_local_to_scene = true
+shader = ExtResource("2_pir38")
+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_pir38")
+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="Buff0006" type="CharacterBody2D" node_paths=PackedStringArray("ShadowSprite", "AnimatedSprite", "Collision")]
+collision_layer = 4
+script = ExtResource("1_lf3k7")
+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("2_clye6")
+
+[node name="Collision" type="CollisionShape2D" parent="."]
+shape = SubResource("RectangleShape2D_cpqup")
diff --git a/DungeonShooting_Godot/prefab/prop/buff/Buff0007.tscn b/DungeonShooting_Godot/prefab/prop/buff/Buff0007.tscn
new file mode 100644
index 0000000..62a560a
--- /dev/null
+++ b/DungeonShooting_Godot/prefab/prop/buff/Buff0007.tscn
@@ -0,0 +1,40 @@
+[gd_scene load_steps=7 format=3 uid="uid://bv85r8mqja8fy"]
+
+[ext_resource type="Script" path="res://src/game/activity/prop/buff/Buff0007.cs" id="1_4ga2a"]
+[ext_resource type="Shader" path="res://resource/material/Blend.gdshader" id="2_dfarf"]
+[ext_resource type="SpriteFrames" uid="uid://et840sb4d1g3" path="res://resource/spriteFrames/prop/buff/Buff0007.tres" id="3_y3ako"]
+
+[sub_resource type="ShaderMaterial" id="ShaderMaterial_mrkt4"]
+resource_local_to_scene = true
+shader = ExtResource("2_dfarf")
+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_dfarf")
+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="Buff0007" type="CharacterBody2D" node_paths=PackedStringArray("ShadowSprite", "AnimatedSprite", "Collision")]
+collision_layer = 4
+script = ExtResource("1_4ga2a")
+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_y3ako")
+
+[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 d294d93..b78df1b 100644
--- a/DungeonShooting_Godot/resource/config/ActivityObject.json
+++ b/DungeonShooting_Godot/resource/config/ActivityObject.json
@@ -126,6 +126,27 @@
"Prefab": "res://prefab/prop/buff/Buff0004.tscn"
},
{
+ "Id": "prop0005",
+ "Type": 9,
+ "Name": "\u6740\u4F24\u5F39",
+ "Remark": "\u63D0\u9AD8\u5B50\u5F39\u4F24\u5BB3",
+ "Prefab": "res://prefab/prop/buff/Buff0005.tscn"
+ },
+ {
+ "Id": "prop0006",
+ "Type": 9,
+ "Name": "\u52A0\u5F3A\u65E0\u654C\u65F6\u95F4",
+ "Remark": "\u53D7\u4F24\u540E\u5EF6\u957F\u65E0\u654C\u65F6\u95F4",
+ "Prefab": "res://prefab/prop/buff/Buff0006.tscn"
+ },
+ {
+ "Id": "prop0007",
+ "Type": 9,
+ "Name": "\u62B5\u6D88\u4F24\u5BB3\u7684\u62A4\u76FE",
+ "Remark": "\u53D7\u4F24\u65F6\u6709\u4E00\u5B9A\u6982\u7387\u62B5\u6D88\u4F24\u5BB3",
+ "Prefab": "res://prefab/prop/buff/Buff0007.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 7413463..fb7179c 100644
--- a/DungeonShooting_Godot/resource/map/tileMaps/testGroup/inlet/Room1.tscn
+++ b/DungeonShooting_Godot/resource/map/tileMaps/testGroup/inlet/Room1.tscn
@@ -50,3 +50,24 @@
Type = 9
ItemExpression = "0004"
WaveNumber = 2
+
+[node name="ActivityMark12" type="Node2D" parent="."]
+position = Vector2(64, 21)
+script = ExtResource("3_m4jrh")
+Type = 9
+ItemExpression = "0005"
+WaveNumber = 2
+
+[node name="ActivityMark13" type="Node2D" parent="."]
+position = Vector2(93, 22)
+script = ExtResource("3_m4jrh")
+Type = 9
+ItemExpression = "0006"
+WaveNumber = 2
+
+[node name="ActivityMark14" type="Node2D" parent="."]
+position = Vector2(32, 46)
+script = ExtResource("3_m4jrh")
+Type = 9
+ItemExpression = "0007"
+WaveNumber = 2
diff --git a/DungeonShooting_Godot/resource/sprite/prop/buff/Buff0004.png b/DungeonShooting_Godot/resource/sprite/prop/buff/Buff0004.png
index b2fd5f5..d46fe72 100644
--- a/DungeonShooting_Godot/resource/sprite/prop/buff/Buff0004.png
+++ b/DungeonShooting_Godot/resource/sprite/prop/buff/Buff0004.png
Binary files differ
diff --git a/DungeonShooting_Godot/resource/sprite/prop/buff/Buff0005.png b/DungeonShooting_Godot/resource/sprite/prop/buff/Buff0005.png
index bb37c35..b47eda1 100644
--- a/DungeonShooting_Godot/resource/sprite/prop/buff/Buff0005.png
+++ b/DungeonShooting_Godot/resource/sprite/prop/buff/Buff0005.png
Binary files differ
diff --git a/DungeonShooting_Godot/resource/sprite/prop/buff/Buff0006.png b/DungeonShooting_Godot/resource/sprite/prop/buff/Buff0006.png
new file mode 100644
index 0000000..18ce355
--- /dev/null
+++ b/DungeonShooting_Godot/resource/sprite/prop/buff/Buff0006.png
Binary files differ
diff --git a/DungeonShooting_Godot/resource/sprite/prop/buff/Buff0006.png.import b/DungeonShooting_Godot/resource/sprite/prop/buff/Buff0006.png.import
new file mode 100644
index 0000000..4bdda12
--- /dev/null
+++ b/DungeonShooting_Godot/resource/sprite/prop/buff/Buff0006.png.import
@@ -0,0 +1,34 @@
+[remap]
+
+importer="texture"
+type="CompressedTexture2D"
+uid="uid://do8blk3xm5uy1"
+path="res://.godot/imported/Buff0006.png-ad8ef1b00368b9ade7dad2594a085571.ctex"
+metadata={
+"vram_texture": false
+}
+
+[deps]
+
+source_file="res://resource/sprite/prop/buff/Buff0006.png"
+dest_files=["res://.godot/imported/Buff0006.png-ad8ef1b00368b9ade7dad2594a085571.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/Buff0007.png b/DungeonShooting_Godot/resource/sprite/prop/buff/Buff0007.png
new file mode 100644
index 0000000..f33940f
--- /dev/null
+++ b/DungeonShooting_Godot/resource/sprite/prop/buff/Buff0007.png
Binary files differ
diff --git a/DungeonShooting_Godot/resource/sprite/prop/buff/Buff0007.png.import b/DungeonShooting_Godot/resource/sprite/prop/buff/Buff0007.png.import
new file mode 100644
index 0000000..7230b9e
--- /dev/null
+++ b/DungeonShooting_Godot/resource/sprite/prop/buff/Buff0007.png.import
@@ -0,0 +1,34 @@
+[remap]
+
+importer="texture"
+type="CompressedTexture2D"
+uid="uid://fql5q452jqo0"
+path="res://.godot/imported/Buff0007.png-37ef8d668ae6ca956b70dc6c26afcbc0.ctex"
+metadata={
+"vram_texture": false
+}
+
+[deps]
+
+source_file="res://resource/sprite/prop/buff/Buff0007.png"
+dest_files=["res://.godot/imported/Buff0007.png-37ef8d668ae6ca956b70dc6c26afcbc0.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/Buff0005.tres b/DungeonShooting_Godot/resource/spriteFrames/prop/buff/Buff0005.tres
new file mode 100644
index 0000000..541aa71
--- /dev/null
+++ b/DungeonShooting_Godot/resource/spriteFrames/prop/buff/Buff0005.tres
@@ -0,0 +1,14 @@
+[gd_resource type="SpriteFrames" load_steps=2 format=3 uid="uid://bvqp46degt1rg"]
+
+[ext_resource type="Texture2D" uid="uid://dse0mbg06ngya" path="res://resource/sprite/prop/buff/Buff0005.png" id="1_en8jo"]
+
+[resource]
+animations = [{
+"frames": [{
+"duration": 1.0,
+"texture": ExtResource("1_en8jo")
+}],
+"loop": true,
+"name": &"default",
+"speed": 5.0
+}]
diff --git a/DungeonShooting_Godot/resource/spriteFrames/prop/buff/Buff0006.tres b/DungeonShooting_Godot/resource/spriteFrames/prop/buff/Buff0006.tres
new file mode 100644
index 0000000..5939146
--- /dev/null
+++ b/DungeonShooting_Godot/resource/spriteFrames/prop/buff/Buff0006.tres
@@ -0,0 +1,14 @@
+[gd_resource type="SpriteFrames" load_steps=2 format=3 uid="uid://bxn65oovekw6k"]
+
+[ext_resource type="Texture2D" uid="uid://do8blk3xm5uy1" path="res://resource/sprite/prop/buff/Buff0006.png" id="1_ugsdc"]
+
+[resource]
+animations = [{
+"frames": [{
+"duration": 1.0,
+"texture": ExtResource("1_ugsdc")
+}],
+"loop": true,
+"name": &"default",
+"speed": 5.0
+}]
diff --git a/DungeonShooting_Godot/resource/spriteFrames/prop/buff/Buff0007.tres b/DungeonShooting_Godot/resource/spriteFrames/prop/buff/Buff0007.tres
new file mode 100644
index 0000000..49ef0b6
--- /dev/null
+++ b/DungeonShooting_Godot/resource/spriteFrames/prop/buff/Buff0007.tres
@@ -0,0 +1,14 @@
+[gd_resource type="SpriteFrames" load_steps=2 format=3 uid="uid://et840sb4d1g3"]
+
+[ext_resource type="Texture2D" uid="uid://fql5q452jqo0" path="res://resource/sprite/prop/buff/Buff0007.png" id="1_p5fwh"]
+
+[resource]
+animations = [{
+"frames": [{
+"duration": 1.0,
+"texture": ExtResource("1_p5fwh")
+}],
+"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 22bbb97..e3b624d 100644
--- a/DungeonShooting_Godot/src/framework/activity/ActivityObject_Init.cs
+++ b/DungeonShooting_Godot/src/framework/activity/ActivityObject_Init.cs
@@ -101,6 +101,21 @@
///
public const string Id_prop0004 = "prop0004";
///
+ /// 名称: 杀伤弹
+ /// 备注: 提高子弹伤害
+ ///
+ public const string Id_prop0005 = "prop0005";
+ ///
+ /// 名称: 加强无敌时间
+ /// 备注: 受伤后延长无敌时间
+ ///
+ public const string Id_prop0006 = "prop0006";
+ ///
+ /// 名称: 抵消伤害的护盾
+ /// 备注: 受伤时有一定概率抵消伤害
+ ///
+ public const string Id_prop0007 = "prop0007";
+ ///
/// 名称:
/// 备注: 地牢房间的门(东侧)
///
@@ -141,6 +156,9 @@
_activityRegisterMap.Add("prop0002", new RegisterActivityData("res://prefab/prop/buff/Buff0002.tscn", ExcelConfig.ActivityObject_Map["prop0002"]));
_activityRegisterMap.Add("prop0003", new RegisterActivityData("res://prefab/prop/buff/Buff0003.tscn", ExcelConfig.ActivityObject_Map["prop0003"]));
_activityRegisterMap.Add("prop0004", new RegisterActivityData("res://prefab/prop/buff/Buff0004.tscn", ExcelConfig.ActivityObject_Map["prop0004"]));
+ _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("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/framework/common/Utils.cs b/DungeonShooting_Godot/src/framework/common/Utils.cs
index 5b3c546..c35931d 100644
--- a/DungeonShooting_Godot/src/framework/common/Utils.cs
+++ b/DungeonShooting_Godot/src/framework/common/Utils.cs
@@ -34,6 +34,13 @@
public static bool RandomBoolean()
{
return _random.NextSingle() >= 0.5f;
+ }
+ ///
+ /// 指定概率会返回 true, probability 范围 0 - 1
+ ///
+ public static bool RandomBoolean(float probability)
+ {
+ return _random.NextSingle() <= probability;
}
///
diff --git a/DungeonShooting_Godot/src/game/activity/bullet/Bullet.cs b/DungeonShooting_Godot/src/game/activity/bullet/Bullet.cs
index 873feb6..262ea8d 100644
--- a/DungeonShooting_Godot/src/game/activity/bullet/Bullet.cs
+++ b/DungeonShooting_Godot/src/game/activity/bullet/Bullet.cs
@@ -106,7 +106,11 @@
node.AddToActivityRoot(RoomLayerEnum.YSortLayer);
//计算子弹造成的伤害
- var damage = role.RoleState.CallCalcDamageEvent(Utils.RandomRangeInt(MinHarm, MaxHarm));
+ var damage = Utils.RandomRangeInt(MinHarm, MaxHarm);
+ if (Role != null)
+ {
+ damage = Role.RoleState.CallCalcDamageEvent(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
new file mode 100644
index 0000000..7e31228
--- /dev/null
+++ b/DungeonShooting_Godot/src/game/activity/prop/buff/Buff0005.cs
@@ -0,0 +1,24 @@
+
+using Godot;
+
+///
+/// 提升伤害buff, 子弹伤害提升20%
+///
+[GlobalClass, Tool]
+public partial class Buff0005 : Buff
+{
+ protected override void OnPickUp(Role master)
+ {
+ master.RoleState.CalcDamageEvent += CalcDamage;
+ }
+
+ protected override void OnRemove(Role master)
+ {
+ master.RoleState.CalcDamageEvent -= CalcDamage;
+ }
+
+ private void CalcDamage(RefValue refValue)
+ {
+ refValue.Value = Mathf.CeilToInt(refValue.Value * 1.2f);
+ }
+}
\ No newline at end of file
diff --git a/DungeonShooting_Godot/src/game/activity/prop/buff/Buff0006.cs b/DungeonShooting_Godot/src/game/activity/prop/buff/Buff0006.cs
new file mode 100644
index 0000000..396abd0
--- /dev/null
+++ b/DungeonShooting_Godot/src/game/activity/prop/buff/Buff0006.cs
@@ -0,0 +1,19 @@
+
+using Godot;
+
+///
+/// 延长无敌时间buff, 受伤后无敌时间 + 2s
+///
+[GlobalClass, Tool]
+public partial class Buff0006 : Buff
+{
+ protected override void OnPickUp(Role master)
+ {
+ master.RoleState.WoundedInvincibleTime += 2f;
+ }
+
+ protected override void OnRemove(Role master)
+ {
+ master.RoleState.WoundedInvincibleTime -= 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
new file mode 100644
index 0000000..1438212
--- /dev/null
+++ b/DungeonShooting_Godot/src/game/activity/prop/buff/Buff0007.cs
@@ -0,0 +1,27 @@
+
+using Godot;
+
+///
+/// 受伤时有15%概率抵消伤害
+///
+[GlobalClass, Tool]
+public partial class Buff0007 : Buff
+{
+ protected override void OnPickUp(Role master)
+ {
+ master.RoleState.CalcHurtDamageEvent += CalcHurtDamageEvent;
+ }
+
+ protected override void OnRemove(Role master)
+ {
+ master.RoleState.CalcHurtDamageEvent -= CalcHurtDamageEvent;
+ }
+
+ private void CalcHurtDamageEvent(RefValue refValue)
+ {
+ if (refValue.Value > 0 && Utils.RandomBoolean(0.15f))
+ {
+ refValue.Value = 0;
+ }
+ }
+}
\ No newline at end of file
diff --git a/DungeonShooting_Godot/src/game/activity/role/Player.cs b/DungeonShooting_Godot/src/game/activity/role/Player.cs
index 9d33b71..db1e0f9 100644
--- a/DungeonShooting_Godot/src/game/activity/role/Player.cs
+++ b/DungeonShooting_Godot/src/game/activity/role/Player.cs
@@ -142,11 +142,11 @@
//进入无敌状态
if (realHarm) //真实伤害
{
- PlayInvincibleFlashing(1.5f);
+ PlayInvincibleFlashing(RoleState.WoundedInvincibleTime);
}
else //护盾抵消掉的
{
- PlayInvincibleFlashing(0.5f);
+ PlayInvincibleFlashing(RoleState.ShieldInvincibleTime);
}
}
diff --git a/DungeonShooting_Godot/src/game/activity/role/Role.cs b/DungeonShooting_Godot/src/game/activity/role/Role.cs
index d924ead..79befdd 100644
--- a/DungeonShooting_Godot/src/game/activity/role/Role.cs
+++ b/DungeonShooting_Godot/src/game/activity/role/Role.cs
@@ -628,11 +628,6 @@
//计算真正受到的伤害
damage = OnHandlerHurt(damage);
- if (damage <= 0)
- {
- return;
- }
-
var flag = Shield > 0;
if (flag)
{
@@ -640,6 +635,11 @@
}
else
{
+ damage = RoleState.CallCalcHurtDamageEvent(damage);
+ if (damage < 0)
+ {
+ return;
+ }
Hp -= damage;
//播放血液效果
// var packedScene = ResourceManager.Load(ResourcePath.prefab_effect_Blood_tscn);
diff --git a/DungeonShooting_Godot/src/game/activity/role/RoleState.cs b/DungeonShooting_Godot/src/game/activity/role/RoleState.cs
index b38e9e0..4414c63 100644
--- a/DungeonShooting_Godot/src/game/activity/role/RoleState.cs
+++ b/DungeonShooting_Godot/src/game/activity/role/RoleState.cs
@@ -27,9 +27,14 @@
public float ShieldRecoveryTime = 8;
///
- /// 伤害加成
+ /// 受伤后的无敌时间, 单位: 秒
///
- public float DamageBonus = 0;
+ public float WoundedInvincibleTime = 1f;
+
+ ///
+ /// 护盾被攻击后的无敌时间, 单位: 秒
+ ///
+ public float ShieldInvincibleTime = 0.5f;
///
/// 攻击/发射后计算伤害
@@ -46,4 +51,20 @@
return damage;
}
+
+ ///
+ /// 受伤后计算受到的伤害
+ ///
+ public event Action> CalcHurtDamageEvent;
+ public int CallCalcHurtDamageEvent(int damage)
+ {
+ if (CalcHurtDamageEvent != null)
+ {
+ var result = new RefValue(damage);
+ CalcHurtDamageEvent(result);
+ return result.Value;
+ }
+
+ return damage;
+ }
}
\ No newline at end of file
diff --git a/DungeonShooting_Godot/src/game/activity/weapon/Weapon.cs b/DungeonShooting_Godot/src/game/activity/weapon/Weapon.cs
index d2fa00a..2b74d67 100644
--- a/DungeonShooting_Godot/src/game/activity/weapon/Weapon.cs
+++ b/DungeonShooting_Godot/src/game/activity/weapon/Weapon.cs
@@ -910,7 +910,7 @@
PlayShootSound();
//抛弹
- if ((Attribute.ContinuousShoot || !Attribute.ManualBeLoaded) && Attribute.ShellId != null)
+ if ((Attribute.ContinuousShoot || !Attribute.ManualBeLoaded))
{
ThrowShellHandler(1f);
}
@@ -1061,7 +1061,7 @@
// GD.Print("开始换弹.");
//抛弹
- if (!Attribute.ContinuousShoot && (_beLoadedState == 0 || _beLoadedState == -1) && Attribute.BeLoadedTime > 0 && Attribute.ShellId != null)
+ if (!Attribute.ContinuousShoot && (_beLoadedState == 0 || _beLoadedState == -1) && Attribute.BeLoadedTime > 0)
{
ThrowShellHandler(0.6f);
}
@@ -1241,7 +1241,7 @@
private void BeLoadedHandler()
{
//上膛抛弹
- if (!Attribute.ContinuousShoot && Attribute.BeLoadedTime > 0 && Attribute.ShellId != null)
+ if (!Attribute.ContinuousShoot && Attribute.BeLoadedTime > 0)
{
ThrowShellHandler(0.6f);
}
@@ -1282,6 +1282,10 @@
//抛弹逻辑
private void ThrowShellHandler(float speedScale)
{
+ if (string.IsNullOrEmpty(Attribute.ShellId))
+ {
+ return;
+ }
//创建一个弹壳
if (Attribute.ThrowShellDelayTime > 0)
{
diff --git a/DungeonShooting_Godot/src/game/activity/weapon/knife/Knife.cs b/DungeonShooting_Godot/src/game/activity/weapon/knife/Knife.cs
index 8f7e3ce..41ada9c 100644
--- a/DungeonShooting_Godot/src/game/activity/weapon/knife/Knife.cs
+++ b/DungeonShooting_Godot/src/game/activity/weapon/knife/Knife.cs
@@ -59,7 +59,7 @@
{
//播放挥刀特效
SpecialEffectManager.Play(
- ResourcePath.resource_spriteFrames_KnifeHit1_tres, "default",
+ ResourcePath.resource_spriteFrames_effect_KnifeHit1_tres, "default",
Master.MountPoint.GlobalPosition, GlobalRotation + Mathf.Pi * 0.5f, new Vector2((int)Master.Face, 1) * AnimatedSprite.Scale,
new Vector2(17, 4), 1
);
diff --git a/DungeonShooting_Godot/src/game/manager/ResourcePath.cs b/DungeonShooting_Godot/src/game/manager/ResourcePath.cs
index 1c9126a..3a0dd7b 100644
--- a/DungeonShooting_Godot/src/game/manager/ResourcePath.cs
+++ b/DungeonShooting_Godot/src/game/manager/ResourcePath.cs
@@ -24,6 +24,13 @@
public const string prefab_map_RoomDoor_N_tscn = "res://prefab/map/RoomDoor_N.tscn";
public const string prefab_map_RoomDoor_S_tscn = "res://prefab/map/RoomDoor_S.tscn";
public const string prefab_map_RoomDoor_W_tscn = "res://prefab/map/RoomDoor_W.tscn";
+ public const string prefab_prop_buff_Buff0001_tscn = "res://prefab/prop/buff/Buff0001.tscn";
+ public const string prefab_prop_buff_Buff0002_tscn = "res://prefab/prop/buff/Buff0002.tscn";
+ public const string prefab_prop_buff_Buff0003_tscn = "res://prefab/prop/buff/Buff0003.tscn";
+ public const string prefab_prop_buff_Buff0004_tscn = "res://prefab/prop/buff/Buff0004.tscn";
+ public const string prefab_prop_buff_Buff0005_tscn = "res://prefab/prop/buff/Buff0005.tscn";
+ public const string prefab_prop_buff_Buff0006_tscn = "res://prefab/prop/buff/Buff0006.tscn";
+ public const string prefab_prop_buff_Buff0007_tscn = "res://prefab/prop/buff/Buff0007.tscn";
public const string prefab_role_Enemy0001_tscn = "res://prefab/role/Enemy0001.tscn";
public const string prefab_role_Role0001_tscn = "res://prefab/role/Role0001.tscn";
public const string prefab_role_RoleTemplate_tscn = "res://prefab/role/RoleTemplate.tscn";
@@ -115,6 +122,13 @@
public const string resource_sprite_map_map1_16x16dungeoniiwallreconfigv04spritesheet_png = "res://resource/sprite/map/map1/16x16 dungeon ii wall reconfig v04 spritesheet.png";
public const string resource_sprite_map_map1_door1_down_png = "res://resource/sprite/map/map1/door1_down.png";
public const string resource_sprite_map_map1_website_txt = "res://resource/sprite/map/map1/website.txt";
+ public const string resource_sprite_prop_buff_Buff0001_png = "res://resource/sprite/prop/buff/Buff0001.png";
+ public const string resource_sprite_prop_buff_Buff0002_png = "res://resource/sprite/prop/buff/Buff0002.png";
+ public const string resource_sprite_prop_buff_Buff0003_png = "res://resource/sprite/prop/buff/Buff0003.png";
+ public const string resource_sprite_prop_buff_Buff0004_png = "res://resource/sprite/prop/buff/Buff0004.png";
+ public const string resource_sprite_prop_buff_Buff0005_png = "res://resource/sprite/prop/buff/Buff0005.png";
+ public const string resource_sprite_prop_buff_Buff0006_png = "res://resource/sprite/prop/buff/Buff0006.png";
+ public const string resource_sprite_prop_buff_Buff0007_png = "res://resource/sprite/prop/buff/Buff0007.png";
public const string resource_sprite_role_role10_png = "res://resource/sprite/role/role10.png";
public const string resource_sprite_role_role2_png = "res://resource/sprite/role/role2.png";
public const string resource_sprite_role_role3_png = "res://resource/sprite/role/role3.png";
@@ -168,22 +182,29 @@
public const string resource_sprite_weapon_weapon0003_Weapon0003_png = "res://resource/sprite/weapon/weapon0003/Weapon0003.png";
public const string resource_sprite_weapon_weapon0005_Weapon0005_png = "res://resource/sprite/weapon/weapon0005/Weapon0005.png";
public const string resource_sprite_weapon_weapon0006_Weapon0006_png = "res://resource/sprite/weapon/weapon0006/Weapon0006.png";
- public const string resource_spriteFrames_Bullet0001_tres = "res://resource/spriteFrames/Bullet0001.tres";
- public const string resource_spriteFrames_Bullet0002_tres = "res://resource/spriteFrames/Bullet0002.tres";
- public const string resource_spriteFrames_KnifeHit1_tres = "res://resource/spriteFrames/KnifeHit1.tres";
- public const string resource_spriteFrames_Role0001_tres = "res://resource/spriteFrames/Role0001.tres";
- public const string resource_spriteFrames_Role1001_tres = "res://resource/spriteFrames/Role1001.tres";
- public const string resource_spriteFrames_RoomDoor_EW_tres = "res://resource/spriteFrames/RoomDoor_EW.tres";
- public const string resource_spriteFrames_RoomDoor_NS_tres = "res://resource/spriteFrames/RoomDoor_NS.tres";
- public const string resource_spriteFrames_Shell0001_tres = "res://resource/spriteFrames/Shell0001.tres";
- public const string resource_spriteFrames_Shell0002_tres = "res://resource/spriteFrames/Shell0002.tres";
- public const string resource_spriteFrames_Shell0003_tres = "res://resource/spriteFrames/Shell0003.tres";
- public const string resource_spriteFrames_Weapon0001_tres = "res://resource/spriteFrames/Weapon0001.tres";
- public const string resource_spriteFrames_Weapon0002_tres = "res://resource/spriteFrames/Weapon0002.tres";
- public const string resource_spriteFrames_Weapon0003_tres = "res://resource/spriteFrames/Weapon0003.tres";
- public const string resource_spriteFrames_Weapon0004_tres = "res://resource/spriteFrames/Weapon0004.tres";
- public const string resource_spriteFrames_Weapon0005_tres = "res://resource/spriteFrames/Weapon0005.tres";
- public const string resource_spriteFrames_Weapon0006_tres = "res://resource/spriteFrames/Weapon0006.tres";
+ public const string resource_spriteFrames_bullet_Bullet0001_tres = "res://resource/spriteFrames/bullet/Bullet0001.tres";
+ public const string resource_spriteFrames_bullet_Bullet0002_tres = "res://resource/spriteFrames/bullet/Bullet0002.tres";
+ public const string resource_spriteFrames_effect_KnifeHit1_tres = "res://resource/spriteFrames/effect/KnifeHit1.tres";
+ public const string resource_spriteFrames_other_RoomDoor_EW_tres = "res://resource/spriteFrames/other/RoomDoor_EW.tres";
+ public const string resource_spriteFrames_other_RoomDoor_NS_tres = "res://resource/spriteFrames/other/RoomDoor_NS.tres";
+ public const string resource_spriteFrames_prop_buff_Buff0001_tres = "res://resource/spriteFrames/prop/buff/Buff0001.tres";
+ public const string resource_spriteFrames_prop_buff_Buff0002_tres = "res://resource/spriteFrames/prop/buff/Buff0002.tres";
+ public const string resource_spriteFrames_prop_buff_Buff0003_tres = "res://resource/spriteFrames/prop/buff/Buff0003.tres";
+ public const string resource_spriteFrames_prop_buff_Buff0004_tres = "res://resource/spriteFrames/prop/buff/Buff0004.tres";
+ public const string resource_spriteFrames_prop_buff_Buff0005_tres = "res://resource/spriteFrames/prop/buff/Buff0005.tres";
+ public const string resource_spriteFrames_prop_buff_Buff0006_tres = "res://resource/spriteFrames/prop/buff/Buff0006.tres";
+ public const string resource_spriteFrames_prop_buff_Buff0007_tres = "res://resource/spriteFrames/prop/buff/Buff0007.tres";
+ public const string resource_spriteFrames_role_Role0001_tres = "res://resource/spriteFrames/role/Role0001.tres";
+ public const string resource_spriteFrames_role_Role1001_tres = "res://resource/spriteFrames/role/Role1001.tres";
+ public const string resource_spriteFrames_shell_Shell0001_tres = "res://resource/spriteFrames/shell/Shell0001.tres";
+ public const string resource_spriteFrames_shell_Shell0002_tres = "res://resource/spriteFrames/shell/Shell0002.tres";
+ public const string resource_spriteFrames_shell_Shell0003_tres = "res://resource/spriteFrames/shell/Shell0003.tres";
+ public const string resource_spriteFrames_weapon_Weapon0001_tres = "res://resource/spriteFrames/weapon/Weapon0001.tres";
+ public const string resource_spriteFrames_weapon_Weapon0002_tres = "res://resource/spriteFrames/weapon/Weapon0002.tres";
+ public const string resource_spriteFrames_weapon_Weapon0003_tres = "res://resource/spriteFrames/weapon/Weapon0003.tres";
+ public const string resource_spriteFrames_weapon_Weapon0004_tres = "res://resource/spriteFrames/weapon/Weapon0004.tres";
+ public const string resource_spriteFrames_weapon_Weapon0005_tres = "res://resource/spriteFrames/weapon/Weapon0005.tres";
+ public const string resource_spriteFrames_weapon_Weapon0006_tres = "res://resource/spriteFrames/weapon/Weapon0006.tres";
public const string resource_theme_mainTheme_tres = "res://resource/theme/mainTheme.tres";
public const string resource_theme_theme1_tres = "res://resource/theme/theme1.tres";
public const string scene_EditorDemo_tscn = "res://scene/EditorDemo.tscn";