コード例 #1
0
        public override bool IsDuplicate(AIObjective otherObjective)
        {
            AIObjectiveCombat objective = otherObjective as AIObjectiveCombat;
            if (objective == null) return false;

            return objective.enemy == enemy;
        }
コード例 #2
0
        public override bool IsDuplicate(AIObjective otherObjective)
        {
            AIObjectiveCombat objective = otherObjective as AIObjectiveCombat;

            if (objective == null)
            {
                return(false);
            }

            return(objective.enemy == enemy);
        }
コード例 #3
0
        protected override AIObjective ObjectiveConstructor(Character target)
        {
            var combatObjective = new AIObjectiveCombat(character, target, AIObjectiveCombat.CombatMode.Offensive, objectiveManager, PriorityModifier);

            if (character.TeamID == Character.TeamType.FriendlyNPC && target.TeamID == Character.TeamType.Team1 && GameMain.GameSession?.GameMode is CampaignMode campaign)
            {
                var reputation = campaign.Map?.CurrentLocation?.Reputation;
                if (reputation != null && reputation.NormalizedValue < Reputation.HostileThreshold)
                {
                    combatObjective.holdFireCondition = () =>
                    {
                        //hold fire while the enemy is in the airlock (except if they've attacked us)
                        if (HumanAIController.GetDamageDoneByAttacker(target) > 0.0f)
                        {
                            return(false);
                        }
                        return(target.CurrentHull == null || target.CurrentHull.OutpostModuleTags.Any(t => t.Equals("airlock", System.StringComparison.OrdinalIgnoreCase)));
                    };
                    character.Speak(TextManager.Get("dialogenteroutpostwarning"), null, Rand.Range(0.5f, 1.0f), "leaveoutpostwarning", 30.0f);
                }
            }
            return(combatObjective);
        }