Beispiel #1
0
    void Damage(int p, int e, int E1CHP, int E1CG, int Att, string damageType)
    {
        if (PlayerPrefs.GetString("E" + e + "-Weakness1") == damageType || PlayerPrefs.GetString("E" + e + "-Weakness2") == damageType)
        {
            Att = (int)Math.Round((float)Att * 1.5, 1);
        }
        if (PlayerPrefs.GetString("E" + e + "-Resistance1") == damageType || PlayerPrefs.GetString("E" + e + "-Resistance2") == damageType || PlayerPrefs.GetString("E" + e + "-Resistance3") == damageType)
        {
            Att = (int)Math.Round((float)Att * 0.75, 1);
        }
        if (PlayerPrefs.GetString("E" + e + "Status0") == "steadfast" || PlayerPrefs.GetString("E" + e + "Status1") == "steadfast" || PlayerPrefs.GetString("E" + e + "Status2") == "steadfast" || PlayerPrefs.GetString("E" + e + "Status3") == "steadfast")
        {
            E1CG -= Att;
        }
        else
        {
            E1CG = E1CG - ((Att / 2) + (Att % 2));
        }
        if (E1CG < 0)
        {
            E1CHP = E1CHP + E1CG;
            E1CG  = 0;
        }
        E1CHP = E1CHP - Att / 2;
        GameObject GBar = GameObject.Find("E" + e + "-Guard");

        PlayerPrefs.SetInt("E" + e + "-CG", E1CG);
        int   E1MaxG   = PlayerPrefs.GetInt("E" + e + "-Guard");
        float PercentG = ((float)E1CG / (float)E1MaxG);

        GBar.gameObject.transform.localScale = new Vector3(PercentG, 1, 1);
        GameObject Bar = GameObject.Find("E" + e + "-Hp");

        if (E1CHP > 0)
        {
            PlayerPrefs.SetInt("E" + e + "-CHP", E1CHP);
            int   E1Max     = PlayerPrefs.GetInt("E" + e + "-HP");
            float PercentHP = ((float)E1CHP / (float)E1Max);
            Bar.gameObject.transform.localScale = new Vector3(PercentHP, 1, 1);
        }
        else
        {
            PlayerPrefs.SetInt("E" + e + "-CHP", 0);
            int   E1Max     = PlayerPrefs.GetInt("E" + e + "-HP");
            float PercentHP = 0;
            Bar.gameObject.transform.localScale = new Vector3(PercentHP, 1, 1);
            GameObject enemy = GameObject.Find("E" + e);
            enemy.GetComponent <SpriteRenderer>().color = Color.black;
            if (PlayerPrefs.GetInt("E1-CHP") <= 0 && PlayerPrefs.GetInt("E2-CHP") <= 0)
            {
                //change to map
                RewardsScreen.RewardDisplay("standard");
                PlayerPrefs.SetInt("E1-Set", 0);
                //Application.LoadLevel("Win");
            }
            else if (PlayerPrefs.GetInt("E1-CHP") <= 0 && PlayerPrefs.GetString("E2-Name") == "null")
            {
                //change to map
                RewardsScreen.RewardDisplay("standard");
                PlayerPrefs.SetInt("E1-Set", 0);
                //Application.LoadLevel("Win");
            }
        }
    }
