예제 #1
0
 public UnitRecepePiece(UnitType unit, int inf, UnitRankType rank, int qty, bool canUseForEvo)
 {
     Unit         = unit;
     Infuse       = inf;
     Rank         = rank;
     Quantity     = qty;
     CanUseForEvo = canUseForEvo;
 }
 public UnitCost GetUnitCost(UnitType unitType, int infuse, UnitRankType rank, bool isLimitBroken = false)
 {
     if (unitType != UnitType.None)
     {
         return(GetRawUnitCost(unitType, infuse, rank, isLimitBroken));
     }
     return(new UnitCost(0, 0));
 }
        UnitCost GetRawUnitCost(UnitType unitType, int infuse, UnitRankType rank, bool isLimitBroken)
        {
            var unitData = VUnit.GetUnitData(unitType);

            // theres some horrible spaghetti with the logic for adding two UnitCost structs because we don't want to sum the ExcessKills.
            // It takes the Excess Kills from the element on the right side of the '+' operator.
            // Please ensure you leave these cost additions in this order to avoid breaking this accidently
            var cost = GetRankCost(rank);

            cost += GetBaseCreationCost(unitData, isLimitBroken);
            cost += GetInfusionCosts(unitData, infuse, cost.CurrentUnitKills);
            return(cost);
        }
예제 #4
0
        public static double GetRankCost(UnitRankType rank, int revision, bool hasRefundSoul)
        {
            var cacheKey = new RankCacheKey(rank, revision, hasRefundSoul);

            if (Cache.TryGetValue(cacheKey, out var value))
            {
                return(value);
            }

            value           = GetNewRankCost(rank, revision, hasRefundSoul);
            Cache[cacheKey] = value;
            return(value);
        }
        UnitCost GetRankCost(UnitRankType rank)
        {
            var rankCost = UnitRankUpHelper.GetRankCost(rank, loadout.IncomeManager.RankRevision, loadout.IncomeManager.HasRefundSoul);

            if (hasRSSS && rank >= UnitRankType.SSS)
            {
                hasRSSS   = false;
                rankCost -= UnitRankUpHelper.GetRankCost(UnitRankType.SSS, loadout.IncomeManager.RankRevision, loadout.IncomeManager.HasRefundSoul);
            }
            else if (hasRSS && rank >= UnitRankType.SS)
            {
                hasRSS    = false;
                rankCost -= UnitRankUpHelper.GetRankCost(UnitRankType.SS, loadout.IncomeManager.RankRevision, loadout.IncomeManager.HasRefundSoul);
            }
            return(new UnitCost(0, rankCost));
        }
예제 #6
0
        public static VUnitRank New(UnitRankType rank)
        {
            if (rank == UnitRankType.None)
            {
                return(new EmptyRank());
            }
            var rankName = "Rank" + rank.AsString(EnumFormat.Name);
            var rankType = System.Type.GetType($"VBusiness.Ranks.{rankName}");

            if (rankType == null)
            {
                ErrorReporter.ReportDebug($"Please create a class named VBusiness.Ranks.{rankName}");
                return(new EmptyRank());
            }

            var ret = (UnitRank)Activator.CreateInstance(rankType);

            return(ret);
        }
예제 #7
0
        static double GetNewRankCost(UnitRankType rank, int revision, bool hasRefundSoul)
        {
            var totalCost = 0.0;

            for (var i = 0; i < (int)rank; i++)
            {
                var chance = Math.Pow(0.902, i) * (1 + revision / 100.0);
                chance = Math.Min(1, chance);
                var successCost            = (100 + 75 * i) * (1 + 0.03 * i);
                var refundAmount           = hasRefundSoul ? 20 * (i - 1) : 0;
                var failCost               = successCost - refundAmount;
                var expectedRankUpAttempts = 1 / chance;
                var expectedFails          = expectedRankUpAttempts - 1;
                var expectedCost           = successCost + failCost * expectedFails;
                totalCost += expectedCost;
            }

            return(totalCost);
        }
예제 #8
0
 public UnitRecepePiece(UnitType unit, int inf, UnitRankType rank, int qty) : this(unit, inf, rank, qty, true)
 {
 }
예제 #9
0
 public RankCacheKey(UnitRankType rank, int rankRevision, bool refundSoul)
 {
     UnitRank      = rank;
     RankRevision  = rankRevision;
     HasRefundSoul = refundSoul;
 }