Example #1
0
        public void HitDiceNames()
        {
            var creatures = CreatureConstants.GetAll();
            var types     = CreatureConstants.Types.GetAll();

            var names = creatures.Union(types);

            AssertCollectionNames(names);
        }
Example #2
0
        private async Task GenerateAndAssertCreatureAsCharacterAsync()
        {
            var characters         = CreatureConstants.GetAllCharacters();
            var randomCreatureName = collectionSelector.SelectRandomFrom(characters);

            var creature = await creatureGenerator.GenerateAsCharacterAsync(randomCreatureName, CreatureConstants.Templates.None);

            creatureAsserter.AssertCreatureAsCharacter(creature);
        }
Example #3
0
        public void AttackDataNames()
        {
            var creatures = CreatureConstants.GetAll();
            var templates = CreatureConstants.Templates.GetAll();

            var names = creatures.Union(templates);

            AssertCollectionNames(names);
        }
 public CreatureTaskInstance(Tasks.CreatureTasks taskType, ActionStep[] previousSteps,
                             Thing[] targets, Creature actingCreature)
 {
     this.taskType             = taskType;
     this._previousActionSteps = previousSteps;
     this.currentActionSteps   = CreatureConstants.GetTaskList(taskType);
     this._targets             = targets;
     this.creature             = actingCreature;
     _currentStepNum           = 0;
 }
Example #5
0
        public void ArmorClassBonusesNames()
        {
            var creatures        = CreatureConstants.GetAll();
            var creatureTypes    = CreatureConstants.Types.GetAll();
            var creatureSubtypes = CreatureConstants.Types.Subtypes.GetAll();

            var names = creatures.Union(creatureTypes).Union(creatureSubtypes);

            AssertCollectionNames(names);
        }
        public void SpecialQualityDataNames()
        {
            var creatures = CreatureConstants.GetAll();
            var types     = CreatureConstants.Types.GetAll();
            var subtypes  = CreatureConstants.Types.Subtypes.GetAll();
            var templates = CreatureConstants.Templates.GetAll();

            var names = creatures.Union(types).Union(subtypes).Union(templates);

            AssertCollectionNames(names);
        }
Example #7
0
        public void SaveBonusesNames()
        {
            var creatures = CreatureConstants.GetAll();
            var types     = CreatureConstants.Types.GetAll();
            var subtypes  = CreatureConstants.Types.Subtypes.GetAll();
            var templates = CreatureConstants.Templates.GetAll();

            var names = creatures.Union(types).Union(subtypes).Union(templates);

            AssertCollectionNames(names);
        }
Example #8
0
 private void Initialize(Actions action, Tasks.CreatureTasks task, float distanceRequiredToCompleteModifier)
 {
     maxAllowedTime      = CreatureConstants.GetMaxAllowedTime(action);
     failReason          = FailReason.NA;
     this.associatedTask = task;
     this.action         = action;
     // No target, set to zero //
     _targetPosition = Vector3.zero;
     failReason      = FailReason.NA;
     creatureAgentDestinationHasBeenSet      = false;
     this.distanceRequiredToCompleteModifier = distanceRequiredToCompleteModifier;
 }
Example #9
0
        private void GenerateAndAssertCreatureAsCharacterWithTemplate()
        {
            var randomTemplate = collectionSelector.SelectRandomFrom(allTemplates);

            if (!compatibleCreatures.ContainsKey(randomTemplate))
            {
                var validCreatures = allCreatures.Where(c => creatureVerifier.VerifyCompatibility(c, randomTemplate)).ToArray();
                compatibleCreatures.TryAdd(randomTemplate, validCreatures);
            }

            var characters         = CreatureConstants.GetAllCharacters().Intersect(compatibleCreatures[randomTemplate]);
            var randomCreatureName = collectionSelector.SelectRandomFrom(characters);

            var creature = creatureGenerator.GenerateAsCharacter(randomCreatureName, randomTemplate);

            creatureAsserter.AssertCreatureAsCharacter(creature);

            Assert.That(creature.Template, Is.EqualTo(randomTemplate));
        }
        public void GrappleBonusesNames()
        {
            var sizes = new[]
            {
                SizeConstants.Colossal,
                SizeConstants.Gargantuan,
                SizeConstants.Huge,
                SizeConstants.Large,
                SizeConstants.Medium,
                SizeConstants.Small,
                SizeConstants.Tiny,
                SizeConstants.Diminutive,
                SizeConstants.Fine,
            };

            var creatures = CreatureConstants.GetAll();
            var names     = sizes.Union(creatures);

            AssertCollectionNames(names);
        }
