Exemplo n.º 1
0
        private void recipe(object drop, List <string> ingredientNames)
        {
            List <string> produces;
            var           ingredients   = ItemTypeFactory.Instance.ToItemType(ingredientNames);
            Drop          processedDrop = null;

            if (drop is string)
            {
                produces = new List <string> {
                    $"Produces: {(string) drop}"
                };
                processedDrop = DropFactory.parseDrop((string)drop);
            }
            else
            {
                produces = new List <string>
                {
                    "May create a random piece of equipment similar to",
                    "the placed item. Add coins to improve the quality",
                    "and chance of a successful forging."
                };
                processedDrop = drop as Drop;
            }
            Recipes.Add(new Recipe(ingredients, processedDrop, produces));
        }
Exemplo n.º 2
0
 private void felines()
 {
     group("F");
     breed("stray cat", gold, 9, new List <object>()
     {
         new Attack("bite[s]", 3),
         new Attack("scratch[es]", 2),
     }, drop: DropFactory.PercentDrop(10, "Fur Pelt"),
           meander: 3, speed: 1);
 }
Exemplo n.º 3
0
        private void people()
        {
            group("p", tracking: 14, flags: "open-doors");
            breed("simpering knave", orange, 15, new List <object>()
            {
                new Attack("hit[s]", 2),
                new Attack("stab[s]", 4)
            }, drop: new List <Drop>()
            {
                DropFactory.PercentDrop(30, "whip", 1),
                DropFactory.PercentDrop(20, "body", 1),
                DropFactory.PercentDrop(10, "boots", 2),
                DropFactory.PercentDrop(10, "magic", 1),
            }, meander: 3, flags: "cowardly");

            breed("decrepit mage", purple, 16, new List <object>()
            {
                new Attack("hit[s]", 2),
                MoveFactory.sparkBolt(rate: 10, damage: 8)
            }, drop: new List <Drop>()
            {
                DropFactory.PercentDrop(30, "magic", 3),
                DropFactory.PercentDrop(15, "dagger", 1),
                DropFactory.PercentDrop(15, "staff", 1),
                DropFactory.PercentDrop(10, "robe", 2),
                DropFactory.PercentDrop(10, "boots", 2)
            }, meander: 2);

            breed("unlucky ranger", green, 20, new List <object>()
            {
                new Attack("slash[es]", 2),
                MoveFactory.arrow(rate: 4, damage: 2)
            }, drop: new List <Drop>()
            {
                DropFactory.PercentDrop(15, "potion", 3),
                DropFactory.PercentDrop(10, "bow", 4),
                DropFactory.PercentDrop(5, "sword", 4),
                DropFactory.PercentDrop(8, "body", 3)
            }, meander: 2);

            breed("drunken priest", aqua, 18, new List <object>()
            {
                new Attack("hit[s]", 3),
                MoveFactory.heal(rate: 15, amount: 8)
            }, drop: new List <Drop>()
            {
                DropFactory.PercentDrop(15, "scroll", 3),
                DropFactory.PercentDrop(7, "club", 2),
                DropFactory.PercentDrop(7, "robe", 2)
            }, meander: 4, flags: "fearless");
        }
Exemplo n.º 4
0
        private void insects()
        {
            group("i", tracking: 3, meander: 8, flags: "fearless");
            breed("giant cockroach[es]", darkBrown, 4, new List <object>()
            {
                new Attack("crawl[s] on", 3),
                MoveFactory.spawn(rate: 4)
            }, drop: DropFactory.PercentDrop(10, "Insect Wing"),
                  speed: 3);

            breed("giant centipede", red, 16, new List <object>()
            {
                new Attack("crawl[s] on", 3),
                new Attack("bite[s]", 5),
            }, speed: 3, meander: 0);
        }
