一些修复和优化
This commit is contained in:
@@ -9,6 +9,15 @@ using UnityEditor;
|
||||
[CreateAssetMenu(fileName = "NewAllyHero", menuName = "SO_Data/AllyHero")]
|
||||
public class AllyHero_SO : ScriptableObject
|
||||
{
|
||||
public enum AllyRolePosition
|
||||
{
|
||||
攻击,
|
||||
回血,
|
||||
回蓝,
|
||||
加分,
|
||||
综合
|
||||
}
|
||||
|
||||
private const string EquippedEquipmentSaveCategory = "ally_equipped_equipment";
|
||||
private const string EquippedEquipmentRecoverySlotPrefix = "ally_equipped_equipment_";
|
||||
|
||||
@@ -31,7 +40,13 @@ public class AllyHero_SO : ScriptableObject
|
||||
public string ally_heroDesignation;
|
||||
public int ally_heroID;
|
||||
public bool isUnlocked;
|
||||
[Header("Role Setup")]
|
||||
[InspectorName("所属阵营")]
|
||||
[Tooltip("Uses the same category list as equipment skill types.")]
|
||||
public equipmentSO.EquipmentSkillType allyType;
|
||||
[InspectorName("角色定位")]
|
||||
[Tooltip("Primary combat role used for configuration and display.")]
|
||||
public AllyRolePosition allyRolePosition = AllyRolePosition.综合;
|
||||
[Tooltip("Optional obsession tag used by memory skills such as 30011012. Leave empty to ignore mismatch checks.")]
|
||||
public string obsessionTag;
|
||||
|
||||
@@ -506,12 +521,57 @@ public class AllyHero_SO : ScriptableObject
|
||||
public string GetDisplayLevelRatingKey()
|
||||
{
|
||||
int displayIndex = GetDisplayLevelIndex();
|
||||
return DisplayLevelIndexToRatingKey(displayIndex);
|
||||
}
|
||||
|
||||
// 用外部传入的成长值(来自持久化账本 AllyHeroDeployLedger)计算等级评级,
|
||||
// 而不是读取 SO 上被打包烘焙的镜像字段。用于 teamSelector 等直接依赖账本真相的界面,
|
||||
// 避免"账本已加载但尚未回写 SO 镜像"窗口内读到过期的烘焙值。判级规则与 GetDisplayLevelRatingKey 完全一致。
|
||||
public string GetDisplayLevelRatingKeyFromGrowth(int currentExp, int unlockedTierIndex, bool levelLocked)
|
||||
{
|
||||
int displayIndex = ResolveDisplayLevelIndexFromGrowth(currentExp, unlockedTierIndex, levelLocked);
|
||||
return DisplayLevelIndexToRatingKey(displayIndex);
|
||||
}
|
||||
|
||||
private static string DisplayLevelIndexToRatingKey(int displayIndex)
|
||||
{
|
||||
if (displayIndex <= 0) return "C";
|
||||
if (displayIndex == 1) return "B";
|
||||
if (displayIndex == 2) return "A";
|
||||
return "S";
|
||||
}
|
||||
|
||||
private int ResolveDisplayLevelIndexFromGrowth(int currentExp, int unlockedTierIndex, bool levelLocked)
|
||||
{
|
||||
List<AllyLevelInfo> sorted = BuildSortedLevelStats();
|
||||
if (sorted == null || sorted.Count == 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
int safeExp = Mathf.Max(0, currentExp);
|
||||
int expQualifiedIndex = 0;
|
||||
for (int i = 0; i < sorted.Count; i++)
|
||||
{
|
||||
if (safeExp >= sorted[i].requiredEXP)
|
||||
{
|
||||
expQualifiedIndex = i;
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!levelLocked)
|
||||
{
|
||||
return expQualifiedIndex;
|
||||
}
|
||||
|
||||
int unlockedIndex = Mathf.Clamp(unlockedTierIndex, 0, sorted.Count - 1);
|
||||
return Mathf.Clamp(Mathf.Min(expQualifiedIndex, unlockedIndex), 0, sorted.Count - 1);
|
||||
}
|
||||
|
||||
public AllyLevelInfo GetEffectiveLevelForCurrentEXP()
|
||||
{
|
||||
List<AllyLevelInfo> sorted = BuildSortedLevelStats();
|
||||
@@ -656,7 +716,11 @@ public class AllyHero_SO : ScriptableObject
|
||||
total += SumEffectValues(equipment.typeSameEffects, effectType);
|
||||
}
|
||||
|
||||
total += SumEffectValues(equipment.maxLevelEffects, effectType);
|
||||
if (equipment.IsMaxLevelEffectActive())
|
||||
{
|
||||
total += SumEffectValues(equipment.maxLevelEffects, effectType);
|
||||
}
|
||||
|
||||
return total;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user