public HUDManager(TextureManager textures, GraphicsDevice graphicsDevice, ContentManager content, Object.Player player, int windowWidth, int windowHeight)
        {
            this.textures     = textures;
            this.player       = player;
            this.windowWidth  = windowWidth;
            this.windowHeight = windowHeight;

            pixelTex = new Texture2D(graphicsDevice, 1, 1);
            pixelTex.SetData <Color>(new Color[] { Color.White });

            flashTimer         = 0;
            flashTimerToggle   = false;
            abilityButtonAlpha = 1f;

            turnEvents     = "Plan your move...";
            textScaleTimer = 10;

            //Sätter mått
            sideBarWidth = windowWidth / 10;
            statBarWidth = sideBarWidth / 3;

            leftBarRect         = new Rectangle(0, 0, sideBarWidth, windowHeight);
            rightBarRect        = new Rectangle(windowWidth - sideBarWidth, 0, sideBarWidth, windowHeight);
            bottomBarRect       = new Rectangle(leftBarRect.Width, windowHeight - (sideBarWidth * 2), windowWidth - (sideBarWidth * 2), sideBarWidth * 2);
            topBarRect          = new Rectangle(leftBarRect.Width, 0, windowWidth - (leftBarRect.Width * 2), sideBarWidth);
            bottomMiddleBarRect = new Rectangle(leftBarRect.Width * 2, windowHeight - bottomBarRect.Height, windowWidth - (leftBarRect.Width * 4), bottomBarRect.Height);

            statScreen = new StatScreen(this, textures);
        }
Пример #2
0
 public Enemy(TextureManager textures, EnemyType theEnemy, Object.Player player)
 {
     this.textures = textures;
     this.theEnemy = theEnemy;
     this.player   = player;
     ability       = new Abilities(UsedBy.enemy, textures);
     GiveStats();
 }
 public Combat(Object.Player player, TextureManager textures, HUDManager hud)
 {
     this.player     = player;
     this.textures   = textures;
     this.hud        = hud;
     animationTimer  = 0;
     animationTimer2 = 0;
 }
