コード例 #1
0
ファイル: Buff.cs プロジェクト: ilezhnin/Roguelike-2
 public Buff(Texture2D texture, Controller controller, int maxTurns)
 {
     this.texture = texture;
     this.maxTurns = maxTurns;
     this.controller = controller;
     turns = this.maxTurns;
 }
コード例 #2
0
ファイル: Ray.cs プロジェクト: ilezhnin/Roguelike-2
 public Ray(Controller controller, Point origin, Vector2 direction, int viewDistance)
 {
     this.origin = origin;
     this.direction = direction;
     this.direction.Normalize();
     this.controller = controller;
     this.viewDistance = viewDistance;
 }
コード例 #3
0
ファイル: Room.cs プロジェクト: ilezhnin/Roguelike-2
 public Room(Controller controller, Map map, Point cornerLeftUp, Point cornerRightDown)
 {
     this.controller = controller;
     this.map = map;
     cornerNW = cornerLeftUp;
     cornerSE = cornerRightDown;
     width = cornerSE.X - cornerNW.X;
     height = cornerSE.Y - cornerNW.Y;
 }
コード例 #4
0
ファイル: Player.cs プロジェクト: ilezhnin/Roguelike-2
        public Player(Controller controller)
        {
            this.controller = controller;
            state = Keyboard.GetState();
            position = new Point(0, 0);
            health = maxHealth;
            delay = maxDelay;

            map = controller.map;
        }
コード例 #5
0
ファイル: Map.cs プロジェクト: ilezhnin/Roguelike-2
        public Map(Controller controller, int floorSize)
        {
            this.controller = controller;
            this.floorSize = floorSize;

            GenerateEmptyFloor();
            mapString = ArrayToString(mapArray);

            mouse = Mouse.GetState();
        }
コード例 #6
0
ファイル: Camera.cs プロジェクト: ilezhnin/Roguelike-2
 public Camera(Controller controller, Point position, int tileSize)
 {
     this.controller = controller;
     this.tileSize = tileSize;
     this.position = position;
     this.graphics = controller.graphics;
     map = controller.map;
     scale = map.scale;
     maxTilesX = (int)Math.Ceiling(((float)graphics.PreferredBackBufferWidth / ((float)tileSize * scale)));
     maxTilesY = (int)Math.Ceiling(((float)graphics.PreferredBackBufferHeight / ((float)tileSize * scale)));
 }
コード例 #7
0
ファイル: Enemy.cs プロジェクト: ilezhnin/Roguelike-2
        public Enemy(Controller controller, Point position, EnemyType enemyType)
        {
            this.position = position;
            this.controller = controller;

            switch (enemyType) //ADDENEMY
            {
                case EnemyType.Skeleton:
                    {
                        texture = ContentManager.tSkeleton;
                        damage = 2;
                        maxHealth = 10;
                        viewDistance = 4;
                        expValue = 5;
                        dropRate = 8;
                        break;
                    }
                case EnemyType.Bat:
                    {
                        texture = ContentManager.tBat;
                        damage = 1;
                        maxHealth = 8;
                        viewDistance = 6;
                        dropRate = 6;
                        expValue = 3;
                        break;
                    }
            }
            //DIFFICULTY SCALING
            int scale = (int)(controller.level / 3);
            maxHealth += scale;
            damage += scale;
            expValue += scale;

            health = maxHealth;
            if (CanSeePlayer())
            {
                asleep = false;
            }
        }
コード例 #8
0
ファイル: Inventory.cs プロジェクト: ilezhnin/Roguelike-2
 public Inventory(Controller controller)
 {
     this.controller = controller;
     player = controller.player;
 }
コード例 #9
0
ファイル: Gameplay.cs プロジェクト: ilezhnin/Roguelike-2
 public Gameplay(GraphicsDeviceManager graphics)
 {
     this.graphics = graphics;
     controller = new Controller(graphics);
 }
コード例 #10
0
ファイル: Item.cs プロジェクト: ilezhnin/Roguelike-2
        public Item(Controller controller, Point position, Map.Element baseElem)
        {
            this.controller = controller;
            this.position = position;
            this.baseElem = baseElem;

            Rarity rarity = RollRarity();

            int random;
            switch (rarity)
            {
                case Rarity.Common:
                    random = controller.random.Next(commonArray.Length);
                    itemType = commonArray[random];
                    break;

                case Rarity.Uncommon:
                    random = controller.random.Next(uncommonArray.Length);
                    itemType = uncommonArray[random];
                    break;

                case Rarity.Rare:
                    random = controller.random.Next(rareArray.Length);
                    itemType = rareArray[random];
                    break;
            }

            switch (itemType)//ADDITEM
            {
                case ItemType.Potion:
                    {
                        texture = ContentManager.tPotion;
                        itemCat = ItemCat.Consumable;
                        break;
                    }
                case ItemType.HealingPotion:
                    {
                        texture = ContentManager.tHealingPotion;
                        itemCat = ItemCat.Consumable;
                        break;
                    }
                case ItemType.PotionRed:
                    {
                        texture = ContentManager.tPotionRed;
                        itemCat = ItemCat.Consumable;
                        break;
                    }
                case ItemType.BigSword:
                    {
                        texture = ContentManager.tBigSword;
                        itemCat = ItemCat.Weapon;

                        damageStat = 5;
                        break;
                    }
                case ItemType.Shield:
                    {
                        texture = ContentManager.tShield;
                        itemCat = ItemCat.Armor;

                        defenseStat = 1;
                        break;
                    }
                case ItemType.PlateArmor:
                    {
                        texture = ContentManager.tPlateArmor;
                        itemCat = ItemCat.Armor;

                        defenseStat = 4;
                        break;
                    }
                case ItemType.BrokenSword:
                    {
                        texture = ContentManager.tBrokenSword;
                        itemCat = ItemCat.Weapon;

                        damageStat = 2;
                        break;
                    }
            }

            if (itemCat == ItemCat.Armor || itemCat == ItemCat.Weapon)
            {
                if (controller.random.Next(BONUSCHANCE) == BONUSCHANCE - 1)
                {
                    if (damageStat > 0)
                    {
                        bonusStat = controller.random.Next(damageStat) + 1;
                        damageStat += bonusStat;
                    }
                    if (defenseStat > 0)
                    {
                        bonusStat = controller.random.Next(defenseStat) + 1;
                        defenseStat += bonusStat;
                    }
                }
            }
        }