public OSRICCharacterModifier(OSRIC_CHARACTER_VARIABLES _charVariable, OSRIC_ATTRIBUTES _attribute,
								OSRIC_ATTRIBUTE_MODIFIER_TYPE _type,  int _value)
    {
        this.characterVariable = _charVariable;
        this.attribute = _attribute;
        this.type = _type;
        this.name = "unkown";
        this.value = _value;
    }
    public List<OSRICCharacterModifier> GetModifierByAttribute(OSRIC_ATTRIBUTES oa)
    {
        List<OSRICCharacterModifier> retList = new List<OSRICCharacterModifier>();

        foreach(OSRICCharacterModifier ocm in ModifierList)
        {
            if(ocm.characterVariable == OSRIC_CHARACTER_VARIABLES.attribute
                && ocm.attribute == oa)
                retList.Add(ocm);
        }
        return retList;
    }
 public OSRICCharacterModifier(JSONObject obj)
 {
     attribute = OSRICConstants.GetEnum<OSRIC_ATTRIBUTES>(obj["attribute"].str);
     type = OSRICConstants.GetEnum<OSRIC_ATTRIBUTE_MODIFIER_TYPE>(obj["type"].str);
     characterVariable = OSRICConstants.GetEnum<OSRIC_CHARACTER_VARIABLES>
         (obj["characterVariable"].str);
     savingThrow = OSRICConstants.GetEnum<OSRIC_SAVING_THROWS>(obj["savingThrow"].str);
     name = obj["name"].str;
     description = obj["description"].str;
     value = (int)obj["value"].n;
     duration = (int)obj["duration"].n;
 }
    string GetAttributeAdjustments(OSRIC_ATTRIBUTES oa, int val)
    {
        string retStr="";
        AttributeAdjustment[] attCollector;
        if(val<1)
            return retStr;
        switch(oa)
        {
        case OSRIC_ATTRIBUTES.Strength:
            attCollector = engine.GetStrengthAdjustments(val);
            break;
        case OSRIC_ATTRIBUTES.Dexterity:
            attCollector = engine.GetDexterityAdjustments(val);
            break;
        case OSRIC_ATTRIBUTES.Constitution:
            attCollector = engine.GetConstitutionAdjustments(val);
            break;
        case OSRIC_ATTRIBUTES.Intellegence:
            attCollector = engine.GetIntelligenceAdjustments(val);
            break;
        case OSRIC_ATTRIBUTES.Wisdom:
            attCollector = engine.GetWisdomAdjustments(val);
            break;
        case OSRIC_ATTRIBUTES.Charisma:
            attCollector = engine.GetCharismaAdjustments(val);
            break;
        default:
            attCollector = new AttributeAdjustment[0];
            break;
        }
        if(attCollector.Length>0)
        {
            retStr = attCollector[0].title + ": " + attCollector[0].adjustment;
            for(int i=1;i<attCollector.Length;i++)
                retStr += " " + attCollector[i].title + ": " + attCollector[i].adjustment;

        }
        return retStr;
    }
Пример #5
0
    public void SetBaseAttribute(OSRIC_ATTRIBUTES oa, int val)
    {
        switch(oa)
        {
        case OSRIC_ATTRIBUTES.Strength:
        {
            Str = val;
            break;
        }
        case OSRIC_ATTRIBUTES.Dexterity:
        {
            Dex = val;
            break;
        }
        case OSRIC_ATTRIBUTES.Constitution:
        {
            Con = val;
            break;
        }
        case OSRIC_ATTRIBUTES.Intellegence:
        {
            Int = val;
            break;
        }
        case OSRIC_ATTRIBUTES.Wisdom:
        {
            Wis = val;
            break;
        }
        case OSRIC_ATTRIBUTES.Charisma:
        {
            Cha = val;
            break;
        }
        default:
            return;
        }

        BroadcastBaseAttributeDidChange ();
        BroadcastAttributeModelDidChange ();
    }
Пример #6
0
 public int GetBaseAttribute(OSRIC_ATTRIBUTES oa)
 {
     switch(oa)
     {
     case OSRIC_ATTRIBUTES.Strength:
         return Str;
     case OSRIC_ATTRIBUTES.Dexterity:
         return Dex;
     case OSRIC_ATTRIBUTES.Constitution:
         return Con;
     case OSRIC_ATTRIBUTES.Intellegence:
         return Int;
     case OSRIC_ATTRIBUTES.Wisdom:
         return Wis;
     case OSRIC_ATTRIBUTES.Charisma:
         return Cha;
     default:
         return -1;
     }
 }
Пример #7
0
 public int GetAttributeTotal(OSRIC_ATTRIBUTES oa)
 {
     switch(oa)
     {
     case OSRIC_ATTRIBUTES.Strength:
         return this.StrTotal();
     case OSRIC_ATTRIBUTES.Dexterity:
         return this.DexTotal();
     case OSRIC_ATTRIBUTES.Constitution:
         return this.ConTotal();
     case OSRIC_ATTRIBUTES.Intellegence:
         return this.IntTotal();
     case OSRIC_ATTRIBUTES.Wisdom:
         return this.WisTotal();
     case OSRIC_ATTRIBUTES.Charisma:
         return this.ChaTotal();
     default:
         return -1;
     }
 }