コード例 #1
0
        public static void CreateBlackHole(Vector3 pos, bool fromEnemy, float damage, float duration = 3, float radius = 20, float pullforce = 12)
        {
            GameObject go = Core.Instantiate(401, pos);
            BlackHole  b  = go.AddComponent <BlackHole>();

            b.damage    = damage;
            b.FromEnemy = fromEnemy;
            b.duration  = duration;
            b.radius    = radius;
            b.pullForce = pullforce;
        }
コード例 #2
0
        public static void CreateBlackHole(Vector3 pos, bool fromEnemy, float damage, float duration = 3, float radius = 20, float pullforce = 12, string SparkOfLightAfterDarkness_PlayerID = null)
        {
            GameObject go = Core.Instantiate(401, pos);
            BlackHole  b  = go.AddComponent <BlackHole>();

            b.damage    = damage;
            b.FromEnemy = fromEnemy;
            b.duration  = duration;
            b.radius    = radius;
            b.pullForce = pullforce;

            if (fromEnemy)
            {
                go.GetComponent <Light>().color = Color.red;
            }
            else
            {
                if (!string.IsNullOrEmpty(SparkOfLightAfterDarkness_PlayerID))
                {
                    b.doSparkOfLight = true;
                    b.casterID       = SparkOfLightAfterDarkness_PlayerID;
                }
            }
        }
