示例#1
0
        internal static Creation FromString(string base64String)
        {
            if (string.IsNullOrEmpty(base64String))
            {
                Log.Error("Creation.FromString with empty value!");
                return(null);
            }
            string[] parts    = Conv.StringPartsFromBase64(base64String, "Creation");
            Creation creation = new Creation((Creation.CreationType)Conv.getIntFromParts(parts, "a"), God.FromString(Conv.getStringFromParts(parts, "b")));

            creation.Count = new CDouble(Conv.getStringFromParts(parts, "d"));
            creation.Count.Round();
            creation.currentDuration = (long)Conv.getIntFromParts(parts, "e");
            creation.IsActive        = Conv.getStringFromParts(parts, "f").ToLower().Equals("true");
            creation.TotalCreated    = new CDouble(Conv.getStringFromParts(parts, "g"));
            creation.CanBuy          = Conv.getStringFromParts(parts, "h").ToLower().Equals("true");
            creation.NextAtCount     = Conv.getIntFromParts(parts, "i");
            string text = Conv.getStringFromParts(parts, "j").ToLower();

            creation.AutoBuy = (string.IsNullOrEmpty(text) || text.Equals("true"));
            if (creation.TotalCreated > 0)
            {
                creation.CanBuy = true;
            }
            return(creation);
        }
示例#2
0
        public void UseBreakEvenWorkerCount()
        {
            base.RemoveCloneCount(this.ShadowCloneCount);
            Creation creation        = App.State.AllCreations.FirstOrDefault((Creation x) => x.TypeEnum == Creation.CreationType.Stone);
            int      breakEvenWorker = this.GetBreakEvenWorker(creation.BuyCost);

            base.AddCloneCount(breakEvenWorker);
        }
示例#3
0
        public void InitDuration(GameState state)
        {
            Creation.UpdateDurationMulti(state);
            Creation creation = state.AllCreations.FirstOrDefault((Creation x) => x.TypeEnum == this.CreationNeeded);

            this.CreationDuration = creation.DurationInMS;
            this.CreationLoss     = creation.CreatingPowerGain() * 5;
        }
示例#4
0
        internal void GoBackToCreating()
        {
            Creation creation = App.State.AllCreations.FirstOrDefault((Creation x) => x.TypeEnum == Creation.CreationType.Shadow_clone);

            foreach (Creation current in App.State.AllCreations)
            {
                current.IsActive = false;
            }
            if (App.State.GameSettings.LastCreation != null)
            {
                creation = App.State.AllCreations.FirstOrDefault((Creation x) => x.TypeEnum == App.State.GameSettings.LastCreation.TypeEnum);
            }
            if (creation != null)
            {
                creation.IsActive = true;
            }
        }
示例#5
0
        public CDouble TotalDuration(GameState state)
        {
            CDouble cDouble = this.DurationInMS;

            using (List <CreationCost> .Enumerator enumerator = CreationCost.RequiredCreations(this.TypeEnum, 1L, false).GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    CreationCost cost     = enumerator.Current;
                    Creation     creation = state.AllCreations.FirstOrDefault((Creation x) => x.TypeEnum == cost.TypeEnum);
                    if (creation != null)
                    {
                        cDouble += cost.CountNeeded * creation.TotalDuration(state);
                    }
                }
            }
            return(cDouble);
        }
示例#6
0
        private bool CheckPrerequesiteCost(List <CreationCost> requiredCreations)
        {
            bool     flag     = false;
            Creation creation = null;

            for (int i = 0; i < requiredCreations.Count; i++)
            {
                CreationCost cost      = requiredCreations[i];
                Creation     creation2 = App.State.AllCreations.FirstOrDefault((Creation x) => x.TypeEnum == cost.TypeEnum);
                if (cost.CountNeeded > creation2.Count)
                {
                    if (App.State.IsBuyUnlocked && App.State.GameSettings.AutoBuyCreations && creation2.CanBuy && creation2.AutoBuy)
                    {
                        CDouble cDouble   = cost.CountNeeded - creation2.Count;
                        CDouble rightSide = cDouble * creation2.BuyCost * (120 - App.State.PremiumBoni.AutoBuyCostReduction) / 100;
                        if (App.State.Money >= rightSide)
                        {
                            App.State.Money -= rightSide;
                            creation2.count += cDouble;
                            App.State.Statistic.TotalMoneySpent += rightSide;
                        }
                        else
                        {
                            flag     = true;
                            creation = creation2;
                        }
                    }
                    else
                    {
                        flag     = true;
                        creation = creation2;
                    }
                }
            }
            if (flag)
            {
                if (creation != null)
                {
                    creation.IsActive = true;
                }
                this.IsActive = false;
            }
            return(flag);
        }
