Beispiel #1
0
        public static void AIActorPostSpawn(AIActor AIActor)
        {
            if (CurrentChallenge == ChallengeType.WHAT_ARMY)
            {
                bool isParachuting = (AIActor.gameObject.transform.parent != null && AIActor.gameObject.transform.parent.gameObject.name.Contains("EX_Parachute"));
                if (AIActor && AIActor.healthHaver && !AIActor.healthHaver.IsBoss && !AIActor.healthHaver.IsSubboss && !AIActor.IsSecretlyTheMineFlayer())
                {
                    if (AIActor.gameObject.GetComponent <HasBeenAffectedByCurrentChallenge>() == null && AIActor.gameObject.GetComponent <CompanionController>() == null && !isParachuting)
                    {
                        float proc = 1;
                        if (AIActor.GetAbsoluteParentRoom().area.PrototypeRoomCategory == PrototypeDungeonRoom.RoomCategory.BOSS && AIActor.GetAbsoluteParentRoom().RoomContainsMineFlayer())
                        {
                            proc = 0.2f;
                        }
                        if (UnityEngine.Random.value <= proc)
                        {
                            List <string> ChaosPalette = GenerateChaosPalette();
                            string        guid         = BraveUtility.RandomElement(ChaosPalette);
                            var           enemyPrefab  = EnemyDatabase.GetOrLoadByGuid(guid);
                            AIActor       aiactor      = AIActor.Spawn(enemyPrefab, AIActor.gameActor.CenterPosition.ToIntVector2(VectorConversions.Floor), AIActor.GetAbsoluteParentRoom(), true, AIActor.AwakenAnimationType.Default, true);
                            aiactor.gameObject.AddComponent <HasBeenAffectedByCurrentChallenge>();
                            aiactor.AssignedCurrencyToDrop    = AIActor.AssignedCurrencyToDrop;
                            aiactor.AdditionalSafeItemDrops   = AIActor.AdditionalSafeItemDrops;
                            aiactor.AdditionalSimpleItemDrops = AIActor.AdditionalSimpleItemDrops;
                            aiactor.CanTargetEnemies          = AIActor.CanTargetEnemies;
                            aiactor.CanTargetPlayers          = AIActor.CanTargetPlayers;
                            if (aiactor.EnemyGuid == "556e9f2a10f9411cb9dbfd61e0e0f1e1")
                            {
                                aiactor.HandleReinforcementFallIntoRoom(0f);
                            }
                            else if (AIActor.IsInReinforcementLayer)
                            {
                                aiactor.invisibleUntilAwaken            = true;
                                aiactor.specRigidbody.CollideWithOthers = false;
                                aiactor.IsGone = true;
                                aiactor.HandleReinforcementFallIntoRoom(0f);
                            }
                            if (aiactor.EnemyGuid == "22fc2c2c45fb47cf9fb5f7b043a70122")
                            {
                                aiactor.CollisionDamage = 0f;
                            }
                            if (AIActor.GetComponent <ExplodeOnDeath>() != null)
                            {
                                UnityEngine.Object.Destroy(AIActor.GetComponent <ExplodeOnDeath>());
                            }
                            AIActor.EraseFromExistence(true);
                        }
                    }
                }
            }
            else if (CurrentChallenge == ChallengeType.TOIL_AND_TROUBLE)
            {
                if (AIActor && AIActor.healthHaver && !AIActor.healthHaver.IsBoss && !AIActor.healthHaver.IsSubboss && !AIActor.IsSecretlyTheMineFlayer())
                {
                    if (AIActor.GetComponent <CompanionController>() == null && AIActor.GetComponent <HasBeenAffectedByCurrentChallenge>() == null && AIActor.GetComponent <DisplacedImageController>() == null && AIActor.GetComponent <WitchsBrew.HasBeenDoubledByWitchsBrew>() == null && AIActor.GetComponent <MirrorImageController>() == null)
                    {
                        GameManager.Instance.StartCoroutine(ToilEnemyDupe(AIActor));
                    }
                }
                else if (AIActor && AIActor.healthHaver && (AIActor.healthHaver.IsBoss || AIActor.healthHaver.IsSubboss) && !AIActor.IsSecretlyTheMineFlayer())
                {
                    if (AIActor.GetComponent <HasBeenAffectedByCurrentChallenge>() == null)
                    {
                        if (ValidDoubleableBosses.Contains(AIActor.EnemyGuid))
                        {
                            string  guid        = AIActor.EnemyGuid;
                            var     enemyPrefab = EnemyDatabase.GetOrLoadByGuid(guid);
                            AIActor aiactor     = AIActor.Spawn(enemyPrefab, AIActor.gameActor.CenterPosition.ToIntVector2(VectorConversions.Floor), AIActor.GetAbsoluteParentRoom(), true, AIActor.AwakenAnimationType.Default, true);

                            HasBeenAffectedByCurrentChallenge challengitude = aiactor.gameObject.AddComponent <HasBeenAffectedByCurrentChallenge>();
                            challengitude.linkedOther = AIActor;
                            HasBeenAffectedByCurrentChallenge challengitude2 = AIActor.gameObject.AddComponent <HasBeenAffectedByCurrentChallenge>();
                            challengitude2.linkedOther        = aiactor;
                            aiactor.AssignedCurrencyToDrop    = AIActor.AssignedCurrencyToDrop;
                            aiactor.AdditionalSafeItemDrops   = AIActor.AdditionalSafeItemDrops;
                            aiactor.AdditionalSimpleItemDrops = AIActor.AdditionalSimpleItemDrops;

                            if (AIActor.GetComponent <BroController>())
                            {
                                aiactor.gameObject.GetOrAddComponent <BroController>();
                            }


                            float actorOrigHP = AIActor.healthHaver.GetMaxHealth();
                            float actorNewHP  = aiactor.healthHaver.GetMaxHealth();
                            AIActor.healthHaver.SetHealthMaximum(actorOrigHP * 0.5f);
                            AIActor.healthHaver.ForceSetCurrentHealth(actorOrigHP * 0.5f);
                            aiactor.healthHaver.SetHealthMaximum(actorNewHP * 0.5f);
                            aiactor.healthHaver.ForceSetCurrentHealth(actorNewHP * 0.5f);
                        }
                        else
                        {
                            float actorHP = AIActor.healthHaver.GetMaxHealth();
                            AIActor.healthHaver.SetHealthMaximum(actorHP * 1.5f);
                            AIActor.healthHaver.ForceSetCurrentHealth(actorHP * 1.5f);
                        }
                    }
                }
            }
        }
 public void AIActorMods(AIActor target)
 {
     if (target && target.healthHaver && !target.healthHaver.IsBoss && !target.healthHaver.IsSubboss && !target.IsSecretlyTheMineFlayer())
     {
         if (target.GetComponent <CompanionController>() == null && target.GetComponent <HasBeenDoubledByWitchsBrew>() == null && target.GetComponent <DisplacedImageController>() == null && target.GetComponent <MirrorImageController>() == null)
         {
             if (target.EnemyGuid != "22fc2c2c45fb47cf9fb5f7b043a70122")
             {
                 StartCoroutine(ToilEnemyDupe(target));
             }
         }
     }
 }