Beispiel #2
0
    void Damage(int p, int e, int E1CHP, int E1CG, int Att, string damageType)
    {
        //accuracyCheck
        int accuracyCheck = UnityEngine.Random.Range(1, 101);

        if (PlayerPrefs.GetInt("P" + p + "-Accuracy") - PlayerPrefs.GetInt("E" + e + "-Dodge") < accuracyCheck)
        {
            Miss(e);
            PlayerPrefs.SetInt("P" + p + "-TurnTaken", 1);
            PlayerPrefs.SetString("ActiveSkill", "None");
            PlayerPrefs.SetInt("ENumber", 0);
            EndPlayerTurn();
        }
        else
        {
            if (PlayerPrefs.GetString("P" + p + "-PassiveSkill") == "Bloodlust1")
            {
                Att += 3;
            }
            if (PlayerPrefs.GetString("E" + e + "-Weakness1") == damageType || PlayerPrefs.GetString("E" + e + "-Weakness2") == damageType)
            {
                Att = (int)Math.Round((float)Att * 1.5, 1);
            }
            if (PlayerPrefs.GetString("E" + e + "-Resistance1") == damageType || PlayerPrefs.GetString("E" + e + "-Resistance2") == damageType || PlayerPrefs.GetString("E" + e + "-Resistance3") == damageType)
            {
                Att = (int)Math.Round((float)Att * 0.75, 1);
            }
            int critCheck = UnityEngine.Random.Range(1, 101);
            if (PlayerPrefs.GetInt("P" + p + "-CritRate") < critCheck)
            {
                Att = (int)Math.Round((float)Att * 1.5, 1);
                Crit(e);
            }
            if (PlayerPrefs.GetString("E" + e + "Status0") == "steadfast" || PlayerPrefs.GetString("E" + e + "Status1") == "steadfast" || PlayerPrefs.GetString("E" + e + "Status2") == "steadfast" || PlayerPrefs.GetString("E" + e + "Status3") == "steadfast")
            {
                E1CG -= Att;
            }
            else if (PlayerPrefs.GetString("E" + e + "Status0") == "vulnerable" || PlayerPrefs.GetString("E" + e + "Status1") == "vulnerable" || PlayerPrefs.GetString("E" + e + "Status2") == "vulnerable" || PlayerPrefs.GetString("E" + e + "Status3") == "vulnerable")
            {
                E1CHP -= Att;
            }
            else
            {
                E1CG  = E1CG - ((Att / 2) + (Att % 2));
                E1CHP = E1CHP - Att / 2;
            }
            if (E1CG < 0)
            {
                E1CHP = E1CHP + E1CG;
                E1CG  = 0;
            }
            GameObject GBar = GameObject.Find("E" + e + "-Guard");
            PlayerPrefs.SetInt("E" + e + "-CG", E1CG);
            int   E1MaxG   = PlayerPrefs.GetInt("E" + e + "-Guard");
            float PercentG = ((float)E1CG / (float)E1MaxG);
            GBar.gameObject.transform.localScale = new Vector3(PercentG, 1, 1);
            GameObject Bar = GameObject.Find("E" + e + "-Hp");
            if (E1CHP > 0)
            {
                PlayerPrefs.SetInt("E" + e + "-CHP", E1CHP);
                int   E1Max     = PlayerPrefs.GetInt("E" + e + "-HP");
                float PercentHP = ((float)E1CHP / (float)E1Max);
                Bar.gameObject.transform.localScale = new Vector3(PercentHP, 1, 1);
            }
            else
            {
                PlayerPrefs.SetInt("E" + e + "-CHP", 0);
                int   E1Max     = PlayerPrefs.GetInt("E" + e + "-HP");
                float PercentHP = 0;
                Bar.gameObject.transform.localScale = new Vector3(PercentHP, 1, 1);
                GameObject enemy = GameObject.Find("E" + e);
                enemy.GetComponent <SpriteRenderer>().color = Color.black;
                if (PlayerPrefs.GetInt("E1-CHP") <= 0 && PlayerPrefs.GetInt("E2-CHP") <= 0)
                {
                    //change to map
                    RewardsScreen.RewardDisplay("standard");
                    PlayerPrefs.SetInt("E1-Set", 0);
                    //Application.LoadLevel("Win");
                }
                else if (PlayerPrefs.GetInt("E1-CHP") <= 0 && PlayerPrefs.GetString("E2-Name") == "null")
                {
                    //change to map
                    RewardsScreen.RewardDisplay("standard");
                    PlayerPrefs.SetInt("E1-Set", 0);
                    //Application.LoadLevel("Win");
                }
            }
        }
    }