示例#7
0
        public string NameOfMissing()
        {
            string result = string.Empty;

            if (this.IsPermanentUnlocked)
            {
                return(string.Empty);
            }
            if (this.CreationTierNeeded > 0)
            {
                Creation creation = App.State.AllCreations.FirstOrDefault((Creation x) => x.TypeEnum == (Creation.CreationType) this.CreationTierNeeded);
                if (!creation.CanBuy)
                {
                    result = creation.Name;
                }
            }
            else if (this.GodDefeatedTierNeeded > 0)
            {
                if (App.State.Statistic.HighestGodDefeated >= this.GodDefeatedTierNeeded)
                {
                    result = string.Empty;
                }
                else if (this.GodDefeatedTierNeeded > 28)
                {
                    if (App.State.PrinnyBaal.Level + 28 <= this.GodDefeatedTierNeeded)
                    {
                        result = "P. Baal v " + (this.GodDefeatedTierNeeded - 28);
                    }
                }
                else
                {
                    Creation creation2 = App.State.AllCreations.FirstOrDefault((Creation x) => x.TypeEnum == (Creation.CreationType) this.GodDefeatedTierNeeded);
                    if (!creation2.GodToDefeat.IsDefeated)
                    {
                        result = creation2.GodToDefeat.Name;
                    }
                }
            }
            else if (this.PermanentGPCost > 0)
            {
                result = this.PermanentGPCost + string.Empty;
            }
            return(result);
        }
        public static bool HasCreations(GameState state, CreationCost cost, bool autobuy)
        {
            Creation creation = state.AllCreations.FirstOrDefault((Creation x) => x.TypeEnum == cost.TypeEnum);

            if (!(cost.CountNeeded > creation.Count))
            {
                return(true);
            }
            if (!autobuy || !creation.CanBuy)
            {
                return(false);
            }
            CDouble cDouble   = cost.CountNeeded - creation.Count;
            CDouble rightSide = cDouble * creation.BuyCost * (120 - state.PremiumBoni.AutoBuyCostReduction) / 100;

            if (state.Money >= rightSide)
            {
                state.Money    -= rightSide;
                creation.count += cDouble;
                state.Statistic.TotalMoneySpent += rightSide;
                return(true);
            }
            return(false);
        }
        internal static void Rebirth()
        {
            Monument monument3 = App.State.AllMonuments.FirstOrDefault((Monument x) => x.TypeEnum == Monument.MonumentType.black_hole);

            if (monument3 != null && monument3.Upgrade.Level > 0)
            {
                int num = monument3.Upgrade.Level.ToInt();
                if (num > 50)
                {
                    num = 50;
                }
                App.State.PremiumBoni.GodPower             += num;
                App.State.Statistic.GPFromBlackHoleUpgrade += num;
                GuiBase.ShowBigMessage("You received " + num + " God Power from your black hole upgrades!");
            }
            if (App.State.Statistic.HasStartedNoRbChallenge)
            {
                GuiBase.ShowToast("Because of your rebirth, you lost your No Rebirth Challenge!");
                App.State.Statistic.HasStartedNoRbChallenge = false;
            }
            App.State.Statistic.Last5RebirthTimes.Add(App.State.Statistic.TimePlayedSinceRebirth);
            if (App.State.Statistic.Last5RebirthTimes.Count > 5)
            {
                App.State.Statistic.Last5RebirthTimes.RemoveAt(0);
            }
            bool    shouldSubmitScore = App.State.ShouldSubmitScore;
            CDouble cDouble           = App.State.Statistic.ApplyTimeMulti(App.State.Multiplier.RebirthMulti * App.State.Statistic.StatisticRebirthMultiplier);

            if (App.State.Statistic.AvgTimeLastRebirths() < 900 || App.State.Statistic.RandomDividerLastRebirth < 1)
            {
                App.State.Statistic.CalcuRandomDivider();
            }
            else
            {
                App.State.Statistic.RandomDividerLastRebirth = 1;
            }
            bool flag = false;

            foreach (Creation current in App.State.AllCreations)
            {
                if (current.GodToDefeat.IsDefeated)
                {
                    App.State.Statistic.GodDefeatedBeforeRebirth = current.GodToDefeat.Name;
                    if (current.TypeEnum == Creation.CreationType.Universe)
                    {
                        flag = true;
                    }
                }
            }
            if (flag)
            {
                App.State.Statistic.GodDefeatedBeforeRebirth = "P. Baal v " + (App.State.PrinnyBaal.Level - 1);
            }
            string  base64String = App.State.Statistic.Serialize();
            CDouble cDouble2     = App.State.Ext.AfkGame.ExpMulti;
            CDouble cDouble3     = App.State.Ext.AfkGame.Power.Level / 10000000;

            if (cDouble3 > 1)
            {
                cDouble3 = 1;
            }
            cDouble2 += cDouble3;
            CDouble                 achievementMultiPhysical = App.State.Multiplier.MultiBoniPhysicalRebirth * cDouble;
            CDouble                 achievementMultiMystic   = App.State.Multiplier.MultiBoniMysticRebirth * cDouble;
            CDouble                 achievementMultiBattle   = App.State.Multiplier.MultiBoniBattleRebirth * cDouble;
            CDouble                 achievementMultiCreating = App.State.Multiplier.MultiBoniCreatingRebirth * cDouble;
            int                     maxShadowClonesRebirth   = App.State.Clones.MaxShadowClonesRebirth;
            int                     absoluteMaximum          = App.State.Clones.AbsoluteMaximum;
            Premium                 premiumBoni  = App.State.PremiumBoni;
            AvatarOptions           avatar       = App.State.Avatar;
            List <Monument>         allMonuments = App.State.AllMonuments;
            List <GeneratorUpgrade> upgrades     = App.State.Generator.Upgrades;
            PlayerKredProblems      kredProblems = App.State.KredProblems;
            Planet                  homePlanet   = App.State.HomePlanet;
            long                    creatingSpeedBoniDuration = App.State.CreatingSpeedBoniDuration;
            string                  avatarName          = App.State.AvatarName;
            List <float>            randomValues        = App.State.Ext.RandomValues;
            int                     currentRandomNumber = App.State.Ext.CurrentRandomNumber;
            Critical                crits = App.State.Crits;

            crits.Eyes         = crits.Eyes * App.State.PremiumBoni.TbsProgressAfterRebirth / 100;
            crits.Feet         = crits.Feet * App.State.PremiumBoni.TbsProgressAfterRebirth / 100;
            crits.Mouth        = crits.Mouth * App.State.PremiumBoni.TbsProgressAfterRebirth / 100;
            crits.Tail         = crits.Tail * App.State.PremiumBoni.TbsProgressAfterRebirth / 100;
            crits.Wings        = crits.Wings * App.State.PremiumBoni.TbsProgressAfterRebirth / 100;
            crits.EyesNoMirror = crits.EyesNoMirror * App.State.PremiumBoni.TbsProgressAfterRebirth / 100;
            List <Creation> allCreations        = App.State.AllCreations;
            Settings        gameSettings        = App.State.GameSettings;
            string          kongUserId          = App.State.KongUserId;
            string          kongUserName        = App.State.KongUserName;
            string          steamId             = App.State.SteamId;
            string          steamName           = App.State.SteamName;
            string          androidId           = App.State.AndroidId;
            string          androidName         = App.State.AndroidName;
            bool            isSocialDialogShown = App.State.IsSocialDialogShown;
            List <Skill>    allSkills           = App.State.AllSkills;
            List <Pet>      allPets             = App.State.Ext.AllPets;

            foreach (Pet current2 in allPets)
            {
                current2.FeedTimer        = 43200000L;
                current2.Exp              = 0;
                current2.Level            = 1;
                current2.ShadowCloneCount = 0;
                current2.CloneBattle      = 1;
                current2.CloneMystic      = 1;
                current2.ClonePhysical    = 1;
                current2.CalculateValues();
            }
            State2       ext                          = App.State.Ext;
            List <Might> allMights                    = App.State.AllMights;
            long         timeStampGameClosed          = App.State.TimeStampGameClosed;
            long         timeStampGameClosedOfflineMS = App.State.TimeStampGameClosedOfflineMS;
            CDouble      cDouble4                     = 0;

            foreach (Crystal current3 in App.State.Ext.Factory.EquippedCrystals)
            {
                CDouble cDouble5 = current3.Level;
                if (current3.Type == ModuleType.Ultimate)
                {
                    cDouble5 *= 2;
                }
                if (current3.Type == ModuleType.God)
                {
                    cDouble5 *= 3;
                }
                cDouble4 += cDouble5;
            }
            App.State = new GameState(true, App.State.Statistic.AchievementChallengesFinished.ToInt());
            App.State.GameSettings.AutofillDefenders = false;
            App.State.TimeStampGameClosed            = timeStampGameClosed;
            App.State.TimeStampGameClosedOfflineMS   = timeStampGameClosedOfflineMS;
            App.State.Ext.AfkGame.InitExpCost();
            App.State.Ext.SteamCurrency               = ext.SteamCurrency;
            App.State.Ext.SteamCountry                = ext.SteamCountry;
            App.State.Ext.TimeSinceSteam              = ext.TimeSinceSteam;
            App.State.Ext.AdPoints                    = ext.AdPoints;
            App.State.Ext.AdsWatched                  = ext.AdsWatched;
            App.State.Ext.TotalAdsWatched             = ext.TotalAdsWatched;
            App.State.Ext.ImportedSaveFromKongToSteam = ext.ImportedSaveFromKongToSteam;
            App.State.Ext.KongConvertId               = ext.KongConvertId;
            App.State.Ext.TwitterClicked              = ext.TwitterClicked;
            App.State.Ext.FacebookClicked             = ext.FacebookClicked;
            App.State.Ext.PetIdInAvatar               = ext.PetIdInAvatar;
            App.State.Ext.Lucky            = ext.Lucky;
            App.State.Ext.RateDialogShown  = ext.RateDialogShown;
            App.State.Ext.PetStonesSpent   = ext.PetStonesSpent;
            App.State.Ext.AfkGame.ExpMulti = cDouble2;
            App.State.KongUserId           = kongUserId;
            App.State.KongUserName         = kongUserName;
            App.State.SteamId             = steamId;
            App.State.SteamName           = steamName;
            App.State.AndroidId           = androidId;
            App.State.AndroidName         = androidName;
            App.State.IsTutorialShown     = true;
            App.State.IsGuestMsgShown     = true;
            App.State.IsSocialDialogShown = isSocialDialogShown;
            App.State.Multiplier.AchievementMultiPhysical = achievementMultiPhysical;
            App.State.Multiplier.AchievementMultiMystic   = achievementMultiMystic;
            App.State.Multiplier.AchievementMultiBattle   = achievementMultiBattle;
            App.State.Multiplier.AchievementMultiCreating = achievementMultiCreating;
            App.State.Clones.MaxShadowClones         = maxShadowClonesRebirth;
            App.State.Clones.AbsoluteMaximum         = absoluteMaximum;
            App.State.Multiplier.GodMultiFromRebirth = cDouble;
            App.State.Statistic = Statistic.FromString(base64String);
            Statistic expr_981 = App.State.Statistic;

            expr_981.TotalRebirths = ++expr_981.TotalRebirths;
            App.State.Statistic.TimePlayedSinceRebirth = 0L;
            App.State.Statistic.BlackHoleGPTimer       = 0;
            App.State.Ext.AfkGame.Exp = App.State.Statistic.TotalRebirths * 30 * App.State.Ext.AfkGame.ExpMulti;
            App.State.AddMultisFromGod();
            App.State.KredProblems = kredProblems;
            App.State.Crits        = crits;
            App.State.CreatingSpeedBoniDuration = creatingSpeedBoniDuration;
            int num2 = App.State.Statistic.TotalShadowClonesCreated.ToInt() / 1000;

            if (num2 > 950)
            {
                num2 = 950;
            }
            App.State.CloneAttackDivider = 1000 - num2;
            int num3 = App.State.Statistic.TotalShadowClonesDied.ToInt() / 500;

            if (num3 > 950)
            {
                num3 = 950;
            }
            App.State.CloneDefenseDivider = 1000 - num3;
            App.State.CloneHealthDivider  = 1000 - num3;
            App.State.InitAchievementNames();
            App.State.PremiumBoni = premiumBoni;
            App.State.PremiumBoni.ChakraPillV2InUse    = false;
            App.State.PremiumBoni.GodlyLiquidV2InUse   = false;
            App.State.PremiumBoni.TotalMightIsUnlocked = false;
            App.State.PremiumBoni.CrystalGPTimeCurrent = 0;
            App.State.PremiumBoni.CrystalPower        += cDouble4;
            App.State.ShouldSubmitScore             = shouldSubmitScore;
            App.State.GameSettings                  = gameSettings;
            App.State.GameSettings.AutoBuyCreations = false;
            App.State.Avatar                  = avatar;
            App.State.Ext.RandomValues        = randomValues;
            App.State.Ext.CurrentRandomNumber = currentRandomNumber;
            using (List <Creation> .Enumerator enumerator4 = App.State.AllCreations.GetEnumerator())
            {
                while (enumerator4.MoveNext())
                {
                    Creation creation  = enumerator4.Current;
                    Creation creation3 = allCreations.FirstOrDefault((Creation x) => x.TypeEnum == creation.TypeEnum);
                    if (creation3 != null)
                    {
                        creation.GodToDefeat.IsDefeatedForFirstTime = creation3.GodToDefeat.IsDefeatedForFirstTime;
                        creation.GodToDefeat.IsDefeatedPetChallenge = creation3.GodToDefeat.IsDefeatedPetChallenge;
                        creation.NextAtCount = creation3.NextAtCount;
                        creation.AutoBuy     = creation3.AutoBuy;
                    }
                }
            }
            using (List <Skill> .Enumerator enumerator5 = App.State.AllSkills.GetEnumerator())
            {
                while (enumerator5.MoveNext())
                {
                    Skill element = enumerator5.Current;
                    Skill skill   = allSkills.FirstOrDefault((Skill x) => x.EnumValue == element.EnumValue);
                    if (skill != null)
                    {
                        element.Extension.KeyPress   = skill.Extension.KeyPress;
                        element.Extension.UsageCount = skill.Extension.UsageCount;
                    }
                }
            }
            using (List <Monument> .Enumerator enumerator6 = App.State.AllMonuments.GetEnumerator())
            {
                while (enumerator6.MoveNext())
                {
                    Monument monument  = enumerator6.Current;
                    Monument monument2 = allMonuments.FirstOrDefault((Monument x) => x.TypeEnum == monument.TypeEnum);
                    if (monument2 != null)
                    {
                        monument.StopAtString         = monument2.StopAtString;
                        monument.Upgrade.StopAtString = monument2.Upgrade.StopAtString;
                    }
                }
            }
            using (List <GeneratorUpgrade> .Enumerator enumerator7 = App.State.Generator.Upgrades.GetEnumerator())
            {
                while (enumerator7.MoveNext())
                {
                    GeneratorUpgrade divGenUpgrade    = enumerator7.Current;
                    GeneratorUpgrade generatorUpgrade = upgrades.FirstOrDefault((GeneratorUpgrade x) => x.type == divGenUpgrade.type);
                    if (generatorUpgrade != null)
                    {
                        divGenUpgrade.StopAt = generatorUpgrade.StopAt;
                    }
                }
            }
            using (List <Might> .Enumerator enumerator8 = App.State.AllMights.GetEnumerator())
            {
                while (enumerator8.MoveNext())
                {
                    Might might  = enumerator8.Current;
                    Might might2 = allMights.FirstOrDefault((Might x) => x.TypeEnum == might.TypeEnum);
                    if (might2 != null)
                    {
                        might.NextAt = might2.NextAt;
                    }
                }
            }
            App.State.Ext.PetPowerMultiCampaigns = ext.PetPowerMultiCampaigns;
            App.State.Ext.PetPowerMultiGods      = ext.PetPowerMultiGods;
            App.State.Ext.PetStones    = ext.PetStones;
            App.State.Ext.AllCampaigns = ext.AllCampaigns;
            foreach (PetCampaign current4 in App.State.Ext.AllCampaigns)
            {
                current4.Cancel();
            }
            App.State.AvatarName                           = avatarName;
            App.State.HomePlanet.IsCreated                 = homePlanet.IsCreated;
            App.State.HomePlanet.UpgradeLevel              = homePlanet.UpgradeLevel;
            App.State.HomePlanet.UltimateBeings            = UltimateBeing.Initial;
            App.State.HomePlanet.UltimateBeingsV2          = UltimateBeingV2.Initial;
            App.State.HomePlanet.UpgradeLevelArtyChallenge = homePlanet.UpgradeLevelArtyChallenge;
            if (App.State.Statistic.UltimateBaalChallengesFinished > 0 || App.State.Statistic.ArtyChallengesFinished > 0)
            {
                App.State.HomePlanet.UltimateBeingsV2[0].IsAvailable   = true;
                App.State.HomePlanet.UltimateBeingsV2[0].TimesDefeated = homePlanet.UltimateBeingsV2[0].TimesDefeated;
                App.State.HomePlanet.UltimateBeingsV2[1].TimesDefeated = homePlanet.UltimateBeingsV2[1].TimesDefeated;
                App.State.HomePlanet.UltimateBeingsV2[2].TimesDefeated = homePlanet.UltimateBeingsV2[2].TimesDefeated;
                App.State.HomePlanet.UltimateBeingsV2[3].TimesDefeated = homePlanet.UltimateBeingsV2[3].TimesDefeated;
                App.State.HomePlanet.UltimateBeingsV2[4].TimesDefeated = homePlanet.UltimateBeingsV2[4].TimesDefeated;
            }
            App.State.HomePlanet.InitUBMultipliers();
            App.State.HomePlanet.TotalGainedGodPower = homePlanet.TotalGainedGodPower;
            using (List <UltimateBeing> .Enumerator enumerator10 = App.State.HomePlanet.UltimateBeings.GetEnumerator())
            {
                while (enumerator10.MoveNext())
                {
                    UltimateBeing being         = enumerator10.Current;
                    UltimateBeing ultimateBeing = homePlanet.UltimateBeings.FirstOrDefault((UltimateBeing x) => x.Tier == being.Tier);
                    being.IsAvailable = ultimateBeing.IsAvailable;
                    being.ComeBack();
                    being.HPPercent = 0.0;
                }
            }
            App.State.GameSettings.AutoBuyCreations = false;
            App.State.GameSettings.AutoBuyCreationsForMonumentsBeforeRebirth = App.State.GameSettings.AutoBuyCreationsForMonuments;
            App.State.GameSettings.AutoBuyCreationsForMonuments = false;
            foreach (UltimateBeingV2 current5 in App.State.HomePlanet.UltimateBeingsV2)
            {
                current5.IsDefeated = false;
            }
            App.State.Ext.AllPets = allPets;
            if (App.State.PremiumBoni.PetFoodAfterRebirth)
            {
                App.State.Ext.PunyFood   = ext.PunyFood;
                App.State.Ext.MightyFood = ext.MightyFood;
                App.State.Ext.StrongFood = ext.StrongFood;
            }
            App.State.Ext.Chocolate = ext.Chocolate;
            App.State.Statistic.CalculateTotalPetGrowth(App.State.Ext.AllPets);
            App.SaveGameState();
            Creation creation2 = App.State.AllCreations.FirstOrDefault((Creation x) => x.TypeEnum == Creation.CreationType.Shadow_clone);

            App.State.GameSettings.LastCreation = creation2;
            if (creation2 != null)
            {
                creation2.IsActive = true;
            }
            if (App.State.Statistic.HasStartedUltimateBaalChallenge && App.State.Statistic.CountRebirthsInUBC)
            {
                Statistic expr_133F = App.State.Statistic;
                expr_133F.RebirthsAfterUBC = ++expr_133F.RebirthsAfterUBC;
            }
            if (App.State.Statistic.HasStartedArtyChallenge)
            {
                Statistic expr_136D = App.State.Statistic;
                expr_136D.RebirthsAfterUAC = ++expr_136D.RebirthsAfterUAC;
                if (App.State.Statistic.RebirthsAfterUAC > 5)
                {
                    App.State.Statistic.HasStartedArtyChallenge = false;
                    App.State.Statistic.RebirthsAfterUAC        = 0;
                    App.State.Statistic.TimeAfterUACStarted     = 0;
                    App.State.HomePlanet.IsCreated = true;
                    if (App.State.HomePlanet.UpgradeLevelArtyChallenge > App.State.HomePlanet.UpgradeLevel)
                    {
                        App.State.HomePlanet.UpgradeLevel = App.State.HomePlanet.UpgradeLevelArtyChallenge;
                    }
                    if (App.State.Statistic.UniverseChallengesFinished > 0 && App.State.HomePlanet.UpgradeLevel < App.State.Statistic.UniverseChallengesFinished + 5)
                    {
                        App.State.HomePlanet.UpgradeLevel = App.State.Statistic.UniverseChallengesFinished + 5;
                    }
                    App.State.HomePlanet.UpgradeLevelArtyChallenge = 0;
                    foreach (UltimateBeing current6 in App.State.HomePlanet.UltimateBeings)
                    {
                        if (current6.Tier <= App.State.HomePlanet.UpgradeLevel)
                        {
                            current6.IsAvailable = true;
                        }
                    }
                    Premium premiumBoni2 = App.State.PremiumBoni;
                    App.State.PremiumBoni = Premium.FromString(App.State.Statistic.PremiumStatsBeforeUBCChallenge);
                    App.State.PremiumBoni.AddPremiumAfterChallenge(premiumBoni2);
                    App.State.Statistic.PremiumStatsBeforeUBCChallenge = string.Empty;
                    App.State.Statistic.HighestGodInUAC = 0;
                    App.State.Clones.AbsoluteMaximum    = App.State.Statistic.AbsoluteMaxClonesBeforeUBCChallenge.ToInt();
                    App.State.Clones.MaxShadowClones    = App.State.Statistic.MaxClonesBeforeUBCChallenge.ToInt();
                    string[] array = App.State.Statistic.SkillUsageCountBeforeUAC.Split(new char[]
                    {
                        ','
                    });
                    for (int i = 0; i < array.Length; i++)
                    {
                        int num4 = 0;
                        int.TryParse(array[i], out num4);
                        if (App.State.AllSkills.Count > i)
                        {
                            App.State.AllSkills[i].Extension.UsageCount += (long)num4;
                        }
                    }
                    App.State.Statistic.SkillUsageCountBeforeUAC = string.Empty;
                    App.State.PremiumBoni.CheckIfGPIsAdjusted();
                    App.SaveGameState();
                    GuiBase.ShowToast("Your Challenge failed! You received back the God Power and God Power upgrades you had before the challenge.");
                }
            }
            Leaderboards.SubmitStat(LeaderBoardType.Rebirths, App.State.Statistic.TotalRebirths.ToInt(), false);
            SpecialFightUi.SortSkills();
            TBSUi.Reset();
            PlanetUi.Instance.Reset();
            if (!App.State.Statistic.HasStartedUltimateBaalChallenge && !App.State.Statistic.HasStartedArtyChallenge && App.State.Statistic.HighestGodDefeated > 3 && !App.State.IsSocialDialogShown)
            {
                MainUi.ShowSocialDialog = true;
            }
            MainUi.Instance.Init(true);
        }
        internal static Settings FromString(string base64String)
        {
            if (string.IsNullOrEmpty(base64String))
            {
                return(new Settings());
            }
            string[] parts    = Conv.StringPartsFromBase64(base64String, "Settings");
            Settings settings = new Settings();

            settings.StopClonesAtTrainings        = Conv.getIntFromParts(parts, "a");
            settings.StopClonesAtSkills           = Conv.getIntFromParts(parts, "b");
            settings.AutoAddClones                = Conv.getStringFromParts(parts, "c").ToLower().Equals("true");
            settings.IsStopAtOnSkills             = Conv.getStringFromParts(parts, "d").ToLower().Equals("true");
            settings.IsStopAtOnTrainings          = Conv.getStringFromParts(parts, "e").ToLower().Equals("true");
            settings.LastCreation                 = Creation.FromString(Conv.getStringFromParts(parts, "g"));
            settings.SyncScrollbars               = Conv.getStringFromParts(parts, "i").ToLower().Equals("true");
            settings.ShowAchievementPopups        = Conv.getStringFromParts(parts, "j").ToLower().Equals("true");
            settings.Framerate                    = Conv.getIntFromParts(parts, "k");
            settings.AutoBuyCreations             = Conv.getStringFromParts(parts, "l").ToLower().Equals("true");
            settings.AutoBuyCreationsForMonuments = Conv.getStringFromParts(parts, "m").ToLower().Equals("true");
            settings.UseStopAt                    = Conv.getStringFromParts(parts, "n").ToLower().Equals("true");
            settings.TooltipMode                  = Conv.getIntFromParts(parts, "o");
            settings.UseExponentNumbers           = Conv.getStringFromParts(parts, "p").ToLower().Equals("true");
            settings.UIStyle                    = Conv.getIntFromParts(parts, "q");
            settings.CustomColor                = Conv.getStringFromParts(parts, "r");
            settings.StopMonumentBuilding       = Conv.getStringFromParts(parts, "s").ToLower().Equals("true");
            settings.ShowToolTipsOnTop          = Conv.getStringFromParts(parts, "t").ToLower().Equals("true");
            settings.CreationToCreateCount      = Conv.getIntFromParts(parts, "u");
            settings.AutoFightIsOn              = Conv.getStringFromParts(parts, "v").ToLower().Equals("true");
            settings.ShowToolTipsOnRightClick   = Conv.getStringFromParts(parts, "w").ToLower().Equals("true");
            settings.IgnoreCloneCountOn         = Conv.getStringFromParts(parts, "x").ToLower().Equals("true");
            settings.TrainIgnoreCount           = Conv.getIntFromParts(parts, "y");
            settings.CreateShadowClonesIfNotMax = Conv.getStringFromParts(parts, "z").ToLower().Equals("true");
            settings.TBSEyesIsMirrored          = Conv.getStringFromParts(parts, "A").ToLower().Equals("true");
            settings.ClonesToAddCount           = Conv.getIntFromParts(parts, "D");
            settings.NextFightIf1Cloned         = Conv.getStringFromParts(parts, "E").ToLower().Equals("true");
            settings.AchievementsOnTop          = Conv.getStringFromParts(parts, "F").ToLower().Equals("true");
            settings.SoundOn                    = Conv.getStringFromParts(parts, "G").ToLower().Equals("true");
            settings.SavedClonesForFight        = Conv.getIntFromParts(parts, "H");
            settings.StickyClones               = Conv.getStringFromParts(parts, "I").ToLower().Equals("true");
            settings.CustomBackground           = Conv.getStringFromParts(parts, "J");
            settings.ProgressbarType            = Conv.getIntFromParts(parts, "K");
            settings.SpecialFightSkillsSorted   = Conv.getStringFromParts(parts, "L").ToLower().Equals("true");
            settings.CreationsNextAtCreated     = Conv.getStringFromParts(parts, "M").ToLower().Equals("true");
            settings.StopDivinityGenBuilding    = Conv.getStringFromParts(parts, "N").ToLower().Equals("true");
            settings.CreationsNextAtMode        = Conv.getIntFromParts(parts, "O");
            settings.DivGenCreatiosToAdd        = Conv.getLongFromParts(parts, "P");
            settings.ChooseCreationIsOpen       = Conv.getStringFromParts(parts, "Q").ToLower().Equals("true");
            settings.AvaScaled                  = Conv.getStringFromParts(parts, "R").ToLower().Equals("true");
            settings.PetDistribution            = Conv.getIntFromParts(parts, "S");
            settings.AutoBuyForCrystal          = Conv.getStringFromParts(parts, "T").ToLower().Equals("true");
            settings.MaxDefenderClones          = Conv.getIntFromParts(parts, "U");
            settings.AutofillDefenders          = Conv.getStringFromParts(parts, "V").ToLower().Equals("true");
            settings.FontType                   = Conv.getIntFromParts(parts, "W");
            settings.MaxAfterEquipCrystal       = Conv.getStringFromParts(parts, "X").ToLower().Equals("true");
            settings.AutoBuyCreationsForDivGen  = Conv.getStringFromParts(parts, "Y").ToLower().Equals("true");
            settings.LastSelectedGrowth         = (Growth)Conv.getIntFromParts(parts, "Z");
            settings.LastHoursForCampaigns      = Conv.getIntFromParts(parts, NS.n1.Nr());
            settings.SyncTrainingSkill          = Conv.getStringFromParts(parts, NS.n2.Nr()).ToLower().Equals("true");
            settings.HideMaxedChallenges        = Conv.getStringFromParts(parts, NS.n3.Nr()).ToLower().Equals("true");
            if (settings.TrainIgnoreCount == 0)
            {
                settings.TrainIgnoreCount = 1;
            }
            return(settings);
        }
