public Data(LLong _clickAmount, long _powerOfClick, LLong _amountOfLeveling, LLong _currentStage) { ClickAmount = _clickAmount; PowerOfClick = _powerOfClick; AmountOfLeveling = _amountOfLeveling; CurrentStage = _currentStage; }
/// <summary> /// Returns the amount of deficit /// </summary> /// <param name="num2">Value</param> public double AmountOfDeficit(LLong num2) { long current = Current - num2.Current; long toReturn = 0; long limit = Limit == 0 ? 1 : Limit; if (IncreasableAmount != 0) { while (current < 0) { toReturn++; DecreaseLimit(ref limit); current += limit; } } else { while (current < 0) { toReturn++; current += limit; } } return(toReturn); }
/// <summary> /// Returns the amount of overflowing the limit /// </summary> /// <param name="num2">Value</param> /// <returns></returns> public long AmountOfOverFlow(LLong num2) { long current = Current + num2.Current; long toReturn = 0; long limit = Limit == 0 ? 1 : Limit; if (current >= limit && !AllowToOverFlow) { return(1); } if (IncreasableAmount != 0) { while (current >= limit) { toReturn++; current -= limit; IncreaseLimit(ref limit); } } else { while (current >= limit) { toReturn++; current -= limit; } } return(toReturn); }
/// <summary> /// Standart constructor /// </summary> /// <param name="example">LDouble value</param> public LLong(LLong example) : this() { Limit = example.Limit; Current = example.Current; IsMultiplicator = example.IsMultiplicator; IncreasableAmount = example.IncreasableAmount; AllowToOverFlow = example.AllowToOverFlow; }
/// <summary> /// Returns bool value of deficit /// </summary> /// <param name="num2">Value</param> /// <returns></returns> public bool IsDeficit(LLong num2) { if (Current - num2.Current < 0) { return(true); } return(false); }
/// <summary> /// Returns bool value of overflowing /// </summary> /// <param name="num">Value</param> /// <returns></returns> public bool IsOverflow(LLong num) { if (Current + num.Current >= Limit) { return(true); } return(false); }
/// <summary> /// increase value with return, where "true" is overflow /// </summary> /// <param name="num">Value</param> /// <returns></returns> public bool AddValue(LLong num) { if (IsOverflow(num)) { LLong temp = Addition(this, num); Limit = temp.Limit; Current = temp.Current; return(true); } else { Current += num.Current; return(false); } }
private void LoadData() { if (File.Exists(DataPath)) { Data data = JsonUtility.FromJson <Data>(File.ReadAllText(DataPath)); Synergy = data.synergy; SynergyOnClick = data.synergyOnClick; PrimoCrystal = data.primoCrystal; UniversalCrystal = data.universalCrystal; UniversalShard = data.universalShard; Gems = data.gems; MiningPower = data.miningPower; MiningLvl = data.miningLvl; MiningExp = data.miningExp; CostSynergy = data.costSynergy; DroppedShards = data.droppedShards; SynergyCrystals = data.synergyCrystals; SynergyShards = data.synergyShards; CostSynergyCrystals = data.costSynergyCrystals; DropChancePrimo = data.dropChancePrimo; PurchasedLocation = data.purchasedLocation; ChanceCrystals = TransformArray.TransformToTwo(data.chanceCrystals, data.rows, data.columns); FreeChest = DateTime.FromFileTimeUtc(data.freeChestTimeLeft); PastTime = DateTime.Now; } else { SynergyOnClick = 1; MiningPower = 1; CostSynergy = 10; DropChancePrimo = 5; MiningExp = new LLong(0, 10); PurchasedLocation = new bool[9]; CostSynergyCrystals = new long[] { 10, 10, 10, 10, 10, 10, 10, 10 }; ChanceCrystals = DropChanceCrystals.ChanceCrystals; FreeChest = DateTime.Now.AddMinutes(30); } }
/// <summary> /// Instead of operator "+" /// </summary> /// <param name="num1">First number</param> /// <param name="num2">Second number</param> /// <returns></returns> private static LLong Addition(LLong num1, LLong num2) { if (num1.Current + num2.Current >= num1.Limit) { if (!num1.AllowToOverFlow) { return(new LLong(num1) { Current = num1.Limit, Limit = num1.Limit }); } long limit = num1.Limit; long current = num1.Current + num2.Current - limit; if (num1.IncreasableAmount != 0) { num1.IncreaseLimit(ref limit); } while (current >= limit) { current -= limit; if (num1.IncreasableAmount != 0) { num1.IncreaseLimit(ref limit); } } return(new LLong(num1) { Current = current, Limit = limit }); } else { return(new LLong(num1) { Current = num1.Current + num2.Current }); } }
public Data(DataManager dt) { synergy = dt.Synergy; synergyOnClick = dt.SynergyOnClick; primoCrystal = dt.PrimoCrystal; universalCrystal = dt.UniversalCrystal; universalShard = dt.UniversalShard; gems = dt.Gems; miningPower = dt.MiningPower; miningLvl = dt.MiningLvl; miningExp = dt.MiningExp; costSynergy = dt.CostSynergy; droppedShards = dt.DroppedShards; synergyCrystals = dt.SynergyCrystals; synergyShards = dt.SynergyShards; costSynergyCrystals = dt.CostSynergyCrystals; dropChancePrimo = dt.DropChancePrimo; purchasedLocation = dt.PurchasedLocation; chanceCrystals = TransformArray.TransformToOne(dt.ChanceCrystals); rows = dt.ChanceCrystals.GetUpperBound(0) + 1; columns = dt.ChanceCrystals.GetUpperBound(1) + 1; freeChestTimeLeft = dt.FreeChest.ToFileTimeUtc(); pastTime = DateTime.Now.ToFileTimeUtc(); }