private static void InitForme8() { Gun gun = ETGMod.Databases.Items.NewGun("Junk Sword", "junk8_sword"); Game.Items.Rename("outdated_gun_mods:junk_sword", "spapi:junk_sword+junk_8"); gun.gameObject.AddComponent <JunkSwordController>(); GunExt.SetShortDescription(gun, "Next Time... What is This?"); GunExt.SetLongDescription(gun, "Just a sword made out of junk. Some of the junk seems enchanted and may react different the more normal junk is around."); GunExt.SetupSprite(gun, null, "junk8_sword_idle_001", 8); GunExt.AddProjectileModuleFrom(gun, "klobb", true, false); Projectile projectile = UnityEngine.Object.Instantiate <Projectile>(EnemyDatabase.GetOrLoadByGuid("c6c8e59d0f5d41969c74e802c9d67d07").bulletBank.GetBullet("angel").BulletObject.GetComponent <Projectile>()); projectile.gameObject.SetActive(false); FakePrefab.MarkAsFakePrefab(projectile.gameObject); UnityEngine.Object.DontDestroyOnLoad(projectile); projectile.name = "JunkSword_AngelForm_Projectile"; gun.DefaultModule.projectiles[0] = projectile; gun.DefaultModule.shootStyle = ProjectileModule.ShootStyle.Automatic; gun.DefaultModule.angleVariance = 30; gun.DefaultModule.cooldownTime = 0.05f; gun.DefaultModule.ammoType = GameUIAmmoType.AmmoType.CUSTOM; gun.DefaultModule.customAmmoType = "white"; gun.DefaultModule.numberOfShotsInClip = 999; gun.reloadTime = 0; gun.InfiniteAmmo = true; gun.quality = PickupObject.ItemQuality.EXCLUDED; gun.barrelOffset.transform.localPosition = new Vector3(0.65f, 1.7f, 0f); gun.encounterTrackable.EncounterGuid = "junkan8_sword"; gun.gunClass = GunClass.SILLY; gun.gunSwitchGroup = "Sack"; gun.muzzleFlashEffects.type = VFXPoolType.None; ETGMod.Databases.Items.Add(gun, null, "ANY"); JunkSwordController.AngelSwordID = gun.PickupObjectId; }
private void HandleActiveTossedBallGrounded(DebrisObject obj) { obj.OnGrounded -= this.HandleActiveTossedBallGrounded; MonsterBall component = obj.GetComponent <MonsterBall>(); //component.spriteAnimator.Play("monster_ball_open"); AIActor orLoadByGuid = EnemyDatabase.GetOrLoadByGuid(component.m_storedEnemyGuid); if (orLoadByGuid == null) { if (m_Debug) { ETGModConsole.Log("[Monster_Ball] Tried to spawn an unknown AIActor! (Enemy GUID not found)"); } component.m_containsEnemy = false; component.m_wasBlackPhantom = false; component.m_storedEnemyGuid = string.Empty; component.IsCurrentlyActive = false; component.ApplyCooldown(this.LastOwner); return; } IntVector2 bestRewardLocation = obj.transform.position.GetAbsoluteRoom().GetBestRewardLocation(orLoadByGuid.Clearance, obj.sprite.WorldCenter, true); AIActor m_CachedEnemy = AIActor.Spawn(orLoadByGuid, bestRewardLocation, obj.transform.position.GetAbsoluteRoom(), true, AIActor.AwakenAnimationType.Default, true); // m_CachedEnemy.ApplyEffect(GameManager.Instance.Dungeon.sharedSettingsPrefab.DefaultPermanentCharmEffect, 1f, null); this.MakeCompanion(this.LastOwner, m_CachedEnemy, component.m_wasBlackPhantom); LootEngine.DoDefaultItemPoof(m_CachedEnemy.CenterPosition, false, false); component.m_containsEnemy = false; component.m_storedEnemyGuid = string.Empty; component.IsCurrentlyActive = false; component.ApplyCooldown(this.LastOwner); }
private void GrowATurtle(PlayerController arg1, HealthHaver arg2) { AIActor orLoadByGuid = EnemyDatabase.GetOrLoadByGuid("cc9c41aa8c194e17b44ac45f993dd212"); RoomHandler absoluteRoom = arg1.gameActor.CenterPosition.GetAbsoluteRoom(); CreateNewCompanion(arg1, arg2.gameActor.CenterPosition, absoluteRoom); }
public static void Init() { var actor = EnemyDatabase.GetOrLoadByGuid("f905765488874846b7ff257ff81d6d0c"); behaviorSpeculatorPrefab = GameObject.Instantiate(actor.gameObject); foreach (Transform child in behaviorSpeculatorPrefab.transform) { if (child != behaviorSpeculatorPrefab.transform) { GameObject.DestroyImmediate(child); } } foreach (var comp in behaviorSpeculatorPrefab.GetComponents <Component>()) { if (comp.GetType() != typeof(BehaviorSpeculator)) { GameObject.DestroyImmediate(comp); } } GameObject.DontDestroyOnLoad(behaviorSpeculatorPrefab); FakePrefab.MarkAsFakePrefab(behaviorSpeculatorPrefab); behaviorSpeculatorPrefab.SetActive(false); Hook enemyHook = new Hook( typeof(EnemyDatabase).GetMethod("GetOrLoadByGuid", BindingFlags.Public | BindingFlags.Static), typeof(BossBuilder).GetMethod("GetOrLoadByGuid") ); }
private void CreateCompanion(PlayerController owner) { if (PreventRespawnOnFloorLoad | m_HasDied) { return; } string guid = CompanionGuid; AIActor orLoadByGuid = EnemyDatabase.GetOrLoadByGuid(guid); Vector3 vector = owner.transform.position; if (GameManager.Instance.CurrentLevelOverrideState == GameManager.LevelOverrideState.FOYER) { vector += new Vector3(1.125f, -0.3125f, 0f); } GameObject extantCompanion2 = Instantiate(orLoadByGuid.gameObject, vector, Quaternion.identity); m_extantCompanion = extantCompanion2; CompanionController orAddComponent = m_extantCompanion.GetOrAddComponent <CompanionController>(); orAddComponent.Initialize(owner); extantCompanion2.GetComponent <HealthHaver>().OnPreDeath += OnPreDeath; extantCompanion2.GetComponent <HealthHaver>().OnDamaged += CompanionOnDamaged; if (m_healthRemaining > 0) { extantCompanion2.GetComponent <HealthHaver>().SetHealthMaximum(m_maxHealthRemaining); extantCompanion2.GetComponent <HealthHaver>().ForceSetCurrentHealth(m_healthRemaining); } if (orAddComponent.specRigidbody) { PhysicsEngine.Instance.RegisterOverlappingGhostCollisionExceptions(orAddComponent.specRigidbody, null, false); } }
private void SpawnJunkan(Projectile proj) { if (proj.Owner == null || !(proj.Owner is PlayerController)) { return; } PlayerController player = proj.Owner as PlayerController; if (player.CurrentGun.GetComponent <JunkansRevengeController>() == null) { return; } AIActor orLoadByGuid = EnemyDatabase.GetOrLoadByGuid("c6c8e59d0f5d41969c74e802c9d67d07"); Vector3 vector = proj.sprite.WorldCenter.ToVector3ZUp(0f); GameObject enemyObj = UnityEngine.Object.Instantiate <GameObject>(orLoadByGuid.gameObject, vector, Quaternion.identity); if (enemyObj.GetComponent <AIActor>() != null) { if (enemyObj.GetComponent <AIActor>().sprite != null) { enemyObj.GetComponent <AIActor>().sprite.PlaceAtPositionByAnchor(vector, tk2dBaseSprite.Anchor.MiddleCenter); if (enemyObj.GetComponent <AIActor>().specRigidbody != null) { enemyObj.GetComponent <AIActor>().specRigidbody.Reinitialize(); } } } CompanionController orAddComponent = enemyObj.GetOrAddComponent <CompanionController>(); orAddComponent.Initialize(player); enemyObj.AddComponent <TempraryJunkanBehaviour>(); }
protected override void DoEffect(PlayerController user) { if (base.LastOwner && base.LastOwner.CurrentRoom != null) { try { AIActor orLoadByGuid = EnemyDatabase.GetOrLoadByGuid("f38686671d524feda75261e469f30e0b"); IntVector2?intVector = new IntVector2?(base.LastOwner.CurrentRoom.GetRandomVisibleClearSpot(1, 1)); bool flag = intVector != null; if (flag) { AIActor aiactor = AIActor.Spawn(orLoadByGuid.aiActor, intVector.Value, GameManager.Instance.Dungeon.data.GetAbsoluteRoomFromPosition(intVector.Value), true, AIActor.AwakenAnimationType.Default, true); aiactor.ApplyEffect(GameManager.Instance.Dungeon.sharedSettingsPrefab.DefaultPermanentCharmEffect, 1f, null); aiactor.IgnoreForRoomClear = true; aiactor.bulletBank.OnProjectileCreated += this.NotDamagePlayer; aiactor.gameObject.AddComponent <KillOnRoomClear>(); } } catch (Exception ex) { ETGModConsole.Log(ex.Message, false); } } this.StartEffect(user); if (this.numberOfUses > 1) { base.StartCoroutine(this.Buff()); } else { base.StartCoroutine(ItemBuilder.HandleDuration(this, this.duration, user, new Action <PlayerController>(this.EndEffect))); } }
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 BehaviorResult Update() { BehaviorResult behaviorResult = base.Update(); if (behaviorResult != BehaviorResult.Continue) { return(behaviorResult); } if (!this.IsReady()) { return(BehaviorResult.Continue); } this.m_enemyPrefab = EnemyDatabase.GetOrLoadByGuid(this.m_aiActor.EnemyGuid); this.m_aiAnimator.PlayUntilFinished(this.Anim, true, null, -1f, false); if (this.AnimRequiresTransparency) { this.m_cachedShader = this.m_aiActor.renderer.material.shader; this.m_aiActor.sprite.usesOverrideMaterial = true; this.m_aiActor.SetOutlines(false); this.m_aiActor.renderer.material.shader = ShaderCache.Acquire("Brave/LitBlendUber"); } this.m_aiActor.ClearPath(); this.m_timer = this.SpawnDelay; if (this.m_aiActor && this.m_aiActor.knockbackDoer) { this.m_aiActor.knockbackDoer.SetImmobile(true, "MirrorImageBehavior"); } this.m_aiActor.IsGone = true; this.m_aiActor.specRigidbody.CollideWithOthers = false; this.m_actorsToSplit.Clear(); this.m_actorsToSplit.Add(this.m_aiActor); this.m_state = FriendlyMirrorImageBehavior.State.Summoning; this.m_updateEveryFrame = true; return(BehaviorResult.RunContinuous); }
private void Start() { this.m_projectile = base.GetComponent <Projectile>(); BulletScriptSource source = this.m_projectile.gameObject.GetOrAddComponent <BulletScriptSource>(); this.m_projectile.gameObject.AddComponent <BulletSourceKiller>(); var bulletScriptSelected = new CustomBulletScriptSelector(typeof(GunjurerSlamPlayerScript)); AIBulletBank bulletBank = DataCloners.CopyAIBulletBank(EnemyDatabase.GetOrLoadByGuid("206405acad4d4c33aac6717d184dc8d4").bulletBank); bulletBank.OnProjectileCreated += this.OnBulletSpawned; foreach (AIBulletBank.Entry bullet in bulletBank.Bullets) { bullet.BulletObject.GetComponent <Projectile>().BulletScriptSettings.preventPooling = true; } source.BulletManager = bulletBank; source.BulletScript = bulletScriptSelected; source.Initialize();//to fire the script once GunjurerSlamPlayerScript spawnedScript = source.RootBullet as GunjurerSlamPlayerScript; spawnedScript.aimDirection = this.m_projectile.Direction.ToAngle(); /*if (this.m_projectile.ProjectilePlayerOwner() != null) * { * spawnedScript.overrideSpeed *= this.m_projectile.ProjectilePlayerOwner().stats.GetStatValue(PlayerStats.StatType.ProjectileSpeed); * }*/ }
protected override IEnumerator Top() // This is just a simple example, but bullet scripts can do so much more. { if (this.BulletBank && this.BulletBank.aiActor && this.BulletBank.aiActor.TargetRigidbody) { base.BulletBank.Bullets.Add(EnemyDatabase.GetOrLoadByGuid("ec6b674e0acd4553b47ee94493d66422").bulletBank.GetBullet("bigBullet")); base.BulletBank.Bullets.Add(EnemyDatabase.GetOrLoadByGuid("b1770e0f1c744d9d887cc16122882b4f").bulletBank.GetBullet("chain")); } base.Fire(new Direction(0f, DirectionType.Aim, -1f), new Speed(9.5f, SpeedType.Absolute), new HelixBullet(false)); base.Fire(new Direction(0f, DirectionType.Aim, -1f), new Speed(9.5f, SpeedType.Absolute), new HelixBullet(true)); //yield return base.Wait(10); base.Fire(new Direction(0f, DirectionType.Aim, -1f), new Speed(9.5f, SpeedType.Absolute), new HelixChainBullet(false)); base.Fire(new Direction(0f, DirectionType.Aim, -1f), new Speed(9.5f, SpeedType.Absolute), new HelixChainBullet(true)); base.Fire(new Direction(0f, DirectionType.Aim, -1f), new Speed(9.5f, SpeedType.Absolute), new HelixChainBullet1(false)); base.Fire(new Direction(0f, DirectionType.Aim, -1f), new Speed(9.5f, SpeedType.Absolute), new HelixChainBullet1(true)); base.Fire(new Direction(0f, DirectionType.Aim, -1f), new Speed(9.5f, SpeedType.Absolute), new HelixChainBullet2(false)); base.Fire(new Direction(0f, DirectionType.Aim, -1f), new Speed(9.5f, SpeedType.Absolute), new HelixChainBullet2(true)); base.Fire(new Direction(0f, DirectionType.Aim, -1f), new Speed(9.5f, SpeedType.Absolute), new HelixChainBullet3(false)); base.Fire(new Direction(0f, DirectionType.Aim, -1f), new Speed(9.5f, SpeedType.Absolute), new HelixChainBullet3(true)); base.Fire(new Direction(0f, DirectionType.Aim, -1f), new Speed(9.5f, SpeedType.Absolute), new HelixChainBullet4(false)); base.Fire(new Direction(0f, DirectionType.Aim, -1f), new Speed(9.5f, SpeedType.Absolute), new HelixChainBullet4(true)); base.Fire(new Direction(0f, DirectionType.Aim, -1f), new Speed(9.5f, SpeedType.Absolute), new HelixChainBullet5(false)); base.Fire(new Direction(0f, DirectionType.Aim, -1f), new Speed(9.5f, SpeedType.Absolute), new HelixChainBullet5(true)); base.Fire(new Direction(0f, DirectionType.Aim, -1f), new Speed(9.5f, SpeedType.Absolute), new HelixChainBullet6(false)); base.Fire(new Direction(0f, DirectionType.Aim, -1f), new Speed(9.5f, SpeedType.Absolute), new HelixChainBullet6(true)); yield break; }
public static void BraveBehaviorDebug() { string enemyGuid = "dc3cd41623d447aeba77c77c99598426"; //MarinePast AIActor prefabActor = EnemyDatabase.GetOrLoadByGuid(enemyGuid); GameObject objectToInstantiate = prefabActor.gameObject; // int flag = 0; Debug.Log("Begin BraveBehavior Debug"); BehaviorSpeculator behaviorspeculator = objectToInstantiate.GetComponent <BehaviorSpeculator>(); AIBulletBank aibulletbank = objectToInstantiate.GetComponent <AIBulletBank>(); List <AttackBehaviorBase> attackbehaviorbase = behaviorspeculator.AttackBehaviors; foreach (AttackBehaviorBase attack in attackbehaviorbase) { Debug.Log("ATTACK Behaviors: " + attack.ToString()); } AttackBehaviorGroup attackbehaviorgroup = behaviorspeculator.AttackBehaviorGroup; List <AttackBehaviorGroup.AttackGroupItem> attackbehaviors = attackbehaviorgroup.AttackBehaviors; foreach (AttackBehaviorGroup.AttackGroupItem attackgroupitem in attackbehaviors) { Debug.Log("AttackGroup Item :" + attackgroupitem.Behavior.ToString()); } //AttackBehaviorGroup //AttackGruop //ShootBehavior --> has bullet scripts Debug.Log("End BraveBehavior Debug"); }
// Token: 0x0600489E RID: 18590 RVA: 0x00178EB0 File Offset: 0x001770B0 private void OnTriggerCollision(SpeculativeRigidbody specRigidbody, SpeculativeRigidbody sourceSpecRigidbody, CollisionData collisionData) { if ((this.State == WizardSpinShootBehavior2.SpinShootState.Spawn || this.State == WizardSpinShootBehavior2.SpinShootState.Prefire) && collisionData.MyPixelCollider == this.m_bulletCatcher && collisionData.OtherRigidbody != null && collisionData.OtherRigidbody.projectile != null) { Projectile projectile = collisionData.OtherRigidbody.projectile; bool flag = (!this.m_isCharmed) ? (projectile.Owner is PlayerController) : (projectile.Owner is AIActor); if (flag && projectile.CanBeCaught) { projectile.specRigidbody.DeregisterSpecificCollisionException(projectile.Owner.specRigidbody); projectile.Shooter = this.m_aiActor.specRigidbody; projectile.Owner = this.m_aiActor; projectile.specRigidbody.Velocity = Vector2.zero; projectile.ManualControl = true; projectile.baseData.SetAll(EnemyDatabase.GetOrLoadByGuid("c4fba8def15e47b297865b18e36cbef8").bulletBank.GetBullet("default").ProjectileData); projectile.UpdateSpeed(); projectile.specRigidbody.CollideWithTileMap = false; projectile.ResetDistance(); projectile.collidesWithEnemies = this.m_isCharmed; projectile.collidesWithPlayer = true; projectile.UpdateCollisionMask(); projectile.sprite.color = new Color(1f, 0.1f, 0.1f); projectile.MakeLookLikeEnemyBullet(true); projectile.RemovePlayerOnlyModifiers(); float second = BraveMathCollege.ClampAngle360((collisionData.Contact - this.ShootPoint.position.XY()).ToAngle()); this.m_bulletPositions.Insert(Mathf.Max(0, this.m_bulletPositions.Count - 1), Tuple.Create <Projectile, float>(projectile, second)); } } }
public override void EffectTick(GameActor actor, RuntimeGameActorEffectData effectData) { if (this.AffectsEnemies && actor is AIActor && !actor.healthHaver.IsBoss) { if (actor.healthHaver.IsDead) { if (ShouldISpawn == true) { if (actor.aiActor.EnemyGuid != "5861e5a077244905a8c25c2b7b4d6ebb") { string guid; guid = "4db03291a12144d69fe940d5a01de376"; AIActor orLoadByGuid = EnemyDatabase.GetOrLoadByGuid(guid); IntVector2?intVector = new IntVector2?(actor.PlacedPosition); AIActor aiactor = AIActor.Spawn(orLoadByGuid.aiActor, actor.CenterPosition, 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.CanDropCurrency = false; aiactor.HitByEnemyBullets = false; aiactor.CollisionDamage = 0f; aiactor.IsHarmlessEnemy = true; aiactor.IgnoreForRoomClear = true; ShouldISpawn = false; } } } } }
private void DevilishSynergy() { AIActor orLoadByGuid = EnemyDatabase.GetOrLoadByGuid("5f3abc2d561b4b9c9e72b879c6f10c7e"); IntVector2?nearestAvailableCell = this.m_owner.CurrentRoom.GetNearestAvailableCell(this.m_owner.transform.position.XY(), new IntVector2?(orLoadByGuid.Clearance), new CellTypes?(CellTypes.FLOOR), false, null); if (nearestAvailableCell == null) { return; } GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(orLoadByGuid.gameObject, (nearestAvailableCell.Value.ToVector2()).ToVector3ZUp(0f), Quaternion.identity); CompanionController orAddComponent = gameObject.GetOrAddComponent <CompanionController>(); orAddComponent.companionID = CompanionController.CompanionIdentifier.NONE; orAddComponent.Initialize(this.m_owner); orAddComponent.behaviorSpeculator.MovementBehaviors.Add(new CompanionFollowPlayerBehavior()); AIActor aiactor = gameObject.GetComponent <AIActor>(); aiactor.HitByEnemyBullets = true; aiactor.healthHaver.ModifyDamage += this.ModifyDamageForCompanions; foreach (AIBulletBank.Entry entry in orAddComponent.bulletBank.Bullets) { if (aiactor.IsBlackPhantom) { entry.BulletObject.GetComponent <Projectile>().baseData.damage = 15; } else { entry.BulletObject.GetComponent <Projectile>().baseData.damage = 10; } } }
private void SpawnExtraWaves(PlayerController user) { if (user.PlayerHasActiveSynergy(SynNames[0])) { IntVector2?spawnPos = user.CurrentRoom.GetRandomVisibleClearSpot(1, 1); int amount = 2; for (int i = 0; i < amount; i++) { AIActor HeavyKin = EnemyDatabase.GetOrLoadByGuid("df7fb62405dc4697b7721862c7b6b3cd"); AIActor TargetActor = AIActor.Spawn(HeavyKin, spawnPos.Value, GameManager.Instance.Dungeon.data.GetAbsoluteRoomFromPosition(spawnPos.Value), true, AIActor.AwakenAnimationType.Default, true); (TargetActor.behaviorSpeculator.AttackBehaviors[0] as ShootGunBehavior).Range = (EnemyDatabase.GetOrLoadByGuid("01972dee89fc4404a5c408d50007dad5").behaviorSpeculator.AttackBehaviors[0] as ShootGunBehavior).Range; TargetActor.ApplyEffect(GameManager.Instance.Dungeon.sharedSettingsPrefab.DefaultPermanentCharmEffect, 1f, null); PhysicsEngine.Instance.RegisterOverlappingGhostCollisionExceptions(TargetActor.specRigidbody, null, false); TargetActor.gameObject.AddComponent <GoAwayAfterRoomClear>(); TargetActor.IsHarmlessEnemy = true; TargetActor.IgnoreForRoomClear = true; TargetActor.StartCoroutine(HandleTimer(TargetActor, duration)); float hpMax = TargetActor.healthHaver.GetMaxHealth(); TargetActor.healthHaver.SetHealthMaximum(hpMax * 3f); TargetActor.healthHaver.FullHeal(); TargetActor.CanTargetPlayers = false; CompanionisedEnemyBulletModifiers mod = TargetActor.gameObject.AddComponent <CompanionisedEnemyBulletModifiers>(); if (user.PlayerHasActiveSynergy("Great Leadership")) { mod.doPostProcess = true; } mod.TintBullets = true; mod.TintColor = new Color(252, 116, 216, 1); TargetActor.specRigidbody.AddCollisionLayerIgnoreOverride(CollisionMask.LayerToMask(CollisionLayer.PlayerCollider)); GameObject gameObject = (GameObject)ResourceCache.Acquire("Global VFX/VFX_Teleport_Beam"); SpawnManager.SpawnVFX(gameObject, TargetActor.specRigidbody.UnitCenter, Quaternion.Euler(0, 0, 0)); } } }
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 SpawnWave() { CurrentWave++; if (CurrentWave < waves.Count) { foreach (string guid in waves[CurrentWave]) { AIActor prefab = EnemyDatabase.GetOrLoadByGuid(guid); IntVector2?vector = this.GetAbsoluteParentRoom().GetRandomAvailableCell(prefab.Clearance, new CellTypes?(CellTypes.FLOOR | CellTypes.PIT), false, null); AIActor aiactor = AIActor.Spawn(prefab, vector != null ? vector.Value : this.GetAbsoluteParentRoom().GetBestRewardLocation(prefab.Clearance, RoomHandler.RewardLocationStyle.Original, false), this.GetAbsoluteParentRoom(), false, AIActor.AwakenAnimationType.Default, true); aiactor.SetIsFlying(true, "because why not", false, true); aiactor.encounterTrackable.journalData.PrimaryDisplayName = "#ENEMY_PRIMALASPIDS_REVENGE"; this.GetAbsoluteParentRoom().SealRoom(); } } else { SpawnManager.SpawnVFX(GameManager.Instance.Dungeon.sharedSettingsPrefab.DefaultExplosionData.effect, this.statue.GetComponent <tk2dBaseSprite>().WorldBottomCenter, Quaternion.identity); AkSoundEngine.PostEvent("Play_WPN_grenade_blast_01", base.gameObject); this.statue.GetComponent <tk2dBaseSprite>().renderer.enabled = false; Chest chest = GameManager.Instance.RewardManager.Rainbow_Chest; IntVector2?vector = this.GetAbsoluteParentRoom().GetRandomAvailableCell(new IntVector2?(IntVector2.One * 4), new CellTypes?(CellTypes.FLOOR | CellTypes.PIT), false, null); Chest.Spawn(chest, vector != null ? vector.Value : this.GetAbsoluteParentRoom().GetBestRewardLocation(IntVector2.One * 4, RoomHandler.RewardLocationStyle.Original, false), this.GetAbsoluteParentRoom(), true); this.IsActive = false; this.DeclineKey = "#SHRINE_ASPID_DECLINE_SPENT"; } }
// 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"); } }
protected override IEnumerator Top() { if (this.BulletBank && this.BulletBank.aiActor && this.BulletBank.aiActor.TargetRigidbody) { base.BulletBank.Bullets.Add(EnemyDatabase.GetOrLoadByGuid("d8a445ea4d944cc1b55a40f22821ae69").bulletBank.GetBullet("default")); } base.Fire(new Direction(0f), new Speed(8f, SpeedType.Absolute), new FlamenBullet()); base.Fire(new Direction(20f), new Speed(8f, SpeedType.Absolute), new FlamenBullet()); base.Fire(new Direction(40f), new Speed(8f, SpeedType.Absolute), new FlamenBullet()); base.Fire(new Direction(60f), new Speed(8f, SpeedType.Absolute), new FlamenBullet()); base.Fire(new Direction(80f), new Speed(8f, SpeedType.Absolute), new FlamenBullet()); base.Fire(new Direction(100f), new Speed(8f, SpeedType.Absolute), new FlamenBullet()); base.Fire(new Direction(120f), new Speed(8f, SpeedType.Absolute), new FlamenBullet()); base.Fire(new Direction(140f), new Speed(8f, SpeedType.Absolute), new FlamenBullet()); base.Fire(new Direction(160f), new Speed(8f, SpeedType.Absolute), new FlamenBullet()); base.Fire(new Direction(180f), new Speed(8f, SpeedType.Absolute), new FlamenBullet()); base.Fire(new Direction(200f), new Speed(8f, SpeedType.Absolute), new FlamenBullet()); base.Fire(new Direction(220f), new Speed(8f, SpeedType.Absolute), new FlamenBullet()); base.Fire(new Direction(240f), new Speed(8f, SpeedType.Absolute), new FlamenBullet()); base.Fire(new Direction(260f), new Speed(8f, SpeedType.Absolute), new FlamenBullet()); base.Fire(new Direction(280f), new Speed(8f, SpeedType.Absolute), new FlamenBullet()); base.Fire(new Direction(300f), new Speed(8f, SpeedType.Absolute), new FlamenBullet()); base.Fire(new Direction(320f), new Speed(8f, SpeedType.Absolute), new FlamenBullet()); base.Fire(new Direction(340f), new Speed(8f, SpeedType.Absolute), new FlamenBullet()); base.Fire(new Direction(360f), new Speed(8f, SpeedType.Absolute), new FlamenBullet()); Instantiate <GameObject>(EasyVFXDatabase.FlameVFX, base.BulletBank.aiActor.sprite.WorldBottomCenter, Quaternion.identity); yield break; }
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); }
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); }
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); } } } }
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); }
// Token: 0x060000BD RID: 189 RVA: 0x000085E8 File Offset: 0x000067E8 public static void Init() { string companionGuid = Game.Items["dog"].GetComponent <CompanionItem>().CompanionGuid; AIActor orLoadByGuid = EnemyDatabase.GetOrLoadByGuid(companionGuid); CompanionBuilder.behaviorSpeculatorPrefab = UnityEngine.Object.Instantiate <GameObject>(orLoadByGuid.gameObject); foreach (object obj in CompanionBuilder.behaviorSpeculatorPrefab.transform) { Transform transform = (Transform)obj; bool flag = transform != CompanionBuilder.behaviorSpeculatorPrefab.transform; if (flag) { UnityEngine.Object.DestroyImmediate(transform); } } foreach (Component component in CompanionBuilder.behaviorSpeculatorPrefab.GetComponents <Component>()) { bool flag2 = component.GetType() != typeof(BehaviorSpeculator); if (flag2) { UnityEngine.Object.DestroyImmediate(component); } } UnityEngine.Object.DontDestroyOnLoad(CompanionBuilder.behaviorSpeculatorPrefab); FakePrefab.MarkAsFakePrefab(CompanionBuilder.behaviorSpeculatorPrefab); CompanionBuilder.behaviorSpeculatorPrefab.SetActive(false); Hook hook = new Hook(typeof(EnemyDatabase).GetMethod("GetOrLoadByGuid", BindingFlags.Static | BindingFlags.Public), typeof(CompanionBuilder).GetMethod("GetOrLoadByGuid")); }
//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 static void Init() { var dog_guid = Gungeon.Game.Items["dog"].GetComponent <CompanionItem>().CompanionGuid; var dog = EnemyDatabase.GetOrLoadByGuid(dog_guid); behaviorSpeculatorPrefab = GameObject.Instantiate(dog.gameObject); foreach (Transform child in behaviorSpeculatorPrefab.transform) { if (child != behaviorSpeculatorPrefab.transform) { GameObject.DestroyImmediate(child); } } foreach (var comp in behaviorSpeculatorPrefab.GetComponents <Component>()) { if (comp.GetType() != typeof(BehaviorSpeculator)) { GameObject.DestroyImmediate(comp); } } GameObject.DontDestroyOnLoad(behaviorSpeculatorPrefab); FakePrefab.MarkAsFakePrefab(behaviorSpeculatorPrefab); behaviorSpeculatorPrefab.SetActive(false); Hook companionHook = new Hook( typeof(EnemyDatabase).GetMethod("GetOrLoadByGuid", BindingFlags.Public | BindingFlags.Static), typeof(CompanionBuilder).GetMethod("GetOrLoadByGuid") ); }
private static bool EnemyIsValid(string enemyGUID, bool canReturnMimic, bool canReturnBoss) { if (enemyGUID != null) { AIActor enemy = EnemyDatabase.GetOrLoadByGuid(enemyGUID); if (enemy) { AIActor realEnemy = enemy; if (enemy is AIActorDummy) { if ((enemy as AIActorDummy).realPrefab.GetComponent <AIActor>() != null) { realEnemy = (enemy as AIActorDummy).realPrefab.GetComponent <AIActor>(); } } if ((!canReturnMimic && !realEnemy.IsMimicEnemy) || canReturnMimic) { if ((!canReturnBoss && realEnemy.healthHaver && !realEnemy.healthHaver.IsBoss) || canReturnBoss) { return(true); } } } } return(false); }
public void Awake() { System.Console.WriteLine("ENEMY OBJECTS"); for (int i = 0; i < EnemyDatabase.Instance.Entries.Count; i++) { var e = EnemyDatabase.Instance.Entries[i]; var name = "[ERROR]"; if (e == null) { name = "[NULL OBJECT]"; } else { try { var o = EnemyDatabase.GetOrLoadByGuid(e.myGuid); var pdn = o.encounterTrackable?.journalData?.PrimaryDisplayName; name = pdn != null?StringTableManager.GetEnemiesString(pdn) : o.ActorName ?? "[NULL NAME]"; } catch { } } Console.WriteLine($"{e.myGuid} {name}"); } }
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. }