Exemplo n.º 5
0
        private void flyingInsects()
        {
            group("f", tracking: 5, meander: 8);
            breed("butterfl[y|ies]", lightPurple, 1, new List <object>()
            {
                new Attack("tickle[s] on", 1),
            }, drop: DropFactory.PercentDrop(20, "Insect Wing"),
                  speed: 2, flags: "few fearless");

            breed("bee", yellow, 1, new List <object>()
            {
                new Attack("sting[s]", 2)
            }, speed: 1, flags: "group protective");

            breed("wasp", brown, 1, new List <object>()
            {
                new Attack("sting[s]", 2, ElementFactory.Instance.Poison),
            }, drop: DropFactory.PercentDrop(30, "Stinger"),
                  speed: 2, flags: "berzerk");
        }
Exemplo n.º 6
0
        private void canines()
        {
            group("c", tracking: 20, meander: 3, flags: "few");
            breed("mangy cur", yellow, 11, new List <object>()
            {
                new Attack("bite[s]", 4),
                MoveFactory.howl(range: 6)
            }, drop: DropFactory.PercentDrop(20, "Fur Pelt"));

            breed("wild dog", gray, 16, new List <object>()
            {
                new Attack("bite[s]", 4),
                MoveFactory.howl(range: 8)
            }, drop: DropFactory.PercentDrop(20, "Fur Pelt"));

            breed("mongrel", orange, 28, new List <object>()
            {
                new Attack("bite[s]", 6),
                MoveFactory.howl(range: 10)
            }, drop: DropFactory.PercentDrop(20, "Fur Pelt"));
        }
Exemplo n.º 7
0
        private void birds()
        {
            group("B");
            breed("robin", lightRed, 3, new List <object>()
            {
                new Attack("claw[s]", 1),
            }, drop: DropFactory.PercentDrop(25, "Red Feather"),
                  meander: 4, speed: 2);

            breed("crow", darkGray, 9, new List <object>()
            {
                new Attack("bite[s]", 5),
            }, drop: DropFactory.PercentDrop(25, "Black Feather"),
                  meander: 4, speed: 2, flags: "group");

            breed("raven", gray, 12, new List <object>()
            {
                new Attack("bite[s]", 5),
                new Attack("claw[s]", 4),
            }, drop: DropFactory.PercentDrop(20, "Black Feather"),
                  meander: 1, flags: "protective");
        }
Exemplo n.º 8
0
        private void arachnids()
        {
            group("a", flags: "fearless");
            breed("garden spider", darkAqua, 2,
                  new List <object>()
            {
                new Attack("bite[s]", 2)
            }, drop: DropFactory.PercentDrop(3, "Stinger"),
                  meander: 8, flags: "group");

            breed("brown spider", brown, 1, new List <object>()
            {
                new Attack("bite[s]", 15, ElementFactory.Instance.Poison)
            }, drop: DropFactory.PercentDrop(5, "Stinger"),
                  meander: 8);

            breed("giant spider", darkBlue, 20, new List <object>()
            {
                new Attack("bite[s]", 5, ElementFactory.Instance.Poison)
            }, drop: DropFactory.PercentDrop(10, "Stinger"),
                  meander: 5);
        }
Exemplo n.º 9
0
        private Breed breed(string name, string foreColour, int maxHealth, List <object> actions,
                            object drop = null, int?tracking = null, int meander = 0, int speed = 0, string flags = null  // All optional
                            )
        {
            if (tracking == null)
            {
                tracking = _tracking;
            }

            var attacks = new List <Attack>();
            var moves   = new List <Move>();

            foreach (var action in actions)
            {
                if (action is Attack)
                {
                    attacks.Add(action as Attack);
                }
                if (action is Move)
                {
                    moves.Add(action as Move);
                }
            }

            Drop processedDrop = null;

            if (drop is List <Drop> )
            {
                processedDrop = DropFactory.dropAllOf(drop as List <Drop>);
            }
            else if (drop is Drop)
            {
                processedDrop = DropFactory.dropAllOf(new List <Drop>()
                {
                    drop as Drop
                });
            }
            else if (drop is String)
            {
                processedDrop = DropFactory.parseDrop(drop as string);
            }
            else
            {
                // Non-null way of dropping nothing.
                processedDrop = DropFactory.dropAllOf(new List <Drop>());
            }

            var flagSet = new List <string>();

            if (_flags != null)
            {
                flagSet.AddRange(_flags.Split(' '));
            }
            if (flags != null)
            {
                flagSet.AddRange(flags.Split(' '));
            }

            var breed = new Breed(
                name, Pronouns.It, new Glyph(_glyph, foreColour),
                attacks, moves,
                processedDrop,
                maxHealth: maxHealth,
                tracking: tracking.Value,
                meander: meander + _meander,
                speed: speed + _speed,
                flags: flagSet,
                slug: string.Empty);

            Breeds.Add(breed.Name, breed);
            return(breed);
        }
