public PrepareSpells(PlayScreen playScreen, Character character)
        {
            InitializeComponent();

            spellPrepIds = new List <int>();
            db           = new DbHandler();
            this.play    = playScreen;
            this.c       = character;

            knownSpells = c.GetKnownSpells();
            SpellPrepControl prep;

            foreach (Spell s in knownSpells)
            {
                s.SetPrepared(false);
                // Not adding cantrips, for they are always prepared.
                if (s.GetLevel() > 0)
                {
                    prep = new SpellPrepControl(s);
                    stackSpells.Children.Add(prep);
                }
            }

            int totalSpells = c.GetModifier(c.GetSpellMod()) + c.GetLevel();

            if (totalSpells < 1)
            {
                totalSpells = 1;
            }

            lbPrep.Content = "Preparable Spells: " + totalSpells;
        }
Exemplo n.º 2
0
        public void UpdateSpells()
        {
            panelSpells.Children.Clear();
            spells.Sort((x, y) => x.GetLevel().CompareTo(y.GetLevel()));

            foreach (Spell s in spells)
            {
                SpellPrepControl pSpells = new SpellPrepControl(s);
                panelSpells.Children.Add(pSpells);
            }
        }