void OnEnable()
 {
     gold     = false;
     aniDelay = 200;
     tooltip.SetActive(false);
     chimera                  = Chimera.GetInstance();
     passWheelFill            = passWheel.GetComponent <Image>();
     passWheelFill.fillAmount = 0;
     if (chimera.currState == Chimera.MainGameState.CardPick)
     {
         button.SetActive(true);
         float chance = RuneStats.GetInstance().GetRuneChance(Chimera.GetInstance().week, card);
         percentPassFail.SetActive(true);
         percentPassFail.GetComponent <Text>().text = "0%";
         if (chance > 1)
         {
             goldenWheel.SetActive(true);
             gold = true;
             percentPassFail.GetComponent <Text>().text = "100%";
         }
         else
         {
             goldenWheel.SetActive(false);
         }
         passFill = chance;
     }
     else
     {
         button.SetActive(false);
         gold = false;
     }
 }
Exemple #2
0
    // this function will create the main stat this rune will have. this stat is online created at the start
    public void GenerateMainRuneStat()
    {
        if (RuneSlot == 1)
        {
            MainStat = RuneStats.Attack;
            GenerateMainStatNumber();
        }
        else if (RuneSlot == 3)
        {
            MainStat = RuneStats.Health;
            GenerateMainStatNumber();
        }
        else if (RuneSlot == 5)
        {
            MainStat = RuneStats.Defence;
            GenerateMainStatNumber();
        }
        else
        {
            MainStat = (RuneStats)Random.Range(0, 10);
            if ((int)MainStat >= 4) // this is for the stats that are percentage
            {
                GenerateMainStatNumberPercentage();
            }
            else if ((int)MainStat <= 3) // this is for the stats that are non percentage
            {
                GenerateMainRuneStat();
            }
        }

        UpdateStatsType(MainRuneStat, MainStat, 0);
    }
Exemple #3
0
    //this function is called when a upgrade is sucessful. it will select one of the stats an generate a stat randomly
    // this function is specific as its only called when it needs to get a new rune every 3 levels.
    // if there is already a stat in the position it would go in then it will upgrade a current stat
    // if there is no stat in the position that it would go then it will randomly pick a stat and put it there
    // the variable is to determine what stat is bieng generated on the rune
    public void GenerateRuneStat(int StatNumber)
    {
        switch (StatNumber)
        {
        case (1):
        {
            StatsOne    = (RuneStats)Random.Range(0, 7);
            RuneStatOne = Random.Range(0.0f, 5.0f);
            //RuneStatOne = Mathf.Round
            UpdateStatsType(RuneStatOne, StatsOne, StatOneType);
            CurrentRuneStats++;
            break;
        }

        case (2):
        {
            StatsTwo    = (RuneStats)Random.Range(0, 7);
            RuneStatTwo = Random.Range(0.0f, 5.0f);
            UpdateStatsType(RuneStatTwo, StatsTwo, StatTwoType);
            CurrentRuneStats++;
            break;
        }

        case (3):
        {
            StatsThree    = (RuneStats)Random.Range(0, 7);
            RuneStatThree = Random.Range(0.0f, 5.0f);
            UpdateStatsType(RuneStatThree, StatsThree, StatThreeType);
            CurrentRuneStats++;
            break;
        }

        case (4):
        {
            StatsFour    = (RuneStats)Random.Range(0, 7);
            RuneStatFour = Random.Range(0.0f, 5.0f);
            UpdateStatsType(RuneStatFour, StatsFour, StatFourType);
            CurrentRuneStats++;
            break;
        }
        }
    }