Example #11
0
        public void SkillBonusesNames()
        {
            var creatures = CreatureConstants.GetAll();
            var types     = CreatureConstants.Types.GetAll();
            var subtypes  = CreatureConstants.Types.Subtypes.GetAll();

            var foci   = collectionMapper.Map(TableNameConstants.Collection.FeatFoci);
            var skills = foci[GroupConstants.Skills];

            var nonFociSkills = new[]
            {
                SkillConstants.Craft,
                SkillConstants.Knowledge,
                SkillConstants.Perform,
                SkillConstants.Profession,
            };

            var names = creatures.Union(types).Union(subtypes).Union(skills).Union(nonFociSkills);

            AssertCollectionNames(names);
        }
        public void performCurrentTask()
        {
            _previousActionSteps = currentActionSteps;
            // DO TASK //
            ActionStep currentStep = currentActionSteps[_currentStepNum];

            //Debug.LogWarning("Current action - " + currentStep.getAction());
            currentStep.performAction(creature);
            // TASK UPDATE COMPLETE - Check status //
            if (currentStep.isStatus(Tasks.TASK_STATUS.Complete))
            {
                //Debug.LogWarning("Step complete - " + currentStep.getAction());
                // Next step //
                if (_currentStepNum != currentActionSteps.Length - 1)
                {
                    ActionStep previousStep = currentActionSteps[_currentStepNum];
                    _currentStepNum++;
                    currentStep = currentActionSteps[_currentStepNum];
                    // If the new step doesn't have a target, and this one did, copy it over, For example Locate //
                    if (!currentStep.HasTargetThing() &&
                        previousStep.HasTargetThing())
                    {
                        currentStep.SetTarget(previousStep._targetThing);
                    }
                    else if (!currentStep.HasTargetPosition() &&
                             previousStep.HasTargetPosition())
                    {
                        currentStep.SetTargetPosition(previousStep._targetPosition);
                    }
                    else
                    {
                        //Debug.LogWarning("No step target from previous, currentstep-previousstep " + currentStep.getAction() + "-" + previousStep.getAction());
                    }
                    creature.SetNavMeshAgentDestination(currentStep._targetPosition);
                    taskStatus = Tasks.TASK_STATUS.Incomplete;
                }
                else
                {
                    taskStatus = Tasks.TASK_STATUS.Complete;
                    creature.RequestObservationUpdate();
                }
                return;
            }
            // FAILED //
            else if (currentStep.isStatus(Tasks.TASK_STATUS.Failed))
            {
                // Notify creature of failure to record/discard as needed //
                creature.SoThisFailed(currentStep);
                ActionStep[] steps = CreatureConstants.GetExceptionActions(taskType, currentStep.failReason, creature);
                if (steps != null)
                {
                    _previousActionSteps = currentActionSteps;
                    currentActionSteps   = steps;
                    _currentStepNum      = 0;
                    taskStatus           = Tasks.TASK_STATUS.Started;
                }
                else
                {
                    taskStatus = Tasks.TASK_STATUS.Cancelled;
                }
                return;
            }
        }
Example #13
0
 public void StressSetup()
 {
     allCreatures     = CreatureConstants.GetAll();
     allTemplates     = CreatureConstants.Templates.GetAll();
     creatureVerifier = GetNewInstanceOf <ICreatureVerifier>();
 }
Example #14
0
        public void SpellGroupsHaveAllNames()
        {
            var casters = new[]
            {
                SpellConstants.Casters.Bard,
                SpellConstants.Casters.Cleric,
                SpellConstants.Casters.Druid,
                SpellConstants.Casters.Sorcerer,
            };

            var domains = new[]
            {
                SpellConstants.Domains.Air,
                SpellConstants.Domains.Animal,
                SpellConstants.Domains.Chaos,
                SpellConstants.Domains.Destruction,
                SpellConstants.Domains.Earth,
                SpellConstants.Domains.Enchantment,
                SpellConstants.Domains.Evil,
                SpellConstants.Domains.Fire,
                SpellConstants.Domains.Good,
                SpellConstants.Domains.Healing,
                SpellConstants.Domains.Illusion,
                SpellConstants.Domains.Knowledge,
                SpellConstants.Domains.Law,
                SpellConstants.Domains.Luck,
                SpellConstants.Domains.Plant,
                SpellConstants.Domains.Protection,
                SpellConstants.Domains.Sun,
                SpellConstants.Domains.Trickery,
                SpellConstants.Domains.War,
                SpellConstants.Domains.Water,
            };

            var creatureProhibited = CreatureConstants.GetAll()
                                     .Select(c => $"{c}:Prohibited");

            var alignmentProhibited = new[]
            {
                $"{AlignmentConstants.Chaotic}:Prohibited",
                $"{AlignmentConstants.Neutral}:Prohibited",
                $"{AlignmentConstants.Evil}:Prohibited",
                $"{AlignmentConstants.Lawful}:Prohibited",
                $"{AlignmentConstants.Good}:Prohibited",
            };

            var casterProhibited = casters
                                   .Select(c => $"{c}:Prohibited");

            var domainProhibited = domains
                                   .Select(d => $"{d}:Prohibited");

            var names = casters
                        .Union(domains)
                        .Union(creatureProhibited)
                        .Union(alignmentProhibited)
                        .Union(casterProhibited)
                        .Union(domainProhibited);

            AssertCollectionNames(names);
        }
Example #15
0
        public void CastersContainsAllCreatures()
        {
            var names = CreatureConstants.GetAll();

            AssertCollectionNames(names);
        }