Exemplo n.º 10
0
        private void kobolds()
        {
            group("k", speed: 2, meander: 4, flags: "cowardly");
            breed("forest sprite", lightGreen, 8, new List <object>()
            {
                new Attack("scratch[es]", 4),
                MoveFactory.teleport(range: 6)
            }, drop: new List <Drop>()
            {
                DropFactory.PercentDrop(20, "magic", 1)
            });

            breed("house sprite", lightBlue, 15, new List <object>()
            {
                new Attack("poke[s]", 8),
                MoveFactory.teleport(range: 6)
            }, drop: new List <Drop>()
            {
                DropFactory.PercentDrop(20, "magic", 6)
            });

            breed("mischievous sprite", lightRed, 24, new List <object>()
            {
                new Attack("stab[s]", 9),
                MoveFactory.sparkBolt(rate: 8, damage: 8),
                MoveFactory.poisonBolt(rate: 15, damage: 10),
                MoveFactory.teleport(range: 8)
            }, drop: new List <Drop>()
            {
                DropFactory.PercentDrop(40, "magic", 8)
            });

            breed("scurrilous imp", lightRed, 18, new List <object>()
            {
                new Attack("club[s]", 4),
                MoveFactory.insult(),
                MoveFactory.haste()
            }, drop: new List <Drop>()
            {
                DropFactory.PercentDrop(10, "club", 1),
                DropFactory.PercentDrop(5, "speed", 1),
            }, meander: 4, flags: "cowardly");

            breed("vexing imp", purple, 19, new List <object>()
            {
                new Attack("scratch[es]", 4),
                MoveFactory.insult(),
                MoveFactory.sparkBolt(rate: 5, damage: 6)
            }, drop: DropFactory.PercentDrop(10, "teleportation", 1),
                  meander: 2, speed: 1, flags: "cowardly");

            breed("kobold", red, 16, new List <object>()
            {
                new Attack("poke[s]", 4),
                MoveFactory.teleport(rate: 6, range: 6)
            }, drop: new List <Drop>()
            {
                DropFactory.PercentDrop(30, "magic", 7)
            }, meander: 2, flags: "group");

            breed("kobold shaman", blue, 16, new List <object>()
            {
                new Attack("hit[s]", 4),
                MoveFactory.teleport(rate: 5, range: 6),
                MoveFactory.waterBolt(rate: 5, damage: 6)
            }, drop: new List <Drop>()
            {
                DropFactory.PercentDrop(40, "magic", 7)
            }, meander: 2);

            breed("kobold trickster", gold, 20, new List <object>()
            {
                new Attack("hit[s]", 5),
                MoveFactory.sparkBolt(rate: 5, damage: 8),
                MoveFactory.teleport(rate: 5, range: 6),
                MoveFactory.haste(rate: 7)
            }, drop: new List <Drop>()
            {
                DropFactory.PercentDrop(40, "magic", 7)
            }, meander: 2);

            breed("kobold priest", white, 25, new List <object>()
            {
                new Attack("club[s]", 6),
                MoveFactory.heal(rate: 15, amount: 10),
                MoveFactory.fireBolt(rate: 10, damage: 8),
                MoveFactory.teleport(rate: 5, range: 6),
                MoveFactory.haste(rate: 7)
            }, drop: new List <Drop>()
            {
                DropFactory.PercentDrop(30, "club", 10),
                DropFactory.PercentDrop(40, "magic", 7)
            }, meander: 2);

            breed("imp incanter", lightPurple, 18, new List <object>()
            {
                new Attack("scratch[es]", 4),
                MoveFactory.insult(),
                MoveFactory.fireBolt(rate: 5, damage: 10)
            }, drop: DropFactory.PercentDrop(20, "magic", 1),
                  meander: 4, speed: 1, flags: "cowardly");

            breed("imp warlock", darkPurple, 40, new List <object>()
            {
                new Attack("stab[s]", 5),
                MoveFactory.iceBolt(rate: 8, damage: 12),
                MoveFactory.fireBolt(rate: 8, damage: 12)
            }, drop: DropFactory.PercentDrop(20, "magic", 4),
                  meander: 3, speed: 1, flags: "cowardly");

            // TODO: Always drop something good.
            breed("Feng", orange, 60, new List <object>()
            {
                new Attack("stab[s]", 5),
                MoveFactory.teleport(rate: 5, range: 6),
                MoveFactory.teleport(rate: 50, range: 30),
                MoveFactory.insult(),
                MoveFactory.lightningCone(rate: 8, damage: 12)
            }, drop: DropFactory.PercentDrop(20, "magic", 4),
                  meander: 3, speed: 1, flags: "cowardly");

            // homonculous
        }
