Untitled

mail@pastecode.io avatar
unknown
abap
2 years ago
4.7 kB
3
Indexable
Never
#region Engine
    public List<AircraftEngine> GetAircraftEngines(AircraftKind kind)
    {
        var engines = GetAircraftInfo(kind).GetAircraftEngines();
        int tier = GetAircraftInfo(kind).GetTier();
        if (tier == 0)
        {
            return engines;
        }
        var bonusEngine = GetTotalBonusEngine(kind);

        for (int i = 0; i < engines.Count; i++)
        {
            switch (engines[i].engineKind)
            {
                case 1:
                    engines[i].x *= (1 + bonusEngine[i]);
                    engines[i].z *= (1 + bonusEngine[i]);
                    break;
                case 2:
                    engines[i].x *= (1 + bonusEngine[i]);
                    engines[i].y *= (1 + bonusEngine[i]);
                    break;
                case 3:
                    engines[i].x *= (1 + bonusEngine[i]);
                    engines[i].y *= (1 + bonusEngine[i]);
                    break;
                case 4:
                    engines[i].x *= (1 + bonusEngine[i]);
                    engines[i].y *= (1 + bonusEngine[i]);
                    break;
                case 5:
                    engines[i].x *= (1 + bonusEngine[i]);
                    break;
                case 6:
                    engines[i].x *= (1 + bonusEngine[i]);
                    break;
                case 7:
                    engines[i].x *= (1 + bonusEngine[i]);
                    break;
                case 8:
                    engines[i].x *= (1 + bonusEngine[i]);
                    break;
                case 9:
                    engines[i].y *= (1 + bonusEngine[i]);
                    break;
                case 10:
                    engines[i].y *= (1 + bonusEngine[i]);
                    break;
                case 11:
                    engines[i].y *= (1 + bonusEngine[i]);
                    break;
                case 12:
                    engines[i].y *= (1 + bonusEngine[i]);
                    break;
                case 13:
                    engines[i].x *= (1 + bonusEngine[i]);
                    engines[i].y *= (1 + bonusEngine[i]);
                    break;
                case 14:
                    engines[i].x *= (1 + bonusEngine[i]);
                    engines[i].y *= (1 + bonusEngine[i]);
                    break;
                case 15:
                    engines[i].z *= (1 + bonusEngine[i]);
                    break;
                case 16:
                    engines[i].x *= (1 + bonusEngine[i]);
                    break;
            } 
        }

        return engines;
    }

    private float[] GetTotalBonusEngine(AircraftKind kind)
    {
        // bonus from tier 1, 2
        int tier = GetAircraftInfo(kind).GetTier();
        var result = new float[4] { 0, 0, 0, 0 };
        if (tier > 0)
        {
            var engineKinds = GetAircraftInfo(kind).GetEnginesKind();

            var aircraftCombineKinds = GetListAircraftToCombineWithoutCurrentAircraft(kind);
            for (int i = 0; i < aircraftCombineKinds.Count; i++)
            {
                int tierAircraftCombine = GetAircraftInfo(aircraftCombineKinds[i]).GetTier();
                var engineKindsAircraftCombine = GetAircraftInfo(aircraftCombineKinds[i]).GetEnginesKind();

                for (int j = 0; j < engineKindsAircraftCombine.Count; j++)
                {
                    if (engineKinds.Contains(engineKindsAircraftCombine[i]))
                    {
                        float ratioBonus = (tier - tierAircraftCombine) * 0.005f;
                        int index = engineKinds.IndexOf(engineKindsAircraftCombine[i]);
                        result[index] += ratioBonus * GetAircraftInfo(aircraftCombineKinds[i]).GetLevelEngine(index);
                    }
                }
            }
        }

        // bonus from wingman, device
        var slot = Utility.GetSlotInfo(kind);
        var wingmanKind = slot.Item2;
        var deviceKind = slot.Item3;
        if (wingmanKind != null)
        {
            
        }
        
        return result;
    }

    public List<int> GetEngineKind(AircraftKind kind)
    {
        return GetAircraftInfo(kind).GetEnginesKind();
    }

    public ObscuredInt[] GetAircraftEngineRank(AircraftKind kind)
    {
        return GetAircraftInfo(kind).engineRanks;
    }
    public ObscuredInt[] GetAircraftEngineSubRank(AircraftKind kind)
    {
        return GetAircraftInfo(kind).engineSubRanks;
    }

    public int UpgradeEngine(AircraftKind kind)
    {
        return GetAircraftInfo(kind).UpgradeEngine();
    }
#endregion