示例#11
0
 public new bool UpdateDuration(long ms)
 {
     if (this.ShadowCloneCount == 0)
     {
         return(false);
     }
     if (this.Level >= this.StopAt && this.StopAt != 0)
     {
         CDouble shadowCloneCount = this.ShadowCloneCount;
         App.State.Clones.RemoveUsedShadowClones(shadowCloneCount);
         this.ShadowCloneCount = 0;
         Monument monument = App.State.AllMonuments.FirstOrDefault((Monument x) => x.TypeEnum == this.type + 1);
         if (monument != null && monument.StopAt > 0)
         {
             monument.AddCloneCount(shadowCloneCount);
         }
         return(false);
     }
     if (!this.IsPaid)
     {
         bool          flag          = false;
         StringBuilder stringBuilder = new StringBuilder("You still need:\n");
         using (List <CreationCost> .Enumerator enumerator = this.RequiredCreations.GetEnumerator())
         {
             while (enumerator.MoveNext())
             {
                 CreationCost cost     = enumerator.Current;
                 Creation     creation = App.State.AllCreations.FirstOrDefault((Creation x) => x.TypeEnum == cost.TypeEnum);
                 if (cost.CountNeeded > creation.Count)
                 {
                     if (App.State.GameSettings.AutoBuyCreationsForMonuments && creation.CanBuy)
                     {
                         CDouble cDouble   = cost.CountNeeded - creation.Count;
                         CDouble rightSide = cDouble * creation.BuyCost * (120 - App.State.PremiumBoni.AutoBuyCostReduction) / 100;
                         if (App.State.Money >= rightSide)
                         {
                             App.State.Money -= rightSide;
                             creation.count  += cDouble;
                             App.State.Statistic.TotalMoneySpent += rightSide;
                         }
                         else
                         {
                             flag = true;
                             stringBuilder.Append(creation.Name).Append(" x ").Append((cost.CountNeeded - creation.Count).ToGuiText(true)).Append("\n");
                         }
                     }
                     else
                     {
                         flag = true;
                         stringBuilder.Append(creation.Name).Append(" x ").Append((cost.CountNeeded - creation.Count).ToGuiText(true)).Append("\n");
                     }
                 }
             }
         }
         if (flag)
         {
             stringBuilder.Append("to upgrade ").Append(EnumName.Name(this.type)).ToString();
             if (!App.State.GameSettings.StickyClones)
             {
                 GuiBase.ShowToast(stringBuilder.ToString());
                 App.State.Clones.RemoveUsedShadowClones(this.ShadowCloneCount);
                 this.ShadowCloneCount = 0;
             }
             else
             {
                 this.MissingItems = "\n\n" + stringBuilder.ToString();
             }
             return(false);
         }
         using (List <CreationCost> .Enumerator enumerator2 = this.RequiredCreations.GetEnumerator())
         {
             while (enumerator2.MoveNext())
             {
                 CreationCost cost      = enumerator2.Current;
                 Creation     creation2 = App.State.AllCreations.FirstOrDefault((Creation x) => x.TypeEnum == cost.TypeEnum);
                 creation2.Count -= cost.CountNeeded;
             }
         }
         this.IsPaid = true;
     }
     this.MissingItems     = string.Empty;
     this.CurrentDuration += (ms * (long)this.ShadowCloneCount.ToInt() * (long)App.State.PremiumBoni.MonumentBuildTimeDivider * (100 + App.State.PremiumBoni.BuildingSpeedUpPercent(true)) / 100).ToLong();
     if (this.CurrentDuration > this.DurationInMS(1))
     {
         if (App.State.GameSettings.StopMonumentBuilding)
         {
             App.State.Clones.RemoveUsedShadowClones(this.ShadowCloneCount);
             this.ShadowCloneCount = 0;
         }
         this.IsPaid          = false;
         this.CurrentDuration = 0L;
         return(true);
     }
     return(false);
 }
