Exemple #1
0
        void CustomInitialize()
        {
            CurrentMultipliers = new StatMultipliers(this);
            TileEntityInstantiator.CreateEntitiesFrom(Map);
            Map.RemoveTiles(t => t.Any(item => item.Name == "Type" && (item.Value as string) == "RemoveMe"), Map.TileProperties);

            // Create players after other entities so they can be spawned next to the base
            CreatePlayers();

            spawnManager = new SpawnManager();

            InitializeCollisions();

            InitializeCameraController();

            Factories.EnemyFactory.EntitySpawned = HandleEnemySpawn;
            EnemyList.CollectionChanged         += (a, b) => HandleEnemyListChanged();

            InitializeNodeNetworks();

            InitializeUi();

            InitializeMusic();

            levelStartTime = FlatRedBall.TimeManager.CurrentTime;
        }
Exemple #2
0
        public double? GetMaxValue(string[] speciesaliases, Stat stat, int baseLevel, int tamedLevel, double tamingEfficiency, double imprintingBonus = 0)
        {
            var index = (int)stat;
            var multipliers = index < StatMultipliers?.Length ? StatMultipliers.ElementAt(index) : null;
            var stats = SpeciesStats?.FirstOrDefault(x => speciesaliases.Contains(x.Name, StringComparer.OrdinalIgnoreCase))?.Stats;

            if (multipliers == null || multipliers.Length != 4 || stats == null) return null;

            //stats = new double[8].Select((x, i) =>
            //{
            //    var v = new double[5];
            //    stats[i]?.CopyTo(v, 0); //copy raw
            //    v[1] *= multipliers[3]; //inc. per wild level 
            //    v[2] *= multipliers[2]; //inc. per tamed level
            //    if(v[3] > 0) v[3] *= multipliers[0]; //add. when tamed
            //    v[4] *= multipliers[1]; //multi. affinity
            //    return v;
            //}).ToArray();

            //stats: Base value, Increase per wild level, increase per tamed level, add. when tamed, multi. affinity

            var B = stats[index][0]; //base-value
            var Lw = (double)baseLevel; //level-wild
            var Iw = stats[index][1]; //increase per wild-level as % of B
            var IwM = multipliers[3]; //increase per domesticated level modifier
            var IB = imprintingBonus;
            var IBM = 1d; //imprinting bonus multiplier
            var Ta = stats[index][3]; //additive taming-bonus
            var TaM = Ta > 0 ? multipliers[0] : 1d; //additive taming-bonus modifier (not when negative)
            var TE = tamingEfficiency; //taming efficiency
            var Tm = stats[index][4]; //multiplicative taming-bonus
            var TmM = multipliers[1]; //multiplicative taming-bonus modifier
            var Ld = (double)tamedLevel; //level points spend after taming
            var Id = stats[index][2]; //increase per domesticated level as % of B
            var IdM = multipliers[2]; //increase per domesticated level modifier


            //Each dino has 6 variables that affect the final stat:

            //Base-value: B
            //increase per wild-level as % of B: Iw
            //increase per domesticated level as % of B: Id
            //additive taming-bonus: Ta (not when negative)
            //multiplicative taming-bonus: Tm
            //imprinting bonus: IB
            //The imprinting bonus IB only affects bred creatures, and all stat-values except of stamina and oxygen (it does affect the torpor-value).

            //The game has further global variables for each stat, that affect the variables above:

            //additive taming-bonus modifier: TaM
            //multiplicative taming-bonus modifier: TmM
            //increase per domesticated level modifier: IdM
            //The imprinting bonus is scaled by the global variable (default: 1)

            //BabyImprintingStatScaleMultiplier: IBM
            //Currently these modifiers are for health TaM = 0.14, TmM = 0.44 and IdM = 0.2, and for melee damage TaM = 0.14, TmM = 0.44 and IdM = 0.17.

            //Assume that a creature has upleveled a certain stat in the wild Lw times, was upleveled a stat by a player Ld times and was tamed with a taming effectiveness of TE. Then the final value V of that stat (as you see it ingame) is

            //Ta and Tm are 0 in the most cases. For Health Ta is always 0.5 (except for the Giganotosaurus, where it is -110000), for Damage Ta is in most cases 0.5 and Tm = 0.4 (that gives the creature a +50pp (percentage point) bonus and after this the value is multiplied by (1 + 0.4 * TmM * TE (so it get's another 40% * 0.45 = 18% of the current value, dependent on the taming effectiveness).

            //Vw = B × ( 1 + Lw × Iw) //wild value
            //Vpt = (Vw + Ta × TaM) × (1 + TE × Tm × TmM) //post-tamed
            //Vpt = (Vw × (1 + IB × 0.2 × IBM) + Ta × TaM) × (1 + TE × Tm × TmM) //bred creatures
            //V = Vpt × (1 + Ld × Id × IdM) //final value
            //V = (B × ( 1 + Lw × Iw) × (1 + IB × 0.2 × IBM) + Ta × TaM) × (1 + TE × Tm × TmM) × (1 + Ld × Id × IdM) //final value (full equation)

            var Vw = B * (1 + Lw * Iw * IwM); //wild value
            var Vib = stat == Stat.Stamina || stat == Stat.Oxygen ? 1 : (1 + IB * 0.2 * IBM); //imprinting bonus
            var Vpt = (Vw * Vib + Ta * TaM) * (1 + TE * Tm * TmM); //post-tame and bred creatures
            var V = Vpt * (1 + Ld * Id * IdM); //final value

            return V;
        }