Exemplo n.º 11
0
        private void goblins()
        {
            group("g", meander: 1, flags: "open-doors");
            breed("goblin peon", lightBrown, 20, new List <object>()
            {
                new Attack("stab[s]", 5)
            }, drop: new List <Drop>()
            {
                DropFactory.PercentDrop(10, "spear", 3),
                DropFactory.PercentDrop(5, "healing", 2),
            }, meander: 2, flags: "few");

            breed("goblin archer", green, 22, new List <object>()
            {
                new Attack("stab[s]", 3),
                MoveFactory.arrow(rate: 3, damage: 4)
            }, drop: new List <Drop>()
            {
                DropFactory.PercentDrop(20, "bow", 1),
                DropFactory.PercentDrop(10, "dagger", 2),
                DropFactory.PercentDrop(5, "healing", 3),
            }, flags: "few");

            breed("goblin fighter", brown, 30, new List <object>()
            {
                new Attack("stab[s]", 7)
            }, drop: new List <Drop>()
            {
                DropFactory.PercentDrop(15, "spear", 5),
                DropFactory.PercentDrop(10, "armor", 5),
                DropFactory.PercentDrop(5, "resistance", 3),
                DropFactory.PercentDrop(5, "healing", 3),
            });

            breed("goblin warrior", gray, 42, new List <object>()
            {
                new Attack("stab[s]", 10)
            }, drop: new List <Drop>()
            {
                DropFactory.PercentDrop(20, "axe", 6),
                DropFactory.PercentDrop(20, "armor", 6),
                DropFactory.PercentDrop(5, "resistance", 3),
                DropFactory.PercentDrop(5, "healing", 3),
            }, flags: "protective");

            breed("goblin mage", blue, 30, new List <object>()
            {
                new Attack("whip[s]", 7),
                MoveFactory.fireBolt(rate: 12, damage: 6),
                MoveFactory.sparkBolt(rate: 12, damage: 8),
            }, drop: new List <Drop>()
            {
                DropFactory.PercentDrop(10, "equipment", 5),
                DropFactory.PercentDrop(10, "whip", 5),
                DropFactory.PercentDrop(20, "magic", 6),
            });

            breed("goblin ranger", darkGreen, 36, new List <object>()
            {
                new Attack("stab[s]", 10),
                MoveFactory.arrow(rate: 3, damage: 8)
            }, drop: new List <Drop>()
            {
                DropFactory.PercentDrop(30, "bow", 11),
                DropFactory.PercentDrop(20, "armor", 8),
                DropFactory.PercentDrop(20, "magic", 8)
            });

            // TODO: Always drop something good.
            breed("Erlkonig, the Goblin Prince", darkGray, 80, new List <object>()
            {
                new Attack("hit[s]", 10),
                new Attack("slash[es]", 14),
                MoveFactory.darkBolt(rate: 20, damage: 10),
            }, drop: new List <Drop>()
            {
                DropFactory.PercentDrop(60, "equipment", 10),
                DropFactory.PercentDrop(60, "equipment", 10),
                DropFactory.PercentDrop(40, "magic", 12),
            }, flags: "protective");
        }
