コード例 #1
0
    public CalculationHalfway Calc(CalculationHalfway halfway)
    {
        //詫び石
        var stoneDistRate = halfway.playerInput.stoneDistrib.rate;

        if (stoneDistRate > 0.0f)
        {
            halfway.innerInput.satisfaction.value += (float)stoneDistRate * 5f;
            halfway.imValues.bonusRate            -= this.stoneCostRateDecreaseMax * stoneDistRate;
        }

        //プロモ
        var promotion = halfway.playerInput.promotions;

        if (promotion.cost > 0L)
        {
            halfway.innerInput.userCount.counts[promotion.target] += halfway.innerInput.userCount.counts[promotion.target] / 3;
            halfway.graphOutput.balance.expenditure += promotion.cost;
        }

        //アップデート
        foreach (var update in halfway.playerInput.updates)
        {
            halfway.graphOutput.opness.opens         = new UpdateTarget[] { update.target };
            halfway.innerInput.satisfaction.value   += 10f;
            halfway.imValues.bonusRate              += 0.5f;
            halfway.graphOutput.balance.expenditure += this.updateCost;
        }

        halfway.innerInput.satisfaction.value = Mathf.Clamp(halfway.innerInput.satisfaction.value, 0f, 100f);

        return(halfway);
    }
コード例 #2
0
    public CalculationHalfway Calc(CalculationHalfway halfway)
    {
        var h0 = this.gachaCalculator.Calc(halfway);
        var h1 = this.otherCalculator.Calc(h0);
        var h2 = this.userCalculator.Calc(h1);

        return(this.basicCalculator.Calc(h2));
    }
コード例 #3
0
    public CalculationHalfway Calc(CalculationHalfway halfway)
    {
        var tyuKakin     = halfway.innerInput.userCount.counts[UserSegment.TyuKakin];
        var biKakin      = halfway.innerInput.userCount.counts[UserSegment.BiKakin];
        var mukakin      = halfway.innerInput.userCount.counts[UserSegment.MuKakin];
        var satisfaction = halfway.innerInput.satisfaction.value;
        var kindness     = halfway.imValues.kindness;

        halfway.innerInput.userCount.counts[UserSegment.JuKakin] += (long)(tyuKakin * (satisfaction / 500f * (1f - kindness / 2f)));
        halfway.innerInput.userCount.counts[UserSegment.TyuKakin] = (long)(((long)(tyuKakin + (1 - satisfaction / 500f)) + (long)(biKakin * (satisfaction / 200f))) * (1f - kindness / 5f));
        halfway.innerInput.userCount.counts[UserSegment.BiKakin]  = (long)(((long)(biKakin + (1 - satisfaction / 200f)) + (long)(mukakin * (satisfaction / 100f))) * (1f + kindness / 20f));
        halfway.innerInput.userCount.counts[UserSegment.MuKakin] += (long)(mukakin * (satisfaction / 50f * (1 + kindness / 30f)));

        if (satisfaction == 100f)
        {
            halfway.innerInput.userCount.counts[UserSegment.Sekiyuo] += 1;
        }

        return(halfway);
    }
コード例 #4
0
    public CalculationHalfway Calc(CalculationHalfway halfway)
    {
        // ユーザー数からIncomeを計算(Ceilingも反映)
        // BounusRateを清算

        // 順番はGachaCalculator、OtherCalculator、UserCalculator、BasicCalculator

        var userCounts   = halfway.innerInput.userCount.counts;
        var ceilingCount = halfway.playerInput.gachaParams
                           .Where(param => param.Value.isCeiling)
                           .Count();

        var income =
            userCounts[UserSegment.BiKakin] * 1000L +
            (long)(userCounts[UserSegment.TyuKakin] * 8000L * (1 + ceilingCount * 0.1)) +
            (long)(userCounts[UserSegment.JuKakin] * 30000L * (1 - ceilingCount * 0.1)) +
            userCounts[UserSegment.Sekiyuo] * 50000000L;

        halfway.graphOutput.balance.income = (long)(income * halfway.imValues.bonusRate);

        return(halfway);
    }
