public Skill(Skill.SkillType type)
 {
     this.TypeEnum  = type;
     this.EnumValue = (int)type;
     this.Extension = new SkillExtension(this.EnumValue);
     this.minLevel  = this.EnumValue * 500 - 1;
 }
 internal static Skill FromString(string base64String)
 {
     if (string.IsNullOrEmpty(base64String))
     {
         Log.Error("Skill.FromString with empty value!");
         return(new Skill(Skill.SkillType.double_punch));
     }
     string[] parts = Conv.StringPartsFromBase64(base64String, "Skill");
     return(new Skill((Skill.SkillType)Conv.getIntFromParts(parts, "a"))
     {
         Level = new CDouble(Conv.getStringFromParts(parts, "b")),
         ShadowCloneCount = Conv.getCDoubleFromParts(parts, "c", false),
         CurrentDuration = Conv.getLongFromParts(parts, "d"),
         Extension = SkillExtension.FromString(Conv.getStringFromParts(parts, "e"))
     });
 }
        internal static SkillExtension FromString(string base64String)
        {
            if (string.IsNullOrEmpty(base64String))
            {
                Log.Error("SkillExtension.FromString with empty value!");
                return(new SkillExtension(0));
            }
            string[]       parts          = Conv.StringPartsFromBase64(base64String, "SkillExtension");
            SkillExtension skillExtension = new SkillExtension(Conv.getIntFromParts(parts, "a"));

            skillExtension.UsageCount = Conv.getLongFromParts(parts, "b");
            KeyCode intFromParts = (KeyCode)Conv.getIntFromParts(parts, "c");

            if (intFromParts != KeyCode.None)
            {
                skillExtension.KeyPress = intFromParts;
            }
            return(skillExtension);
        }
Exemplo n.º 4
0
        public int DurationInMS(int shadowCloneCount)
        {
            int num = 999999999;

            switch (this.EnumValue)
            {
            case 0:
                num = 5000;
                break;

            case 1:
                num = 10000;
                break;

            case 2:
                num = 15000;
                break;

            case 3:
                num = 20000;
                break;

            case 4:
                num = 25000;
                break;

            case 5:
                num = 35000;
                break;

            case 6:
                num = 50000;
                break;

            case 7:
                num = 65000;
                break;

            case 8:
                num = 85000;
                break;

            case 9:
                num = 110000;
                break;

            case 10:
                num = 140000;
                break;

            case 11:
                num = 170000;
                break;

            case 12:
                num = 210000;
                break;

            case 13:
                num = 250000;
                break;

            case 14:
                num = 295000;
                break;

            case 15:
                num = 340000;
                break;

            case 16:
                num = 385000;
                break;

            case 17:
                num = 435000;
                break;

            case 18:
                num = 485000;
                break;

            case 19:
                num = 540000;
                break;

            case 20:
                num = 600000;
                break;

            case 21:
                num = 660000;
                break;

            case 22:
                num = 725000;
                break;

            case 23:
                num = 800000;
                break;

            case 24:
                num = 880000;
                break;

            case 25:
                num = 965000;
                break;

            case 26:
                num = 1100000;
                break;

            case 27:
                num = 1300000;
                break;
            }
            if (App.State != null)
            {
                Skill skill = App.State.AllSkills.FirstOrDefault((Skill x) => x.EnumValue == this.EnumValue);
                if (skill != null)
                {
                    SkillExtension extension = skill.Extension;
                    num -= (int)extension.UsageCount * 10;
                }
                if (num <= 29)
                {
                    num = 29;
                }
            }
            if (shadowCloneCount == 0)
            {
                return(num);
            }
            return(num / shadowCloneCount);
        }