Exemple #4
0
    public void nextGameState()
    {
        Save();
        // finish current game state
        switch (currState)
        {
        case MainGameState.Week:
            break;

        case MainGameState.FactionPick:
            // store faction choice
            if (!factionChoices.ContainsKey(faction))
            {
                throw new InvalidOperationException($"Faction {faction} does not exist.");
            }
            factionChoices[faction]++;
            // add runes
            List <Card> newRunes = new List <Card>()
            {
                Spellbook.RandomFromPool(faction),
                Spellbook.RandomFromPool(faction),
            };
            resultsScreen.GetComponent <ResultScreen>().Set(WeekResults.GetInstance().GetWeekTitleResult(week, faction), WeekResults.GetInstance().GetWeekResult(week, faction),
                                                            newRunes, new List <Card>()
            {
            }, false, 0);
            cards.AddRange(cardChooserScreen.GetComponent <RuneChoiceScreen>().AddRunes(newRunes));
            break;

        case MainGameState.WeekResult:
            break;

        case MainGameState.Mastermind:
            break;

        case MainGameState.Weekend:
            break;

        case MainGameState.CardPick:
            string result = "Fail";

            if (forcedResult != "")
            {
                card = Spellbook.RandomCard();
            }


            float chance = RuneStats.GetInstance().GetRuneChance(week, card);
            if (chance == Mathf.Infinity)
            {
                result = "Perfect";
            }
            if (random.NextDouble() < chance)
            {
                result = "Win";
            }
            // spend runes
            resultsScreen.GetComponent <ResultScreen>().Set(WeekendResults.GetInstance().GetWeekendTitleResult(week, result), WeekendResults.GetInstance().GetWeekendResult(week, result),
                                                            new List <Card>()
            {
            },
                                                            new List <Card>()
            {
                card
            },
                                                            result != "Fail", chance);
            break;

        case MainGameState.WeekendResult:
            break;
        }
        // go to next game state
        int nextState = (int)currState + 1;

        if (nextState > gameStateSize)
        {
            week++;
            nextState = 0;
        }
        currState = (MainGameState)nextState;


        if (week == 8)
        {
            //Check to see if at the end
            if (factionChoices["Oxx"] >= week - 3)
            {
                endGame("Oxx", 0);
                currState = MainGameState.Ending;
            }
            else if (factionChoices["Oxx"] >= week - 3)
            {
                endGame("Bark", 1);
                currState = MainGameState.Ending;
            }
            else if (factionChoices["Day"] >= week - 2)
            {
                endGame("Day", 2);
                currState = MainGameState.Ending;
            }
            else if (factionChoices["Night"] >= week - 2)
            {
                endGame("Night", 3);
                currState = MainGameState.Ending;
            }
            else if (factionChoices["Wolf"] >= week - 1)
            {
                endGame("Wolf", 4);
                currState = MainGameState.Ending;
            }
            else if (factionChoices["Deer"] >= week - 1)
            {
                endGame("Deer", 5);
                currState = MainGameState.Ending;
            }
        }

        if (week == 11)
        {
            endGame("Neutral", 6);
            currState = MainGameState.Ending;
        }


        showGameStateScreenUI(currState);
    }
Exemple #5
0
    //this function will be used to update the stats information like the private string used to return the differnt stat types
    // this function will be run at the start of when the rune is created and also when this rune is powered up and the amount of stats on the rune increases
    // params :
    // - the float runestats is the stats that you are checking. each rune has four stats and this float is one of those four stats depending on which stat you are updating
    // - the RuneStats is the stat that you are updating. example. if you are updating the first stat then you would put in stat one
    // - the string parameter is the string that needs to know what type that stat is. so when the type is updated this string is updated to know the type
    // Returns : this returns a string which will update the private string used to determine what type of stats are on the rune
    public string UpdateStatsType(float runestats, RuneStats TheRuneStats, string RuneTypeToUpdate)
    {
        // if a rune stat has a higher value then 0 it means that the stat has been generated allready
        if (runestats > 0)
        {
            switch (TheRuneStats)
            {
            case (RuneStats.Accuracy):
            {
                RuneTypeToUpdate = "Accuracy";

                break;
            }

            case (RuneStats.Attack):
            {
                RuneTypeToUpdate = "Attack";
                break;
            }

            case (RuneStats.CritDamage):
            {
                RuneTypeToUpdate = "CritDamage";
                break;
            }

            case (RuneStats.CritRate):
            {
                RuneTypeToUpdate = "CritRate";
                break;
            }

            case (RuneStats.Defence):
            {
                RuneTypeToUpdate = "Defence";
                break;
            }

            case (RuneStats.Health):
            {
                RuneTypeToUpdate = "Health";
                break;
            }

            case (RuneStats.Resistance):
            {
                RuneTypeToUpdate = "Resistance";
                break;
            }

            case (RuneStats.Speed):
            {
                RuneTypeToUpdate = "Speed";
                break;
            }
            }
        }


        return(RuneTypeToUpdate);
    }
Exemple #6
0
 // this function will create the main stat that this rune will have. this stat is only created at the start
 public void GenerateMainRuneStat()
 {
     MainStat     = (RuneStats)Random.Range(0, 7);
     MainRuneStat = Random.Range(1, 60);
     UpdateStatsType(MainRuneStat, MainStat, MainStatType);
 }
