Esempio n. 1
0
 private void OnTriggerStay(Collider collision)
 {
     if (collision.gameObject.transform.parent)
     {
         if (collision.gameObject.transform.parent.tag == "Battle")
         {
             if (StaticClasses.CharControllerVelocity != false)
             {
                 if (StaticClasses.IsInBattle == false && currentMonsterOnPlayer.health > 0)
                 {
                     if (currentMonsterOnPlayer.monsterMoves[0] == null && currentMonsterOnPlayer.monsterMoves[1] == null)
                     {
                         print("Your monster doesn't have any moves!");
                     }
                     else
                     {
                         float randomNumber = Random.Range(0f, 100f);
                         if (randomNumber < 0.5f)
                         {
                             BattleScript battleScript       = transform.parent.GetComponent <BattleScript>();
                             string       WhatTypeOfMonsters = collision.gameObject.tag;
                             List <int>   TypeOfMonstersList = typeOfMonsters.FindType(WhatTypeOfMonsters);
                             int          MinMonsterLevel    = Mathf.Clamp(currentMonsterOnPlayer.level - 2, 1, int.MaxValue);
                             int          MaxMonsterLevel    = Mathf.Clamp(currentMonsterOnPlayer.level + 2, 1, int.MaxValue);
                             print("Min Monster Level = " + MinMonsterLevel + " | Max Monster Level = " + MaxMonsterLevel);
                             int RandomNumberLevel = Random.Range(MinMonsterLevel, MaxMonsterLevel + 1);
                             print("Monster Level = " + RandomNumberLevel);
                             int RandomNumber = Random.Range(1, 101);
                             if (RandomNumber < StaticClasses.BossChance)
                             {
                                 battleScript.Battle(TypeOfMonstersList[Random.Range(0, TypeOfMonstersList.Count - 1)], currentMonsterOnPlayer.level + 10, true);
                             }
                             else
                             {
                                 battleScript.Battle(TypeOfMonstersList[Random.Range(0, TypeOfMonstersList.Count - 1)], RandomNumberLevel, false);
                             }
                             StaticClasses.IsInBattle = true;
                         }
                     }
                 }
                 else
                 {
                     //Already in battle or monster is at no health.
                 }
             }
         }
     }
 }
Esempio n. 2
0
 public void StartBattlePhase(BasePiece attacker, BasePiece defender)
 {
     Bscript.Battle(attacker, defender);
 }