添加 CharacterEffectControlTypes

This commit is contained in:
milimoe 2024-09-12 00:32:38 +08:00
parent 42e5042154
commit dc008b1d95
Signed by: milimoe
GPG Key ID: 05D280912DA6C69E
3 changed files with 30 additions and 24 deletions

View File

@ -958,7 +958,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
{ {
money += (coefficient + 1) * new Random().Next(100, 200); money += (coefficient + 1) * new Random().Next(100, 200);
string termination = CharacterSet.GetContinuousKilling(coefficient); string termination = CharacterSet.GetContinuousKilling(coefficient);
string msg = $"[ {killer} ] 终结了 [ {death} ] {(termination != "" ? " " + termination : "")},获得 {money} 金钱!"; string msg = $"[ {killer} ] 终结了 [ {death} ]{(termination != "" ? " " + termination : "")},获得 {money} 金钱!";
if (assists.Length > 1) if (assists.Length > 1)
{ {
msg += "助攻:[ " + string.Join(" ] / [ ", assists.Where(c => c != killer)) + " ]"; msg += "助攻:[ " + string.Join(" ] / [ ", assists.Where(c => c != killer)) + " ]";

View File

@ -137,12 +137,17 @@ namespace Milimoe.FunGame.Core.Entity
public CharacterState CharacterState { get; set; } = CharacterState.Actionable; public CharacterState CharacterState { get; set; } = CharacterState.Actionable;
/// <summary> /// <summary>
/// 角色目前被特效施加的状态 /// 角色目前被特效施加的状态 [ 用于设置角色是否被控制的状态 ]
/// </summary> /// </summary>
public Dictionary<Effect, CharacterState> CharacterEffectStates { get; } = []; public Dictionary<Effect, List<CharacterState>> CharacterEffectStates { get; } = [];
/// <summary> /// <summary>
/// 角色是否是中立的/无敌的 [ 战斗相关 ] /// 角色目前被特效施加的控制效果 [ 用于特效判断是否需要在移除特效时更改角色状态 ]
/// </summary>
public Dictionary<Effect, List<EffectControlType>> CharacterEffectControlTypes { get; } = [];
/// <summary>
/// 角色是否是中立的 [ 战斗相关 ]
/// </summary> /// </summary>
public bool IsNeutral { get; set; } = false; public bool IsNeutral { get; set; } = false;
@ -976,7 +981,7 @@ namespace Milimoe.FunGame.Core.Entity
if (IsNeutral) if (IsNeutral)
{ {
builder.AppendLine("角色是无敌的"); builder.AppendLine("角色是中立单位,处于无敌状态");
} }
if (IsUnselectable) if (IsUnselectable)
@ -1009,25 +1014,16 @@ namespace Milimoe.FunGame.Core.Entity
bool isBattleRestricted = false; bool isBattleRestricted = false;
bool isSkillRestricted = false; bool isSkillRestricted = false;
foreach (CharacterState state in CharacterEffectStates.Values) IEnumerable<CharacterState> states = CharacterEffectStates.Values.SelectMany(list => list);
{ // 根据持有的特效判断角色所处的状态
if (state == CharacterState.NotActionable) isNotActionable = states.Any(state => state == CharacterState.NotActionable);
{ isActionRestricted = states.Any(state => state == CharacterState.ActionRestricted);
isNotActionable = true; isBattleRestricted = states.Any(state => state == CharacterState.BattleRestricted);
} isSkillRestricted = states.Any(state => state == CharacterState.SkillRestricted);
else if (state == CharacterState.ActionRestricted)
{ IEnumerable<EffectControlType> types = CharacterEffectControlTypes.Values.SelectMany(list => list);
isActionRestricted = true; // 判断角色的控制效果
} IsUnselectable = types.Any(type => type == EffectControlType.Unselectable);
else if (state == CharacterState.BattleRestricted)
{
isBattleRestricted = true;
}
else if (state == CharacterState.SkillRestricted)
{
isSkillRestricted = true;
}
}
bool isControl = isNotActionable || isActionRestricted || isBattleRestricted || isSkillRestricted; bool isControl = isNotActionable || isActionRestricted || isBattleRestricted || isSkillRestricted;
bool isCasting = CharacterState == CharacterState.Casting; bool isCasting = CharacterState == CharacterState.Casting;

View File

@ -213,6 +213,11 @@ namespace Milimoe.FunGame.Core.Library.Constant
/// </summary> /// </summary>
None, None,
/// <summary>
/// 标记,目标受到某些技能的标记
/// </summary>
Mark,
/// <summary> /// <summary>
/// 眩晕,目标无法行动 /// 眩晕,目标无法行动
/// </summary> /// </summary>
@ -313,6 +318,11 @@ namespace Milimoe.FunGame.Core.Library.Constant
/// </summary> /// </summary>
Invulnerable, Invulnerable,
/// <summary>
/// 不可选中,无法成为普攻和技能的目标
/// </summary>
Unselectable,
/// <summary> /// <summary>
/// 伤害提升,增加攻击输出 /// 伤害提升,增加攻击输出
/// </summary> /// </summary>