Exemplo n.º 5
0
        public void UseSkill(Skill skill, bool usedKey = false)
        {
            int num = 500;

            if (usedKey)
            {
                num = 800;
            }
            foreach (Skill current in App.State.AllSkills)
            {
                if (current.Extension.CoolDownCurrent < (long)num)
                {
                    current.Extension.CoolDownCurrent = (long)num;
                }
            }
            SkillExtension extension = skill.Extension;

            extension.CoolDownCurrent = extension.CoolDownBase;
            extension.UsageCount     += 1L;
            if (skill.TypeEnum == Skill.SkillType.time_manipulation)
            {
                this.CurrentEnemy.TimeManipulate();
                CDouble       cDouble       = new CDouble();
                StringBuilder stringBuilder = new StringBuilder("You use ").Append(skill.Name).Append(" and the damages ");
                for (int i = 0; i < 3; i++)
                {
                    if (this.last3EnemyAttacks[i] != null)
                    {
                        cDouble += this.last3EnemyAttacks[i];
                        stringBuilder.Append(this.last3EnemyAttacks[i].ToGuiText(true));
                        if (i == 0)
                        {
                            stringBuilder.Append(", ");
                        }
                        if (i == 1)
                        {
                            stringBuilder.Append(" and ");
                        }
                    }
                }
                this.PlayerHp    += cDouble;
                this.SkillUseText = this.FightTimeString + stringBuilder.ToString() + " never occurred.";
                this.FightingLog.Add(this.SkillUseText);
                return;
            }
            if (extension.DamagePercent > 0)
            {
                int num2 = extension.DamagePercent;
                int num3 = extension.Hitcount;
                if (skill.TypeEnum == Skill.SkillType.unlimited_creation_works)
                {
                    int num4 = 0;
                    foreach (Creation current2 in App.State.AllCreations)
                    {
                        if (current2.CanBuy)
                        {
                            num4++;
                        }
                    }
                    num2 *= num4;
                }
                else if (skill.TypeEnum == Skill.SkillType.ionioi_hero_summon)
                {
                    num3 = App.State.Statistic.HighestGodDefeated.ToInt();
                }
                if (this.DoubleUp)
                {
                    this.DoubleUp = false;
                    num2         *= 2;
                }
                StringBuilder stringBuilder2 = new StringBuilder("You attack ").Append(this.CurrentEnemy.Name).Append(" with ").Append(skill.Name);
                int           num5           = 0;
                for (int j = 0; j < num3; j++)
                {
                    int num6 = UnityEngine.Random.Range(0, 100);
                    if (extension.Hitchance + this.HitchanceBonus > num6)
                    {
                        num5++;
                    }
                }
                this.HitchanceBonus = 0;
                if (num5 > 0)
                {
                    CDouble cDouble2 = skill.Level;
                    if (cDouble2 > 100000)
                    {
                        int num7 = cDouble2.ToInt() - 100000;
                        if (num7 > 1100000)
                        {
                            cDouble2 = 150000 + (num7 - 1100000) / 100;
                        }
                        else
                        {
                            cDouble2 = 100000 + num7 / 20;
                        }
                    }
                    CDouble cDouble3 = this.randomize(cDouble2 * num2 * this.DamageIncrease * App.State.Attack / 1000000000 * num5);
                    Log.Info("playerDamage: " + cDouble3.ToGuiText(true));
                    stringBuilder2.Append(" and hit ").Append(num5).Append(" times for ").Append(cDouble3.ToGuiText(true)).Append(" damage total.");
                    this.TotalPlayerDamage += cDouble3;
                    this.SkillUseText       = this.FightTimeString + stringBuilder2.ToString();
                    if (extension.HealPercent != 0)
                    {
                        StringBuilder stringBuilder3 = new StringBuilder();
                        CDouble       cDouble4       = extension.HealPercent * App.State.MaxHealth / 100;
                        if (this.PlayerHp + cDouble4 > this.PlayerMaxHP)
                        {
                            cDouble4 = this.PlayerMaxHP - this.PlayerHp;
                        }
                        this.PlayerHp += cDouble4;
                        if (cDouble4 > 0)
                        {
                            stringBuilder3.Append("\nYou heal yourself for " + cDouble4.ToGuiText(true)).Append(".");
                        }
                        else
                        {
                            stringBuilder3.Append("\nYou damage yourself for " + (cDouble4 * -1).ToGuiText(true)).Append(".");
                        }
                        this.SkillUseText += stringBuilder3.ToString();
                    }
                    this.FightingLog.Add(this.SkillUseText);
                    if (this.PlayerHp <= 0)
                    {
                        GuiBase.ShowToast("You lose!");
                        this.IsFighting       = false;
                        this.IsBattleFinished = true;
                        this.GetReward(false);
                        return;
                    }
                    if (this.CurrentEnemy.DoDamage(cDouble3))
                    {
                        this.SkillUseText = "You defeated " + this.CurrentEnemy.Name + "!";
                        if (this.currentBattleType == BattleState.BattleType.developer)
                        {
                            this.SkillUseText = this.SkillUseText + " " + this.CurrentEnemy.Name + " evolved into ";
                        }
                        this.DefeatedEnemyCount++;
                        Log.Info("AllEnemies.Count: " + this.AllEnemies.Count);
                        if (this.AllEnemies.Count > 0)
                        {
                            this.CurrentEnemy = this.AllEnemies[0];
                            this.AllEnemies.RemoveAt(0);
                            if (this.currentBattleType == BattleState.BattleType.developer)
                            {
                                this.SkillUseText = this.SkillUseText + this.CurrentEnemy.Name + "!";
                            }
                        }
                        else if (this.currentBattleType == BattleState.BattleType.gods)
                        {
                            CDouble cDouble5 = new CDouble("99999999999999999999999999999999999999999999999999999999000");
                            int     num8     = 1;
                            for (int k = 0; k < this.DefeatedEnemyCount - 28; k++)
                            {
                                num8++;
                                cDouble5 *= 100;
                            }
                            string name = "P. Baal";
                            if (num8 > 1)
                            {
                                name = "P. Baal v " + num8;
                            }
                            List <EnemyData.SpecialAttackChance> list = new List <EnemyData.SpecialAttackChance>();
                            list.Add(new EnemyData.SpecialAttackChance(EnemyData.SpecialAttack.doubleDamage, 20));
                            list.Add(new EnemyData.SpecialAttackChance(EnemyData.SpecialAttack.tripleDamage, 10));
                            list.Add(new EnemyData.SpecialAttackChance(EnemyData.SpecialAttack.fiveDamage, 5));
                            list.Add(new EnemyData.SpecialAttackChance(EnemyData.SpecialAttack.tenDamage, 3));
                            this.CurrentEnemy = new EnemyData.Enemy(name, string.Empty, cDouble5 * 1000, cDouble5, EnemyData.EnemyType.constantDamage, list);
                        }
                        else if (this.currentBattleType == BattleState.BattleType.endless)
                        {
                            string name2 = this.DefeatedEnemyCount + 1 + " Shadow Clones";
                            List <EnemyData.SpecialAttackChance> list2 = new List <EnemyData.SpecialAttackChance>();
                            list2.Add(new EnemyData.SpecialAttackChance(EnemyData.SpecialAttack.doubleDamage, 2 + this.DefeatedEnemyCount / 2));
                            list2.Add(new EnemyData.SpecialAttackChance(EnemyData.SpecialAttack.tripleDamage, 1 + this.DefeatedEnemyCount / 3));
                            list2.Add(new EnemyData.SpecialAttackChance(EnemyData.SpecialAttack.fiveDamage, 1 + this.DefeatedEnemyCount / 5));
                            list2.Add(new EnemyData.SpecialAttackChance(EnemyData.SpecialAttack.tenDamage, 1 + this.DefeatedEnemyCount / 10));
                            CDouble hp  = App.State.PowerLevel * 5 * (this.DefeatedEnemyCount + 1);
                            CDouble dam = App.State.PowerLevel / 300 * (this.DefeatedEnemyCount + 1);
                            this.CurrentEnemy = new EnemyData.Enemy(name2, string.Empty, hp, dam, EnemyData.EnemyType.constantDamage, list2);
                        }
                        else
                        {
                            GuiBase.ShowToast("You win!");
                            this.IsFighting       = false;
                            this.IsBattleFinished = true;
                            this.GetReward(true);
                        }
                        this.FightingLog.Add(this.SkillUseText);
                    }
                }
                else
                {
                    stringBuilder2.Append(" and your attack misses!");
                    this.SkillUseText = this.FightTimeString + stringBuilder2.ToString();
                    this.FightingLog.Add(this.SkillUseText);
                }
            }
            else
            {
                StringBuilder stringBuilder4 = new StringBuilder(this.FightTimeString + "You use " + skill.Name).Append(" ");
                if (extension.DamageBlock)
                {
                    this.DamageBlock = true;
                    stringBuilder4.Append("and the next incoming damage will be blocked.");
                }
                if (extension.DamageReflect)
                {
                    this.DamageReflect = true;
                    stringBuilder4.Append("and the next incoming damage will be reflected.");
                }
                if (extension.DoubleUp)
                {
                    this.DoubleUp = true;
                    stringBuilder4.Append("and the next damage you do will be doubled.");
                }
                if (extension.GodSpeedModeDuration > 0L)
                {
                    this.GodSpeedModeDuration = extension.GodSpeedModeDuration;
                    stringBuilder4.Append("and you enter god speed mode for " + extension.GodSpeedModeDuration / 1000L + " seconds.");
                }
                if (extension.GearEyesDuration > 0L)
                {
                    this.GearEyesDuration = extension.GearEyesDuration;
                    stringBuilder4.Append("and the enemy is stopped for " + extension.GearEyesDuration / 1000L + " seconds.");
                }
                if (extension.HealPercent != 0)
                {
                    CDouble cDouble6 = extension.HealPercent * App.State.MaxHealth / 100;
                    if (this.PlayerHp + cDouble6 > this.PlayerMaxHP)
                    {
                        cDouble6 = this.PlayerMaxHP - this.PlayerHp;
                    }
                    this.PlayerHp += cDouble6;
                    if (cDouble6 > 0)
                    {
                        stringBuilder4.Append("and you heal yourself for " + cDouble6.ToGuiText(true)).Append(".");
                    }
                    else
                    {
                        stringBuilder4.Append("and you damage yourself for " + (cDouble6 * -1).ToGuiText(true)).Append(".");
                    }
                }
                if (extension.DodgeChance > 0)
                {
                    this.DodgeChance = extension.DodgeChance;
                    stringBuilder4.Append("and have a ").Append(extension.DodgeChance).Append(" % chance to dodge the next attack.");
                }
                if (extension.HitchanceBonus > 0)
                {
                    this.HitchanceBonus = extension.HitchanceBonus;
                    stringBuilder4.Append("and your next attack skill will have a ").Append(this.HitchanceBonus).Append(" % higher chance to hit.");
                }
                if (extension.CounterChance > 0)
                {
                    this.CounterChance = extension.CounterChance;
                    stringBuilder4.Append("and you have a ").Append(extension.CounterChance).Append(" % chance to counter the next attack.");
                }
                if (extension.DamageIncreaseDuration > 0L)
                {
                    stringBuilder4.Append("and your damage is increased by ").Append(extension.DamageIncreasePercent).Append(" % for ").Append(extension.DamageIncreaseDuration / 1000L).Append(" seconds.");
                    this.DamageIncreases.Add(new DamageChange(extension.DamageIncreasePercent, extension.DamageIncreaseDuration));
                }
                if (extension.DamageDecreaseDuration > 0L)
                {
                    stringBuilder4.Append("and the damage you receive is decreased by ").Append(extension.DamageDecreasePercent).Append(" % for ").Append(extension.DamageDecreaseDuration / 1000L).Append(" seconds.");
                    this.DamageDecreases.Add(new DamageChange(extension.DamageDecreasePercent, extension.DamageDecreaseDuration));
                }
                this.SkillUseText = stringBuilder4.ToString();
                this.SkillUseText = this.SkillUseText.Replace('.', ' ').TrimEnd(new char[0]) + ".";
                this.FightingLog.Add(this.SkillUseText);
            }
        }