예제 #1
0
파일: Repository.cs 프로젝트: Sohrab/MyRPG
 private List<Enemy> GetEnemies()
 {
     List<Enemy> enemies = new List<Enemy>();
     Enemy FirstEnemy = new Enemy("Paco",200,20,10,6, "Images/Paco.png");
     Enemy SecondEnemy = new Enemy("Monkey", 400, 40, 20, 10, "Images/Monkey.png");
     Enemy ThirdEnemy = new Enemy("Johny", 800, 80, 40, 30, "Images/Johny.png");
     Enemy ForthEnemy = new Enemy("Jimpach", 1600, 160, 80, 50, "Images/Jimmy.png");
     Enemy FifthEnemy = new Enemy("Basse", 3200, 320, 160, 80, "Images/Basse.png");
     enemies.Add(FirstEnemy);
     enemies.Add(SecondEnemy);
     enemies.Add(ThirdEnemy);
     enemies.Add(ForthEnemy);
     enemies.Add(FifthEnemy);
     
     return enemies;
 }
예제 #2
0
파일: Adventure.cs 프로젝트: Sohrab/MyRPG
        public Adventure(Enemy _advEnemy, int _enemyDifficulty)
        {

            advEnemy = _advEnemy;
            EnemyMaxHP = advEnemy.HealthPoints;
            PlayerMaxHP = Repository.Player.Maxhealth;
            if (_enemyDifficulty == 0)
            {
                GenerateItems(0);
                AdvGold = rnd.Next(50, 151);
            }
            if (_enemyDifficulty == 1)
            {
                GenerateItems(1);
                AdvGold = rnd.Next(100, 201);
            }
            if (_enemyDifficulty == 2)
            {
                GenerateItems(2);
                AdvGold = rnd.Next(150, 251);
            }
            if (_enemyDifficulty == 3)
            {
                GenerateItems(3);
                AdvGold = rnd.Next(200, 301);
            }
            if (_enemyDifficulty == 4)
            {
                GenerateItems(3);
                AdvGold = rnd.Next(350, 501);
            }

            //FightSyStem.PBarMaxValue = _advEnemy.HealthPoints;

            updateProgressBar();
        }
예제 #3
0
파일: FightSystem.cs 프로젝트: Sohrab/MyRPG
        public void AttackEnemy(Enemy advEnemy)
        {
            CombatLog += "\r\n";
            bool crit = false;
            int damage = Repository.Player.Damage;
            float drProcent;
            float damageReduction;
            int randomizer;
            if (rnd.Next(1, 101) <= 30)
            {
                CombatLog += "You missed your attack.";
            }
            else
            {
                if (rnd.Next(1, 101) <= Repository.Player.CritChance)
                {
                    damage = damage * 2;
                    crit = true;
                }

                drProcent = advEnemy.Armor / 1000f;
                damageReduction = damage * drProcent;
                
                randomizer = rnd.Next(1, advEnemy.RandomiZer);
                if (randomizer > damage)
                {
                    damage += randomizer;
                }
                else
                {
                    if (rnd.Next(1, 2) == 2)
                    {
                        damage += randomizer;
                    }
                    else
                    {
                        damage -= randomizer;
                    }
                }

                damage = (int)(damage - damageReduction);
                advEnemy.HealthPoints -= damage;

                CombatLog += "You hit " + advEnemy.EnemyName;
                if (randomizer < advEnemy.RandomiZer / 2)
                {
                    CombatLog += " hard for " + damage;
                }
                else
                {
                    CombatLog += " poorly for " + damage;
                    
                }

                if (crit == true)
                {
                    CombatLog += " critical";
                }

                CombatLog += " damage.";
            }

            PlayerTurn = false;

            CheckVictoryConditions(advEnemy);
            //SetEnemyHp(advEnemy);
        }
예제 #4
0
파일: FightSystem.cs 프로젝트: Sohrab/MyRPG
        public void EnemyAttacksYou(Enemy advEnemy)
        {
            CombatLog += "\r\n";
            bool crit = false;
            int damage = advEnemy.Damage;
            float drProcent;
            float damageReduction;
            int randomizer;

            //See if miss
            if (rnd.Next(1, 101) <= 30)
            {
                CombatLog += advEnemy.EnemyName + " missed his attack.";
            }
            else
            {
                if (rnd.Next(1, 101) <= 10)
                {
                    damage = damage * 2;
                    crit = true;
                }


                //Start calculating damage
                drProcent = Repository.Player.Armor / 1000f;
                damageReduction = damage * drProcent;

                randomizer = rnd.Next(1, advEnemy.RandomiZer);
                if (randomizer > damage)
                {
                    damage += randomizer;
                }
                else
                {
                    if (rnd.Next(1, 2) == 2)
                    {
                        damage += randomizer;
                    }
                    else
                    {
                        damage -= randomizer;
                    }
                }

                damage = (int)(damage - damageReduction);
                Repository.Player.Health -= damage;


                //See if Parry, Dodge or Block
                if (rnd.Next(1, 101) <= Repository.Player.ParryChance)
                {
                    CombatLog += "You parried " + advEnemy.EnemyName + "'s attack!";
                }
                else if (rnd.Next(1, 101) <= Repository.Player.BlockChance)
                {
                    CombatLog += "You blocked " + advEnemy.EnemyName + "'s attack!";
                }
                else if (rnd.Next(1, 101) <= Repository.Player.DodgeChance)
                {
                    CombatLog += "You dodged " + advEnemy.EnemyName + "'s attack!";
                }

                else
                {
                    CombatLog += advEnemy.EnemyName + " hits you";
                    if (randomizer < advEnemy.RandomiZer / 2)
                    {
                        CombatLog += " hard for " + damage;
                    }
                    else
                    {
                        CombatLog += " poorly for " + damage;

                    }

                    if (crit == true)
                    {
                        CombatLog += " critical";
                    }

                    CombatLog += " damage.";
                }
            }

            PlayerTurn = true;

            CheckVictoryConditions(advEnemy);


        }
예제 #5
0
파일: FightSystem.cs 프로젝트: Sohrab/MyRPG
        private void CheckVictoryConditions(Enemy _advEnemy)
        {
            //Check if Player won
            if (_advEnemy.HealthPoints <= 0)
            {
                Victory = true;
                Loose = false;
                Repository.Player.DefeatedEnemies.Add(_advEnemy);
            }

            //Check if Enemy won
            if (Repository.Player.Health <= 0)
            {
                Victory = false;
                Loose = true;
            }
            

        }
예제 #6
0
파일: FightSystem.cs 프로젝트: Sohrab/MyRPG
 private void SetEnemyHp(Enemy _enemy)
 {
     EnemyHP = _enemy.HealthPoints;
 }