Exemplo n.º 1
0
            private void AIActorPreSpawn(AIActor enemy)
            {
                if (enemy.EnemyGuid == "c182a5cb704d460d9d099a47af49c913")
                {
                    if (enemy.CanTargetEnemies == false && enemy.CanTargetPlayers == true)
                    {
                        CompanionController orAddComponent = enemy.gameObject.GetOrAddComponent <CompanionController>();
                        orAddComponent.companionID = CompanionController.CompanionIdentifier.NONE;
                        orAddComponent.Initialize(Owner);
                        CompanionisedEnemyBulletModifiers companionisedBullets = enemy.gameObject.GetOrAddComponent <CompanionisedEnemyBulletModifiers>();
                        companionisedBullets.jammedDamageMultiplier = 2;
                        companionisedBullets.TintBullets            = true;
                        companionisedBullets.TintColor        = ExtendedColours.honeyYellow;
                        companionisedBullets.baseBulletDamage = 10;

                        enemy.ApplyEffect(GameManager.Instance.Dungeon.sharedSettingsPrefab.DefaultPermanentCharmEffect, 1f, null);
                        enemy.gameObject.AddComponent <KillOnRoomClear>();
                        enemy.IsHarmlessEnemy    = true;
                        enemy.IgnoreForRoomClear = true;
                    }
                }
            }
