Example #1
0
        internal static void ReadySpell(SpellInfo selectedSpell, bool _freespell)
        {
            freeSpell = _freespell;
            if (selectedSpell.Immediate)
            {
                SpellInfo.SpellOut so;

                so = CastSpell(selectedSpell, null);
                if (freeSpell && so.worked)
                {
                    Spells.RemoveFoundSpell(selectedSpell);
                    freeSpell = false;
                }
                else
                {
                    ChangeManna(-selectedSpell.MannaPoints);
                }
            }
            else
            {
                //CastSpell(selectedSpell, null, NextSpell);
                NextSpell = selectedSpell;
            }
        }
Example #2
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);
                    }
                }
            }
        }