Esempio n. 1
0
        public void AddMonster(int x, int y, Core.DungeonMap m)
        {
            Core.Entity         e = new Core.Entity(_entityID);
            Core.EntityReturner er;

            //int ind = r.Next(CreatNames.Count);
            int    ind          = Game.Random.Next(CreatNames.Count - 1);
            string creatureName = CreatNames[ind];

            int entType = RogueSharp.DiceNotation.Dice.Roll("1d20");

            if (entType <= 2)
            {
                er = Core.EntityFactory.CreateTroll(x, y, creatureName, m);
            }
            else if (entType > 2 && entType < 6)
            {
                er = Core.EntityFactory.CreateOrc(x, y, creatureName, m);
            }
            else if (entType >= 6 && entType < 12)
            {
                er = Core.EntityFactory.CreateKobold(x, y, creatureName, m);
            }
            else if (entType >= 12 && entType < 15)
            {
                er = Core.EntityFactory.CreateZombie(x, y, creatureName, m);
            }
            else
            {
                er = Core.EntityFactory.CreateRat(x, y, creatureName, m);
            }

            //add entity to entity dict
            Entities.Add(_entityID, er.ComponentList);
            EntityBitLookUp.Add(_entityID, er.LookUpBit);
            JustEntities.Add(_entityID, e);

            //add to PositionLookUp
            AddEntToPosition(x, y, e.UID);

            //try adding to schedule
            Components.Component ts = GetSingleComponentByID(_entityID, Core.ComponentTypes.Schedulable);
            if (ts != null)
            {
                Components.SchedulableComp sc = (Components.SchedulableComp)ts;
                int entTime = sc.Time;
                Game.ShedSystem.Add(e, entTime);
            }

            // inc entityID
            _entityID++;

            //add weapon to entity
            AddWeaponToEntity(e.UID);
            if (RogueSharp.DiceNotation.Dice.Roll("1d10") > 8)
            {
                AddPotionToEntity(e.UID);
            }
        }
Esempio n. 2
0
        public static EntityReturner CreateKobold(int xPos, int yPos, string name, DungeonMap m)
        {
            List <Components.Component> compList = new List <Components.Component>();

            //stats
            int lev     = 1;
            int size    = 4;
            int intBase = 1;

            // set bitwise to 0
            int checker = 0;

            Components.PositionComp positionComp = new Components.PositionComp(xPos, yPos);
            compList.Add(positionComp);
            checker = checker | (int)Core.ComponentTypes.Position;

            Components.RenderComp rendComp = new Components.RenderComp('k', RLNET.RLColor.Green);
            compList.Add(rendComp);
            checker = checker | (int)Core.ComponentTypes.Render;

            Components.AttributesComp attComp = new Components.AttributesComp(15, size, lev, intBase);
            compList.Add(attComp);
            checker = checker | (int)Core.ComponentTypes.Attributes;

            //get base factor for health
            int hp = (int)(size + attComp.Hardiness) / 2;

            Components.HealthComp healthComp = new Components.HealthComp(hp);
            compList.Add(healthComp);
            checker = checker | (int)Core.ComponentTypes.Health;

            Components.ActorComp actComp = new Components.ActorComp();
            compList.Add(actComp);
            checker = checker | (int)Core.ComponentTypes.Actor;

            Components.AIComp aiComp = new Components.AIComp(m, Types.AITypes.Creature, new RogueSharp.Point(xPos, yPos));
            compList.Add(aiComp);
            checker = checker | (int)Core.ComponentTypes.AI;

            int speed = Game.Random.Next(2) + 1;

            Components.SchedulableComp shedComp = new Components.SchedulableComp(speed);
            compList.Add(shedComp);
            checker = checker | (int)Core.ComponentTypes.Schedulable;

            Components.InventoryComp invComp = new Components.InventoryComp();
            compList.Add(invComp);
            checker = checker | (int)Core.ComponentTypes.Inventory;

            Components.CreatureDetailsComp detailsComp
                = new Components.CreatureDetailsComp("Koblod", name, Types.CreatureTypes.Kobold);
            compList.Add(detailsComp);
            checker = checker | (int)ComponentTypes.CreatureDetails;

            EntityReturner er = new EntityReturner(checker, compList);

            return(er);
        }
