Exemplo n.º 1
0
        public void OnDeserialized(StreamingContext ctx)
        {
            World         = ctx.Context as WorldManager;
            ParentFaction = World.Overworld.Natives.FirstOrDefault(n => n.Name == ParentFactionName);

            Threats.RemoveAll(threat => threat == null || threat.IsDead);
            Minions.RemoveAll(minion => minion == null || minion.IsDead);
        }
Exemplo n.º 2
0
        public OverworldFaction GenerateOverworldFaction(Overworld Settings, int idx, int n)
        {
            var race = Library.GetRandomIntelligentRace();

            var fact = new OverworldFaction()
            {
                Race               = race.Name,
                Name               = TextGenerator.ToTitleCase(TextGenerator.GenerateRandom(Datastructures.SelectRandom(race.FactionNameTemplates).ToArray())),
                PrimaryColor       = new HSLColor(idx * (255.0f / n), 255.0, MathFunctions.Rand(100.0f, 200.0f)),
                GoodWill           = MathFunctions.Rand(-1, 1),
                InteractiveFaction = true
            };

            return(fact);
        }
Exemplo n.º 3
0
 public Faction(WorldManager World, OverworldFaction descriptor)
 {
     this.World        = World;
     ParentFaction     = descriptor;
     ParentFactionName = descriptor.Name;
 }
Exemplo n.º 4
0
        public static Politics CreatePolitivs(OverworldFaction thisFaction, OverworldFaction otherFaction)
        {
            if (thisFaction.Name == otherFaction.Name)
            {
                var politics = new Politics()
                {
                    OwnerFaction = thisFaction,
                    OtherFaction = otherFaction,
                    HasMet       = true
                };

                politics.AddEvent(new PoliticalEvent()
                {
                    Change      = 1.0f,
                    Description = "we are of the same faction",
                });

                return(politics);
            }
            else
            {
                var politics = new Politics()
                {
                    OwnerFaction = thisFaction,
                    OtherFaction = otherFaction,
                    HasMet       = false,
                };

                if (thisFaction.Race == otherFaction.Race)
                {
                    politics.AddEvent(new PoliticalEvent()
                    {
                        Change      = 0.5f,
                        Description = "we are of the same people",
                    });
                }

                if (Library.GetRace(thisFaction.Race).HasValue(out var thisFactionRace) && Library.GetRace(otherFaction.Race).HasValue(out var otherRace))
                {
                    if (thisFactionRace.NaturalEnemies.Any(name => name == otherRace.Name) || otherRace.NaturalEnemies.Any(name => name == thisFactionRace.Name))
                    {
                        if (!politics.HasEvent("we are taught to hate your kind"))
                        {
                            politics.AddEvent(new PoliticalEvent()
                            {
                                Change      = -10.0f, // Make this negative and we get an instant war party rush.
                                Description = "we are taught to hate your kind",
                            });
                        }
                    }

                    if (thisFactionRace.IsIntelligent && otherRace.IsIntelligent)
                    {
                        if (thisFaction.GoodWill < -0.8f || otherFaction.GoodWill < -0.8f)
                        {
                            if (!politics.HasEvent("we just don't trust you"))
                            {
                                politics.AddEvent(new PoliticalEvent()
                                {
                                    Change      = -10.0f, // Make this negative and we get an instant war party rush.
                                    Description = "we just don't trust you",
                                });
                                politics.IsAtWar = true;
                            }
                        }
                        else if (thisFaction.GoodWill > 0.8f || otherFaction.GoodWill > 0.8f)
                        {
                            if (!politics.HasEvent("we just trust you"))
                            {
                                politics.AddEvent(new PoliticalEvent()
                                {
                                    Change      = 10.0f,
                                    Description = "we just trust you",
                                });
                            }
                        }
                    }
                }

                return(politics);
            }
        }