示例#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);
        }
示例#2
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));
 }