Пример #1
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);
            }
        }
Пример #2
0
        public void StartFight(BattleState.BattleType type)
        {
            this.AllEnemies = new List <EnemyData.Enemy>();
            switch (type)
            {
            case BattleState.BattleType.endless:
                this.AllEnemies.Add(this.Enemies.Endless);
                break;

            case BattleState.BattleType.jacky:
                this.AllEnemies.Add(this.Enemies.Jacky);
                break;

            case BattleState.BattleType.cthulhu:
                this.AllEnemies.Add(this.Enemies.Cthulhu);
                break;

            case BattleState.BattleType.doppel:
                this.AllEnemies.Add(this.Enemies.Doppelganger);
                break;

            case BattleState.BattleType.developer:
                this.AllEnemies.Add(this.Enemies.Developer);
                this.AllEnemies.Add(this.Enemies.Creator);
                break;

            case BattleState.BattleType.gods:
                foreach (Creation current in App.State.AllCreations)
                {
                    if (current.TypeEnum != Creation.CreationType.Shadow_clone)
                    {
                        God godToDefeat = current.GodToDefeat;
                        List <EnemyData.SpecialAttackChance> list = new List <EnemyData.SpecialAttackChance>();
                        list.Add(new EnemyData.SpecialAttackChance(EnemyData.SpecialAttack.doubleDamage, 10));
                        list.Add(new EnemyData.SpecialAttackChance(EnemyData.SpecialAttack.tripleDamage, 3));
                        list.Add(new EnemyData.SpecialAttackChance(EnemyData.SpecialAttack.fiveDamage, 2));
                        list.Add(new EnemyData.SpecialAttackChance(EnemyData.SpecialAttack.tenDamage, 1));
                        EnemyData.Enemy item = new EnemyData.Enemy(godToDefeat.Name, string.Empty, godToDefeat.MaxHealth, godToDefeat.Attack, EnemyData.EnemyType.constantDamage, list);
                        this.AllEnemies.Add(item);
                    }
                }
                break;
            }
            this.currentBattleType = type;
            this.IsFighting        = true;
            this.IsBattleFinished  = false;
            this.totalFightTime    = 0L;
            this.PlayerHp          = App.State.MaxHealth;
            this.PlayerMaxHP       = App.State.MaxHealth;
            this.CurrentEnemy      = this.AllEnemies[0];
            this.AllEnemies.RemoveAt(0);
            this.EnemyDamageText            = string.Empty;
            this.SkillUseText               = string.Empty;
            this.FightingLog                = new List <string>();
            this.totalFightTimeMilliSeconds = 0L;
            this.enemyAttackTimer           = 0L;
            this.DefeatedEnemyCount         = 0;
            this.BattleRewardText           = string.Empty;
            this.last3EnemyAttacks          = new CDouble[3];
            this.currentIntexOfEnemyAttacks = 0;
            this.GodSpeedModeDuration       = 0L;
            this.GearEyesDuration           = 0L;
            this.DoubleUp          = false;
            this.DamageBlock       = false;
            this.DamageReflect     = false;
            this.HitchanceBonus    = 0;
            this.DodgeChance       = 0;
            this.CounterChance     = 0;
            this.DamageIncreases   = new List <DamageChange>();
            this.DamageDecreases   = new List <DamageChange>();
            this.TotalPlayerDamage = 0;
        }