Exemplo n.º 2
0
        private IEnumerator DoEnemySpawn(string enemyGuid, IntVector2 position, bool isJammed, bool isDisplaced)
        {
            //ETGModConsole.Log("DoEnemySpawn triggered");
            yield return(new WaitForSeconds(1f));

            try
            {
                if (Owner.IsInCombat)
                {
                    var enemyToSpawn = EnemyDatabase.GetOrLoadByGuid(enemyGuid);
                    Instantiate <GameObject>(EasyVFXDatabase.BloodiedScarfPoofVFX, position.ToVector3(), Quaternion.identity);
                    AIActor TargetActor = AIActor.Spawn(enemyToSpawn, position, GameManager.Instance.Dungeon.data.GetAbsoluteRoomFromPosition(position), true, AIActor.AwakenAnimationType.Default, true);
                    PhysicsEngine.Instance.RegisterOverlappingGhostCollisionExceptions(TargetActor.specRigidbody, null, false);
                    CustomEnemyTagsSystem tags = TargetActor.gameObject.GetOrAddComponent <CustomEnemyTagsSystem>();
                    tags.isKalibersEyeMinion = true;
                    tags.ignoreForGoodMimic  = true;

                    CompanionController orAddComponent = TargetActor.gameObject.GetOrAddComponent <CompanionController>();
                    orAddComponent.companionID = CompanionController.CompanionIdentifier.NONE;
                    orAddComponent.Initialize(Owner);

                    TargetActor.OverrideHitEnemies    = true;
                    TargetActor.CollisionDamage       = 0.5f;
                    TargetActor.CollisionDamageTypes |= CoreDamageTypes.Electric;

                    if (isJammed == true)
                    {
                        TargetActor.BecomeBlackPhantom();
                    }
                    CompanionisedEnemyBulletModifiers companionisedBullets = TargetActor.gameObject.GetOrAddComponent <CompanionisedEnemyBulletModifiers>();
                    companionisedBullets.jammedDamageMultiplier = 2f;
                    companionisedBullets.TintBullets            = true;
                    companionisedBullets.TintColor        = ExtendedColours.honeyYellow;
                    companionisedBullets.baseBulletDamage = 10f;
                    companionisedBullets.scaleSpeed       = true;
                    companionisedBullets.scaleDamage      = true;
                    companionisedBullets.scaleSize        = false;
                    companionisedBullets.doPostProcess    = false;
                    companionisedBullets.enemyOwner       = Owner;

                    TargetActor.ApplyEffect(GameManager.Instance.Dungeon.sharedSettingsPrefab.DefaultPermanentCharmEffect, 1f, null);
                    TargetActor.gameObject.AddComponent <KillOnRoomClear>();

                    if (isDisplaced)
                    {
                        DisplacedImageController displacedness = TargetActor.gameObject.AddComponent <DisplacedImageController>();
                        displacedness.Init();
                    }

                    if (EasyEnemyTypeLists.MultiPhaseEnemies.Contains(TargetActor.EnemyGuid) || EasyEnemyTypeLists.EnemiesWithInvulnerablePhases.Contains(TargetActor.EnemyGuid))
                    {
                        EraseFromExistenceOnRoomClear destroyTrickyEnemy = TargetActor.gameObject.AddComponent <EraseFromExistenceOnRoomClear>();
                        destroyTrickyEnemy.Delay = 1f;
                    }
                    TargetActor.IsHarmlessEnemy = true;
                    TargetActor.RegisterOverrideColor(Color.grey, "Ressurection");
                    TargetActor.IgnoreForRoomClear = true;
                    if (TargetActor.gameObject.GetComponent <SpawnEnemyOnDeath>())
                    {
                        Destroy(TargetActor.gameObject.GetComponent <SpawnEnemyOnDeath>());
                    }
                }
            }
            catch (Exception e)
            {
                ETGModConsole.Log(e.Message);
                ETGModConsole.Log(e.StackTrace);
            }
            yield break;
        }
        private void DisplacedImageSpawnHook(Action <DisplaceBehavior> orig, DisplaceBehavior sourceBehaviour)
        {
            orig(sourceBehaviour);
            AIActor attkOwner = sourceBehaviour.GetAttackBehaviourOwner();

            if (attkOwner != null)
            {
                if (attkOwner.GetComponent <CustomEnemyTagsSystem>() != null && attkOwner.GetComponent <CustomEnemyTagsSystem>().isKalibersEyeMinion)
                {
                    AIActor image = OMITBReflectionHelpers.ReflectGetField <AIActor>(typeof(DisplaceBehavior), "m_image", sourceBehaviour);
                    if (image != null)
                    {
                        PhysicsEngine.Instance.RegisterOverlappingGhostCollisionExceptions(image.specRigidbody, null, false);

                        CustomEnemyTagsSystem tags = image.gameObject.GetOrAddComponent <CustomEnemyTagsSystem>();
                        tags.isKalibersEyeMinion = true;
                        tags.ignoreForGoodMimic  = true;

                        if (attkOwner.CompanionOwner != null)
                        {
                            CompanionController orAddComponent = image.gameObject.GetOrAddComponent <CompanionController>();
                            orAddComponent.companionID = CompanionController.CompanionIdentifier.NONE;
                            orAddComponent.Initialize(attkOwner.CompanionOwner);
                        }

                        image.OverrideHitEnemies    = true;
                        image.CollisionDamage       = 0.5f;
                        image.CollisionDamageTypes |= CoreDamageTypes.Electric;

                        CompanionisedEnemyBulletModifiers companionisedBullets = image.gameObject.GetOrAddComponent <CompanionisedEnemyBulletModifiers>();
                        companionisedBullets.jammedDamageMultiplier = 2f;
                        companionisedBullets.TintBullets            = true;
                        companionisedBullets.TintColor        = ExtendedColours.honeyYellow;
                        companionisedBullets.baseBulletDamage = 10f;
                        companionisedBullets.scaleSpeed       = true;
                        companionisedBullets.scaleDamage      = true;
                        companionisedBullets.scaleSize        = false;
                        companionisedBullets.doPostProcess    = false;
                        if (attkOwner.CompanionOwner != null)
                        {
                            companionisedBullets.enemyOwner = attkOwner.CompanionOwner;
                        }

                        image.ApplyEffect(GameManager.Instance.Dungeon.sharedSettingsPrefab.DefaultPermanentCharmEffect, 1f, null);
                        image.gameObject.AddComponent <KillOnRoomClear>();


                        if (EasyEnemyTypeLists.MultiPhaseEnemies.Contains(image.EnemyGuid) || EasyEnemyTypeLists.EnemiesWithInvulnerablePhases.Contains(image.EnemyGuid))
                        {
                            EraseFromExistenceOnRoomClear destroyTrickyEnemy = image.gameObject.AddComponent <EraseFromExistenceOnRoomClear>();
                            destroyTrickyEnemy.Delay = 1f;
                        }
                        image.IsHarmlessEnemy = true;
                        image.RegisterOverrideColor(Color.grey, "Ressurection");
                        image.IgnoreForRoomClear = true;
                        if (image.gameObject.GetComponent <SpawnEnemyOnDeath>())
                        {
                            UnityEngine.Object.Destroy(image.gameObject.GetComponent <SpawnEnemyOnDeath>());
                        }
                    }
                }
            }
        }
        public static AIActor SpawnCompanionisedEnemy(PlayerController owner, string enemyGuid, IntVector2 position, bool doTint, Color enemyTint, int baseDMG, int jammedDMGMult, bool shouldBeJammed, bool doFriendlyOverhead)
        {
            var enemyToSpawn = EnemyDatabase.GetOrLoadByGuid(enemyGuid);

            UnityEngine.Object.Instantiate <GameObject>(EasyVFXDatabase.BloodiedScarfPoofVFX, position.ToVector3(), Quaternion.identity);
            AIActor TargetActor = AIActor.Spawn(enemyToSpawn, position, GameManager.Instance.Dungeon.data.GetAbsoluteRoomFromPosition(position), true, AIActor.AwakenAnimationType.Default, true);

            PhysicsEngine.Instance.RegisterOverlappingGhostCollisionExceptions(TargetActor.specRigidbody, null, false);

            CompanionController orAddComponent = TargetActor.gameObject.GetOrAddComponent <CompanionController>();

            orAddComponent.companionID = CompanionController.CompanionIdentifier.NONE;
            orAddComponent.Initialize(owner);

            if (shouldBeJammed == true)
            {
                TargetActor.BecomeBlackPhantom();
            }
            CompanionisedEnemyBulletModifiers companionisedBullets = TargetActor.gameObject.GetOrAddComponent <CompanionisedEnemyBulletModifiers>();

            companionisedBullets.jammedDamageMultiplier = jammedDMGMult;
            companionisedBullets.TintBullets            = true;
            companionisedBullets.TintColor        = ExtendedColours.honeyYellow;
            companionisedBullets.baseBulletDamage = baseDMG;

            TargetActor.ApplyEffect(GameManager.Instance.Dungeon.sharedSettingsPrefab.DefaultPermanentCharmEffect, 1f, null);
            TargetActor.gameObject.AddComponent <KillOnRoomClear>();
            ContinualKillOnRoomClear contKill = TargetActor.gameObject.AddComponent <ContinualKillOnRoomClear>();

            if (EasyEnemyTypeLists.MultiPhaseEnemies.Contains(TargetActor.EnemyGuid))
            {
                contKill.forceExplode       = true;
                contKill.eraseInsteadOfKill = true;
            }
            TargetActor.IsHarmlessEnemy = true;
            if (doTint)
            {
                TargetActor.RegisterOverrideColor(enemyTint, "CompanionisedEnemyTint");
            }
            TargetActor.IgnoreForRoomClear = true;

            if (doFriendlyOverhead)
            {
                GameObject     gameObject = UnityEngine.Object.Instantiate <GameObject>(FriendlyVFX);
                tk2dBaseSprite component  = gameObject.GetComponent <tk2dBaseSprite>();
                gameObject.transform.parent = TargetActor.transform;
                if (TargetActor.healthHaver.IsBoss)
                {
                    gameObject.transform.position = TargetActor.specRigidbody.HitboxPixelCollider.UnitTopCenter;
                }
                else
                {
                    Bounds  bounds = TargetActor.sprite.GetBounds();
                    Vector3 vector = TargetActor.transform.position + new Vector3((bounds.max.x + bounds.min.x) / 2f, bounds.max.y, 0f).Quantize(0.0625f);
                    gameObject.transform.position = TargetActor.sprite.WorldCenter.ToVector3ZUp(0f).WithY(vector.y);
                }
                component.HeightOffGround = 0.5f;
                TargetActor.sprite.AttachRenderer(component);
            }

            return(TargetActor);
        }