示例#12
0
 public new void UpdateDuration(long ms)
 {
     if (this.Upgrade.UpdateDuration(ms))
     {
         this.AddUpgradeLevel();
     }
     if (App.State == null || this.ShadowCloneCount == 0)
     {
         return;
     }
     if (this.Level >= this.StopAt && this.StopAt != 0)
     {
         CDouble shadowCloneCount = this.ShadowCloneCount;
         App.State.Clones.RemoveUsedShadowClones(shadowCloneCount);
         this.ShadowCloneCount = 0;
         if (this.Upgrade.StopAt > 0 && this.Upgrade.IsAvailable)
         {
             this.Upgrade.AddCloneCount(shadowCloneCount);
         }
         else
         {
             Monument monument = App.State.AllMonuments.FirstOrDefault((Monument x) => x.TypeEnum == this.TypeEnum + 1);
             if (monument != null && monument.StopAt > 0)
             {
                 monument.AddCloneCount(shadowCloneCount);
             }
         }
         return;
     }
     if (!this.IsPaid)
     {
         bool          flag          = false;
         StringBuilder stringBuilder = new StringBuilder("You still need:\n");
         using (List <CreationCost> .Enumerator enumerator = this.RequiredCreations(this.Level).GetEnumerator())
         {
             while (enumerator.MoveNext())
             {
                 CreationCost cost     = enumerator.Current;
                 Creation     creation = App.State.AllCreations.FirstOrDefault((Creation x) => x.TypeEnum == cost.TypeEnum);
                 cost.CountNeeded.Round();
                 creation.count.Round();
                 if (cost.CountNeeded > creation.Count)
                 {
                     if (App.State.IsBuyUnlocked && App.State.GameSettings.AutoBuyCreationsForMonuments && creation.CanBuy)
                     {
                         CDouble cDouble   = cost.CountNeeded - creation.Count;
                         CDouble rightSide = cDouble * creation.BuyCost * (120 - App.State.PremiumBoni.AutoBuyCostReduction) / 100;
                         if (App.State.Money >= rightSide)
                         {
                             App.State.Money -= rightSide;
                             creation.count  += cDouble;
                             App.State.Statistic.TotalMoneySpent += rightSide;
                         }
                         else
                         {
                             flag = true;
                             stringBuilder.Append(creation.Name).Append(" x ").Append((cost.CountNeeded - creation.Count).ToGuiText(true)).Append("\n");
                         }
                     }
                     else
                     {
                         flag = true;
                         stringBuilder.Append(creation.Name).Append(" x ").Append((cost.CountNeeded - creation.Count).ToGuiText(true)).Append("\n");
                     }
                 }
             }
         }
         if (flag)
         {
             stringBuilder.Append("to build ").Append(this.Name).ToString();
             if (!App.State.GameSettings.StickyClones)
             {
                 GuiBase.ShowToast(stringBuilder.ToString());
                 App.State.Clones.RemoveUsedShadowClones(this.ShadowCloneCount);
                 this.ShadowCloneCount = 0;
             }
             else
             {
                 this.MissingItems = "\n\n" + stringBuilder.ToString();
             }
             return;
         }
         using (List <CreationCost> .Enumerator enumerator2 = this.RequiredCreations(this.Level).GetEnumerator())
         {
             while (enumerator2.MoveNext())
             {
                 CreationCost cost      = enumerator2.Current;
                 Creation     creation2 = App.State.AllCreations.FirstOrDefault((Creation x) => x.TypeEnum == cost.TypeEnum);
                 creation2.Count -= cost.CountNeeded;
             }
         }
         this.IsPaid = true;
     }
     this.MissingItems     = string.Empty;
     this.CurrentDuration += (ms * (long)this.ShadowCloneCount.ToInt() * (long)App.State.PremiumBoni.MonumentBuildTimeDivider * (100 + App.State.PremiumBoni.BuildingSpeedUpPercent(true)) / 100).ToLong();
     if (this.CurrentDuration > this.DurationInMS(1))
     {
         this.CurrentDuration = 0L;
         this.Level           = ++this.Level;
         this.IsPaid          = false;
         Statistic expr_4D4 = App.State.Statistic;
         expr_4D4.MonumentsCreated = ++expr_4D4.MonumentsCreated;
         Leaderboards.SubmitStat(LeaderBoardType.Monuments, App.State.Statistic.MonumentsCreated.ToInt(), false);
         if (this.TypeEnum == Monument.MonumentType.temple_of_god && this.Level == 1)
         {
             GuiBase.ShowContentUnlocked("You can now build a divinity generator!");
         }
         this.AddStatBoni();
         if (App.State.GameSettings.StopMonumentBuilding)
         {
             App.State.Clones.RemoveUsedShadowClones(this.ShadowCloneCount);
             this.ShadowCloneCount = 0;
         }
         if (this.TypeEnum == Monument.MonumentType.temple_of_god)
         {
             App.State.Generator.IsAvailable = true;
         }
     }
 }
