Example #1
0
        internal static ScoreStats RecordWordScore()
        {
            ScoreStats ss = new ScoreStats();

            int wordTotal = ScoreWord();

            //HistoryList.Items.Insert(0, GetWordTally());
            boardScript.AddHistory(GetCurrentWord() + " " + GetWordTally());

            totalScore += wordTotal;
            if (wordTotal > HighScoreWordValue)
            {
                HighScoreWordValue = wordTotal;
                HighScoreWord      = GetCurrentWord();
                HighScoreWordTally = EngLetterScoring.GetWordTally(SelLetterList);
            }

            WordScoreItem wsi = new WordScoreItem()
            {
                word = GetCurrentWord(), score = wordTotal, wordscorestring = EngLetterScoring.GetWordTally(SelLetterList), simplescore = ScoreWordSimple()
            };

            ss.bonus = EngLetterScoring.LengthBonus(wsi.word);

            FortuneWordScoreHistory.Add(wsi);
            if (FortuneWordScoreHistory.Count > EffWordCount)
            {
                FortuneWordScoreHistory.RemoveAt(0);
            }

            HistoryWords.Add(wsi);

            CheckTopBestWordScores(wsi);
            CheckTopBestWordScoresSimple(wsi);
            CheckTopLongestWordScores(wsi);

            totalwords++;

            TotalEfficiency = totalScore / totalwords;
            Efficiency      = GetLatestEff();

            if (GetFortune() == FortuneLevel.Great)
            {
                FortuneLevelCount++;
            }
            else
            {
                FortuneLevelCount = 0;
            }

            if (FortuneLevelCount > 4)
            {
                Manna += (FortuneLevelCount - 4);
            }
            ss.MannaScore = ScoreManna();

            // If it's a big or price word, give them a spell based on the word.
            string curword = GetCurrentWord();

            if (wordTotal > 14 || curword.Length >= 8)
            {
                SpellInfo si = null;

                if (wordTotal > 70 || curword.Length > 16)
                {
                    si = Spells.GetSpell(6, level);
                }
                else if (wordTotal > 55 || curword.Length > 15)
                {
                    si = Spells.GetSpell(5, level);
                }
                else if (wordTotal > 45 || curword.Length > 14)
                {
                    si = Spells.GetSpell(4, level);
                }
                else if (wordTotal > 35 || curword.Length > 13)
                {
                    si = Spells.GetSpell(3, level);
                }
                else if (wordTotal > 25 || curword.Length > 11)
                {
                    si = Spells.GetSpell(2, level);
                }
                else if (wordTotal > 17 || curword.Length > 9)
                {
                    si = Spells.GetSpell(1, level);
                }
                else if (wordTotal > 14 || curword.Length >= 8)
                {
                    si = Spells.GetSpell(0, level);
                }

                ss.si = si;
            }

            UpdateFortune();

            UpdateStats();

            return(ss);
        }