예제 #1
0
        public static Entity MakeRelic()
        {
            Entity         item;
            RelicArchetype archetype = RandomUtils.EnumRandom <RelicArchetype>();

            switch (archetype)
            {
            default:
            case RelicArchetype.MeleeWeapon:
            case RelicArchetype.TossingWeapon:
                item = TossingWeaponFunctions.Random().Invoke();
                break;

            case RelicArchetype.RangedWeapon:
            case RelicArchetype.Wearable:
            case RelicArchetype.Utility:
            case RelicArchetype.MagicWeapon:
                item = MagicWeaponFunctions.Random().Invoke();
                break;
            }
            Components.Relic comp = new Components.Relic();
            item.AddComponent(comp);
            NameRelic(item, comp);
            return(item);
        }
예제 #2
0
        private static void NameRelic(Entity relic, Components.Relic comp)
        {
            string[] tokens = Assets.RelicNames.text.Split(new[] { Environment.NewLine },
                                                           StringSplitOptions.RemoveEmptyEntries);

            int r = Random.Range(0, 11);

            switch (r)
            {
            case 0:     // Noun Noun
            {
                string noun1 = tokens.Random().Split(',')[0];
                string noun2 = tokens.Random().Split(',')[0];
                comp.Name = $"{noun1} {noun2}";
                break;
            }

            case 1:     // Adjective Noun
            {
                string noun = tokens.Random().Split(',')[0];
                string adj  = tokens.Random().Split(',')[1];
                comp.Name = $"{adj} {noun}";
                break;
            }

            case 2:     // Name's Noun
            {
                string noun   = tokens.Random().Split(',')[0];
                Markov markov = new Markov(3);
                comp.Name = $"{markov.GetName()}'s {noun}";
                break;
            }

            case 3:     // Adjective Number
            {
                string adj = tokens.Random().Split(',')[1];
                comp.Name = $"{adj} {Random.Range(0, 1000)}";
                break;
            }

            case 4:     // Noun Number
            {
                string noun = tokens.Random().Split(',')[0];
                comp.Name = $"{noun} {Random.Range(0, 1000)}";
                break;
            }

            case 5:     // Nounmonger
            {
                string noun = tokens.Random().Split(',')[0];
                comp.Name = $"{noun}monger";
                break;
            }

            case 6:     // Nounbringer
            {
                string noun = tokens.Random().Split(',')[0];
                comp.Name = $"{noun}bringer";
                break;
            }

            case 7:     // Noun's Noun
            {
                string noun1 = tokens.Random().Split(',')[0];
                string noun2 = tokens.Random().Split(',')[0];
                comp.Name = $"{noun1}'s {noun2}";
                break;
            }

            case 8:     // Nounborn
            {
                string noun = tokens.Random().Split(',')[0];
                comp.Name = $"{noun}born";
                break;
            }

            case 9:     // Baseitem of Noun
            {
                string noun  = tokens.Random().Split(',')[0];
                string basic =
                    relic.Flyweight.EntityName.First().ToString().ToUpper() +
                    relic.Flyweight.EntityName.Substring(1);
                comp.Name = $"The {basic} of {noun}";
                break;
            }

            default:     // The Noun of Name
            {
                string noun   = tokens.Random().Split(',')[0];
                Markov markov = new Markov(3);
                comp.Name = $"The {noun} of {markov.GetName()}";
                break;
            }
            }
        }