From 3695a7ef112dca51ebae85bfc2bf83d05b214253 Mon Sep 17 00:00:00 2001 From: Cold-Mint Date: Wed, 9 Oct 2024 15:54:43 +0800 Subject: [PATCH] =?UTF-8?q?Add=20beginner's=20wand.=20=E5=8A=A0=E5=85=A5?= =?UTF-8?q?=E5=88=9D=E5=AD=A6=E8=80=85=E6=B3=95=E6=9D=96=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- data/itemRegs/weapons.yaml | 4 ++ locals/Item.csv | 4 +- .../entitys/BlackenedAboriginalWarrior.tscn | 1 + .../roomTemplates/tutorials/spellEditor.tscn | 4 +- prefab/weapons/BeginnerStaff.tscn | 51 +++++++++++++++++ scenes/mapContainer.tscn | 54 +++++++++--------- scripts/character/AiCharacter.cs | 24 ++++---- sprites/weapon/BeginnerStaff.png | Bin 0 -> 732 bytes sprites/weapon/BeginnerStaff.png.import | 34 +++++++++++ sprites/weapon/BeginnerStaffIcon.png.import | 34 +++++++++++ sprites/weapon/BeginnerStaff_Icon.png | Bin 0 -> 874 bytes sprites/weapon/BeginnerStaff_Icon.png.import | 34 +++++++++++ 12 files changed, 200 insertions(+), 44 deletions(-) create mode 100644 prefab/weapons/BeginnerStaff.tscn create mode 100644 sprites/weapon/BeginnerStaff.png create mode 100644 sprites/weapon/BeginnerStaff.png.import create mode 100644 sprites/weapon/BeginnerStaffIcon.png.import create mode 100644 sprites/weapon/BeginnerStaff_Icon.png create mode 100644 sprites/weapon/BeginnerStaff_Icon.png.import diff --git a/data/itemRegs/weapons.yaml b/data/itemRegs/weapons.yaml index 784ffc6..ca29e2e 100644 --- a/data/itemRegs/weapons.yaml +++ b/data/itemRegs/weapons.yaml @@ -18,4 +18,8 @@ - id: iron_axe scene_path: res://prefab/weapons/IronAxe.tscn icon_path: res://sprites/weapon/StaffNecromancy_Icon.png + max_stack_value: 1 +- id: beginner_staff + scene_path: res://prefab/weapons/BeginnerStaff.tscn + icon_path: res://sprites/weapon/BeginnerStaff_Icon.png max_stack_value: 1 \ No newline at end of file diff --git a/locals/Item.csv b/locals/Item.csv index ae5e524..442baac 100644 --- a/locals/Item.csv +++ b/locals/Item.csv @@ -12,4 +12,6 @@ item_resignation_certificate_desc,冷薄荷,感谢您在职时为公司做出 item_iron_axe,铁斧子,Iron axe,鉄の斧です item_iron_axe_desc,铁斧子,Iron axe,鉄の斧です item_curse,死灵诅咒法术,The curse of the Dead,死霊呪いの術 -item_curse_desc,杀死敌人后在生成死灵敌人。,Spawn Undead enemies after killing them.,敵を殺すと死霊敵が発生します。 \ No newline at end of file +item_curse_desc,杀死敌人后在生成死灵敌人。,Spawn Undead enemies after killing them.,敵を殺すと死霊敵が発生します。 +item_beginner_staff,初学者法杖,Beginner's staff,初心者用の杖です +item_beginner_staff_desc,送给初来乍到的冒险家。,For new adventurers.,初心者の冒険家に贈ります。 \ No newline at end of file diff --git a/prefab/entitys/BlackenedAboriginalWarrior.tscn b/prefab/entitys/BlackenedAboriginalWarrior.tscn index 67ceb30..43d9ec7 100644 --- a/prefab/entitys/BlackenedAboriginalWarrior.tscn +++ b/prefab/entitys/BlackenedAboriginalWarrior.tscn @@ -33,6 +33,7 @@ radius = 172.29 collision_layer = 64 collision_mask = 38 script = ExtResource("1_ubaid") +InitWeaponId = "staff_necromancy" CharacterName = "character_evil_crow" CanMutateAfterDeath = false MaxHp = 50 diff --git a/prefab/roomTemplates/tutorials/spellEditor.tscn b/prefab/roomTemplates/tutorials/spellEditor.tscn index e48ed08..2a25ba3 100644 --- a/prefab/roomTemplates/tutorials/spellEditor.tscn +++ b/prefab/roomTemplates/tutorials/spellEditor.tscn @@ -113,7 +113,7 @@ position = Vector2(134, 248) script = ExtResource("4_6ihp7") _itemIdList = PackedStringArray("necromancy") -[node name="staff_necromancy" type="Marker2D" parent="AutoSpawn"] +[node name="beginner_staff" type="Marker2D" parent="AutoSpawn"] position = Vector2(100, 250) script = ExtResource("4_6ihp7") -_itemIdList = PackedStringArray("staff_necromancy") +_itemIdList = PackedStringArray("beginner_staff") diff --git a/prefab/weapons/BeginnerStaff.tscn b/prefab/weapons/BeginnerStaff.tscn new file mode 100644 index 0000000..bde7a79 --- /dev/null +++ b/prefab/weapons/BeginnerStaff.tscn @@ -0,0 +1,51 @@ +[gd_scene load_steps=7 format=3 uid="uid://cg2jmn7cs8m2c"] + +[ext_resource type="Script" path="res://scripts/weapon/ProjectileWeapon.cs" id="1_w4b6p"] +[ext_resource type="Texture2D" uid="uid://pf2ilanjwino" path="res://sprites/weapon/BeginnerStaff_Icon.png" id="2_ip8xd"] +[ext_resource type="Texture2D" uid="uid://b4g1mkvjf7uns" path="res://sprites/weapon/BeginnerStaff.png" id="3_rhhwp"] +[ext_resource type="AudioStream" uid="uid://cak6chjjsu7wo" path="res://sounds/fire.wav" id="4_p12sk"] + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_obcq2"] +size = Vector2(49, 5) + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_14m1g"] +size = Vector2(49, 5.25) + +[node name="BeginnerStaff" type="RigidBody2D"] +collision_layer = 8 +collision_mask = 34 +script = ExtResource("1_w4b6p") +_numberSlots = 5 +_fireSequentially = true +FiringIntervalAsMillisecond = 300 +_recoilStrength = 5 +UniqueIcon = ExtResource("2_ip8xd") + +[node name="DamageArea2D" type="Area2D" parent="."] +collision_layer = 8 +collision_mask = 102 + +[node name="CollisionShape2D" type="CollisionShape2D" parent="DamageArea2D"] +position = Vector2(25.5, 0.5) +shape = SubResource("RectangleShape2D_obcq2") + +[node name="StaffOfTheUndead2" type="Sprite2D" parent="."] +position = Vector2(30, 0) +texture = ExtResource("3_rhhwp") + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +position = Vector2(25.5, 0.375) +shape = SubResource("RectangleShape2D_14m1g") + +[node name="Marker2D" type="Marker2D" parent="."] +position = Vector2(65, 0) + +[node name="AudioStreamPlayer2D" type="AudioStreamPlayer2D" parent="Marker2D"] +stream = ExtResource("4_p12sk") +bus = &"SoundEffect" + +[node name="TipLabel" type="Label" parent="."] +offset_left = 6.0 +offset_top = 48.0 +offset_right = 46.0 +offset_bottom = 73.0 diff --git a/scenes/mapContainer.tscn b/scenes/mapContainer.tscn index cdd4b20..1e1438d 100644 --- a/scenes/mapContainer.tscn +++ b/scenes/mapContainer.tscn @@ -4,6 +4,33 @@ [ext_resource type="Script" path="res://scripts/map/miniMap/MiniMap.cs" id="2_ltp8b"] [ext_resource type="Texture2D" uid="uid://cfpcm0hkmpu38" path="res://sprites/ui/mark.png" id="3_x80y0"] +[sub_resource type="Animation" id="Animation_dkx17"] +length = 0.001 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("Control/MiniMap:position") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [Vector2(983, 480)] +} +tracks/1/type = "value" +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/path = NodePath("Control/MiniMap:visible") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 1, +"values": [true] +} + [sub_resource type="Animation" id="Animation_jdj6o"] resource_name = "hide" length = 0.3 @@ -32,33 +59,6 @@ tracks/1/keys = { "values": [true, false] } -[sub_resource type="Animation" id="Animation_dkx17"] -length = 0.001 -tracks/0/type = "value" -tracks/0/imported = false -tracks/0/enabled = true -tracks/0/path = NodePath("Control/MiniMap:position") -tracks/0/interp = 1 -tracks/0/loop_wrap = true -tracks/0/keys = { -"times": PackedFloat32Array(0), -"transitions": PackedFloat32Array(1), -"update": 0, -"values": [Vector2(983, 480)] -} -tracks/1/type = "value" -tracks/1/imported = false -tracks/1/enabled = true -tracks/1/path = NodePath("Control/MiniMap:visible") -tracks/1/interp = 1 -tracks/1/loop_wrap = true -tracks/1/keys = { -"times": PackedFloat32Array(0), -"transitions": PackedFloat32Array(1), -"update": 1, -"values": [true] -} - [sub_resource type="Animation" id="Animation_icaqa"] resource_name = "show" length = 0.3 diff --git a/scripts/character/AiCharacter.cs b/scripts/character/AiCharacter.cs index cbefc43..20e5390 100644 --- a/scripts/character/AiCharacter.cs +++ b/scripts/character/AiCharacter.cs @@ -106,10 +106,10 @@ public sealed partial class AiCharacter : CharacterTemplate private BubbleMarker? _bubbleMarker; /// - /// The initial weapons scene - /// 初始的武器场景 + /// Initial weapon ID + /// 初始的武器ID /// - [Export] public string? InitWeaponRes; + [Export] public string? InitWeaponId; public override void _Ready() { @@ -184,30 +184,26 @@ public sealed partial class AiCharacter : CharacterTemplate ProtectedItemContainer = universalItemContainer; //Add initial weapon //添加初始武器 - AddInitialWeapon(InitWeaponRes); + AddInitialWeapon(InitWeaponId); } /// /// Adds an initial weapon to the character /// 为角色添加初始的武器 /// - private void AddInitialWeapon(string? initWeaponRes) + private void AddInitialWeapon(string? initWeaponId) { - if (string.IsNullOrEmpty(initWeaponRes)) + if (string.IsNullOrEmpty(initWeaponId)) { return; } - //Set the resource path of the initial weapon and try to create the object of the initial weapon. - //设置了初始武器的资源路径,尝试创建初始武器的对象。 - var packedScene = ResourceLoader.Load(initWeaponRes); - var weaponTemplate = NodeUtils.InstantiatePackedScene(packedScene); - if (weaponTemplate == null) + var item = ItemTypeManager.CreateItem(initWeaponId, this); + if (item is not WeaponTemplate weaponTemplate) { return; } - - NodeUtils.CallDeferredAddChild(this, weaponTemplate); + NodeUtils.CallDeferredReparent(this, weaponTemplate); PickItem(weaponTemplate); } @@ -477,4 +473,4 @@ public sealed partial class AiCharacter : CharacterTemplate StateMachine.Stop(); } } -} +} \ No newline at end of file diff --git a/sprites/weapon/BeginnerStaff.png b/sprites/weapon/BeginnerStaff.png new file mode 100644 index 0000000000000000000000000000000000000000..53af66fa97aee0765a3c247b3bba94b7fbc6dd63 GIT binary patch literal 732 zcmeAS@N?(olHy`uVBq!ia0vp^4j|0I1|(Ny7T#lEU|Q_y;uuoF_;#v&hKQrcvG^l; zy)jc73NrpU^Kb-i5mI7FV!8OvVMBlk`1CQmW}#H}#Fr2M zFFzk|V8OWKyY}lj+j?goY^=}Wt4-vqPj^56IR6#9okY6%25W``KTi~#{Pq3o&X!D( zrN``w1zGyd*JpoQ{L%QrjJLXPH%?xD-a_`55R(PRj7jY636E1M^|mzHu3+HMdvxi^ zWVtO2Up};3o=@$S?Ph6cSvK#V*Y%6(m7Pptd5uj!+n0*6E3ybXJ&Zf_&}Pj7oB9o$ z(I1!-H?3iNk!P>>P4&eOt_R0vFP+}gAHSjht7LeW^V8T3FK;!jeJCPrWqe=lN@1Mj z7sjCehQ~`*#q_wTolx1?V^$KBe#vjc0%Z8lkkggg6RWWB6ru$mSt#W2M;vHM5l zpP0UVGP(f_oSfS1#cFT4Cq<<*)IqTQB&itU3%JU9PnPPPv8%Yl*MKYt<%Jzt0_gT03h1FZ7>CX^!TY1{OsemO+c|6ur=D2H5u7<;OjX^e&WPF0q|?rr&1Ms zUTVmfWpa_&V3yYFe`g=}_qVxb}eE^Dx z!vi4w{X>0n>6V!VuHcrQN^~AT@Gv|`A126By}ROEu~88~@L2cU0U&uqfBwY}=iouC zmrfb6JT*-ZkuM57<`%Mu0D=!8eUcj_4}jre0?6T+>0!I`?f3+3)`jl^j5;KbQl#UXzue7x>tKJ0~F2 z>nwrT)=u9Au;yPre-@?Lbt1?K0gOHdf!l}3={o`J*4|Sh#3TowuT97AHfT)$w>CjW z9iOLJxZTCJ)p35#Y93lr0q8iZ&Dnq+JId_=0FCeThsI%c>s>6{+`^ucy8Bhk40cAiLPzIC%Wk4BF2BK!*H}<`FQHe0J^#A|>07*qoM6N<$f*e|w A+W-In literal 0 HcmV?d00001 diff --git a/sprites/weapon/BeginnerStaff_Icon.png.import b/sprites/weapon/BeginnerStaff_Icon.png.import new file mode 100644 index 0000000..30ec7f0 --- /dev/null +++ b/sprites/weapon/BeginnerStaff_Icon.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://pf2ilanjwino" +path="res://.godot/imported/BeginnerStaff_Icon.png-5f3c025d334f338333d0f48cf2e52c0e.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://sprites/weapon/BeginnerStaff_Icon.png" +dest_files=["res://.godot/imported/BeginnerStaff_Icon.png-5f3c025d334f338333d0f48cf2e52c0e.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