Esempio n. 3
0
        public static EntityReturner CreateTroll(int xPos, int yPos, string name, DungeonMap m)
        {
            List <Components.Component> compList = new List <Components.Component>();
            //stats
            int lev     = 2;
            int size    = 8 + RogueSharp.DiceNotation.Dice.Roll("1d3");
            int intBase = 1;

            // set bitwise to 0
            int checker = 0;

            Components.PositionComp positionComp = new Components.PositionComp(xPos, yPos);
            compList.Add(positionComp);
            checker = checker | (int)ComponentTypes.Position;

            Components.RenderComp rendComp = new Components.RenderComp('T', Core.Colours.OrcColour);
            compList.Add(rendComp);
            checker = checker | (int)ComponentTypes.Render;

            Components.AttributesComp attComp = new Components.AttributesComp(10, size, lev, intBase);
            compList.Add(attComp);
            checker = checker | (int)ComponentTypes.Attributes;

            //get base factor for health
            int hp = ((int)(size + attComp.Hardiness) / 2) * lev;

            Components.HealthComp healthComp = new Components.HealthComp(hp);
            compList.Add(healthComp);
            checker = checker | (int)ComponentTypes.Health;

            Components.ActorComp actComp = new Components.ActorComp();
            compList.Add(actComp);
            checker = checker | (int)ComponentTypes.Actor;

            Components.AIComp aiComp = new Components.AIComp(m, Types.AITypes.Creature, new RogueSharp.Point(xPos, yPos));
            compList.Add(aiComp);
            checker = checker | (int)ComponentTypes.AI;

            int speed = Game.Random.Next(3) + 6;

            Components.SchedulableComp shedComp = new Components.SchedulableComp(speed);
            compList.Add(shedComp);
            checker = checker | (int)ComponentTypes.Schedulable;

            Components.InventoryComp invComp = new Components.InventoryComp();
            compList.Add(invComp);
            checker = checker | (int)ComponentTypes.Inventory;

            Components.CreatureDetailsComp detailsComp
                = new Components.CreatureDetailsComp("Troll", name, Types.CreatureTypes.Troll);
            compList.Add(detailsComp);
            checker = checker | (int)ComponentTypes.CreatureDetails;

            EntityReturner er = new EntityReturner(checker, compList);

            return(er);
        }
Esempio n. 4
0
        public static EntityReturner CreateZombie(int xPos, int yPos, string name, DungeonMap m)
        {
            List <Components.Component> compList = new List <Components.Component>();
            //stats
            int lev     = 2;
            int size    = 4 + RogueSharp.DiceNotation.Dice.Roll("1d3");
            int intBase = 1;

            // set bitwise to 0
            int checker = 0;

            Components.PositionComp positionComp = new Components.PositionComp(xPos, yPos);
            compList.Add(positionComp);
            checker = checker | (int)ComponentTypes.Position;

            Components.RenderComp rendComp = new Components.RenderComp('z', RLNET.RLColor.Cyan);
            compList.Add(rendComp);
            checker = checker | (int)ComponentTypes.Render;

            Components.AttributesComp attComp = new Components.AttributesComp(12, size, lev, intBase);
            compList.Add(attComp);
            checker = checker | (int)ComponentTypes.Attributes;

            //get base factor for health
            int hp = ((int)(size + attComp.Hardiness) / 2) * lev;

            Components.HealthComp healthComp = new Components.HealthComp(hp);
            compList.Add(healthComp);
            checker = checker | (int)ComponentTypes.Health;

            Components.ActorComp actComp = new Components.ActorComp();
            compList.Add(actComp);
            checker = checker | (int)ComponentTypes.Actor;

            Components.AIComp aiComp = new Components.AIComp(m, Types.AITypes.Undead, new RogueSharp.Point(xPos, yPos));
            compList.Add(aiComp);
            checker = checker | (int)ComponentTypes.AI;

            int speed = RogueSharp.DiceNotation.Dice.Roll("1d6") + 4;

            Components.SchedulableComp shedComp = new Components.SchedulableComp(speed);
            compList.Add(shedComp);
            checker = checker | (int)ComponentTypes.Schedulable;

            Components.CreatureDetailsComp detailsComp
                = new Components.CreatureDetailsComp("Zombie", name, Types.CreatureTypes.Zombie);
            compList.Add(detailsComp);
            checker = checker | (int)ComponentTypes.CreatureDetails;

            EntityReturner er = new EntityReturner(checker, compList);

            return(er);
        }