示例#13
0
 public new bool UpdateDuration(long ms)
 {
     if (this.ShadowCloneCount == 0)
     {
         return(false);
     }
     if (this.StopAt != 0 && this.StopAt <= this.Level)
     {
         App.State.Clones.RemoveUsedShadowClones(this.ShadowCloneCount);
         this.ShadowCloneCount = 0;
         return(false);
     }
     if (!this.IsPaid)
     {
         bool          flag          = false;
         StringBuilder stringBuilder = new StringBuilder("You still need:\n");
         using (List <CreationCost> .Enumerator enumerator = this.RequiredCreations.GetEnumerator())
         {
             while (enumerator.MoveNext())
             {
                 CreationCost cost     = enumerator.Current;
                 Creation     creation = App.State.AllCreations.FirstOrDefault((Creation x) => x.TypeEnum == cost.TypeEnum);
                 if (!CreationCost.HasCreations(App.State, cost, App.State.GameSettings.AutoBuyCreationsForDivGen))
                 {
                     flag = true;
                     stringBuilder.Append(creation.Name).Append(" x ").Append((cost.CountNeeded - creation.Count).ToGuiText(true)).Append("\n");
                 }
             }
         }
         if (flag)
         {
             if (!App.State.GameSettings.StickyClones)
             {
                 stringBuilder.Append("to upgrade ").Append(this.Name).ToString();
                 GuiBase.ShowToast(stringBuilder.ToString());
                 App.State.Clones.RemoveUsedShadowClones(this.ShadowCloneCount);
                 this.ShadowCloneCount = 0;
             }
             else
             {
                 this.MissingItems = "\n\n" + stringBuilder.ToString();
             }
             return(false);
         }
         using (List <CreationCost> .Enumerator enumerator2 = this.RequiredCreations.GetEnumerator())
         {
             while (enumerator2.MoveNext())
             {
                 CreationCost cost      = enumerator2.Current;
                 Creation     creation2 = App.State.AllCreations.FirstOrDefault((Creation x) => x.TypeEnum == cost.TypeEnum);
                 creation2.Count -= cost.CountNeeded;
             }
         }
         this.IsPaid = true;
     }
     this.MissingItems     = string.Empty;
     this.CurrentDuration += (ms * (long)this.ShadowCloneCount.ToInt() * (long)App.State.PremiumBoni.MonumentBuildTimeDivider * (100 + App.State.PremiumBoni.BuildingSpeedUpPercent(true)) / 100).ToLong();
     if (this.CurrentDuration > this.DurationInMS(1))
     {
         this.IsPaid          = false;
         this.CurrentDuration = 0L;
         this.Level           = ++this.Level;
         if (App.State.GameSettings.StopDivinityGenBuilding)
         {
             App.State.Clones.RemoveUsedShadowClones(this.ShadowCloneCount);
             this.ShadowCloneCount = 0;
         }
         return(true);
     }
     return(false);
 }
