private void OnKill(Projectile arg1, SpeculativeRigidbody arg2) { bool flag = !arg2.aiActor.healthHaver.IsDead; if (flag) { int num3 = UnityEngine.Random.Range(0, 4); bool flag3 = num3 == 0; if (flag3) { AkSoundEngine.PostEvent("Play_OBJ_chestwarp_use_01", gameObject); PlayerController player = (GameManager.Instance.PrimaryPlayer); string guid; guid = "ChaosBeing"; PlayerController owner = player; AIActor orLoadByGuid = EnemyDatabase.GetOrLoadByGuid(guid); IntVector2? intVector = new IntVector2?(player.CurrentRoom.GetRandomVisibleClearSpot(2, 2)); AIActor aiactor = AIActor.Spawn(orLoadByGuid.aiActor, intVector.Value, GameManager.Instance.Dungeon.data.GetAbsoluteRoomFromPosition(intVector.Value), true, AIActor.AwakenAnimationType.Default, true); aiactor.CanTargetEnemies = false; aiactor.CanTargetPlayers = true; PhysicsEngine.Instance.RegisterOverlappingGhostCollisionExceptions(aiactor.specRigidbody, null, false); aiactor.IsHarmlessEnemy = false; aiactor.IgnoreForRoomClear = true; aiactor.HandleReinforcementFallIntoRoom(-1f); SpawnManager.SpawnVFX((PickupObjectDatabase.GetById(573) as ChestTeleporterItem).TeleportVFX, aiactor.sprite.WorldCenter.ToVector3ZisY(0f), Quaternion.identity).GetComponent <tk2dBaseSprite>().PlaceAtPositionByAnchor(aiactor.sprite.WorldCenter.ToVector3ZisY(0f), tk2dBaseSprite.Anchor.MiddleCenter); } } }
public override void OnPostFired(PlayerController player, Gun gun) { //This determines what sound you want to play when you fire a gun. //Sounds names are based on the Gungeon sound dump, which can be found at EnterTheGungeon/Etg_Data/StreamingAssets/Audio/GeneratedSoundBanks/Windows/sfx.txt gun.PreventNormalFireAudio = true; string guid; guid = "86dfc13486ee4f559189de53cfb84107"; PlayerController owner = player; if (player.PlayerHasActiveSynergy("Ye Olden Ages")) { guid = "05891b158cd542b1a5f3df30fb67a7ff"; } AIActor orLoadByGuid = EnemyDatabase.GetOrLoadByGuid(guid); IntVector2?intVector = new IntVector2?(player.CurrentRoom.GetRandomVisibleClearSpot(2, 2)); AIActor aiactor = AIActor.Spawn(orLoadByGuid.aiActor, intVector.Value, GameManager.Instance.Dungeon.data.GetAbsoluteRoomFromPosition(intVector.Value), true, AIActor.AwakenAnimationType.Default, true); aiactor.CanTargetEnemies = true; aiactor.CanTargetPlayers = false; PhysicsEngine.Instance.RegisterOverlappingGhostCollisionExceptions(aiactor.specRigidbody, null, false); aiactor.gameObject.AddComponent <KillOnRoomClear>(); aiactor.IsHarmlessEnemy = true; aiactor.IgnoreForRoomClear = true; aiactor.HandleReinforcementFallIntoRoom(0f); }
public void knightPlacer(PlayerController owner) { AIActor orLoadByGuid = EnemyDatabase.GetOrLoadByGuid("ec8ea75b557d4e7b8ceeaacdf6f8238c"); IntVector2 aim = Vector2Extensions.ToIntVector2(owner.unadjustedAimPoint, VectorConversions.Round); RoomHandler room = GameManager.Instance.Dungeon.data.GetAbsoluteRoomFromPosition(aim); if (room != null && room == owner.CurrentRoom && owner.IsInCombat) { AIActor aiActor = AIActor.Spawn(orLoadByGuid.aiActor, owner.CenterPosition, room, true, AIActor.AwakenAnimationType.Default, true); PhysicsEngine.Instance.RegisterOverlappingGhostCollisionExceptions(aiActor.specRigidbody, null, false); aiActor.CanTargetEnemies = true; aiActor.CanTargetPlayers = false; aiActor.IsHarmlessEnemy = true; aiActor.CanDropCurrency = false; aiActor.IgnoreForRoomClear = true; aiActor.MovementSpeed = 6.3f; aiActor.gameObject.AddComponent <KillOnRoomClear>(); aiActor.reinforceType = AIActor.ReinforceType.Instant; aiActor.HandleReinforcementFallIntoRoom(.1f); nut = aiActor; MindControlEffect orAddComponent = aiActor.gameObject.GetOrAddComponent <MindControlEffect>(); orAddComponent.owner = (this.gun.CurrentOwner as PlayerController); } }
private void SpawnKevin() { string kevinGuid; if (Owner.HasPickupID(118)) { kevinGuid = "70216cae6c1346309d86d4a0b4603045"; } else { kevinGuid = "01972dee89fc4404a5c408d50007dad5"; } PlayerController player = this.Owner; var Kevin = EnemyDatabase.GetOrLoadByGuid(kevinGuid); IntVector2?bestRewardLocation = Owner.CurrentRoom.GetRandomVisibleClearSpot(2, 2); AIActor TargetActor = AIActor.Spawn(Kevin.aiActor, bestRewardLocation.Value, GameManager.Instance.Dungeon.data.GetAbsoluteRoomFromPosition(bestRewardLocation.Value), true, AIActor.AwakenAnimationType.Default, true); //TargetActor.gameActor.ApplyEffect(this.charmEffect, 100f, null); TargetActor.CanTargetEnemies = true; TargetActor.CanTargetPlayers = false; PhysicsEngine.Instance.RegisterOverlappingGhostCollisionExceptions(TargetActor.specRigidbody, null, false); TargetActor.gameObject.AddComponent <KillOnRoomClear>(); TargetActor.IsHarmlessEnemy = true; //TargetActor.healthHaver.bossHealthBar = HealthHaver.BossBarType.MainBar; TargetActor.IgnoreForRoomClear = true; TargetActor.HandleReinforcementFallIntoRoom(0f); TargetActor.gameObject.AddComponent <AIActorIsKevin>(); //PRAISE BE OUR LORD AND SAVIOUR KEVIN. YOU WILL BOW TO HIM, OR YOU WILL DIE. }
private void SpawnGrim() { string guid; if (this.Owner) { guid = "0d3f7c641557426fbac8596b61c9fb45"; } else { guid = "0d3f7c641557426fbac8596b61c9fb45"; } PlayerController owner = base.Owner; AIActor orLoadByGuid = EnemyDatabase.GetOrLoadByGuid(guid); IntVector2? intVector = new IntVector2?(base.Owner.CurrentRoom.GetRandomVisibleClearSpot(2, 2)); AIActor aiactor = AIActor.Spawn(orLoadByGuid.aiActor, intVector.Value, GameManager.Instance.Dungeon.data.GetAbsoluteRoomFromPosition(intVector.Value), true, AIActor.AwakenAnimationType.Default, true); aiactor.CanTargetEnemies = false; aiactor.CanTargetPlayers = true; PhysicsEngine.Instance.RegisterOverlappingGhostCollisionExceptions(aiactor.specRigidbody, null, false); aiactor.gameObject.AddComponent <KillOnRoomClear>(); aiactor.IsHarmlessEnemy = false; aiactor.IgnoreForRoomClear = true; aiactor.MovementSpeed = .5f; aiactor.reinforceType = AIActor.ReinforceType.Instant; aiactor.HandleReinforcementFallIntoRoom(0f); }
public void tophat(Vector3 position) { string guid; guid = "5861e5a077244905a8c25c2b7b4d6ebb"; if (Owner.PlayerHasActiveSynergy("Hat's Off to You")) { guid = "ddf12a4881eb43cfba04f36dd6377abb"; } if (Owner.HasPickupID(Game.Items["cak:hat_shells"].PickupObjectId)) { } PlayerController owner = base.Owner; AIActor orLoadByGuid = EnemyDatabase.GetOrLoadByGuid(guid); IntVector2? intVector = new IntVector2?(base.Owner.CurrentRoom.GetRandomVisibleClearSpot(2, 2)); AIActor aiactor = AIActor.Spawn(orLoadByGuid.aiActor, intVector.Value, GameManager.Instance.Dungeon.data.GetAbsoluteRoomFromPosition(intVector.Value), true, AIActor.AwakenAnimationType.Default, true); aiactor.CanTargetEnemies = true; aiactor.CanTargetPlayers = false; PhysicsEngine.Instance.RegisterOverlappingGhostCollisionExceptions(aiactor.specRigidbody, null, false); aiactor.gameObject.AddComponent <KillOnRoomClear>(); aiactor.IsHarmlessEnemy = true; aiactor.IgnoreForRoomClear = true; aiactor.HandleReinforcementFallIntoRoom(0f); }
protected override void DoEffect(PlayerController user) { base.DoEffect(user); if (user.CurrentRoom != null && user) { List <AIActor> activeEnemies = user.CurrentRoom.GetActiveEnemies(RoomHandler.ActiveEnemyType.All); if (activeEnemies.Count != 0 && activeEnemies != null) { for (int counter = 0; counter < activeEnemies.Count; counter++) { AIActor actor = activeEnemies[counter]; if (actor && actor.healthHaver && !actor.healthHaver.IsBoss && actor.gameObject.GetComponent <GhostAllyComponent>() == null && actor.healthHaver.IsVulnerable && actor.IsNormalEnemy && !actor.IsMimicEnemy && actor.GetResistanceForEffectType(EffectResistanceType.Charm) != 1) { List <int> Colors = new List <int> { 7, 141, 222 }; GameActorCharmEffect ghostCharm = GameManager.Instance.Dungeon.sharedSettingsPrefab.DefaultPermanentCharmEffect; ghostCharm.OverheadVFX = null; ghostCharm.TintColor = new Color(Colors[0], Colors[1], Colors[2]); ghostCharm.TintColor.a /= 100; string guid = actor.EnemyGuid; AIActor aiactor = BoxOTools.SummonAtRandomPosition(guid, user); aiactor.AddPermanentCharm(ghostCharm); aiactor.gameObject.AddComponent <GhostAllyComponent>(); aiactor.HandleReinforcementFallIntoRoom(counter / 10); } } } } }
public void SpawnParamedic(PlayerController player) { string guid; if (player) { guid = "22fc2c2c45fb47cf9fb5f7b043a70122"; } else { guid = "22fc2c2c45fb47cf9fb5f7b043a70122"; } AIActor orLoadByGuid = EnemyDatabase.GetOrLoadByGuid(guid); IntVector2?intVector = new IntVector2?(player.CurrentRoom.GetRandomVisibleClearSpot(2, 2)); AIActor aiactor = AIActor.Spawn(orLoadByGuid.aiActor, player.AimCenter, GameManager.Instance.Dungeon.data.GetAbsoluteRoomFromPosition(intVector.Value), true, AIActor.AwakenAnimationType.Spawn, true); aiactor.CanTargetEnemies = false; aiactor.CanTargetPlayers = true; PhysicsEngine.Instance.RegisterOverlappingGhostCollisionExceptions(aiactor.specRigidbody, null, false); aiactor.IsHarmlessEnemy = false; aiactor.IgnoreForRoomClear = true; aiactor.reinforceType = AIActor.ReinforceType.Instant; aiactor.HandleReinforcementFallIntoRoom(0f); }
private void HandleSpawn(AIActor spawnedActor) { if (!IsGlitchedLJ) { if (!string.IsNullOrEmpty(spawnAnim)) { spawnedActor.aiAnimator.PlayUntilFinished(spawnAnim, false, null, -1f, false); } } if (!IsGlitchedLJ) { ChaosSpawnGlitchEnemyOnDeath component = spawnedActor.GetComponent <ChaosSpawnGlitchEnemyOnDeath>(); if (component) { component.guaranteedSpawnGenerations = Mathf.Max(0f, guaranteedSpawnGenerations - 1f); } } if (!spawnsCanDropLoot) { spawnedActor.CanDropCurrency = false; spawnedActor.CanDropItems = false; } if (DoNormalReinforcement) { spawnedActor.HandleReinforcementFallIntoRoom(0.1f); } }
//applies damage on last use protected override void DoEffect(PlayerController user) { AkSoundEngine.PostEvent("Play_ENM_smiley_whistle_02", base.gameObject); string guid; if (user) { guid = "86237c6482754cd29819c239403a2de7"; } else { guid = "86237c6482754cd29819c239403a2de7"; } AIActor orLoadByGuid = EnemyDatabase.GetOrLoadByGuid(guid); IntVector2?intVector = new IntVector2?(user.CurrentRoom.GetRandomVisibleClearSpot(2, 2)); AIActor aiactor = AIActor.Spawn(orLoadByGuid.aiActor, intVector.Value, GameManager.Instance.Dungeon.data.GetAbsoluteRoomFromPosition(intVector.Value), true, AIActor.AwakenAnimationType.Default, true); aiactor.CanTargetEnemies = true; aiactor.CanTargetPlayers = false; PhysicsEngine.Instance.RegisterOverlappingGhostCollisionExceptions(aiactor.specRigidbody, null, false); aiactor.gameObject.AddComponent <KillOnRoomClear>(); aiactor.IsHarmlessEnemy = false; aiactor.IgnoreForRoomClear = true; aiactor.reinforceType = AIActor.ReinforceType.Instant; aiactor.HandleReinforcementFallIntoRoom(0f); }
public void tophat(PlayerController player, HealthHaver enemy) { int bighead = UnityEngine.Random.Range(1, 6); if (bighead == 1) { if (!enemy.healthHaver.IsBoss) { string guid; guid = enemy.aiActor.EnemyGuid; if (guid != "4db03291a12144d69fe940d5a01de376") { PlayerController owner = base.Owner; AIActor orLoadByGuid = EnemyDatabase.GetOrLoadByGuid(guid); IntVector2? intVector = new IntVector2?(base.Owner.CurrentRoom.GetRandomVisibleClearSpot(2, 2)); AIActor aiactor = AIActor.Spawn(orLoadByGuid.aiActor, intVector.Value, GameManager.Instance.Dungeon.data.GetAbsoluteRoomFromPosition(intVector.Value), true, AIActor.AwakenAnimationType.Default, true); aiactor.CanTargetEnemies = true; aiactor.CanTargetPlayers = false; PhysicsEngine.Instance.RegisterOverlappingGhostCollisionExceptions(aiactor.specRigidbody, null, false); aiactor.gameObject.AddComponent <KillOnRoomClear>(); aiactor.IsHarmlessEnemy = true; aiactor.IgnoreForRoomClear = true; aiactor.HandleReinforcementFallIntoRoom(0f); } } } }
protected override void DoEffect(PlayerController user) { for (int i = 0; i < 4; i++) { try { var BulletKin = EnemyDatabase.GetOrLoadByGuid("01972dee89fc4404a5c408d50007dad5"); //float radius = 5; //var random = UnityEngine.Random.insideUnitCircle * radius; //IntVector2 temp = random.ToIntVector2() + LastOwner.CurrentRoom.GetNearestCellToPosition(LastOwner.specRigidbody.UnitCenter).position; // or something like this to get the player's pos relative to the room //IntVector2? spawnPos = LastOwner.CurrentRoom.GetRandomAvailableCell(temp); IntVector2?spawnPos = LastOwner.CurrentRoom.GetRandomVisibleClearSpot(1, 1); if (spawnPos != null) { AIActor TargetActor = AIActor.Spawn(BulletKin.aiActor, spawnPos.Value, GameManager.Instance.Dungeon.data.GetAbsoluteRoomFromPosition(spawnPos.Value), true, AIActor.AwakenAnimationType.Default, true); TargetActor.ApplyEffect(GameManager.Instance.Dungeon.sharedSettingsPrefab.DefaultPermanentCharmEffect, 1f, null); PhysicsEngine.Instance.RegisterOverlappingGhostCollisionExceptions(TargetActor.specRigidbody, null, false); TargetActor.gameObject.AddComponent <KillOnRoomClear>(); TargetActor.IsHarmlessEnemy = true; TargetActor.IgnoreForRoomClear = true; TargetActor.HandleReinforcementFallIntoRoom(0f); } } catch (Exception e) { ETGModConsole.Log(e.Message); } } }
// This function doesn't null check orLoadByGuid. If non fake prefab custom enemies are spawned (like the special rats on Hollow), then this would cause exception. // Added fall back GUIDs and use one of those for AIActor instead if this happens. public void AddSpecificEnemyToRoomProcedurallyFixed(RoomHandler room, string enemyGuid, bool reinforcementSpawn = false, Vector2?goalPosition = null) { AIActor orLoadByGuid = EnemyDatabase.GetOrLoadByGuid(enemyGuid); if (!orLoadByGuid) { List <string> FallbackGUIDs = new List <string>() { ExpandCustomEnemyDatabase.BootlegBullatGUID, ExpandCustomEnemyDatabase.BootlegBulletManGUID, ExpandCustomEnemyDatabase.BootlegBulletManBandanaGUID, ExpandCustomEnemyDatabase.BootlegShotgunManBlueGUID, ExpandCustomEnemyDatabase.BootlegShotgunManRedGUID }; FallbackGUIDs = FallbackGUIDs.Shuffle(); orLoadByGuid = EnemyDatabase.GetOrLoadByGuid(BraveUtility.RandomElement(FallbackGUIDs)); } IntVector2 clearance = orLoadByGuid.specRigidbody.UnitDimensions.ToIntVector2(VectorConversions.Ceil); CellValidator cellValidator = delegate(IntVector2 c) { for (int i = 0; i < clearance.x; i++) { int x = c.x + i; for (int j = 0; j < clearance.y; j++) { int y = c.y + j; if (GameManager.Instance.Dungeon.data.isTopWall(x, y)) { return(false); } } } return(true); }; IntVector2?intVector; if (goalPosition != null) { intVector = room.GetNearestAvailableCell(goalPosition.Value, new IntVector2?(clearance), new CellTypes?(CellTypes.FLOOR), false, cellValidator); } else { intVector = room.GetRandomAvailableCell(new IntVector2?(clearance), new CellTypes?(CellTypes.FLOOR), false, cellValidator); } if (intVector != null) { AIActor aiactor = AIActor.Spawn(orLoadByGuid, intVector.Value, room, true, AIActor.AwakenAnimationType.Spawn, false); if (aiactor && reinforcementSpawn) { if (aiactor.specRigidbody) { aiactor.specRigidbody.CollideWithOthers = false; } aiactor.HandleReinforcementFallIntoRoom(0f); } } else { Debug.LogError("failed placement"); } }
// Token: 0x06000056 RID: 86 RVA: 0x00004194 File Offset: 0x00002394 public void KnightPlacer(PlayerController owner) { try { AIActor orLoadByGuid = EnemyDatabase.GetOrLoadByGuid("ec8ea75b557d4e7b8ceeaacdf6f8238c"); IntVector2 intVector = Vector2Extensions.ToIntVector2(owner.unadjustedAimPoint, (VectorConversions)2); RoomHandler absoluteRoomFromPosition = GameManager.Instance.Dungeon.data.GetAbsoluteRoomFromPosition(intVector); bool flag = absoluteRoomFromPosition != null && absoluteRoomFromPosition == owner.CurrentRoom && owner.IsInCombat; if (flag) { AIActor aiactor = AIActor.Spawn(orLoadByGuid.aiActor, owner.CenterPosition, absoluteRoomFromPosition, true, (AIActor.AwakenAnimationType) 2, true); PhysicsEngine.Instance.RegisterOverlappingGhostCollisionExceptions(aiactor.specRigidbody, null, false); aiactor.CanTargetEnemies = true; aiactor.CanTargetPlayers = false; aiactor.IsHarmlessEnemy = true; aiactor.CanDropCurrency = false; aiactor.IgnoreForRoomClear = true; aiactor.MovementSpeed = 5.95f; aiactor.CompanionOwner = owner; aiactor.IsBuffEnemy = true; aiactor.isPassable = true; aiactor.gameObject.AddComponent <KillOnRoomClear>(); aiactor.reinforceType = (AIActor.ReinforceType) 2; aiactor.HandleReinforcementFallIntoRoom(0.1f); //added this so the player doesn't collide with the nut when dodge rolling, he goes through companions aiactor.gameObject.AddComponent <CompanionController>(); CompanionController component = aiactor.gameObject.GetComponent <CompanionController>(); component.Initialize(owner); this.nut = aiactor; MindControlEffect orAddComponent = GameObjectExtensions.GetOrAddComponent <MindControlEffect>(aiactor.gameObject); orAddComponent.owner = (this.gun.CurrentOwner as PlayerController); // to make the nut invincible against the player effects or any other damage effects if (aiactor.healthHaver != null) { aiactor.healthHaver.PreventAllDamage = true; } // to prevent the attacks of the nut from damaging the player if (aiactor.bulletBank != null) { AIBulletBank bulletBank = aiactor.bulletBank; bulletBank.OnProjectileCreated = (Action <Projectile>)Delegate.Combine(bulletBank.OnProjectileCreated, new Action <Projectile>(CopperChariot.OnPostProcessProjectile)); } if (aiactor.aiShooter != null) { AIShooter aiShooter = aiactor.aiShooter; aiShooter.PostProcessProjectile = (Action <Projectile>)Delegate.Combine(aiShooter.PostProcessProjectile, new Action <Projectile>(CopperChariot.OnPostProcessProjectile)); } } } catch (Exception e) { Tools.Print("Copper KnightPlacer", "FFFFFF", true); Tools.PrintException(e); } }
private void OnEnemyDamaged(float damage, bool fatal, HealthHaver enemy) { if (!Owner.PlayerHasActiveSynergy("REANIMATE")) { if (fatal && enemy && enemy.aiActor && enemy.aiActor.EnemyGuid != "699cd24270af4cd183d671090d8323a1") { if (Owner.CurrentRoom != null) { if (BoxOTools.BasicRandom(0.975f) && DoneKill) { try { AIActor aiactor = BoxOTools.SummonAtRandomPosition("699cd24270af4cd183d671090d8323a1", Owner); if (base.Owner.PlayerHasActiveSynergy("keysight")) { aiactor.IsHarmlessEnemy = true; aiactor.BecomeBlackPhantom(); } if (!base.Owner.PlayerHasActiveSynergy("keysight")) { aiactor.PreventBlackPhantom = true; } aiactor.HandleReinforcementFallIntoRoom(0f); DoneKill = false; } catch (Exception Error) { ETGModConsole.Log(Error.Message); } } } } } else { if (BoxOTools.BasicRandom(0.8f) && enemy && enemy.aiActor && Owner.CurrentRoom != null && fatal) { if (BoxOTools.BasicRandom(0.3f) || base.Owner.PlayerHasActiveSynergy("keysight")) { AIActor aiactor = BoxOTools.SummonAtRandomPosition("336190e29e8a4f75ab7486595b700d4a", Owner); BoxOTools.AddPermanentCharm(aiactor); aiactor.HandleReinforcementFallIntoRoom(0f); } else { AIActor aiactor = BoxOTools.SummonAtRandomPosition("95ec774b5a75467a9ab05fa230c0c143", Owner); BoxOTools.AddPermanentCharm(aiactor); aiactor.HandleReinforcementFallIntoRoom(0f); } } } }
private void OnEnteredCombat() { if (Owner && UnityEngine.Random.value <= 0.015f) { var KeyBulletKin = EnemyDatabase.GetOrLoadByGuid("699cd24270af4cd183d671090d8323a1"); IntVector2?spawnPos = Owner.CurrentRoom.GetRandomVisibleClearSpot(1, 1); if (spawnPos != null) { AIActor TargetActor = AIActor.Spawn(KeyBulletKin.aiActor, spawnPos.Value, GameManager.Instance.Dungeon.data.GetAbsoluteRoomFromPosition(spawnPos.Value), true, AIActor.AwakenAnimationType.Default, true); PhysicsEngine.Instance.RegisterOverlappingGhostCollisionExceptions(TargetActor.specRigidbody, null, false); TargetActor.HandleReinforcementFallIntoRoom(0f); } } }
private void Spawnhando() { //boss checker PlayerController owner = (PlayerController)this.gun.CurrentOwner; bool inBossFight = false; if (owner.CurrentRoom != null && owner.CurrentRoom.HasActiveEnemies(RoomHandler.ActiveEnemyType.All)) { foreach (AIActor aiactor in owner.CurrentRoom.GetActiveEnemies(RoomHandler.ActiveEnemyType.All)) { if (aiactor != null && aiactor.healthHaver != null && aiactor.healthHaver.IsBoss) { inBossFight = true; } } } //lichspawner if (inBossFight && HasSynergy) { string guid; if (this.gun.CurrentOwner) { guid = "cf27dd464a504a428d87a8b2560ad40a"; } else { guid = "cf27dd464a504a428d87a8b2560ad40a"; } AIActor orLoadByGuid = EnemyDatabase.GetOrLoadByGuid(guid); IntVector2?intVector = new IntVector2?(owner.CurrentRoom.GetRandomVisibleClearSpot(2, 2)); AIActor aiactor = AIActor.Spawn(orLoadByGuid.aiActor, intVector.Value, GameManager.Instance.Dungeon.data.GetAbsoluteRoomFromPosition(intVector.Value), true, AIActor.AwakenAnimationType.Default, true); aiactor.CanTargetEnemies = true; aiactor.CanTargetPlayers = false; PhysicsEngine.Instance.RegisterOverlappingGhostCollisionExceptions(aiactor.specRigidbody, null, false); aiactor.gameObject.AddComponent <KillOnRoomClear>(); aiactor.IsHarmlessEnemy = true; aiactor.CompanionOwner = owner; aiactor.CanDropCurrency = false; aiactor.IsNormalEnemy = true; aiactor.isPassable = true; aiactor.IgnoreForRoomClear = true; aiactor.reinforceType = AIActor.ReinforceType.Instant; aiactor.HandleReinforcementFallIntoRoom(0f); } }
public void knightPlacer(PlayerController owner) { IntVector2 aim = Vector2Extensions.ToIntVector2(owner.unadjustedAimPoint, VectorConversions.Round); RoomHandler room = GameManager.Instance.Dungeon.data.GetAbsoluteRoomFromPosition(aim); if (room != null && room == owner.CurrentRoom && owner.IsInCombat) { AIActor orLoadByGuid = EnemyDatabase.GetOrLoadByGuid("ec8ea75b557d4e7b8ceeaacdf6f8238c"); AIActor aiActor = AIActor.Spawn(orLoadByGuid.aiActor, owner.CenterPosition, room, true, AIActor.AwakenAnimationType.Spawn, true); PhysicsEngine.Instance.RegisterOverlappingGhostCollisionExceptions(aiActor.specRigidbody, null, false); aiActor.CanTargetEnemies = true; aiActor.CanTargetPlayers = false; aiActor.IsHarmlessEnemy = true; aiActor.CanDropCurrency = false; aiActor.IgnoreForRoomClear = true; aiActor.MovementSpeed = 6.1f; aiActor.CompanionOwner = owner; aiActor.IsBuffEnemy = true; aiActor.isPassable = true; aiActor.gameObject.AddComponent <KillOnRoomClear>(); aiActor.reinforceType = AIActor.ReinforceType.Instant; aiActor.HandleReinforcementFallIntoRoom(.1f); nut = aiActor; MindControlEffect mindControl = aiActor.gameObject.GetOrAddComponent <MindControlEffect>(); mindControl.owner = (this.gun.CurrentOwner as PlayerController); aiActor.aiShooter.IsReallyBigBoy = true; aiActor.aiShooter.customShootCooldownPeriod = .25f; aiActor.Update(); if (nut.bulletBank != null) { AIBulletBank bulletBank = nut.bulletBank; bulletBank.OnProjectileCreated = (Action <Projectile>)Delegate.Combine(bulletBank.OnProjectileCreated, new Action <Projectile>(CopperChariot.OnPostProcessProjectile)); } if (nut.aiShooter != null) { AIShooter aiShooter = nut.aiShooter; aiShooter.PostProcessProjectile = (Action <Projectile>)Delegate.Combine(aiShooter.PostProcessProjectile, new Action <Projectile>(CopperChariot.OnPostProcessProjectile)); } } }
private void OnEnemyDamaged(float damage, bool fatal, HealthHaver enemy) { PlayerController user = base.LastOwner; if (fatal) { if (BoxOTools.BasicRandom(0.985f)) { if (enemy != null && enemy.specRigidbody != null && enemy.aiActor != null && base.LastOwner != null) { switch (pick3) { case 1: LootEngine.SpawnItem(PickupObjectDatabase.GetById(67).gameObject, enemy.specRigidbody.UnitCenter, Vector2.zero, 1f, false, true, false); break; case 2: LootEngine.SpawnItem(PickupObjectDatabase.GetById(565).gameObject, enemy.specRigidbody.UnitCenter, Vector2.zero, 1f, false, true, false); break; case 3: StatModifier damageboost = new StatModifier { statToBoost = PlayerStats.StatType.Damage, amount = 0.01f, modifyType = StatModifier.ModifyMethod.ADDITIVE }; user.ownerlessStatModifiers.Add(damageboost); user.stats.RecalculateStats(user, true, false); AkSoundEngine.PostEvent("Play_OBJ_power_up_01", base.gameObject); break; case 4: IntVector2?intVector = new IntVector2?(this.LastOwner.CurrentRoom.GetRandomVisibleClearSpot(1, 1)); var BulletKin = EnemyDatabase.GetOrLoadByGuid("a446c626b56d4166915a4e29869737fd"); if (enemy.aiActor.EnemyGuid != "a446c626b56d4166915a4e29869737fd") { AIActor aiactor = AIActor.Spawn(BulletKin.aiActor, intVector.Value, GameManager.Instance.Dungeon.data.GetAbsoluteRoomFromPosition(intVector.Value), true, AIActor.AwakenAnimationType.Awaken, true); aiactor.HandleReinforcementFallIntoRoom(0f); } break; } } } } }
void SpawnAll(string[] args) { if (!ArgCount(args, 0)) { return; } foreach (EnemyDatabaseEntry enemy in EnemyDatabase.Instance.Entries) { AIActor enemyPrefab = enemy?.GetPrefab <AIActor>(); if (enemyPrefab == null) { continue; } IntVector2?targetCenter = GameManager.Instance.PrimaryPlayer.CenterPosition.ToIntVector2(VectorConversions.Floor); Pathfinding.CellValidator cellValidator = delegate(IntVector2 c) { for (int j = 0; j < enemyPrefab.Clearance.x; j++) { for (int k = 0; k < enemyPrefab.Clearance.y; k++) { if (GameManager.Instance.Dungeon.data.isTopWall(c.x + j, c.y + k)) { return(false); } if (targetCenter.HasValue) { if (IntVector2.Distance(targetCenter.Value, c.x + j, c.y + k) < 4) { return(false); } if (IntVector2.Distance(targetCenter.Value, c.x + j, c.y + k) > 20) { return(false); } } } } return(true); }; IntVector2?randomAvailableCell = GameManager.Instance.PrimaryPlayer.CurrentRoom.GetRandomAvailableCell(enemyPrefab.Clearance, enemyPrefab.PathableTiles, false, cellValidator); if (randomAvailableCell.HasValue) { AIActor aIActor = AIActor.Spawn(enemyPrefab, randomAvailableCell.Value, GameManager.Instance.PrimaryPlayer.CurrentRoom, true, AIActor.AwakenAnimationType.Default, true); aIActor.HandleReinforcementFallIntoRoom(0); } } }
public override void OnReloadPressed(PlayerController player, Gun gun, bool bSOMETHING) { HasReloaded = false; AkSoundEngine.PostEvent("Stop_WPN_All", base.gameObject); base.OnReloadPressed(player, gun, bSOMETHING); // spit PlayerController owner = (PlayerController)this.gun.CurrentOwner; if (succ[0] != null) { AIActor orLoadByGuid = EnemyDatabase.GetOrLoadByGuid(succ[0]); IntVector2 intVector = Vector2Extensions.ToIntVector2(owner.unadjustedAimPoint, (VectorConversions)2); RoomHandler absoluteRoomFromPosition = GameManager.Instance.Dungeon.data.GetAbsoluteRoomFromPosition(intVector); bool flag = absoluteRoomFromPosition != null && absoluteRoomFromPosition == owner.CurrentRoom && owner.IsInCombat; if (flag) { AIActor aiactor = AIActor.Spawn(orLoadByGuid.aiActor, gun.sprite.WorldBottomRight, absoluteRoomFromPosition, true, (AIActor.AwakenAnimationType.Spawn), true); PhysicsEngine.Instance.RegisterOverlappingGhostCollisionExceptions(aiactor.specRigidbody, null, false); aiactor.CanTargetEnemies = false; aiactor.CanTargetPlayers = true; aiactor.IsHarmlessEnemy = true; aiactor.CanDropCurrency = true; aiactor.IgnoreForRoomClear = false; aiactor.IsBuffEnemy = true; aiactor.isPassable = true; aiactor.reinforceType = (AIActor.ReinforceType.Instant); aiactor.HandleReinforcementFallIntoRoom(-1f); aiactor.specRigidbody.AddCollisionLayerIgnoreOverride(CollisionMask.LayerToMask(CollisionLayer.PlayerHitBox, CollisionLayer.PlayerCollider)); Projectile projectile1 = ((Gun)ETGMod.Databases.Items[541]).DefaultModule.chargeProjectiles[0].Projectile; GameObject gameObject = SpawnManager.SpawnProjectile(projectile1.gameObject, player.CurrentGun.sprite.WorldCenter, Quaternion.Euler(0f, 0f, (player.CurrentGun == null) ? 0f : player.CurrentGun.CurrentAngle), true); Projectile component = gameObject.GetComponent <Projectile>(); component.baseData.damage = 150f; component.baseData.force = 800f; component.baseData.speed *= 1f; component.Owner = player; HandlePostProcessProjectile(component); succ.RemoveAt(0); StartCoroutine(wait()); } } }
private void SpawnSpectralLad(PlayerController user) { string guid; guid = "383175a55879441d90933b5c4e60cf6f"; PlayerController owner = base.LastOwner; AIActor orLoadByGuid = EnemyDatabase.GetOrLoadByGuid(guid); IntVector2? intVector = new IntVector2?(base.LastOwner.CurrentRoom.GetRandomVisibleClearSpot(2, 2)); AIActor aiactor = AIActor.Spawn(orLoadByGuid.aiActor, intVector.Value, GameManager.Instance.Dungeon.data.GetAbsoluteRoomFromPosition(intVector.Value), true, AIActor.AwakenAnimationType.Default, true); aiactor.CanTargetEnemies = true; aiactor.CanTargetPlayers = false; PhysicsEngine.Instance.RegisterOverlappingGhostCollisionExceptions(aiactor.specRigidbody, null, false); aiactor.gameObject.AddComponent <KillOnRoomClear>(); aiactor.IsHarmlessEnemy = true; aiactor.IgnoreForRoomClear = true; aiactor.HandleReinforcementFallIntoRoom(0f); }
public void OnNewRoom() { List <AIActor> activeEnemies = base.Owner.CurrentRoom.GetActiveEnemies(RoomHandler.ActiveEnemyType.All); if (activeEnemies != null && (base.Owner.CurrentRoom.area.PrototypeRoomCategory != PrototypeDungeonRoom.RoomCategory.SPECIAL)) { int count = activeEnemies.Count; for (int i = 0; i < count; i++) { if (activeEnemies[i] && activeEnemies[i].HasBeenEngaged && activeEnemies[i].healthHaver && activeEnemies[i].IsNormalEnemy && !activeEnemies[i].healthHaver.IsDead && !activeEnemies[i].healthHaver.IsBoss && !activeEnemies[i].IsTransmogrified && activeEnemies[i].EnemyGuid != "22fc2c2c45fb47cf9fb5f7b043a70122") { AIActor actor2 = BoxOTools.SummonAtRandomPosition(activeEnemies[i].EnemyGuid, base.Owner); actor2.CanDropCurrency = true; actor2.AssignedCurrencyToDrop = activeEnemies[i].AssignedCurrencyToDrop; actor2.HandleReinforcementFallIntoRoom(); } } } }
private void HellsBells() { for (int counter = 0; counter < 3; counter++) { string guid; guid = "78a8ee40dff2477e9c2134f6990ef297"; PlayerController owner = base.Owner; AIActor orLoadByGuid = EnemyDatabase.GetOrLoadByGuid(guid); IntVector2? intVector = new IntVector2?(base.Owner.CurrentRoom.GetRandomVisibleClearSpot(2, 2)); AIActor aiactor = AIActor.Spawn(orLoadByGuid.aiActor, intVector.Value, GameManager.Instance.Dungeon.data.GetAbsoluteRoomFromPosition(intVector.Value), true, AIActor.AwakenAnimationType.Default, true); aiactor.CanTargetEnemies = false; aiactor.CanTargetPlayers = true; PhysicsEngine.Instance.RegisterOverlappingGhostCollisionExceptions(aiactor.specRigidbody, null, false); aiactor.gameObject.AddComponent <KillOnRoomClear>(); aiactor.IsHarmlessEnemy = false; aiactor.IgnoreForRoomClear = true; aiactor.HandleReinforcementFallIntoRoom(0f); } }
public void Crewmates() { int crewtype = rng.Next(0, 40); if (crewtype < 13) { int type = laugh.Next(1, 2); if (type == 1) { AkSoundEngine.PostEvent("Play_AGUNIM_VO_FIGHT_LAUGH_02", gameObject); } else { AkSoundEngine.PostEvent("Play_AGUNIM_VO_FIGHT_LAUGH_01", gameObject); } PlayerController owner = this.gun.CurrentOwner as PlayerController; AIActor orLoadByGuid = EnemyDatabase.GetOrLoadByGuid((string)guid.GetValue(crewtype)); IntVector2? intVector = new IntVector2?(owner.CurrentRoom.GetRandomVisibleClearSpot(2, 2)); AIActor aiactor = AIActor.Spawn(orLoadByGuid.aiActor, intVector.Value, GameManager.Instance.Dungeon.data.GetAbsoluteRoomFromPosition(intVector.Value), true, AIActor.AwakenAnimationType.Default, true); aiactor.CanTargetEnemies = true; aiactor.CanTargetPlayers = false; PhysicsEngine.Instance.RegisterOverlappingGhostCollisionExceptions(aiactor.specRigidbody, null, false); aiactor.gameObject.AddComponent <KillOnRoomClear>(); aiactor.IsHarmlessEnemy = true; aiactor.BaseMovementSpeed = 8; aiactor.IgnoreForRoomClear = true; aiactor.HandleReinforcementFallIntoRoom(0f); } else { PlayerController player = (PlayerController)this.gun.CurrentOwner; if (player.PlayerHasActiveSynergy("Sharkbait hoo ha ha!")) { Projectile shatterer = ((Gun)ETGMod.Databases.Items[359]).DefaultModule.chargeProjectiles[0].Projectile; GameObject gameObject = SpawnManager.SpawnProjectile(shatterer.gameObject, player.specRigidbody.UnitCenter, Quaternion.Euler(0f, 0f, (player.CurrentGun == null) ? 0f : player.CurrentGun.CurrentAngle)); Projectile component = gameObject.GetComponent <Projectile>(); component.Owner = player; } } }
private void GuardTheTreasure() { this.random = UnityEngine.Random.Range(0.0f, 1.0f); if (random <= 0.1f) { string guid; guid = "249db525a9464e5282d02162c88e0357"; PlayerController owner = base.Owner; AIActor orLoadByGuid = EnemyDatabase.GetOrLoadByGuid(guid); IntVector2? intVector = new IntVector2?(base.Owner.CurrentRoom.GetRandomVisibleClearSpot(2, 2)); AIActor aiactor = AIActor.Spawn(orLoadByGuid.aiActor, intVector.Value, GameManager.Instance.Dungeon.data.GetAbsoluteRoomFromPosition(intVector.Value), true, 0, true); aiactor.CanTargetEnemies = false; aiactor.CanTargetPlayers = true; PhysicsEngine.Instance.RegisterOverlappingGhostCollisionExceptions(aiactor.specRigidbody, null, false); aiactor.gameObject.AddComponent <KillOnRoomClear>(); aiactor.IsHarmlessEnemy = false; aiactor.IgnoreForRoomClear = true; aiactor.HandleReinforcementFallIntoRoom(0f); } }
private void OnKill(Projectile arg1, SpeculativeRigidbody arg2) { PlayerController owner = this.gun.CurrentOwner as PlayerController; bool flag = !arg2.aiActor.healthHaver.IsDead; if (flag) { { RoomHandler absoluteRoom = base.transform.position.GetAbsoluteRoom(); List <AIActor> list = new List <AIActor>(); bool flag6 = absoluteRoom.GetActiveEnemies(RoomHandler.ActiveEnemyType.RoomClear) != null; if (flag6) { foreach (AIActor item in absoluteRoom.GetActiveEnemies(RoomHandler.ActiveEnemyType.RoomClear)) { list.Add(item); } } bool flag7 = list.Count > 1; if (flag7) { bool fuckyou = (arg2.aiActor.EnemyGuid == "01972dee89fc4404a5c408d50007dad5" && arg2.aiActor.IsHarmlessEnemy); if (!fuckyou) { string guid; guid = "01972dee89fc4404a5c408d50007dad5"; AIActor orLoadByGuid = EnemyDatabase.GetOrLoadByGuid(guid); IntVector2?intVector = new IntVector2?(owner.CurrentRoom.GetRandomVisibleClearSpot(2, 2)); AIActor bastardman = AIActor.Spawn(orLoadByGuid.aiActor, arg2.sprite.WorldCenter, GameManager.Instance.Dungeon.data.GetAbsoluteRoomFromPosition(intVector.Value), true, AIActor.AwakenAnimationType.Spawn, true); bastardman.CanTargetEnemies = true; bastardman.CanTargetPlayers = false; PhysicsEngine.Instance.RegisterOverlappingGhostCollisionExceptions(bastardman.specRigidbody, null, false); bastardman.gameObject.AddComponent <KillOnRoomClear>(); bastardman.IsHarmlessEnemy = true; bastardman.IgnoreForRoomClear = true; bastardman.HandleReinforcementFallIntoRoom(0f); } } } } }
private IEnumerator Summon2ndSpent() { yield return(new WaitForSeconds(UnityEngine.Random.Range(0.5f, 1.25f))); { string guid; guid = "e21ac9492110493baef6df02a2682a0d"; PlayerController owner = base.LastOwner; AIActor orLoadByGuid = EnemyDatabase.GetOrLoadByGuid(guid); IntVector2? intVector = new IntVector2?(base.LastOwner.CurrentRoom.GetRandomVisibleClearSpot(2, 2)); AIActor aiactor = AIActor.Spawn(orLoadByGuid.aiActor, intVector.Value, GameManager.Instance.Dungeon.data.GetAbsoluteRoomFromPosition(intVector.Value), true, AIActor.AwakenAnimationType.Default, true); aiactor.CanTargetEnemies = true; aiactor.CanTargetPlayers = false; PhysicsEngine.Instance.RegisterOverlappingGhostCollisionExceptions(aiactor.specRigidbody, null, false); aiactor.gameObject.AddComponent <KillOnRoomClear>(); aiactor.IsHarmlessEnemy = true; aiactor.IgnoreForRoomClear = true; aiactor.HandleReinforcementFallIntoRoom(0f); } yield break; }
// Token: 0x06000364 RID: 868 RVA: 0x0001B6E0 File Offset: 0x000198E0 private void SpawnFlesh() { bool flag = base.Owner.HasPickupID(64); string guid; guid = "33b212b856b74ff09252bf4f2e8b8c57"; PlayerController owner = base.Owner; AIActor orLoadByGuid = EnemyDatabase.GetOrLoadByGuid(guid); IntVector2? intVector = new IntVector2?(base.Owner.CurrentRoom.GetRandomVisibleClearSpot(2, 2)); AIActor aiactor = AIActor.Spawn(orLoadByGuid.aiActor, intVector.Value, GameManager.Instance.Dungeon.data.GetAbsoluteRoomFromPosition(intVector.Value), true, AIActor.AwakenAnimationType.Default, true); aiactor.CanTargetEnemies = true; aiactor.CanTargetPlayers = false; aiactor.HitByEnemyBullets = true; PhysicsEngine.Instance.RegisterOverlappingGhostCollisionExceptions(aiactor.specRigidbody, null, false); aiactor.gameObject.AddComponent <KillOnRoomClear>(); aiactor.IsHarmlessEnemy = true; aiActor.CompanionOwner = this.m_owner; aiactor.CanDropCurrency = false; aiactor.IgnoreForRoomClear = true; aiactor.HandleReinforcementFallIntoRoom(0f); }
protected override void DoEffect(PlayerController user) { AkSoundEngine.PostEvent("Play_OBJ_supplydrop_activate_01", base.gameObject); List <string> reinforcements = new List <string>(); reinforcements.AddRange(BraveUtility.RandomElement(randomEnemyloadouts)); foreach (string key in synergies.Keys) { if (user.PlayerHasActiveSynergy(key)) { reinforcements.Add(synergies[key]); } } foreach (string dude in reinforcements) { IntVector2?bestRewardLocation = LastOwner.CurrentRoom.GetRandomVisibleClearSpot(2, 2); AIActor spawnedDude = CompanionisedEnemyUtility.SpawnCompanionisedEnemy(user, dude, (IntVector2)bestRewardLocation, false, Color.red, 5, 2, false, true); spawnedDude.HandleReinforcementFallIntoRoom(0f); } }