예제 #1
0
 public Creature(
     ComponentManager Manager,
     CreatureStats stats,
     string allies,
     PlanService planService,
     Faction faction,
     string name) :
     base(Manager, name, stats.MaxHealth, 0.0f, stats.MaxHealth)
 {
     Gender = Mating.RandomGender();
     DrawLifeTimer.HasTriggered = true;
     HasMeat               = true;
     HasBones              = true;
     HasCorpse             = false;
     Buffs                 = new List <Buff>();
     IsOnGround            = true;
     Stats                 = stats;
     Faction               = faction;
     PlanService           = planService;
     Allies                = allies;
     Controller            = new PIDController(Stats.MaxAcceleration, Stats.StoppingForce * 2, 0.0f);
     JumpTimer             = new Timer(0.2f, true);
     Status                = new CreatureStatus();
     IsHeadClear           = true;
     NoiseMaker            = new NoiseMaker();
     OverrideCharacterMode = false;
 }
예제 #2
0
        public NonPlayerDwarf(ComponentManager manager, CreatureStats stats, Faction faction, string name, Vector3 position) :
            base(manager, stats, faction, name)
        {
            Physics = new Physics(manager, "Dwarf", Matrix.CreateTranslation(position),
                                  new Vector3(0.5f, 0.5f, 0.5f), new Vector3(0.0f, -0.25f, 0.0f), 1.0f, 1.0f, 0.999f, 0.999f, new Vector3(0, -10, 0));
            Physics.AddChild(this);

            Stats.Gender        = Mating.RandomGender();
            Stats.VoicePitch    = DwarfFactory.GetRandomVoicePitch(Stats.Gender);
            Physics.Orientation = Physics.OrientMode.RotateY;

            CreateCosmeticChildren(Manager);

            Physics.AddChild(new EnemySensor(Manager, "EnemySensor", Matrix.Identity, new Vector3(10, 5, 10), Vector3.Zero));
            Physics.AddChild(new CreatureAI(Manager, "Non Player Dwarf AI", Sensor));
            Physics.AddChild(new Inventory(Manager, "Inventory", Physics.BoundingBox.Extents(), Physics.LocalBoundingBoxOffset));

            Physics.Tags.Add("Dwarf");

            Physics.AddChild(new Flammable(Manager, "Flames"));

            Stats.FullName = TextGenerator.GenerateRandom("$firstname", " ", "$lastname");
            Stats.FindAdjustment("base stats").Size = 5;

            AI.Movement.CanClimbWalls = true; // Why isn't this a flag like the below?
            AI.Movement.SetCost(MoveType.ClimbWalls, 50.0f);
            AI.Movement.SetSpeed(MoveType.ClimbWalls, 0.15f);

            AI.Biography = Applicant.GenerateBiography(AI.Stats.FullName, Stats.Gender);
            Stats.Money  = (decimal)MathFunctions.Rand(0, 150);
        }
예제 #3
0
        public IEnumerable <Act.Status> Mate(Creature me)
        {
            Timer mateTimer = new Timer(5.0f, true);

            while (!mateTimer.HasTriggered)
            {
                me.Physics.Velocity        = Vector3.Zero;
                Them.Physics.Velocity      = Vector3.Zero;
                Them.Physics.LocalPosition = me.Physics.Position * 0.1f + Them.Physics.Position * 0.9f;
                if (MathFunctions.RandEvent(0.01f))
                {
                    me.NoiseMaker.MakeNoise("Hurt", me.AI.Position, true, 0.1f);
                    me.World.ParticleManager.Trigger("puff", me.AI.Position, Color.White, 1);
                }
                mateTimer.Update(DwarfTime.LastTime);
                yield return(Act.Status.Running);
            }

            if (Mating.CanMate(me, Them.Creature))
            {
                Mating.Mate(me, Them.Creature, me.World.Time);
            }
            else
            {
                AutoRetry = false;
                yield return(Act.Status.Fail);
            }

            yield return(Act.Status.Success);
        }
예제 #4
0
 public override Feasibility IsFeasible(Creature agent)
 {
     if (Them == null || Them.IsDead || agent == null || agent.IsDead || agent.AI == null)
     {
         return(Feasibility.Infeasible);
     }
     return(Mating.CanMate(agent, Them.Creature) ? Feasibility.Feasible : Feasibility.Infeasible);
 }
예제 #5
0
        public Creature()
        {
            CurrentCharacterMode = CharacterMode.Idle;

            OverrideCharacterMode = false;
            Buffs     = new List <Buff>();
            HasMeat   = true;
            HasBones  = true;
            HasCorpse = false;
            DrawLifeTimer.HasTriggered = true;
            Gender = Mating.RandomGender();
        }