示例#14
0
        public void UpdateDuration(long ms)
        {
            if (App.State == null)
            {
                return;
            }
            if (!this.GodToDefeat.IsDefeated)
            {
                this.GodToDefeat.RecoverHealth(ms);
            }
            if (!this.IsActive)
            {
                return;
            }
            if (!this.GodToDefeat.IsDefeated)
            {
                this.FightGod(ms);
                if (this.GodToDefeat.IsDefeated)
                {
                    this.description = string.Empty;
                }
                return;
            }
            bool flag = this.NextAtCount != 0 && this.NextAtCount <= this.Count;

            if (App.State.GameSettings.CreationsNextAtMode == 2)
            {
                flag = (this.NextAtCount != 0 && this.NextAtCount <= this.TotalCreated);
            }
            if ((App.State.GameSettings.LastCreation != null && App.State.GameSettings.LastCreation.TypeEnum != this.TypeEnum) || App.State.GameSettings.CreationsNextAtMode == 0)
            {
                flag = false;
            }
            if (flag && this.TypeEnum != Creation.CreationType.Shadow_clone)
            {
                foreach (Creation current in App.State.AllCreations)
                {
                    current.IsActive = false;
                }
                Creation lastCreation = this;
                Creation creation     = App.State.AllCreations.First((Creation x) => x.TypeEnum == Creation.CreationType.Shadow_clone);
                if (this.TypeEnum == Creation.CreationType.Universe)
                {
                    lastCreation      = creation;
                    creation.IsActive = true;
                }
                else
                {
                    Creation creation2 = App.State.AllCreations.FirstOrDefault((Creation x) => x.TypeEnum == this.TypeEnum + 1);
                    if (creation2 != null && creation2.GodToDefeat.IsDefeated)
                    {
                        lastCreation       = creation2;
                        creation2.IsActive = true;
                    }
                    else
                    {
                        bool flag2 = false;
                        foreach (Creation current2 in App.State.AllCreations)
                        {
                            if (current2.GodToDefeat.IsDefeated && current2.NextAtCount == 0 && current2.TypeEnum != Creation.CreationType.Shadow_clone)
                            {
                                lastCreation      = current2;
                                current2.IsActive = true;
                                flag2             = true;
                                break;
                            }
                        }
                        if (!flag2)
                        {
                            lastCreation      = creation;
                            creation.IsActive = true;
                        }
                    }
                }
                App.State.GameSettings.LastCreation = lastCreation;
                return;
            }
            if (App.State.GameSettings.CreateShadowClonesIfNotMax && App.State.Clones.Count < App.State.Clones.MaxShadowClones && this.TypeEnum != Creation.CreationType.Shadow_clone)
            {
                this.oldActiveCreation = this;
                Creation creation3 = App.State.AllCreations.FirstOrDefault((Creation x) => x.TypeEnum == Creation.CreationType.Shadow_clone);
                creation3.IsActive = true;
                return;
            }
            if (this.oldActiveCreation != null)
            {
                this.IsActive = false;
                this.oldActiveCreation.IsActive = true;
                this.oldActiveCreation          = null;
            }
            int num = this.CheckCountNeeded();
            List <CreationCost> list = CreationCost.RequiredCreations(this.TypeEnum, (long)num, false);

            if (this.CheckPrerequesiteCost(list))
            {
                return;
            }
            this.currentDuration += App.State.CreationSpeed(ms);
            long durationInMS = this.DurationInMS;

            if (this.currentDuration > durationInMS)
            {
                this.currentDuration -= durationInMS;
                if (this.currentDuration > durationInMS)
                {
                    this.currentDuration = durationInMS;
                }
                using (List <CreationCost> .Enumerator enumerator3 = list.GetEnumerator())
                {
                    while (enumerator3.MoveNext())
                    {
                        CreationCost cost      = enumerator3.Current;
                        Creation     creation4 = App.State.AllCreations.FirstOrDefault((Creation x) => x.TypeEnum == cost.TypeEnum);
                        creation4.Count -= cost.CountNeeded;
                    }
                }
                CDouble rightSide = this.CreatingPowerGain() * (100 + (num - 1) * 5) / 100;
                App.State.CreatingPowerBase += rightSide;
                this.CanBuy        = true;
                this.Count        += num;
                this.TotalCreated += num;
                App.State.CheckForAchievement(this);
                if (this.TypeEnum != Creation.CreationType.Shadow_clone)
                {
                    App.State.Statistic.TotalCreations += num;
                }
                this.FinishUUC(App.State);
                if (App.State.GameSettings.LastCreation != null && App.State.GameSettings.LastCreation.TypeEnum != this.TypeEnum)
                {
                    Creation creation5 = App.State.AllCreations.FirstOrDefault((Creation x) => x.TypeEnum == App.State.GameSettings.LastCreation.TypeEnum);
                    this.IsActive      = false;
                    creation5.IsActive = true;
                }
            }
        }
        public void Fight(SkillUB2 skillUsed, bool playerSecondAttack)
        {
            string str  = string.Empty;
            int    num  = 0;
            int    num2 = 0;

            foreach (SkillUB2 current in this.LastUsedSkills)
            {
                if (current.TypeEnum == SkillTypeUBV2.GiveBaseCreation)
                {
                    num++;
                }
                if (current.TypeEnum == SkillTypeUBV2.GiveModifiedCreation)
                {
                    num2++;
                }
            }
            this.LastUsedSkills.Add(skillUsed);
            if (skillUsed.TypeEnum == SkillTypeUBV2.GiveBaseCreation)
            {
                Creation creation = App.State.AllCreations.FirstOrDefault((Creation x) => x.TypeEnum == this.Being.CreationNeeded);
                if (creation.Count < 1)
                {
                    this.LastUsedSkills.RemoveAt(this.LastUsedSkills.Count - 1);
                    str = "You did not have any " + creation.Name + "!";
                    this.UBAttack(playerSecondAttack);
                }
                else
                {
                    if ((this.LastUsedSkills.Count > 2 && this.LastUsedSkills[this.LastUsedSkills.Count - 2].TypeEnum == SkillTypeUBV2.GiveBaseCreation) || (this.LastUsedSkills.Count > 2 && this.LastUsedSkills[this.LastUsedSkills.Count - 2].TypeEnum == SkillTypeUBV2.GiveModifiedCreation))
                    {
                        this.LastUsedSkills.RemoveAt(this.LastUsedSkills.Count - 1);
                        str = this.Being.Name + " destroyed your " + creation.Name + "! He grew tired of it.";
                        this.UBAttack(playerSecondAttack);
                    }
                    else
                    {
                        this.Being.DamageReduction += 3;
                        if (this.Being.DamageReduction > 100)
                        {
                            this.Being.DamageReduction = 100;
                        }
                        str = this.Being.Name + " ate your " + creation.Name + ". His damage reduction was increased by 3%";
                    }
                    Creation expr_20B = creation;
                    expr_20B.Count = --expr_20B.Count;
                }
            }
            else if (skillUsed.TypeEnum == SkillTypeUBV2.GiveModifiedCreation)
            {
                if (this.Being.CreationCount < 1)
                {
                    this.LastUsedSkills.RemoveAt(this.LastUsedSkills.Count - 1);
                    str = "You did not have any " + this.Being.CreationName + "!";
                    this.UBAttack(playerSecondAttack);
                }
                else
                {
                    if (num2 > num * 2)
                    {
                        this.LastUsedSkills.RemoveAt(this.LastUsedSkills.Count - 1);
                        str = this.Being.Name + " destroyed your " + this.Being.CreationName + "! He was suspicious of it!";
                        this.UBAttack(playerSecondAttack);
                    }
                    else if ((this.LastUsedSkills.Count > 2 && this.LastUsedSkills[this.LastUsedSkills.Count - 2].TypeEnum == SkillTypeUBV2.GiveBaseCreation) || (this.LastUsedSkills.Count > 2 && this.LastUsedSkills[this.LastUsedSkills.Count - 2].TypeEnum == SkillTypeUBV2.GiveModifiedCreation))
                    {
                        this.LastUsedSkills.RemoveAt(this.LastUsedSkills.Count - 1);
                        str = this.Being.Name + " destroyed your " + this.Being.CreationName + "! He grew tired of it.";
                        this.UBAttack(playerSecondAttack);
                    }
                    else
                    {
                        this.Being.DamageReduction -= 5;
                        if (this.Being.DamageReduction < 0)
                        {
                            this.Being.DamageReduction = 0;
                        }
                        str = this.Being.Name + " ate your " + this.Being.CreationName + ". His damage reduction was reduced by 5%!";
                    }
                    UltimateBeingV2 expr_402 = this.Being;
                    expr_402.CreationCount = --expr_402.CreationCount;
                }
            }
            else if (skillUsed.TypeEnum == SkillTypeUBV2.AuraBall || skillUsed.TypeEnum == SkillTypeUBV2.IonioiHeroSummon || skillUsed.TypeEnum == SkillTypeUBV2.BigBang)
            {
                CDouble cDouble = skillUsed.Damage * (100 - this.Being.DamageReduction) / 100;
                if (this.DoubleUp)
                {
                    cDouble      *= 2;
                    this.DoubleUp = false;
                }
                cDouble  = cDouble * this.Damage / 100;
                cDouble  = (double)UnityEngine.Random.Range((float)cDouble.ToInt() * 0.9f, (float)cDouble.ToInt() * 1.1f);
                cDouble /= 0.5 + (double)(this.Being.Tier / 2);
                this.Being.HPPercent -= cDouble;
                this.InfoText         = this.InfoText + " and caused " + cDouble.ToGuiText(true) + " % damage.";
                this.UBAttack(playerSecondAttack);
            }
            else
            {
                this.UBAttack(playerSecondAttack);
            }
            this.InfoText = this.InfoText + "\n" + str;
        }
        public void start(UltimateBeingV2 ub)
        {
            this.TurnCount             = 1;
            this.Being                 = ub;
            this.Being.DamageReduction = 100;
            this.LastUsedSkills        = new List <SkillUB2>();
            this.PlayerHp              = App.State.CurrentHealth;
            this.PlayerEnergy          = 1000;
            this.IsFighting            = true;
            this.DoubleUp              = false;
            this.DamageBlock           = false;
            this.DamageReflect         = false;
            this.HitchanceBonus        = 0;
            this.DodgeChance           = 0;
            this.CounterChance         = 0;
            this.MysticMode            = null;
            this.TransformationAura    = null;
            this.GodSpeedModeDuration  = 0;
            this.Being.PowerUp         = false;
            this.InfoText              = string.Empty;
            this.PlayerSkills          = new List <SkillUB2>();
            this.PlayerSkills.Add(new SkillUB2
            {
                Name         = "Mystic Mode",
                Desc         = "50% more attack and 25% damage reduction for 6 turns",
                TypeEnum     = SkillTypeUBV2.MysticMode,
                EnergyCost   = 30,
                BuffDuration = 6,
                Buff         = 50
            });
            this.PlayerSkills.Add(new SkillUB2
            {
                Name         = "Transformation aura",
                Desc         = "100 % more attack and 50% damage reduction for 5 turns",
                TypeEnum     = SkillTypeUBV2.TransformationAura,
                EnergyCost   = 80,
                BuffDuration = 5,
                Buff         = 100
            });
            this.PlayerSkills.Add(new SkillUB2
            {
                Name       = "God Speed",
                Desc       = "Do 2 actions in one turn for the next 4 turns",
                TypeEnum   = SkillTypeUBV2.GodSpeed,
                EnergyCost = 150,
                IncreaseActionsDuration = 8
            });
            this.PlayerSkills.Add(new SkillUB2
            {
                Name         = "Elemental manipulation",
                Desc         = "Doubles the damage of the next attack",
                TypeEnum     = SkillTypeUBV2.ElementalManipulation,
                EnergyCost   = 30,
                DoubleDamage = true
            });
            this.PlayerSkills.Add(new SkillUB2
            {
                Name          = "Reflection barrier",
                Desc          = "Reflect the next attack",
                TypeEnum      = SkillTypeUBV2.ReflectionBarrier,
                EnergyCost    = 200,
                ReflectDamage = true
            });
            this.PlayerSkills.Add(new SkillUB2
            {
                Name               = "Clairvoyance",
                Desc               = "65% chance to dodge and counter the next attack",
                TypeEnum           = SkillTypeUBV2.Clairvoyance,
                EnergyCost         = 100,
                DodgeCounterChance = 65
            });
            this.PlayerSkills.Add(new SkillUB2
            {
                Name       = "Focused breathing",
                Desc       = "Recover 15% of hp",
                TypeEnum   = SkillTypeUBV2.FocusedBreathing,
                EnergyCost = -60,
                HealPerc   = 15
            });
            this.PlayerSkills.Add(new SkillUB2
            {
                Name       = "Aura Ball",
                Desc       = "Attack with an aura ball",
                TypeEnum   = SkillTypeUBV2.AuraBall,
                EnergyCost = 20,
                Damage     = 2
            });
            this.PlayerSkills.Add(new SkillUB2
            {
                Name       = "Big Bang",
                Desc       = "Attack with big bang, twice as much damage as aura ball",
                TypeEnum   = SkillTypeUBV2.BigBang,
                EnergyCost = 40,
                Damage     = 4,
                HealPerc   = -10
            });
            this.PlayerSkills.Add(new SkillUB2
            {
                Name       = "lonioi hero summon",
                Desc       = "Damage depending on your highest god defeated",
                TypeEnum   = SkillTypeUBV2.IonioiHeroSummon,
                EnergyCost = App.State.Statistic.HighestGodDefeated * 1.8,
                Damage     = App.State.Statistic.HighestGodDefeated / 10
            });
            Creation creation = App.State.AllCreations.FirstOrDefault((Creation x) => x.TypeEnum == ub.CreationNeeded);

            this.PlayerSkills.Add(new SkillUB2
            {
                Name       = "Give " + creation.Name,
                Desc       = "Gives away one " + creation.Name,
                TypeEnum   = SkillTypeUBV2.GiveBaseCreation,
                EnergyCost = -20
            });
            this.PlayerSkills.Add(new SkillUB2
            {
                Name       = "Give " + ub.CreationName,
                Desc       = "Gives away one " + ub.CreationName,
                TypeEnum   = SkillTypeUBV2.GiveModifiedCreation,
                EnergyCost = -20
            });
            foreach (SkillUB2 current in this.PlayerSkills)
            {
                if (current.EnergyCost > 0)
                {
                    current.Desc = current.Desc + "\nEnergy cost: " + current.EnergyCost.ToGuiText(true);
                }
                else if (current.EnergyCost < 0)
                {
                    current.Desc = current.Desc + "\nRecovers " + current.EnergyCost.ToGuiText(true) + " energy";
                }
                if (current.HealPerc < 0)
                {
                    current.Desc = current.Desc + "\nReduces your hp by " + (current.HealPerc * -1).ToGuiText(true) + " %";
                }
                if (current.Damage > 0)
                {
                    current.Desc = current.Desc + "\nBase Damage: " + current.Damage.ToGuiText(false);
                }
            }
        }
