Beispiel #1
0
        /// <summary>
        ///     Spawns an entity based on a prefab with a bonus
        /// </summary>
        /// <typeparam name="T">The type of the prefab</typeparam>
        /// <param name="prefab">The prefab to use</param>
        /// <param name="bonus1">The first bonus stat</param>
        /// <param name="bonus2">The second bonus stat</param>
        /// <returns>The new entity</returns>
        public static T SpawnEntityWithBonus <T>(T prefab, Stat?bonus1 = Stat.Random, Stat?bonus2 = Stat.Random) where T : BaseDriver
        {
            T driver = Instantiate(prefab);
            BaseBattleDriver battleDriver = driver.battleDriver;

            if (bonus1 == Stat.Random)
            {
                bonus1 = MainGeneral.GetRandomStat();
            }

            if (bonus2 == Stat.Random)
            {
                bonus2 = MainGeneral.GetRandomStat(bonus1);
            }

            if (bonus1 != null)
            {
                battleDriver.SetBaseStat(
                    (Stat)bonus1,
                    battleDriver.GetBaseStat((Stat)bonus1) * BaseBattleDriver.BonusStatMultiplier);
            }

            if (bonus2 != null)
            {
                battleDriver.SetBaseStat(
                    (Stat)bonus2,
                    battleDriver.GetBaseStat((Stat)bonus2) * BaseBattleDriver.BonusStatMultiplier);
            }

            return(driver);
        }
Beispiel #2
0
        /// <summary>
        ///     Get a random stat
        /// </summary>
        /// <param name="except">A stat which isn't allowed</param>
        /// <returns>A stat</returns>
        public static Stat GetRandomStat(Stat?except = null)
        {
            switch (Random.Range(0, 5))
            {
            case 0:
                return(MainGeneral.RFSTUEER(Stat.MaximumHealth, except));

            case 1:
                return(MainGeneral.RFSTUEER(Stat.PhysicalDamage, except));

            case 2:
                return(MainGeneral.RFSTUEER(Stat.MagicalDamage, except));

            case 3:
                return(MainGeneral.RFSTUEER(Stat.Defense, except));

            case 4:
                return(MainGeneral.RFSTUEER(Stat.TurnSpeed, except));
            }

            // This should never happen
            throw new System.Exception("There seems to be no fitting stat found...?");
        }
Beispiel #3
0
 /// <summary>
 ///     Return First Stat Unless Equal Else Random.
 /// </summary>
 /// <param name="stat">The stat to possibly return</param>
 /// <param name="except">The stat which to check against</param>
 /// <returns>A stat</returns>
 private static Stat RFSTUEER(Stat stat, Stat?except = null)
 {
     return(stat != except ? stat : MainGeneral.GetRandomStat(except));
 }