public bool Upgrade(ref CDouble availableEnergy)
 {
     availableEnergy.Round();
     if (availableEnergy >= this.UpgradeCost)
     {
         availableEnergy -= this.UpgradeCost;
         this.MaxLevel    = ++this.MaxLevel;
         return(true);
     }
     return(false);
 }
Exemplo n.º 2
0
 public void RemoveCloneCount(CDouble count)
 {
     count.Round();
     this.ShadowCloneCount.Round();
     if (this.ShadowCloneCount <= count)
     {
         count = this.ShadowCloneCount;
     }
     this.ShadowCloneCount -= count;
     this.ShadowCloneCount.Round();
     App.State.Clones.RemoveUsedShadowClones(count);
     this.ShouldUpdateText = true;
 }
Exemplo n.º 3
0
        public List <CreationCost> RequiredCreations(CDouble level)
        {
            CDouble rightSide = 1;

            if (level > 0)
            {
                rightSide = level * 5;
            }
            List <CreationCost> list = new List <CreationCost>();

            switch (this.TypeEnum)
            {
            case Monument.MonumentType.mighty_statue:
                list.Add(new CreationCost(2000 * rightSide, Creation.CreationType.Stone));
                break;

            case Monument.MonumentType.mystic_garden:
                list.Add(new CreationCost(250 * rightSide, Creation.CreationType.Water));
                list.Add(new CreationCost(100 * rightSide, Creation.CreationType.Plant));
                break;

            case Monument.MonumentType.tomb_of_god:
                list.Add(new CreationCost(1000 * rightSide, Creation.CreationType.Stone));
                list.Add(new CreationCost(1 * rightSide, Creation.CreationType.Human));
                break;

            case Monument.MonumentType.everlasting_lighthouse:
                list.Add(new CreationCost(250000 * rightSide, Creation.CreationType.Light));
                list.Add(new CreationCost(50000 * rightSide, Creation.CreationType.Stone));
                break;

            case Monument.MonumentType.godly_statue:
                list.Add(new CreationCost(1 * rightSide, Creation.CreationType.Mountain));
                list.Add(new CreationCost(100000 * rightSide, Creation.CreationType.Stone));
                list.Add(new CreationCost(25000 * rightSide, Creation.CreationType.Water));
                break;

            case Monument.MonumentType.pyramids_of_power:
                list.Add(new CreationCost(50000 * rightSide, Creation.CreationType.Water));
                list.Add(new CreationCost(500000 * rightSide, Creation.CreationType.Stone));
                list.Add(new CreationCost(200000 * rightSide, Creation.CreationType.Light));
                break;

            case Monument.MonumentType.temple_of_god:
                list.Add(new CreationCost(1000000 * rightSide, Creation.CreationType.Stone));
                list.Add(new CreationCost(100000 * rightSide, Creation.CreationType.Light));
                list.Add(new CreationCost(2000 * rightSide, Creation.CreationType.Plant));
                list.Add(new CreationCost(1000 * rightSide, Creation.CreationType.Tree));
                list.Add(new CreationCost(60000 * rightSide, Creation.CreationType.Water));
                list.Add(new CreationCost(1000 * rightSide, Creation.CreationType.Fish));
                break;

            case Monument.MonumentType.black_hole:
            {
                CDouble cDouble = 25 * rightSide;
                if (App.State != null && App.State.Statistic.BlackHoleChallengesFinished > 0)
                {
                    CDouble cDouble2 = App.State.Statistic.BlackHoleChallengesFinished * 2;
                    if (cDouble2 > 80)
                    {
                        cDouble2 = 80;
                    }
                    cDouble = cDouble * (100 - cDouble2) / 100;
                }
                cDouble.Round();
                list.Add(new CreationCost(cDouble, Creation.CreationType.Galaxy));
                break;
            }
            }
            return(list);
        }
