卡牌更新
This commit is contained in:
@@ -15,11 +15,7 @@ namespace Continentis.MainGame.Base
|
||||
public partial class EditorBaseCollection : BaseCollection<EditorBaseCollection>
|
||||
{
|
||||
[Title("角色")]
|
||||
[Tooltip("核心属性\nKey 为词条 ID(如 Strength),Value 为词条中文描述(如 力量)")]
|
||||
[SerializedDictionarySettings("Key", "Description")]
|
||||
public SerializedDictionary<string, string> characterCoreAttributes = new SerializedDictionary<string, string>();
|
||||
|
||||
[Tooltip("通用与状态属性\nKey 为词条 ID(如 Health),Value 为词条中文描述(如 角色生命值)")]
|
||||
[Tooltip("角色属性\nKey 为词条 ID(如 Health),Value 为词条中文描述(如 角色生命值)")]
|
||||
[SerializedDictionarySettings("Key", "Description")]
|
||||
public SerializedDictionary<string, string> characterGeneralAttributes = new SerializedDictionary<string, string>();
|
||||
|
||||
@@ -81,15 +77,6 @@ namespace Continentis.MainGame.Base
|
||||
|
||||
foreach (var coll in GetAllCollections())
|
||||
{
|
||||
if (coll.characterCoreAttributes != null)
|
||||
{
|
||||
allItems.AddRange(coll.characterCoreAttributes.Select(kvp => new ValueDropdownItem<string>
|
||||
{
|
||||
Text = $"{kvp.Key} ({kvp.Value})",
|
||||
Value = kvp.Key
|
||||
}));
|
||||
}
|
||||
|
||||
if (coll.characterGeneralAttributes != null)
|
||||
{
|
||||
allItems.AddRange(coll.characterGeneralAttributes.Select(kvp => new ValueDropdownItem<string>
|
||||
@@ -176,24 +163,8 @@ namespace Continentis.MainGame.Base
|
||||
sb.AppendLine($" public static class {className}");
|
||||
sb.AppendLine(" {");
|
||||
|
||||
// 生成核心属性
|
||||
sb.AppendLine(" // ── 核心属性 (Core) ──────────────────────────────────");
|
||||
if (characterCoreAttributes != null)
|
||||
{
|
||||
foreach (var kvp in characterCoreAttributes)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(kvp.Key)) continue;
|
||||
if (!string.IsNullOrWhiteSpace(kvp.Value))
|
||||
{
|
||||
sb.AppendLine($" /// <summary> {kvp.Value} </summary>");
|
||||
}
|
||||
sb.AppendLine($" public const string {kvp.Key} = \"{kvp.Key}\";");
|
||||
sb.AppendLine();
|
||||
}
|
||||
}
|
||||
|
||||
// 生成通用属性
|
||||
sb.AppendLine(" // ── 通用属性 (General) ───────────────────────────────");
|
||||
// 生成属性
|
||||
sb.AppendLine(" // ── 属性 (General) ───────────────────────────────");
|
||||
if (characterGeneralAttributes != null)
|
||||
{
|
||||
foreach (var kvp in characterGeneralAttributes)
|
||||
|
||||
@@ -12,77 +12,4 @@ namespace Continentis.MainGame
|
||||
public class GameAttributeCollectionAttribute : Attribute
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 游戏通用属性名称常量。
|
||||
/// 请始终使用此类中的常量而非裸字符串访问属性,以避免 typo 错误。
|
||||
/// </summary>
|
||||
[GameAttributeCollection]
|
||||
public static class GameAttributes
|
||||
{
|
||||
// ── 生命值 ──────────────────────────────────
|
||||
public const string Health = "Health";
|
||||
public const string MaximumHealth = "MaximumHealth";
|
||||
|
||||
// ── 资源 ────────────────────────────────────
|
||||
public const string Stamina = "Stamina";
|
||||
public const string MaximumStamina = "MaximumStamina";
|
||||
public const string StaminaRecoverPerAction = "StaminaRecoverPerAction";
|
||||
public const string Mana = "Mana";
|
||||
public const string MaximumMana = "MaximumMana";
|
||||
public const string ManaRecoverPerAction = "ManaRecoverPerAction";
|
||||
|
||||
// ── 防御 ────────────────────────────────────
|
||||
public const string Block = "Block";
|
||||
public const string TemporaryHealth = "TemporaryHealth";
|
||||
public const string Dodge = "Dodge";
|
||||
|
||||
public const string BlockGainOffset = "BlockGainOffset";
|
||||
public const string BlockGainMultiplier = "BlockGainMultiplier";
|
||||
public const string DodgeGainOffset = "DodgeGainOffset";
|
||||
public const string DodgeGainMultiplier = "DodgeGainMultiplier";
|
||||
public const string TemporaryHealthGainOffset = "TemporaryHealthGainOffset";
|
||||
public const string TemporaryHealthGainMultiplier = "TemporaryHealthGainMultiplier";
|
||||
|
||||
public const string KeepBlockOnActionStart = "KeepBlockOnActionStart";
|
||||
public const string KeepDodgeOnActionStart = "KeepDodgeOnActionStart";
|
||||
|
||||
// ── 速度与行动 ──────────────────────────────
|
||||
public const string Speed = "Speed";
|
||||
public const string DrawCardAmountPerAction = "DrawCardAmountPerAction";
|
||||
public const string DeckCapacity = "DeckCapacity";
|
||||
|
||||
// ── 伤害调整(通用)──────────────────────────
|
||||
public const string PhysicsDamageDealtOffset = "PhysicsDamageDealtOffset";
|
||||
public const string MagicDamageDealtOffset = "MagicDamageDealtOffset";
|
||||
public const string FinalDamageDealtMultiplier = "FinalDamageDealtMultiplier";
|
||||
public const string FinalDamageGainMultiplier = "FinalDamageGainMultiplier";
|
||||
public const string MagicDamageDealtMultiplier = "MagicDamageDealtMultiplier";
|
||||
public const string MagicDamageGainMultiplier = "MagicDamageGainMultiplier";
|
||||
|
||||
// ── 核心属性(角色创建时)──────────────────────
|
||||
public const string Strength = "Strength";
|
||||
public const string Agility = "Agility";
|
||||
public const string Intelligence = "Intelligence";
|
||||
public const string Physique = "Physique";
|
||||
public const string Perception = "Perception";
|
||||
public const string Charisma = "Charisma";
|
||||
public const string Level = "Level";
|
||||
|
||||
// ── 感知与闪避检测 ──────────────────────────
|
||||
public const string Awareness = "Awareness";
|
||||
public const string DodgeCheckStartDamageMultiplier = "DodgeCheckStartDamageMultiplier";
|
||||
|
||||
#if UNITY_EDITOR
|
||||
/// <summary>
|
||||
/// 提供给 Odin Inspector [ValueDropdown] 使用的方法。
|
||||
/// 从所有 Mod 的 EditorBaseCollection 资产中聚合角色属性(Core + General),
|
||||
/// 覆盖旧的反射扫描方式,天然支持多 Mod 叠加,无需关心程序集加载顺序。
|
||||
/// </summary>
|
||||
public static IEnumerable<Sirenix.OdinInspector.ValueDropdownItem<string>> GetAllAvailableAttributes()
|
||||
{
|
||||
return Continentis.MainGame.Base.EditorBaseCollection.GetCharacterAttributesDropdown(null);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,9 +54,9 @@ namespace Continentis.MainGame
|
||||
{
|
||||
private static string GetAttribute(CardInstance card, string attributeName, bool higherIsBetter, bool inPercent)
|
||||
{
|
||||
string displayName = "Display" + attributeName;
|
||||
string baseName = "Base" + attributeName;
|
||||
string baseOffsetName = "Base" + attributeName + "Offset";
|
||||
string displayName = "Display_" + attributeName;
|
||||
string baseName = "Base_" + attributeName;
|
||||
string baseOffsetName = "Base_" + attributeName + "_Offset";
|
||||
|
||||
if (!inPercent)
|
||||
{
|
||||
@@ -74,7 +74,7 @@ namespace Continentis.MainGame
|
||||
|
||||
private static string GetAttribute(CardInstance card, string attributeName, bool inPercent)
|
||||
{
|
||||
string displayName = "Display" + attributeName;
|
||||
string displayName = "Display_" + attributeName;
|
||||
int displayValue = card.GetAttribute(displayName);
|
||||
return DynamicTextInterpreter.GetValue(displayValue, inPercent);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user