Exemplo n.º 1
0
 public override IEnumerable <StatusEffect> GetGoodInterventions(Deity self, Level level, Agent agent)
 {
     if (Globals.Random.Next(100) < _chanceOfItem)
     {
         var gift = new StatusEffect {
             Name           = null,
             TurnsRemaining = 1
         };
         gift.AddEffect(null,
                        () => {
             _chanceOfItem /= 2;
             var item       = level.Catalog.NewArmor(0, 0);
             item.DEF      += 1;
             var materials  = self.GetPreferredMaterials().ToArray();
             if (materials.Any())
             {
                 var material     = materials[Globals.Random.Next(materials.Length)];
                 item.MadeOf      = material;
                 item.DisplayName = $"{material} armor of {self.Name}";
             }
             else
             {
                 item.DisplayName = $"{item.DisplayName} of {self.Name}";
             }
             agent.Messages.Add($"[color={Globals.TextColorGood}]{self.Name}[/color] gives you a gift");
             new PickupItem().Do(level, agent, item);
         },
                        () => {});
         yield return(gift);
     }
 }
Exemplo n.º 2
0
    private static void MakeDeities()
    {
        MakeLanguage();

        var types = System.Reflection.Assembly
                    .GetExecutingAssembly()
                    .GetTypes();

        var archetypes = types
                         .Where(t => typeof(DeityArchetype).IsAssignableFrom(t) && !t.IsInterface && !t.IsAbstract)
                         .Select(t => (DeityArchetype)Activator.CreateInstance(t))
                         .ToList();

        var domains = types
                      .Where(t => typeof(DeityDomain).IsAssignableFrom(t) && !t.IsInterface && !t.IsAbstract)
                      .Select(t => (DeityDomain)Activator.CreateInstance(t))
                      .ToList();

        while (archetypes.Any() &&
               domains.Any() &&
               Deities.Count < 4)
        {
            var deity = new Deity {
                Name      = MakeDeityName(),
                Pronoun   = Globals.Random.NextDouble() < 0.5 ? "he" : "she",
                Archetype = archetypes[Random.Next(archetypes.Count)]
            };
            archetypes.Remove(deity.Archetype);
            deity.FavorPerTeam["player"] = 0;
            deity.FavorPerTeam["undead"] = 0;
            deity.FavorPerTeam["plants"] = 0;

            while (domains.Any() && deity.Domains.Count < deity.Archetype.NumberOfDomains)
            {
                var domain = domains[Random.Next(domains.Count)];
                domains.Remove(domain);
                deity.Domains.Add(domain);
            }

            Deities.Add(deity);
        }

        foreach (var deity in Deities)
        {
            deity.Finalize(Deities);

            foreach (var material in deity.GetPreferredMaterials())
            {
                deity.Likes.Add($"things made of {material}");
            }

            GD.Print(deity.GetFullTitle());
        }
    }