Esempio n. 1
0
    private ELEMENT_TYPE ChangeElementToMasterDefineElement(int elementIndex, ELEMENT_CONDITION condition)
    {
        ELEMENT_TYPE result = ELEMENT_TYPE.MAX;

        switch (elementIndex)
        {
        case 1:
            switch (condition)
            {
            case ELEMENT_CONDITION.EQUAL:
                result = ELEMENT_TYPE.FIRE;
                break;

            case ELEMENT_CONDITION.EFFECTIVE_DEF:
                result = ELEMENT_TYPE.SOIL;
                break;

            default:
                result = ELEMENT_TYPE.THUNDER;
                break;
            }
            break;

        case 2:
            switch (condition)
            {
            case ELEMENT_CONDITION.EQUAL:
                result = ELEMENT_TYPE.WATER;
                break;

            case ELEMENT_CONDITION.EFFECTIVE_DEF:
                result = ELEMENT_TYPE.FIRE;
                break;

            default:
                result = ELEMENT_TYPE.SOIL;
                break;
            }
            break;

        case 3:
            switch (condition)
            {
            case ELEMENT_CONDITION.EQUAL:
                result = ELEMENT_TYPE.THUNDER;
                break;

            case ELEMENT_CONDITION.EFFECTIVE_DEF:
                result = ELEMENT_TYPE.WATER;
                break;

            default:
                result = ELEMENT_TYPE.FIRE;
                break;
            }
            break;

        case 4:
            switch (condition)
            {
            case ELEMENT_CONDITION.EQUAL:
                result = ELEMENT_TYPE.SOIL;
                break;

            case ELEMENT_CONDITION.EFFECTIVE_DEF:
                result = ELEMENT_TYPE.THUNDER;
                break;

            default:
                result = ELEMENT_TYPE.WATER;
                break;
            }
            break;

        case 5:
            switch (condition)
            {
            case ELEMENT_CONDITION.EQUAL:
                result = ELEMENT_TYPE.LIGHT;
                break;

            case ELEMENT_CONDITION.EFFECTIVE_DEF:
                result = ELEMENT_TYPE.DARK;
                break;

            default:
                result = ELEMENT_TYPE.MAX;
                break;
            }
            break;

        case 6:
            switch (condition)
            {
            case ELEMENT_CONDITION.EQUAL:
                result = ELEMENT_TYPE.DARK;
                break;

            case ELEMENT_CONDITION.EFFECTIVE_DEF:
                result = ELEMENT_TYPE.LIGHT;
                break;

            default:
                result = ELEMENT_TYPE.MAX;
                break;
            }
            break;
        }
        return(result);
    }
Esempio n. 2
0
    private EquipItemInfo GetWeaponMaxAtk(bool validElement, ELEMENT_CONDITION condition = ELEMENT_CONDITION.EQUAL)
    {
        EquipItemInfo equipItemInfo = null;
        int           num           = -1;

        for (int i = 0; i < weaponItemInfoList.Length; i++)
        {
            if (validElement && elementIndex != 0)
            {
                ELEMENT_TYPE eLEMENT_TYPE = ChangeElementToMasterDefineElement(elementIndex, condition);
                int          elemAtkType  = weaponItemInfoList[i].GetElemAtkType();
                if ((eLEMENT_TYPE != (ELEMENT_TYPE)elemAtkType && condition == ELEMENT_CONDITION.EQUAL) || ((eLEMENT_TYPE == (ELEMENT_TYPE)elemAtkType || elemAtkType == 6) && condition == ELEMENT_CONDITION.DISADVANTAGEOUS))
                {
                    continue;
                }
            }
            int num2 = 0;
            if (isCurrent)
            {
                num2 = weaponItemInfoList[i].atk + weaponItemInfoList[i].elemAtk;
            }
            else
            {
                EquipItemTable.EquipItemData         tableData         = weaponItemInfoList[i].tableData;
                GrowEquipItemTable.GrowEquipItemData growEquipItemData = Singleton <GrowEquipItemTable> .I.GetGrowEquipItemData(tableData.growID, (uint)tableData.maxLv);

                if (growEquipItemData != null)
                {
                    EquipItemExceedParamTable.EquipItemExceedParamAll equipItemExceedParamAll = tableData.GetExceedParam((uint)weaponItemInfoList[i].exceed);
                    if (equipItemExceedParamAll == null)
                    {
                        equipItemExceedParamAll = new EquipItemExceedParamTable.EquipItemExceedParamAll();
                    }
                    int   num3             = growEquipItemData.GetGrowParamAtk(tableData.baseAtk) + (int)equipItemExceedParamAll.atk;
                    int[] growParamElemAtk = growEquipItemData.GetGrowParamElemAtk(tableData.atkElement);
                    int   j = 0;
                    for (int num4 = growParamElemAtk.Length; j < num4; j++)
                    {
                        growParamElemAtk[j] += equipItemExceedParamAll.atkElement[j];
                    }
                    int num5 = Mathf.Max(growParamElemAtk);
                    num2 = num3 + num5;
                }
            }
            if (num2 != 0)
            {
                int num6 = (int)weaponItemInfoList[i].tableData.type;
                if (num6 >= 4)
                {
                    num6--;
                }
                if (num6 < MonoBehaviourSingleton <GlobalSettingsManager> .I.playerWeaponAttackRate.Length)
                {
                    num2 = (int)((float)num2 / MonoBehaviourSingleton <GlobalSettingsManager> .I.playerWeaponAttackRate[num6]);
                }
            }
            if (num2 > num && !selectedWeaponIds.Contains(weaponItemInfoList[i].uniqueID))
            {
                equipItemInfo = weaponItemInfoList[i];
                num           = num2;
            }
        }
        if (equipItemInfo != null)
        {
            selectedWeaponIds.Add(equipItemInfo.uniqueID);
        }
        if (equipItemInfo == null && validElement && condition == ELEMENT_CONDITION.EQUAL)
        {
            equipItemInfo = GetWeaponMaxAtk(true, ELEMENT_CONDITION.DISADVANTAGEOUS);
        }
        else if (equipItemInfo == null && validElement && condition == ELEMENT_CONDITION.DISADVANTAGEOUS)
        {
            equipItemInfo = GetWeaponMaxAtk(false, ELEMENT_CONDITION.EQUAL);
        }
        return(equipItemInfo);
    }