public new void UpdateDuration(long millisecs)
        {
            this.RecoverHealth(millisecs);
            if (this.ShadowCloneCount == 0)
            {
                return;
            }
            CDouble attackPower = (App.State.CloneAttack + 10) * this.ShadowCloneCount;
            CDouble leftSide    = millisecs * (this.Attack - App.State.CloneDefense) / 5000;

            if (leftSide > 0 && App.State.CloneMaxHealth > 0)
            {
                int num = (leftSide * 100 / App.State.CloneMaxHealth).ToInt();
                if (num > 100 || UnityEngine.Random.Range(0, 100) <= num)
                {
                    base.RemoveCloneCount(1);
                    ShadowClone expr_E9 = App.State.Clones;
                    expr_E9.Count = --expr_E9.Count;
                    ShadowClone expr_103 = App.State.Clones;
                    expr_103.TotalClonesKilled = ++expr_103.TotalClonesKilled;
                    Statistic expr_11D = App.State.Statistic;
                    expr_11D.TotalShadowClonesDied = ++expr_11D.TotalShadowClonesDied;
                    if (App.State.GameSettings.AutoAddClones)
                    {
                        if (this.savedCount < this.ShadowCloneCount)
                        {
                            this.savedCount = this.ShadowCloneCount.ToInt();
                        }
                        base.AddCloneCount(this.savedCount - this.ShadowCloneCount);
                    }
                }
            }
            this.GetAttacked(attackPower, millisecs);
            if (App.State.GameSettings.NextFightIf1Cloned && this.ShadowCloneCount > 1 && App.State.CloneAttack + 10 > this.maxHealth * 170 && this.TypeEnum != Fight.FightType.monster_queen)
            {
                bool flag = false;
                foreach (Might current in App.State.AllMights)
                {
                    if (current.DurationLeft > 0L)
                    {
                        flag = true;
                    }
                }
                if (!flag)
                {
                    Fight fight = App.State.AllFights.FirstOrDefault((Fight x) => x.TypeEnum == this.TypeEnum + 1);
                    if (fight != null)
                    {
                        int value = this.ShadowCloneCount.ToInt() - 1;
                        this.RemoveCloneCount(value);
                        fight.AddCloneCount(value);
                    }
                }
            }
        }
예제 #2
0
        internal static ShadowClone FromString(string base64String)
        {
            if (string.IsNullOrEmpty(base64String))
            {
                Log.Error("ShadowClone.FromString with empty value!");
                return(new ShadowClone());
            }
            string[]    parts       = Conv.StringPartsFromBase64(base64String, "ShadowClone");
            ShadowClone shadowClone = new ShadowClone();

            shadowClone.MaxCloneModifier   = Conv.getCDoubleFromParts(parts, "g", false);
            shadowClone.count              = Conv.getCDoubleFromParts(parts, "a", false);
            shadowClone.InUse              = Conv.getCDoubleFromParts(parts, "b", false);
            shadowClone.TotalClonesCreated = Conv.getCDoubleFromParts(parts, "c", false);
            shadowClone.TotalClonesKilled  = Conv.getCDoubleFromParts(parts, "d", false);
            shadowClone.AbsoluteMaximum    = Conv.getIntFromParts(parts, "f");
            if (shadowClone.AbsoluteMaximum < 99999)
            {
                shadowClone.AbsoluteMaximum = 99999;
            }
            shadowClone.maxShadowClones = Conv.getCDoubleFromParts(parts, "e", false);
            return(shadowClone);
        }