예제 #6
0
        public static string GenerateBiography(string Name, Gender Gender)
        {
            var hobbyTemplates = TextGenerator.GetAtoms(ContentPaths.Text.Templates.hobby);
            var hobby          = TextGenerator.GenerateRandom(new List <string>(),
                                                              hobbyTemplates[MathFunctions.Random.Next(hobbyTemplates.Count)].ToArray());
            var biographyTemplates = TextGenerator.GetAtoms(ContentPaths.Text.Templates.biography);

            return(TextGenerator.ToSentenceCase(TextGenerator.GenerateRandom(
                                                    new List <string> {
                Name, Gender.ToString(), hobby, Mating.Pronoun(Gender), Mating.Posessive(Gender)
            },
                                                    biographyTemplates[MathFunctions.Random.Next(biographyTemplates.Count)].ToArray())));
        }
예제 #7
0
        public Dwarf(ComponentManager manager, CreatureStats stats, Faction faction, string name, Vector3 position) :
            base(manager, stats, faction, name)
        {
            Physics = new Physics(manager, "Dwarf", Matrix.CreateTranslation(position),
                                  new Vector3(0.5f, 0.5f, 0.5f), new Vector3(0.0f, -0.25f, 0.0f), 1.0f, 1.0f, 0.999f, 0.999f, new Vector3(0, -10, 0));

            Physics.AddChild(this);

            Stats.Gender        = Mating.RandomGender();
            Physics.Orientation = Physics.OrientMode.RotateY;

            CreateCosmeticChildren(Manager);

            Physics.AddChild(new EnemySensor(Manager, "EnemySensor", Matrix.Identity, new Vector3(10, 5, 10), Vector3.Zero));
            Physics.AddChild(new DwarfAI(Manager, "Dwarf AI", Sensor));
            Physics.AddChild(new Inventory(Manager, "Inventory", Physics.BoundingBox.Extents(), Physics.LocalBoundingBoxOffset));
            Physics.AddChild(new Equipment(Manager));

            Physics.Tags.Add("Dwarf");

            Physics.AddChild(new Flammable(Manager, "Flames"));

            Stats.FullName = TextGenerator.GenerateRandom("$firstname", " ", "$lastname");
            Stats.FindAdjustment("base stats").Size = 5;
            Stats.CanEat = true;
            AI.Movement.CanClimbWalls = true; // Why isn't this a flag like the below?
            AI.Movement.SetCan(MoveType.Teleport, true);
            AI.Movement.SetCost(MoveType.Teleport, 1.0f);
            AI.Movement.SetSpeed(MoveType.Teleport, 10.0f);
            AI.Movement.SetCost(MoveType.ClimbWalls, 50.0f);
            AI.Movement.SetSpeed(MoveType.ClimbWalls, 0.15f);
            AI.Movement.SetCan(MoveType.EnterVehicle, true);
            AI.Movement.SetCan(MoveType.ExitVehicle, true);
            AI.Movement.SetCan(MoveType.RideVehicle, true);
            AI.Movement.SetCost(MoveType.EnterVehicle, 0.01f);
            AI.Movement.SetCost(MoveType.ExitVehicle, 0.01f);
            AI.Movement.SetCost(MoveType.RideVehicle, 0.01f);
            AI.Movement.SetSpeed(MoveType.RideVehicle, 3.0f);
            AI.Movement.SetSpeed(MoveType.EnterVehicle, 1.0f);
            AI.Movement.SetSpeed(MoveType.ExitVehicle, 1.0f);
            if (AI.Stats.IsTaskAllowed(TaskCategory.Dig))
            {
                AI.Movement.SetCan(MoveType.Dig, true);
            }
            AI.Biography = Applicant.GenerateBiography(AI.Stats.FullName, Stats.Gender);
            Stats.Money  = (decimal)MathFunctions.Rand(0, 150);

            Physics.AddChild(new DwarfThoughts(Manager, "Thoughts"));
        }
예제 #8
0
 public Creature(
     ComponentManager Manager,
     CreatureStats stats,
     Faction faction,
     string name) :
     base(Manager, name, stats.MaxHealth, 0.0f, stats.MaxHealth)
 {
     Stats        = stats;
     Stats.Gender = Mating.RandomGender();
     DrawLifeTimer.HasTriggered = true;
     IsOnGround            = true;
     Faction               = faction;
     Controller            = new PIDController(Stats.MaxAcceleration, Stats.StoppingForce * 2, 0.0f);
     IsHeadClear           = true;
     NoiseMaker            = new NoiseMaker();
     NoiseMaker.BasePitch  = stats.VoicePitch;
     OverrideCharacterMode = false;
     InitializeAttacks();
 }
