public override float ProcessReward(SpinInfo spinInfo)
        {
            if (!needChangeReward)
            {
                return(spinInfo.finalRewardPercent);
            }

            if (isDecreaseBank)
            {
                if (spinInfo.finalStatus == SpinStatus.Lucky)
                {
                    return(Mathf.Max(1.0f, SlotsGame.Instance.SlotMachineConfig.rewardLimits.MinFalseReward / 100.0f));
                }
            }
            else
            {
                PeriodData periodData = DataManager.Instance.SlotsData.periodData;
                int        needBank   = (int)(periodData.playerBankOnStart * (periodData.curRTP / 100.0f));

                int   delta         = DataManager.Instance.Money - needBank;
                float rewardPercent = Mathf.Abs(delta) / (float)spinInfo.bet;
                return(rewardPercent);
            }
            return(spinInfo.finalRewardPercent);
        }
Exemple #2
0
        public override bool NeedToDeactivate(SpinInfo spinInfo)
        {
            int startSpinId   = DataManager.Instance.SlotsData.payUserModData.startSpinId;
            int currentSpinId = DataManager.Instance.SlotsData.lastSpinId;

            return((currentSpinId - startSpinId) >= selfConfig.MaxWinSpins);
        }
Exemple #3
0
        public void TestMatrix(float reward)
        {
            SpinInfo newSpinInfo = new SpinInfo();

            newSpinInfo.finalRewardPercent = reward;

            matrixGenerator.GenerateMatrix(newSpinInfo);
        }
        public void PushNewSpin(SpinInfo spinInfo)
        {
            //data.SlotsData.periodData.leftSpinCount++;

            //Debug.Log("New spin: " + spinInfo.ToString());

            SetDataDirty();
        }
        public override SpinStatus ProcessSpinStatus(SpinInfo spinInfo)
        {
            PeriodData periodData = DataManager.Instance.SlotsData.periodData;
            int        needBank   = (int)(periodData.playerBankOnStart * (periodData.curRTP / 100.0f));

            int delta = DataManager.Instance.Money - needBank;

            isDecreaseBank   = false;
            needChangeReward = false;

            if (delta < 0)
            {
                needChangeReward = true;

                float rewardPercent = Mathf.Abs(delta) / (float)spinInfo.bet;
                if ((rewardPercent * 100) > SlotsGame.Instance.SlotMachineConfig.rewardLimits.MaxLuckyReward)
                {
                    return(SpinStatus.Big);
                }
                else
                {
                    return(SpinStatus.Lucky);
                }
            }
            else
            {
                int spinsLeft = spinInfo.id - DataManager.Instance.SlotsData.finishPeriodModData.startSpinIdByDescreaseBank;

                if (spinsLeft >= selfConfig.MaxSpinsToDecreaseBank)
                {
                    DataManager.Instance.FinishPeriod(true, false);
                    return(spinInfo.baseStatus);
                }

                isDecreaseBank = true;

                if (spinInfo.baseStatus != SpinStatus.Lose)
                {
                    float minFalseReward = SlotsGame.Instance.SlotMachineConfig.rewardLimits.MinFalseReward;
                    if (minFalseReward < 99.99f)
                    {
                        return(SpinStatus.False);
                    }
                    else
                    {
                        needChangeReward = true;
                        return(SpinStatus.Lucky);
                    }
                }
                else
                {
                    return(spinInfo.baseStatus);
                }
            }
        }
        public override bool NeedToDeactivate(SpinInfo spinInfo)
        {
            PeriodData periodData = DataManager.Instance.SlotsData.periodData;
            int        leftSpins  = DataManager.Instance.SlotsData.lastSpinId - periodData.startSpinId;

            if (leftSpins < SlotsGame.Instance.SlotsConfig.SpinsCountOnPeriod)
            {
                return(true);
            }
            return(false);
        }
        public override SpinStatus ProcessSpinStatus(SpinInfo spinInfo)
        {
            int spinIndex = DataManager.Instance.SlotsData.lastSpinId -
                            DataManager.Instance.SlotsData.absentUserModData.startSpinId;

            if (spinIndex >= (selfConfig.MaxWinSpins - 1))
            {
                DataManager.Instance.FinishPeriod(false);
            }

            return(spinInfo.baseStatus == SpinStatus.Lose ? SpinStatus.Lucky : spinInfo.baseStatus);
        }
