diff --git a/data/itemRegs/weapons.yaml b/data/itemRegs/weapons.yaml
index 300a9c7..3700f97 100644
--- a/data/itemRegs/weapons.yaml
+++ b/data/itemRegs/weapons.yaml
@@ -2,7 +2,15 @@
scene_path: res://prefab/weapons/staffOfTheUndead.tscn
icon_path: res://sprites/weapon/staffOfTheUndead_icon.png
max_stack_value: 1
+
+- id: degraded_staff_of_the_undead
+ scene_path: res://prefab/weapons/staffOfTheUndead.tscn
+ icon_path: res://sprites/weapon/staffOfTheUndead_icon.png
+ max_stack_value: 1
custom_args:
- name: FiringIntervalAsMillisecond
type: int
value: 1000
+ - name: UniqueName
+ type: string
+ value: 劣化的死灵法杖
diff --git a/locals/Log.csv b/locals/Log.csv
index 4a39692..60dffeb 100644
--- a/locals/Log.csv
+++ b/locals/Log.csv
@@ -34,5 +34,6 @@ log_warning_node_cannot_cast_to,创建的物品{0}无法被转型为类型{1},Cr
log_start_item_register_from_file,开始从文件注册物品信息,Start registering item information from files,アイテム情報をファイルから登録開始
log_found_files,找到{0}个文件,Found {0} files,{0}ファイルが見つかりました
log_found_item_types,从文件中找到{0}个物品类型,Found {0} item types in files,ファイルから{0}個のアイテム・タイプが見つかった
+log_register_item,注册物品类型{0}结果为{1},Registered item type {0}; results in {1},登録されたアイテム・タイプ {0} の結果は {1} です。
log_error_when_open_item_regs_dir,尝试打开物品信息目录时发生错误,Error when opening itemRegs dir,アイテム情報カタログを開こうとしてエラーが発生しました。
log_wrong_custom_arg,不匹配的参数:类型为{0}而值为{1},Mismatched parameter: type {0} and value {1},パラメータの不一致:型{0}と値{1}。
\ No newline at end of file
diff --git a/prefab/weapons/staffOfTheUndead.tscn b/prefab/weapons/staffOfTheUndead.tscn
index ffd1bb0..01d4dc3 100644
--- a/prefab/weapons/staffOfTheUndead.tscn
+++ b/prefab/weapons/staffOfTheUndead.tscn
@@ -15,9 +15,8 @@ collision_layer = 8
collision_mask = 34
script = ExtResource("1_w8hhv")
ProjectileScenes = [ExtResource("2_34250")]
-Id = "staff_of_the_undead"
FiringIntervalAsMillisecond = 300
-metadata/Projectiles = PackedStringArray("res://prefab/projectile/curseOfTheUndead.tscn")
+Id = "staff_of_the_undead"
[node name="DamageArea2D" type="Area2D" parent="."]
collision_layer = 8
diff --git a/scripts/item/ItemTypeRegister.cs b/scripts/item/ItemTypeRegister.cs
index 00b20f2..dcad2c2 100644
--- a/scripts/item/ItemTypeRegister.cs
+++ b/scripts/item/ItemTypeRegister.cs
@@ -22,7 +22,7 @@ public static class ItemTypeRegister
/// 在这里注册物品
///
public static void StaticRegister() { }
-
+
///
/// Register items from yaml file
/// 从文件注册物品
@@ -66,7 +66,7 @@ public static class ItemTypeRegister
//Read & deserialize
var yamlString = yamlFile.GetAsText();
var typeInfos = deserializer.Deserialize>(yamlString);
-
+
yamlFile.Close();
return typeInfos;
}
@@ -76,7 +76,7 @@ public static class ItemTypeRegister
//Load scene and icon
var scene = ResourceLoader.Load(typeInfo.ScenePath);
var icon = ResourceLoader.Load(typeInfo.IconPath);
-
+
//Create init delegate
Func newItemFunc;
if (typeInfo.CustomArgs is null or [])
@@ -104,7 +104,8 @@ public static class ItemTypeRegister
var itemType = new ItemType(typeInfo.Id,
newItemFunc,
icon, typeInfo.MaxStackValue);
- ItemTypeManager.Register(itemType);
+ var succeed = ItemTypeManager.Register(itemType);
+ LogCat.LogWithFormat("register_item", itemType.Id, succeed);
}
//Use for yaml deserialization
diff --git a/scripts/item/weapon/WeaponTemplate.cs b/scripts/item/weapon/WeaponTemplate.cs
index 2f89f65..d323f0e 100644
--- a/scripts/item/weapon/WeaponTemplate.cs
+++ b/scripts/item/weapon/WeaponTemplate.cs
@@ -1,4 +1,5 @@
using System;
+
using ColdMint.scripts.character;
using ColdMint.scripts.pickable;
using ColdMint.scripts.damage;
@@ -14,6 +15,7 @@ namespace ColdMint.scripts.item.weapon;
public abstract partial class WeaponTemplate : PickAbleTemplate
{
private float _gravity = ProjectSettings.GetSetting("physics/2d/default_gravity").AsSingle();
+
public override void Use(Node2D? owner, Vector2 targetGlobalPosition)
{
Fire(owner, targetGlobalPosition);
@@ -49,16 +51,7 @@ public abstract partial class WeaponTemplate : PickAbleTemplate
///
[Export] private Vector2 _recoil;
- public override void _Ready()
- {
-
- }
-
-
-
-
-
-
+ public override void _Ready() { }
///
/// Discharge of the weapon
diff --git a/scripts/loot/LootEntry.cs b/scripts/loot/LootEntry.cs
index 77a834b..c4d9ea4 100644
--- a/scripts/loot/LootEntry.cs
+++ b/scripts/loot/LootEntry.cs
@@ -55,10 +55,9 @@ public readonly record struct LootGroup(double Chance, IEnumerable En
foreach (var e in Entries)
{
w -= e.Weight;
- if (w < 0)
- {
- entry = e;
- }
+ if (w >= 0) continue;
+ entry = e;
+ break;
}
var quantity = random.Next(entry.MinQuantity, entry.MaxQuantity + 1);
diff --git a/scripts/loot/LootRegister.cs b/scripts/loot/LootRegister.cs
index 4ccd9da..208b8ec 100644
--- a/scripts/loot/LootRegister.cs
+++ b/scripts/loot/LootRegister.cs
@@ -14,13 +14,13 @@ public static class LootRegister
if (Config.IsDebug())
{
IList lootGroups = [];
+ lootGroups.Add(new LootGroup(0.8,
+ [
+ new LootEntry("degraded_staff_of_the_undead", weight: 2), new LootEntry("staff_of_the_undead")
+ ]));
lootGroups.Add(new LootGroup(1,
[
- new LootEntry("packsack", weight: 2), new LootEntry("staff_of_the_undead", minQuantity: 2, maxQuantity: 4)
- ]));
- lootGroups.Add(new LootGroup(0.3,
- [
- new LootEntry("packsack")
+ new LootEntry("packsack", minQuantity: 2, maxQuantity: 4)
]));
var testLootList = new LootList(Config.LootListId.Test, lootGroups);
diff --git a/scripts/pickable/PickAbleTemplate.cs b/scripts/pickable/PickAbleTemplate.cs
index 36e2da3..0de8019 100644
--- a/scripts/pickable/PickAbleTemplate.cs
+++ b/scripts/pickable/PickAbleTemplate.cs
@@ -1,8 +1,10 @@
using System;
+
using ColdMint.scripts.camp;
using ColdMint.scripts.character;
using ColdMint.scripts.damage;
using ColdMint.scripts.item;
+
using Godot;
namespace ColdMint.scripts.pickable;
@@ -14,12 +16,12 @@ namespace ColdMint.scripts.pickable;
public partial class PickAbleTemplate : RigidBody2D, IItem
{
[Export] public virtual string Id { get; set; } = "ID";
- protected Texture2D? UniqueIcon { get; set; }
+ [Export] protected Texture2D? UniqueIcon { get; set; }
public Texture2D Icon => UniqueIcon ?? ItemTypeManager.DefaultIconOf(Id);
- protected string? UniqueName { get; set; }
+ [Export] protected string? UniqueName { get; set; }
public new string Name => UniqueName ?? ItemTypeManager.DefaultNameOf(Id);
- protected string? UniqueDescription { get; set; }
-
+ [Export] protected string? UniqueDescription { get; set; }
+
///
/// Owner
/// 主人
@@ -55,9 +57,7 @@ public partial class PickAbleTemplate : RigidBody2D, IItem
///
public bool Picked { get; set; }
- public virtual void Use(Node2D? owner, Vector2 targetGlobalPosition)
- {
- }
+ public virtual void Use(Node2D? owner, Vector2 targetGlobalPosition) { }
public override void _Ready()
{
@@ -124,7 +124,7 @@ public partial class PickAbleTemplate : RigidBody2D, IItem
//Determine if your side can cause damage
//判断所属的阵营是否可以造成伤害
var canCauseHarm = CampManager.CanCauseHarm(CampManager.GetCamp(ownerCharacterTemplate.CampId),
- CampManager.GetCamp(characterTemplate.CampId));
+ CampManager.GetCamp(characterTemplate.CampId));
if (!canCauseHarm)
{
return;
@@ -147,8 +147,8 @@ public partial class PickAbleTemplate : RigidBody2D, IItem
LinearVelocity *= 1 - Config.ThrownItemsHitEnemiesReduceSpeedByPercentage;
}
}
-
-
+
+
///
/// Flip item
/// 翻转物品