Exemplo n.º 12
0
        private void ProcessCommand()
        {
            var rex = new Regex(@"("".*?""|[^ ""]+)+");
            //string test = "CALL \"C:\\My File Name With Space\" /P1 P1Value /P1 P2Value";
            //var array = rex.Matches(test).OfType<Match>().Select(m => m.Groups[0]).ToArray();

            var matches        = rex.Matches(Command).OfType <Match>().Select(m => m.Groups[0]).ToArray();
            var primaryCommand = matches[0].Value;

            switch (primaryCommand.ToLower())
            {
            case "goto":
            {
                var location = matches[1].Value;

                VectorBase pos = null;
                switch (location.ToLower())
                {
                case "stairsdown":
                {
                    pos = Game.CurrentStage.StairDownPosition;
                    break;
                }

                case "stairsup":
                {
                    pos = Game.CurrentStage.StairUpPosition;
                    break;
                }
                }

                if (pos == null)
                {
                    Command = string.Empty;
                    break;
                }
                pos = Game.CurrentStage.FindDistantOpenTileNear(pos);

                Game.CurrentStage.currentActor.Position = pos;
                Game.CurrentStage.refreshVisibility(Game.CurrentStage.CurrentHero);
                Command = string.Empty;
                break;
            }

            case "giveitem":
            {
                var itemType = matches[1].Value;
                if (itemType[0] == '"')
                {
                    itemType = itemType.Substring(1, itemType.Length - 2);
                }
                var quantity = 1;
                if (matches.Length == 3)
                {
                    quantity = int.Parse(matches[2].Value);
                }
                Drop processedDrop = DropFactory.parseDrop(itemType);
                for (int index = 0; index < quantity; index++)
                {
                    processedDrop.SpawnDrop(Game.Hero.Inventory.tryAdd);
                }
                Command = string.Empty;
                break;
            }

            case "giveset":
            {
                var setType  = matches[1].Value;
                var quantity = 1;

                switch (setType.ToLower())
                {
                case "warrior":
                {
                    DropFactory.parseDrop("Chain Mail Cap").SpawnDrop(Game.Hero.Equipment.replace);
                    DropFactory.parseDrop("Chain Mail Gloves").SpawnDrop(Game.Hero.Equipment.replace);
                    DropFactory.parseDrop("Large Shield").SpawnDrop(Game.Hero.Equipment.replace);
                    DropFactory.parseDrop("Falchion").SpawnDrop(Game.Hero.Equipment.replace);
                    DropFactory.parseDrop("Crossbow").SpawnDrop(Game.Hero.Equipment.replace);
                    DropFactory.parseDrop("Greaves").SpawnDrop(Game.Hero.Equipment.replace);
                    DropFactory.parseDrop("Scale Mail").SpawnDrop(Game.Hero.Equipment.replace);
                    DropFactory.parseDrop("Fur Cloak").SpawnDrop(Game.Hero.Equipment.replace);
                    break;
                }
                }


                Command = string.Empty;
                break;
            }

            case "sethealth":
            {
                var newHealth = int.Parse(matches[1].Value);
                Game.Hero.Health.Current = newHealth;
                Command = string.Empty;
                break;
            }
            }
        }