Exemplo n.º 1
0
    /// <summary>
    /// Update final property calculated by equipments and labels
    /// </summary>
    public void UpdateFinalProperty(bool isFirstUpdate = false)
    {
        // Calculate property by equipments and labels
        // 1. Equipments
        CharProperty newProperty = originalProperty;

        newProperty.hpMax += armor.health + accessory.health;

        newProperty.pDamage += weapon.pAtk;
        newProperty.mDamage += weapon.mAtk;

        newProperty.strength  += armor.strength + accessory.strength;
        newProperty.agility   += armor.agility + accessory.agility;
        newProperty.intellect += armor.intellect + accessory.intellect;

        newProperty.pResist += armor.pDefense + accessory.pDefense;
        newProperty.mResist += armor.mDefense + accessory.mDefense;

        // Calculate 2-level property by 1-level property
        newProperty.dodge   += newProperty.agility * 1f;
        newProperty.pResist += newProperty.strength * 1f;
        newProperty.mResist += newProperty.intellect * 1f;

        // Keep hp and hunger
        newProperty.hp     = finalProperty.hp;
        newProperty.hunger = finalProperty.hunger;

        // 2. Labels
        foreach (Label label in labels)
        {
            newProperty = InequalityParse.EffectParse(label.effect, newProperty);
        }

        finalProperty = newProperty;
    }
Exemplo n.º 2
0
    // Use this for initialization
    void Start()
    {
        string       str = "E3+10|E4-10.1";
        CharProperty cp  = CharProperty.standard;

        cp = InequalityParse.EffectParse(str, cp);

        Debug.Log("strength: " + cp.strength);
        Debug.Log("agility: " + cp.agility);
    }