예제 #9
0
        public void GenerateRandom(String ClassName, int level, CompanyInformation info)
        {
            this.ClassName = ClassName;
            Class          = Library.GetClass(ClassName);
            LevelIndex     = level;
            Gender         = Mating.RandomGender();
            Name           = TextGenerator.GenerateRandom("$firstname", " ", "$lastname");
            List <string> justifications = new List <string>()
            {
                "I have many relevant qualities!",
                "My expereince is extensive!",
                "I really need this job!",
                "I need to get away from it all!",
                "I will be your loyal servant!",
                "I've always wanted to work at " + info.Name + "!",
                "I am a very hard worker!",
                "I am an adventurous soul!"
            };

            CoverLetter =
                TextGenerator.GenerateRandom("${Dear,Hey,Hi,Hello,Sup,Yo}", " ", info.Name, ",\n    ",
                                             "${Please,Do}", " ", "${consider,check out,look at,see,view}", " ", "${my,this}", " ",
                                             "${application for the position of, resume for, request to be a,offer as}", " "
                                             + Level.Name + ". " + justifications[MathFunctions.Random.Next(justifications.Count)] + " \n",
                                             "${Thanks,Sincerely,Yours,--,Always}", ",\n    ", Name);

            if (level > 0)
            {
                FormerProfession = Class.Levels[level - 1].Name;
            }
            else
            {
                FormerProfession = TextGenerator.GenerateRandom("$profession");
            }


            var templates = TextGenerator.GetAtoms(ContentPaths.Text.Templates.location);

            HomeTown = TextGenerator.GenerateRandom(new List <string>(),
                                                    templates[MathFunctions.Random.Next(templates.Count)].ToArray());

            Biography = GenerateBiography(Name, Gender);
        }
예제 #10
0
        public void HandleReproduction()
        {
            if (!Creature.Stats.Species.CanReproduce)
            {
                return;
            }
            if (Creature.IsPregnant)
            {
                return;
            }
            if (!MathFunctions.RandEvent(0.0002f))
            {
                return;
            }
            if (CurrentTask != null)
            {
                return;
            }
            IEnumerable <CreatureAI> potentialMates =
                Faction.Minions.Where(minion => minion != this && Mating.CanMate(minion.Creature, this.Creature));
            CreatureAI closestMate = null;
            float      closestDist = float.MaxValue;

            foreach (var ai in potentialMates)
            {
                var dist = (ai.Position - Position).LengthSquared();
                if (!(dist < closestDist))
                {
                    continue;
                }
                closestDist = dist;
                closestMate = ai;
            }

            if (closestMate != null && closestDist < 30)
            {
                Tasks.Add(new MateTask(closestMate));
            }
        }
