mirror of
https://github.com/project-redbud/FunGame-Core.git
synced 2026-01-19 22:18:23 +00:00
修复混战终局判断问题;添加更多治疗钩子
This commit is contained in:
parent
44d5ffd3f7
commit
787b5a12e0
@ -455,10 +455,10 @@ namespace Milimoe.FunGame.Core.Entity
|
|||||||
/// <param name="character"></param>
|
/// <param name="character"></param>
|
||||||
/// <param name="hr"></param>
|
/// <param name="hr"></param>
|
||||||
/// <param name="mr"></param>
|
/// <param name="mr"></param>
|
||||||
/// <returns>返回 true 取消回复</returns>
|
/// <returns>返回 false 取消回复</returns>
|
||||||
public virtual bool BeforeApplyRecoveryAtTimeLapsing(Character character, ref double hr, ref double mr)
|
public virtual bool BeforeApplyRecoveryAtTimeLapsing(Character character, ref double hr, ref double mr)
|
||||||
{
|
{
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -498,7 +498,20 @@ namespace Milimoe.FunGame.Core.Entity
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 在治疗结算前修改治疗值
|
/// 在治疗结算前触发
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="actor"></param>
|
||||||
|
/// <param name="target"></param>
|
||||||
|
/// <param name="heal"></param>
|
||||||
|
/// <param name="canRespawn"></param>
|
||||||
|
/// <returns>返回 false 取消治疗</returns>
|
||||||
|
public virtual bool BeforeHealToTarget(Character actor, Character target, double heal, bool canRespawn)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 在 <see cref="BeforeHealToTarget"/> 后、治疗结算前修改治疗值
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="actor"></param>
|
/// <param name="actor"></param>
|
||||||
/// <param name="target"></param>
|
/// <param name="target"></param>
|
||||||
@ -786,6 +799,19 @@ namespace Milimoe.FunGame.Core.Entity
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 当角色触发生命偷取前
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="character"></param>
|
||||||
|
/// <param name="enemy"></param>
|
||||||
|
/// <param name="damage"></param>
|
||||||
|
/// <param name="steal"></param>
|
||||||
|
/// <returns>返回 false 取消生命偷取</returns>
|
||||||
|
public virtual bool BeforeLifesteal(Character character, Character enemy, double damage, double steal)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 当角色触发生命偷取后
|
/// 当角色触发生命偷取后
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@ -787,7 +787,7 @@ namespace Milimoe.FunGame.Core.Model
|
|||||||
Effect[] effects = [.. character.Effects];
|
Effect[] effects = [.. character.Effects];
|
||||||
foreach (Effect effect in effects)
|
foreach (Effect effect in effects)
|
||||||
{
|
{
|
||||||
if (effect.BeforeApplyRecoveryAtTimeLapsing(character, ref reallyReHP, ref reallyReMP))
|
if (!effect.BeforeApplyRecoveryAtTimeLapsing(character, ref reallyReHP, ref reallyReMP))
|
||||||
{
|
{
|
||||||
allowRecovery = false;
|
allowRecovery = false;
|
||||||
}
|
}
|
||||||
@ -1979,7 +1979,7 @@ namespace Milimoe.FunGame.Core.Model
|
|||||||
/// <param name="assists"></param>
|
/// <param name="assists"></param>
|
||||||
protected virtual void AfterDeathCalculation(Character death, Character? killer, Character[] assists)
|
protected virtual void AfterDeathCalculation(Character death, Character? killer, Character[] assists)
|
||||||
{
|
{
|
||||||
if (!_queue.Any(c => c != killer && c.Master != killer && killer?.Master != c))
|
if (!_queue.Any(c => c != killer && (c.Master is null || c.Master != killer)))
|
||||||
{
|
{
|
||||||
// 没有其他的角色了,游戏结束
|
// 没有其他的角色了,游戏结束
|
||||||
if (killer != null)
|
if (killer != null)
|
||||||
@ -2358,12 +2358,24 @@ namespace Milimoe.FunGame.Core.Model
|
|||||||
|
|
||||||
// 生命偷取
|
// 生命偷取
|
||||||
double steal = actualDamage * actor.Lifesteal;
|
double steal = actualDamage * actor.Lifesteal;
|
||||||
|
bool allowSteal = true;
|
||||||
|
effects = [.. characters.SelectMany(c => c.Effects.Where(e => e.IsInEffect)).Distinct()];
|
||||||
|
foreach (Effect effect in effects)
|
||||||
|
{
|
||||||
|
if (!effect.BeforeLifesteal(actor, enemy, damage, steal))
|
||||||
|
{
|
||||||
|
allowSteal = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (allowSteal)
|
||||||
|
{
|
||||||
HealToTarget(actor, actor, steal, false, true);
|
HealToTarget(actor, actor, steal, false, true);
|
||||||
effects = [.. characters.SelectMany(c => c.Effects.Where(e => e.IsInEffect)).Distinct()];
|
effects = [.. characters.SelectMany(c => c.Effects.Where(e => e.IsInEffect)).Distinct()];
|
||||||
foreach (Effect effect in effects)
|
foreach (Effect effect in effects)
|
||||||
{
|
{
|
||||||
effect.AfterLifesteal(actor, enemy, damage, steal);
|
effect.AfterLifesteal(actor, enemy, damage, steal);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 造成伤害和受伤都可以获得能量。护盾抵消的伤害不算
|
// 造成伤害和受伤都可以获得能量。护盾抵消的伤害不算
|
||||||
double ep = GetEP(actualDamage, GameplayEquilibriumConstant.DamageGetEPFactor, GameplayEquilibriumConstant.DamageGetEPMax);
|
double ep = GetEP(actualDamage, GameplayEquilibriumConstant.DamageGetEPFactor, GameplayEquilibriumConstant.DamageGetEPMax);
|
||||||
@ -2681,13 +2693,28 @@ namespace Milimoe.FunGame.Core.Model
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool allowHealing = true;
|
||||||
|
List<Effect> effects = [.. actor.Effects.Union(target.Effects).Distinct().Where(e => e.IsInEffect)];
|
||||||
|
foreach (Effect effect in effects)
|
||||||
|
{
|
||||||
|
if (!effect.BeforeHealToTarget(actor, target, heal, canRespawn))
|
||||||
|
{
|
||||||
|
allowHealing = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!allowHealing)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
bool isDead = target.HP <= 0;
|
bool isDead = target.HP <= 0;
|
||||||
string healString = $"【{heal:0.##}(基础)";
|
string healString = $"【{heal:0.##}(基础)";
|
||||||
|
|
||||||
if (triggerEffects)
|
if (triggerEffects)
|
||||||
{
|
{
|
||||||
Dictionary<Effect, double> totalHealBonus = [];
|
Dictionary<Effect, double> totalHealBonus = [];
|
||||||
List<Effect> effects = [.. actor.Effects.Union(target.Effects).Distinct().Where(e => e.IsInEffect)];
|
effects = [.. actor.Effects.Union(target.Effects).Distinct().Where(e => e.IsInEffect)];
|
||||||
foreach (Effect effect in effects)
|
foreach (Effect effect in effects)
|
||||||
{
|
{
|
||||||
bool changeCanRespawn = false;
|
bool changeCanRespawn = false;
|
||||||
|
|||||||
@ -23,7 +23,7 @@ namespace Milimoe.FunGame.Core.Model
|
|||||||
.Select(kv => $"[ {kv.Key} ] {kv.Value.Kills} 分"))}\r\n剩余存活人数:{_queue.Count}");
|
.Select(kv => $"[ {kv.Key} ] {kv.Value.Kills} 分"))}\r\n剩余存活人数:{_queue.Count}");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_queue.Any(c => c != killer && c.Master != killer && killer?.Master != c && killer?.Master != c.Master))
|
if (!_queue.Any(c => c != killer && (c.Master is null || c.Master != killer)))
|
||||||
{
|
{
|
||||||
// 没有其他的角色了,游戏结束
|
// 没有其他的角色了,游戏结束
|
||||||
EndGameInfo(killer);
|
EndGameInfo(killer);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user