道具逻辑片段更新参数描述

This commit is contained in:
小李xl 2024-03-22 20:50:27 +08:00
parent 69df2d7619
commit 1bac8dffdf
42 changed files with 444 additions and 321 deletions

View File

@ -6,7 +6,7 @@
"Buff": null,
"Condition": {
"HpFull": [
0
true
]
},
"Effect": {
@ -27,7 +27,7 @@
"Buff": null,
"Condition": {
"AmmoFull": [
0
true
]
},
"Effect": {
@ -103,7 +103,7 @@
"Buff": null,
"Condition": {
"HpFull": [
0
true
],
"Gold": [
"\u003E=",

View File

@ -8,31 +8,22 @@ namespace Config;
public static partial class ExcelConfig
{
/// <summary>
/// BuffPropBase.xlsx表数据集合, 以 List 形式存储, 数据顺序与 Excel 表相同
/// ActivePropBase.xlsx表数据集合, 以 List 形式存储, 数据顺序与 Excel 表相同
/// </summary>
public static List<BuffPropBase> BuffPropBase_List { get; private set; }
public static List<ActivePropBase> ActivePropBase_List { get; private set; }
/// <summary>
/// BuffPropBase.xlsx表数据集合, 里 Map 形式存储, key 为 Id
/// ActivePropBase.xlsx表数据集合, 里 Map 形式存储, key 为 Id
/// </summary>
public static Dictionary<string, BuffPropBase> BuffPropBase_Map { get; private set; }
public static Dictionary<string, ActivePropBase> ActivePropBase_Map { get; private set; }
/// <summary>
/// Sound.xlsx表数据集合, 以 List 形式存储, 数据顺序与 Excel 表相同
/// ActivityBase.xlsx表数据集合, 以 List 形式存储, 数据顺序与 Excel 表相同
/// </summary>
public static List<Sound> Sound_List { get; private set; }
public static List<ActivityBase> ActivityBase_List { get; private set; }
/// <summary>
/// Sound.xlsx表数据集合, 里 Map 形式存储, key 为 Id
/// ActivityBase.xlsx表数据集合, 里 Map 形式存储, key 为 Id
/// </summary>
public static Dictionary<string, Sound> Sound_Map { get; private set; }
/// <summary>
/// WeaponBase.xlsx表数据集合, 以 List 形式存储, 数据顺序与 Excel 表相同
/// </summary>
public static List<WeaponBase> WeaponBase_List { get; private set; }
/// <summary>
/// WeaponBase.xlsx表数据集合, 里 Map 形式存储, key 为 Id
/// </summary>
public static Dictionary<string, WeaponBase> WeaponBase_Map { get; private set; }
public static Dictionary<string, ActivityBase> ActivityBase_Map { get; private set; }
/// <summary>
/// ActivityMaterial.xlsx表数据集合, 以 List 形式存储, 数据顺序与 Excel 表相同
@ -52,6 +43,15 @@ public static partial class ExcelConfig
/// </summary>
public static Dictionary<string, AiAttackAttr> AiAttackAttr_Map { get; private set; }
/// <summary>
/// BuffPropBase.xlsx表数据集合, 以 List 形式存储, 数据顺序与 Excel 表相同
/// </summary>
public static List<BuffPropBase> BuffPropBase_List { get; private set; }
/// <summary>
/// BuffPropBase.xlsx表数据集合, 里 Map 形式存储, key 为 Id
/// </summary>
public static Dictionary<string, BuffPropBase> BuffPropBase_Map { get; private set; }
/// <summary>
/// BulletBase.xlsx表数据集合, 以 List 形式存储, 数据顺序与 Excel 表相同
/// </summary>
@ -61,15 +61,6 @@ public static partial class ExcelConfig
/// </summary>
public static Dictionary<string, BulletBase> BulletBase_Map { get; private set; }
/// <summary>
/// ActivePropBase.xlsx表数据集合, 以 List 形式存储, 数据顺序与 Excel 表相同
/// </summary>
public static List<ActivePropBase> ActivePropBase_List { get; private set; }
/// <summary>
/// ActivePropBase.xlsx表数据集合, 里 Map 形式存储, key 为 Id
/// </summary>
public static Dictionary<string, ActivePropBase> ActivePropBase_Map { get; private set; }
/// <summary>
/// EnemyBase.xlsx表数据集合, 以 List 形式存储, 数据顺序与 Excel 表相同
/// </summary>
@ -79,15 +70,6 @@ public static partial class ExcelConfig
/// </summary>
public static Dictionary<string, EnemyBase> EnemyBase_Map { get; private set; }
/// <summary>
/// ActivityBase.xlsx表数据集合, 以 List 形式存储, 数据顺序与 Excel 表相同
/// </summary>
public static List<ActivityBase> ActivityBase_List { get; private set; }
/// <summary>
/// ActivityBase.xlsx表数据集合, 里 Map 形式存储, key 为 Id
/// </summary>
public static Dictionary<string, ActivityBase> ActivityBase_Map { get; private set; }
/// <summary>
/// LiquidMaterial.xlsx表数据集合, 以 List 形式存储, 数据顺序与 Excel 表相同
/// </summary>
@ -97,6 +79,24 @@ public static partial class ExcelConfig
/// </summary>
public static Dictionary<string, LiquidMaterial> LiquidMaterial_Map { get; private set; }
/// <summary>
/// Sound.xlsx表数据集合, 以 List 形式存储, 数据顺序与 Excel 表相同
/// </summary>
public static List<Sound> Sound_List { get; private set; }
/// <summary>
/// Sound.xlsx表数据集合, 里 Map 形式存储, key 为 Id
/// </summary>
public static Dictionary<string, Sound> Sound_Map { get; private set; }
/// <summary>
/// WeaponBase.xlsx表数据集合, 以 List 形式存储, 数据顺序与 Excel 表相同
/// </summary>
public static List<WeaponBase> WeaponBase_List { get; private set; }
/// <summary>
/// WeaponBase.xlsx表数据集合, 里 Map 形式存储, key 为 Id
/// </summary>
public static Dictionary<string, WeaponBase> WeaponBase_Map { get; private set; }
private static bool _init = false;
/// <summary>
@ -107,75 +107,57 @@ public static partial class ExcelConfig
if (_init) return;
_init = true;
_InitBuffPropBaseConfig();
_InitSoundConfig();
_InitWeaponBaseConfig();
_InitActivePropBaseConfig();
_InitActivityBaseConfig();
_InitActivityMaterialConfig();
_InitAiAttackAttrConfig();
_InitBuffPropBaseConfig();
_InitBulletBaseConfig();
_InitActivePropBaseConfig();
_InitEnemyBaseConfig();
_InitActivityBaseConfig();
_InitLiquidMaterialConfig();
_InitSoundConfig();
_InitWeaponBaseConfig();
_InitBuffPropBaseRef();
_InitWeaponBaseRef();
_InitActivePropBaseRef();
_InitEnemyBaseRef();
_InitActivityBaseRef();
_InitBuffPropBaseRef();
_InitEnemyBaseRef();
_InitWeaponBaseRef();
}
private static void _InitBuffPropBaseConfig()
private static void _InitActivePropBaseConfig()
{
try
{
var text = _ReadConfigAsText("res://resource/config/BuffPropBase.json");
BuffPropBase_List = new List<BuffPropBase>(JsonSerializer.Deserialize<List<Ref_BuffPropBase>>(text));
BuffPropBase_Map = new Dictionary<string, BuffPropBase>();
foreach (var item in BuffPropBase_List)
var text = _ReadConfigAsText("res://resource/config/ActivePropBase.json");
ActivePropBase_List = new List<ActivePropBase>(JsonSerializer.Deserialize<List<Ref_ActivePropBase>>(text));
ActivePropBase_Map = new Dictionary<string, ActivePropBase>();
foreach (var item in ActivePropBase_List)
{
BuffPropBase_Map.Add(item.Id, item);
ActivePropBase_Map.Add(item.Id, item);
}
}
catch (Exception e)
{
GD.PrintErr(e.ToString());
throw new Exception("初始化表'BuffPropBase'失败!");
throw new Exception("初始化表'ActivePropBase'失败!");
}
}
private static void _InitSoundConfig()
private static void _InitActivityBaseConfig()
{
try
{
var text = _ReadConfigAsText("res://resource/config/Sound.json");
Sound_List = JsonSerializer.Deserialize<List<Sound>>(text);
Sound_Map = new Dictionary<string, Sound>();
foreach (var item in Sound_List)
var text = _ReadConfigAsText("res://resource/config/ActivityBase.json");
ActivityBase_List = new List<ActivityBase>(JsonSerializer.Deserialize<List<Ref_ActivityBase>>(text));
ActivityBase_Map = new Dictionary<string, ActivityBase>();
foreach (var item in ActivityBase_List)
{
Sound_Map.Add(item.Id, item);
ActivityBase_Map.Add(item.Id, item);
}
}
catch (Exception e)
{
GD.PrintErr(e.ToString());
throw new Exception("初始化表'Sound'失败!");
}
}
private static void _InitWeaponBaseConfig()
{
try
{
var text = _ReadConfigAsText("res://resource/config/WeaponBase.json");
WeaponBase_List = new List<WeaponBase>(JsonSerializer.Deserialize<List<Ref_WeaponBase>>(text));
WeaponBase_Map = new Dictionary<string, WeaponBase>();
foreach (var item in WeaponBase_List)
{
WeaponBase_Map.Add(item.Id, item);
}
}
catch (Exception e)
{
GD.PrintErr(e.ToString());
throw new Exception("初始化表'WeaponBase'失败!");
throw new Exception("初始化表'ActivityBase'失败!");
}
}
private static void _InitActivityMaterialConfig()
@ -214,6 +196,24 @@ public static partial class ExcelConfig
throw new Exception("初始化表'AiAttackAttr'失败!");
}
}
private static void _InitBuffPropBaseConfig()
{
try
{
var text = _ReadConfigAsText("res://resource/config/BuffPropBase.json");
BuffPropBase_List = new List<BuffPropBase>(JsonSerializer.Deserialize<List<Ref_BuffPropBase>>(text));
BuffPropBase_Map = new Dictionary<string, BuffPropBase>();
foreach (var item in BuffPropBase_List)
{
BuffPropBase_Map.Add(item.Id, item);
}
}
catch (Exception e)
{
GD.PrintErr(e.ToString());
throw new Exception("初始化表'BuffPropBase'失败!");
}
}
private static void _InitBulletBaseConfig()
{
try
@ -232,24 +232,6 @@ public static partial class ExcelConfig
throw new Exception("初始化表'BulletBase'失败!");
}
}
private static void _InitActivePropBaseConfig()
{
try
{
var text = _ReadConfigAsText("res://resource/config/ActivePropBase.json");
ActivePropBase_List = new List<ActivePropBase>(JsonSerializer.Deserialize<List<Ref_ActivePropBase>>(text));
ActivePropBase_Map = new Dictionary<string, ActivePropBase>();
foreach (var item in ActivePropBase_List)
{
ActivePropBase_Map.Add(item.Id, item);
}
}
catch (Exception e)
{
GD.PrintErr(e.ToString());
throw new Exception("初始化表'ActivePropBase'失败!");
}
}
private static void _InitEnemyBaseConfig()
{
try
@ -268,24 +250,6 @@ public static partial class ExcelConfig
throw new Exception("初始化表'EnemyBase'失败!");
}
}
private static void _InitActivityBaseConfig()
{
try
{
var text = _ReadConfigAsText("res://resource/config/ActivityBase.json");
ActivityBase_List = new List<ActivityBase>(JsonSerializer.Deserialize<List<Ref_ActivityBase>>(text));
ActivityBase_Map = new Dictionary<string, ActivityBase>();
foreach (var item in ActivityBase_List)
{
ActivityBase_Map.Add(item.Id, item);
}
}
catch (Exception e)
{
GD.PrintErr(e.ToString());
throw new Exception("初始化表'ActivityBase'失败!");
}
}
private static void _InitLiquidMaterialConfig()
{
try
@ -304,7 +268,81 @@ public static partial class ExcelConfig
throw new Exception("初始化表'LiquidMaterial'失败!");
}
}
private static void _InitSoundConfig()
{
try
{
var text = _ReadConfigAsText("res://resource/config/Sound.json");
Sound_List = JsonSerializer.Deserialize<List<Sound>>(text);
Sound_Map = new Dictionary<string, Sound>();
foreach (var item in Sound_List)
{
Sound_Map.Add(item.Id, item);
}
}
catch (Exception e)
{
GD.PrintErr(e.ToString());
throw new Exception("初始化表'Sound'失败!");
}
}
private static void _InitWeaponBaseConfig()
{
try
{
var text = _ReadConfigAsText("res://resource/config/WeaponBase.json");
WeaponBase_List = new List<WeaponBase>(JsonSerializer.Deserialize<List<Ref_WeaponBase>>(text));
WeaponBase_Map = new Dictionary<string, WeaponBase>();
foreach (var item in WeaponBase_List)
{
WeaponBase_Map.Add(item.Id, item);
}
}
catch (Exception e)
{
GD.PrintErr(e.ToString());
throw new Exception("初始化表'WeaponBase'失败!");
}
}
private static void _InitActivePropBaseRef()
{
foreach (Ref_ActivePropBase item in ActivePropBase_List)
{
try
{
if (!string.IsNullOrEmpty(item.__Activity))
{
item.Activity = ActivityBase_Map[item.__Activity];
}
}
catch (Exception e)
{
GD.PrintErr(e.ToString());
throw new Exception("初始化'ActivePropBase'引用其他表数据失败, 当前行id: " + item.Id);
}
}
}
private static void _InitActivityBaseRef()
{
foreach (Ref_ActivityBase item in ActivityBase_List)
{
try
{
if (!string.IsNullOrEmpty(item.__Material))
{
item.Material = ActivityMaterial_Map[item.__Material];
}
}
catch (Exception e)
{
GD.PrintErr(e.ToString());
throw new Exception("初始化'ActivityBase'引用其他表数据失败, 当前行id: " + item.Id);
}
}
}
private static void _InitBuffPropBaseRef()
{
foreach (Ref_BuffPropBase item in BuffPropBase_List)
@ -324,6 +362,25 @@ public static partial class ExcelConfig
}
}
}
private static void _InitEnemyBaseRef()
{
foreach (Ref_EnemyBase item in EnemyBase_List)
{
try
{
if (!string.IsNullOrEmpty(item.__Activity))
{
item.Activity = ActivityBase_Map[item.__Activity];
}
}
catch (Exception e)
{
GD.PrintErr(e.ToString());
throw new Exception("初始化'EnemyBase'引用其他表数据失败, 当前行id: " + item.Id);
}
}
}
private static void _InitWeaponBaseRef()
{
foreach (Ref_WeaponBase item in WeaponBase_List)
@ -392,63 +449,6 @@ public static partial class ExcelConfig
}
}
}
private static void _InitActivePropBaseRef()
{
foreach (Ref_ActivePropBase item in ActivePropBase_List)
{
try
{
if (!string.IsNullOrEmpty(item.__Activity))
{
item.Activity = ActivityBase_Map[item.__Activity];
}
}
catch (Exception e)
{
GD.PrintErr(e.ToString());
throw new Exception("初始化'ActivePropBase'引用其他表数据失败, 当前行id: " + item.Id);
}
}
}
private static void _InitEnemyBaseRef()
{
foreach (Ref_EnemyBase item in EnemyBase_List)
{
try
{
if (!string.IsNullOrEmpty(item.__Activity))
{
item.Activity = ActivityBase_Map[item.__Activity];
}
}
catch (Exception e)
{
GD.PrintErr(e.ToString());
throw new Exception("初始化'EnemyBase'引用其他表数据失败, 当前行id: " + item.Id);
}
}
}
private static void _InitActivityBaseRef()
{
foreach (Ref_ActivityBase item in ActivityBase_List)
{
try
{
if (!string.IsNullOrEmpty(item.__Material))
{
item.Material = ActivityMaterial_Map[item.__Material];
}
}
catch (Exception e)
{
GD.PrintErr(e.ToString());
throw new Exception("初始化'ActivityBase'引用其他表数据失败, 当前行id: " + item.Id);
}
}
}
private static string _ReadConfigAsText(string path)
{
var file = FileAccess.Open(path, FileAccess.ModeFlags.Read);

View File

@ -1,6 +1,4 @@
using System;
/// <summary>
/// 被动属性逻辑基类
/// </summary>

View File

@ -1,21 +1,12 @@
using System;
/// <summary>
/// buff片段
/// </summary>
[AttributeUsage(AttributeTargets.Class)]
public class BuffFragmentAttribute : Attribute
public class BuffFragmentAttribute : FragmentAttribute
{
/// <summary>
/// Buff属性名称
/// </summary>
public string BuffName { get; set; }
/// <summary>
/// 描述
/// </summary>
public string Description { get; set; }
public BuffFragmentAttribute(string buffName, string description)
public BuffFragmentAttribute(string name, string description) : base(name, description)
{
BuffName = buffName;
Description = description;
}
}

View File

@ -1,21 +1,12 @@
using System;
/// <summary>
/// 充能片段
/// </summary>
[AttributeUsage(AttributeTargets.Class)]
public class ChargeFragmentAttribute : Attribute
public class ChargeFragmentAttribute : FragmentAttribute
{
/// <summary>
/// 充能属性名称
/// </summary>
public string ChargeName { get; set; }
/// <summary>
/// 描述
/// </summary>
public string Description { get; set; }
public ChargeFragmentAttribute(string chargeName, string description)
public ChargeFragmentAttribute(string name, string description) : base(name, description)
{
ChargeName = chargeName;
Description = description;
}
}

View File

@ -1,22 +1,13 @@
using System;
/// <summary>
/// 条件片段
/// </summary>
[AttributeUsage(AttributeTargets.Class)]
public class ConditionFragmentAttribute : Attribute
public class ConditionFragmentAttribute : FragmentAttribute
{
/// <summary>
/// 条件名称
/// </summary>
public string ConditionName { get; set; }
/// <summary>
/// 描述
/// </summary>
public string Description { get; set; }
public ConditionFragmentAttribute(string conditionName, string description)
public ConditionFragmentAttribute(string name, string description) : base(name, description)
{
ConditionName = conditionName;
Description = description;
}
}

View File

@ -1,21 +1,12 @@
using System;
/// <summary>
/// 主动效果片段
/// </summary>
[AttributeUsage(AttributeTargets.Class)]
public class EffectFragmentAttribute : Attribute
public class EffectFragmentAttribute : FragmentAttribute
{
/// <summary>
/// 效果名称
/// </summary>
public string EffectName { get; set; }
/// <summary>
/// 描述
/// </summary>
public string Description { get; set; }
public EffectFragmentAttribute(string effectName, string description)
public EffectFragmentAttribute(string name, string description) : base(name, description)
{
EffectName = effectName;
Description = description;
}
}

View File

@ -0,0 +1,63 @@
using System;
/// <summary>
/// 属性逻辑基类
/// </summary>
public abstract class FragmentAttribute : Attribute
{
/// <summary>
/// 属性名称
/// </summary>
public string Name { get; set; }
/// <summary>
/// 描述
/// </summary>
public string Description { get; set; }
/// <summary>
/// 参数1 描述
/// </summary>
public string Arg1 { get; set; }
/// <summary>
/// 参数2 描述
/// </summary>
public string Arg2 { get; set; }
/// <summary>
/// 参数3 描述
/// </summary>
public string Arg3 { get; set; }
/// <summary>
/// 参数4 描述
/// </summary>
public string Arg4 { get; set; }
/// <summary>
/// 参数5 描述
/// </summary>
public string Arg5 { get; set; }
/// <summary>
/// 参数6 描述
/// </summary>
public string Arg6 { get; set; }
/// <summary>
/// 参数7 描述
/// </summary>
public string Arg7 { get; set; }
/// <summary>
/// 参数8 描述
/// </summary>
public string Arg8 { get; set; }
public FragmentAttribute(string name, string description)
{
Name = name;
Description = description;
}
}

View File

@ -1,7 +1,11 @@
using System.Text.Json;
[BuffFragment("ActivePropsCapacity", "主动道具背包容量 buff, 参数1为主动道具背包增加的容量")]
[BuffFragment(
"ActivePropsCapacity",
"主动道具背包容量 buff",
Arg1 = "(int)主动道具背包增加的容量"
)]
public class Buff_ActivePropsCapacity : BuffFragment
{
private int _value;

View File

@ -1,7 +1,10 @@
using System.Text.Json;
[BuffFragment("BulletBounceCount", "子弹弹射数量 buff, 参数1为增加的弹射次数")]
[BuffFragment(
"BulletBounceCount", "子弹弹射数量 buff",
Arg1 = "(int)子弹增加的弹射次数"
)]
public class Buff_BulletBounceCount : BuffFragment
{
private int _value;

View File

@ -2,10 +2,12 @@
using System.Text.Json;
using Godot;
[BuffFragment("BulletCount",
"子弹数量 buff, " +
"参数1为子弹数量添加类型, 1: 具体数量, 2:百分比(小数), " +
"参数2为增加子弹的数量")]
[BuffFragment(
"BulletCount",
"子弹数量 buff, ",
Arg1 = "(int)子弹数量添加类型, 1: 具体数量, 2:百分比",
Arg2 = "(float)增加子弹的数量"
)]
public class Buff_BulletCount : BuffFragment
{
private int _type;

View File

@ -2,10 +2,12 @@
using System.Text.Json;
using Godot;
[BuffFragment("BulletDamage",
"提升子弹伤害buff, " +
"参数1为伤害增加类型: 1:具体伤害, 2:百分比伤害(小数), " +
"参数2为增益伤害值")]
[BuffFragment(
"BulletDamage",
"提升子弹伤害buff, ",
Arg1 = "(int)伤害增加类型: 1:具体伤害, 2:百分比伤害",
Arg2 = "(float)增益伤害值"
)]
public class Buff_BulletDamage : BuffFragment
{
private int _type;

View File

@ -1,10 +1,12 @@
using System.Text.Json;
[BuffFragment("BulletDeviationAngle",
"子弹偏移角度 buff, " +
"参数1为增加子弹偏移角度下限, " +
"参数2为增加子弹偏移角度上限, 单位角度制, 会从上限和下限随机抽取值")]
[BuffFragment(
"BulletDeviationAngle",
"子弹偏移角度 buff, 单位角度制, 会从上限和下限随机抽取值",
Arg1 = "(float)增加子弹偏移角度下限",
Arg2 = "(float)增加子弹偏移角度上限"
)]
public class Buff_BulletDeviationAngle : BuffFragment
{
private float _min;

View File

@ -1,10 +1,12 @@
using System.Text.Json;
[BuffFragment("BulletDistance",
"子弹射程 buff, " +
"参数1为射程增加类型: 1:具体射程, 2:百分比射程(小数), " +
"参数2为子弹增加的射程值")]
[BuffFragment(
"BulletDistance",
"子弹射程 buff, ",
Arg1 = "(int)子弹射程增加类型: 1:具体射程, 2:百分比射程",
Arg2 = "(float)子弹增加的射程值"
)]
public class Buff_BulletDistance : BuffFragment
{
private int _type;

View File

@ -1,7 +1,11 @@
using System.Text.Json;
[BuffFragment("BulletPenetration", "子弹穿透次数 buff, 参数1为增加的穿透次数")]
[BuffFragment(
"BulletPenetration",
"子弹穿透次数 buff",
Arg1 = "(int)子弹增加的穿透次数"
)]
public class Buff_BulletPenetration : BuffFragment
{
private int _value;

View File

@ -2,10 +2,12 @@
using System.Text.Json;
using Godot;
[BuffFragment("BulletRepel",
"子弹击退 buff, " +
"参数1为击退增加类型: 1:具体击退值, 2:百分比击退值(小数), " +
"参数2为子弹增加的击退值")]
[BuffFragment(
"BulletRepel",
"子弹击退 buff, ",
Arg1 = "(int)击退增加类型: 1:具体击退值, 2:百分比击退值",
Arg2 = "(float)子弹增加的击退值"
)]
public class Buff_BulletRepel : BuffFragment
{
private int _type;

View File

@ -1,10 +1,12 @@
using System.Text.Json;
[BuffFragment("BulletSpeed",
"子弹速度 buff, " +
"参数1为射速增加类型: 1:具体射速, 2:百分比射速(小数), " +
"参数2为子弹增加的射速值")]
[BuffFragment(
"BulletSpeed",
"子弹速度 buff, ",
Arg1 = "(int)子弹速度增加类型: 1:具体速度, 2:百分比速度",
Arg2 = "(float)子弹增加的速度值"
)]
public class Buff_BulletSpeed : BuffFragment
{
private int _type;

View File

@ -2,9 +2,12 @@
using System.Text.Json;
using Godot;
[BuffFragment("GetGold", "计算获取的金币buff, " +
"参数1为金币数量添加类型, 1: 具体数量, 2:百分比(小数), " +
"参数2为增加金币的数量值")]
[BuffFragment(
"GetGold",
"计算获取的金币buff, ",
Arg1 = "(int)金币数量添加类型, 1: 具体数量, 2:百分比",
Arg2 = "(float)增加金币的数量值"
)]
public class Buff_GetGold : BuffFragment
{
private int _type;

View File

@ -2,7 +2,11 @@
using System.Collections.Generic;
using System.Text.Json;
[BuffFragment("MaxHp", "血量上限 buff, 参数1为血量上限值")]
[BuffFragment(
"MaxHp",
"增加血量上限 buff",
Arg1 = "(int)增加血量上限值"
)]
public class Buff_MaxHp : BuffFragment
{
private List<ulong> _cacheId = new List<ulong>();

View File

@ -2,7 +2,11 @@
using System.Collections.Generic;
using System.Text.Json;
[BuffFragment("MaxShield", "护盾上限buff, 参数1为护盾上限")]
[BuffFragment(
"MaxShield",
"增加护盾上限buff",
Arg1 = "(int)增加的护盾上限值"
)]
public class Buff_MaxShield : BuffFragment
{
private List<ulong> _cacheId = new List<ulong>();

View File

@ -1,7 +1,11 @@
using System.Text.Json;
[BuffFragment("MoveSpeed", "移速 buff, 参数1为移动速度值")]
[BuffFragment(
"MoveSpeed",
"增加移速 buff",
Arg1 = "(float)增加的移动速度值"
)]
public class Buff_MoveSpeed : BuffFragment
{
private float _moveSpeed;

View File

@ -1,7 +1,11 @@
using System.Text.Json;
[BuffFragment("OffsetInjury", "受伤时有概率抵消伤害的buff, 参数1为抵消伤害概率百分比(小数)")]
[BuffFragment(
"OffsetInjury",
"受伤时有概率抵消伤害的 buff",
Arg1 = "(float)抵消伤害概率百分比"
)]
public class Buff_OffsetInjury : BuffFragment
{
private float _value;

View File

@ -1,10 +1,12 @@
using System.Text.Json;
[BuffFragment("RandomBulletSpeed",
"子弹增加随机速度 buff, " +
"参数1为增加子弹速度下限, " +
"参数2为增加子弹速度上限, 会从上限和下限随机抽取值")]
[BuffFragment(
"RandomBulletSpeed",
"子弹增加随机速度 buff, 会从上限和下限随机抽取值",
Arg1 = "(float)增加子弹速度下限",
Arg2 = "(float)增加子弹速度上限"
)]
public class Buff_RandomBulletSpeed : BuffFragment
{
private float _min;

View File

@ -2,7 +2,11 @@
using System.Text.Json;
using Godot;
[BuffFragment("Scattering", "提高武器精准度buff, 参数1为提升的精准度百分比值(小数)")]
[BuffFragment(
"Scattering",
"提高武器精准度 buff",
Arg1 = "(float)精准度提升百分比值"
)]
public class Buff_Scattering : BuffFragment
{
private float _value;

View File

@ -1,7 +1,11 @@
using System.Text.Json;
[BuffFragment("ShieldRecoveryTime", "单格护盾减少的恢复时间, 参数1单位: 秒")]
[BuffFragment(
"ShieldRecoveryTime",
"单格护盾减少的恢复时间, 单位: 秒",
Arg1 = "(float)单格护盾减少的恢复时间"
)]
public class Buff_ShieldRecoveryTime : BuffFragment
{
private float _time;

View File

@ -1,7 +1,11 @@
using System.Text.Json;
[BuffFragment("WeaponCapacity", "武器背包容量 buff, 参数1为武器背包增加的容量")]
[BuffFragment(
"WeaponCapacity",
"武器背包容量 buff",
Arg1 = "(int)武器背包增加的容量"
)]
public class Buff_WeaponCapacity : BuffFragment
{
private int _value;

View File

@ -1,7 +1,11 @@
using System.Text.Json;
[BuffFragment("WoundedInvincibleTime", "延长无敌时间buff, 参数1为延长时间, 单位秒")]
[BuffFragment(
"WoundedInvincibleTime",
"延长无敌时间 buff, 单位秒",
Arg1 = "(float)延长时间"
)]
public class Buff_WoundedInvincibleTime : BuffFragment
{
private float _time;

View File

@ -1,7 +1,11 @@
using System.Text.Json;
[ChargeFragment("EnterRoom", "玩家第一次进入某个房间充能, 该条充能件仅对玩家生效, 参数1为进入房间充能量(0-1)")]
[ChargeFragment(
"EnterRoom",
"玩家第一次进入某个房间充能, 该条充能件仅对玩家生效",
Arg1 = "(float)充能量, 范围内0-1"
)]
public class Cha_EnterRoom : ChargeFragment
{
private float _value = 0.2f;

View File

@ -1,8 +1,11 @@
using System.Text.Json;
[ChargeFragment("Hurt",
"造成伤害充能, 参数1为充满能量需要造成的伤害值")]
[ChargeFragment(
"Hurt",
"造成伤害充能",
Arg1 = "(int)充满能量需要造成的伤害值"
)]
public class Cha_Hurt : ChargeFragment
{
private int _value = 100;

View File

@ -1,16 +1,18 @@
using System.Text.Json;
[ConditionFragment("AmmoFull",
"判断当前武器弹药状态, " +
"参数1可选值: 0:判断非满弹药, 1:判断满弹药")]
[ConditionFragment(
"AmmoFull",
"判断当前武器弹药状态, ",
Arg1 = "(boolean)是否判断满弹药"
)]
public class Cond_AmmoFull : ConditionFragment
{
private int _type;
private bool _type;
public override void InitParam(JsonElement[] arg)
{
_type = arg[0].GetInt32();
_type = arg[0].GetBoolean();
}
public override bool OnCheckUse()
@ -19,7 +21,7 @@ public class Cond_AmmoFull : ConditionFragment
{
return false;
}
if (_type == 0)
if (_type)
{
return !Role.WeaponPack.ActiveItem.IsAmmoFull();
}

View File

@ -1,10 +1,12 @@
using System.Text.Json;
[ConditionFragment("Gold",
"判断金币数量, " +
"参数1为判断条件符号, 分别为: >, <, =, >=, <=; " +
"参数2为比较的值")]
[ConditionFragment(
"Gold",
"判断金币数量, ",
Arg1 = "(string)判断条件符号, 分别为: >, <, =, >=, <=",
Arg2 = "(int)比较的值"
)]
public class Cond_Gold : ConditionFragment
{
private string _symbol;

View File

@ -1,9 +1,11 @@
using System.Text.Json;
[ConditionFragment("Hp",
"判断血量, " +
"参数1为判断条件符号, 分别为: >, <, =, >=, <=; " +
"参数2为比较的值")]
[ConditionFragment(
"Hp",
"判断血量, ",
Arg1 = "(string)判断条件符号, 分别为: >, <, =, >=, <=",
Arg2 = "(int)比较的值"
)]
public class Cond_Hp : ConditionFragment
{
private string _symbol;

View File

@ -1,21 +1,23 @@
using System.Text.Json;
[ConditionFragment("HpFull",
"判断满血状态, " +
"参数1可选值: 0:判断非满血, 1:判断满血")]
[ConditionFragment(
"HpFull",
"判断满血状态, ",
Arg1 = "(boolean)判断非满血"
)]
public class Cond_HpFull : ConditionFragment
{
private int _type;
private bool _type;
public override void InitParam(JsonElement[] arg)
{
_type = arg[0].GetInt32();
_type = arg[0].GetBoolean();
}
public override bool OnCheckUse()
{
if (_type == 0)
if (_type)
{
return !Role.IsHpFull();
}

View File

@ -3,9 +3,11 @@ using System.Collections.Generic;
using System.Text.Json;
using Godot;
[EffectFragment("AreaTrigger",
"触发附近地上的武器开火, " +
"参数1为最大作用半径, ")]
[EffectFragment(
"AreaTrigger",
"触发附近地上的武器开火, ",
Arg1 = "(int)最大作用半径"
)]
public class Eff_AreaTrigger : EffectFragment
{
private Prop5003Area _areaNode;

View File

@ -1,7 +1,11 @@
using System.Text.Json;
[EffectFragment("ChangeHp", "修改血量, 参数1为血量变化的具体值")]
[EffectFragment(
"ChangeHp",
"修改血量",
Arg1 = "(int)血量变化的具体值"
)]
public class Eff_ChangeHp : EffectFragment
{
private int _value;

View File

@ -3,7 +3,11 @@
using System.Text.Json;
using Godot;
[EffectFragment("GetGold", "获得金币, 参数1为金币的值")]
[EffectFragment(
"GetGold",
"获得金币",
Arg1 = "(int)金币的值"
)]
public class Eff_GetGold : EffectFragment
{
private int _value;

View File

@ -2,7 +2,11 @@
using System.Text.Json;
using Godot;
[EffectFragment("PiggyBank", "存钱罐, 使用后返还存入的金币, 参数1为返还金币的倍率(小数)")]
[EffectFragment(
"PiggyBank",
"存钱罐, 使用后返还存入的金币",
Arg1 = "(float)返还金币的倍率, 范围0-1"
)]
public class Eff_PiggyBank : EffectFragment
{
private float _value;

View File

@ -1,7 +1,10 @@
using System.Collections.Generic;
using System.Text.Json;
[EffectFragment("SwapWeapon", "随机选择房间内的一个手持武器的敌人, 交换你们手中的武器, 无参数")]
[EffectFragment(
"SwapWeapon",
"随机选择房间内的一个手持武器的敌人, 交换你们手中的武器"
)]
public class Eff_SwapWeapon : EffectFragment
{
public override void InitParam(JsonElement[] args)

View File

@ -1,9 +1,11 @@
using System.Text.Json;
[EffectFragment("TotalAmmo",
"修改武器总弹药量, " +
"参数1(选填)为弹药变化的具体值, 如果不传则表示补满弹药")]
[EffectFragment(
"TotalAmmo",
"修改武器总弹药量, ",
Arg1 = "(int|null)弹药变化的具体值, 如果不传则表示补满弹药"
)]
public class Eff_TotalAmmo : EffectFragment
{
private bool _initParam = false;

View File

@ -2,7 +2,11 @@
using System.Text.Json;
[EffectFragment("UseGold", "使用金币, 参数1为金币的值")]
[EffectFragment(
"UseGold",
"使用金币",
Arg1 = "(int)消耗金币的值"
)]
public class Eff_UseGold : EffectFragment
{
private int _value;

View File

@ -47,14 +47,14 @@ public class PropFragmentRegister
var attribute = (BuffFragmentAttribute)type.GetCustomAttribute(typeof(BuffFragmentAttribute), false);
if (attribute != null)
{
if (BuffFragmentInfos.ContainsKey(attribute.BuffName))
if (BuffFragmentInfos.ContainsKey(attribute.Name))
{
GD.PrintErr($"Buff '{attribute.BuffName}' 重名!");
GD.PrintErr($"Buff '{attribute.Name}' 重名!");
continue;
}
var buffInfo = new PropFragmentInfo(attribute.BuffName, attribute.Description, type);
BuffFragmentInfos.Add(attribute.BuffName, buffInfo);
var buffInfo = new PropFragmentInfo(attribute.Name, attribute.Description, type);
BuffFragmentInfos.Add(attribute.Name, buffInfo);
}
}
//包含[ConditionAttribute]特性
@ -65,14 +65,14 @@ public class PropFragmentRegister
var attribute = (ConditionFragmentAttribute)type.GetCustomAttribute(typeof(ConditionFragmentAttribute), false);
if (attribute != null)
{
if (ConditionFragmentInfos.ContainsKey(attribute.ConditionName))
if (ConditionFragmentInfos.ContainsKey(attribute.Name))
{
GD.PrintErr($"Condition '{attribute.ConditionName}' 重名!");
GD.PrintErr($"Condition '{attribute.Name}' 重名!");
continue;
}
var conditionInfo = new PropFragmentInfo(attribute.ConditionName, attribute.Description, type);
ConditionFragmentInfos.Add(attribute.ConditionName, conditionInfo);
var conditionInfo = new PropFragmentInfo(attribute.Name, attribute.Description, type);
ConditionFragmentInfos.Add(attribute.Name, conditionInfo);
}
}
//包含[EffectAttribute]特性
@ -83,14 +83,14 @@ public class PropFragmentRegister
var attribute = (EffectFragmentAttribute)type.GetCustomAttribute(typeof(EffectFragmentAttribute), false);
if (attribute != null)
{
if (EffectFragmentInfos.ContainsKey(attribute.EffectName))
if (EffectFragmentInfos.ContainsKey(attribute.Name))
{
GD.PrintErr($"Effect '{attribute.EffectName}' 重名!");
GD.PrintErr($"Effect '{attribute.Name}' 重名!");
continue;
}
var effectInfo = new PropFragmentInfo(attribute.EffectName, attribute.Description, type);
EffectFragmentInfos.Add(attribute.EffectName, effectInfo);
var effectInfo = new PropFragmentInfo(attribute.Name, attribute.Description, type);
EffectFragmentInfos.Add(attribute.Name, effectInfo);
}
}
//包含[ChargeAttribute]特性
@ -101,14 +101,14 @@ public class PropFragmentRegister
var attribute = (ChargeFragmentAttribute)type.GetCustomAttribute(typeof(ChargeFragmentAttribute), false);
if (attribute != null)
{
if (ChargeFragmentInfos.ContainsKey(attribute.ChargeName))
if (ChargeFragmentInfos.ContainsKey(attribute.Name))
{
GD.PrintErr($"Charge '{attribute.ChargeName}' 重名!");
GD.PrintErr($"Charge '{attribute.Name}' 重名!");
continue;
}
var chargeInfo = new PropFragmentInfo(attribute.ChargeName, attribute.Description, type);
ChargeFragmentInfos.Add(attribute.ChargeName, chargeInfo);
var chargeInfo = new PropFragmentInfo(attribute.Name, attribute.Description, type);
ChargeFragmentInfos.Add(attribute.Name, chargeInfo);
}
}
}