加入很多新内容,这波一块交了

This commit is contained in:
FloatGaming
2026-04-08 20:53:41 +08:00
parent d9376833b6
commit 85dfff28dd
128 changed files with 14546 additions and 474 deletions
+9 -2
View File
@@ -15,6 +15,7 @@ using TMPro;
/// </summary>
public class AllyCombatant : MonoBehaviour, ICombatant
{
private static AllyHero_SO[] cachedAllAllyHeroes;
public int slotIndex = 0; // Documentation text normalized.
// runtime stats
@@ -989,8 +990,8 @@ public class AllyCombatant : MonoBehaviour, ICombatant
if (id > 0)
{
var all = Resources.LoadAll<AllyHero_SO>("");
foreach (var a in all)
EnsureAllyHeroCache();
foreach (var a in cachedAllAllyHeroes)
{
if (a != null && a.ally_heroID == id)
{
@@ -1049,6 +1050,12 @@ public class AllyCombatant : MonoBehaviour, ICombatant
}
}
private static void EnsureAllyHeroCache()
{
if (cachedAllAllyHeroes != null) return;
cachedAllAllyHeroes = Resources.LoadAll<AllyHero_SO>("") ?? Array.Empty<AllyHero_SO>();
}
// Documentation text normalized.
private static AllyHero_SO.AllyLevelInfo GetEffectiveLevelForExp(AllyHero_SO so, int exp)
{
+58
View File
@@ -414,6 +414,8 @@ public class EnemyCombatant : MonoBehaviour, ICombatant
}
}
AwardBountyScoreToLivingAllies();
// Finally mark dead
isDead = true;
@@ -510,6 +512,62 @@ public class EnemyCombatant : MonoBehaviour, ICombatant
public bool IsDead => isDead;
// New: allow EffectSystem/SkillBuilder to adjust enemy max HP safely
private void AwardBountyScoreToLivingAllies()
{
if (sourceData == null)
return;
float difficultyLevel = ResolveCurrentDifficultyLevel();
var stats = sourceData.GetStatsByDifficultyID(_currentDifficultyID);
int calculatedMaxHp = Mathf.Max(0, stats.enemy_maxHP);
float totalBounty = calculatedMaxHp * 0.05f * difficultyLevel + sourceData.enemyBountyBonus;
if (totalBounty <= 0f)
return;
AllyCombatant[] allies = UnityEngine.Object.FindObjectsByType<AllyCombatant>(FindObjectsInactive.Include, FindObjectsSortMode.None);
List<AllyCombatant> livingAllies = new List<AllyCombatant>();
for (int i = 0; i < allies.Length; i++)
{
AllyCombatant ally = allies[i];
if (ally == null)
continue;
if (ally.IsDead || ally.maxHP <= 0 || !ally.gameObject.activeInHierarchy)
continue;
livingAllies.Add(ally);
}
if (livingAllies.Count == 0)
return;
int awardPerAlly = Mathf.CeilToInt(totalBounty / livingAllies.Count);
if (awardPerAlly <= 0)
return;
for (int i = 0; i < livingAllies.Count; i++)
{
livingAllies[i].AddScoreDirect(awardPerAlly);
}
}
private float ResolveCurrentDifficultyLevel()
{
BeatmapManager beatmapManager = BeatmapManager.Instance;
if (beatmapManager == null || beatmapManager.assignedSongData == null || beatmapManager.assignedSongData.chartFiles == null)
return 1f;
List<ChartFileEntry> chartFiles = beatmapManager.assignedSongData.chartFiles;
for (int i = 0; i < chartFiles.Count; i++)
{
ChartFileEntry entry = chartFiles[i];
if (entry == null || entry.difficulty != _currentDifficultyID)
continue;
return Mathf.Max(0f, entry.difficultyLEVEL);
}
return 1f;
}
public void SetMaxHP(int newMax, bool keepCurrentRatio = true)
{
if (newMax < 1) newMax = 1;