Exemple #8
0
        public override bool NeedToActivate(SpinInfo spinInfo)
        {
            var needActivate = !DataManager.Instance.CheckForSpend(spinInfo.bet * 2);

            if (needActivate)
            {
                DataManager.Instance.SlotsData.bankNearZeroModData.countNeedUse++;
                needActivate = CheckSpin();
            }

            return(needActivate);
        }
Exemple #9
0
        public void StartSpin()
        {
            Debug.Log("Start spin");

            SpinInfo newSpin = spinGenerator.GenerateSpin();

            DataManager.Instance.SpendMoney(currentBet);

            if (newSpin.finalStatus != SpinStatus.Lose)
            {
                DataManager.Instance.AddMoney(newSpin.moneyReward);
            }

            Debug.Log("New spin: " + newSpin.ToString());
        }
Exemple #10
0
        public FinalSpinReward GenerateMatrix(SpinInfo spinInfo)
        {
            int i = 0;

            symbolIdToGenSymbol.Clear();
            foreach (var curSymbol in SlotsGame.Instance.SlotMachineConfig.symbols)
            {
                uint symbolOffset = (uint)1 << i++;
                symbolIdToGenSymbol.Add(symbolOffset, new GenSymbolId()
                {
                    symbolConfig = curSymbol, symbolId = symbolOffset
                });
            }

            i = 0;
            lineIdToGenLine.Clear();
            foreach (var curLine in SlotsGame.Instance.SlotMachineConfig.lines)
            {
                uint lineOffset = (uint)1 << i++;
                lineIdToGenLine.Add(lineOffset, new GenLineId()
                {
                    lineConfig = curLine, lineId = lineOffset
                });
            }

            currentSpinInfo = spinInfo;

            MatrixInWork newMatrix = new MatrixInWork(SlotsGame.Instance.SlotMachineConfig.drums.Length, SlotsGame.Instance.SlotMachineConfig.MaxDrumHeight());

            //newMatrix.symbols[1][1].fixedSymbol = true;

            //FinalSpinReward finalSpinReward = new FinalSpinReward();

            int[] firstIndicies = new int[newMatrix.symbols[0].Length];
            for (int j = 0; j < firstIndicies.Length; j++)
            {
                firstIndicies[j] = j;
            }

            Shuffle(firstIndicies);

            ProcessSymbols(firstIndicies, newMatrix);


            return(new FinalSpinReward());
        }
        public SpinInfo GenerateSpin()
        {
            //UnityEngine.Random.InitState((int)Time.time);

            currentSpin = new SpinInfo();

            currentSpin.id  = DataManager.Instance.GenerateSpinId();
            currentSpin.bet = SlotsGame.Instance.CurrentBet;

            //if (SlotsData.periodData.finished)
            CheckForNewPeriod();

            float bankRemain  = SlotsData.periodData.playerBankOnStart * (SlotsData.periodData.curRTP / 100.0f) - DataManager.Instance.Money;
            int   spinsRemain = Mathf.Max(SlotsGame.Instance.SlotsConfig.SpinsCountOnPeriod - (SlotsData.lastSpinId - SlotsData.periodData.startSpinId), 0);

            rewardMods.UpdateRewardFactors(Mathf.RoundToInt(bankRemain), spinsRemain, currentSpin.bet);

            currentSpin.luckyRTPFactor  = rewardMods.LuckyFactor;
            currentSpin.bigWinRTPFactor = rewardMods.BigWinFactor;

            CalculateChances();

            currentSpin.baseStatus        = RandomSpinStatus();
            currentSpin.baseRewardPercent = CalculateReward(currentSpin.baseStatus);

            FindAndActivateModificator(currentSpin);

            currentSpin.finalStatus = currentSpin.baseStatus;
            if (currentSpin.currentActivedMod != SpinModificatorType.None)
            {
                currentSpin.finalStatus = currentActivedMod.ProcessSpinStatus(currentSpin);
            }

            currentSpin.finalRewardPercent = CalculateReward(currentSpin.finalStatus);
            if (currentSpin.currentActivedMod != SpinModificatorType.None)
            {
                currentSpin.finalRewardPercent = currentActivedMod.ProcessReward(currentSpin);
            }

            currentSpin.moneyReward = Mathf.RoundToInt((float)currentSpin.bet * currentSpin.finalRewardPercent);

            DataManager.Instance.PushNewSpin(currentSpin);

            return(currentSpin);
        }
        public override bool NeedToActivate(SpinInfo spinInfo)
        {
            if (spinInfo.bet != SlotsGame.Instance.MaxBet)
            {
                DataManager.Instance.SlotsData.makeMaxBetModData.countNoMaxBet++;
            }


            if (!DataManager.Instance.SlotsData.makeMaxBetModData.lastBetMax)
            {
                if (spinInfo.bet == SlotsGame.Instance.MaxBet)
                {
                    DataManager.Instance.SlotsData.makeMaxBetModData.lastBetMax = true;
                    return(DataManager.Instance.SlotsData.makeMaxBetModData.countNoMaxBet >=
                           DataManager.Instance.SlotsData.makeMaxBetModData.countSpinToNextPeriod);
                }

                return(false);
            }

            DataManager.Instance.SlotsData.makeMaxBetModData.lastBetMax = spinInfo.bet == SlotsGame.Instance.MaxBet;
            return(false);
        }