예제 #11
0
        public void Initialize(EmployeeClass dwarfClass)
        {
            Gender = Mating.RandomGender();
            Physics.Orientation = Physics.OrientMode.RotateY;
            CreateSprite(dwarfClass, Manager);

            Hands = Physics.AddChild(new Grabber("hands", Manager, Matrix.Identity, new Vector3(0.1f, 0.1f, 0.1f), Vector3.Zero)) as Grabber;

            Sensors = Physics.AddChild(new EnemySensor(Manager, "EnemySensor", Matrix.Identity, new Vector3(20, 5, 20), Vector3.Zero)) as EnemySensor;

            AI = Physics.AddChild(new CreatureAI(Manager, "Dwarf AI", Sensors, PlanService)) as CreatureAI;

            Attacks = new List <Attack>()
            {
                new Attack(Stats.CurrentClass.Attacks[0])
            };

            Inventory = Physics.AddChild(new Inventory(Manager, "Inventory", Physics.BoundingBox.Extents(), Physics.BoundingBoxPos)) as Inventory;


            Physics.Tags.Add("Dwarf");

            Physics.AddChild(new ParticleTrigger("blood_particle", Manager, "Death Gibs", Matrix.Identity, Vector3.One, Vector3.Zero)
            {
                TriggerOnDeath  = true,
                TriggerAmount   = 1,
                BoxTriggerTimes = 10,
                SoundToPlay     = ContentPaths.Entities.Dwarf.Audio.dwarfhurt1,
            });

            Physics.AddChild(new Flammable(Manager, "Flames"));

            Physics.AddChild(Shadow.Create(0.75f, Manager));

            NoiseMaker.Noises["Hurt"] = new List <string>
            {
                ContentPaths.Audio.Oscar.sfx_ic_dwarf_hurt_1,
                ContentPaths.Audio.Oscar.sfx_ic_dwarf_hurt_2,
            };

            NoiseMaker.Noises["Ok"] = new List <string>()
            {
                ContentPaths.Audio.Oscar.sfx_ic_dwarf_ok_1,
                ContentPaths.Audio.Oscar.sfx_ic_dwarf_ok_2,
                ContentPaths.Audio.Oscar.sfx_ic_dwarf_ok_3
            };

            NoiseMaker.Noises["Die"] = new List <string>()
            {
                ContentPaths.Audio.Oscar.sfx_ic_dwarf_death
            };

            NoiseMaker.Noises["Pleased"] = new List <string>()
            {
                ContentPaths.Audio.Oscar.sfx_ic_dwarf_pleased
            };

            NoiseMaker.Noises["Tantrum"] = new List <string>()
            {
                ContentPaths.Audio.Oscar.sfx_ic_dwarf_tantrum_1,
                ContentPaths.Audio.Oscar.sfx_ic_dwarf_tantrum_2,
                ContentPaths.Audio.Oscar.sfx_ic_dwarf_tantrum_3,
            };
            NoiseMaker.Noises["Jump"] = new List <string>()
            {
                ContentPaths.Audio.Oscar.sfx_ic_dwarf_jump
            };

            NoiseMaker.Noises["Climb"] = new List <string>()
            {
                ContentPaths.Audio.Oscar.sfx_ic_dwarf_climb_1,
                ContentPaths.Audio.Oscar.sfx_ic_dwarf_climb_2,
                ContentPaths.Audio.Oscar.sfx_ic_dwarf_climb_3
            };

            MinimapIcon minimapIcon = Physics.AddChild(new MinimapIcon(Manager, new NamedImageFrame(ContentPaths.GUI.map_icons, 16, 0, 0))) as MinimapIcon;

            Stats.FullName            = TextGenerator.GenerateRandom("$firstname", " ", "$lastname");
            Stats.Size                = 5;
            Stats.CanSleep            = true;
            Stats.CanEat              = true;
            AI.Movement.CanClimbWalls = true;
            AI.Movement.SetCost(MoveType.ClimbWalls, 50.0f);
            AI.Movement.SetSpeed(MoveType.ClimbWalls, 0.15f);
            AI.TriggersMourning = true;
            AI.Biography        = Applicant.GenerateBiography(AI.Stats.FullName, Gender);
            Species             = "Dwarf";
        }
예제 #12
0
 private static GameComponent __factory4(ComponentManager Manager, Vector3 Position, Blackboard Data)
 {
     return(GenerateDwarf(Position, Manager, "Player", JobLibrary.Classes[JobLibrary.JobType.MusketDwarf], 0, Mating.RandomGender(), MathFunctions.Random.Next()));
 }
예제 #13
0
 public override bool IsFeasible(Creature agent)
 {
     return(Mating.CanMate(agent, Them.Creature));
 }
예제 #14
0
 public override Feasibility IsFeasible(Creature agent)
 {
     return(Mating.CanMate(agent, Them.Creature) ? Feasibility.Feasible : Feasibility.Infeasible);
 }
