コード例 #1
0
ファイル: RPGData.cs プロジェクト: Arcanils/Sparta2D
    //CalculStatsFinal;
    //CalculStatsFinalWithoutBuff
    //TickBuff
    //Private / getter setter
    //Get Damage Physique / Magic
    // Inflict Damage
    // Get Current HP

    public void CalculFinalStats()
    {
        CurrentStats = Stats.EmptyStats();
        var baseEntityStats = EntityData.GetStats();
        var equipementStats = Equipements.GetStats();

        CurrentStats.AddStats(baseEntityStats);
        CurrentStats.AddStats(equipementStats.FlatStats);

        var coefStats = Stats.EmptyStats(1f);

        coefStats.AddStats(equipementStats.CoefStats);


        for (int i = (int)Stat.EBaseStats.LUCK; i >= 0; --i)
        {
            CurrentStats.MultiplyStat(coefStats.Values[i]);
        }

        CurrentStats.AddBaseStat((int)Stat.EBaseStats.PHYSICS_RES, GetData(Stat.EBaseStats.STRENGTH) * COEF_STR_PHYS_RES);
        CurrentStats.AddBaseStat((int)Stat.EBaseStats.PHYSICS_DMG, GetData(Stat.EBaseStats.STRENGTH) * COEF_STR_PHYS_DMG);

        CurrentStats.AddBaseStat((int)Stat.EBaseStats.ATTACK_SPEED, GetData(Stat.EBaseStats.DEXTERITY) * COEF_DEX_AS);
        CurrentStats.AddBaseStat((int)Stat.EBaseStats.SPEED, GetData(Stat.EBaseStats.DEXTERITY) * COEF_DEX_SPEED);

        CurrentStats.AddBaseStat((int)Stat.EBaseStats.HP, GetData(Stat.EBaseStats.VITALITY) * COEF_VIT_HP);
        CurrentStats.AddBaseStat((int)Stat.EBaseStats.MAGIC_RES, GetData(Stat.EBaseStats.VITALITY) * COEF_VIT_PHYS_RES);
        CurrentStats.AddBaseStat((int)Stat.EBaseStats.PHYSICS_RES, GetData(Stat.EBaseStats.VITALITY) * COEF_VIT_MAGIC_RES);

        CurrentStats.AddBaseStat((int)Stat.EBaseStats.MAGIC_RES, GetData(Stat.EBaseStats.WISDOM) * COEF_WIS_MAGIC_RES);
        CurrentStats.AddBaseStat((int)Stat.EBaseStats.MAGIC_DMG, GetData(Stat.EBaseStats.WISDOM) * COEF_WIS_MAGIC_DMG);


        CurrentStats.AddBaseStat((int)Stat.EBaseStats.DROP_RATE, GetData(Stat.EBaseStats.LUCK) * COEF_LUC_DROP_RATE);
        CurrentStats.AddBaseStat((int)Stat.EBaseStats.COEF_CRIT, GetData(Stat.EBaseStats.LUCK) * COEF_LUC_CRIT);

        for (int i = (int)Stat.EBaseStats.LUCK + 1, iLength = (int)Stat.EBaseStats.HP + 1; i < iLength; ++i)
        {
            CurrentStats.MultiplyStat(coefStats.Values[i]);
        }
    }