Add beginner's wand.

加入初学者法杖。
This commit is contained in:
Cold-Mint 2024-10-09 15:54:43 +08:00
parent 929dfb5f2f
commit 3695a7ef11
Signed by: Cold-Mint
GPG Key ID: C5A9BF8A98E0CE99
12 changed files with 200 additions and 44 deletions

View File

@ -19,3 +19,7 @@
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

View File

@ -13,3 +13,5 @@ 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.,敵を殺すと死霊敵が発生します。
item_beginner_staff,初学者法杖,Beginner's staff,初心者用の杖です
item_beginner_staff_desc,送给初来乍到的冒险家。,For new adventurers.,初心者の冒険家に贈ります。
1 id zh en ja
13 item_iron_axe_desc 铁斧子 Iron axe 鉄の斧です
14 item_curse 死灵诅咒法术 The curse of the Dead 死霊呪いの術
15 item_curse_desc 杀死敌人后在生成死灵敌人。 Spawn Undead enemies after killing them. 敵を殺すと死霊敵が発生します。
16 item_beginner_staff 初学者法杖 Beginner's staff 初心者用の杖です
17 item_beginner_staff_desc 送给初来乍到的冒险家。 For new adventurers. 初心者の冒険家に贈ります。

View File

@ -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

View File

@ -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")

View File

@ -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

View File

@ -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

View File

@ -106,10 +106,10 @@ public sealed partial class AiCharacter : CharacterTemplate
private BubbleMarker? _bubbleMarker;
/// <summary>
/// <para>The initial weapons scene</para>
/// <para>初始的武器场景</para>
/// <para>Initial weapon ID</para>
/// <para>初始的武器ID</para>
/// </summary>
[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);
}
/// <summary>
/// <para>Adds an initial weapon to the character</para>
/// <para>为角色添加初始的武器</para>
/// </summary>
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<PackedScene>(initWeaponRes);
var weaponTemplate = NodeUtils.InstantiatePackedScene<WeaponTemplate>(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);
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 732 B

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://b4g1mkvjf7uns"
path="res://.godot/imported/BeginnerStaff.png-b812f1377a68497cf5d497a50a7dc4eb.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://sprites/weapon/BeginnerStaff.png"
dest_files=["res://.godot/imported/BeginnerStaff.png-b812f1377a68497cf5d497a50a7dc4eb.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

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://r2obk433du1r"
path="res://.godot/imported/BeginnerStaffIcon.png-e12838ace0d9a63d4c717c73ff599a24.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://sprites/weapon/BeginnerStaffIcon.png"
dest_files=["res://.godot/imported/BeginnerStaffIcon.png-e12838ace0d9a63d4c717c73ff599a24.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

Binary file not shown.

After

Width:  |  Height:  |  Size: 874 B

View File

@ -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