添加遗漏的升级钩子

This commit is contained in:
milimoe 2025-07-08 23:51:33 +08:00
parent 72d29cff5f
commit 86066ba0f0
Signed by: milimoe
GPG Key ID: 9554D37E4B8991D0
2 changed files with 18 additions and 0 deletions

View File

@ -1190,6 +1190,7 @@ namespace Milimoe.FunGame.Core.Entity
/// <param name="checkLevelBreak"></param> /// <param name="checkLevelBreak"></param>
public void OnLevelUp(int level = 0, bool checkLevelBreak = true) public void OnLevelUp(int level = 0, bool checkLevelBreak = true)
{ {
bool isUp = false;
int count = 0; int count = 0;
while (true) while (true)
{ {
@ -1213,6 +1214,7 @@ namespace Milimoe.FunGame.Core.Entity
{ {
EXP -= need; EXP -= need;
Level++; Level++;
isUp = true;
OnAttributeChanged(); OnAttributeChanged();
Recovery(); Recovery();
} }
@ -1221,6 +1223,14 @@ namespace Milimoe.FunGame.Core.Entity
break; break;
} }
} }
if (isUp)
{
Effect[] effects = [.. Effects.Where(e => e.IsInEffect)];
foreach (Effect e in effects)
{
e.OnOwnerLevelUp(this, Level);
}
}
} }
/// <summary> /// <summary>

View File

@ -288,6 +288,14 @@ namespace Milimoe.FunGame.Core.Entity
} }
} }
} }
if (Level > 0 && Character != null)
{
Effect[] effects = [.. Character.Effects.Where(e => e.IsInEffect)];
foreach (Effect e in effects)
{
e.OnSkillLevelUp(Character, Level);
}
}
} }
/// <summary> /// <summary>