Beispiel #3
0
    void Collision(int e, int collision, int damage, string status, int statusX)
    {
        int loc = 0;

        if (collision == 1)
        {
            loc = PlayerPrefs.GetInt("E" + e + "-Loc") + 1;
            for (int i = 1; i <= 4; i++)
            {
                if (loc == PlayerPrefs.GetInt("E" + i + "Loc"))
                {
                    StatusEffect.InflictStatusEnemy(status, e, statusX);
                    StatusEffect.InflictStatusEnemy(status, i, statusX);
                    int e1HP = PlayerPrefs.GetInt("E" + e + "-CHP");
                    int e2HP = PlayerPrefs.GetInt("E" + i + "-CHP");
                    e1HP -= damage;
                    e2HP -= damage;
                    if (e1HP > 0)
                    {
                        PlayerPrefs.SetInt("E" + e + "-CHP", e1HP);
                        int   E1Max     = PlayerPrefs.GetInt("E" + e + "-HP");
                        float PercentHP = ((float)e1HP / (float)E1Max);
                        GameObject.Find("E" + e + "-Hp").transform.localScale = new Vector3(PercentHP, 1, 1);
                    }
                    else
                    {
                        PlayerPrefs.SetInt("E" + e + "-CHP", 0);
                        int   E1Max     = PlayerPrefs.GetInt("E" + e + "-HP");
                        float PercentHP = 0;
                        GameObject.Find("E" + e + "-Hp").transform.localScale = new Vector3(PercentHP, 1, 1);
                        GameObject enemy = GameObject.Find("E" + e);
                        enemy.GetComponent <SpriteRenderer>().color = Color.black;
                        if (PlayerPrefs.GetInt("E1-CHP") <= 0 && PlayerPrefs.GetInt("E2-CHP") <= 0)
                        {
                            //change to map
                            RewardsScreen.RewardDisplay("standard");
                            PlayerPrefs.SetInt("E1-Set", 0);
                            //Application.LoadLevel("Win");
                        }
                        else if (PlayerPrefs.GetInt("E1-CHP") <= 0 && PlayerPrefs.GetString("E2-Name") == "null")
                        {
                            //change to map
                            RewardsScreen.RewardDisplay("standard");
                            PlayerPrefs.SetInt("E1-Set", 0);
                            //Application.LoadLevel("Win");
                        }
                    }
                    if (e2HP > 0)
                    {
                        PlayerPrefs.SetInt("E" + i + "-CHP", e2HP);
                        int   E1Max     = PlayerPrefs.GetInt("E" + i + "-HP");
                        float PercentHP = ((float)e2HP / (float)E1Max);
                        GameObject.Find("E" + i + "-Hp").transform.localScale = new Vector3(PercentHP, 1, 1);
                    }
                    else
                    {
                        PlayerPrefs.SetInt("E" + i + "-CHP", 0);
                        int   E1Max     = PlayerPrefs.GetInt("E" + i + "-HP");
                        float PercentHP = 0;
                        GameObject.Find("E" + i + "-Hp").transform.localScale = new Vector3(PercentHP, 1, 1);
                        GameObject enemy = GameObject.Find("E" + i);
                        enemy.GetComponent <SpriteRenderer>().color = Color.black;
                        if (PlayerPrefs.GetInt("E1-CHP") <= 0 && PlayerPrefs.GetInt("E2-CHP") <= 0)
                        {
                            //change to map
                            RewardsScreen.RewardDisplay("standard");
                            PlayerPrefs.SetInt("E1-Set", 0);
                            //Application.LoadLevel("Win");
                        }
                        else if (PlayerPrefs.GetInt("E1-CHP") <= 0 && PlayerPrefs.GetString("E2-Name") == "null")
                        {
                            //change to map
                            RewardsScreen.RewardDisplay("standard");
                            PlayerPrefs.SetInt("E1-Set", 0);
                            //Application.LoadLevel("Win");
                        }
                    }
                }
            }
        }
        if (collision == 2)
        {
            loc = PlayerPrefs.GetInt("E" + e + "-Loc") - 1;
            for (int i = 1; i <= 4; i++)
            {
                if (loc == PlayerPrefs.GetInt("E" + i + "Loc"))
                {
                    StatusEffect.InflictStatusEnemy(status, e, statusX);
                    StatusEffect.InflictStatusEnemy(status, i, statusX);
                    int e1HP = PlayerPrefs.GetInt("E" + e + "-CHP");
                    int e2HP = PlayerPrefs.GetInt("E" + i + "-CHP");
                    e1HP -= damage;
                    e2HP -= damage;
                    if (e1HP > 0)
                    {
                        PlayerPrefs.SetInt("E" + e + "-CHP", e1HP);
                        int   E1Max     = PlayerPrefs.GetInt("E" + e + "-HP");
                        float PercentHP = ((float)e1HP / (float)E1Max);
                        GameObject.Find("E" + e + "-Hp").transform.localScale = new Vector3(PercentHP, 1, 1);
                    }
                    else
                    {
                        PlayerPrefs.SetInt("E" + e + "-CHP", 0);
                        int   E1Max     = PlayerPrefs.GetInt("E" + e + "-HP");
                        float PercentHP = 0;
                        GameObject.Find("E" + e + "-Hp").transform.localScale = new Vector3(PercentHP, 1, 1);
                        GameObject enemy = GameObject.Find("E" + e);
                        enemy.GetComponent <SpriteRenderer>().color = Color.black;
                        if (PlayerPrefs.GetInt("E1-CHP") <= 0 && PlayerPrefs.GetInt("E2-CHP") <= 0)
                        {
                            //change to map
                            RewardsScreen.RewardDisplay("standard");
                            PlayerPrefs.SetInt("E1-Set", 0);
                            //Application.LoadLevel("Win");
                        }
                        else if (PlayerPrefs.GetInt("E1-CHP") <= 0 && PlayerPrefs.GetString("E2-Name") == "null")
                        {
                            //change to map
                            RewardsScreen.RewardDisplay("standard");
                            PlayerPrefs.SetInt("E1-Set", 0);
                            //Application.LoadLevel("Win");
                        }
                    }
                    if (e2HP > 0)
                    {
                        PlayerPrefs.SetInt("E" + i + "-CHP", e2HP);
                        int   E1Max     = PlayerPrefs.GetInt("E" + i + "-HP");
                        float PercentHP = ((float)e2HP / (float)E1Max);
                        GameObject.Find("E" + i + "-Hp").transform.localScale = new Vector3(PercentHP, 1, 1);
                    }
                    else
                    {
                        PlayerPrefs.SetInt("E" + i + "-CHP", 0);
                        int   E1Max     = PlayerPrefs.GetInt("E" + i + "-HP");
                        float PercentHP = 0;
                        GameObject.Find("E" + i + "-Hp").transform.localScale = new Vector3(PercentHP, 1, 1);
                        GameObject enemy = GameObject.Find("E" + i);
                        enemy.GetComponent <SpriteRenderer>().color = Color.black;
                        if (PlayerPrefs.GetInt("E1-CHP") <= 0 && PlayerPrefs.GetInt("E2-CHP") <= 0)
                        {
                            //change to map
                            RewardsScreen.RewardDisplay("standard");
                            PlayerPrefs.SetInt("E1-Set", 0);
                            //Application.LoadLevel("Win");
                        }
                        else if (PlayerPrefs.GetInt("E1-CHP") <= 0 && PlayerPrefs.GetString("E2-Name") == "null")
                        {
                            //change to map
                            RewardsScreen.RewardDisplay("standard");
                            PlayerPrefs.SetInt("E1-Set", 0);
                            //Application.LoadLevel("Win");
                        }
                    }
                }
            }
        }
    }