예제 #15
0
        public void Initialize(EmployeeClass dwarfClass)
        {
            Stats.Gender        = Mating.RandomGender();
            Physics.Orientation = Physics.OrientMode.RotateY;
            CreateDwarfSprite(dwarfClass, Manager);

            Physics.AddChild(new EnemySensor(Manager, "EnemySensor", Matrix.Identity, new Vector3(20, 5, 20), Vector3.Zero));

            Physics.AddChild(new CreatureAI(Manager, "Dwarf AI", Sensors, PlanService));

            Attacks = new List <Attack>()
            {
                new Attack(Stats.CurrentClass.Attacks[0])
            };

            Physics.AddChild(new Inventory(Manager, "Inventory", Physics.BoundingBox.Extents(), Physics.LocalBoundingBoxOffset));


            Physics.Tags.Add("Dwarf");

            Physics.AddChild(new ParticleTrigger("blood_particle", Manager, "Death Gibs", Matrix.Identity, Vector3.One, Vector3.Zero)
            {
                TriggerOnDeath  = true,
                TriggerAmount   = 1,
                BoxTriggerTimes = 10,
                SoundToPlay     = ContentPaths.Entities.Dwarf.Audio.dwarfhurt1,
            });

            Physics.AddChild(new Flammable(Manager, "Flames"));

            Physics.AddChild(Shadow.Create(0.75f, Manager));

            NoiseMaker.Noises["Hurt"] = new List <string>
            {
                ContentPaths.Audio.Oscar.sfx_ic_dwarf_hurt_1,
                ContentPaths.Audio.Oscar.sfx_ic_dwarf_hurt_2,
            };

            NoiseMaker.Noises["Ok"] = new List <string>()
            {
                ContentPaths.Audio.Oscar.sfx_ic_dwarf_ok_1,
                ContentPaths.Audio.Oscar.sfx_ic_dwarf_ok_2,
                ContentPaths.Audio.Oscar.sfx_ic_dwarf_ok_3
            };

            NoiseMaker.Noises["Die"] = new List <string>()
            {
                ContentPaths.Audio.Oscar.sfx_ic_dwarf_death
            };

            NoiseMaker.Noises["Pleased"] = new List <string>()
            {
                ContentPaths.Audio.Oscar.sfx_ic_dwarf_pleased
            };

            NoiseMaker.Noises["Tantrum"] = new List <string>()
            {
                ContentPaths.Audio.Oscar.sfx_ic_dwarf_tantrum_1,
                ContentPaths.Audio.Oscar.sfx_ic_dwarf_tantrum_2,
                ContentPaths.Audio.Oscar.sfx_ic_dwarf_tantrum_3,
            };
            NoiseMaker.Noises["Jump"] = new List <string>()
            {
                ContentPaths.Audio.Oscar.sfx_ic_dwarf_jump
            };

            NoiseMaker.Noises["Climb"] = new List <string>()
            {
                ContentPaths.Audio.Oscar.sfx_ic_dwarf_climb_1,
                ContentPaths.Audio.Oscar.sfx_ic_dwarf_climb_2,
                ContentPaths.Audio.Oscar.sfx_ic_dwarf_climb_3
            };

            MinimapIcon minimapIcon = Physics.AddChild(new MinimapIcon(Manager, new NamedImageFrame(ContentPaths.GUI.map_icons, 16, 0, 0))) as MinimapIcon;

            Stats.FullName            = TextGenerator.GenerateRandom("$firstname", " ", "$lastname");
            Stats.Size                = 5;
            Stats.CanSleep            = true;
            Stats.CanEat              = true;
            Stats.CanGetBored         = true;
            AI.Movement.CanClimbWalls = true; // Why isn't this a flag like the below?
            AI.Movement.SetCan(MoveType.Teleport, true);
            AI.Movement.SetCost(MoveType.Teleport, 1.0f);
            AI.Movement.SetSpeed(MoveType.Teleport, 10.0f);
            AI.Movement.SetCost(MoveType.ClimbWalls, 50.0f);
            AI.Movement.SetSpeed(MoveType.ClimbWalls, 0.15f);
            AI.Movement.SetCan(MoveType.EnterVehicle, true);
            AI.Movement.SetCan(MoveType.ExitVehicle, true);
            AI.Movement.SetCan(MoveType.RideVehicle, true);
            AI.Movement.SetCost(MoveType.EnterVehicle, 1.0f);
            AI.Movement.SetCost(MoveType.ExitVehicle, 1.0f);
            AI.Movement.SetCost(MoveType.RideVehicle, 0.01f);
            AI.Movement.SetSpeed(MoveType.RideVehicle, 3.0f);
            AI.Movement.SetSpeed(MoveType.EnterVehicle, 1.0f);
            AI.Movement.SetSpeed(MoveType.ExitVehicle, 1.0f);
            if (AI.Stats.IsTaskAllowed(Task.TaskCategory.Dig))
            {
                AI.Movement.SetCan(MoveType.Dig, true);
            }
            AI.TriggersMourning = true;
            AI.Biography        = Applicant.GenerateBiography(AI.Stats.FullName, Stats.Gender);
            Species             = "Dwarf";
            Status.Money        = (decimal)MathFunctions.Rand(0, 150);

            Physics.AddChild(new VoxelRevealer(Manager, Physics, 5)).SetFlag(Flag.ShouldSerialize, false);

            Physics.AddChild(new DwarfThoughts(Manager, "Thoughts"));
        }
예제 #16
0
 private static GameComponent __factory5(ComponentManager Manager, Vector3 Position, Blackboard Data)
 {
     return(GenerateDwarf(Position, Manager, "Manager", 0, Mating.RandomGender(), MathFunctions.Random.Next()));
 }