コード例 #3
0
        private void Update()
        {
            if (!setupComplete)
            {
                if (_Health.Health > 0 && ModSettings.DifficultyChoosen)
                {
                    Setup();
                }

                return;
            }
            if (Time.time - CreationTime < 10)
            {
                _Health.Health = Mathf.RoundToInt(MaxHealth);
            }
            if (OnDieCalled && Health > 0)
            {
                timeOfDeath -= Time.deltaTime;
                if (timeOfDeath < 0)
                {
                    OnDieCalled = false;
                }
            }
            FireDmgBonus = 0;
            foreach (EnemyDebuff item in FireDamageDebuffs.Values)
            {
                FireDmgBonus += item.amount;
            }

            int[] FDBKeys = new List <int>(FireDamageDebuffs.Keys).ToArray();
            for (int i = 0; i < FDBKeys.Length; i++)
            {
                int key = FDBKeys[i];

                FireDamageDebuffs[key].duration -= Time.deltaTime;

                if (FireDamageDebuffs[key].duration < 0)
                {
                    FireDamageDebuffs.Remove(key);
                }
            }


            int[] DTDKeys = new List <int>(dmgTakenDebuffs.Keys).ToArray();
            int[] DDDKeys = new List <int>(dmgDealtDebuffs.Keys).ToArray();
            DebuffDmgMult    = 1;
            dmgTakenIncrease = 1;

            for (int i = 0; i < DTDKeys.Length; i++)
            {
                int key = DTDKeys[i];
                dmgTakenIncrease *= dmgTakenDebuffs[key].amount;
                dmgTakenDebuffs[key].duration -= Time.deltaTime;

                if (dmgTakenDebuffs[key].duration < 0)
                {
                    dmgTakenDebuffs.Remove(key);
                }
            }


            for (int i = 0; i < DDDKeys.Length; i++)
            {
                int key = DDDKeys[i];
                DebuffDmgMult *= dmgDealtDebuffs[key].amount;
                dmgDealtDebuffs[key].duration -= Time.deltaTime;

                if (dmgDealtDebuffs[key].duration < 0)
                {
                    dmgDealtDebuffs.Remove(key);
                }
            }



            if (TrapCD > 0)
            {
                TrapCD -= Time.deltaTime;
            }

            if (StunCD > 0)
            {
                StunCD -= Time.deltaTime;
            }

            if (LaserCD > 0)
            {
                LaserCD -= Time.deltaTime;
            }

            if (MeteorCD > 0)
            {
                MeteorCD -= Time.deltaTime;
            }
            if (BeamCD > 0)
            {
                BeamCD -= Time.deltaTime;
            }
            AnimSpeed = BaseAnimSpeed;
            int[] Keys = new List <int>(slows.Keys).ToArray();
            for (int i = 0; i < Keys.Length; i++)
            {
                int key = Keys[i];
                if (!(slows[key].amount < 1 && CCimmune))
                {
                    AnimSpeed           *= slows[key].amount;
                    slows[key].duration -= Time.deltaTime;
                }
                else
                {
                    slows[key].duration = -1;
                }
                if (slows[key].duration < 0)
                {
                    slows.Remove(key);
                }
            }
            Health = _Health.Health;
            bool inRange = false;

            closestPlayerMagnitude = agroRange;
            foreach (GameObject g in _AI.allPlayers)
            {
                float f = (g.transform.position - transform.position).sqrMagnitude;
                if (f < agroRange)
                {
                    if (f < closestPlayerMagnitude)
                    {
                        closestPlayer          = g;
                        closestPlayerMagnitude = f;
                    }
                    inRange = true;
                }
            }

            transform.localScale = Vector3.one;
            if (abilities.Contains(Abilities.RainEmpowerement))
            {
                if (TheForest.Utils.Scene.WeatherSystem.Raining)
                {
                    Armor                 = prerainArmor * 5;
                    DamageMult            = prerainDmg * 5;
                    transform.localScale *= 1.5f;

                    AnimSpeed *= 2;
                }
                else
                {
                    Armor      = prerainArmor;
                    DamageMult = prerainDmg;
                }
            }
            ArmorReduction = Mathf.Min(ArmorReduction, Armor);
            if (abilities.Contains(Abilities.Huge))
            {
                gameObject.transform.localScale *= 2f;
            }
            else if (abilities.Contains(Abilities.Tiny))
            {
                gameObject.transform.localScale *= 0.35f;
                BroadcastMessage("SetTriggerScaleForTiny", SendMessageOptions.DontRequireReceiver);
            }
            if (abilities.Contains(Abilities.DoubleLife))
            {
                if (DualLifeSpend)
                {
                    _Health.MySkin.material.color = Color.magenta;
                    AnimSpeed *= 1.2f;
                    gameObject.transform.localScale *= 1.3f;
                }
            }

            if (abilities.Contains(Abilities.Shielding))
            {
                if (shieldingON > 0)
                {
                    shieldingON -= Time.deltaTime;
                    _Health.MySkin.material.color = Color.black;

                    if (shieldingON <= 0)
                    {
                        _Health.MySkin.material.color = normalColor;
                    }
                }
                if (shieldingCD > 0)
                {
                    shieldingCD -= Time.deltaTime;
                }
            }
            if (DualLifeSpend)
            {
                transform.localScale         *= 1.2f;
                _Health.MySkin.material.color = Color.green;
                AnimSpeed *= 1.2f;
            }


            if (inRange)
            {
                if (abilities.Contains(Abilities.Meteor) && MeteorCD <= 0)
                {
                    Vector3 dir = closestPlayer.transform.position;
                    Network.NetworkManager.SendLine("MT" + dir.x + ";" + dir.y + ";" + dir.z + ";" + Random.Range(-100000, 100000) + ";", Network.NetworkManager.Target.Everyone);
                    MeteorCD = 50f;
                }
                if (abilities.Contains(Abilities.Flare) && BeamCD <= 0)
                {
                    Vector3 dir      = transform.position;
                    float   dmg      = 30;
                    float   slow     = 0.4f;
                    float   boost    = 1.25f;
                    float   duration = 20;
                    float   radius   = 3;

                    switch (ModSettings.difficulty)
                    {
                    case ModSettings.Difficulty.Hard:
                        dmg    = 100;
                        radius = 5f;
                        break;

                    case ModSettings.Difficulty.Elite:
                        dmg    = 250;
                        radius = 5.4f;
                        break;

                    case ModSettings.Difficulty.Master:
                        dmg    = 600;
                        radius = 5.7f;
                        break;

                    case ModSettings.Difficulty.Challenge1:
                        dmg    = 1500;
                        radius = 6f;
                        break;

                    case ModSettings.Difficulty.Challenge2:
                        dmg    = 4000;
                        radius = 6.2f;
                        break;

                    case ModSettings.Difficulty.Challenge3:
                        dmg    = 10000;
                        radius = 6.4f;
                        break;

                    case ModSettings.Difficulty.Challenge4:
                        dmg    = 20000;
                        radius = 6.7f;
                        break;

                    case ModSettings.Difficulty.Challenge5:
                        dmg    = 45000;
                        radius = 7;
                        break;
                    }

                    float Healing = dmg / 10;


                    Network.NetworkManager.SendLine("SC3;" + dir.x + ";" + dir.y + ";" + dir.z + ";" + "t;" + dmg + ";" + Healing + ";" + slow + ";" + boost + ";" + duration + ";" + radius + ";", Network.NetworkManager.Target.Everyone);
                    BeamCD = 120f;
                }

                if (abilities.Contains(Abilities.Blink))
                {
                    if (blinkCD <= 0)
                    {
                        transform.root.position = closestPlayer.transform.position + transform.forward * -2;
                        blinkCD = Random.Range(15, 25);
                    }
                    else
                    {
                        blinkCD -= Time.deltaTime;
                    }
                }
                if (abilities.Contains(Abilities.Laser) && LaserCD <= 0)
                {
                    Vector3 dir = closestPlayer.transform.position;

                    LaserCD = 100;
                    Network.NetworkManager.SendLine("LA" + transform.position.x + ";" + transform.position.y + ";" + transform.position.z + ";" + dir.x + ";" + dir.y + 2 + ";" + dir.z + ";", Network.NetworkManager.Target.Everyone);
                }
                if (abilities.Contains(Abilities.Rooting) && StunCD <= 0)
                {
                    float duration = 2;
                    switch (ModSettings.difficulty)
                    {
                    case ModSettings.Difficulty.Hard:
                        duration = 2.4f;
                        break;

                    case ModSettings.Difficulty.Elite:
                        duration = 2.8f;
                        break;

                    case ModSettings.Difficulty.Master:
                        duration = 3;
                        break;

                    case ModSettings.Difficulty.Challenge1:
                        duration = 3.3f;
                        break;

                    case ModSettings.Difficulty.Challenge2:
                        duration = 3.6f;
                        break;

                    case ModSettings.Difficulty.Challenge3:
                        duration = 4;
                        break;

                    case ModSettings.Difficulty.Challenge4:
                        duration = 4.5f;
                        break;

                    case ModSettings.Difficulty.Challenge5:
                        duration = 6f;
                        break;

                    default:
                        break;
                    }
                    Network.NetworkManager.SendLine("RO" + transform.position.x + ";" + transform.position.y + ";" + transform.position.z + ";" + duration + ";", Network.NetworkManager.Target.Everyone);
                    StunCD = Random.Range(15, 30);
                }

                if (abilities.Contains(Abilities.Trapper) && TrapCD <= 0)
                {
                    if (closestPlayerMagnitude < agroRange / 2)
                    {
                        float radius = 10f;

                        Network.NetworkManager.SendLine("TR" + transform.position.x + ";" + transform.position.y + ";" + transform.position.z + ";14;" + radius + ";", Network.NetworkManager.Target.Everyone);
                        TrapCD = 50;
                    }
                }

                if (abilities.Contains(Abilities.FreezingAura))
                {
                    if (freezeauraCD > 0)
                    {
                        freezeauraCD -= Time.deltaTime;
                    }
                    else
                    {
                        if (BoltNetwork.isRunning)
                        {
                            Network.NetworkManager.SendLine("ES1;" + entity.networkId.PackedValue + ";", Network.NetworkManager.Target.Everyone);
                        }
                        else
                        {
                            SnowAura sa = new GameObject("Snow").AddComponent <SnowAura>();
                            sa.followTarget = transform.root;
                        }
                        freezeauraCD = 100;
                    }
                }
                if (abilities.Contains(Abilities.BlackHole))
                {
                    if (blackholeCD > 0)
                    {
                        blackholeCD -= Time.deltaTime;
                    }
                    else
                    {
                        float damage    = 5 * Level * Level;
                        float duration  = 5;
                        float radius    = 15;
                        float pullforce = 12;
                        if (BoltNetwork.isRunning)
                        {
                            Network.NetworkManager.SendLine("SC1;" + Math.Round(transform.position.x, 5) + ";" + Math.Round(transform.position.y, 5) + ";" + Math.Round(transform.position.z, 5) + ";" +
                                                            "t;" + damage + ";" + duration + ";" + radius + ";" + pullforce + ";", Network.NetworkManager.Target.Everyone);
                        }
                        else
                        {
                            BlackHole.CreateBlackHole(transform.position, true, damage, duration, radius, pullforce);
                        }
                        blackholeCD = 45;
                    }
                }
            }
            _AI.animSpeed        = AnimSpeed;
            setup.animator.speed = AnimSpeed;
        }