Пример #1
0
        public void FromJSObject(JSObject obj)
        {
            id                    = ++CreatureIdCounter;
            name                  = JSObjectHelper.GetString(obj, "name", "<Default Name>");
            team                  = JSObjectHelper.GetString(obj, "team", "good");
            maxHitPoints          = JSObjectHelper.GetInt(obj, "maxHitPoints", 1);
            baseStrengthScore     = JSObjectHelper.GetInt(obj, "baseStrengthScore", 1);
            baseDexterityScore    = JSObjectHelper.GetInt(obj, "baseDexterityScore", 1);
            baseConstitutionScore = JSObjectHelper.GetInt(obj, "baseConstitutionScore", 1);
            baseIntelligenceScore = JSObjectHelper.GetInt(obj, "baseIntelligenceScore", 1);
            baseWisdomScore       = JSObjectHelper.GetInt(obj, "baseWisdomScore", 1);
            baseCharismaScore     = JSObjectHelper.GetInt(obj, "baseCharismaScore", 1);
            baseArmorClass        = JSObjectHelper.GetInt(obj, "baseArmorClass", 1);

            string[] resistences = JSObjectHelper.GetString(obj, "resistences", "").Split(',');

            if (resistences.Length >= 1 && !resistences[0].Equals(""))
            {
                for (int i = 0; i < resistences.Length; i++)
                {
                    DamageTypes damageType;
                    if (Enum.TryParse <DamageTypes>(resistences[i], out damageType))
                    {
                        this.resistences.Add(damageType);
                    }
                }
            }

            string[] immunities = JSObjectHelper.GetString(obj, "immunities", "").Split(',');

            if (immunities.Length >= 1 && !immunities[0].Equals(""))
            {
                for (int i = 0; i < immunities.Length; i++)
                {
                    DamageTypes damageType;
                    if (Enum.TryParse <DamageTypes>(immunities[i], out damageType))
                    {
                        this.immunities.Add(damageType);
                    }
                }
            }

            string[] weaknesses = JSObjectHelper.GetString(obj, "weaknesses", "").Split(',');

            if (weaknesses.Length >= 1 && !weaknesses[0].Equals(""))
            {
                for (int i = 0; i < weaknesses.Length; i++)
                {
                    DamageTypes damageType;
                    if (Enum.TryParse <DamageTypes>(weaknesses[i], out damageType))
                    {
                        this.weaknesses.Add(damageType);
                    }
                }
            }
        }
Пример #2
0
 public void FromJSObject(JSObject obj)
 {
     name = JSObjectHelper.GetString(obj, "name", "<Default Name>");
     strengthAbilityBonus     = JSObjectHelper.GetInt(obj, "strengthAbilityBonus", 0);
     constitutionAbilityBonus = JSObjectHelper.GetInt(obj, "constitutionAbilityBonus", 0);
     dexterityAbilityBonus    = JSObjectHelper.GetInt(obj, "dexterityAbilityBonus", 0);
     wisdomAbilityBonus       = JSObjectHelper.GetInt(obj, "wisdomAbilityBonus", 0);
     intelligenceAbilityBonus = JSObjectHelper.GetInt(obj, "intelligenceAbilityBonus", 0);
     charismaAbilityBonus     = JSObjectHelper.GetInt(obj, "charismaAbilityBonus", 0);
 }
Пример #3
0
 public void FromJSObject(JSObject obj)
 {
     name                = JSObjectHelper.GetString(obj, "name", "<Default Name>");
     level               = JSObjectHelper.GetInt(obj, "level", 0);
     duration            = JSObjectHelper.GetInt(obj, "duration", 1);
     combatSpell         = JSObjectHelper.GetBool(obj, "combatSpell", false);
     good                = JSObjectHelper.GetBool(obj, "good", false);
     castHigherLevel     = JSObjectHelper.GetBool(obj, "castHigherLevel", false);
     maxTargets          = JSObjectHelper.GetInt(obj, "maxTargets", 1);
     minTargets          = JSObjectHelper.GetInt(obj, "minTargets", 1);
     damage              = JSObjectHelper.GetString(obj, "damage", "0");
     extraDamagePerLevel = JSObjectHelper.GetString(obj, "extraDamagePerLevel", "0");
 }