public void AddExp(int nDamage, int nAtkLev, int nDefLev)
{
int nExp = BattleSystem.AdjustExp(nDamage, nAtkLev, nDefLev);
nExp = this.AdjustExp(nExp);
//发送获得经验公告
this.LeftNotice(string.Format(StringDefine.KILLEXP, nExp.ToString()));
//this.GetBaseAttr().exp += nExp;
this.ChangeAttribute(GameStruct.UserAttribute.EXP, nExp,false);
bool bChangeLevel = false;
while (true)
{
LevelExp exp = ConfigManager.Instance().GetLevelExp(GameStruct.LevelExp.LEVELEXP_ROLE, this.GetLevel());
if (exp != null)
{
if ((ulong)this.GetBaseAttr().exp >= exp.exp)
{
this.GetBaseAttr().exp -= (int)exp.exp;
this.GetBaseAttr().level += 1;
bChangeLevel = true;
}
else break;
}
else break; ;
}
if (bChangeLevel)
{
this.ChangeAttribute(GameStruct.UserAttribute.LEVEL, 0);
this.ChangeAttribute(GameStruct.UserAttribute.EXP, 0,false);
}
//出征与合体的幻兽也增加经验
this.GetEudemonSystem().AddExp(nExp);
}