Files
BH3/Assets/Scripts/Assembly-CSharp/MoleMole/Config/PredicateByHasEnemyAround.cs
2025-08-13 09:26:42 +08:00

61 lines
1.9 KiB
C#

namespace MoleMole.Config
{
[GeneratePartialHash(CombineGeneratedFile = true)]
public class PredicateByHasEnemyAround : BaseUtilityAction, IHashable
{
public DynamicFloat Range;
public ConfigAbilityAction[] Actions = ConfigAbilityAction.EMPTY;
public void ObjectContentHashOnto(ref int lastHash)
{
if (Range != null)
{
HashUtils.ContentHashOnto(Range.isDynamic, ref lastHash);
HashUtils.ContentHashOnto(Range.fixedValue, ref lastHash);
HashUtils.ContentHashOnto(Range.dynamicKey, ref lastHash);
}
if (Actions != null)
{
ConfigAbilityAction[] actions = Actions;
foreach (ConfigAbilityAction configAbilityAction in actions)
{
if (configAbilityAction is IHashable)
{
HashUtils.ContentHashOnto((IHashable)configAbilityAction, ref lastHash);
}
}
}
HashUtils.ContentHashOnto((int)Target, ref lastHash);
if (TargetOption != null && TargetOption.Range != null)
{
HashUtils.ContentHashOnto(TargetOption.Range.isDynamic, ref lastHash);
HashUtils.ContentHashOnto(TargetOption.Range.fixedValue, ref lastHash);
HashUtils.ContentHashOnto(TargetOption.Range.dynamicKey, ref lastHash);
}
if (Predicates == null)
{
return;
}
ConfigAbilityPredicate[] predicates = Predicates;
foreach (ConfigAbilityPredicate configAbilityPredicate in predicates)
{
if (configAbilityPredicate is IHashable)
{
HashUtils.ContentHashOnto((IHashable)configAbilityPredicate, ref lastHash);
}
}
}
public override ConfigAbilityAction[][] GetAllSubActions()
{
return new ConfigAbilityAction[1][] { Actions };
}
public override void Call(ActorAbilityPlugin abilityPlugin, ConfigAbilityAction actionConfig, ActorAbility instancedAbility, ActorModifier instancedModifier, BaseAbilityActor target, BaseEvent evt)
{
abilityPlugin.PredicateByHasEnemyAroundHandler(actionConfig, instancedAbility, instancedModifier, target, evt);
}
}
}