Пример #4
0
        public BarManager(TextureManager textures, GraphicsDevice graphicsDevice, ContentManager content, Object.Player player, int windowWidth, int windowHeight)
        {
            this.textures     = textures;
            this.player       = player;
            this.windowWidth  = windowWidth;
            this.windowHeight = windowHeight;

            comicSans = content.Load <SpriteFont>("textFont1");

            pixelTex = new Texture2D(graphicsDevice, 1, 1);
            pixelTex.SetData <Color>(new Color[] { Color.White });

            sideBarWidth = windowWidth / 10;
            statBarWidth = sideBarWidth / 3;

            leftSideBarRect  = new Rectangle(0, 0, sideBarWidth, windowHeight);
            rightSideBarRect = new Rectangle(windowWidth - sideBarWidth, 0, sideBarWidth, windowHeight);
        }
        public void Ability(Enemy enemy, Object.Player player, UsedAbility ability)
        {
            #region Hit
            if (ability == UsedAbility.Hit)
            {
                if (usedBy == UsedBy.player)
                {
                    if (CheckIfHit(player.stats.CheckStat(Stat.accuracy),
                                   player.stats.CheckStat(Stat.luck),
                                   player.stats.CheckStat(Stat.speed),
                                   enemy.stats.CheckStat(Stat.luck),
                                   enemy.stats.CheckStat(Stat.speed)))
                    {
                        usedAbility = UsedAbility.Hit;
                        if (CheckIfCritical(player.stats.CheckStat(Stat.luck),
                                            player.stats.CheckStat(Stat.strength),
                                            enemy.stats.CheckStat(Stat.luck),
                                            enemy.stats.CheckStat(Stat.strength)))
                        {
                            power  = player.stats.CheckStat(Stat.strength);
                            effect = Effects.bleed;
                        }
                        else
                        {
                            power  = player.stats.CheckStat(Stat.strength);
                            effect = Effects.none;
                        }
                    }
                    else
                    {
                        usedAbility = UsedAbility.Miss; power = 0; effect = Effects.none;
                    }
                }
                else
                {
                    if (CheckIfHit(enemy.stats.CheckStat(Stat.accuracy),
                                   enemy.stats.CheckStat(Stat.luck),
                                   enemy.stats.CheckStat(Stat.speed),
                                   player.stats.CheckStat(Stat.luck),
                                   player.stats.CheckStat(Stat.speed)))
                    {
                        usedAbility = UsedAbility.Hit;
                        if (CheckIfCritical(player.stats.CheckStat(Stat.luck),
                                            player.stats.CheckStat(Stat.strength),
                                            enemy.stats.CheckStat(Stat.luck),
                                            enemy.stats.CheckStat(Stat.strength)))
                        {
                            power  = enemy.stats.CheckStat(Stat.strength) * 2;
                            effect = Effects.bleed;
                        }
                        else
                        {
                            power  = enemy.stats.CheckStat(Stat.strength);
                            effect = Effects.none;
                        }
                    }
                    else
                    {
                        usedAbility = UsedAbility.Miss; power = 0; effect = Effects.none;
                    }
                }
            }
            #endregion

            #region Defence

            if (ability == UsedAbility.Defence)
            {
                effect = Effects.none;
                if (usedBy == UsedBy.player)
                {
                    usedAbility = UsedAbility.Defence;
                    power       = (player.stats.CheckStat(Stat.strength) / 2) + (player.stats.CheckStat(Stat.accuracy) / 2);
                }
                else
                {
                    usedAbility = UsedAbility.Defence;
                    power       = (enemy.stats.CheckStat(Stat.strength) / 2) + (enemy.stats.CheckStat(Stat.accuracy) / 2);
                }
            }
            #endregion

            #region Magic
            if (ability == UsedAbility.Magic)
            {
                if (usedBy == UsedBy.player)
                {
                    if (CheckIfHit(player.stats.CheckStat(Stat.accuracy),
                                   player.stats.CheckStat(Stat.luck),
                                   player.stats.CheckStat(Stat.speed),
                                   enemy.stats.CheckStat(Stat.luck),
                                   enemy.stats.CheckStat(Stat.speed)))
                    {
                        usedAbility = UsedAbility.Magic;
                        if (CheckIfCritical(player.stats.CheckStat(Stat.luck),
                                            player.stats.CheckStat(Stat.intelligence),
                                            enemy.stats.CheckStat(Stat.luck),
                                            enemy.stats.CheckStat(Stat.intelligence)))
                        {
                            power  = player.stats.CheckStat(Stat.intelligence) + rand.Next(0, player.stats.CheckStat(Stat.luck));
                            effect = Effects.confusion;
                        }
                        else
                        {
                            power  = player.stats.CheckStat(Stat.intelligence) + rand.Next(0, player.stats.CheckStat(Stat.luck));
                            effect = Effects.none;
                        }
                    }
                    else
                    {
                        usedAbility = UsedAbility.Miss; power = 0; effect = Effects.none;
                    }
                }
                else
                {
                    if (CheckIfHit(enemy.stats.CheckStat(Stat.accuracy),
                                   enemy.stats.CheckStat(Stat.luck),
                                   enemy.stats.CheckStat(Stat.speed),
                                   player.stats.CheckStat(Stat.luck),
                                   player.stats.CheckStat(Stat.speed)))
                    {
                        this.usedAbility = UsedAbility.Magic;
                        if (CheckIfCritical(player.stats.CheckStat(Stat.luck),
                                            player.stats.CheckStat(Stat.intelligence),
                                            enemy.stats.CheckStat(Stat.luck),
                                            enemy.stats.CheckStat(Stat.intelligence)))
                        {
                            power  = enemy.stats.CheckStat(Stat.intelligence) + +rand.Next(0, enemy.stats.CheckStat(Stat.luck));
                            effect = Effects.confusion;
                        }
                        else
                        {
                            power  = enemy.stats.CheckStat(Stat.intelligence) + +rand.Next(0, enemy.stats.CheckStat(Stat.luck));
                            effect = Effects.none;
                        }
                    }
                    else
                    {
                        this.usedAbility = UsedAbility.Miss; power = 0; effect = Effects.none;
                    }
                }
            }
            #endregion

            #region Dodge
            if (ability == UsedAbility.Dodge)
            {
                effect = Effects.none;
                if (usedBy == UsedBy.player)
                {
                    int accuracy = player.stats.CheckStat(Stat.accuracy) +
                                   (player.stats.CheckStat(Stat.luck)) + rand.Next(0, 80);
                    if (accuracy >= 50)
                    {
                        usedAbility = UsedAbility.Dodge;
                    }
                    else
                    {
                        usedAbility = UsedAbility.Miss;
                    }
                }
                else
                {
                    int accuracy = enemy.stats.CheckStat(Stat.accuracy) +
                                   (enemy.stats.CheckStat(Stat.luck)) + rand.Next(0, 80);
                    if (accuracy >= 50)
                    {
                        usedAbility = UsedAbility.Dodge;
                    }
                    else
                    {
                        usedAbility = UsedAbility.Miss;
                    }
                }
            }
            #endregion

            #region Poison Hit
            if (ability == UsedAbility.PoisonHit)
            {
                if (usedBy == UsedBy.player)
                {
                    if (CheckIfHit(player.stats.CheckStat(Stat.accuracy),
                                   player.stats.CheckStat(Stat.luck),
                                   player.stats.CheckStat(Stat.speed),
                                   enemy.stats.CheckStat(Stat.luck),
                                   enemy.stats.CheckStat(Stat.speed)))
                    {
                        usedAbility = UsedAbility.PoisonHit;
                        if (CheckIfCritical(player.stats.CheckStat(Stat.luck),
                                            player.stats.CheckStat(Stat.intelligence),
                                            enemy.stats.CheckStat(Stat.luck),
                                            enemy.stats.CheckStat(Stat.intelligence)))
                        {
                            power  = player.stats.CheckStat(Stat.intelligence);
                            effect = Effects.poison;
                        }
                        else
                        {
                            power  = player.stats.CheckStat(Stat.intelligence) / 2;
                            effect = Effects.poison;
                        }
                    }
                    else
                    {
                        usedAbility = UsedAbility.Miss; power = 0; effect = Effects.none;
                    }
                }
                else
                {
                    if (CheckIfHit(enemy.stats.CheckStat(Stat.accuracy),
                                   enemy.stats.CheckStat(Stat.luck),
                                   enemy.stats.CheckStat(Stat.speed),
                                   player.stats.CheckStat(Stat.luck),
                                   player.stats.CheckStat(Stat.speed)))
                    {
                        usedAbility = UsedAbility.PoisonHit;
                        if (CheckIfCritical(enemy.stats.CheckStat(Stat.luck),
                                            enemy.stats.CheckStat(Stat.intelligence),
                                            player.stats.CheckStat(Stat.luck),
                                            player.stats.CheckStat(Stat.intelligence)))
                        {
                            power  = enemy.stats.CheckStat(Stat.intelligence);
                            effect = Effects.poison;
                        }
                        else
                        {
                            power  = enemy.stats.CheckStat(Stat.intelligence) / 2;
                            effect = Effects.poison;
                        }
                    }
                    else
                    {
                        usedAbility = UsedAbility.Miss; power = 0; effect = Effects.none;
                    }
                }
            }
            #endregion

            #region Auto-Miss

            if (ability == UsedAbility.Miss)
            {
                usedAbility = UsedAbility.Miss;
                power       = 0;
                effect      = Effects.none;
            }

            #endregion
        }