Esempio n. 1
0
        public static bool Buff;                                     //czy jest to umiejetnosc czy atak

        public static void Attack(Warrior hero, List <Hero> Enemies) //dla warriora
        {
            Buff = false;                                            //ustawia ze jest to atak
            if (!hero._moreArmor)                                    //jesli nie ma wlaczonego buff'u moreArmor
            {
                hero.warShout();                                     //to go aktywuje
                Buff = true;                                         //zaznacza ze to nie atak
            }
            else//w przeciwnym wypadku
            {
                if (hero.Health > 65)//decyduje kogo chce zaatakowac
                {
                    DMG = hero.powerHit();
                }
                else if (hero.Health > 30)
                {
                    DMG = hero.swordHit();
                }
                else if (hero.Health > 20)
                {
                    DMG = hero.powerHit();
                }
                else
                {
                    DMG = hero.swordHit();
                }
                Enemy = rnd.Next(0, Enemies.Count);//wybiera wroga w sposob losowy
                Buff  = false;
            }
        }
Esempio n. 2
0
 private void warrior_attack(Warrior hero, bool fourthSkill) //atakuje Warrior
 {
     hero.checkWarShout();                                   //sprawdza umiejetnosc moreArmor
     if (fourthSkill)                                        //jesli czwarty skill: to jest booleam z paramteru który mówi nam czy został uzyty
     {
         hero.warShout();                                    //czwarty skill, jesli nie został to sprawdza radiobutton'y
     }
     else if (radioButton1.Checked)
     {
         DMG = hero.swordHit();
     }
     else if (radioButton2.Checked)
     {
         DMG = hero.powerHit();
     }
 }
