主题
GameCore.Struct
AcquireSettings 双端
命名空间 GameCore.Struct
csharp
public class AcquireSettings技能的目标获取与自动施法配置。
备注
控制三种自动行为: SmartAcquire:手动施法指令缺少目标时,自动在范围内搜索并填充有效目标。 AutoCast:单位空闲时,周期性检查并自动对有效目标发起施法。 Recast:施法完成后立即尝试重新施法(连续施法)。 SmartAcquire 和 AutoCast 共享 TargetingFilters、AcquireRange 和 AcquireSorting。 仅 GameDataAbilityExecute 持有此配置。
构造函数
AcquireSettings 双端
csharp
public AcquireSettings()属性
AutoCast 双端
csharp
public bool AutoCast { get; set; }此技能是否支持自动施法模式。
备注
为 true 时,玩家可以在 UI 上切换自动施法开关(右键技能按钮)。 自动施法通过 AbilityManager 的 IThinkerStaggered 驱动,周期性搜索有效目标并下达 IsAuto 指令。
AutoCastOn 双端
csharp
public bool AutoCastOn { get; set; }技能被赋予时,自动施法是否默认开启。
备注
仅在 AutoCast 为 true 时有效。 运行时开关通过 IsAutoCastOn 控制。
AutoCastMovePolicy 双端
csharp
public AutoCastMovePolicy AutoCastMovePolicy { get; set; }自动施法遇到摇杆移动输入时的处理策略。
Recast 双端
csharp
public bool Recast { get; set; }施法完成后是否自动重新施法。
备注
为 true 时,施法完成后指令系统会自动重新下达带 DoRecast 的指令。 客户端 UI(GameSystemUI CastingJoyStick)和 AI(GameDataAINodeValidateCast)也会读取此值。 与 AutoCast 正交:AutoCast 控制"是否主动发起",Recast 控制"是否连续释放"。
RecastUseAutoCast 双端
csharp
public bool RecastUseAutoCast { get; set; }重施法(Recast)时是否使用自动施法的目标搜索逻辑重新选取目标。
备注
为 false(默认)时,重施法沿用原始指令的目标。 为 true 时,重施法会通过 TargetingFilters、AcquireRange 和 AcquireSorting 重新搜索最优目标。适用于治疗等需要动态切换目标的连续施法场景。
Enabled 双端
csharp
public bool Enabled { get; set; }目标获取行为总开关。为 false 时禁用所有自动目标获取和自动施法行为。
TargetingFilters 双端
csharp
public TargetFilterComplex TargetingFilters { get; set; }自动目标获取的过滤条件,由 SmartAcquire 和 AutoCast 共用。
SmartAcquire 双端
csharp
public bool SmartAcquire { get; set; }手动施法指令缺少目标时,是否自动在范围内搜索有效目标。默认 true。
AcquireRange 双端
csharp
public FuncFloat? AcquireRange { get; set; }自动目标搜索的范围函数,由 SmartAcquire 和 AutoCast 共用。 为 null 时回退到技能本身的 Range。
AcquireSorting 双端
csharp
public ContextualPriorityComparer<Ability, Unit>? AcquireSorting { get; set; }自动目标搜索的排序规则,由 SmartAcquire 和 AutoCast 共用。 为 null 时使用 SearchCircle 的默认顺序(通常为距离)。
AutoCastMovePolicy 双端
命名空间 GameCore.Struct
csharp
public enum AutoCastMovePolicy自动施法遇到摇杆移动输入时的处理策略。
枚举值
BlockWhileVectorMoving— 有摇杆移动输入时不主动发起自动施法。AllowWhileVectorMoving— 允许自动施法在摇杆移动输入期间发起,可能会抑制或打断当前移动。
ContextualComparison 双端
命名空间 GameCore.Struct
csharp
public delegate ContextualComparison<in TContext, in T> where T : allows ref struct带上下文的比较委托,在比较时可以访问额外的上下文信息。
context— 比较时使用的上下文x— 要比较的第一个对象y— 要比较的第二个对象
返回: 一个有符号整数,指示 x 与 y 的相对值: 小于 0x 小于 y 0x 等于 y 大于 0x 大于 y
ContextualPriorityComparer 双端
命名空间 GameCore.Struct
csharp
public class ContextualPriorityComparer<TContext, T> : List<ContextualComparison<TContext, T>>带上下文的优先级比较器,按顺序执行多个比较函数直到得出结果。
备注
当比较两个元素时,优先执行列表中前面的比较函数, 如果比较出结果直接返回结果,如果前面的比较函数没有结果 才会按顺序执行后面的比较函数直到得出结果或者返回0。 此类继承自 List1,因此可以直接使用集合操作来管理比较函数。 与 PriorityComparer1 不同的是,此类的比较函数需要一个上下文参数, 可以在比较时访问额外的状态信息。 使用示例: // 创建带上下文的优先级比较器 var comparer = new ContextualPriorityComparer<Player, Unit>(); comparer.Add((player, a, b) => a.Health.CompareTo(b.Health)); comparer.Add((player, a, b) => a.DistanceTo(player).CompareTo(b.DistanceTo(player))); // 使用玩家作为上下文进行比较 var result = comparer.Compare(player, unitA, unitB); // 排序 var sortedUnits = comparer.Sort(player, units);
构造函数
ContextualPriorityComparer 双端
csharp
public ContextualPriorityComparer()带上下文的优先级比较器,按顺序执行多个比较函数直到得出结果。
备注
当比较两个元素时,优先执行列表中前面的比较函数, 如果比较出结果直接返回结果,如果前面的比较函数没有结果 才会按顺序执行后面的比较函数直到得出结果或者返回0。 此类继承自 List1,因此可以直接使用集合操作来管理比较函数。 与 PriorityComparer1 不同的是,此类的比较函数需要一个上下文参数, 可以在比较时访问额外的状态信息。 使用示例: // 创建带上下文的优先级比较器 var comparer = new ContextualPriorityComparer<Player, Unit>(); comparer.Add((player, a, b) => a.Health.CompareTo(b.Health)); comparer.Add((player, a, b) => a.DistanceTo(player).CompareTo(b.DistanceTo(player))); // 使用玩家作为上下文进行比较 var result = comparer.Compare(player, unitA, unitB); // 排序 var sortedUnits = comparer.Sort(player, units);
ContextualPriorityComparer 双端
csharp
public ContextualPriorityComparer(IEnumerable<ContextualComparison<TContext, T>> comparisons)使用指定的比较函数集合初始化带上下文的优先级比较器。
comparisons— 比较函数集合
方法
Compare 双端
csharp
public int Compare(TContext context, T? x, T? y)使用指定的上下文比较两个对象并返回它们的相对顺序。
context— 比较时使用的上下文x— 要比较的第一个对象y— 要比较的第二个对象
返回: 一个有符号整数,指示 x 与 y 的相对值: 小于 0x 小于 y 0x 等于 y 大于 0x 大于 y
备注
按顺序执行列表中的比较函数,直到某个函数返回非零值。 如果所有比较函数都返回0,则返回0。
Sort 双端
csharp
public List<T> Sort(TContext context, IEnumerable<T> source)使用指定的上下文和当前比较器对集合进行排序。
context— 比较时使用的上下文source— 要排序的集合
返回: 排序后的新列表
备注
此方法会创建一个新的列表,不会修改原始集合。
ToComparer 双端
csharp
public IComparer<T> ToComparer(TContext context)创建一个适配器 IComparer1`,使用指定的上下文进行比较。
context— 比较时使用的上下文
返回: 一个使用指定上下文的 IComparer1` 实例
备注
当需要在标准的排序API中使用带上下文的比较器时,可以使用此方法创建适配器。 例如:list.Sort(comparer.ToComparer(context))
CooldownLocation 双端
命名空间 GameCore.Struct
csharp
public enum CooldownLocation定义冷却时间的存储位置,决定冷却时间在哪个层级进行管理和共享
备注
冷却位置决定了冷却时间的作用域和共享规则。不同的位置允许冷却时间在不同的层级上进行管理, 从而实现各种复杂的冷却机制,如全局冷却、角色冷却、技能冷却等。
枚举值
Self— 自身冷却 - 仅影响当前对象Item— 物品冷却 - 技能的默认值,当没有物品时会回退到技能冷却Ability— 技能冷却 - 冷却时间与特定技能关联Unit— 单位冷却 - 冷却时间与特定单位关联Player— 玩家冷却 - 冷却时间与特定玩家关联Game— 游戏冷却 - 全局冷却时间
Cost 双端
命名空间 GameCore.Struct
csharp
public class CostRepresents the cost requirements for performing an action, including cooldowns, charges, vitals, and player resources.
备注
The Cost class provides a comprehensive system for defining and managing resource requirements for game actions such as casting spells, using abilities, or performing other operations. It supports multiple types of costs including cooldown timers, charge systems, vital properties (like health and mana), and player-specific resources. The class includes validation methods to check if costs can be afforded and execution methods to actually spend the resources when an action is performed.
构造函数
Cost 双端
csharp
public Cost()属性
Cooldown 双端
csharp
public IGameLink<GameDataCooldownActive>? Cooldown { get; set; }Gets or sets the active cooldown requirement for this cost.
备注
Active cooldowns prevent actions from being performed until a specified time has elapsed. This is commonly used for abilities that have a recharge time between uses.
Charge 双端
csharp
public IGameLink<GameDataCooldownCharge>? Charge { get; set; }Gets or sets the charge system requirement for this cost.
备注
Charge systems allow actions to be performed a limited number of times before requiring a recharge period. This is useful for abilities with multiple uses but limited availability.
Vital 双端
csharp
public QuickDictionary<PropertyVital, FuncNumber> Vital { get; set; }Gets or sets the vital property costs (such as health, mana, or energy) required for this action.
备注
Vital costs are typically used for abilities that consume health, mana, or other character resources. The cost functions allow for dynamic calculation based on the execution context, such as scaling with level or other modifiers.
PlayerCost 双端
csharp
public QuickDictionary<PropertyPlayerNumeric, FuncNumber> PlayerCost { get; set; }Gets or sets the player-specific numeric costs required for this action.
备注
Player costs represent resources that belong to the player rather than individual units, such as gold, experience, or other shared resources. This feature is currently under development.
方法
CooldownCheck 双端
csharp
public static CmdResult CooldownCheck(ICostSpender requester)Performs a cooldown and charge check for the specified cost spender.
requester— The object requesting to spend costs, which manages cooldowns and charges.
返回: A command result indicating whether the cooldown and charge requirements are satisfied.
备注
This method validates that the requester can proceed based on cooldown timers and available charges. It does not check other cost types like vital or player resources.
CanAfford 双端
csharp
public CmdResult CanAfford(Entity caster, IExecutionContext context, ICostSpender requester, bool testOnly = true, bool skipCooldownCheckInTest = false)Determines whether the specified caster can afford this cost.
caster— The entity attempting to pay the cost.context— The execution context providing additional parameters for cost calculation.requester— The object requesting to spend costs.testOnly— Iftrue, only tests affordability without caching results for spending; iffalse, caches results for efficient spending.skipCooldownCheckInTest— Iftrueandis true, skips cooldown validation for performance.
返回: A command result indicating whether the cost can be afforded.
备注
This method performs comprehensive validation of all cost requirements including cooldowns, charges, vital properties, and player resources. When is false, it caches the calculated costs for efficient spending later. The method validates that the caster has sufficient resources and that adding negative costs (healing effects) wouldn't exceed maximum values.
Spend 仅服务端
csharp
public bool Spend(Entity caster, IExecutionContext context, ICostSpender requester)Spends the costs associated with this action on the specified caster.
caster— The entity that will pay the costs.context— The execution context used for cost calculations.requester— The object requesting to spend costs.
返回: true if all costs were successfully spent; otherwise, false.
备注
This method is only available on the server side and actually deducts the required resources from the caster and their player. If costs haven't been cached by a previous call to CanAfford with testOnly=false, it will perform affordability checking first. The method handles cooldowns, charges, vital properties, and player resources atomically - if any part fails, no costs are spent. Negative costs (healing effects) will add resources instead of subtracting them.
EffectAngleExpression 双端
命名空间 GameCore.Struct
csharp
public class EffectAngleExpression表示效果角度表达式,用于计算和确定效果的方向角度
备注
EffectAngleExpression 类提供了灵活的角度计算机制,支持多种角度确定方法, 包括使用实体朝向、两点间角度计算和显式角度设置。这对于需要方向性的效果 (如投射物、区域效果、视觉特效等)提供了完整的角度计算解决方案。
构造函数
EffectAngleExpression 双端
csharp
public EffectAngleExpression()属性
Method 双端
csharp
public EffectAngleMethod Method { get; set; }获取或设置角度计算的方法
备注
默认使用朝向方法(Facing),即使用目标实体的朝向作为角度。
Location 双端
csharp
public TargetLocationExpression Location { get; set; }获取或设置主要目标位置表达式
备注
根据角度计算方法的不同,此位置可能作为起始点、朝向来源或角度计算的基础。
OtherLocation 双端
csharp
public TargetLocationExpression OtherLocation { get; set; }获取或设置其他目标位置表达式
备注
在两点间角度计算方法中,此位置作为终点,与主要位置配合计算方向角度。
LocalOffset 双端
csharp
public FuncAngleEffect? LocalOffset { get; set; }获取或设置本地偏移角度函数
备注
此函数提供额外的角度偏移,会添加到计算出的基础角度上。 默认返回 0,表示无偏移。可用于微调或动态调整效果方向。
方法
Parse 双端
csharp
public Angle? Parse(Effect effect)解析并计算效果的最终角度
effect— 效果实例,提供计算所需的上下文信息
返回: 计算出的角度值,如果计算失败则返回 null
备注
根据配置的角度方法执行相应的计算逻辑: ExplicitAngle:直接返回本地偏移角度 AngleBetweenTwoPoints:计算两个位置间的角度并加上偏移 Facing:使用目标的朝向角度并加上偏移 如果所需的目标位置无法解析,方法会返回 null。
EffectAngleMethod 双端
命名空间 GameCore.Struct
csharp
public enum EffectAngleMethodDefines the methods used to determine the angle for effect calculations.
备注
This enum specifies how the angle should be calculated when applying effects that require directional information, such as projectiles, area effects, or visual effects that need orientation.
枚举值
Facing— Uses the facing direction of the source entity.AngleBetweenTwoPoints— Calculates the angle based on the direction between two points.ExplicitAngle— Uses a specific angle value that is explicitly provided.
EffectLaunchMissileMethod 双端
命名空间 GameCore.Struct
csharp
public enum EffectLaunchMissileMethodDefines the methods for launching missiles in effect systems.
备注
This enum specifies how missiles should be created and launched when applying missile-based effects. It determines whether to create new missile instances or reuse existing ones for performance optimization.
枚举值
CreateMissile— Creates a new missile instance for the effect.UseExistingMissile— Uses an existing missile instance for the effect.
EffectOffsetExpression 双端
命名空间 GameCore.Struct
csharp
public class EffectOffsetExpression表示效果偏移表达式,用于计算基于角度和距离的位置偏移
备注
EffectOffsetExpression 类提供了基于极坐标系统的位置偏移计算功能。 它使用角度表达式和距离函数来计算从原点开始的偏移位置, 常用于技能效果、投射物发射位置、AOE效果中心等需要精确位置控制的场景。
构造函数
EffectOffsetExpression 双端
csharp
public EffectOffsetExpression()属性
Angle 双端
csharp
public EffectAngleExpression Angle { get; set; }获取或设置角度表达式,用于确定偏移的方向
备注
此角度表达式定义了从原点向外偏移的方向。 角度可以基于实体朝向、两点间夹角或显式角度值来计算。
Distance 双端
csharp
public FuncNumberEffect Distance { get; set; }获取或设置距离函数,用于确定偏移的距离
备注
此函数计算从原点沿指定角度方向偏移的距离。 默认返回 0,表示无偏移。可以基于效果的各种参数动态计算距离。
方法
Parse 双端
csharp
public ScenePoint Parse(Effect effect, ITarget origin)解析并计算最终的偏移位置
effect— 效果实例,提供计算所需的上下文信息origin— 原点位置,作为偏移计算的基础
返回: 计算出的最终位置点
备注
方法首先计算偏移距离,如果距离为 0 则直接返回原点位置。 否则使用角度表达式计算偏移方向,然后基于极坐标系统计算最终位置。 如果角度无法确定,则返回原点位置。 计算公式:最终位置 = 原点 + (角度方向 × 距离)
EffectOwner 双端
命名空间 GameCore.Struct
csharp
public enum EffectOwnerDefines who owns or controls an effect in the game.
备注
This enum determines the ownership context for effects, which can influence their behavior, interactions, and lifecycle management within the game systems.
枚举值
TargetLocation— The effect is owned by or associated with the target location where it was created.Neutral— The effect has no specific owner and is considered neutral.
EffectOwnerExpression 双端
命名空间 GameCore.Struct
csharp
public class EffectOwnerExpression构造函数
EffectOwnerExpression 双端
csharp
public EffectOwnerExpression()属性
Value 双端
csharp
public EffectOwner Value { get; set; }TargetLocation 双端
csharp
public TargetLocationExpression TargetLocation { get; set; }方法
Parse 双端
csharp
public Player? Parse(IExecutableObject context)EffectPropertyModification 双端
命名空间 GameCore.Struct
csharp
public class EffectPropertyModification<T> where T : IExtendableEnum<T>Represents a property modification configuration for effects that alter entity properties.
备注
This class defines how an effect should modify a specific property of an entity, including the property to modify, the calculation method for the new value, and optional randomization parameters.
构造函数
EffectPropertyModification 双端
csharp
public EffectPropertyModification()属性
Property 双端
csharp
public required T Property { get; set; }Gets or sets the property to be modified by this effect.
备注
This property specifies which entity property will be affected by the modification. The property type must be part of the extendable enum system for type safety.
Value 双端
csharp
public FuncNumberEffect Value { get; set; }Gets or sets the function used to calculate the modification value.
备注
This function determines how the property value should be calculated or modified. The default implementation returns a constant value of 100. The function receives effect context parameters and returns the computed value.
Random 双端
csharp
public double? Random { get; set; }Gets or sets the optional random variation applied to the modification value.
备注
When specified, this value introduces randomness to the property modification, allowing for variable effects rather than deterministic ones. If null, no randomization is applied.
EItemCategory 双端
命名空间 GameCore.Struct
csharp
public enum EItemCategory定义物品的分类类型,用于组织和管理游戏中的各种物品
备注
此枚举提供了扩展能力,允许在运行时动态添加新的物品分类。 物品分类用于物品栏管理、UI 显示、过滤器和其他需要按类型组织物品的系统中。 可以通过枚举扩展系统添加自定义的物品分类,如武器、防具、消耗品等。
HashSetFilter 双端
命名空间 GameCore.Struct
csharp
public class HashSetFilter<T>Represents a generic filter for determining whether collections of items meet specific criteria based on required and excluded elements.
备注
HashSetFilter provides a flexible way to define filtering conditions for any type of collection. It uses inclusion (required) and exclusion criteria to determine if a collection is valid. A collection passes the filter if it contains all required elements and none of the excluded elements. This is a generic version of TargetFilter that can work with any type, not just unit filter tags.
构造函数
HashSetFilter 双端
csharp
public HashSetFilter()属性
Required 双端
csharp
public HashSet<T> Required { get; set; }Gets or sets the collection of elements that must be present for the filter to pass.
备注
All elements in this collection must be present in the tested collection for the filter to pass. If this collection is empty, no specific elements are required (only exclusions apply).
Excluded 双端
csharp
public HashSet<T> Excluded { get; set; }Gets or sets the collection of elements that disqualify a collection from passing the filter.
备注
If any element in this collection is present in the tested collection, the filter will fail regardless of which required elements are met. This provides a way to exclude specific elements.
方法
Pass 双端
csharp
public bool Pass(HashSet<T> tags)Determines whether the specified set of elements passes this filter.
tags— The collection of elements to test against this filter.
返回: True if the elements pass the filter criteria; otherwise, false.
备注
The filter passes if: The collection has none of the excluded elements (no overlap with Excluded) The collection has all of the required elements (Required is a subset of tags) Both conditions must be met for the filter to pass.
Pass 双端
csharp
public bool Pass(IEnumerable<T> tags)Determines whether the specified enumerable collection of elements passes this filter.
tags— The enumerable collection of elements to test against this filter.
返回: True if the elements pass the filter criteria; otherwise, false.
备注
This overload accepts any enumerable collection, not just HashSet. The same filtering logic applies: the collection must contain all required elements and none of the excluded elements. For better performance with large collections, consider using the HashSet overload.
InventoryFlags 双端
命名空间 GameCore.Struct
csharp
public class InventoryFlags定义物品栏系统的行为标志,控制物品的拾取、丢弃和使用权限
备注
InventoryFlags 类用于配置物品栏系统中物品和容器的各种行为权限。 这些标志决定了玩家或系统是否可以对物品栏中的物品执行特定操作, 为不同类型的容器和物品提供了灵活的权限控制机制。
构造函数
InventoryFlags 双端
csharp
public InventoryFlags()属性
HandlePickUpRequest 双端
csharp
public bool HandlePickUpRequest { get; set; }获取或设置是否处理物品拾取请求
备注
当设置为 true 时,物品栏系统会处理来自玩家的物品拾取请求。 当设置为 false 时,拾取请求会被忽略,物品无法被添加到此物品栏中。 默认值为 true。 即使设置为 false,物品也可以通过其他方式添加到物品栏中,如通过代码添加。
AllowDrop 双端
csharp
public bool AllowDrop { get; set; }获取或设置是否允许丢弃物品
备注
当设置为 true 时,玩家可以从物品栏中丢弃物品到游戏世界中。 当设置为 false 时,丢弃操作被禁止,物品只能通过其他方式移除。 默认值为 true。这通常用于限制特殊容器或任务物品的丢弃。
AllowUse 双端
csharp
public bool AllowUse { get; set; }获取或设置是否允许使用物品
备注
当设置为 true 时,玩家可以直接使用物品栏中的物品(如消耗品、工具等)。 当设置为 false 时,使用操作被禁止,物品可能需要先移动到其他位置才能使用。 默认值为 true。这用于控制特定容器中物品的可用性。
ItemCategory 双端
命名空间 GameCore.Struct
csharp
public readonly struct ItemCategory : IGameClass, IExtendableEnum<ItemCategory>, IExtendableEnum, IExtendedEnum, ISyncIdOwner方法
ToString 双端
csharp
public override string? ToString()operator == 双端
csharp
public static bool operator ==(ItemCategory left, ItemCategory right)operator != 双端
csharp
public static bool operator !=(ItemCategory left, ItemCategory right)Equals 双端
csharp
public override bool Equals(object? obj)GetHashCode 双端
csharp
public override int GetHashCode()OnRegisterGameClass 双端
csharp
public static void OnRegisterGameClass()字段
InnerValue 双端
csharp
public readonly Enum InnerValueItemUnitModificationData 双端
命名空间 GameCore.Struct
csharp
public class ItemUnitModificationData : IUnitModificationData构造函数
ItemUnitModificationData 双端
csharp
public ItemUnitModificationData()属性
Ability 双端
csharp
public IGameLink<GameDataAbility>? Ability { get; set; }Modifications 双端
csharp
public List<UnitPropertyModification> Modifications { get; set; }AddStates 双端
csharp
public List<UnitState> AddStates { get; set; }RemoveStates 双端
csharp
public List<UnitState> RemoveStates { get; set; }ImmuneStates 双端
csharp
public List<UnitState> ImmuneStates { get; set; }ActorArray 双端
csharp
public List<IGameLink<GameDataActor>?>? ActorArray { get; set; }LeveledData 双端
命名空间 GameCore.Struct
csharp
public class LeveledData<T> : List<T>Represents a collection of data that varies by level, providing level-based data retrieval with automatic clamping.
备注
LeveledData is commonly used for game mechanics where values change as a character or ability levels up, such as spell damage, ability cooldowns, or unit statistics. The class automatically handles level bounds by clamping the requested level to the available data range.
构造函数
LeveledData 双端
csharp
public LeveledData()方法
GetLeveledData 双端
csharp
public T GetLeveledData(int level)Retrieves the data for the specified level, automatically clamping the level to valid bounds.
level— The zero-based level index to retrieve data for.
返回: The data for the specified level, or the closest valid level if the input is out of bounds.
备注
This method provides safe access to leveled data by automatically clamping the level parameter: Negative levels are clamped to 0 (minimum level) Levels exceeding the data count are clamped to the maximum available level This ensures that valid data is always returned as long as the collection is not empty.
MorphFlags 双端
命名空间 GameCore.Struct
csharp
public class MorphFlags定义变身系统的行为标志,控制变身时哪些属性和特征会发生改变
备注
MorphFlags 类用于配置单位变身时的各种变化选项。变身是游戏中常见的机制, 可以用于技能效果、形态转换、临时强化等场景。这些标志提供了细粒度的控制, 允许开发者精确定义变身过程中哪些方面会被修改。
构造函数
MorphFlags 双端
csharp
public MorphFlags()属性
ChangeModel 双端
csharp
public bool ChangeModel { get; set; }获取或设置是否改变模型外观
备注
当设置为 true 时,变身会改变单位的 3D 模型、材质和视觉外观。 这是最常见的变身效果,让单位看起来完全不同。 默认值为 true。
ChangeAbilities 双端
csharp
public bool ChangeAbilities { get; set; }获取或设置是否改变技能能力
备注
当设置为 true 时,变身会改变单位可用的技能和能力。 这允许变身形态拥有完全不同的技能组合。 默认值为 false。
ChangeResponses 双端
csharp
public bool ChangeResponses { get; set; }获取或设置是否改变响应行为
备注
当设置为 true 时,变身会改变单位对各种事件和刺激的响应方式。 这包括 AI 行为、交互方式、触发条件等。 默认值为 false。
ChangeUnitProperties 双端
csharp
public bool ChangeUnitProperties { get; set; }获取或设置是否改变单位属性
备注
当设置为 true 时,变身会改变单位的基础属性,如生命值、攻击力、移动速度等。 这允许变身形态具有不同的战斗能力和特征。 默认值为 false。
ChangeUnitStates 双端
csharp
public bool ChangeUnitStates { get; set; }获取或设置是否改变单位状态
备注
当设置为 true 时,变身会改变单位的各种状态标记和分类。 这可能影响单位如何被其他系统识别和处理。 默认值为 false。
ChangeHeight 双端
csharp
public bool ChangeHeight { get; set; }获取或设置是否改变单位高度
备注
当设置为 true 时,变身会改变单位的物理高度。 这影响碰撞检测、视线计算和其他基于高度的游戏机制。 默认值为 false。 TODO: 高度系统待实现
ChangeLoot 双端
csharp
public bool ChangeLoot { get; set; }获取或设置是否改变掉落物品
备注
当设置为 true 时,变身会改变单位死亡时掉落的物品。 这允许不同形态的单位掉落不同的战利品。 默认值为 false。 TODO: 掉落系统待实现
PlayerData 双端
命名空间 GameCore.Struct
csharp
public class PlayerDataRepresents configuration data for a player in the game, including their identity, controller type, and team status.
备注
This class is used to define player properties during game setup and initialization. It contains information about how the player is controlled and their relationship to other players.
构造函数
PlayerData 双端
csharp
public PlayerData()属性
Id 双端
csharp
public int Id { get; set; }Gets or sets the unique identifier for this player.
Controller 双端
csharp
public ControllerType Controller { get; set; }Gets or sets the type of controller that manages this player (e.g., human, AI).
IsNeutral 双端
csharp
public bool IsNeutral { get; set; }Gets or sets a value indicating whether this player is neutral (not aligned with any team).
PriorityComparer 双端
命名空间 GameCore.Struct
csharp
public class PriorityComparer<T> : List<Comparison<T>>, IComparer<T>优先级比较器,按顺序执行多个比较函数直到得出结果。
备注
当比较两个元素时,优先执行列表中前面的比较函数, 如果比较出结果直接返回结果,如果前面的比较函数没有结果 才会按顺序执行后面的比较函数直到得出结果或者返回0。 此类继承自 List1,因此可以直接使用集合操作来管理比较函数, 同时实现了 IComparer1 接口,可以直接用于排序操作。 使用示例: // 创建优先级比较器 var comparer = new PriorityComparer<Unit>(); comparer.Add((a, b) => a.Health.CompareTo(b.Health)); comparer.Add((a, b) => a.DistanceTo(player).CompareTo(b.DistanceTo(player))); // 排序 var sortedUnits = comparer.Sort(units); // 或者直接用于List.Sort units.Sort(comparer);
构造函数
PriorityComparer 双端
csharp
public PriorityComparer()优先级比较器,按顺序执行多个比较函数直到得出结果。
备注
当比较两个元素时,优先执行列表中前面的比较函数, 如果比较出结果直接返回结果,如果前面的比较函数没有结果 才会按顺序执行后面的比较函数直到得出结果或者返回0。 此类继承自 List1,因此可以直接使用集合操作来管理比较函数, 同时实现了 IComparer1 接口,可以直接用于排序操作。 使用示例: // 创建优先级比较器 var comparer = new PriorityComparer<Unit>(); comparer.Add((a, b) => a.Health.CompareTo(b.Health)); comparer.Add((a, b) => a.DistanceTo(player).CompareTo(b.DistanceTo(player))); // 排序 var sortedUnits = comparer.Sort(units); // 或者直接用于List.Sort units.Sort(comparer);
PriorityComparer 双端
csharp
public PriorityComparer(IEnumerable<Comparison<T>> comparisons)使用指定的比较函数集合初始化优先级比较器。
comparisons— 比较函数集合
方法
Compare 双端
csharp
public int Compare(T? x, T? y)比较两个对象并返回它们的相对顺序。
x— 要比较的第一个对象y— 要比较的第二个对象
返回: 一个有符号整数,指示 x 与 y 的相对值: 小于 0x 小于 y 0x 等于 y 大于 0x 大于 y
备注
按顺序执行列表中的比较函数,直到某个函数返回非零值。 如果所有比较函数都返回0,则返回0。
Sort 双端
csharp
public List<T> Sort(IEnumerable<T> source)使用当前比较器对指定的集合进行排序。
source— 要排序的集合
返回: 排序后的新列表
备注
此方法会创建一个新的列表,不会修改原始集合。
PropertyModificationOperation 双端
命名空间 GameCore.Struct
csharp
public enum PropertyModificationOperationDefines the types of operations that can be performed when modifying properties.
备注
This enum is used to specify how a property value should be changed during modification operations.
枚举值
Set— Sets the property to a specific value, replacing the current value.Add— Adds a value to the current property value.
ResponseDamageFlags 双端
命名空间 GameCore.Struct
csharp
public class ResponseDamageFlags定义伤害响应系统的行为标志,控制特定伤害事件的处理方式
备注
ResponseDamageFlags 类用于配置伤害响应系统如何处理不同类型的伤害事件。 这些标志决定了响应器是否会对特定的伤害情况(如致命伤害、暴击、零伤害等)做出反应, 为创建复杂的伤害响应机制提供了灵活的控制选项。
构造函数
ResponseDamageFlags 双端
csharp
public ResponseDamageFlags()属性
Fatal 双端
csharp
public bool Fatal { get; set; }获取或设置是否响应致命伤害
备注
当设置为 true 时,响应器会对导致单位死亡的伤害事件做出反应。 这通常用于死亡时触发的特殊效果,如死亡爆炸、复活机制或遗言技能。 默认值为 false。
SetAsCrit 双端
csharp
public bool SetAsCrit { get; set; }获取或设置是否将伤害设置为暴击
备注
当设置为 true 时,响应器可以强制将触发的伤害标记为暴击。 这允许某些技能或效果确保产生暴击伤害,无视正常的暴击计算。 默认值为 false。
HandleZeroDamage 双端
csharp
public bool HandleZeroDamage { get; set; }获取或设置是否处理零伤害事件
备注
当设置为 true 时,响应器会对造成 0 点伤害的攻击做出反应。 这包括被完全抵挡、免疫或其他原因导致的无效伤害。 用于在即使没有造成实际伤害时也需要触发某些效果的场景。 默认值为 false。
HandleNullifiedDamage 双端
csharp
public bool HandleNullifiedDamage { get; set; }获取或设置是否处理被无效化的伤害
备注
当设置为 true 时,响应器会对被护盾、无敌或其他保护机制完全抵消的伤害做出反应。 这与零伤害不同,无效化伤害是指原本会造成伤害但被特殊机制阻止的情况。 用于在伤害被阻挡时仍需要触发响应的场景。 默认值为 false。
SpellCastTime 双端
命名空间 GameCore.Struct
csharp
public class SpellCastTimeRepresents the timing configuration for spell or ability casting phases.
备注
SpellCastTime defines the various time durations involved in casting a spell or using an ability. It breaks down the casting process into distinct phases: preswing (preparation), cast (actual casting), channel (sustained effect), and backswing (recovery). Each phase can have different timing requirements and may be affected by various modifiers such as cast speed, interruption, or other game mechanics. This granular timing control allows for sophisticated spell mechanics and balanced gameplay.
构造函数
SpellCastTime 双端
csharp
public SpellCastTime()属性
Preswing 双端
csharp
public FuncTime Preswing { get; set; }Gets or sets the preswing time function for the spell casting.
备注
Preswing represents the preparation phase before the actual spell casting begins. During this time, the caster may play preparation animations, gather energy, or perform other preliminary actions. The preswing phase can typically be interrupted without triggering cooldowns or consuming resources.
Cast 双端
csharp
public FuncTime Cast { get; set; }Gets or sets the cast time function for the main spell casting phase.
备注
The cast time represents the core casting phase where the spell effect is being prepared and channeled. During this phase, the caster is typically vulnerable to interruption, and interrupting the cast may trigger partial cooldowns or resource consumption. This is often the longest phase of spell casting.
Channel 双端
csharp
public FuncTime Channel { get; set; }Gets or sets the channel time function for sustained spell effects.
备注
Channel time represents the duration for which a spell effect is actively maintained after the initial cast completes. During channeling, the caster typically cannot perform other actions and must maintain focus to continue the effect. Channeled spells can often be canceled early or interrupted by external effects. Spell costs will typically be consumed at the start of the channel phase.
Backswing 双端
csharp
public FuncTime Backswing { get; set; }Gets or sets the backswing time function for the spell recovery phase.
备注
Backswing represents the recovery time after a spell has been cast. Backswing is typically can be interrupted by subsequent actions.
NormalizedDuration 双端
csharp
public FuncTime? NormalizedDuration { get; set; }Gets or sets the normalized duration for the core casting phases (Preswing + Cast + Channel). When set, enforces that the combined time of these three phases equals exactly this value, while preserving their relative proportions.
备注
Primary Use Case: This property is primarily designed for basic attack abilities where precise attack interval control is required. For such abilities, designers typically: Set NormalizedDuration to the desired attack interval Do not configure cooldown (cooldown = 0) Configure backswing as interruptible Scaling Behavior: When NormalizedDuration is set, all casting phases are scaled by the same factor to maintain animation coherence: Preswing, Cast, Channel: Scaled to fit exactly within NormalizedDuration Backswing: Scaled by the same factor but not included in NormalizedDuration Attack Interval Control: For abilities with interruptible backswing, the effective attack interval equals NormalizedDuration because subsequent attacks will interrupt the backswing phase. This provides precise attack rhythm control. Example: Setting NormalizedDuration = 2s for a basic attack with original timings Preswing=0.3s, Cast=1.2s, Channel=0.5s, Backswing=0.6s: Scale factor = 2s / (0.3s + 1.2s + 0.5s) = 1.0 Adjusted: Preswing=0.3s, Cast=1.2s, Channel=0.5s, Backswing=0.6s Complete casting time = 2.6s (for animation/UI purposes) Effective attack interval = 2s (due to backswing interruption) Edge Cases: If the sum of original core phase durations is zero or very small, the phases will be distributed equally within the normalized duration. Backswing scaling follows the same factor to maintain visual consistency.
SpellInterruptConfig 双端
命名空间 GameCore.Struct
csharp
public class SpellInterruptConfig构造函数
SpellInterruptConfig 双端
csharp
public SpellInterruptConfig()属性
InterruptedRequiredPriority 双端
csharp
public double InterruptedRequiredPriority { get; set; }InterruptingPriority 双端
csharp
public double InterruptingPriority { get; set; }InterruptiblePreswing 双端
csharp
public bool InterruptiblePreswing { get; set; }InterruptibleApproach 双端
csharp
public bool InterruptibleApproach { get; set; }InterruptibleWaitForCooldown 双端
csharp
public bool InterruptibleWaitForCooldown { get; set; }InterruptibleCast 双端
csharp
public bool InterruptibleCast { get; set; }InterruptibleChannel 双端
csharp
public bool InterruptibleChannel { get; set; }InterruptibleBackswing 双端
csharp
public bool InterruptibleBackswing { get; set; }StaticCollisionMask 双端
命名空间 GameCore.Struct
csharp
public enum StaticCollisionMask枚举值
None = 0Unwalkable = 1Unflyable = 4Unbuildable = 8UnPeonHarvest = 0x10Blighted = 0x20Unfloatable = 0x40Unamphibious = 0x80UnItemplacable = 0x100Cliff = 0x200Higher = 0x400Lower = 0x800
TargetFilter 双端
命名空间 GameCore.Struct
csharp
public class TargetFilterRepresents a filter for determining whether targets meet specific criteria based on unit filter tags.
备注
The TargetFilter class provides a flexible way to define targeting conditions for abilities, spells, and other game systems. It uses inclusion (required) and exclusion criteria to determine if a target is valid. A target passes the filter if it has all required tags and none of the excluded tags.
构造函数
TargetFilter 双端
csharp
public TargetFilter()属性
Required 双端
csharp
public HashSet<UnitFilterTag> Required { get; set; }Gets or sets the collection of tags that a target must have to pass the filter.
备注
All tags in this collection must be present on the target for the filter to pass. If this collection is empty, no specific tags are required (only exclusions apply).
Excluded 双端
csharp
public HashSet<UnitFilterTag> Excluded { get; set; }Gets or sets the collection of tags that disqualify a target from passing the filter.
备注
If any tag in this collection is present on the target, the filter will fail regardless of which required tags are met. This provides a way to exclude specific types of targets.
方法
Pass 双端
csharp
public bool Pass(HashSet<UnitFilterTag> tags)Determines whether the specified set of tags passes this filter.
tags— The collection of tags to test against this filter.
返回: True if the tags pass the filter criteria; otherwise, false.
备注
The filter passes if: The target has none of the excluded tags (no overlap with Excluded) The target has all of the required tags (Required is a subset of tags) Both conditions must be met for the filter to pass.
Pass 双端
csharp
public bool Pass(Entity caster, Entity target)Determines whether the specified target entity passes this filter from the perspective of the caster.
TargetFilterComplex 双端
命名空间 GameCore.Struct
csharp
public class TargetFilterComplex : List<TargetFilter>Represents a complex target filter that combines multiple individual target filters using OR logic.
备注
TargetFilterComplex extends the List<TargetFilter> to provide a collection of filters where a target passes if it satisfies ANY of the individual filters in the collection. This allows for flexible targeting conditions where multiple different criteria can make a target valid. For example, you could target either "living enemies" OR "undead allies" by combining two separate filters. If the collection is empty, all targets pass by default.
构造函数
TargetFilterComplex 双端
csharp
public TargetFilterComplex()方法
Pass 双端
csharp
public bool Pass(HashSet<UnitFilterTag> tags)Determines whether the specified set of tags passes this complex filter.
tags— The collection of unit filter tags to test against this filter.
返回: True if the tags pass any of the individual filters, or if no filters are defined; otherwise, false.
备注
This method uses OR logic - the target passes if it satisfies ANY of the individual filters in the collection. If the collection is empty (no filters defined), the method returns true, effectively allowing all targets to pass. This provides a safe default for unfiltered targeting.
Pass 双端
csharp
public bool Pass(Entity caster, Entity target)Determines whether the specified target entity passes this complex filter from the perspective of the caster.
caster— The entity that is performing the targeting (used to determine relationships).target— The entity being evaluated as a potential target.
返回: True if the target passes any of the individual filters, or if no filters are defined; otherwise, false.
备注
This method automatically extracts the target's filter tags relative to the caster and then evaluates them against all filters in the collection. It uses OR logic like the other Pass method, but provides a more convenient interface when working with entities directly. The method caches the extracted tags for efficiency during the evaluation process.
TargetLocationExpression 双端
命名空间 GameCore.Struct
csharp
public class TargetLocationExpression构造函数
TargetLocationExpression 双端
csharp
public TargetLocationExpression()属性
Effect 双端
csharp
public IGameLink<GameDataEffect>? Effect { get; set; }LocalVar 双端
csharp
public LocVarType LocalVar { get; set; }Value 双端
csharp
public TargetLocation Value { get; set; }方法
Parse 双端
csharp
public ITarget? Parse(IExecutableObject executable, TargetType targetType = TargetType.Any)UnitPropertyFormula 双端
命名空间 GameCore.Struct
csharp
public class UnitPropertyFormulaRepresents a formula for calculating unit property values based on dependencies and custom calculation logic.
备注
UnitPropertyFormula provides a way to define complex property calculations that depend on other unit properties. This is commonly used for derived statistics where one property's value is calculated based on multiple other properties, such as calculating total damage from base damage plus bonuses, or determining movement speed based on agility and equipment modifiers. The formula system ensures that dependent properties are recalculated when their dependencies change.
构造函数
UnitPropertyFormula 双端
csharp
public UnitPropertyFormula()属性
DependedProperties 双端
csharp
public HashSet<IGameLink<GameDataUnitProperty>> DependedProperties { get; set; }Gets or sets the collection of unit properties that this formula depends on.
备注
When any of the properties in this collection change, the formula will be recalculated automatically. This dependency tracking ensures that derived properties stay up-to-date when their inputs change. The property system uses this information to determine the order of calculations and avoid circular dependencies.
Formula 双端
csharp
public Func<UnitPropertyComplex, double>? Formula { get; set; }Gets or sets the calculation function that computes the property value based on the unit's property complex.
备注
This function is called whenever the property value needs to be recalculated. It receives a UnitPropertyComplex object that provides access to all of the unit's current property values. The function should use the GetFinal method to retrieve the final calculated values of dependent properties, ensuring that all modifiers and other formulas have been applied.
UnitPropertyInitialData 双端
命名空间 GameCore.Struct
csharp
public class UnitPropertyInitialData : QuickDictionary<IGameLink<GameDataUnitProperty>, double>构造函数
UnitPropertyInitialData 双端
csharp
public UnitPropertyInitialData()UnitPropertyModification 双端
命名空间 GameCore.Struct
csharp
public class UnitPropertyModification构造函数
UnitPropertyModification 双端
csharp
public UnitPropertyModification()属性
Property 双端
csharp
public required IGameLink<GameDataUnitProperty> Property { get; set; }Value 双端
csharp
public FuncNumber Value { get; set; }Random 双端
csharp
public double? Random { get; set; }SubType 双端
csharp
public PropertySubType SubType { get; set; }UnitPropertyRequirementData 双端
命名空间 GameCore.Struct
csharp
public class UnitPropertyRequirementData构造函数
UnitPropertyRequirementData 双端
csharp
public UnitPropertyRequirementData()属性
Property 双端
csharp
public required IGameLink<GameDataUnitProperty> Property { get; set; }Value 双端
csharp
public double Value { get; set; }UnitPropertyRequirements 双端
命名空间 GameCore.Struct
csharp
public class UnitPropertyRequirements : List<UnitPropertyRequirementData>构造函数
UnitPropertyRequirements 双端
csharp
public UnitPropertyRequirements()方法
MeetRequirement 双端
csharp
public bool MeetRequirement(Unit unit)WeightedLink 双端
命名空间 GameCore.Struct
csharp
public class WeightedLink<T> where T : IGameLink?表示带权重的游戏数据链接,用于随机选择和概率计算
备注
WeightedLink 类将游戏数据链接与权重值关联,用于实现基于权重的随机选择算法。 这通常用于掉落系统、随机事件、AI 决策等需要概率性选择的场景。 权重越高,被选中的概率越大。
构造函数
WeightedLink 双端
csharp
public WeightedLink()WeightedLink 双端
csharp
public WeightedLink(T? link, double weight = 1.0)属性
Link 双端
csharp
public T? Link { get; set; }获取或设置游戏数据链接
备注
指向具体游戏数据的链接,可以为 null。 在随机选择过程中,只有非 null 的链接才会被考虑。
Weight 双端
csharp
public double Weight { get; set; }获取或设置链接的权重值
备注
权重决定了此链接在随机选择中被选中的相对概率。 默认权重为 1。权重为 0 的链接不会被选中,负权重通常被视为无效。 在多个加权链接的集合中,单个链接的选中概率 = 该链接权重 / 所有链接权重之和。
方法
implicit operator 双端
csharp
public static WeightedLink<T> implicit operator(T? link)WeightedLinkComplex 双端
命名空间 GameCore.Struct
csharp
public class WeightedLinkComplex<T> : List<WeightedLink<T>> where T : IGameLink?构造函数
WeightedLinkComplex 双端
csharp
public WeightedLinkComplex()方法
GetLink 双端
csharp
public T? GetLink()GetLinks 双端
csharp
public IEnumerable<T?>? GetLinks(int count, bool allowRecycle, Func<T?, bool>? filter = null)