public override bool Apply(NPC npc, World world)
    {
        var candidates = world.AllNPCs.Where(n => {
            return(npc.Gender != n.Gender &&
                   Math.Abs(npc.Age - n.Age) < 10 &&
                   npc.Age > 18 && n.Age > 18);
        });

        if (candidates.Count() == 0)
        {
            return(false);
        }

        Target = candidates.ElementAt(DDRand.Int(0, candidates.Count() - 1));
        return(true);
    }
Esempio n. 2
0
    public static List <NPC> GenerateNPCs()
    {
        var npcs = new List <NPC>();

        var npc = new NPC()
        {
            Name   = "Gedrick",
            Age    = GenerateAge(30, 45),
            Gender = Gender.Male,
        };

        npc.Skills.Add(new Skill(Skills.Blacksmithing, DDRand.Double(0.4, 0.65)));
        npc.Roles.Add(Skills.Blacksmithing);
        npcs.Add(npc);

        return(npcs);
    }