Exemple #13
0
 public override float ProcessReward(SpinInfo spinInfo)
 {
     return(selfConfig.Reward);
 }
 public override bool NeedToDeactivate(SpinInfo spinInfo)
 {
     return(DataManager.Instance.SlotsData.makeMaxBetModData.countNoMaxBet <
            DataManager.Instance.SlotsData.makeMaxBetModData.countSpinToNextPeriod || spinInfo.bet == SlotsGame.Instance.MaxBet);
 }
Exemple #15
0
 public override SpinStatus ProcessSpinStatus(SpinInfo spinInfo)
 {
     return(SpinStatus.Lucky);
 }
Exemple #16
0
 public override bool NeedToDeactivate(SpinInfo spinInfo)
 {
     return(CheckSpin());
 }
 public virtual float ProcessReward(SpinInfo spinInfo)
 {
     return(0.0f);
 }
        void FindAndActivateModificator(SpinInfo spinInfo)
        {
            int activatedModIndex     = -1;
            int highNeedActivateIndex = -1;
            int toActivateIndex       = -1;

            for (int i = 0; i < spinModificators.Count; i++)
            {
                if (!spinModificators[i].Enabled)
                {
                    continue;
                }

                if (SlotsData.modActivated == spinModificators[i].ModType)
                {
                    if (spinModificators[i].NeedToDeactivate(spinInfo))
                    {
                        DataManager.Instance.SetActivatedSpinModificator(SpinModificatorType.None);
                        currentActivedMod          = null;
                        spinInfo.currentActivedMod = SpinModificatorType.None;
                    }
                    else
                    {
                        activatedModIndex = i;
                    }
                }
                if (spinModificators[i].NeedToActivate(spinInfo) && highNeedActivateIndex == -1)
                {
                    highNeedActivateIndex = i;
                }
            }

            if (highNeedActivateIndex != -1)
            {
                toActivateIndex = -1;

                if (activatedModIndex == -1)
                {
                    toActivateIndex = highNeedActivateIndex;
                }
                else if (highNeedActivateIndex == activatedModIndex &&
                         spinModificators[highNeedActivateIndex].MayRestart)
                {
                    toActivateIndex = highNeedActivateIndex;
                }
                else if (highNeedActivateIndex < activatedModIndex)
                {
                    toActivateIndex = highNeedActivateIndex;
                }
            }

            if (toActivateIndex != -1)
            {
                spinModificators[toActivateIndex].Activate();
                currentActivedMod          = spinModificators[toActivateIndex];
                spinInfo.currentActivedMod = currentActivedMod.ModType;

                DataManager.Instance.SetActivatedSpinModificator(currentActivedMod.ModType);
            }
            else if (activatedModIndex != -1)
            {
                currentActivedMod          = spinModificators[activatedModIndex];
                spinInfo.currentActivedMod = currentActivedMod.ModType;
            }
            else
            {
                currentActivedMod          = null;
                spinInfo.currentActivedMod = SpinModificatorType.None;
            }
        }
 public virtual SpinStatus ProcessSpinStatus(SpinInfo spinInfo)
 {
     return(SpinStatus.None);
 }
Exemple #20
0
 public override bool NeedToActivate(SpinInfo spinInfo)
 {
     return(DataManager.Instance.SlotsData.userPaid);
 }
 public override float ProcessReward(SpinInfo spinInfo)
 {
     return(UnityEngine.Random.Range(selfConfig.MinReward, selfConfig.MaxReward));
 }
Exemple #22
0
 public override float ProcessReward(SpinInfo spinInfo)
 {
     return(spinInfo.finalRewardPercent);
 }
 public virtual bool NeedToDeactivate(SpinInfo spinInfo)
 {
     return(false);
 }