Example #1
0
        internal static void SubmitWord()
        {
            string s = GetCurrentWord().ToLower();

            if (EngLetterScoring.IsWord(s))
            {
                ScoreStats ss = RecordWordScore();
                RemoveWordAndReplaceTiles();

                Deselect(null);
                boardScript.ResetSubmitButton();

                bool gameOver = ProcessLetters();
                if (gameOver)
                {
                    RemoveGameBoard();

                    //SaveStats();
                    Resume = false;
                    boardScript.EndGanme();

                    //ResetSavedGame();
                }
                else
                {
                    if (ss.MannaScore > 0)
                    {
                        //ScoreFlash.Foreground = WordWarLogic.GetFortuneColor(WordWarLogic.ScoreWord());
                        //ScoreFlash.Text = "Manna +" + ss.MannaScore;
                        //await BeginAsync(ScoreMotionSmall);
                    }

                    if (ss.bonus > 0)
                    {
                        //ScoreFlash.Foreground = WordWarLogic.GetFortuneColor(WordWarLogic.ScoreWord());
                        //ScoreFlash.Text = "Bonus +" + ss.bonus;
                        //await BeginAsync(ScoreMotionSmall);
                    }

                    if (ss.si != null)
                    {
                        boardScript.ShowMsg("Nice word, you've earned a " + ss.si.FriendlyName + " spell.");
                    }

                    TurnOver();

                    if (CheckNextLevel(totalScore))
                    {
                        boardScript.LevelSound();
                        string levelmsg = "Welcom to Level " + CurrentLevel.ToString() + "\n\n";
                        if (Spells.HasSpells())
                        {
                            levelmsg += "You have new spells";
                        }

                        boardScript.ShowMsg(levelmsg);
                    }


                    boardScript.ScoreWordSound();
                }
            }
            else
            {
                Deselect(null);

                //CurrentWord.Text = "Not a known word.  Try again";
            }
        }
Example #2
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);
        }
Example #3
0
        public static void LetterClick(int i, int j)
        {
            LetterProp lp = LetterPropGrid[i, j];

            //LetterTipPopup.IsOpen = false;

            if (NextSpell != null)
            {
                SpellInfo.SpellOut so = CastSpell(NextSpell, lp);

                if (so.si == null && so.worked)
                {
                    if (freeSpell)
                    {
                        Spells.RemoveFoundSpell(NextSpell);
                    }
                    else
                    {
                        ChangeManna(-NextSpell.MannaPoints);
                    }
                }
                NextSpell = so.si;
            }
            else
            {
                if (SelLetterList.Count >= 0)
                {
                    //string curword = GetCurrentWord().ToLower();
                    // Check if button is adject to the last
                    if (!(IsLetterAdjacentToLastButton(lp) && !SelLetterList.Contains(lp)))
                    {
                        // Deselect except for the one you just clicked.
                        if (!Deselect(lp))
                        {
                            lp.SelectorObject = boardScript.SelectLet(lp.I, lp.J);
                            //lp.SetSelected(true);
                        }
                    }
                    else
                    {
                        //lp.SetSelected(true);
                        lp.SelectorObject = boardScript.SelectLet(lp.I, lp.J);
                    }

                    SelLetterList.Add(lp);

                    boardScript.SetCurrentWord(GetCurrentWord() + "\n" + GetWordTally());

                    // add if for > 3 letters
                    //CurrentWord.Text = GetWordTally();

                    // if it's a word, update color to green
                    if (SelLetterList.Count > 2 && EngLetterScoring.IsWord(GetCurrentWord()))
                    {
                        boardScript.IndicateGoodWord(true);

                        // if it's a word, remember it.
                        AddToTryList();
                    }
                    else
                    {
                        boardScript.IndicateGoodWord(false);
                    }
                }
            }
        }