Exemple #7
0
    //this function will be used to update the stats information like the private string used to return the differnt stat types
    // this function will be run at the start of when the rune is created and also when this rune is powered up and the amount of stats on the rune increases
    // params :
    // - the float runestats is the stats that you are checking. each rune has four stats and this float is one of those four stats depending on which stat you are updating
    // - the RuneStats is the stat that you are updating. example. if you are updating the first stat then you would put in stat one
    // - the int determines what stat is bieng updated (0 is main stat and the others are self explanitory
    // Returns : this returns a string which will update the private string used to determine what type of stats are on the rune
    public void UpdateStatsType(float runestats, RuneStats TheRuneStats, int StatsNumber)
    {
        //string TypeToSet = "";

        // if a rune stat has a higher value then 0 it means that the stat has been generated allready
        if (runestats > 0)
        {
            switch (TheRuneStats)
            {
            case (RuneStats.Accuracy):
            {
                switch (StatsNumber)
                {
                case (0):
                {
                    MainStatType = "Accuracy";
                    break;
                }

                case (1):
                {
                    StatOneType = "Accuracy";
                    break;
                }

                case (2):
                {
                    StatTwoType = "Accuracy";
                    break;
                }

                case (3):
                {
                    StatThreeType = "Accuracy";
                    break;
                }

                case (4):
                {
                    StatFourType = "Accuracy";
                    break;
                }
                }

                break;
            }

            case (RuneStats.Attack):
            {
                switch (StatsNumber)
                {
                case (0):
                {
                    MainStatType = "Attack";
                    break;
                }

                case (1):
                {
                    StatOneType = "Attack";
                    break;
                }

                case (2):
                {
                    StatTwoType = "Attack";
                    break;
                }

                case (3):
                {
                    StatThreeType = "Attack";
                    break;
                }

                case (4):
                {
                    StatFourType = "Attack";
                    break;
                }
                }
                break;
            }

            case (RuneStats.CritDamage):
            {
                switch (StatsNumber)
                {
                case (0):
                {
                    MainStatType = "CritDamage";
                    break;
                }

                case (1):
                {
                    StatOneType = "CritDamage";
                    break;
                }

                case (2):
                {
                    StatTwoType = "CritDamage";
                    break;
                }

                case (3):
                {
                    StatThreeType = "CritDamage";
                    break;
                }

                case (4):
                {
                    StatFourType = "CritDamage";
                    break;
                }
                }

                break;
            }

            case (RuneStats.CritRate):
            {
                switch (StatsNumber)
                {
                case (0):
                {
                    MainStatType = "CritRate";
                    break;
                }

                case (1):
                {
                    StatOneType = "CritRate";
                    break;
                }

                case (2):
                {
                    StatTwoType = "CritRate";
                    break;
                }

                case (3):
                {
                    StatThreeType = "CritRate";
                    break;
                }

                case (4):
                {
                    StatFourType = "CritRate";
                    break;
                }
                }

                break;
            }

            case (RuneStats.Defence):
            {
                switch (StatsNumber)
                {
                case (0):
                {
                    MainStatType = "Defence";
                    break;
                }

                case (1):
                {
                    StatOneType = "Defence";
                    break;
                }

                case (2):
                {
                    StatTwoType = "Defence";
                    break;
                }

                case (3):
                {
                    StatThreeType = "Defence";
                    break;
                }

                case (4):
                {
                    StatFourType = "Defence";
                    break;
                }
                }

                break;
            }

            case (RuneStats.Health):
            {
                switch (StatsNumber)
                {
                case (0):
                {
                    MainStatType = "Health";
                    break;
                }

                case (1):
                {
                    StatOneType = "Health";
                    break;
                }

                case (2):
                {
                    StatTwoType = "Health";
                    break;
                }

                case (3):
                {
                    StatThreeType = "Health";
                    break;
                }

                case (4):
                {
                    StatFourType = "Health";
                    break;
                }
                }

                break;
            }

            case (RuneStats.Resistance):
            {
                switch (StatsNumber)
                {
                case (0):
                {
                    MainStatType = "Resistance";
                    break;
                }

                case (1):
                {
                    StatOneType = "Resistance";
                    break;
                }

                case (2):
                {
                    StatTwoType = "Resistance";
                    break;
                }

                case (3):
                {
                    StatThreeType = "Resistance";
                    break;
                }

                case (4):
                {
                    StatFourType = "Resistance";
                    break;
                }
                }

                break;
            }

            case (RuneStats.Speed):
            {
                switch (StatsNumber)
                {
                case (0):
                {
                    MainStatType = "Speed";
                    break;
                }

                case (1):
                {
                    StatOneType = "Speed";
                    break;
                }

                case (2):
                {
                    StatTwoType = "Speed";
                    break;
                }

                case (3):
                {
                    StatThreeType = "Speed";
                    break;
                }

                case (4):
                {
                    StatFourType = "Speed";
                    break;
                }
                }

                break;
            }

            case (RuneStats.AttackPer):
            {
                switch (StatsNumber)
                {
                case (0):
                {
                    MainStatType = "AttackPercentage";
                    break;
                }

                case (1):
                {
                    StatOneType = "AttackPercentage";
                    break;
                }

                case (2):
                {
                    StatTwoType = "AttackPercentage";
                    break;
                }

                case (3):
                {
                    StatThreeType = "AttackPercentage";
                    break;
                }

                case (4):
                {
                    StatFourType = "AttackPercentage";
                    break;
                }
                }

                break;
            }

            case (RuneStats.HealthPer):
            {
                switch (StatsNumber)
                {
                case (0):
                {
                    MainStatType = "HealthPercentage";
                    break;
                }

                case (1):
                {
                    StatOneType = "HealthPercentage";
                    break;
                }

                case (2):
                {
                    StatTwoType = "HealthPercentage";
                    break;
                }

                case (3):
                {
                    StatThreeType = "HealthPercentage";
                    break;
                }

                case (4):
                {
                    StatFourType = "HealthPercentage";
                    break;
                }
                }

                break;
            }

            case (RuneStats.DefencePer):
            {
                switch (StatsNumber)
                {
                case (0):
                {
                    MainStatType = "DefencePercentage";
                    break;
                }

                case (1):
                {
                    StatOneType = "DefencePercentage";
                    break;
                }

                case (2):
                {
                    StatTwoType = "DefencePercentage";
                    break;
                }

                case (3):
                {
                    StatThreeType = "DefencePercentage";
                    break;
                }

                case (4):
                {
                    StatFourType = "DefencePercentage";
                    break;
                }
                }

                break;
            }
            }
        }
    }