示例#17
0
 public void UpdateDuration(long ms)
 {
     if (App.State == null)
     {
         return;
     }
     if (this.CreationDuration == 0)
     {
         this.InitDuration(App.State);
     }
     if (this.isCreating)
     {
         if (App.State.CreatingPowerBase <= 0)
         {
             GuiBase.ShowToast("You need more creating power to create a " + this.CreationName);
             this.isCreating = false;
             this.GoBackToCreating();
             return;
         }
         if (this.CurrentCreationDuration <= 0)
         {
             Creation creation = App.State.AllCreations.FirstOrDefault((Creation x) => x.TypeEnum == this.CreationNeeded);
             if (creation.count == 0)
             {
                 this.isCreating = false;
                 GuiBase.ShowToast("You need one " + creation.Name + " to create a " + this.CreationName);
                 this.GoBackToCreating();
                 return;
             }
             Creation expr_EB = creation;
             expr_EB.count = --expr_EB.count;
         }
         CDouble rightSide = App.State.CreationSpeed(ms);
         this.CurrentCreationDuration += rightSide;
         CDouble cDouble  = (this.CreationDuration - this.CurrentCreationDuration) * 30 / rightSide;
         string  text     = "Time to finish: " + Conv.MsToGuiText(cDouble.ToLong(), true);
         CDouble cDouble2 = this.CreationLoss / this.CreationDuration * rightSide;
         App.State.CreatingPowerBase -= cDouble2;
         if (App.State.CreatingPowerBase < 0)
         {
             App.State.CreatingPowerBase = 0;
         }
         CDouble cDouble3 = cDouble2 * App.State.Multiplier.CurrentMultiCreating * (100 + App.State.PremiumBoni.GpBoniCreating);
         cDouble3 = App.State.AdditionalMultis(cDouble3);
         if (this.CreationDuration > 0 && this.CurrentCreationDuration > this.CreationDuration)
         {
             this.CurrentCreationDuration = 0;
             this.CreationCount           = ++this.CreationCount;
             if (this.CreationCount >= this.StopAt && this.StopAt != 0)
             {
                 this.isCreating = false;
                 this.GoBackToCreating();
             }
         }
         this.CreationDescription = string.Concat(new string[]
         {
             this.CreationDescriptionBase,
             "\nYou will lose ",
             cDouble3.ToGuiText(true),
             " Creating every second while creating this.\n",
             text
         });
     }
     if (this.HPPercent < 100)
     {
         this.HPPercent += 1.67E-05 * (double)ms;
     }
 }