Esempio n. 3
0
 private void bot_Attack()                                            //atak komputera
 {
     if (whichTeam)                                                   //jesli druzyna przyajciol
     {
         if (AllyTeam[currentAlly] is Warrior)                        //jesli warrior
         {
             AI_Attack.Attack((Warrior)current, EnemyTeam);           //metoda losujaca/wybierajaca
             if (AI_Attack.Buff)                                      //jesli nie byl to atak
             {
                 Warrior tmp = (Warrior)AllyTeam[currentAlly];        //tutaj tak troche
                 tmp.warShout();                                      //byle jak, uzywanie skilla,
                 AllyTeam[currentAlly] = tmp;                         //oraz nowe przypisywanie do obecnie grajacej psotaci
                 MessageBox.Show(current._Name + " used War Shout."); //wiadomosc pokazujaca co sie stalo
             }
             else//jesli to byl atack
             {
                 EnemyTeam[AI_Attack.Enemy].healthChange(AI_Attack.DMG);//odejmuje wybranemu wrogowi obliczone obrazenia
                 MessageBox.Show(current._Name + " hit " + EnemyTeam[AI_Attack.Enemy]._Name + " for " + AI_Attack.DMG + " damage.");
             }//wiadomosc pokazujaca co sie stalo
         }
         if (AllyTeam[currentAlly] is Mage)//reszta na tej samej zasadzie
         {
             AI_Attack.Attack((Mage)current, EnemyTeam);
             if (AI_Attack.Buff)
             {
                 Mage tmp = (Mage)AllyTeam[currentAlly];
                 tmp.regenerate();
                 AllyTeam[currentAlly] = tmp;
                 MessageBox.Show(AllyTeam[currentAlly]._Name + " regenerated mana.");
             }
             else
             {
                 if (AI_Attack.Enemy != -1)
                 {
                     EnemyTeam[AI_Attack.Enemy].healthChange(AI_Attack.DMG);
                     MessageBox.Show(current._Name + " hit " + EnemyTeam[AI_Attack.Enemy]._Name + " for " + DMG + " damage.");
                 }
                 else//z tym wyjatkiem, ze jesli indeks wroga jest -1 to jest uzywany blizzard
                 {//na wszystkich wrogow
                     for (int i = 0; i < EnemyTeam.Count; i++)
                     {
                         EnemyTeam[i].healthChange(AI_Attack.DMG);
                     }
                     MessageBox.Show(current._Name + " used Blizzard and hit every enemy for " + AI_Attack.DMG + " damage.");
                 }
             }
         }
         if (AllyTeam[currentAlly] is Archer)
         {
             AI_Attack.Attack((Archer)current, EnemyTeam);
             EnemyTeam[AI_Attack.Enemy].healthChange(AI_Attack.DMG);
             MessageBox.Show(current._Name + " hit " + EnemyTeam[AI_Attack.Enemy]._Name + " for " + AI_Attack.DMG + " damage.");
         }
         if (AllyTeam[currentAlly] is Priest)
         {
             AI_Attack.Attack((Priest)current, AllyTeam, EnemyTeam);
             if (AI_Attack.Buff)
             {
                 if (AI_Attack.Enemy == -1)
                 {//tak samo jesli indeks jest na -1 to leczy samego sieibe
                     AllyTeam[currentAlly].healthChange(AI_Attack.DMG);
                     MessageBox.Show(current._Name + " healed himself for " + (-AI_Attack.DMG));
                 }
                 else//jesli nie jest na -1 ale nie jest to rowniez atak to leczy
                 {//przyajciela o wskazanym indeksie
                     AllyTeam[AI_Attack.Enemy].healthChange(AI_Attack.DMG);
                     MessageBox.Show(current._Name + " healed " + AllyTeam[AI_Attack.Enemy]._Name + " for " + (-AI_Attack.DMG));
                 }
             }
             else
             {
                 EnemyTeam[AI_Attack.Enemy].healthChange(AI_Attack.DMG);
                 MessageBox.Show(current._Name + " hit " + EnemyTeam[AI_Attack.Enemy]._Name + " for " + DMG + " damage.");
             }
         }
     }
     else//tak samo dal druzyny wrogow
     {
         if (EnemyTeam[currentEnemy] is Warrior)
         {
             AI_Attack.Attack((Warrior)current, AllyTeam);
             if (AI_Attack.Buff)
             {
                 Warrior tmp = (Warrior)EnemyTeam[currentEnemy];
                 tmp.warShout();
                 EnemyTeam[currentEnemy] = tmp;
                 MessageBox.Show(current._Name + " used War Shout.");
             }
             else
             {
                 AllyTeam[AI_Attack.Enemy].healthChange(AI_Attack.DMG);
                 MessageBox.Show(current._Name + " hit " + AllyTeam[AI_Attack.Enemy]._Name + " for " + AI_Attack.DMG + " damage.");
             }
         }
         if (EnemyTeam[currentEnemy] is Mage)
         {
             AI_Attack.Attack((Mage)current, AllyTeam);
             if (AI_Attack.Buff)
             {
                 Mage tmp = (Mage)EnemyTeam[currentEnemy];
                 tmp.regenerate();
                 EnemyTeam[currentEnemy] = tmp;
                 MessageBox.Show(EnemyTeam[currentEnemy]._Name + " regenerated mana.");
             }
             else
             {
                 if (AI_Attack.Enemy != -1)
                 {
                     AllyTeam[AI_Attack.Enemy].healthChange(AI_Attack.DMG);
                     MessageBox.Show(current._Name + " hit " + AllyTeam[AI_Attack.Enemy]._Name + " for " + AI_Attack.DMG + " damage.");
                 }
                 else
                 {
                     for (int i = 0; i < AllyTeam.Count; i++)
                     {
                         AllyTeam[i].healthChange(AI_Attack.DMG);
                     }
                     MessageBox.Show(current._Name + " used Blizzard and hit every enemy for " + AI_Attack.DMG + " damage.");
                 }
             }
         }
         if (EnemyTeam[currentEnemy] is Archer)
         {
             AI_Attack.Attack((Archer)current, AllyTeam);
             AllyTeam[AI_Attack.Enemy].healthChange(AI_Attack.DMG);
             MessageBox.Show(current._Name + " hit " + AllyTeam[AI_Attack.Enemy]._Name + " for " + AI_Attack.DMG + " damage.");
         }
         if (EnemyTeam[currentEnemy] is Priest)
         {
             AI_Attack.Attack((Priest)current, EnemyTeam, AllyTeam);
             if (AI_Attack.Buff)
             {
                 if (AI_Attack.Enemy == -1)
                 {
                     EnemyTeam[currentEnemy].healthChange(AI_Attack.DMG);
                     MessageBox.Show(current._Name + " healed himself for " + (-AI_Attack.DMG));
                 }
                 else
                 {
                     EnemyTeam[AI_Attack.Enemy].healthChange(AI_Attack.DMG);
                     MessageBox.Show(current._Name + " healed " + EnemyTeam[AI_Attack.Enemy]._Name + " for " + (-AI_Attack.DMG));
                 }
             }
             else
             {
                 AllyTeam[AI_Attack.Enemy].healthChange(AI_Attack.DMG);
                 MessageBox.Show(current._Name + " hit " + AllyTeam[AI_Attack.Enemy]._Name + " for " + AI_Attack.DMG + " damage.");
             }
         }
     }
     uncheck_buttons_and_markers();                                      //i tutaj tak samo, odznaczanie
     damage_added_correctly = false;
     set();                                                              //ustawianie paskow zyc i many
     check_dead();                                                       //sprawdza czy ktos umarl
     if (ArenaGameProject.Menu.AllyWin | ArenaGameProject.Menu.EnemyWin) //sprawdza czy czy ktos wygrał czy nie
     {
         Close();
     }
     else//poniewaz musi dokonczyc metode zamin zamknie Form'a, dlatego jest tu else
     {
         next_turn();//nastepna tura
         skill_check(); //ustawia skille,
         set_marker();  //ustawia znacznik
         if (current._isAI)
         {
             bot_Attack();
         }
     }
 }