public void Add(OSRICCharacterModifier candidate)
    {
        foreach(OSRICCharacterModifier ocm in ModifierList)
            if(ocm.Equals(candidate))
                return;

        ModifierList.Add(candidate);
    }
    //we could make this more generic and call it AddBaseAttributeModifier and store it all one list
    public void AddRacialModifier(OSRICCharacterModifier modifier)
    {
        CharacterModifiers.Add (modifier);

        BroadcastRacialAttributeDidChange ();
        BroadcastAttributeModelDidChange ();
    }
Example #3
0
    public static void AddRaceAdjustments(OSRICAttributeModel oam, OSRIC_RACE newOR)
    {
        List<OSRICCharacterModifier> accumulator = new List<OSRICCharacterModifier>();
        OSRICCharacterModifier tempMod;

        switch(newOR)
        {
        case OSRIC_RACE.Dwarf:
            tempMod = new OSRICCharacterModifier(OSRIC_CHARACTER_VARIABLES.attribute,
                OSRIC_ATTRIBUTES.Constitution, OSRIC_ATTRIBUTE_MODIFIER_TYPE.Racial, 1);
            accumulator.Add(tempMod);
            tempMod = new OSRICCharacterModifier(OSRIC_CHARACTER_VARIABLES.attribute,
                OSRIC_ATTRIBUTES.Charisma, OSRIC_ATTRIBUTE_MODIFIER_TYPE.Racial, -1);
            accumulator.Add(tempMod);
            break;
        case OSRIC_RACE.Elf:
            tempMod = new OSRICCharacterModifier(OSRIC_CHARACTER_VARIABLES.attribute,
                OSRIC_ATTRIBUTES.Dexterity, OSRIC_ATTRIBUTE_MODIFIER_TYPE.Racial, 1);
            accumulator.Add(tempMod);
            tempMod = new OSRICCharacterModifier(OSRIC_CHARACTER_VARIABLES.attribute,
                OSRIC_ATTRIBUTES.Constitution, OSRIC_ATTRIBUTE_MODIFIER_TYPE.Racial, -1);
            accumulator.Add(tempMod);
            break;
        case OSRIC_RACE.Gnome:
            break;
        case OSRIC_RACE.HalfElf:
            break;
        case OSRIC_RACE.Halfling:
            tempMod = new OSRICCharacterModifier(OSRIC_CHARACTER_VARIABLES.attribute,
                OSRIC_ATTRIBUTES.Dexterity, OSRIC_ATTRIBUTE_MODIFIER_TYPE.Racial, 1);
            accumulator.Add(tempMod);

            tempMod = new OSRICCharacterModifier(OSRIC_CHARACTER_VARIABLES.attribute,
                OSRIC_ATTRIBUTES.Strength, OSRIC_ATTRIBUTE_MODIFIER_TYPE.Racial, -1);
            accumulator.Add(tempMod);

            // Broken here
            int conAdjust = -1*(int)((float)oam.Con/3.5);

            tempMod = new OSRICCharacterModifier(OSRIC_CHARACTER_VARIABLES.savingthrow,
                OSRIC_SAVING_THROWS.saveRoSaWa, OSRIC_ATTRIBUTES.Constitution,
                OSRIC_ATTRIBUTE_MODIFIER_TYPE.Racial, conAdjust);
            accumulator.Add(tempMod);

            tempMod = new OSRICCharacterModifier(OSRIC_CHARACTER_VARIABLES.savingthrow,
                OSRIC_SAVING_THROWS.saveSpell, OSRIC_ATTRIBUTES.Constitution,
                OSRIC_ATTRIBUTE_MODIFIER_TYPE.Racial, conAdjust);
            accumulator.Add(tempMod);

            tempMod = new OSRICCharacterModifier(OSRIC_CHARACTER_VARIABLES.savingthrow,
                OSRIC_SAVING_THROWS.saveDeath, OSRIC_ATTRIBUTES.Constitution,
                OSRIC_ATTRIBUTE_MODIFIER_TYPE.Racial, conAdjust);
            accumulator.Add(tempMod);

            break;
        case OSRIC_RACE.HalfOrc:
            tempMod = new OSRICCharacterModifier(OSRIC_CHARACTER_VARIABLES.attribute,
                OSRIC_ATTRIBUTES.Strength, OSRIC_ATTRIBUTE_MODIFIER_TYPE.Racial, 1);
            accumulator.Add(tempMod);
            tempMod = new OSRICCharacterModifier(OSRIC_CHARACTER_VARIABLES.attribute,
                OSRIC_ATTRIBUTES.Constitution, OSRIC_ATTRIBUTE_MODIFIER_TYPE.Racial, 1);
            accumulator.Add(tempMod);
            tempMod = new OSRICCharacterModifier(OSRIC_CHARACTER_VARIABLES.attribute,
                OSRIC_ATTRIBUTES.Charisma, OSRIC_ATTRIBUTE_MODIFIER_TYPE.Racial, -2);
            accumulator.Add(tempMod);
            break;
        case OSRIC_RACE.Human:
            break;
        }

        foreach(OSRICCharacterModifier ocm in accumulator)
        {
            oam.AddRacialModifier(ocm);
        }
        //		Debug.Log("Modifier List: " + oam.CharacterModifiers.ModifierList.Count.ToString());
    }
Example #4
0
 public void AddModifier(OSRICCharacterModifier _ocm)
 {
     if(ModifierList==null)
         initializeModifierList();
     ModifierList.Add(_ocm);
 }
 public bool Equals(OSRICCharacterModifier ocm)
 {
     if(this.characterVariable == ocm.characterVariable &&
             this.attribute == ocm.attribute &&
             this.type == ocm.type &&
             this.savingThrow == ocm.savingThrow)
         return true;
     return false;
 }