示例#18
0
        public new void UpdateDuration(long ms)
        {
            foreach (GeneratorUpgrade current in this.Upgrades)
            {
                current.UpdateDuration(ms);
            }
            CDouble leftSide = 0;
            int     num      = 0;

            if (this.IsBuilt && this.ShadowCloneCount > 0)
            {
                Creation creation = App.State.AllCreations.FirstOrDefault((Creation x) => x.TypeEnum == Creation.CreationType.Stone);
                if (creation != null)
                {
                    CDouble rightSide = ms * (long)App.State.ClonesDifGenMod / 20L;
                    CDouble cDouble   = this.ShadowCloneCount * rightSide;
                    if (creation.Count < cDouble)
                    {
                        cDouble = creation.Count;
                    }
                    CDouble cDouble2 = this.Capacity - this.FilledCapacity;
                    CDouble cDouble3 = cDouble * creation.BuyCost;
                    if (cDouble3 > cDouble2)
                    {
                        leftSide = cDouble3 - cDouble2;
                        cDouble3 = cDouble2;
                    }
                    if (leftSide > 0)
                    {
                        cDouble -= leftSide / creation.BuyCost;
                        num      = (leftSide / 962500000).ToInt();
                    }
                    this.FilledCapacity += cDouble3;
                    creation.Count      -= cDouble;
                }
            }
            if (this.FilledCapacity > 0)
            {
                CDouble cDouble4 = this.ConvertSec * ms / 1000;
                if (this.FilledCapacity > cDouble4)
                {
                    this.FilledCapacity -= cDouble4;
                }
                else
                {
                    cDouble4            = this.FilledCapacity;
                    this.FilledCapacity = 0;
                }
                CDouble cDouble5 = cDouble4 * this.DivinityEachCapacity;
                this.DivinitySec = cDouble5 * 1000 / ms;
                if (num > 400)
                {
                    num = 400;
                }
                cDouble5 = cDouble5 * (num + 100) / 100;
                this.DivinitySecWithWorker = cDouble5 * 1000 / ms;
                if (App.State.PremiumBoni.CrystalBonusDivinity > 0)
                {
                    cDouble5 = cDouble5 * (100 + App.State.PremiumBoni.CrystalBonusDivinity) / 100;
                    this.DivinitySecWithWorkerCrystal = cDouble5 * 1000 / ms;
                }
                App.State.Money += cDouble5;
            }
            else
            {
                this.DivinitySecWithWorker = 0;
                this.DivinitySec           = 0;
            }
            if (this.ShadowCloneCount == 0 || this.IsBuilt)
            {
                return;
            }
            if (!this.IsPaid)
            {
                bool          flag          = false;
                StringBuilder stringBuilder = new StringBuilder("You still need:\n");
                using (List <CreationCost> .Enumerator enumerator2 = this.RequiredCreations.GetEnumerator())
                {
                    while (enumerator2.MoveNext())
                    {
                        CreationCost cost      = enumerator2.Current;
                        Creation     creation2 = App.State.AllCreations.FirstOrDefault((Creation x) => x.TypeEnum == cost.TypeEnum);
                        if (!CreationCost.HasCreations(App.State, cost, App.State.GameSettings.AutoBuyCreationsForDivGen))
                        {
                            flag = true;
                            stringBuilder.Append(creation2.Name).Append(" x ").Append((cost.CountNeeded - creation2.Count).ToGuiText(true)).Append("\n");
                        }
                    }
                }
                if (flag)
                {
                    stringBuilder.Append("to build ").Append(this.Name).ToString();
                    if (!App.State.GameSettings.StickyClones)
                    {
                        GuiBase.ShowToast(stringBuilder.ToString());
                        App.State.Clones.RemoveUsedShadowClones(this.ShadowCloneCount);
                        this.ShadowCloneCount = 0;
                    }
                    else
                    {
                        this.MissingItems = "\n\n" + stringBuilder.ToString();
                    }
                    return;
                }
                using (List <CreationCost> .Enumerator enumerator3 = this.RequiredCreations.GetEnumerator())
                {
                    while (enumerator3.MoveNext())
                    {
                        CreationCost cost      = enumerator3.Current;
                        Creation     creation3 = App.State.AllCreations.FirstOrDefault((Creation x) => x.TypeEnum == cost.TypeEnum);
                        creation3.Count -= cost.CountNeeded;
                    }
                }
                this.IsPaid = true;
            }
            this.MissingItems     = string.Empty;
            this.CurrentDuration += (ms * (long)this.ShadowCloneCount.ToInt() * (long)App.State.PremiumBoni.MonumentBuildTimeDivider * (100 + App.State.PremiumBoni.BuildingSpeedUpPercent(true)) / 100).ToLong();
            Log.Info(string.Concat(new object[]
            {
                this.Name,
                ", Duration: ",
                this.CurrentDuration,
                " / ",
                this.DurationInMS(1)
            }));
            if (this.CurrentDuration > this.DurationInMS(1))
            {
                this.IsPaid          = false;
                this.CurrentDuration = 0L;
                this.IsBuilt         = true;
                App.State.Clones.RemoveUsedShadowClones(this.ShadowCloneCount);
                this.ShadowCloneCount = 0;
            }
        }
 public string UpdateDuration(long ms, GameState state)
 {
     this.UpdateInfoText();
     if (this.ShadowClones > 0)
     {
         bool flag = true;
         using (List <CreationCost> .Enumerator enumerator = this.RequiredCreations.GetEnumerator())
         {
             while (enumerator.MoveNext())
             {
                 CreationCost cost     = enumerator.Current;
                 Creation     creation = state.AllCreations.FirstOrDefault((Creation x) => x.TypeEnum == cost.TypeEnum);
                 CDouble      leftSide = ms * cost.CountNeeded * this.Level;
                 if (leftSide > creation.Count)
                 {
                     if (state.IsBuyUnlocked && state.GameSettings.AutoBuyForCrystal && creation.CanBuy)
                     {
                         CDouble leftSide2 = cost.CountNeeded * this.Level * (this.BaseDuration - this.CurrentDuration);
                         CDouble cDouble   = leftSide2 - creation.Count;
                         CDouble rightSide = cDouble * creation.BuyCost * (120 - state.PremiumBoni.AutoBuyCostReduction) / 100;
                         if (state.Money >= rightSide)
                         {
                             state.Money    -= rightSide;
                             creation.count += cDouble;
                             state.Statistic.TotalMoneySpent += rightSide;
                         }
                         else
                         {
                             CDouble cDouble2   = leftSide - creation.Count;
                             CDouble rightSide2 = cDouble2 * creation.BuyCost * (120 - state.PremiumBoni.AutoBuyCostReduction) / 100;
                             if (state.Money >= rightSide2)
                             {
                                 state.Money    -= rightSide2;
                                 creation.count += cDouble2;
                                 state.Statistic.TotalMoneySpent += rightSide2;
                             }
                             else
                             {
                                 flag = false;
                             }
                         }
                     }
                     else
                     {
                         flag = false;
                     }
                 }
             }
         }
         this.hasEnoughCreations = flag;
         if (flag)
         {
             using (List <CreationCost> .Enumerator enumerator2 = this.RequiredCreations.GetEnumerator())
             {
                 while (enumerator2.MoveNext())
                 {
                     CreationCost cost       = enumerator2.Current;
                     Creation     creation2  = state.AllCreations.FirstOrDefault((Creation x) => x.TypeEnum == cost.TypeEnum);
                     CDouble      rightSide3 = ms * cost.CountNeeded * this.Level;
                     creation2.count -= rightSide3;
                 }
             }
             this.CurrentDuration += ms;
             double num  = (double)this.CurrentDuration / (double)this.BaseDuration;
             int    num2 = (int)num;
             if (num2 > 0)
             {
                 this.CurrentDuration = (long)((num - (double)num2) * (double)this.BaseDuration);
                 Crystal crystal = this.Crystals.FirstOrDefault((Crystal x) => x.Level == 1);
                 if (crystal == null)
                 {
                     this.Crystals.Add(new Crystal
                     {
                         Type  = this.Type,
                         Level = 1,
                         Count = this.Level * num2
                     });
                 }
                 else
                 {
                     crystal.Count += this.Level * num2;
                 }
                 this.Crystals = (from x in this.Crystals
                                  orderby x.Level.ToInt()
                                  select x).ToList <Crystal>();
                 return(string.Concat(new object[]
                 {
                     "- ",
                     this.Level * num2,
                     " x ",
                     this.Type.ToString(),
                     " Crystal\n"
                 }));
             }
         }
         return(string.Empty);
     }
     return(string.Empty);
 }