IEnumerator MonTurn() { int opmove; //bool died = false; List <Move.SubMove> potmoves = new List <Move.SubMove>(); for (int i = 0; i < 3; i++) { if (opon.moves[i].curPP > 0) { potmoves.Add(opon.moves[i]); } } if (potmoves.Count > 0) { opmove = (int)UnityEngine.Random.Range((int)0, (int)potmoves.Count); atkturn.atk = opon; atkturn.def = you; atkturn.atkmove = potmoves[opmove]; usingmove = true; StartCoroutine("UseMoveCo", atkturn); while (usingmove) { yield return(new WaitForEndOfFrame()); } UpHealth(); } else { TheQueue.AddQueue(instance.opon.Name + " can't use any moves!"); } while (TheQueue.QCount() > 0) { yield return(new WaitForEndOfFrame()); } if (instance.you.isDead() && instance.opon.isDead()) { TheQueue.AddQueue("Both m0nst3rz have died!"); player1.moninv.RemoveMonster(instance.you); you = new Monster.SubMonster(); if (player1.moninv.HasAnActive()) { TheQueue.goadventure = true; } else { TheQueue.gohome = true; } yield break; } else if (instance.you.isDead()) { player1.moninv.RemoveMonster(instance.you); opon.GetKill(); UpHealth();//check if (player1.moninv.HasAnActive()) { //instance.deadoponturn = false; player1.moninv.RemoveMonster(you); you = new Monster.SubMonster(); TheQueue.curdead = true; playerdied = true; while (you.Name == "") { yield return(new WaitForEndOfFrame()); } //playerdied = false; } else { player1.moninv.RemoveMonster(you); you = new Monster.SubMonster(); TheQueue.AddQueue("You're out of m0nst3rz!!!"); TheQueue.gohome = true; yield break; } } while (TheQueue.QCount() > 0) { yield return(new WaitForEndOfFrame()); } opon.StatLenUpdate(); UpStats(); while (TheQueue.QCount() > 0) { yield return(new WaitForEndOfFrame()); } UpHealth(); if (instance.opon.isDead()) { you.GetKill(); TheQueue.AddQueue("You killed the " + instance.opon.Name + "!!!"); TheQueue.goadventure = true; //deadoponturn = false; } if (TheQueue.QCount() == 0) { monturn = false; } }
IEnumerator YouTurn(TurnType tt) { int esccheck; switch (tt) { case TurnType.none: break; case TurnType.item: if (instance.turnitem.IT == Item.ItemType.potion) { //do animation here //DoPotion function? instance.you.Heal(-1); TheQueue.AddQueue("You used a potion!"); while (TheQueue.QCount() > 0) { yield return(new WaitForEndOfFrame()); } UpHealth(); TheQueue.AddQueue(instance.you.Name + " is fully healed!"); if (instance.you.status.Count == 0) { instance.you.SetStatus(Monster.Status.none, 1); } } else if (instance.turnitem.IT == Item.ItemType.net) { //DoNet //animation //if types match, catch //else if net type is none, 50/50 //else if types dont match, dont catch TheQueue.AddQueue("You launched a net!"); if (instance.turnitem.nettype == Types.Type.none) { if (!instance.CheckNet()) { TheQueue.AddQueue("Your net missed!"); } else { if (player1.moninv.IsFull()) { TheQueue.AddQueue("You don't have room for this m0nst3r!"); TheQueue.goadventure = true; yield break; } else { TheQueue.AddQueue("You've caught the " + instance.opon.Name + "!"); player1.moninv.AddMonster(instance.opon); TheQueue.goadventure = true; yield break; } } } else if (instance.turnitem.nettype == instance.opon.Type) { if (player1.moninv.IsFull()) { TheQueue.AddQueue("You don't have room for this m0nst3r!"); TheQueue.goadventure = true; yield break; } else { TheQueue.AddQueue("You've caught the " + instance.opon.Name + "!"); player1.moninv.AddMonster(instance.opon); TheQueue.goadventure = true; yield break; } } else { TheQueue.AddQueue("Your net missed!"); } } break; case TurnType.attack: atkturn.atk = you; atkturn.def = opon; atkturn.atkmove = turnmove; usingmove = true; StartCoroutine("UseMoveCo", atkturn); while (usingmove) { yield return(new WaitForEndOfFrame()); } UpHealth(); break; case TurnType.change: you = changeto; changeto = new Monster.SubMonster(); UpHealth(); TheQueue.AddQueue("You've changed m0nst3rz to " + instance.you.Name + "!"); break; case TurnType.esc: esccheck = UnityEngine.Random.Range((int)0, (int)3); if (esccheck == 0) { TheQueue.AddQueue("You've escaped!"); TheQueue.goadventure = true; yield break; } else { TheQueue.AddQueue("Escape attempt failed!"); } break; } while (TheQueue.QCount() > 0) { yield return(new WaitForEndOfFrame()); } if (!instance.you.isDead()) { instance.you.StatLenUpdate(); UpStats(); while (TheQueue.QCount() > 0) { yield return(new WaitForEndOfFrame()); } UpHealth(); } if (instance.you.isDead() && instance.opon.isDead()) { TheQueue.AddQueue("Both m0nst3rz have died!"); player1.moninv.RemoveMonster(instance.you); you = new Monster.SubMonster(); if (player1.moninv.HasAnActive()) { TheQueue.goadventure = true; } else { TheQueue.gohome = true; } yield break; } else if (instance.you.isDead()) { player1.moninv.RemoveMonster(instance.you); if (player1.moninv.HasAnActive()) { player1.moninv.RemoveMonster(you); you = new Monster.SubMonster(); //instance.deadoponturn = true; TheQueue.curdead = true; while (you.Name == "") { yield return(new WaitForEndOfFrame()); } } else { player1.moninv.RemoveMonster(you); you = new Monster.SubMonster(); TheQueue.AddQueue("You're out of m0nst3rz!!!"); TheQueue.gohome = true; yield break; } } else if (instance.opon.isDead()) { you.GetKill(); TheQueue.AddQueue("You killed the " + instance.opon.Name + "!!!"); TheQueue.goadventure = true; yield break; //SceneManager.LoadScene("Adventure"); } if (TheQueue.QCount() == 0) { youturn = false; } }