예제 #1
0
파일: Lists.cs 프로젝트: heugel/m0nst3rz
    public static Move.SubMove RandMove()
    {
        Random.InitState((int)System.DateTime.Now.Ticks);
        int i = (int)Random.Range((int)0, (int)instance.allmoves.Length);

        Move.SubMove temp = new Move.SubMove(instance.allmoves[i].themove);
        return(temp);
    }
예제 #2
0
 public void ClearQuest()
 {
     QT      = QuestType.none;
     gettype = Types.Type.none;
     getmove = new Move.SubMove();
     num     = 0;
     name    = "";
     desc    = "";
     pay     = 0;
 }
예제 #3
0
 public bool KnowsMove(Move.SubMove test)
 {
     for (int i = 0; i < 3; i++)
     {
         if (moves[i].Name == test.Name)
         {
             return(true);
         }
     }
     return(false);
 }
예제 #4
0
 public static void SetMove(Move.SubMove newmove, int player)
 {
     if (player == 1)
     {
         instance.turnmove1 = newmove;
     }
     else if (player == 2)
     {
         instance.turnmove2 = newmove;
     }
 }
예제 #5
0
 public static void SetMove(Move.SubMove newmove)
 {
     instance.turnmove = newmove;
 }
예제 #6
0
    IEnumerator UseMoveCo(AtkTurn theturn)
    {
        double dam         = 0;
        double origdam     = 0;
        int    paracheck   = 100;
        int    numhits     = 0;
        bool   multihit    = false;
        bool   mixedupfail = false;

        Monster.SubMonster atk     = theturn.atk;
        Monster.SubMonster def     = theturn.def;
        Move.SubMove       themove = theturn.atkmove;

        int  typecheck  = Types.CheckWeakness(themove.type, def.Type);
        bool statimmune = false;
        bool dodamage   = themove.dodamage;
        bool movefailed = false;

        if (themove.self)
        {
            statimmune = true;
        }
        if (themove.status == Monster.Status.none)
        {
            statimmune = true;
        }

        TheQueue.AddQueue(atk.Name + " used " + themove.Name + "!");

        //separate
        if (atk.status.Contains(Monster.Status.paralyze) || atk.status.Contains(Monster.Status.frozen))
        {
            paracheck = (int)UnityEngine.Random.Range((int)0, (int)3);
            if (paracheck != 0)
            {
                TheQueue.AddQueue(atk.Name + "'s status prevented it from moving!");
                usingmove = false;
                yield break;
            }
        }

        else if (atk.status.Contains(Monster.Status.asleep))
        {
            if ((int)UnityEngine.Random.Range((int)0, (int)5) == 0)
            {
                TheQueue.AddQueue(atk.Name + " is still sleeping!");
                TheQueue.AddQueue(atk.Name + " just woke up");
                atk.SetStatus(Monster.Status.none, 1);
                while (TheQueue.QCount() > 0)
                {
                    yield return(new WaitForEndOfFrame());
                }
                UpStats();
            }
            else
            {
                TheQueue.AddQueue(atk.Name + " is still sleeping!");
                usingmove = false;
                yield break;
            }
        }

        themove.Use();

        if (def.status.Contains(Monster.Status.evading))
        {
            if ((themove.dodamage || (!themove.self && themove.status != Monster.Status.none)))
            {
                if ((int)UnityEngine.Random.Range((int)0, (int)4) > 0)
                {
                    TheQueue.AddQueue(def.Name + " evaded the move!");
                    if (themove.hurtself)
                    {
                        TheQueue.AddQueue(atk.Name + " hurt itself!");
                        while (TheQueue.QCount() > 0)
                        {
                            yield return(new WaitForEndOfFrame());
                        }
                        TheQueue.AddQueue("It caused " + themove.hurtselfdam + " damage!");
                        UpHealth();
                        atk.Damage(themove.hurtselfdam);
                        if (atk.isDead())
                        {
                            TheQueue.AddQueue(atk.Name + " died!!!");
                        }
                    }
                    usingmove = false;
                    yield break;
                }
            }
        }

        dam  = themove.GiveDam();
        dam *= (1 + (atk.ATK / 200));
        dam  = System.Math.Round(dam, 2);
        //maybe move this switch statement within themove.hit()
        if (themove.dodamage || !statimmune)
        {
            switch (def.thequirk.quirk)
            {
            case Monster.QuirkType.none:
                break;

            case Monster.QuirkType.bouncer:
                if (themove.mt == def.thequirk.afmt && themove.dodamage)
                {
                    TheQueue.AddQueue(def.Name + "'s " + def.thequirk.Name + " caused the move to bounce back!");    //,false);

                    atk.Damage(dam / 2);
                    while (TheQueue.QCount() > 0)
                    {
                        yield return(new WaitForEndOfFrame());
                    }
                    UpHealth();
                    dodamage   = false;
                    movefailed = true;
                    while (TheQueue.QCount() > 0)
                    {
                        yield return(new WaitForEndOfFrame());
                    }
                    UpHealth();
                    TheQueue.AddQueue("It caused " + dam / 2 + " damage!");    //,true);
                    if (!themove.hurtself)
                    {
                        usingmove = false;
                        yield break;
                    }
                }
                break;

            case Monster.QuirkType.dodger:
                if (themove.mt == def.thequirk.afmt && themove.dodamage)
                {
                    if ((int)UnityEngine.Random.Range(0, 2) == 0)
                    {
                        break;
                    }
                    else
                    {
                        dodamage   = false;
                        movefailed = true;
                        TheQueue.AddQueue(def.Name + "'s " + def.thequirk.Name + " caused them to dodge!");    //,false);
                        if (!themove.hurtself)
                        {
                            usingmove = false;
                            yield break;
                        }
                    }
                }
                break;

            case Monster.QuirkType.givestatus:
                if (themove.mt == def.thequirk.afmt && themove.dodamage && !atk.status.Contains(def.thequirk.givestatus))
                {
                    if (atk.thequirk.quirk == Monster.QuirkType.statimmune)
                    {
                        if (atk.thequirk.givestatus == def.thequirk.givestatus)
                        {
                            break;
                        }
                        else
                        {
                            TheQueue.AddQueue("The move caused a status rebound!");
                            atk.SetStatus(def.thequirk.givestatus, def.thequirk.statlen);
                            while (TheQueue.QCount() > 0)
                            {
                                yield return(new WaitForEndOfFrame());
                            }
                            UpStats();
                        }
                    }
                    else
                    {
                        TheQueue.AddQueue("The move caused a status rebound!");
                        atk.SetStatus(def.thequirk.givestatus, def.thequirk.statlen);
                        //unless the attacker is immune to this status effect
                    }
                }

                break;

            case Monster.QuirkType.healer:
                if (def.thequirk.aftype == themove.type && themove.dodamage)
                {
                    dodamage   = false;
                    movefailed = true;
                    TheQueue.AddQueue("The moved caused " + def.Name + " to heal!");
                    def.Heal(def.thequirk.healhurt);
                    while (TheQueue.QCount() > 0)
                    {
                        yield return(new WaitForEndOfFrame());
                    }
                    UpHealth();
                    if (!themove.hurtself)
                    {
                        usingmove = false;
                        yield break;
                    }
                }
                break;

            case Monster.QuirkType.healerMT:
                if (def.thequirk.afmt == themove.mt && themove.dodamage)
                {
                    movefailed = true;
                    dodamage   = false;
                    //add quirk name
                    TheQueue.AddQueue("The moved caused " + def.Name + " to heal!");
                    def.Heal(def.thequirk.healhurt);
                    while (TheQueue.QCount() > 0)
                    {
                        yield return(new WaitForEndOfFrame());
                    }
                    UpHealth();
                    if (!themove.hurtself)
                    {
                        usingmove = false;
                        yield break;
                    }
                }
                break;

            case Monster.QuirkType.hurter:
                if (def.thequirk.afmt == themove.mt && themove.dodamage)
                {
                    //add quirk name
                    TheQueue.AddQueue("The moved caused " + atk.Name + " to take " + def.thequirk.healhurt + " damage!");
                    atk.Damage(def.thequirk.healhurt);
                    while (TheQueue.QCount() > 0)
                    {
                        yield return(new WaitForEndOfFrame());
                    }
                    UpHealth();
                    //if (atkr.isDead()) return;
                }
                break;

            case Monster.QuirkType.hurterT:
                if (def.thequirk.aftype == themove.type && themove.dodamage)
                {
                    //add quirk name
                    TheQueue.AddQueue("The moved caused " + atk.Name + " to take damage!");
                    atk.Damage(def.thequirk.healhurt);
                    while (TheQueue.QCount() > 0)
                    {
                        yield return(new WaitForEndOfFrame());
                    }
                    UpHealth();
                    //if (atkr.isDead()) return;
                }
                break;

            case Monster.QuirkType.mtimmune:
                if (themove.mt == def.thequirk.afmt && themove.dodamage)
                {
                    movefailed = true;
                    //add quirk name
                    dodamage = false;
                    TheQueue.AddQueue(def.Name + " is immune to this type of move!");
                    if (!themove.hurtself)
                    {
                        usingmove = false;
                        yield break;
                    }
                }
                break;

            case Monster.QuirkType.statimmune:
                if (themove.status == def.thequirk.givestatus && !themove.self)
                {
                    //add quirk name
                    statimmune = true;
                    TheQueue.AddQueue(def.Name + " is immune to " + themove.Name + "'s status effect!");
                }
                break;

            case Monster.QuirkType.typeimmune:
                if (themove.type == def.thequirk.aftype && themove.dodamage)
                {
                    //add quirk name
                    dodamage   = false;
                    movefailed = true;
                    TheQueue.AddQueue(def.Name + " is immune to this type!");
                    if (!themove.hurtself)
                    {
                        usingmove = false;
                        yield break;
                    }
                }
                break;
            }
        }


        if (themove.Hit())
        {
            if (dodamage)
            {
                dam  = themove.GiveDam();
                dam *= (1 + (atk.ATK / 200));
                //dam = System.Math.Round(dam, 2);
                if (atk.status.Contains(Monster.Status.doubled))
                {
                    dam *= 2;
                    TheQueue.AddQueue(atk.Name + "'s status caused double damage!");
                }
                if (atk.status.Contains(Monster.Status.halved))
                {
                    dam *= .5;
                    TheQueue.AddQueue(atk.Name + "'s status caused half damage!");
                }
                if (atk.status.Contains(Monster.Status.high))
                {
                    dam *= .7;
                    TheQueue.AddQueue(atk.Name + "'s status caused reduced damage!");
                }
                if (atk.status.Contains(Monster.Status.mixedup))
                {
                    if ((int)UnityEngine.Random.Range((int)0, (int)2) == 0)
                    {
                        TheQueue.AddQueue(atk.Name + " hurt itself instead!");
                        dam = System.Math.Round(dam, 2);
                        atk.Damage(dam / 2);
                        while (TheQueue.QCount() > 0)
                        {
                            yield return(new WaitForEndOfFrame());
                        }
                        UpHealth();
                        TheQueue.AddQueue("It did " + dam / 2 + " damage!");
                        mixedupfail = true;
                        dodamage    = false;
                        statimmune  = true;
                    }
                }

                if (def.status.Contains(Monster.Status.annoyed) && !mixedupfail)
                {
                    //print("poopoo");
                    dam *= 1.4;
                    TheQueue.AddQueue(def.Name + "'s status caused increased damage!");
                }
                if (def.status.Contains(Monster.Status.cold) && !mixedupfail)
                {
                    dam *= 1.4;
                    TheQueue.AddQueue(def.Name + "'s status caused increased damage!");
                }

                if (dodamage)
                {
                    if (typecheck == 2)
                    {
                        TheQueue.AddQueue("MEGA WEAKNESS! INSTAKILL!");
                        dam *= 3000;
                    }
                    else if (typecheck == 1)
                    {
                        TheQueue.AddQueue("Super effective!");
                        dam *= 2;

                        /*if (themove.Crit())
                         * {
                         *  dam *= 2;
                         *  TheQueue.AddQueue("Critical hit!");
                         * }*/
                        //def.Damage(dam);
                        //TheQueue.AddQueue("It did " + dam + " damage!");
                    }
                    else if (typecheck == 0)
                    {
                        /*if (themove.Crit())
                         * {
                         *  dam *= 1.5;
                         *  TheQueue.AddQueue("Critical hit!");
                         * }*/
                        //Damage(dam);
                        //TheQueue.AddQueue("It did " + dam + " damage!");
                    }
                    else if (typecheck == -1)
                    {
                        TheQueue.AddQueue("Not very effective");
                        dam /= 1.5;
                        //Damage(dam);
                        //TheQueue.AddQueue("It did " + dam + " damage!");
                    }
                    else if (typecheck == -2)
                    {
                        movefailed  = true;
                        statimmune  = true;
                        dodamage    = false;
                        mixedupfail = true;
                        TheQueue.AddQueue("The move had no effect!");
                    }
                    else if (typecheck == -3)
                    {
                        movefailed  = true;
                        dodamage    = false;
                        mixedupfail = true;
                        TheQueue.AddQueue("The move caused " + dam + " points of healing!");
                        def.Heal(dam);
                        statimmune = true;
                    }

                    if (!mixedupfail)
                    {
                        dam     = Math.Round(dam, 2);
                        origdam = dam;

                        if (themove.multihit && UnityEngine.Random.Range(0, 100f) < themove.MHP)
                        {
                            multihit = true;
                            TheQueue.AddQueue("Multi hit move!");
                        }

                        if (!multihit)
                        {
                            if (themove.Crit())
                            {
                                dam *= 1.5;
                                TheQueue.AddQueue("Critical hit!");
                            }
                            TheQueue.AddQueue("It did " + dam + " damage!");
                            def.Damage(dam);
                            while (TheQueue.QCount() > 0)
                            {
                                yield return(new WaitForEndOfFrame());
                            }
                            UnityEngine.Random.InitState((int)System.DateTime.Now.Ticks);

                            UpHealth();
                        }
                        else if (multihit)
                        {
                            if (themove.Crit())
                            {
                                dam *= 1.5;
                                TheQueue.AddQueue("Critical hit!");
                            }
                            TheQueue.AddQueue("First hit did " + dam + " damage!");
                            def.Damage(dam);
                            while (TheQueue.QCount() > 0)
                            {
                                yield return(new WaitForEndOfFrame());
                            }
                            UnityEngine.Random.InitState((int)System.DateTime.Now.Ticks);
                            UpHealth();

                            numhits = 2;
                            dam     = origdam * (double)UnityEngine.Random.Range(.9f, 1.1f);
                            dam     = Math.Round(dam, 2);
                            if (themove.Crit())
                            {
                                dam *= 1.5;
                                TheQueue.AddQueue("Critical hit!");
                            }
                            TheQueue.AddQueue("Second hit did " + dam + " damage!");
                            def.Damage(dam);
                            while (TheQueue.QCount() > 0)
                            {
                                yield return(new WaitForEndOfFrame());
                            }
                            UpHealth();
                            if (themove.maxhits > 2)
                            {
                                for (int i = 3; i <= themove.maxhits; i++)
                                {
                                    if (UnityEngine.Random.Range(0, 100f) < themove.MHP)
                                    {
                                        dam = origdam * (double)UnityEngine.Random.Range(.8f, 1.2f);
                                        dam = Math.Round(dam, 2);
                                        if (themove.Crit())
                                        {
                                            dam *= 1.5;
                                            TheQueue.AddQueue("Critical hit!");
                                        }
                                        def.Damage(dam);
                                        while (TheQueue.QCount() > 0)
                                        {
                                            yield return(new WaitForEndOfFrame());
                                        }
                                        UpHealth();
                                        UnityEngine.Random.InitState((int)System.DateTime.Now.Ticks);
                                        numhits = i;
                                        TheQueue.AddQueue("Hit " + i + " did " + dam + " damage!");
                                    }
                                    else
                                    {
                                        break;
                                    }
                                }
                            }
                            TheQueue.AddQueue(numhits + " hits!");
                        }
                    }
                }
            }



            if (!def.isDead() && !statimmune && themove.status != Monster.Status.none)
            {
                def.SetStatus(themove.status, themove.statlen);
            }
            //else if (!def.isDead() && !statimmune && themove.status != Monster.Status.none && def.status != Monster.Status.none && themove.statoverride)
            //def.SetStatus(themove.status, themove.statlen);
            else if (!def.isDead() && themove.status != Monster.Status.none && !themove.self && statimmune)
            {
                TheQueue.AddQueue(themove.Name + "'s status effect failed!");
            }

            while (TheQueue.QCount() > 0)
            {
                yield return(new WaitForEndOfFrame());
            }
            UpStats();

            if (themove.hurtself)
            {
                TheQueue.AddQueue(atk.Name + " hurt itself!");
                TheQueue.AddQueue("It caused " + themove.hurtselfdam + " damage!");
                //health bar animation
                atk.Damage(themove.hurtselfdam);
                while (TheQueue.QCount() > 0)
                {
                    yield return(new WaitForEndOfFrame());
                }
                UpHealth();
            }

            else if (themove.healself && !movefailed)
            {
                TheQueue.AddQueue(themove.Name + " caused " + atk.Name + " to heal!");
                TheQueue.AddQueue(atk.Name + " healed " + themove.hurtselfdam + " health!");
                //health bar animation
                atk.Heal(themove.hurtselfdam);
            }

            if (themove.self && !atk.status.Contains(themove.status) && !atk.isDead())
            {
                TheQueue.AddQueue(themove.Name + " gave " + atk.Name + " a status effect!");
                atk.SetStatus(themove.status, themove.statlen);
                statimmune = true;
                while (TheQueue.QCount() > 0)
                {
                    yield return(new WaitForEndOfFrame());
                }
                //if(themove.healself)
                //return;
            }

            /*else if (themove.self && atk.status != Monster.Status.none && themove.statoverride && !atk.isDead())
             * {
             *  TheQueue.AddQueue(themove.Name + " gave " + atk.Name + " a status effect!");
             *  atk.SetStatus(themove.status, themove.statlen);
             *  statimmune = true;
             * }*/
            else if (themove.self && atk.status.Contains(themove.status) && !atk.isDead())
            {
                TheQueue.AddQueue(atk.Name + " failed to give itself a status effect!");
            }

            if (def.isDead())
            {
                TheQueue.AddQueue(def.Name + " died!!!");
            }
            if (atk.isDead())
            {
                TheQueue.AddQueue(atk.Name + " died!!!");
            }
        }
        else
        {
            TheQueue.AddQueue(atk.Name + "'s attack missed!");
        }


        //UpStats();

        usingmove = false;
    }
