Ejemplo n.º 1
0
 public DnDWizard(DnDCharacter character, DnDMagicSchool specialization, List <DnDMagicSchool> forbiddenSchools, int level = 1) : base(character)
 {
     Init();
     mSpecialization   = specialization;
     mForbiddenSchools = forbiddenSchools;
     mClassLevel       = level;
 }
Ejemplo n.º 2
0
		public DnDWizard(DnDCharacter character, DnDMagicSchool specialization, List<DnDMagicSchool> forbiddenSchools, int level = 1) : base(character)
		{
			Init();
			mSpecialization = specialization;
			mForbiddenSchools = forbiddenSchools;
			mClassLevel = level;
		}
Ejemplo n.º 3
0
        public void InitiateSpell(JSONObject spellObject)
        {
            mName   = spellObject.GetString("name");
            mSchool = (DnDMagicSchool)spellObject.GetNumber("school");
            JSONArray classes = spellObject.GetArray("classes");

            foreach (var val in classes)
            {
                SpellAttribute attribute = new SpellAttribute();
                attribute.attribute      = SpellAttributeType.Class;
                attribute.attributeValue = (int)val.Obj.GetNumber("class");
                attribute.rank           = (int)val.Obj.GetNumber("rank");
                mClasses.Add(attribute);
            }
            JSONArray domains = spellObject.GetArray("domains");

            foreach (var val in domains)
            {
                SpellAttribute attribute = new SpellAttribute();
                attribute.attribute      = SpellAttributeType.Domain;
                attribute.attributeValue = (int)val.Obj.GetNumber("domain");
                attribute.rank           = (int)val.Obj.GetNumber("rank");
                mDomains.Add(attribute);
            }
        }
Ejemplo n.º 4
0
	public List<Spell> GetWizardSchoolSpecializationSpells(DnDMagicSchool school, int rank)
	{
		ListCheck();
		List<Spell> result = mSpells.FindAll(
			delegate(Spell temp)
			{
				return temp.Contains(school, DnDCharClass.Wizard, rank);
			});
		return result;
	}
Ejemplo n.º 5
0
        public List <Spell> GetWizardSchoolSpecializationSpells(DnDMagicSchool school, int rank)
        {
            ListCheck();
            List <Spell> result = mSpells.FindAll(
                delegate(Spell temp)
            {
                return(temp.Contains(school, DnDCharClass.Wizard, rank));
            });

            return(result);
        }
Ejemplo n.º 6
0
 public bool Contains(DnDMagicSchool school, DnDCharClass cclass, int rank)
 {
     foreach (SpellAttribute attribute in mClasses)
     {
         if (attribute.attributeValue == (int)cclass && attribute.rank == rank)
         {
             return(mSchool == school);
         }
     }
     return(false);
 }
Ejemplo n.º 7
0
 public void Deserialize(JSONObject obj)
 {
     mName    = obj.GetString("name");
     mSchool  = (DnDMagicSchool)obj.GetNumber("school");
     mClasses = new List <SpellAttribute>();
     foreach (var value in obj.GetArray("classes"))
     {
         SpellAttribute tempAttribute = new SpellAttribute();
         tempAttribute.attribute      = SpellAttributeType.Class;
         tempAttribute.attributeValue = (int)value.Obj.GetNumber("class");
         tempAttribute.rank           = (int)value.Obj.GetNumber("rank");
         mClasses.Add(tempAttribute);
     }
     mDomains = new List <SpellAttribute>();
     foreach (var value in obj.GetArray("domains"))
     {
         SpellAttribute tempAttribute = new SpellAttribute();
         tempAttribute.attribute      = SpellAttributeType.Domain;
         tempAttribute.attributeValue = (int)value.Obj.GetNumber("domain");
         tempAttribute.rank           = (int)value.Obj.GetNumber("rank");
         mClasses.Add(tempAttribute);
     }
 }
Ejemplo n.º 8
0
        public override void Deserialize(JSONObject obj)
        {
            mClassLevel = (int)obj.GetNumber(LEVEL);
            DeserializeKnownSpells(obj);
            DeserializeMainSpells(obj);
            DeserializeExtraSpells(obj);
            mSkills = new DnDSkillModel();
            mSkills.Deserialize(obj.GetObject(SKILLS));
            // spec:
            JSONArray tempArray = obj.GetArray(SPECIALIZATION);

            for (int i = 0; i < tempArray.Length; ++i)
            {
                if (i == 0)                 // first item is the specialization
                {
                    mSpecialization = (DnDMagicSchool)((int)tempArray[i].Number);
                }
                else                 // the other items are the forbidden schools
                {
                    mForbiddenSchools.Add((DnDMagicSchool)((int)tempArray[i].Number));
                }
            }
        }
Ejemplo n.º 9
0
		public override void Deserialize(JSONObject obj)
		{
			mClassLevel = (int)obj.GetNumber(LEVEL);
			DeserializeKnownSpells(obj);
			DeserializeMainSpells(obj);
			DeserializeExtraSpells(obj);
			mSkills = new DnDSkillModel();
			mSkills.Deserialize(obj.GetObject(SKILLS));
			// spec:
			JSONArray tempArray = obj.GetArray(SPECIALIZATION);
			for (int i = 0; i < tempArray.Length; ++i)
			{
				if (i == 0) // first item is the specialization
				{
					mSpecialization = (DnDMagicSchool)((int)tempArray[i].Number);
				}
				else // the other items are the forbidden schools
				{
					mForbiddenSchools.Add((DnDMagicSchool)((int)tempArray[i].Number));
				}
			}
		}
Ejemplo n.º 10
0
 public bool Contains(DnDMagicSchool school)
 {
     return(mSchool == school);
 }