Fixed a bug where the last item always looted in the same loot group
修复了同一个掉落组中总是掉落最后一项的bug
This commit is contained in:
parent
703c19d09f
commit
ced2618a5e
|
@ -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: 劣化的死灵法杖
|
||||
|
|
|
@ -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}。
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
|||
/// </remarks>
|
||||
[Export] private Vector2 _recoil;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public override void _Ready() { }
|
||||
|
||||
/// <summary>
|
||||
/// <para>Discharge of the weapon</para>
|
||||
|
|
|
@ -55,10 +55,9 @@ public readonly record struct LootGroup(double Chance, IEnumerable<LootEntry> 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);
|
||||
|
|
|
@ -14,13 +14,13 @@ public static class LootRegister
|
|||
if (Config.IsDebug())
|
||||
{
|
||||
IList<LootGroup> 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);
|
||||
|
|
|
@ -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,11 +16,11 @@ 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; }
|
||||
|
||||
/// <summary>
|
||||
/// <para>Owner</para>
|
||||
|
@ -55,9 +57,7 @@ public partial class PickAbleTemplate : RigidBody2D, IItem
|
|||
/// </summary>
|
||||
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;
|
||||
|
|
Loading…
Reference in New Issue
Block a user