private static AttackParams CheckAttackAvailability(IActor actor, IAttackTarget target, ISectorMap map) { var combatActModule = actor.Person.GetModuleSafe <ICombatActModule>(); if (combatActModule is null) { throw new NotSupportedException(); } var inventory = actor.Person.GetModuleSafe <IInventoryModule>(); var acts = combatActModule.GetCurrentCombatActs(); var act = SelectActHelper.SelectBestAct(acts, inventory); var isInDistance = act.CheckDistance(actor.Node, target.Node, map); var targetIsOnLine = map.TargetIsOnLine(actor.Node, target.Node); var attackParams = new AttackParams { IsAvailable = isInDistance && targetIsOnLine, CombatAct = act }; return(attackParams); }
private AttackParams CheckAttackAvailability(IActor actor, IAttackTarget target) { if (actor.Person.GetModuleSafe <ICombatActModule>() is null) { throw new NotSupportedException(); } var inventory = actor.Person.GetModuleSafe <IInventoryModule>(); var act = SelectActHelper.SelectBestAct(actor.Person.GetModule <ICombatActModule>().CalcCombatActs(), inventory); var isInDistance = act.CheckDistance(actor.Node, target.Node, _map); var targetIsOnLine = _map.TargetIsOnLine(actor.Node, target.Node); var attackParams = new AttackParams { IsAvailable = isInDistance && targetIsOnLine, TacticalAct = act }; return(attackParams); }