169 lines
5.8 KiB
C#
169 lines
5.8 KiB
C#
using UnityEngine;
|
|
using System.Collections.Generic;
|
|
|
|
[CreateAssetMenu(fileName = "NewAllyHero", menuName = "SO_Data/AllyHero")]
|
|
public class AllyHero_SO : ScriptableObject
|
|
{
|
|
[Header("友方英雄基本信息")]
|
|
public string ally_heroName;
|
|
public string ally_heroDesignation;
|
|
public int ally_heroID;
|
|
|
|
[Header("英雄立绘")]
|
|
public Sprite ally_heroImage;
|
|
[Header("英雄局内头像")]
|
|
public Sprite ally_heroProfile;
|
|
[Header("英雄选择界面头像")]
|
|
public Sprite ally_heroSelectIcon;
|
|
[Header("英雄轨道icon")]
|
|
public Sprite ally_heroIcon;
|
|
[Header("英雄编队界面海报")]
|
|
public Sprite ally_heroPoster;
|
|
[Header("角色带通道立绘")]
|
|
public Sprite ally_hero_HD_image;
|
|
|
|
[Header("主题色")]
|
|
public Color ally_heroThemeColor;
|
|
|
|
[Header("英雄简介")]
|
|
[TextArea(3, 10)]
|
|
[Tooltip("英雄的详细简介信息")]
|
|
public string ally_heroDescription;
|
|
|
|
[Header("等级属性列表")]
|
|
public List<AllyLevelInfo> levelStats = new List<AllyLevelInfo>();
|
|
|
|
[System.Serializable]
|
|
public class AllyLevelInfo
|
|
{
|
|
[Tooltip("等级名称或标识")]
|
|
public string levelName;
|
|
public int levelID;
|
|
|
|
[Tooltip("基础攻击力")]
|
|
public int attack = 0;
|
|
|
|
[Tooltip("最大生命值")]
|
|
public int maxHP = 100;
|
|
|
|
[Tooltip("伤害抗性 (0..1), 用于减少所受伤害")]
|
|
public float damageResistance = 0f;
|
|
|
|
[Tooltip("最大法力值")]
|
|
public int maxMana = 100;
|
|
|
|
[Tooltip("得分效率")]
|
|
public float scoreEfficiency = 1f;
|
|
|
|
[Header("升到本等级所需经验")]
|
|
[Tooltip("升到本等级所需经验")]
|
|
public int requiredEXP;
|
|
|
|
// --- 新增:每等级的共享音符击中参数(用于将来调整) ---
|
|
[Header("Note-hit shared parameters")]
|
|
[Tooltip("Good 判定时获得的法力值(整数)")]
|
|
public int manaGainGood = 1;
|
|
[Tooltip("Great 判定时获得的法力值(整数)")]
|
|
public int manaGainGreat = 2;
|
|
[Tooltip("Perfect 判定时获得的法力值(整数)")]
|
|
public int manaGainPerfect = 3;
|
|
[Tooltip("Miss 判定时获得的法力值(整数)")]
|
|
public int manaGainOnMiss = 5;
|
|
|
|
[Tooltip("Good 判定时基于英雄攻击力的伤害倍率,例如 0.5 表示造成 50% 的基础攻击力伤害")]
|
|
public float damageMultiplierGood = 0.5f;
|
|
[Tooltip("Great 判定时基于英雄攻击力的伤害倍率,例如 0.75 表示造成 75% 的基础攻击力伤害")]
|
|
public float damageMultiplierGreat = 0.75f;
|
|
[Tooltip("Perfect 判定时基于英雄攻击力的伤害倍率,例如 1.0 表示造成 100% 的基础攻击力伤害")]
|
|
public float damageMultiplierPerfect = 1f;
|
|
|
|
[Tooltip("Miss 时造成的基础生命损失基数。最终扣血将按 (missHpLossBase * (1 - damageResistance)) 计算,以考虑抗性")]
|
|
public float missHpLossBase = 10f;
|
|
}
|
|
|
|
[Header("当前经验")]
|
|
public int ally_currentEXP;
|
|
|
|
[Header("Skills")]
|
|
public SkillDefinition[] availableSkills;
|
|
[Tooltip("Indexes into availableSkills for preselected skills; empty means none selected")]
|
|
public int[] selectedSkillIndices = new int[0];
|
|
|
|
[Tooltip("Primary selected skill index into availableSkills (-1 = none)")]
|
|
public int primarySkillIndex = -1;
|
|
|
|
// --- 技能组逻辑(已修复) ---
|
|
|
|
[Tooltip("Skill groups defined on this hero. Each SkillGroup has a numeric skillGroupID which can be equipped into slots to allow activation of the entire group via that ID.")]
|
|
public SkillGroup[] skillGroups = new SkillGroup[0];
|
|
|
|
[Tooltip("Equipped skill group IDs for this ally. Each int references a skillGroupID defined in skillGroups. Use 0 to indicate empty.")]
|
|
public int[] equippedSkillGroupIDs = new int[0];
|
|
|
|
// --- 技能方法 ---
|
|
|
|
public SkillDefinition GetPrimarySkill()
|
|
{
|
|
if (availableSkills == null || primarySkillIndex < 0 || primarySkillIndex >= availableSkills.Length) return null;
|
|
return availableSkills[primarySkillIndex];
|
|
}
|
|
|
|
// Adjusted: primary group is no longer stored as an index; prefer the first equipped group ID, otherwise fall back to the first non-null defined group.
|
|
public SkillGroup GetPrimarySkillGroup()
|
|
{
|
|
if (skillGroups == null || skillGroups.Length == 0) return null;
|
|
|
|
// If equipped group IDs exist, prefer the first valid referenced group
|
|
if (equippedSkillGroupIDs != null && equippedSkillGroupIDs.Length > 0)
|
|
{
|
|
foreach (var gid in equippedSkillGroupIDs)
|
|
{
|
|
if (gid == 0) continue;
|
|
var g = GetSkillGroupByID(gid);
|
|
if (g != null) return g;
|
|
}
|
|
}
|
|
|
|
// Fallback: return first non-null skill group defined on the SO
|
|
foreach (var g in skillGroups)
|
|
{
|
|
if (g != null) return g;
|
|
}
|
|
|
|
return null;
|
|
}
|
|
|
|
// New helper: find a SkillGroup by its numeric skillGroupID
|
|
public SkillGroup GetSkillGroupByID(int groupID)
|
|
{
|
|
if (skillGroups == null || skillGroups.Length == 0) return null;
|
|
foreach (var g in skillGroups)
|
|
{
|
|
if (g != null && g.skillGroupID == groupID) return g;
|
|
}
|
|
return null;
|
|
}
|
|
|
|
// Return the AllyLevelInfo that corresponds to the current ally_currentEXP.
|
|
// Picks the highest level whose requiredEXP <= ally_currentEXP. If none match, returns levelStats[0] if present, otherwise null.
|
|
public AllyLevelInfo GetEffectiveLevelForCurrentEXP()
|
|
{
|
|
if (levelStats == null || levelStats.Count == 0) return null;
|
|
AllyLevelInfo best = null;
|
|
int currentExp = ally_currentEXP;
|
|
foreach (var lvl in levelStats)
|
|
{
|
|
if (lvl == null) continue;
|
|
if (best == null)
|
|
{
|
|
if (currentExp >= lvl.requiredEXP) best = lvl;
|
|
}
|
|
else
|
|
{
|
|
if (currentExp >= lvl.requiredEXP && lvl.requiredEXP >= best.requiredEXP) best = lvl;
|
|
}
|
|
}
|
|
if (best == null) return levelStats[0];
|
|
return best;
|
|
}
|
|
} |