예제 #1
0
 public SpellAllowed DeepCopy()
 {
     SpellAllowed copy = new SpellAllowed();
     copy.name = this.name;
     copy.tag = this.tag;
     copy.atWhatLevelIsAvailable = this.atWhatLevelIsAvailable;
     copy.automaticallyLearned = this.automaticallyLearned;
     copy.allow = this.allow;
     return copy;
 }
예제 #2
0
        public int getLevelAvailable(String tag)
        {
            SpellAllowed sa = getCastingPlayer().playerClass.getSpellAllowedByTag(tag);

            if (sa != null)
            {
                return(sa.atWhatLevelIsAvailable);
            }
            return(0);
        }
예제 #3
0
        public SpellAllowed DeepCopy()
        {
            SpellAllowed copy = new SpellAllowed();

            copy.needsSpecificTrainingToLearn = this.needsSpecificTrainingToLearn;
            copy.name = this.name;
            copy.tag  = this.tag;
            copy.atWhatLevelIsAvailable = this.atWhatLevelIsAvailable;
            copy.automaticallyLearned   = this.automaticallyLearned;
            copy.allow = this.allow;
            return(copy);
        }
예제 #4
0
        public bool hasSpellAlready(SpellAllowed sa)
        {
            /*
             * foreach (string s in this.knownSpellsTags)
             * {
             *  if (sa.tag.Equals(s))
             *  {
             *      return true;
             *  }
             * }
             */
            if (this.knownSpellsTags.Contains(sa.tag))
            {
                return(true);
            }
            if (this.learningSpellsTags.Contains(sa.tag))
            {
                return(true);
            }

            return(false);
        }
예제 #5
0
        public void sortTraitsForLevelUp(Player pc)
        {
            //clear
            backupKnownSpellTagsInCombat.Clear();
            backupKnownSpellTagsOutsideCombat.Clear();

            List <string>       spellsForLearningTags = new List <string>();
            List <SpellAllowed> spellsForLearning     = new List <SpellAllowed>();

            if (!isInCombat)
            {
                SpellAllowed tempSA = new SpellAllowed();

                //add the known outside battle useable traits
                foreach (string s in pc.knownSpellsTags)
                {
                    foreach (Spell sp in gv.mod.moduleSpellsList)
                    {
                        if (sp.tag == s)
                        {
                            if (sp.useableInSituation.Equals("Always") || sp.useableInSituation.Equals("OutOfCombat"))
                            {
                                spellsForLearningTags.Add(s);
                            }
                        }
                    }
                }

                //sort the known outside battle useable spells
                int levelCounter = 0;
                while (spellsForLearningTags.Count > 0)
                {
                    for (int i = spellsForLearningTags.Count - 1; i >= 0; i--)
                    {
                        foreach (SpellAllowed sa in pc.playerClass.spellsAllowed)
                        {
                            if (sa.tag == spellsForLearningTags[i])
                            {
                                tempSA = sa.DeepCopy();
                                break;
                            }
                        }
                        if (levelCounter == tempSA.atWhatLevelIsAvailable)
                        {
                            backupKnownSpellTagsOutsideCombat.Add(spellsForLearningTags[i]);
                            spellsForLearningTags.RemoveAt(i);
                        }
                    }
                    levelCounter++;
                }
            }
            //inside combat
            else
            {
                SpellAllowed tempSA = new SpellAllowed();

                //add the known in battle useable traits
                foreach (string s in pc.knownSpellsTags)
                {
                    foreach (Spell sp in gv.mod.moduleSpellsList)
                    {
                        if (sp.tag == s)
                        {
                            if (sp.useableInSituation.Equals("Always") || sp.useableInSituation.Equals("InCombat"))
                            {
                                spellsForLearningTags.Add(s);
                            }
                        }
                    }
                }

                //sort the known inside battle useable spells
                int levelCounter = 0;
                while (spellsForLearningTags.Count > 0)
                {
                    for (int i = spellsForLearningTags.Count - 1; i >= 0; i--)
                    {
                        foreach (SpellAllowed sa in pc.playerClass.spellsAllowed)
                        {
                            if (sa.tag == spellsForLearningTags[i])
                            {
                                tempSA = sa.DeepCopy();
                                break;
                            }
                        }
                        if (levelCounter == tempSA.atWhatLevelIsAvailable)
                        {
                            backupKnownSpellTagsInCombat.Add(spellsForLearningTags[i]);
                            spellsForLearningTags.RemoveAt(i);
                        }
                    }
                    levelCounter++;
                }
            }
        }