예제 #7
0
 public AtkTurn()
 {
     atk     = new Monster.SubMonster();
     def     = new Monster.SubMonster();
     atkmove = new Move.SubMove();
 }
예제 #8
0
        public void RandomQuest()
        {
            int      typetest = (int)UnityEngine.Random.Range((int)0, (int)5);
            SubQuest temp     = new SubQuest();

            switch (typetest)
            {
            case 0:
                QT      = QuestType.type;
                gettype = Types.Int2Type((int)UnityEngine.Random.Range((int)1, (int)22));
                desc    = "Oi! I need you to get a young " + Types.TypePrinter(gettype) + " type m0nst3r for me!";
                if (gettype != Types.Type.spooky && gettype != Types.Type.amyschumer)
                {
                    pay = (int)UnityEngine.Random.Range((int)100, (int)301);
                }
                else
                {
                    pay = (int)UnityEngine.Random.Range((int)250, (int)501);
                }
                break;

            case 1:
                QT      = QuestType.move;
                getmove = Lists.RandMove();
                desc    = "Oi oi! I need a young m0nst3r that knows the move " + getmove.Name + "!";
                pay     = (int)UnityEngine.Random.Range((int)100, (int)301);
                break;

            case 2:
                QT   = QuestType.ATK;
                num  = (double)UnityEngine.Random.Range(50f, 95f);
                num  = System.Math.Round(num, 2);
                desc = "Hey-o oi oi! I'm gonna need a m0nst3r with an ATK rating of over " + num + "!";
                if (num < 90)
                {
                    pay = (int)(2 * ((num * num) / 50));
                }
                else
                {
                    pay = 1000;
                }
                break;

            case 3:
                QT   = QuestType.SPD;
                num  = (double)UnityEngine.Random.Range(50f, 95f);
                num  = System.Math.Round(num, 2);
                desc = "Hey-o oi! I'm gonna need a m0nst3r with an SPD rating of over " + num + "!";
                if (num < 90)
                {
                    pay = (int)(2 * ((num * num) / 50));
                }
                else
                {
                    pay = 1000;
                }
                break;

            case 4:
                QT   = QuestType.HP;
                num  = (double)UnityEngine.Random.Range(45f, 70f);
                num  = System.Math.Round(num, 2);
                desc = "Hoi! I'm gonna need a m0nst3r with over " + num + " health!";
                if (num < 60)
                {
                    pay = (int)(4 * ((num * num) / 45));
                }
                else
                {
                    pay = 2000;
                }
                break;
            }
        }