private IEnumerator TurnBossGrey(AIActor boss) { boss.RegisterOverrideColor(Color.grey, "AegisShield"); yield return(new WaitForSeconds(15)); boss.DeregisterOverrideColor("AegisShield"); }
private void MakeCompanion(PlayerController owner, AIActor targetActor, bool makeBlackPhantom, AIActor sourceCompanionData = null) { if (sourceCompanionData == null) { sourceCompanionData = EnemyDatabase.GetOrLoadByGuid("3a077fa5872d462196bb9a3cb1af02a3"); } targetActor.behaviorSpeculator.MovementBehaviors.Add(sourceCompanionData.behaviorSpeculator.MovementBehaviors[0]); targetActor.CanTargetPlayers = false; targetActor.CanTargetEnemies = true; targetActor.IgnoreForRoomClear = true; targetActor.HitByEnemyBullets = true; targetActor.IsSignatureEnemy = false; targetActor.IsHarmlessEnemy = false; targetActor.RegisterOverrideColor(new Color(0.5f, 0, 0.5f), "Charm Effect"); targetActor.name = "CompanionPet"; targetActor.PreventAutoKillOnBossDeath = true; targetActor.gameObject.AddComponent <CompanionController>(); CompanionController companionController = targetActor.gameObject.GetComponent <CompanionController>(); companionController.CanInterceptBullets = true; companionController.IsCop = false; companionController.IsCopDead = false; companionController.CopDeathStatModifier = new StatModifier() { statToBoost = 0, modifyType = StatModifier.ModifyMethod.ADDITIVE, amount = 0 }; companionController.CurseOnCopDeath = 2; companionController.CanCrossPits = targetActor.IsFlying; companionController.BlanksOnActiveItemUsed = false; companionController.InternalBlankCooldown = 10; companionController.HasStealthMode = false; companionController.PredictsChests = false; companionController.PredictsChestSynergy = 0; companionController.CanBePet = false; companionController.companionID = CompanionController.CompanionIdentifier.NONE; companionController.TeaSynergyHeatRing = new HeatRingModule(); companionController.m_petOffset = new Vector2(0, 0); // Do needed setup for Companion system. (makes enemy able to go through sealed doors, not damage player, etc) companionController.Initialize(owner); // Make things that deal damage via contact damage more useful. (they normally don't damage other enemies on their own) :P if (ContactDamageDealers.Contains(targetActor.EnemyGuid)) { targetActor.OverrideHitEnemies = true; targetActor.CollisionDamage = 1f; targetActor.CollisionDamageTypes = CoreDamageTypes.Electric; } if (makeBlackPhantom) { targetActor.BecomeBlackPhantom(); } }
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; }
public void EXPostProcessProjectile(Projectile projectile) { if (EnemyGUIDs == null | EnemyGUIDs.Count <= 0) { return; } AIActor sourceActor = EnemyDatabase.GetOrLoadByGuid(BraveUtility.RandomElement(EnemyGUIDs)); if (!sourceActor) { return; } float damageMod = m_baseDamageMod; if (projectile.sprite && projectile.sprite.renderer) { projectile.sprite.renderer.enabled = false; } if (sourceActor.EnemyGuid == "128db2f0781141bcb505d8f00f9e4d47" | sourceActor.EnemyGuid == "b54d89f9e802455cbb2b8a96a31e8259") { damageMod += 0.35f; } if (m_FiresJammedEnemies) { damageMod += 0.25f; } projectile.baseData.damage *= damageMod; if (sourceActor.EnemyGuid == "76bc43539fc24648bff4568c75c686d1") { projectile.baseData.damage /= 2f; projectile.AppliesStun = true; projectile.AppliedStunDuration = 3f; projectile.StunApplyChance = 0.4f; } if (!sourceActor.gameObject.GetComponent <ExplodeOnDeath>() && sourceActor.EnemyGuid != "76bc43539fc24648bff4568c75c686d1") { projectile.baseData.force += 5; } projectile.pierceMinorBreakables = true; Vector3 targetPosition = projectile.transform.position; AIActor targetAIActor = Instantiate(sourceActor, targetPosition, projectile.transform.rotation); if (projectile.Owner && projectile.Owner is PlayerController) { float ScaleMod = (projectile.Owner as PlayerController).BulletScaleModifier; targetAIActor.gameObject.layer = LayerMask.NameToLayer("Unpixelated"); targetAIActor.EnemyScale = new Vector2(ScaleMod, ScaleMod); SpriteOutlineManager.ChangeOutlineLayer(targetAIActor.sprite, LayerMask.NameToLayer("Unpixelated")); if (targetAIActor.EnemyScale != Vector2.one) { targetAIActor.HasShadow = false; Destroy(targetAIActor.ShadowObject); } ; } targetAIActor.specRigidbody.enabled = false; targetAIActor.IgnoreForRoomClear = true; targetAIActor.IsHarmlessEnemy = true; targetAIActor.CanTargetEnemies = true; targetAIActor.CanTargetPlayers = false; targetAIActor.procedurallyOutlined = false; if (!m_FiresJammedEnemies && targetAIActor.EnemyGuid != "76bc43539fc24648bff4568c75c686d1") { if (targetAIActor.EnemyGuid == "01972dee89fc4404a5c408d50007dad5") { targetAIActor.RegisterOverrideColor(new Color32(255, 240, 190, 220), "Pale BulletKin"); } else if (targetAIActor.EnemyGuid == "4d37ce3d666b4ddda8039929225b7ede") { targetAIActor.RegisterOverrideColor(new Color32(170, 170, 170, 190), "Pale Generic Enemy"); } else { targetAIActor.RegisterOverrideColor(new Color32(160, 160, 160, 170), "Pale Generic Enemy"); } } if (targetAIActor.specRigidbody.GetPixelCollider(ColliderType.Ground) != null) { PixelCollider EnemyCollider = targetAIActor.specRigidbody.GetPixelCollider(ColliderType.HitBox); PixelCollider NewProjCollider = ExpandUtility.DuplicatePixelCollider(EnemyCollider); NewProjCollider.CollisionLayer = CollisionLayer.Projectile; projectile.specRigidbody.PixelColliders = new List <PixelCollider>() { NewProjCollider }; projectile.specRigidbody.Reinitialize(); } targetAIActor.gameObject.transform.parent = projectile.transform; if (sourceActor.EnemyGuid == "01972dee89fc4404a5c408d50007dad5" | sourceActor.EnemyGuid == "4d37ce3d666b4ddda8039929225b7ede") { // targetPosition -= new Vector3(0.5f, 0.5f); targetAIActor.gameObject.transform.localPosition -= new Vector3(0.5f, 0.5f); } else if (sourceActor.EnemyGuid == "128db2f0781141bcb505d8f00f9e4d47" | sourceActor.EnemyGuid == "b54d89f9e802455cbb2b8a96a31e8259") { // targetPosition -= new Vector3(0.5f, 1); targetAIActor.gameObject.transform.localPosition -= new Vector3(0.5f, 1); } targetAIActor.sprite.UpdateZDepth(); if (m_FiresJammedEnemies) { targetAIActor.BecomeBlackPhantom(); } projectile.OnDestruction += OnDestruction; }
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); }
private void Update() { RoomHandler currentRoom = GameManager.Instance.PrimaryPlayer.CurrentRoom; List <AIActor> activeEnemies = currentRoom.GetActiveEnemies(RoomHandler.ActiveEnemyType.All); Vector2 vector = Vector2.zero; Vector2 b = Vector2.zero; float num; if (GameManager.Instance.PrimaryPlayer.CurrentGun && !GameManager.Instance.PrimaryPlayer.IsGhost) { num = GameManager.Instance.PrimaryPlayer.CurrentGun.CurrentAngle; } else { num = BraveMathCollege.Atan2Degrees(GameManager.Instance.PrimaryPlayer.unadjustedAimPoint.XY()); } vector = GameManager.Instance.PrimaryPlayer.CenterPosition; float a; if (GameManager.Instance.CurrentGameType == GameManager.GameType.COOP_2_PLAYER) { if (GameManager.Instance.SecondaryPlayer.CurrentGun && !GameManager.Instance.SecondaryPlayer.IsGhost) { a = GameManager.Instance.SecondaryPlayer.CurrentGun.CurrentAngle; } else { a = BraveMathCollege.Atan2Degrees(GameManager.Instance.SecondaryPlayer.unadjustedAimPoint.XY()); } b = GameManager.Instance.SecondaryPlayer.CenterPosition; } else { b = vector; a = num; } for (int i = 0; i < activeEnemies.Count; i++) { AIActor aiactor = activeEnemies[i]; if (aiactor && aiactor.healthHaver && aiactor.IsNormalEnemy && !aiactor.healthHaver.IsBoss && !aiactor.healthHaver.IsDead) { Vector2 centerPosition = aiactor.CenterPosition; float b2 = BraveMathCollege.Atan2Degrees(centerPosition - vector); float b3 = BraveMathCollege.Atan2Degrees(centerPosition - b); bool flag = BraveMathCollege.AbsAngleBetween(num, b2) < ConeAngle || BraveMathCollege.AbsAngleBetween(a, b3) < ConeAngle; if (flag) { if (aiactor.behaviorSpeculator) { aiactor.behaviorSpeculator.Stun(0.25f, false); } if (aiactor.IsBlackPhantom) { aiactor.UnbecomeBlackPhantom(); } aiactor.RegisterOverrideColor(new Color(0.4f, 0.4f, 0.33f, 1), "Turn to Stone"); } else if (!aiactor.IsBlackPhantom) { aiactor.DeregisterOverrideColor("Turn to Stone"); aiactor.BecomeBlackPhantom(); } } } }