星露谷模组开发教程#8 自定义武器

添加武器还是比较简单的,只需要在 Data/Weapons 中添加一个新的武器数据即可。

这里做一张16x16格式为png的图。

TheLastSword

if (e.Name.IsEquivalentTo("Data/Weapons"))
{
    e.Edit(assets =>
    {
        var dict = assets.AsDictionary<string, WeaponData>();
        dict.Data["Awesome_TheLastSword"] = new WeaponData
        {
            Name = "Awesome_TheLastSword",
            DisplayName = "The Last Sword",
            Description = "The Last Sword You Will Ever Need",
            MinDamage = 999,
            MaxDamage = 999,
            CritChance = 1,
            CanBeLostOnDeath = false,
            Texture = "Awesome_TheLastSword"
        };
    });
}
if (e.Name.IsEquivalentTo("Awesome_TheLastSword"))
{
    e.LoadFromModFile<Texture2D>("assets/TheLastSword.png", AssetLoadPriority.Medium);
}

20240811004219

20240811004201