コード例 #5
0
    public CalculationHalfway Calc(CalculationHalfway halfway)
    {
        // それぞれのガチャの効果を算出
        // 例)ノーマルガチャなら好感度を変更

        // ついでにガチャ確率から個別にKindnessを割り出す
        // 最高レアが10%(最も優しい)->6%(優しい)->1%(厳しい)->0.01%(最も厳しい)

        // 個別のKindnessを平均して総合Kindnessを算出

        var kindnesses = new float[6];

        // ノーマルガチャ
        if (halfway.playerInput.gachaParams.ContainsKey(GachaCategory.Normal))
        {
            var normalGachaparam = halfway.playerInput.gachaParams[GachaCategory.Normal];
            kindnesses[0] = Mathf.Log10(Mathf.Clamp(normalGachaparam.rates.rates[GachaRarity.LR], 0.1f, 10f));
            halfway.innerInput.satisfaction.value += kindnesses[0] * 1f;
            halfway.innerInput.satisfaction.value += 4f;
        }

        // プレミアム
        if (halfway.playerInput.gachaParams.ContainsKey(GachaCategory.Premium))
        {
            var premiumGachaparam = halfway.playerInput.gachaParams[GachaCategory.Premium];
            kindnesses[1] = Mathf.Log10(Mathf.Clamp(premiumGachaparam.rates.rates[GachaRarity.LR], 0.1f, 10f));
            halfway.imValues.bonusRate += kindnesses[1] * 0.2f;
        }

        // ボックス
        if (halfway.playerInput.gachaParams.ContainsKey(GachaCategory.Box))
        {
            var boxGachaparam = halfway.playerInput.gachaParams[GachaCategory.Box];
            kindnesses[2] = Mathf.Log10(Mathf.Clamp(boxGachaparam.rates.rates[GachaRarity.LR], 0.1f, 10f));
            halfway.innerInput.satisfaction.value += kindnesses[0] * 6f;
        }

        // コンプ
        if (halfway.playerInput.gachaParams.ContainsKey(GachaCategory.Complete))
        {
            var completeGachaparam = halfway.playerInput.gachaParams[GachaCategory.Complete];
            kindnesses[3] = Mathf.Log10(Mathf.Clamp(completeGachaparam.rates.rates[GachaRarity.LR], 0.1f, 10f));
            halfway.imValues.bonusRate            -= kindnesses[1];
            halfway.innerInput.satisfaction.value -= 10f;
        }

        // 確定
        if (halfway.playerInput.gachaParams.ContainsKey(GachaCategory.Confirm))
        {
            var confirmGachaparam = halfway.playerInput.gachaParams[GachaCategory.Confirm];
            kindnesses[4] = 1f;
            halfway.imValues.bonusRate            -= 0.1f;
            halfway.innerInput.satisfaction.value += 3f;
        }

        // 福袋
        if (halfway.playerInput.gachaParams.ContainsKey(GachaCategory.LuckyBag))
        {
            var luckyBagGachaparam = halfway.playerInput.gachaParams[GachaCategory.LuckyBag];
            kindnesses[5] = 1f;
            halfway.imValues.bonusRate            += 0.5f;
            halfway.innerInput.satisfaction.value += 6f;
        }

        halfway.imValues.kindness = kindnesses.Average();

        return(halfway);
    }
コード例 #6
0
    public void Simulation()
    {
        var playerInput = this.playerInputCollector.GetPlayerInput();

        var innerInput = new InnerInput
        {
            userCount = new UserCount
            {
                counts = new Dictionary <UserSegment, long>
                {
                    { UserSegment.MuKakin, this.userCountProgress.MukakinUserCounts.Last() },
                    { UserSegment.BiKakin, this.userCountProgress.BikakinUserCounts.Last() },
                    { UserSegment.TyuKakin, this.userCountProgress.TyukakinUserCounts.Last() },
                    { UserSegment.JuKakin, this.userCountProgress.JukakinUserCounts.Last() },
                    { UserSegment.Sekiyuo, this.userCountProgress.SekiyuoCounts.Last() }
                }
            },
            satisfaction = new UserSatisfaction
            {
                value = this.satisfactionProgress.satisFactions.Last()
            }
        };

        var graphOutput = new GraphOutput();

        var imValues = new IntermediateValues
        {
            kindness  = 0f,
            bonusRate = 1f
        };

        var calculationHalfway = new CalculationHalfway
        {
            playerInput = playerInput,
            innerInput  = innerInput,
            graphOutput = graphOutput,
            imValues    = imValues
        };

        var result = this.calculator.Calc(calculationHalfway);

        // Update Progresses
        var profit = result.graphOutput.balance.income - result.graphOutput.balance.expenditure;

        this.moneyProgress.moneys.Add(this.moneyProgress.moneys.Last() + profit);

        var opens = result.graphOutput.opness.opens;

        if (opens != null)
        {
            this.commandOpenness.Ceiling       = opens.Contains(UpdateTarget.Ceiling);
            this.commandOpenness.CompleteGacha = opens.Contains(UpdateTarget.CompleteGacha);
        }

        this.userCountProgress.MukakinUserCounts.Add(result.innerInput.userCount.counts[UserSegment.MuKakin]);
        this.userCountProgress.BikakinUserCounts.Add(result.innerInput.userCount.counts[UserSegment.BiKakin]);
        this.userCountProgress.TyukakinUserCounts.Add(result.innerInput.userCount.counts[UserSegment.TyuKakin]);
        this.userCountProgress.JukakinUserCounts.Add(result.innerInput.userCount.counts[UserSegment.JuKakin]);
        this.userCountProgress.SekiyuoCounts.Add(result.innerInput.userCount.counts[UserSegment.Sekiyuo]);

        this.satisfactionProgress.satisFactions.Add(result.innerInput.satisfaction.value);

        this.termProgress.currentTerm++;

        if (this.termProgress.currentTerm % 4 == 0)
        {
            this.commandOpenness.ConfirmGacha = true;
        }
        else
        {
            this.commandOpenness.ConfirmGacha = false;
        }

        if (this.termProgress.currentTerm % 5 == 0)
        {
            this.commandOpenness.Update = true;
        }
        else
        {
            this.commandOpenness.Update = false;
        }

        if (this.termProgress.currentTerm == 9)
        {
            this.commandOpenness.HukubukuroGacha = true;
        }
        else
        {
            this.commandOpenness.HukubukuroGacha = false;
        }

        if (this.satisfactionProgress.satisFactions.Last() < 5f)
        {
            this.commandOpenness.StoneDistribution = true;
        }
        else
        {
            this.commandOpenness.StoneDistribution = false;
        }

        // Save Premium Gacha rates
        var premiumRates = playerInput.gachaParams[GachaCategory.Premium].rates;

        this.premiumGachaRate.nRate   = premiumRates.rates[GachaRarity.N];
        this.premiumGachaRate.rRate   = premiumRates.rates[GachaRarity.R];
        this.premiumGachaRate.srRate  = premiumRates.rates[GachaRarity.SR];
        this.premiumGachaRate.ssrRate = premiumRates.rates[GachaRarity.SSR];
        this.premiumGachaRate.urRate  = premiumRates.rates[GachaRarity.UR];
        this.premiumGachaRate.lrRate  = premiumRates.rates[GachaRarity.LR];
    }