Beispiel #4
0
    public void Damage(int p, int e, int Att, string damageType)
    {
        //accuracyCheck
        int E1CHP         = PlayerPrefs.GetInt("E" + e + "-CHP");
        int E1CG          = PlayerPrefs.GetInt("E" + e + "-CG");
        int accuracyCheck = UnityEngine.Random.Range(1, 101);

        if (PlayerPrefs.GetInt("P" + p + "-Accuracy") - PlayerPrefs.GetInt("E" + e + "-Dodge") < accuracyCheck)
        {
            Miss(e);
        }
        else
        {
            StartCoroutine(Animation(damageType));
            if (PlayerPrefs.GetString("E" + e + "-Weakness1") == damageType || PlayerPrefs.GetString("E" + e + "-Weakness2") == damageType)
            {
                Att = (int)Math.Round((float)Att * 1.5, 1);
            }
            if (PlayerPrefs.GetString("E" + e + "-Resistance1") == damageType || PlayerPrefs.GetString("E" + e + "-Resistance2") == damageType || PlayerPrefs.GetString("E" + e + "-Resistance3") == damageType)
            {
                Att = (int)Math.Round((float)Att * 0.75, 1);
            }
            int critCheck = UnityEngine.Random.Range(1, 101);
            if (PlayerPrefs.GetInt("P" + p + "-CritRate") > critCheck)
            {
                Att = (int)Math.Round((float)Att * 1.5, 1);
                Crit(e);
            }
            if (damageType == "Fire")
            {
                for (int status = 0; status <= 3; status++)
                {
                    if (PlayerPrefs.GetString("P" + p + "Status" + status) == "firestorm")
                    {
                        Att = 2 * Att;
                    }
                }
                SpecialCharge(p, Att, "Flamebearer");
            }
            if (PlayerPrefs.GetString("E" + e + "Status0") == "steadfast" || PlayerPrefs.GetString("E" + e + "Status1") == "steadfast" || PlayerPrefs.GetString("E" + e + "Status2") == "steadfast" || PlayerPrefs.GetString("E" + e + "Status3") == "steadfast")
            {
                E1CG -= Att;
            }
            else if (PlayerPrefs.GetString("E" + e + "Status0") == "vulnerable" || PlayerPrefs.GetString("E" + e + "Status1") == "vulnerable" || PlayerPrefs.GetString("E" + e + "Status2") == "vulnerable" || PlayerPrefs.GetString("E" + e + "Status3") == "vulnerable")
            {
                E1CHP -= Att;
            }
            else
            {
                E1CG  = E1CG - ((Att / 2) + (Att % 2));
                E1CHP = E1CHP - Att / 2;
            }
            if (E1CG < 0)
            {
                E1CHP = E1CHP + E1CG;
                E1CG  = 0;
            }
            GameObject GBar = GameObject.Find("E" + e + "-Guard");
            PlayerPrefs.SetInt("E" + e + "-CG", E1CG);
            int   E1MaxG   = PlayerPrefs.GetInt("E" + e + "-Guard");
            float PercentG = ((float)E1CG / (float)E1MaxG);
            GBar.gameObject.transform.localScale = new Vector3(PercentG, 1, 1);
            GameObject Bar = GameObject.Find("E" + e + "-Hp");
            if (E1CHP > 0)
            {
                PlayerPrefs.SetInt("E" + e + "-CHP", E1CHP);
                int   E1Max     = PlayerPrefs.GetInt("E" + e + "-HP");
                float PercentHP = ((float)E1CHP / (float)E1Max);
                Bar.gameObject.transform.localScale = new Vector3(PercentHP, 1, 1);
            }
            else
            {
                PlayerPrefs.SetInt("E" + e + "-CHP", 0);
                int   E1Max     = PlayerPrefs.GetInt("E" + e + "-HP");
                float PercentHP = 0;
                Bar.gameObject.transform.localScale = new Vector3(PercentHP, 1, 1);
                GameObject enemy = GameObject.Find("E" + e);
                enemy.GetComponent <SpriteRenderer>().color = Color.black;
                if (PlayerPrefs.GetInt("E1-CHP") <= 0 && PlayerPrefs.GetInt("E2-CHP") <= 0)
                {
                    //change to map
                    RewardsScreen.RewardDisplay("standard");
                    PlayerPrefs.SetInt("E1-Set", 0);
                    //Application.LoadLevel("Win");
                }
                else if (PlayerPrefs.GetInt("E1-CHP") <= 0 && PlayerPrefs.GetString("E2-Name") == "null")
                {
                    //change to map
                    RewardsScreen.RewardDisplay("standard");
                    PlayerPrefs.SetInt("E1-Set", 0);
                    //Application.LoadLevel("Win");
                }
            }
        }
    }