Exemplo n.º 4
0
        internal string Fight(GameState gameState, int bpAtk, int bpDef, int powersurge, CDouble shadowCloneCount, bool crystalFactoryAttack = false)
        {
            gameState.HomePlanet.BaalPower -= bpAtk + bpDef;
            int           num           = gameState.ClonesPlanetMod + bpAtk * 50 + powersurge;
            int           num2          = gameState.ClonesPlanetMod + bpDef * 50 + powersurge;
            StringBuilder stringBuilder = new StringBuilder();
            int           num3          = 1;
            int           num4          = 0;

            if (crystalFactoryAttack)
            {
                this.crystalFightBuilder = new StringBuilder();
                CultureInfo currentCulture = CultureInfo.CurrentCulture;
                this.crystalFightBuilder.Append(DateTime.Now.ToString(currentCulture) + "\n");
                if (shadowCloneCount == 0)
                {
                    this.crystalFightBuilder.Append(this.Name + " attacked your crystal factory and you lost the fight!");
                }
            }
            while (gameState.CurrentHealth > 0 && shadowCloneCount > 0 && this.HPPercent > 0.0)
            {
                int num5 = 7000;
                if (this.Tier == 2)
                {
                    num5 = 16000;
                }
                else if (this.Tier == 3)
                {
                    num5 = 25000;
                }
                else if (this.Tier == 4)
                {
                    num5 = 40000;
                }
                else if (this.Tier == 5)
                {
                    num5 = 60000;
                }
                int    num6  = this.skillOrder[(num3 - 1) % 10];
                string value = this.SkillName1;
                if (num6 == 3)
                {
                    num5 *= 4;
                    value = this.SkillName3;
                }
                else if (num6 == 2)
                {
                    num5 *= 2;
                    value = this.SkillName2;
                }
                long num7 = (long)UnityEngine.Random.Range((int)((double)num5 * 0.9), (int)((double)num5 * 1.1));
                if (crystalFactoryAttack && gameState.PremiumBoni.CrystalBonusDefender > 0)
                {
                    num7 = (num7 * (100 - gameState.PremiumBoni.CrystalBonusDefender) / 100).ToLong();
                }
                int num8 = (int)((double)(num7 / 4000L) - shadowCloneCount.Double / 40000.0);
                if (num8 < 0)
                {
                    num8 = 0;
                }
                num7 = num7 * 100L / (long)num2;
                if (num7 >= shadowCloneCount)
                {
                    num7 = (long)shadowCloneCount.ToInt();
                    num8 = 100;
                }
                if (crystalFactoryAttack)
                {
                    gameState.Ext.Factory.DefenderClones -= num7;
                }
                else
                {
                    gameState.CurrentHealth -= gameState.MaxHealth / 100 * num8;
                    gameState.HomePlanet.ShadowCloneCount -= num7;
                }
                shadowCloneCount -= (int)num7;
                num4             += (int)num7;
                shadowCloneCount.Round();
                gameState.Clones.RemoveUsedShadowClones((int)num7);
                gameState.Clones.Count                    -= (int)num7;
                gameState.Clones.TotalClonesKilled        += (int)num7;
                gameState.Statistic.TotalShadowClonesDied += num7;
                stringBuilder.Append(num3).Append(". ").Append(this.Name).Append(" uses ").Append(value).Append(", kills ").Append(num7).Append(" Shadow Clones and deals ").Append(num8).Append(" % damage to your hp.\n");
                if (gameState.CurrentHealth == 0 || shadowCloneCount <= 0)
                {
                    stringBuilder.Append("You lost the fight!");
                    this.crystalFightBuilder.Append(this.Name + " attacked your crystal factory and your defender clones lost the fight!");
                }
                else
                {
                    double num9 = shadowCloneCount.Double / 20000.0 / (double)this.Tier + 1.0;
                    if (shadowCloneCount <= 100000)
                    {
                        num9 *= 2.0;
                    }
                    else if (shadowCloneCount <= 150000)
                    {
                        num9 *= 1.8;
                    }
                    else if (shadowCloneCount <= 200000)
                    {
                        num9 *= 1.6;
                    }
                    else if (shadowCloneCount <= 250000)
                    {
                        num9 *= 1.4;
                    }
                    else if (shadowCloneCount <= 300000)
                    {
                        num9 *= 1.2;
                    }
                    num9 = num9 * (double)num / 100.0;
                    string str = "Shadow Clones Power Charge";
                    if (num6 != 1)
                    {
                        num9 *= 1.5;
                        str   = "Ultimate Shadow Clone Blast";
                    }
                    stringBuilder.Append("You used " + str + " and dealt ").Append((int)num9).Append(" % damage to ").Append(this.Name).Append("\n");
                    if (num9 > this.HPPercent)
                    {
                        num9 = this.HPPercent;
                    }
                    this.HPPercent -= num9;
                    if (this.HPPercent <= 0.0)
                    {
                        Statistic expr_585 = gameState.Statistic;
                        expr_585.UBsDefeated = ++expr_585.UBsDefeated;
                        gameState.HomePlanet.UBMultiplier += this.NextMultiplier;
                        this.TimesDefeated++;
                        gameState.HomePlanet.RecalculateMultiplier();
                        CDouble cDouble = 100000;
                        foreach (Fight current in gameState.AllFights)
                        {
                            if (current.IsAvailable)
                            {
                                cDouble *= 2;
                            }
                        }
                        if (gameState.Generator != null && gameState.Generator.IsBuilt)
                        {
                            cDouble += gameState.Generator.DivinitySec * 3600;
                        }
                        cDouble          = cDouble * this.Tier / 2;
                        gameState.Money += cDouble;
                        this.crystalFightBuilder.Append(string.Concat(new object[]
                        {
                            this.Name,
                            " attacked your defender clones and you won the fight!\nYou lost a total of ",
                            num4,
                            " clones and gained "
                        })).Append(cDouble.ToGuiText(true)).Append(" Divinity, your Planet Stat Multiplier increased by ").Append(this.NextMultiplier.ToGuiText(true)).Append(" %");
                        stringBuilder.Append("You won the fight!\nYou gained ").Append(cDouble.ToGuiText(true)).Append(" Divinity, your Planet Stat Multiplier increased by ").Append(this.NextMultiplier.ToGuiText(true)).Append(" %");
                        bool flag = false;
                        if (this.TimesDefeated % 5 == 0 && this.Tier == 1)
                        {
                            flag = true;
                        }
                        else if ((this.TimesDefeated % 5 == 0 && this.Tier == 2) || (this.TimesDefeated % 5 == 3 && this.Tier == 2))
                        {
                            flag = true;
                        }
                        else if (this.TimesDefeated % 5 != 0 && this.Tier == 3 && this.TimesDefeated % 5 != 3 && this.Tier == 3)
                        {
                            flag = true;
                        }
                        else if (this.TimesDefeated % 5 != 3 && this.Tier == 4)
                        {
                            flag = true;
                        }
                        else if (this.Tier == 5)
                        {
                            flag = true;
                        }
                        Log.Info(string.Concat(new object[]
                        {
                            "times defeated: ",
                            this.TimesDefeated,
                            ", drop GP = ",
                            flag
                        }));
                        if (flag)
                        {
                            gameState.PremiumBoni.GodPower++;
                            gameState.HomePlanet.TotalGainedGodPower++;
                            gameState.PremiumBoni.CheckIfGPIsAdjusted();
                            stringBuilder.Append(" and got 1 God Power!");
                            this.crystalFightBuilder.Append("\nYou received 1 God Power.");
                        }
                        if (gameState.IsCrystalFactoryAvailable)
                        {
                            CDouble cDouble2 = this.Tier * 100;
                            gameState.Ext.Factory.Energy += cDouble2;
                            stringBuilder.Append("\nYour crystal factory received " + cDouble2.GuiText + " energy!");
                            this.crystalFightBuilder.Append("\nYour crystal factory received " + cDouble2.GuiText + " energy!");
                        }
                        gameState.HomePlanet.InitUBMultipliers();
                    }
                }
                num3++;
            }
            if (!crystalFactoryAttack)
            {
                return(stringBuilder.ToString());
            }
            return(this.crystalFightBuilder.ToString());
        }