Пример #1
0
        public bool OnDie()
        {
            try
            {
                if (GameSetup.IsMpClient)
                {
                    return(true);
                }
                if (setup.waterDetect.drowned)
                {
                    return(true);
                }
                if (abilities.Contains(Abilities.DoubleLife))
                {
                    if (!DualLifeSpend)
                    {
                        DualLifeSpend  = true;
                        _Health.Health = _Health.maxHealth / 2;
                        _Health.MySkin.material.color = Color.magenta;
                        prerainDmg *= 2;

                        _Health.releaseFromTrap();
                        return(false);
                    }
                }

                //if (abilities.Contains(Abilities.Molten))
                //{
                //    //not working, find a fix or replacement
                //    //BoltNetwork.Instantiate(BoltPrefabs.instantDynamite, transform.position, Quaternion.identity);
                //    //BoltNetwork.Instantiate(BoltPrefabs.instantDynamite, transform.position + Vector3.right * 2, Quaternion.identity);
                //    //BoltNetwork.Instantiate(BoltPrefabs.instantDynamite, transform.position + Vector3.left * 2, Quaternion.identity);
                //    //BoltNetwork.Instantiate(BoltPrefabs.instantDynamite, transform.position + Vector3.forward * 2, Quaternion.identity);
                //    //BoltNetwork.Instantiate(BoltPrefabs.instantDynamite, transform.position + Vector3.back * 2, Quaternion.identity);

                //}
                if (OnDieCalled)
                {
                    return(true);
                }
                EnemyManager.RemoveEnemy(this);
                if (Random.value <= 0.1f || _AI.creepy_boss || abilities.Count > 0)
                {
                    int itemCount = Random.Range(1, 6);
                    if (_AI.creepy_boss)
                    {
                        itemCount += 14;
                    }
                    else if (abilities.Count >= 3)
                    {
                        itemCount += Random.Range(3, 6);
                    }
                    if (type == EnemyType.Boss)
                    {
                        itemCount += 4;
                    }
                    if (type == EnemyType.Miniboss)
                    {
                        itemCount += 2;
                    }
                    for (int i = 0; i < itemCount; i++)
                    {
                        Network.NetworkManager.SendItemDrop(ItemDataBase.GetRandomItem(Bounty, enemyType), transform.position + Vector3.up * (2.5f + i / 4));
                    }
                    if (enemyType == Enemy.Megan && (int)ModSettings.difficulty > 6)
                    {
                        //Drop megan only amulet
                        Network.NetworkManager.SendItemDrop(new Item(ItemDataBase.ItemBases[80], 1, 2), transform.position + Vector3.up * 3);
                    }
                }
                if (GameSetup.IsMpServer)
                {
                    Network.NetworkManager.SendLine("KX" + Convert.ToInt64(Bounty / (Mathf.Max(1, 0.8f + ModReferences.Players.Count * 0.2f))) + ";", Network.NetworkManager.Target.Everyone);
                }
                else if (GameSetup.IsSinglePlayer)
                {
                    ModdedPlayer.instance.AddKillExperience(Bounty);
                }
                OnDieCalled = true;
                timeOfDeath = 60;
            }
            catch (Exception ex)
            {
                ModAPI.Log.Write("DIEING ENEMY EXCEPTION  " + ex.ToString());
            }

            return(true);
        }
Пример #2
0
        public bool OnDie()
        {
            try
            {
                //ModAPI.Console.Write("Enemy Dies, \nhealth left "+ _Health.Health+ "\n OnDieCalled "+ OnDieCalled.ToString()+"\nDrowned "+ setup.waterDetect.drowned);
                if (setup.waterDetect.drowned)
                {
                    ModAPI.Console.Write("enemy exp giving canceled, enemy drowned");
                    ModAPI.Log.Write("enemy exp giving canceled, enemy drowned");
                    return(true);
                }
                if (abilities.Contains(Abilities.DoubleLife))
                {
                    if (!DualLifeSpend)
                    {
                        DualLifeSpend  = true;
                        _Health.Health = _Health.maxHealth / 2;
                        _Health.MySkin.material.color = Color.magenta;
                        prerainDmg *= 2;

                        _Health.releaseFromTrap();
                        return(false);
                    }
                }

                if (abilities.Contains(Abilities.Molten))
                {
                    //not working, find a fix or replacement
                    //BoltNetwork.Instantiate(BoltPrefabs.instantDynamite, transform.position, Quaternion.identity);
                    //BoltNetwork.Instantiate(BoltPrefabs.instantDynamite, transform.position + Vector3.right * 2, Quaternion.identity);
                    //BoltNetwork.Instantiate(BoltPrefabs.instantDynamite, transform.position + Vector3.left * 2, Quaternion.identity);
                    //BoltNetwork.Instantiate(BoltPrefabs.instantDynamite, transform.position + Vector3.forward * 2, Quaternion.identity);
                    //BoltNetwork.Instantiate(BoltPrefabs.instantDynamite, transform.position + Vector3.back * 2, Quaternion.identity);
                }
                if (OnDieCalled)
                {
                    ModAPI.Console.Write("enemy exp giving canceled, enemy already died");
                    ModAPI.Log.Write("enemy exp giving canceled, enemy already died");
                    return(true);
                }
                Invoke("ReanimateMe", 15);
                EnemyManager.RemoveEnemy(this);
                if (Random.value < 0.2f || _AI.creepy_boss || abilities.Count >= 2)
                {
                    int itemCount = Random.Range(1, 4);
                    if (_AI.creepy_boss)
                    {
                        itemCount += 12;
                    }
                    else if (abilities.Count >= 2)
                    {
                        itemCount += Random.Range(2, 5);
                    }
                    for (int i = 0; i < itemCount; i++)
                    {
                        Network.NetworkManager.SendItemDrop(ItemDataBase.GetRandomItem(Bounty, enemyType), transform.position + Vector3.up * 3);
                    }
                    if (enemyType == Enemy.Megan && (int)ModSettings.difficulty > 6)
                    {
                        //Drop megan only amulet
                        Network.NetworkManager.SendItemDrop(new Item(ItemDataBase.ItemBases[80], 1, 2), transform.position + Vector3.up * 3);
                    }
                }
                if (GameSetup.IsMultiplayer)
                {
                    Network.NetworkManager.SendLine("KX" + Convert.ToInt64(Bounty / (Mathf.Max(1, ModReferences.Players.Count * 0.75f))) + ";", Network.NetworkManager.Target.Everyone);
                }
                else
                {
                    ModdedPlayer.instance.AddKillExperience(Bounty);
                }
                OnDieCalled = true;
                timeOfDeath = 10;
            }
            catch (Exception ex)
            {
                ModAPI.Log.Write("DIEING ENEMY EXCEPTION  " + ex.ToString());
            }

            return(true);
        }