コード例 #1
0
 public void UseSpellSlot(Magic.Level _level)
 {
     if (HaveSpellSlot(_level))
     {
         SpellsLeft[_level]--;
     }
 }
コード例 #2
0
 public bool HaveSpellSlot(Magic.Level _level)
 {
     // return true if the spellcaster has a spell slot of the specified level or higher
     foreach (KeyValuePair <Magic.Level, int> level_spells in SpellsLeft.Where(sl => (int)sl.Key >= (int)_level))
     {
         if (level_spells.Value > 0)
         {
             return(true);
         }
     }
     return(false);
 }