Exemple #8
0
    //this function is called when a upgrade is sucessful. it will select one of the stats an generate a stat randomly
    // this function is specific as its only called when it needs to get a new rune every 3 levels.
    // if there is already a stat in the position it would go in then it will upgrade a current stat
    // if there is no stat in the position that it would go then it will randomly pick a stat and put it there
    // the variable is to determine what stat is bieng generated on the rune
    public void GenerateRuneStat(int StatNumber)
    {
        switch (StatNumber)
        {
        case (1):
        {
            StatsOne = (RuneStats)Random.Range(0, 10);

            if ((int)StatsOne >= 4)         // this is for the stats that are percentage
            {
                RuneStatOne = Random.Range(1, 5);
            }
            else if ((int)StatsOne <= 3)         // this is for the stats that are non percentage
            {
                RuneStatOne = Random.Range(10, 30);
            }
            UpdateStatsType(RuneStatOne, StatsOne, 1);
            CurrentRuneStats++;
            break;
        }

        case (2):
        {
            StatsTwo = (RuneStats)Random.Range(0, 10);

            if ((int)StatsTwo >= 4)         // this is for the stats that are percentage
            {
                RuneStatTwo = Random.Range(1, 5);
            }
            else if ((int)StatsTwo <= 3)         // this is for the stats that are non percentage
            {
                RuneStatTwo = Random.Range(10, 30);
            }

            UpdateStatsType(RuneStatTwo, StatsTwo, 2);
            CurrentRuneStats++;
            break;
        }

        case (3):
        {
            StatsThree = (RuneStats)Random.Range(0, 10);

            if ((int)StatsThree >= 4)         // this is for the stats that are percentage
            {
                RuneStatThree = Random.Range(1, 5);
            }
            else if ((int)StatsThree <= 3)         // this is for the stats that are non percentage
            {
                RuneStatThree = Random.Range(10, 30);
            }

            UpdateStatsType(RuneStatThree, StatsThree, 3);
            CurrentRuneStats++;
            break;
        }

        case (4):
        {
            StatsFour = (RuneStats)Random.Range(0, 10);

            if ((int)StatsFour >= 4)         // this is for the stats that are percentage
            {
                RuneStatFour = Random.Range(1, 5);
            }
            else if ((int)StatsFour <= 3)         // this is for the stats that are non percentage
            {
                RuneStatFour = Random.Range(10, 30);
            }

            UpdateStatsType(RuneStatFour, StatsFour, 4);
            CurrentRuneStats++;
            break;
        }
        }
    }