public static GameObject RemoveBossIntros(GameObject bossobject) { //removes boss generic and specific boss intros GenericIntroDoer genericIntroDoer = bossobject.GetComponent <GenericIntroDoer>(); CustomEngageDoer customengage = bossobject.GetComponent <CustomEngageDoer>(); GatlingGullIntroDoer ggintro = bossobject.GetComponent <GatlingGullIntroDoer>(); if (genericIntroDoer) { SpecificIntroDoer specificintrodoer = bossobject.GetComponent <SpecificIntroDoer>(); //MetalGearRatDeathController deathcontroller2 = bossobject.GetComponent<MetalGearRatDeathController>(); if (specificintrodoer) { Destroy(specificintrodoer); specificintrodoer.RegenerateCache(); } genericIntroDoer.InvisibleBeforeIntroAnim = false; Destroy(genericIntroDoer); genericIntroDoer.RegenerateCache(); Destroy(customengage); } if (ggintro) //gatling gull { Destroy(ggintro); } return(bossobject); }
public static GameObject CreateNewBossRoomAIActor(GameObject gameObject) {//turn regular enemy into boss AIActor bosscomponent = gameObject.GetComponent <AIActor>(); if (bosscomponent.healthHaver.bossHealthBar == HealthHaver.BossBarType.None) { bosscomponent.healthHaver.bossHealthBar = HealthHaver.BossBarType.MainBar; gameObject.AddComponent <GenericIntroDoer>(); GenericIntroDoer genericIntroDoer = gameObject.GetComponent <GenericIntroDoer>(); genericIntroDoer.InvisibleBeforeIntroAnim = false; genericIntroDoer.triggerType = GenericIntroDoer.TriggerType.PlayerEnteredRoom; gameObject.AddComponent <SpecificIntroDoer>(); genericIntroDoer.RegenerateCache(); gameObject = ReinstateAIActorObjectInfo(gameObject); } return(gameObject); }
public static void RoomStats2(string[] notused) { RoomHandler currentRoom = GameManager.Instance.PrimaryPlayer.CurrentRoom; List <AIActor> activeenemies_typeall = currentRoom.GetActiveEnemies(RoomHandler.ActiveEnemyType.All); List <AIActor> activeenemies_typeroomclear = currentRoom.GetActiveEnemies(RoomHandler.ActiveEnemyType.RoomClear); ETGModConsole.Log(""); ETGModConsole.Log(string.Format("Current Room: {0}", currentRoom.GetRoomName())); //ETGModConsole.Log("ActorName: {0}, IsVulnerable: {1}, CurrentHealth: {2}, IsHarmlessEnemy: {3}, activeenabled: {4}, PreventAllDamage: {5}, " + // "CanBeKilled: {6}, FlashesOnDamage: {7}, IsNormalEnemy: {8}"); ETGModConsole.Log(" {0}:Guid, {1}:IsVulnerable, {2}:health, {3}:IsHarmlessEnemy, {4}:specialbossdamage, {5}:PreventAllDamage, " + "{6}:awoken, {7}:engaged, {8}:IsNormalEnemy, {9} cancurrentlybekilled"); for (int e = 0; e < activeenemies_typeall.Count; e++) { AIActor enemy = activeenemies_typeall[e]; bool vulnerable = enemy.healthHaver.IsVulnerable; float health = enemy.healthHaver.GetCurrentHealth(); bool isharmlessenemy = enemy.IsHarmlessEnemy; bool isbuffenemy = enemy.IsBuffEnemy; bool activeenabled = enemy.isActiveAndEnabled; bool preventalldamage = enemy.healthHaver.PreventAllDamage; bool flash = enemy.healthHaver.flashesOnDamage; bool awoken = enemy.HasBeenAwoken; bool engaged = enemy.HasBeenEngaged; bool playerentered = enemy.HasDonePlayerEnterCheck; bool specialbossdamage = enemy.healthHaver.OnlyAllowSpecialBossDamage; bool cancurrentlybekilled = enemy.healthHaver.CanCurrentlyBeKilled; //ETGModConsole.Log(string.Format("0{0}, 1{1}, 2{2}, 3{3}, 4{4}, 5{5}, 6{6}, 7{7}, 8{8} ", // enemy.GetActorName(), vulnerable.ToString(), health.ToString(), isharmlessenemy.ToString(), activeenabled.ToString(), preventalldamage.ToString(), // enemy.healthHaver.CanCurrentlyBeKilled.ToString(), flash.ToString(), enemy.IsNormalEnemy.ToString())); GenericIntroDoer genericIntroDoer = enemy.GetComponent <GenericIntroDoer>(); ETGModConsole.Log(string.Format("0{0}, 1{1}, 2{2}, 3{3}, 4{4}, 5{5}, 6{6}, 7{7}, 8{8}, 9{9} ", enemy.EnemyGuid, vulnerable.ToString(), health.ToString(), isharmlessenemy.ToString(), specialbossdamage.ToString(), preventalldamage.ToString(), awoken.ToString(), engaged.ToString(), enemy.IsNormalEnemy.ToString(), cancurrentlybekilled)); } }
private static void BuildWestBrosBossPrefab(AssetBundle assetBundle, out GameObject outObject, WestBros whichBro, bool isSmiley, tk2dSpriteCollectionData sourceSpriteCollection, tk2dSpriteAnimation sourceAnimations, bool keepIntroDoer = false) { GameObject prefab = ExpandCustomEnemyDatabase.GetOfficialEnemyByGuid(isSmiley ? "ea40fcc863d34b0088f490f4e57f8913" // Smiley : "c00390483f394a849c36143eb878998f").gameObject; // Shades outObject = UnityEngine.Object.Instantiate(prefab, Vector3.zero, Quaternion.identity); try { string name = $"West Bros {whichBro}"; outObject.SetActive(false); outObject.name = name; AIActor actor = outObject.GetComponent <AIActor>(); actor.healthHaver.overrideBossName = "Western Bros"; actor.EnemyId = UnityEngine.Random.Range(100000, 999999); actor.ActorName = name; EncounterTrackable Encounterable = outObject.GetComponent <EncounterTrackable>(); switch (whichBro) { case WestBros.Angel: actor.EnemyGuid = "275354563e244f558be87fcff4b07f9f"; Encounterable.EncounterGuid = "7d6e1faf682d4402b29535020313f383"; break; case WestBros.Nome: actor.EnemyGuid = "3a1a33a905bb4b669e7d798f20674c4c"; Encounterable.EncounterGuid = "78cb8889dc884dd9b3aafe64558d858e"; break; case WestBros.Tuc: actor.EnemyGuid = "d2e7ea9ea9a444cebadd3bafa0832cd1"; Encounterable.EncounterGuid = "1df53371ce084dafb46f6bcd5a6c1c5f"; break; } // TODO at some distant point in time Encounterable.journalData.PrimaryDisplayName = name; Encounterable.journalData.NotificationPanelDescription = name; Encounterable.journalData.AmmonomiconFullEntry = name; // x BroController // x BulletBroDeathController // x BulletBrosIntroDoer // x BulletBroSeekTargetBehavior // movement behaviour // BulletBroRepositionBehavior // completely unused var oldBroController = outObject.GetComponent <BroController>(); var newBroController = outObject.AddComponent <ExpandWesternBroController>(); newBroController.enrageAnim = oldBroController.enrageAnim; newBroController.enrageAnimTime = oldBroController.enrageAnimTime; newBroController.enrageHealToPercent = oldBroController.enrageHealToPercent; newBroController.overheadVfx = oldBroController.overheadVfx; newBroController.postEnrageMoveSpeed = oldBroController.postEnrageMoveSpeed; newBroController.whichBro = whichBro; newBroController.postSecondEnrageMoveSpeed = newBroController.postEnrageMoveSpeed; UnityEngine.Object.Destroy(oldBroController); UnityEngine.Object.Destroy(outObject.GetComponent <BulletBroDeathController>()); outObject.AddComponent <ExpandWesternBroDeathController>(); var newMovementBehavior = new ExpandWesternBroSeekTargetBehavior(); var oldMovementBehavior = actor.behaviorSpeculator.MovementBehaviors.First() as BulletBroSeekTargetBehavior; newMovementBehavior.CustomRange = oldMovementBehavior.CustomRange; newMovementBehavior.PathInterval = oldMovementBehavior.PathInterval; newMovementBehavior.StopWhenInRange = oldMovementBehavior.StopWhenInRange; actor.behaviorSpeculator.MovementBehaviors = new List <MovementBehaviorBase>() { newMovementBehavior }; // only smiley has a bossIntroDoer, so the stuff after this would null reference if done with shade if (isSmiley) { if (!keepIntroDoer) { UnityEngine.Object.Destroy(outObject.GetComponent <BulletBrosIntroDoer>()); UnityEngine.Object.Destroy(outObject.GetComponent <GenericIntroDoer>()); } else { // BulletBrosIntroDoer is a SpecificIntroDoer; it does not inherent from GenericIntroDoer, it requires it to be present BulletBrosIntroDoer bulletBrosIntroDoer = outObject.GetComponent <BulletBrosIntroDoer>(); // destroy it so we can add our own UnityEngine.Object.Destroy(bulletBrosIntroDoer); GenericIntroDoer genericIntroDoer = outObject.GetComponent <GenericIntroDoer>(); genericIntroDoer.portraitSlideSettings.bossNameString = "Western Bros"; genericIntroDoer.portraitSlideSettings.bossSubtitleString = "Triple Tap"; genericIntroDoer.portraitSlideSettings.bossQuoteString = string.Empty; genericIntroDoer.portraitSlideSettings.bossArtSprite = assetBundle.LoadAsset <Texture2D>("WesternBrosBossCard"); genericIntroDoer.triggerType = GenericIntroDoer.TriggerType.PlayerEnteredRoom; genericIntroDoer.OnIntroFinished = () => { }; ExpandWesternBroIntroDoer specificIntroDoer = outObject.AddComponent <ExpandWesternBroIntroDoer>(); } } var animationsAsset = assetBundle.LoadAsset <GameObject>($"WestBrosAnimations_{whichBro}"); List <tk2dSpriteAnimationClip> animationClips = new List <tk2dSpriteAnimationClip>(); foreach (tk2dSpriteAnimationClip clip in sourceAnimations.clips) { if (clip.name.StartsWith($"{whichBro.ToString().ToLower()}_")) { animationClips.Add(ExpandUtility.DuplicateAnimationClip(clip)); } } List <tk2dSpriteAnimationClip> clipsToAdd = new List <tk2dSpriteAnimationClip>(); foreach (tk2dSpriteAnimationClip clip in animationClips) { clip.name = clip.name.Replace($"{whichBro.ToString().ToLower()}_", string.Empty); clip.name = clip.name.Replace("dash_front", "dash_forward"); clip.name = clip.name.Replace("move_front", "move_forward"); if (clip.name.EndsWith("_prime")) { clip.frames[5].eventAudio = "Play_ENM_bullet_dash_01"; clip.frames[5].triggerEvent = true; } else if (clip.name.StartsWith("move_")) { clip.frames[2].eventAudio = "PLay_FS_ENM"; clip.frames[2].triggerEvent = true; } else if (clip.name == "anger") { // we change the west bros anger animation from a loop to a loop section so the anger SFX only plays once. // to do this we simply clone every frame once and make it loop at the first copied frame. var angerFrames = clip.frames.ToList(); foreach (var frame in clip.frames) { tk2dSpriteAnimationFrame clonedFrame = new tk2dSpriteAnimationFrame(); ExpandUtility.ReflectionShallowCopyFields(clonedFrame, frame, BindingFlags.Public | BindingFlags.Instance); angerFrames.Add(clonedFrame); } // it's important to do this before changing clip.frames clip.loopStart = clip.frames.Length; clip.frames = angerFrames.ToArray(); clip.wrapMode = tk2dSpriteAnimationClip.WrapMode.LoopSection; clip.frames[0].eventAudio = "Play_BOSS_bulletbros_anger_01"; clip.frames[0].triggerEvent = true; } else if (clip.name == "death_right") { clip.name = "die"; tk2dSpriteAnimationClip dieFrontRight = ExpandUtility.DuplicateAnimationClip(clip); dieFrontRight.name = "die_front_right"; clipsToAdd.Add(dieFrontRight); } else if (clip.name == "death_left") { clip.name = "die_left"; tk2dSpriteAnimationClip dieFrontLeft = ExpandUtility.DuplicateAnimationClip(clip); dieFrontLeft.name = "die_front_left"; clipsToAdd.Add(dieFrontLeft); } else if (clip.name == "idle_front") { clip.name = "idle"; tk2dSpriteAnimationClip bigShot = ExpandUtility.DuplicateAnimationClip(clip); bigShot.wrapMode = tk2dSpriteAnimationClip.WrapMode.Once; bigShot.name = "big_shot"; clipsToAdd.Add(bigShot); tk2dSpriteAnimationClip charge = ExpandUtility.DuplicateAnimationClip(clip); charge.wrapMode = tk2dSpriteAnimationClip.WrapMode.Loop; charge.name = "charge"; clipsToAdd.Add(charge); // not really necessary since it's nuked from the animator further down tk2dSpriteAnimationClip appear = ExpandUtility.DuplicateAnimationClip(clip); appear.wrapMode = tk2dSpriteAnimationClip.WrapMode.Once; appear.name = "appear"; clipsToAdd.Add(appear); tk2dSpriteAnimationClip introGunToggle = ExpandUtility.DuplicateAnimationClip(clip); introGunToggle.wrapMode = tk2dSpriteAnimationClip.WrapMode.Once; introGunToggle.name = "intro2"; clipsToAdd.Add(introGunToggle); introGunToggle.frames[0].eventInfo = "guntoggle"; introGunToggle.frames[0].triggerEvent = true; } else if (clip.name == "summon") { clip.name = "whistle"; clip.wrapMode = tk2dSpriteAnimationClip.WrapMode.Once; // the summon vfx don't look right // clip.frames[0].eventVfx = "summon_vfx"; // clip.frames[0].triggerEvent = true; } else if (clip.name == "pound") { clip.name = "jump_attack"; // Uses modified sound that plays faster on the first half to account for west bros having faster animation. clip.frames[0].eventAudio = "Play_EX_BOSS_westbros_slam_01"; clip.frames[0].triggerEvent = true; } else if (clip.name == "intro") { clip.wrapMode = tk2dSpriteAnimationClip.WrapMode.Once; // this is setup in case we want the intro to continue looping during the boss card instead of the idle animation // requires to change the intro doer so it sets finished to true once it reaches the first loop //if (whichBro == WestBros.Nome) //{ // // nome's intro animation wasn't looping at the end like the others // var list = clip.frames.ToList(); // list.RemoveAt(20); // list.RemoveAt(20); // clip.frames = list.ToArray(); // clip.loopStart = 23; // clip.frames[23] = clip.frames[0]; // clip.frames[24] = clip.frames[1]; // clip.frames[25] = clip.frames[2]; // clip.frames[26] = clip.frames[3]; //} //else if (whichBro == WestBros.Tuc) //{ // // tuc's intro animation was off by one frame compared to the others // var list = clip.frames.ToList(); // list.RemoveAt(15); // clip.frames = list.ToArray(); // clip.loopStart = 21; //} } } animationClips.AddRange(clipsToAdd); tk2dSpriteAnimation spriteAnimation = animationsAsset.AddComponent <tk2dSpriteAnimation>(); spriteAnimation.clips = animationClips.ToArray(); tk2dSpriteAnimator spriteAnimator = outObject.GetComponent <tk2dSpriteAnimator>(); spriteAnimator.Library = spriteAnimation; tk2dSprite sprite = outObject.GetComponent <tk2dSprite>(); sprite.SetSprite(sourceSpriteCollection, $"BB_{whichBro.ToString().ToLower()}_idle_front_001"); sprite.PlaceAtPositionByAnchor(new Vector3(0f, 0f), tk2dBaseSprite.Anchor.LowerCenter); AIAnimator animator = outObject.GetComponent <AIAnimator>(); // removes the 'appear' animation animator.OtherAnimations.RemoveAt(0); outObject.transform.Find("shadow").localPosition += new Vector3(1.52f, 0.02f, 0); var shooter = SetupAIShooter(outObject); shooter.handObject = WestBrosHandPrefab.GetComponent <PlayerHandController>(); DebrisObject hatPrefab = null; switch (whichBro) { case WestBros.Angel: shooter.gunAttachPoint.position = new Vector3(-1.05f, 0.5f); WestBrosAngelGUID = actor.EnemyGuid; hatPrefab = WestBrosAngelHatPrefab.GetComponent <DebrisObject>(); break; case WestBros.Nome: shooter.gunAttachPoint.position = new Vector3(-1.05f, 0.4f); WestBrosNomeGUID = actor.EnemyGuid; hatPrefab = WestBrosNomeHatPrefab.GetComponent <DebrisObject>(); break; case WestBros.Tuc: shooter.gunAttachPoint.position = new Vector3(-1.05f, 0.5f); WestBrosTucGUID = actor.EnemyGuid; hatPrefab = WestBrosTucHatPrefab.GetComponent <DebrisObject>(); break; } shooter.equippedGunId = WestBrosRevolverGenerator.GetWestBrosRevolverID(whichBro); if (shooter.equippedGunId == -1) { ETGModConsole.Log("The West Bros Gun ID should have been set at this point already, but it wasn't. Assigning fallback gun."); shooter.equippedGunId = isSmiley ? 35 : 22; } var hatLauncher = outObject.GetComponentInChildren <ExplosionDebrisLauncher>(); // basically changes smiley's debris launcher into shades' hatLauncher.specifyArcDegrees = false; hatLauncher.minShards = 1; hatLauncher.maxShards = 1; hatLauncher.debrisSources = new DebrisObject[] { hatPrefab }; // move the ring of bullets spawned by jumping var shootPoint = outObject.transform.Find("shoot point"); shootPoint.position += new Vector3(1.5f, 0); // move the actual pixel colliders var rigidbody = outObject.GetComponent <SpeculativeRigidbody>(); foreach (var item in rigidbody.PixelColliders) { item.ManualOffsetX = 32; item.Regenerate(outObject.transform); } // TODO balance actor.healthHaver.ForceSetCurrentHealth(600); actor.healthHaver.SetHealthMaximum(600); actor.RegenerateCache(); ExpandCustomEnemyDatabase.AddEnemyToDatabase(outObject, actor.EnemyGuid, true); FakePrefab.MarkAsFakePrefab(outObject); UnityEngine.Object.DontDestroyOnLoad(outObject); } catch (Exception e) { ETGModConsole.Log($"Error setting up the western bro {whichBro}: " + e.ToString()); } }
public static GameObject MainHook(GameObject objectToInstantiate, RoomHandler targetRoom, IntVector2 location, bool deferConfiguration, AIActor.AwakenAnimationType awakenAnimType = AIActor.AwakenAnimationType.Default, bool autoEngage = false) { //hooks into InstantiateDungeonPlaceable GameObject result; System.Random rnd = new System.Random(); int nu = 0; string enemyGuid; GRandomHook.wasBoss = false; bool isbossroom = false; if (targetRoom.area.PrototypeRoomCategory == PrototypeDungeonRoom.RoomCategory.BOSS && targetRoom.area.PrototypeRoomBossSubcategory == PrototypeDungeonRoom.RoomBossSubCategory.FLOOR_BOSS) { isbossroom = true; } else if (GRandomRoomDatabaseHelper.AllSpecificDeathRooms.Contains(targetRoom.GetRoomName())) { isbossroom = true; } try { if (objectToInstantiate != null) { Vector3 vector = location.ToVector3(0f) + targetRoom.area.basePosition.ToVector3(); vector.z = vector.y + vector.z; AIActor component = objectToInstantiate.GetComponent <AIActor>(); //notused AIActor ogcomponent = component; if (component is AIActorDummy) { objectToInstantiate = (component as AIActorDummy).realPrefab; component = objectToInstantiate.GetComponent <AIActor>(); } SpeculativeRigidbody component2 = objectToInstantiate.GetComponent <SpeculativeRigidbody>(); //notused if (component && component2) { if (component.EnemyGuid != null) { //Here gets enemyGuid based on room. Pulls from EnemyDatabase /////////////////////// if (isbossroom) { if (component.healthHaver.IsBoss) { GRandomHook.wasBoss = true; if (component.healthHaver.GetMaxHealth() != 60) //sometimes gets health as regular enemy health, 60 { GRandomHook.boss_health = component.healthHaver.GetMaxHealth(); //getting boss health to set for replacement boss } //replacement for Boss nu = rnd.Next(0, GRandomEnemyDataBaseHelper.UsedBossRoomDatabase.Count); enemyGuid = GRandomEnemyDataBaseHelper.UsedBossRoomDatabase[nu]; } else { //normal enemies as bosses is off and the enemy is not a boss; pull from no bosses database for enemy spawnings nu = rnd.Next(0, GRandomEnemyDataBaseHelper.BossRoomRegularEnemiesOnly.Count); enemyGuid = GRandomEnemyDataBaseHelper.BossRoomRegularEnemiesOnly[nu]; } } else if (targetRoom.GetRoomName() == "ResourcefulRat_PitEntrance_01" | targetRoom.GetRoomName() == "ResourcefulRat_Entrance") { nu = rnd.Next(0, GRandomEnemyDataBaseHelper.HarmlessEnemyDatabase.Count); enemyGuid = GRandomEnemyDataBaseHelper.HarmlessEnemyDatabase[nu]; } else { nu = rnd.Next(0, GRandomEnemyDataBaseHelper.UsedRegularRoomDatabase.Count); enemyGuid = GRandomEnemyDataBaseHelper.UsedRegularRoomDatabase[nu]; } if (component.EnemyGuid == "479556d05c7c44f3b6abb3b2067fc778") //wallmimic { enemyGuid = "479556d05c7c44f3b6abb3b2067fc778"; } // //can add specific Guid here for debugging // if (enemyGuid == "465da2bb086a4a88a803f79fe3a27677") //replace DraGun, can't remove him from database or forge dragunroom breaks { enemyGuid = "05b8afe0b6cc4fffa9dc6036fa24c8ec"; } // End getting guid ////////////////////////////// //initializing new AIActor, not sure why they do it again below AIActor prefabActor = EnemyDatabase.GetOrLoadByGuid(enemyGuid); objectToInstantiate = prefabActor.gameObject; component = objectToInstantiate.GetComponent <AIActor>(); component2 = objectToInstantiate.GetComponent <SpeculativeRigidbody>(); //bool specificdeathdoer = prefabActor.healthHaver.ManualDeathHandling; GenericIntroDoer genericIntroDoer = component.GetComponent <GenericIntroDoer>(); //if (genericIntroDoer) // is boss // handles initiated boss settings if (component.healthHaver.IsBoss) { if (isbossroom) { prefabActor.healthHaver.SetHealthMaximum(GRandomHook.boss_health); ETGModConsole.Log("Newbosshealth " + prefabActor.healthHaver.GetMaxHealth()); } else { prefabActor.healthHaver.SetHealthMaximum(60f); } objectToInstantiate = RandomHandleEnemyInfo.RemoveBossIntros(objectToInstantiate); objectToInstantiate = RandomHandleEnemyInfo.ReplaceSpecificBossDeathController(objectToInstantiate); objectToInstantiate = RandomHandleEnemyInfo.AttackBehaviorManipulator(objectToInstantiate); DemonWallController dwc = objectToInstantiate.GetComponent <DemonWallController>(); if (dwc) { Destroy(dwc); } } if (!component.IsNormalEnemy) { objectToInstantiate = RandomHandleEnemyInfo.HandleCompanions(objectToInstantiate); } } PixelCollider pixelCollider = component2.GetPixelCollider(ColliderType.Ground); if (pixelCollider.ColliderGenerationMode != PixelCollider.PixelColliderGeneration.Manual) { Debug.LogErrorFormat("Trying to spawn an AIActor who doesn't have a manual ground collider... do we still do this? Name: {0}", new object[] { objectToInstantiate.name }); } Vector2 a = PhysicsEngine.PixelToUnit(new IntVector2(pixelCollider.ManualOffsetX, pixelCollider.ManualOffsetY)); Vector2 vector2 = PhysicsEngine.PixelToUnit(new IntVector2(pixelCollider.ManualWidth, pixelCollider.ManualHeight)); Vector2 vector3 = new Vector2((float)Mathf.CeilToInt(vector2.x), (float)Mathf.CeilToInt(vector2.y)); Vector2 b = new Vector2((vector3.x - vector2.x) / 2f, 0f).Quantize(0.0625f); if (targetRoom.GetRoomName() == "DraGunRoom01" | targetRoom.GetRoomName() == "LichRoom02" | targetRoom.GetRoomName() == "LichRoom03" | targetRoom.GetRoomName() == "Bullet_End_Room_04" | targetRoom.GetRoomName() == "ResourcefulRatRoom01") { b -= new Vector2(0.0f, 5.0f); } Vector3 v3 = a - b; vector -= v3; //vector -= a - b; //Vector3 } if (component) { component.AwakenAnimType = awakenAnimType; } GameObject NewEnemyObject = UnityEngine.Object.Instantiate <GameObject>(objectToInstantiate, vector, Quaternion.identity); if (!deferConfiguration) { Component[] componentsInChildren = NewEnemyObject.GetComponentsInChildren(typeof(IPlaceConfigurable)); for (int i = 0; i < componentsInChildren.Length; i++) { IPlaceConfigurable placeConfigurable = componentsInChildren[i] as IPlaceConfigurable; if (placeConfigurable != null) { placeConfigurable.ConfigureOnPlacement(targetRoom); } } } ObjectVisibilityManager component3 = NewEnemyObject.GetComponent <ObjectVisibilityManager>(); if (component3 != null) { component3.Initialize(targetRoom, autoEngage); } MinorBreakable componentInChildren = NewEnemyObject.GetComponentInChildren <MinorBreakable>(); if (componentInChildren != null) { IntVector2 key = location + targetRoom.area.basePosition; CellData cellData = GameManager.Instance.Dungeon.data[key]; if (cellData != null) { cellData.cellVisualData.containsObjectSpaceStamp = true; } } PlayerItem component4 = NewEnemyObject.GetComponent <PlayerItem>(); if (component4 != null) { component4.ForceAsExtant = true; } //[Randomizer] Add AIActor GameObjectInfo AIActor enemy_component = NewEnemyObject.GetComponent <AIActor>(); if (enemy_component) { if (enemy_component.healthHaver.IsBoss) { if (isbossroom) { //Boss Room enemy_component.healthHaver.bossHealthBar = HealthHaver.BossBarType.MainBar; } else { enemy_component.healthHaver.bossHealthBar = HealthHaver.BossBarType.None; autoEngage = true; } NewEnemyObject = RandomHandleEnemyInfo.ReinstateBossObjectInfo(NewEnemyObject); //removes boss status if regular boss, needs hitbox stuff reinstated } if (GRandomEnemyDataBaseHelper.SpecificEnemyDatabase.Contains(enemy_component.EnemyGuid)) { NewEnemyObject = RandomHandleEnemyInfo.SpecificEnemyHelper(NewEnemyObject); } NewEnemyObject = UniqueBossRoomDeathHandler.SpecificRoomHandler(targetRoom, NewEnemyObject); } result = NewEnemyObject; } else { result = null; //return null; } } catch (Exception message) { Debug.Log("[RANDOMIZER ERROR] " + message.ToString()); result = null; } return(result); }
public static void GenerateGungeoneerMimicBoss(AssetBundle expandSharedAssets1, GameObject aiActorObject, PlayerController sourcePlayer = null) { if (sourcePlayer == null) { sourcePlayer = GameManager.Instance.PrimaryPlayer; } if (sourcePlayer == null) { return; } tk2dSprite playerSprite = aiActorObject.AddComponent <tk2dSprite>(); ExpandUtility.DuplicateSprite(playerSprite, (sourcePlayer.sprite as tk2dSprite)); // If Player sprite was flipped (aka, player aiming/facing towards the left), then this could cause sprite being shifted left on AIActor. // Always set false to ensure this doesn't happen. playerSprite.FlipX = false; ExpandUtility.GenerateAIActorTemplate(aiActorObject, out m_CorpseObject, aiActorObject.name, System.Guid.NewGuid().ToString(), GunAttachOffset: new Vector3(0.3f, 0.25f, 0), StartingGunID: 472); AIActor CachedEnemyActor = aiActorObject.GetComponent <AIActor>(); if (!aiActorObject | !CachedEnemyActor) { return; } if (ExpandStats.debugMode) { ETGModConsole.Log("Spawning '" + CachedEnemyActor.ActorName + "' with GUID: " + CachedEnemyActor.EnemyGuid + " .", false); } GameObject m_NewHandObject = new GameObject("PlayerMimicHand"); tk2dSprite m_HandSprite = m_NewHandObject.AddComponent <tk2dSprite>(); ExpandUtility.DuplicateSprite(m_HandSprite, sourcePlayer.primaryHand.gameObject.GetComponent <tk2dSprite>()); PlayerHandController m_HandController = m_NewHandObject.AddComponent <PlayerHandController>(); m_HandController.ForceRenderersOff = false; m_HandController.handHeightFromGun = 0.05f; CachedEnemyActor.aiShooter.handObject = m_HandController; // Generate BossCard based on current Player. Texture2D BossCardForeground = ExpandUtility.FlipTexture(Instantiate(sourcePlayer.BosscardSprites[0])); // Mirror thing will be used as static background. (will be the same for all possible boss cards) Texture2D BossCardBackground = expandSharedAssets1.LoadAsset <Texture2D>("MimicInMirror_BossCardBackground"); // Combine foreground boss card generated from PlayerController onto the static background image loased in earlier. Resolutions must match! Texture2D BossCardTexture = ExpandUtility.CombineTextures(BossCardBackground, BossCardForeground); GenericIntroDoer miniBossIntroDoer = aiActorObject.AddComponent <GenericIntroDoer>(); aiActorObject.AddComponent <ExpandGungeoneerMimicIntroDoer>(); miniBossIntroDoer.triggerType = GenericIntroDoer.TriggerType.PlayerEnteredRoom; miniBossIntroDoer.initialDelay = 0.15f; miniBossIntroDoer.cameraMoveSpeed = 14; miniBossIntroDoer.specifyIntroAiAnimator = null; miniBossIntroDoer.BossMusicEvent = "Play_MUS_Boss_Theme_Beholster"; miniBossIntroDoer.PreventBossMusic = false; miniBossIntroDoer.InvisibleBeforeIntroAnim = false; miniBossIntroDoer.preIntroAnim = string.Empty; miniBossIntroDoer.preIntroDirectionalAnim = string.Empty; miniBossIntroDoer.introAnim = "idle"; miniBossIntroDoer.introDirectionalAnim = string.Empty; miniBossIntroDoer.continueAnimDuringOutro = false; miniBossIntroDoer.cameraFocus = null; miniBossIntroDoer.roomPositionCameraFocus = Vector2.zero; miniBossIntroDoer.restrictPlayerMotionToRoom = false; miniBossIntroDoer.fusebombLock = false; miniBossIntroDoer.AdditionalHeightOffset = 0; miniBossIntroDoer.portraitSlideSettings = new PortraitSlideSettings() { bossNameString = "Dopplegunner", bossSubtitleString = "Imposter!", bossQuoteString = "Clone gone rogue...", bossSpritePxOffset = IntVector2.Zero, topLeftTextPxOffset = IntVector2.Zero, bottomRightTextPxOffset = IntVector2.Zero, bgColor = new Color(0, 0, 1, 1) }; if (BossCardTexture) { miniBossIntroDoer.portraitSlideSettings.bossArtSprite = BossCardTexture; miniBossIntroDoer.SkipBossCard = false; CachedEnemyActor.healthHaver.bossHealthBar = HealthHaver.BossBarType.MainBar; } else { miniBossIntroDoer.SkipBossCard = true; CachedEnemyActor.healthHaver.bossHealthBar = HealthHaver.BossBarType.SubbossBar; } miniBossIntroDoer.HideGunAndHand = true; miniBossIntroDoer.SkipFinalizeAnimation = true; miniBossIntroDoer.RegenerateCache(); CachedEnemyActor.BaseMovementSpeed = 8f; CachedEnemyActor.MovementSpeed = 8f; CachedEnemyActor.healthHaver.SetHealthMaximum(1000); CachedEnemyActor.healthHaver.ForceSetCurrentHealth(1000); CachedEnemyActor.healthHaver.overrideBossName = "Dopplegunner"; CachedEnemyActor.healthHaver.RegenerateCache(); CachedEnemyActor.EnemyId = Random.Range(2000, 9999); CachedEnemyActor.EnemyGuid = System.Guid.NewGuid().ToString(); CachedEnemyActor.OverrideDisplayName = ("Dopplegunner"); CachedEnemyActor.ActorName = ("Dopplegunner"); CachedEnemyActor.name = ("Dopplegunner"); CachedEnemyActor.CanTargetEnemies = false; CachedEnemyActor.CanTargetPlayers = true; if (sourcePlayer.characterIdentity == PlayableCharacters.Bullet) { CachedEnemyActor.EnemySwitchState = "Metal_Bullet_Man"; } else if (sourcePlayer.characterIdentity == PlayableCharacters.Convict) { CachedEnemyActor.EnemySwitchState = "Convict"; } else if (sourcePlayer.characterIdentity == PlayableCharacters.CoopCultist) { CachedEnemyActor.EnemySwitchState = "Cultist"; } else if (sourcePlayer.characterIdentity == PlayableCharacters.Cosmonaut) { CachedEnemyActor.EnemySwitchState = "Cosmonaut"; } else if (sourcePlayer.characterIdentity == PlayableCharacters.Guide) { CachedEnemyActor.EnemySwitchState = "Guide"; } else if (sourcePlayer.characterIdentity == PlayableCharacters.Gunslinger) { CachedEnemyActor.EnemySwitchState = "Gunslinger"; } else if (sourcePlayer.characterIdentity == PlayableCharacters.Ninja) { CachedEnemyActor.EnemySwitchState = "Ninja"; } else if (sourcePlayer.characterIdentity == PlayableCharacters.Pilot) { CachedEnemyActor.EnemySwitchState = "Rogue"; } else if (sourcePlayer.characterIdentity == PlayableCharacters.Robot) { CachedEnemyActor.EnemySwitchState = "Robot"; } else if (sourcePlayer.characterIdentity == PlayableCharacters.Soldier) { CachedEnemyActor.EnemySwitchState = "Marine"; } else if (sourcePlayer.characterIdentity == PlayableCharacters.Eevee) { CachedEnemyActor.EnemySwitchState = "Convict"; ExpandShaders.ApplyParadoxPlayerShader(CachedEnemyActor.sprite); } else { CachedEnemyActor.EnemySwitchState = "Gun Cultist"; } ExpandGungeoneerMimicBossController playerMimicController = aiActorObject.AddComponent <ExpandGungeoneerMimicBossController>(); playerMimicController.m_Player = sourcePlayer; aiActorObject.AddComponent <ExpandGungeoneerMimicDeathController>(); if (CachedEnemyActor.GetComponent <ExpandGungeoneerMimicIntroDoer>()) { GenericIntroDoer genericIntroDoer = CachedEnemyActor.gameObject.GetComponent <GenericIntroDoer>(); FieldInfo field = typeof(GenericIntroDoer).GetField("m_specificIntroDoer", BindingFlags.Instance | BindingFlags.NonPublic); field.SetValue(genericIntroDoer, CachedEnemyActor.GetComponent <ExpandGungeoneerMimicIntroDoer>()); } CachedEnemyActor.aiAnimator.enabled = false; CachedEnemyActor.spriteAnimator.Stop(); CachedEnemyActor.spriteAnimator.DefaultClipId = 0; CachedEnemyActor.spriteAnimator.playAutomatically = false; List <tk2dSpriteAnimationClip> m_AnimationClips = new List <tk2dSpriteAnimationClip>(); foreach (tk2dSpriteAnimationClip clip in sourcePlayer.spriteAnimator.Library.clips) { if (!string.IsNullOrEmpty(clip.name)) { if (clip.name.ToLower() == "dodge") { m_AnimationClips.Add(clip); if (clip.frames != null && clip.frames.Length > 0) { if (!sourcePlayer.UseArmorlessAnim) { CachedEnemyActor.sprite.SetSprite(clip.frames[0].spriteId); } } } else if (clip.name.ToLower() == "dodge_armorless") { m_AnimationClips.Add(clip); if (clip.frames != null && clip.frames.Length > 0) { if (sourcePlayer.UseArmorlessAnim) { CachedEnemyActor.sprite.SetSprite(clip.frames[0].spriteId); } } } else if (clip.name.ToLower() == "run_down") { m_AnimationClips.Add(clip); } else if (clip.name.ToLower() == "run_down_armorless") { m_AnimationClips.Add(clip); } else if (clip.name.ToLower() == "death_shot") { m_AnimationClips.Add(clip); } else if (clip.name.ToLower() == "death_shot_armorless") { m_AnimationClips.Add(clip); } } } if (m_AnimationClips.Count > 0) { if (!CachedEnemyActor.spriteAnimator.Library) { CachedEnemyActor.spriteAnimator.Library = aiActorObject.AddComponent <tk2dSpriteAnimation>(); } CachedEnemyActor.spriteAnimator.Library.clips = m_AnimationClips.ToArray(); } CachedEnemyActor.healthHaver.RegenerateCache(); BehaviorSpeculator customBehaviorSpeculator = aiActorObject.AddComponent <BehaviorSpeculator>(); customBehaviorSpeculator.OverrideBehaviors = new List <OverrideBehaviorBase>(0); customBehaviorSpeculator.TargetBehaviors = new List <TargetBehaviorBase>(0); customBehaviorSpeculator.MovementBehaviors = new List <MovementBehaviorBase>(0); customBehaviorSpeculator.AttackBehaviors = new List <AttackBehaviorBase>(0); customBehaviorSpeculator.OtherBehaviors = new List <BehaviorBase>(0); customBehaviorSpeculator.InstantFirstTick = false; customBehaviorSpeculator.TickInterval = 0.1f; customBehaviorSpeculator.PostAwakenDelay = 0.5f; customBehaviorSpeculator.RemoveDelayOnReinforce = false; customBehaviorSpeculator.OverrideStartingFacingDirection = false; customBehaviorSpeculator.StartingFacingDirection = -90f; customBehaviorSpeculator.SkipTimingDifferentiator = false; customBehaviorSpeculator.RegenerateCache(); // BehaviorSpeculator is a serialized object. You must build these lists (or create new empty lists) and save them before the game can instantiate it correctly! ISerializedObject m_TargetBehaviorSpeculatorSeralized = customBehaviorSpeculator; m_TargetBehaviorSpeculatorSeralized.SerializedObjectReferences = new List <Object>(0); m_TargetBehaviorSpeculatorSeralized.SerializedStateKeys = new List <string>() { "OverrideBehaviors", "TargetBehaviors", "MovementBehaviors", "AttackBehaviors", "OtherBehaviors" }; m_TargetBehaviorSpeculatorSeralized.SerializedStateValues = new List <string>() { "[]", "[]", "[]", "[]", "[]" }; CachedEnemyActor.RegenerateCache(); return; }
public static void BuildPrefab() { // source = EnemyDatabase.GetOrLoadByGuid("c50a862d19fc4d30baeba54795e8cb93"); bool flag = prefab != null || BossBuilder.Dictionary.ContainsKey(guid); bool flag2 = flag; if (!flag2) { prefab = BossBuilder.BuildPrefab("Flame Chamber", guid, spritePaths[0], new IntVector2(0, 0), new IntVector2(8, 9), false, true); var companion = prefab.AddComponent <EnemyBehavior2>(); companion.aiActor.knockbackDoer.weight = 200; companion.aiActor.MovementSpeed = 6f; companion.aiActor.healthHaver.PreventAllDamage = false; companion.aiActor.CollisionDamage = 1f; companion.aiActor.HasShadow = true; companion.aiActor.IgnoreForRoomClear = false; companion.aiActor.aiAnimator.HitReactChance = 0.05f; companion.aiActor.specRigidbody.CollideWithOthers = true; companion.aiActor.specRigidbody.CollideWithTileMap = true; companion.aiActor.PreventFallingInPitsEver = true; companion.aiActor.healthHaver.ForceSetCurrentHealth(500f); companion.aiActor.healthHaver.SetHealthMaximum(500f); companion.aiActor.CollisionKnockbackStrength = 5f; companion.aiActor.procedurallyOutlined = true; companion.aiActor.CanTargetPlayers = true; ItemsMod.Strings.Enemies.Set("#FLAMECHAMBER", "Killinder"); ItemsMod.Strings.Enemies.Set("#????", "???"); ItemsMod.Strings.Enemies.Set("#SUBTITLE", "FLAME CHAMBER"); ItemsMod.Strings.Enemies.Set("#QUOTE", "THE 36 CHAMBERS"); companion.aiActor.healthHaver.overrideBossName = "#FLAMECHAMBER"; companion.aiActor.OverrideDisplayName = "#FLAMECHAMBER"; companion.aiActor.ActorName = "#FLAMECHAMBER"; companion.aiActor.name = "#FLAMECHAMBER"; companion.aiActor.SetIsFlying(true, "Flying Enemy", true, true); prefab.name = companion.aiActor.OverrideDisplayName; GenericIntroDoer miniBossIntroDoer = prefab.AddComponent <GenericIntroDoer>(); miniBossIntroDoer.triggerType = GenericIntroDoer.TriggerType.PlayerEnteredRoom; miniBossIntroDoer.initialDelay = 0.15f; miniBossIntroDoer.cameraMoveSpeed = 14; miniBossIntroDoer.specifyIntroAiAnimator = null; miniBossIntroDoer.BossMusicEvent = "Play_MUS_Boss_Theme_Beholster"; companion.aiActor.ShadowObject = EnemyDatabase.GetOrLoadByGuid("c00390483f394a849c36143eb878998f").ShadowObject; companion.aiActor.HasShadow = true; miniBossIntroDoer.PreventBossMusic = false; miniBossIntroDoer.InvisibleBeforeIntroAnim = false; miniBossIntroDoer.preIntroAnim = string.Empty; miniBossIntroDoer.preIntroDirectionalAnim = string.Empty; miniBossIntroDoer.introAnim = "intro"; miniBossIntroDoer.introDirectionalAnim = string.Empty; miniBossIntroDoer.continueAnimDuringOutro = false; miniBossIntroDoer.cameraFocus = null; miniBossIntroDoer.roomPositionCameraFocus = Vector2.zero; miniBossIntroDoer.restrictPlayerMotionToRoom = false; miniBossIntroDoer.fusebombLock = false; miniBossIntroDoer.AdditionalHeightOffset = 0; miniBossIntroDoer.portraitSlideSettings = new PortraitSlideSettings() { bossNameString = "#FLAMECHAMBER", bossSubtitleString = "#SUBTITLE", bossQuoteString = "#QUOTE", bossSpritePxOffset = IntVector2.Zero, topLeftTextPxOffset = IntVector2.Zero, bottomRightTextPxOffset = IntVector2.Zero, bgColor = ExtendedColours.orange }; miniBossIntroDoer.SkipBossCard = false; miniBossIntroDoer.portraitSlideSettings.bossArtSprite = BossCardTexture; companion.aiActor.healthHaver.bossHealthBar = HealthHaver.BossBarType.MainBar; miniBossIntroDoer.SkipFinalizeAnimation = true; miniBossIntroDoer.RegenerateCache(); //BehaviorSpeculator aIActor = EnemyDatabase.GetOrLoadByGuid("465da2bb086a4a88a803f79fe3a27677").behaviorSpeculator; //Tools.DebugInformation(aIActor); ///// companion.aiActor.healthHaver.SetHealthMaximum(500f, null, false); companion.aiActor.specRigidbody.PixelColliders.Clear(); companion.aiActor.specRigidbody.PixelColliders.Add(new PixelCollider { ColliderGenerationMode = PixelCollider.PixelColliderGeneration.Manual, CollisionLayer = CollisionLayer.EnemyCollider, IsTrigger = false, BagleUseFirstFrameOnly = false, SpecifyBagelFrame = string.Empty, BagelColliderNumber = 0, ManualOffsetX = 0, ManualOffsetY = 10, ManualWidth = 50, ManualHeight = 50, ManualDiameter = 0, ManualLeftX = 0, ManualLeftY = 0, ManualRightX = 0, ManualRightY = 0 }); companion.aiActor.specRigidbody.PixelColliders.Add(new PixelCollider { ColliderGenerationMode = PixelCollider.PixelColliderGeneration.Manual, CollisionLayer = CollisionLayer.EnemyHitBox, IsTrigger = false, BagleUseFirstFrameOnly = false, SpecifyBagelFrame = string.Empty, BagelColliderNumber = 0, ManualOffsetX = 0, ManualOffsetY = 10, ManualWidth = 50, ManualHeight = 50, ManualDiameter = 0, ManualLeftX = 0, ManualLeftY = 0, ManualRightX = 0, ManualRightY = 0, }); companion.aiActor.CorpseObject = EnemyDatabase.GetOrLoadByGuid("c0ff3744760c4a2eb0bb52ac162056e6").CorpseObject; companion.aiActor.PreventBlackPhantom = false; AIAnimator aiAnimator = companion.aiAnimator; aiAnimator.IdleAnimation = new DirectionalAnimation { Type = DirectionalAnimation.DirectionType.Single, Prefix = "idle", AnimNames = new string[1], Flipped = new DirectionalAnimation.FlipType[1] }; DirectionalAnimation almostdone = new DirectionalAnimation { Type = DirectionalAnimation.DirectionType.Single, Prefix = "intro", AnimNames = new string[1], Flipped = new DirectionalAnimation.FlipType[1] }; aiAnimator.OtherAnimations = new List <AIAnimator.NamedDirectionalAnimation> { new AIAnimator.NamedDirectionalAnimation { name = "intro", anim = almostdone } }; DirectionalAnimation done2 = new DirectionalAnimation { Type = DirectionalAnimation.DirectionType.Single, Prefix = "bigeyes", AnimNames = new string[1], Flipped = new DirectionalAnimation.FlipType[1] }; aiAnimator.OtherAnimations = new List <AIAnimator.NamedDirectionalAnimation> { new AIAnimator.NamedDirectionalAnimation { name = "bigeyes", anim = done2 } }; DirectionalAnimation done32 = new DirectionalAnimation { Type = DirectionalAnimation.DirectionType.Single, Prefix = "eyes", AnimNames = new string[1], Flipped = new DirectionalAnimation.FlipType[1] }; aiAnimator.OtherAnimations = new List <AIAnimator.NamedDirectionalAnimation> { new AIAnimator.NamedDirectionalAnimation { name = "eyes", anim = done32 } }; bool flag3 = BishopCollection == null; if (flag3) { BishopCollection = SpriteBuilder.ConstructCollection(prefab, "FlameChamber_Collection"); UnityEngine.Object.DontDestroyOnLoad(BishopCollection); for (int i = 0; i < spritePaths.Length; i++) { SpriteBuilder.AddSpriteToCollection(spritePaths[i], BishopCollection); } SpriteBuilder.AddAnimation(companion.spriteAnimator, BishopCollection, new List <int> { 0, 1, 2, 3 }, "idle", tk2dSpriteAnimationClip.WrapMode.Loop).fps = 7f; SpriteBuilder.AddAnimation(companion.spriteAnimator, BishopCollection, new List <int> { 4, 5, 6, 7, 8, 9, 34 }, "intro", tk2dSpriteAnimationClip.WrapMode.Once).fps = 7f; SpriteBuilder.AddAnimation(companion.spriteAnimator, BishopCollection, new List <int> { 31 }, "bigeyes", tk2dSpriteAnimationClip.WrapMode.Once).fps = 6f; SpriteBuilder.AddAnimation(companion.spriteAnimator, BishopCollection, new List <int> { 32 }, "eyes", tk2dSpriteAnimationClip.WrapMode.Once).fps = 6f; } var bs = prefab.GetComponent <BehaviorSpeculator>(); BehaviorSpeculator behaviorSpeculator = EnemyDatabase.GetOrLoadByGuid("01972dee89fc4404a5c408d50007dad5").behaviorSpeculator; bs.OverrideBehaviors = behaviorSpeculator.OverrideBehaviors; bs.OtherBehaviors = behaviorSpeculator.OtherBehaviors; shootpoint = new GameObject("attach"); shootpoint.transform.parent = companion.transform; shootpoint.transform.position = companion.sprite.WorldCenter; GameObject m_CachedGunAttachPoint = companion.transform.Find("attach").gameObject; bs.TargetBehaviors = new List <TargetBehaviorBase> { new TargetPlayerBehavior { Radius = 35f, LineOfSight = false, ObjectPermanence = true, SearchInterval = 0.25f, PauseOnTargetSwitch = false, PauseTime = 0.25f } }; float[] angles = { 45, 135, 225, 135 }; bs.MovementBehaviors = new List <MovementBehaviorBase> { new PingPongAroundBehavior2 { startingAngles = angles } }; bs.AttackBehaviorGroup.AttackBehaviors = new List <AttackBehaviorGroup.AttackGroupItem> { new AttackBehaviorGroup.AttackGroupItem() { Probability = 1, Behavior = new ShootBehavior { ShootPoint = m_CachedGunAttachPoint, BulletScript = new CustomBulletScriptSelector(typeof(ChamberShot)), LeadAmount = 0f, AttackCooldown = 4.5f, TellAnimation = "bigeyes", RequiresLineOfSight = false, StopDuring = ShootBehavior.StopType.Attack, Uninterruptible = true }, NickName = "Lucky Sixes" }, new AttackBehaviorGroup.AttackGroupItem() { Probability = 1, Behavior = new ShootBehavior { ShootPoint = m_CachedGunAttachPoint, BulletScript = new CustomBulletScriptSelector(typeof(FireLine)), LeadAmount = 0f, AttackCooldown = 4.5f, TellAnimation = "bigeyes", RequiresLineOfSight = false, StopDuring = ShootBehavior.StopType.Attack, Uninterruptible = true }, NickName = "Fire In Da Hole" }, new AttackBehaviorGroup.AttackGroupItem() { Probability = 1.5f, Behavior = new TeleportBehavior() { AttackableDuringAnimation = true, AllowCrossRoomTeleportation = false, teleportRequiresTransparency = false, hasOutlinesDuringAnim = true, ManuallyDefineRoom = false, StayOnScreen = true, AvoidWalls = true, GoneTime = 0.7f, OnlyTeleportIfPlayerUnreachable = false, MinDistanceFromPlayer = 7f, MaxDistanceFromPlayer = -1f, teleportInBulletScript = new CustomBulletScriptSelector(typeof(PoofScript)), teleportOutBulletScript = new CustomBulletScriptSelector(typeof(PoofScript)), AttackCooldown = 5f, InitialCooldown = 0f, RequiresLineOfSight = false, roomMax = new Vector2(0, 0), roomMin = new Vector2(0, 0), GlobalCooldown = 0.5f, Cooldown = 1f, InitialCooldownVariance = 0f, goneAttackBehavior = null, IsBlackPhantom = false, GroupName = null, GroupCooldown = 0f, MinRange = 3, Range = 10, MinHealthThreshold = 0, AccumulateHealthThresholds = true, targetAreaStyle = null, HealthThresholds = new float[0], MinWallDistance = 1, }, NickName = "Flameport" }, new AttackBehaviorGroup.AttackGroupItem() { Probability = 0.5f, Behavior = new ShootBehavior { ShootPoint = m_CachedGunAttachPoint, BulletScript = new CustomBulletScriptSelector(typeof(ShotgunBall)), LeadAmount = 0f, TellAnimation = "eyes", AttackCooldown = 4.5f, RequiresLineOfSight = false, StopDuring = ShootBehavior.StopType.Attack, Uninterruptible = true }, NickName = "Large Shotgunball" }, }; bs.InstantFirstTick = behaviorSpeculator.InstantFirstTick; bs.TickInterval = behaviorSpeculator.TickInterval; bs.PostAwakenDelay = behaviorSpeculator.PostAwakenDelay; bs.RemoveDelayOnReinforce = behaviorSpeculator.RemoveDelayOnReinforce; bs.OverrideStartingFacingDirection = behaviorSpeculator.OverrideStartingFacingDirection; bs.StartingFacingDirection = behaviorSpeculator.StartingFacingDirection; bs.SkipTimingDifferentiator = behaviorSpeculator.SkipTimingDifferentiator; companion.aiActor.CollisionSetsPlayerOnFire = true; companion.aiActor.EffectResistances = new ActorEffectResistance[] { new ActorEffectResistance() { resistAmount = 1, resistType = EffectResistanceType.Fire }, }; Game.Enemies.Add("cak:flamechamber", companion.aiActor); } }
{//used for debugging public static void RoomStats(string[] notused) { RoomHandler currentRoom = GameManager.Instance.PrimaryPlayer.CurrentRoom; List <AIActor> activeenemies_typeall = currentRoom.GetActiveEnemies(RoomHandler.ActiveEnemyType.All); List <AIActor> activeenemies_typeroomclear = currentRoom.GetActiveEnemies(RoomHandler.ActiveEnemyType.RoomClear); ETGModConsole.Log(""); ETGModConsole.Log(string.Format("Current Room: {0}", currentRoom.GetRoomName())); ETGModConsole.Log(string.Format("There are {0} Type All enemies", activeenemies_typeall.Count)); ETGModConsole.Log(string.Format("There are {0} Type Room Clear enemies", activeenemies_typeroomclear.Count)); //ETGModConsole.Log("ActorName: {0}, IsVulnerable: {1}, CurrentHealth: {2}, IsHarmlessEnemy: {3}, activeenabled: {4}, PreventAllDamage: {5}, " + // "CanBeKilled: {6}, FlashesOnDamage: {7}, IsNormalEnemy: {8}"); ETGModConsole.Log(" {0}:Guid, {1}:IsVulnerable, {2}:playerentered, {3}:IsHarmlessEnemy, {4}:activeenabled, {5}:PreventAllDamage, " + "{6}:awoken, {7}:engaged, {8}:IsNormalEnemy"); for (int e = 0; e < activeenemies_typeall.Count; e++) { AIActor enemy = activeenemies_typeall[e]; bool vulnerable = enemy.healthHaver.IsVulnerable; float health = enemy.healthHaver.GetCurrentHealth(); bool isharmlessenemy = enemy.IsHarmlessEnemy; bool isbuffenemy = enemy.IsBuffEnemy; bool activeenabled = enemy.isActiveAndEnabled; bool preventalldamage = enemy.healthHaver.PreventAllDamage; bool flash = enemy.healthHaver.flashesOnDamage; bool awoken = enemy.HasBeenAwoken; bool engaged = enemy.HasBeenEngaged; bool playerentered = enemy.HasDonePlayerEnterCheck; //ETGModConsole.Log(string.Format("0{0}, 1{1}, 2{2}, 3{3}, 4{4}, 5{5}, 6{6}, 7{7}, 8{8} ", // enemy.GetActorName(), vulnerable.ToString(), health.ToString(), isharmlessenemy.ToString(), activeenabled.ToString(), preventalldamage.ToString(), // enemy.healthHaver.CanCurrentlyBeKilled.ToString(), flash.ToString(), enemy.IsNormalEnemy.ToString())); GenericIntroDoer genericIntroDoer = enemy.GetComponent <GenericIntroDoer>(); ETGModConsole.Log(string.Format("0{0}, 1{1}, 2{2}, 3{3}, 4{4}, 5{5}, 6{6}, 7{7}, 8{8} ", enemy.EnemyGuid, vulnerable.ToString(), playerentered.ToString(), isharmlessenemy.ToString(), activeenabled.ToString(), preventalldamage.ToString(), awoken.ToString(), engaged.ToString(), enemy.IsNormalEnemy.ToString())); AIActor objectToInstantiate = activeenemies_typeall[e]; SpeculativeRigidbody custom_component = objectToInstantiate.GetComponent <SpeculativeRigidbody>(); //if (genericIntroDoer) //{ // ETGModConsole.Log("Has Generic Intro Doer"); //} //else //{ // ETGModConsole.Log("has no Gneric Intro Doer"); //} //custom_component.HitboxPixelCollider.IsTrigger = true; //custom_component.HitboxPixelCollider.CollisionLayerIgnoreOverride |= CollisionMask.LayerToMask(CollisionLayer.Projectile); //custom_component.RemoveCollisionLayerIgnoreOverride(CollisionMask.LayerToMask(CollisionLayer.Projectile)); //custom_component.RemoveCollisionLayerOverride(CollisionMask.LayerToMask(CollisionLayer.Projectile)); //enemy.IsNormalEnemy = true; //custom_component.HitboxPixelCollider.CanCollideWith(CollisionLayer.Projectile); ////enemy.CollisionDamage() //if (custom_component.HasFrameSpecificCollisionExceptions) //{ // ETGModConsole.Log("HAS Frame Specific Collision Exeptions"); //} //if (custom_component.GhostCollisionExceptions != null) //{ // List<SpeculativeRigidbody> ghostcollisions = custom_component.GhostCollisionExceptions; // ETGModConsole.Log(string.Format("Number Ghost Collisions: {0}", ghostcollisions.Count.ToString())); //} //else //{ // ETGModConsole.Log("No Ghosst Collisions"); //} ////bool hashiteffecthandler = custom_component.hasHit //List<PixelCollider> custom_pixels = custom_component.PixelColliders; //ETGModConsole.Log(string.Format("Number Pixel Colliders: {0}", custom_pixels.Count.ToString())); //for (int g = 0; g < custom_pixels.Count; g++) //{ // PixelCollider custom_pixel_collider = custom_pixels[g]; // //foreach(var x in CollisionLayer) // //{ // //} // bool playercollider = custom_pixel_collider.CanCollideWith(CollisionLayer.PlayerHitBox); // bool projectile = custom_pixel_collider.CanCollideWith(CollisionLayer.Projectile); // bool tiles = custom_pixel_collider.CanCollideWith(CollisionLayer.LowObstacle); // ETGModConsole.Log(string.Format("PlayerCollider: {0}, Projectile: {1}, LowObstacle: {2}", playercollider.ToString(), projectile.ToString(), tiles.ToString())); //} //base.specRigidbody.HitboxPixelCollider.IsTrigger = true; //base.specRigidbody.HitboxPixelCollider.CollisionLayerIgnoreOverride |= CollisionMask.LayerToMask(CollisionLayer.Projectile); //custom_pixel_collider.ClearFrameSpecificCollisionExceptions(); } }
private void DoInitialConfiguration(PlayerController player) { m_AIActor.sprite.SetSprite(player.sprite.Collection, player.sprite.GetCurrentSpriteDef().name); tk2dSprite m_HandSprite = m_AIActor.aiShooter.handObject.gameObject.AddComponent <tk2dSprite>(); ExpandUtility.DuplicateSprite(m_HandSprite, player.primaryHand.gameObject.GetComponent <tk2dSprite>()); m_AIActor.aiShooter.handObject.sprite.SetSprite(player.primaryHand.sprite.Collection, player.primaryHand.sprite.GetCurrentSpriteDef().name); // Generate BossCard based on current Player. Texture2D BossCardForeground = ExpandUtility.FlipTexture(Instantiate(player.BosscardSprites[0])); // Mirror thing will be used as static background. (will be the same for all possible boss cards) Texture2D BossCardBackground = ExpandAssets.LoadAsset <Texture2D>("MimicInMirror_BossCardBackground"); // Combine foreground boss card generated from PlayerController onto the static background image loased in earlier. Resolutions must match! Texture2D BossCardTexture = ExpandUtility.CombineTextures(BossCardBackground, BossCardForeground); GenericIntroDoer miniBossIntroDoer = gameObject.GetComponent <GenericIntroDoer>(); if (BossCardTexture) { miniBossIntroDoer.portraitSlideSettings.bossArtSprite = BossCardTexture; } if (player.characterIdentity == PlayableCharacters.Bullet) { m_AIActor.EnemySwitchState = "Metal_Bullet_Man"; } else if (player.characterIdentity == PlayableCharacters.Convict) { m_AIActor.EnemySwitchState = "Convict"; } else if (player.characterIdentity == PlayableCharacters.CoopCultist) { m_AIActor.EnemySwitchState = "Cultist"; } else if (player.characterIdentity == PlayableCharacters.Cosmonaut) { m_AIActor.EnemySwitchState = "Cosmonaut"; } else if (player.characterIdentity == PlayableCharacters.Guide) { m_AIActor.EnemySwitchState = "Guide"; } else if (player.characterIdentity == PlayableCharacters.Gunslinger) { m_AIActor.EnemySwitchState = "Gunslinger"; } else if (player.characterIdentity == PlayableCharacters.Ninja) { m_AIActor.EnemySwitchState = "Ninja"; } else if (player.characterIdentity == PlayableCharacters.Pilot) { m_AIActor.EnemySwitchState = "Rogue"; } else if (player.characterIdentity == PlayableCharacters.Robot) { m_AIActor.EnemySwitchState = "Robot"; } else if (player.characterIdentity == PlayableCharacters.Soldier) { m_AIActor.EnemySwitchState = "Marine"; } else if (player.characterIdentity == PlayableCharacters.Eevee) { m_AIActor.EnemySwitchState = "Convict"; ExpandShaders.ApplyParadoxPlayerShader(m_AIActor.sprite); } else { m_AIActor.EnemySwitchState = "Gun Cultist"; } List <tk2dSpriteAnimationClip> m_AnimationClips = new List <tk2dSpriteAnimationClip>(); foreach (tk2dSpriteAnimationClip clip in player.spriteAnimator.Library.clips) { if (!string.IsNullOrEmpty(clip.name)) { if (clip.name.ToLower() == "dodge") { m_AnimationClips.Add(clip); if (clip.frames != null && clip.frames.Length > 0) { if (!player.UseArmorlessAnim) { m_AIActor.sprite.SetSprite(clip.frames[0].spriteId); } } } else if (clip.name.ToLower() == "dodge_armorless") { m_AnimationClips.Add(clip); if (clip.frames != null && clip.frames.Length > 0) { if (player.UseArmorlessAnim) { m_AIActor.sprite.SetSprite(clip.frames[0].spriteId); } } } else if (clip.name.ToLower() == "run_down") { m_AnimationClips.Add(clip); } else if (clip.name.ToLower() == "run_down_armorless") { m_AnimationClips.Add(clip); } else if (clip.name.ToLower() == "death_shot") { m_AnimationClips.Add(clip); } else if (clip.name.ToLower() == "death_shot_armorless") { m_AnimationClips.Add(clip); } } } if (m_AnimationClips.Count > 0) { if (!m_AIActor.spriteAnimator.Library) { m_AIActor.spriteAnimator.Library = m_AIActor.gameObject.AddComponent <tk2dSpriteAnimation>(); } m_AIActor.spriteAnimator.Library.clips = m_AnimationClips.ToArray(); } MirrorController mirror = ExpandPrefabs.CurrsedMirror.GetComponent <MirrorController>(); MirrorBase = Instantiate(ExpandPrefabs.DoppelgunnerMirror, gameObject.transform.position - new Vector3(0.25f, 1), Quaternion.identity); ShatterSystem = Instantiate(mirror.ShatterSystem, MirrorBase.transform.position, Quaternion.identity); ShatterSystem.SetActive(false); ShatterSystem.transform.parent = MirrorBase.transform; MirrorShatterFX = Instantiate(ExpandPrefabs.DoppelgunnerMirrorFX, (MirrorBase.transform.position - Vector3.one), Quaternion.identity); MirrorShatterFX.SetActive(false); }
public static void BuildPrefab() { // source = EnemyDatabase.GetOrLoadByGuid("c50a862d19fc4d30baeba54795e8cb93"); bool flag = fuckyouprefab != null || BossBuilder.Dictionary.ContainsKey(guid); bool flag2 = flag; if (!flag2) { fuckyouprefab = BossBuilder.BuildPrefab("TheStranger", guid, spritePaths[0], new IntVector2(0, 0), new IntVector2(8, 9), false, true); var companion = fuckyouprefab.AddComponent <EnemyBehavior>(); companion.aiActor.knockbackDoer.weight = 200; companion.aiActor.MovementSpeed = 1.33f; companion.aiActor.healthHaver.PreventAllDamage = false; companion.aiActor.CollisionDamage = 1f; companion.aiActor.HasShadow = false; companion.aiActor.IgnoreForRoomClear = false; companion.aiActor.aiAnimator.HitReactChance = 0.05f; companion.aiActor.specRigidbody.CollideWithOthers = true; companion.aiActor.specRigidbody.CollideWithTileMap = true; companion.aiActor.PreventFallingInPitsEver = true; companion.aiActor.healthHaver.ForceSetCurrentHealth(600f); companion.aiActor.healthHaver.SetHealthMaximum(600f); companion.aiActor.CollisionKnockbackStrength = 2f; companion.aiActor.procedurallyOutlined = false; companion.aiActor.CanTargetPlayers = true; /// BunnyModule.Strings.Enemies.Set("#THE_STRANGER", "Stranger"); BunnyModule.Strings.Enemies.Set("#????", "???"); BunnyModule.Strings.Enemies.Set("#SUBTITLE", "Glocked And Loaded"); BunnyModule.Strings.Enemies.Set("#QUOTE", ""); companion.aiActor.healthHaver.overrideBossName = "#THE_STRANGER"; companion.aiActor.OverrideDisplayName = "#THE_STRANGER"; companion.aiActor.ActorName = "#THE_STRANGER"; companion.aiActor.name = "#THE_STRANGER"; fuckyouprefab.name = companion.aiActor.OverrideDisplayName; GenericIntroDoer miniBossIntroDoer = fuckyouprefab.AddComponent <GenericIntroDoer>(); fuckyouprefab.AddComponent <TheStrangerIntro>(); miniBossIntroDoer.triggerType = GenericIntroDoer.TriggerType.PlayerEnteredRoom; miniBossIntroDoer.initialDelay = 0.15f; miniBossIntroDoer.cameraMoveSpeed = 14; miniBossIntroDoer.specifyIntroAiAnimator = null; miniBossIntroDoer.BossMusicEvent = "Play_MUS_Boss_Theme_Beholster"; miniBossIntroDoer.PreventBossMusic = false; miniBossIntroDoer.InvisibleBeforeIntroAnim = true; miniBossIntroDoer.preIntroAnim = string.Empty; miniBossIntroDoer.preIntroDirectionalAnim = string.Empty; miniBossIntroDoer.introAnim = "intro"; miniBossIntroDoer.introDirectionalAnim = string.Empty; miniBossIntroDoer.continueAnimDuringOutro = false; miniBossIntroDoer.cameraFocus = null; miniBossIntroDoer.roomPositionCameraFocus = Vector2.zero; miniBossIntroDoer.restrictPlayerMotionToRoom = false; miniBossIntroDoer.fusebombLock = false; miniBossIntroDoer.AdditionalHeightOffset = 0; miniBossIntroDoer.portraitSlideSettings = new PortraitSlideSettings() { bossNameString = "#THE_STRANGER", bossSubtitleString = "#SUBTITLE", bossQuoteString = "#QUOTE", bossSpritePxOffset = IntVector2.Zero, topLeftTextPxOffset = IntVector2.Zero, bottomRightTextPxOffset = IntVector2.Zero, bgColor = Color.yellow }; if (BossCardTexture) { miniBossIntroDoer.portraitSlideSettings.bossArtSprite = BossCardTexture; miniBossIntroDoer.SkipBossCard = false; companion.aiActor.healthHaver.bossHealthBar = HealthHaver.BossBarType.MainBar; } else { miniBossIntroDoer.SkipBossCard = true; companion.aiActor.healthHaver.bossHealthBar = HealthHaver.BossBarType.SubbossBar; } miniBossIntroDoer.SkipFinalizeAnimation = true; miniBossIntroDoer.RegenerateCache(); //BehaviorSpeculator aIActor = EnemyDatabase.GetOrLoadByGuid("465da2bb086a4a88a803f79fe3a27677").behaviorSpeculator; //Tools.DebugInformation(aIActor); ///// companion.aiActor.healthHaver.SetHealthMaximum(600f, null, false); companion.aiActor.specRigidbody.PixelColliders.Clear(); companion.aiActor.specRigidbody.PixelColliders.Add(new PixelCollider { ColliderGenerationMode = PixelCollider.PixelColliderGeneration.Manual, CollisionLayer = CollisionLayer.EnemyCollider, IsTrigger = false, BagleUseFirstFrameOnly = false, SpecifyBagelFrame = string.Empty, BagelColliderNumber = 0, ManualOffsetX = 0, ManualOffsetY = 10, ManualWidth = 16, ManualHeight = 17, ManualDiameter = 0, ManualLeftX = 0, ManualLeftY = 0, ManualRightX = 0, ManualRightY = 0 }); companion.aiActor.specRigidbody.PixelColliders.Add(new PixelCollider { ColliderGenerationMode = PixelCollider.PixelColliderGeneration.Manual, CollisionLayer = CollisionLayer.EnemyHitBox, IsTrigger = false, BagleUseFirstFrameOnly = false, SpecifyBagelFrame = string.Empty, BagelColliderNumber = 0, ManualOffsetX = 0, ManualOffsetY = 10, ManualWidth = 16, ManualHeight = 17, ManualDiameter = 0, ManualLeftX = 0, ManualLeftY = 0, ManualRightX = 0, ManualRightY = 0, }); companion.aiActor.CorpseObject = EnemyDatabase.GetOrLoadByGuid("01972dee89fc4404a5c408d50007dad5").CorpseObject; companion.aiActor.PreventBlackPhantom = false; AIAnimator aiAnimator = companion.aiAnimator; aiAnimator.IdleAnimation = new DirectionalAnimation { Type = DirectionalAnimation.DirectionType.Single, Prefix = "idle", AnimNames = new string[1], Flipped = new DirectionalAnimation.FlipType[1] }; DirectionalAnimation anim = new DirectionalAnimation { Type = DirectionalAnimation.DirectionType.TwoWayHorizontal, AnimNames = new string[] { "flare", }, Flipped = new DirectionalAnimation.FlipType[2] }; aiAnimator.OtherAnimations = new List <AIAnimator.NamedDirectionalAnimation> { new AIAnimator.NamedDirectionalAnimation { name = "flare", anim = anim } }; DirectionalAnimation anim2 = new DirectionalAnimation { Type = DirectionalAnimation.DirectionType.TwoWayHorizontal, AnimNames = new string[] { "brrap", }, Flipped = new DirectionalAnimation.FlipType[2] }; aiAnimator.OtherAnimations = new List <AIAnimator.NamedDirectionalAnimation> { new AIAnimator.NamedDirectionalAnimation { name = "brrap", anim = anim2 } }; DirectionalAnimation anim3 = new DirectionalAnimation { Type = DirectionalAnimation.DirectionType.Single, AnimNames = new string[] { "tell", }, Flipped = new DirectionalAnimation.FlipType[1] }; aiAnimator.OtherAnimations = new List <AIAnimator.NamedDirectionalAnimation> { new AIAnimator.NamedDirectionalAnimation { name = "tell", anim = anim3 } }; DirectionalAnimation Hurray = new DirectionalAnimation { Type = DirectionalAnimation.DirectionType.Single, Prefix = "fire1", AnimNames = new string[1], Flipped = new DirectionalAnimation.FlipType[1] }; aiAnimator.OtherAnimations = new List <AIAnimator.NamedDirectionalAnimation> { new AIAnimator.NamedDirectionalAnimation { name = "fire1", anim = Hurray } }; DirectionalAnimation almostdone = new DirectionalAnimation { Type = DirectionalAnimation.DirectionType.Single, Prefix = "intro", AnimNames = new string[1], Flipped = new DirectionalAnimation.FlipType[1] }; aiAnimator.OtherAnimations = new List <AIAnimator.NamedDirectionalAnimation> { new AIAnimator.NamedDirectionalAnimation { name = "intro", anim = almostdone } }; DirectionalAnimation done = new DirectionalAnimation { Type = DirectionalAnimation.DirectionType.Single, Prefix = "death", AnimNames = new string[1], Flipped = new DirectionalAnimation.FlipType[1] }; aiAnimator.OtherAnimations = new List <AIAnimator.NamedDirectionalAnimation> { new AIAnimator.NamedDirectionalAnimation { name = "death", anim = done } }; bool flag3 = StagngerCollection == null; if (flag3) { StagngerCollection = SpriteBuilder.ConstructCollection(fuckyouprefab, "The_Stranger_Collection"); UnityEngine.Object.DontDestroyOnLoad(StagngerCollection); for (int i = 0; i < spritePaths.Length; i++) { SpriteBuilder.AddSpriteToCollection(spritePaths[i], StagngerCollection); } SpriteBuilder.AddAnimation(companion.spriteAnimator, StagngerCollection, new List <int> { 0, 1, 2, 3 }, "idle", tk2dSpriteAnimationClip.WrapMode.Loop).fps = 3f; SpriteBuilder.AddAnimation(companion.spriteAnimator, StagngerCollection, new List <int> { 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, }, "flare", tk2dSpriteAnimationClip.WrapMode.Once).fps = 12f; SpriteBuilder.AddAnimation(companion.spriteAnimator, StagngerCollection, new List <int> { 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, }, "brrap", tk2dSpriteAnimationClip.WrapMode.Once).fps = 8f; SpriteBuilder.AddAnimation(companion.spriteAnimator, StagngerCollection, new List <int> { 31, 32, 33, 34, 35, 36, }, "tell", tk2dSpriteAnimationClip.WrapMode.Once).fps = 8f; SpriteBuilder.AddAnimation(companion.spriteAnimator, StagngerCollection, new List <int> { 37, 38, 39, 40, 41, 42, 43, 44, }, "fire1", tk2dSpriteAnimationClip.WrapMode.Once).fps = 5f; SpriteBuilder.AddAnimation(companion.spriteAnimator, StagngerCollection, new List <int> { 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, }, "intro", tk2dSpriteAnimationClip.WrapMode.Once).fps = 5f; SpriteBuilder.AddAnimation(companion.spriteAnimator, StagngerCollection, new List <int> { 62, 63, 64, 65, 66, 67, 68, 69, 70, }, "death", tk2dSpriteAnimationClip.WrapMode.Once).fps = 6f; } var bs = fuckyouprefab.GetComponent <BehaviorSpeculator>(); BehaviorSpeculator behaviorSpeculator = EnemyDatabase.GetOrLoadByGuid("01972dee89fc4404a5c408d50007dad5").behaviorSpeculator; bs.OverrideBehaviors = behaviorSpeculator.OverrideBehaviors; bs.OtherBehaviors = behaviorSpeculator.OtherBehaviors; shootpoint = new GameObject("attach"); shootpoint.transform.parent = companion.transform; shootpoint.transform.position = companion.sprite.WorldCenter; GameObject m_CachedGunAttachPoint = companion.transform.Find("attach").gameObject; bs.TargetBehaviors = new List <TargetBehaviorBase> { new TargetPlayerBehavior { Radius = 35f, LineOfSight = false, ObjectPermanence = true, SearchInterval = 0.25f, PauseOnTargetSwitch = false, PauseTime = 0.25f } }; bs.MovementBehaviors = new List <MovementBehaviorBase>() { new SeekTargetBehavior() { StopWhenInRange = true, CustomRange = 6, LineOfSight = true, ReturnToSpawn = true, SpawnTetherDistance = 0, PathInterval = 0.5f, SpecifyRange = false, MinActiveRange = 1, MaxActiveRange = 10 } }; bs.AttackBehaviorGroup.AttackBehaviors = new List <AttackBehaviorGroup.AttackGroupItem> { new AttackBehaviorGroup.AttackGroupItem() { Probability = 0.4f, Behavior = new ShootBehavior { ShootPoint = m_CachedGunAttachPoint, BulletScript = new BunnyMod.CustomBulletScriptSelector(typeof(SwirlScript)), LeadAmount = 0f, AttackCooldown = 1.5f, Cooldown = 5, InitialCooldown = 8f, FireAnimation = "flare", RequiresLineOfSight = false, StopDuring = ShootBehavior.StopType.Attack, Uninterruptible = true, }, NickName = "FireFlare" }, new AttackBehaviorGroup.AttackGroupItem() { Probability = 1f, Behavior = new ShootBehavior { ShootPoint = m_CachedGunAttachPoint, BulletScript = new BunnyMod.CustomBulletScriptSelector(typeof(BrrapScript)), LeadAmount = 0f, AttackCooldown = 1.5f, FireAnimation = "brrap", RequiresLineOfSight = false, StopDuring = ShootBehavior.StopType.Attack, Uninterruptible = true }, NickName = "BRRRRRRRRAP" }, new AttackBehaviorGroup.AttackGroupItem() { Probability = 0.25f, Behavior = new ShootBehavior { ShootPoint = m_CachedGunAttachPoint, BulletScript = new BunnyMod.CustomBulletScriptSelector(typeof(GrenadeChuck)), LeadAmount = 0f, MaxUsages = 3, Cooldown = 7f, InitialCooldown = 3f, AttackCooldown = 1.66f, TellAnimation = "tell", FireAnimation = "fire1", RequiresLineOfSight = false, StopDuring = ShootBehavior.StopType.Attack, Uninterruptible = true }, NickName = "Grenade Toss." }, new AttackBehaviorGroup.AttackGroupItem() { Probability = 0.7f, Behavior = new ShootBehavior { ShootPoint = m_CachedGunAttachPoint, BulletScript = new BunnyMod.CustomBulletScriptSelector(typeof(CannonScript)), LeadAmount = 0f, AttackCooldown = 1.2f, TellAnimation = "tell", FireAnimation = "fire1", RequiresLineOfSight = false, Cooldown = 6f, StopDuring = ShootBehavior.StopType.Attack, Uninterruptible = true }, NickName = "CANNON" }, new AttackBehaviorGroup.AttackGroupItem() { Probability = 1f, Behavior = new ShootBehavior { ShootPoint = m_CachedGunAttachPoint, BulletScript = new BunnyMod.CustomBulletScriptSelector(typeof(SniperScript)), LeadAmount = 0f, AttackCooldown = 2f, Cooldown = 5f, TellAnimation = "tell", FireAnimation = "fire1", RequiresLineOfSight = false, StopDuring = ShootBehavior.StopType.Attack, Uninterruptible = true }, NickName = "Sniper" }, }; bs.InstantFirstTick = behaviorSpeculator.InstantFirstTick; bs.TickInterval = behaviorSpeculator.TickInterval; bs.PostAwakenDelay = behaviorSpeculator.PostAwakenDelay; bs.RemoveDelayOnReinforce = behaviorSpeculator.RemoveDelayOnReinforce; bs.OverrideStartingFacingDirection = behaviorSpeculator.OverrideStartingFacingDirection; bs.StartingFacingDirection = behaviorSpeculator.StartingFacingDirection; bs.SkipTimingDifferentiator = behaviorSpeculator.SkipTimingDifferentiator; Game.Enemies.Add("bny:the_stranger", companion.aiActor); } }
public static void BuildPrefab() { // source = EnemyDatabase.GetOrLoadByGuid("c50a862d19fc4d30baeba54795e8cb93"); bool flag = prefab != null || BossBuilder.Dictionary.ContainsKey(guid); bool flag2 = flag; if (!flag2) { prefab = BossBuilder.BuildPrefab("Kill Shrine", guid, spritePaths[0], new IntVector2(0, 0), new IntVector2(8, 9), false, true); var companion = prefab.AddComponent <EnemyBehavior23>(); companion.aiActor.knockbackDoer.weight = 200; companion.aiActor.MovementSpeed = 6f; companion.aiActor.healthHaver.PreventAllDamage = false; companion.aiActor.CollisionDamage = 1f; companion.aiActor.HasShadow = true; companion.aiActor.IgnoreForRoomClear = false; companion.aiActor.aiAnimator.HitReactChance = 0.05f; companion.aiActor.specRigidbody.CollideWithOthers = true; companion.aiActor.specRigidbody.CollideWithTileMap = true; companion.aiActor.PreventFallingInPitsEver = true; companion.aiActor.healthHaver.ForceSetCurrentHealth(500f); companion.aiActor.healthHaver.SetHealthMaximum(500f); companion.aiActor.CollisionKnockbackStrength = 5f; companion.aiActor.procedurallyOutlined = true; companion.aiActor.CanTargetPlayers = true; ItemsMod.Strings.Enemies.Set("#KILLSHRINE", "Sepulchergiest"); ItemsMod.Strings.Enemies.Set("#????", "???"); ItemsMod.Strings.Enemies.Set("#KILLSHRINESUBTITLE", "KILL SHRINE"); ItemsMod.Strings.Enemies.Set("#KILLSHRINEQUOTE", "THE SHRINING"); companion.aiActor.healthHaver.overrideBossName = "#KILLSHRINE"; companion.aiActor.OverrideDisplayName = "#KILLSHRINE"; companion.aiActor.ActorName = "#KILLSHRINE"; companion.aiActor.name = "#KILLSHRINE"; companion.aiActor.SetIsFlying(true, "Flying Enemy", true, true); prefab.name = companion.aiActor.OverrideDisplayName; GenericIntroDoer miniBossIntroDoer = prefab.AddComponent <GenericIntroDoer>(); miniBossIntroDoer.triggerType = GenericIntroDoer.TriggerType.PlayerEnteredRoom; miniBossIntroDoer.initialDelay = 0.15f; miniBossIntroDoer.cameraMoveSpeed = 14; miniBossIntroDoer.specifyIntroAiAnimator = null; miniBossIntroDoer.BossMusicEvent = "Play_MUS_Boss_Theme_Beholster"; companion.aiActor.ShadowObject = EnemyDatabase.GetOrLoadByGuid("c00390483f394a849c36143eb878998f").ShadowObject; companion.aiActor.HasShadow = true; miniBossIntroDoer.PreventBossMusic = false; miniBossIntroDoer.InvisibleBeforeIntroAnim = false; miniBossIntroDoer.preIntroAnim = string.Empty; miniBossIntroDoer.preIntroDirectionalAnim = string.Empty; miniBossIntroDoer.introAnim = "intro"; miniBossIntroDoer.introDirectionalAnim = string.Empty; miniBossIntroDoer.continueAnimDuringOutro = false; miniBossIntroDoer.cameraFocus = null; miniBossIntroDoer.roomPositionCameraFocus = Vector2.zero; miniBossIntroDoer.restrictPlayerMotionToRoom = false; miniBossIntroDoer.fusebombLock = false; miniBossIntroDoer.AdditionalHeightOffset = 0; miniBossIntroDoer.portraitSlideSettings = new PortraitSlideSettings() { bossNameString = "#KILLSHRINE", bossSubtitleString = "#KILLSHRINESUBTITLE", bossQuoteString = "#KILLSHRINEQUOTE", bossSpritePxOffset = IntVector2.Zero, topLeftTextPxOffset = IntVector2.Zero, bottomRightTextPxOffset = IntVector2.Zero, bgColor = Color.cyan }; miniBossIntroDoer.SkipBossCard = false; miniBossIntroDoer.portraitSlideSettings.bossArtSprite = BossCardTexture; companion.aiActor.healthHaver.bossHealthBar = HealthHaver.BossBarType.MainBar; miniBossIntroDoer.SkipFinalizeAnimation = true; miniBossIntroDoer.RegenerateCache(); //BehaviorSpeculator aIActor = EnemyDatabase.GetOrLoadByGuid("465da2bb086a4a88a803f79fe3a27677").behaviorSpeculator; //Tools.DebugInformation(aIActor); ///// companion.aiActor.healthHaver.SetHealthMaximum(500f, null, false); companion.aiActor.specRigidbody.PixelColliders.Clear(); companion.aiActor.specRigidbody.PixelColliders.Add(new PixelCollider { ColliderGenerationMode = PixelCollider.PixelColliderGeneration.Manual, CollisionLayer = CollisionLayer.EnemyCollider, IsTrigger = false, BagleUseFirstFrameOnly = false, SpecifyBagelFrame = string.Empty, BagelColliderNumber = 0, ManualOffsetX = 15, ManualOffsetY = 10, ManualWidth = 60, ManualHeight = 80, ManualDiameter = 0, ManualLeftX = 0, ManualLeftY = 0, ManualRightX = 0, ManualRightY = 0 }); companion.aiActor.specRigidbody.PixelColliders.Add(new PixelCollider { ColliderGenerationMode = PixelCollider.PixelColliderGeneration.Manual, CollisionLayer = CollisionLayer.EnemyHitBox, IsTrigger = false, BagleUseFirstFrameOnly = false, SpecifyBagelFrame = string.Empty, BagelColliderNumber = 0, ManualOffsetX = 15, ManualOffsetY = 10, ManualWidth = 60, ManualHeight = 80, ManualDiameter = 0, ManualLeftX = 0, ManualLeftY = 0, ManualRightX = 0, ManualRightY = 0, }); companion.aiActor.CorpseObject = EnemyDatabase.GetOrLoadByGuid("c0ff3744760c4a2eb0bb52ac162056e6").CorpseObject; companion.aiActor.PreventBlackPhantom = false; AIAnimator aiAnimator = companion.aiAnimator; aiAnimator.IdleAnimation = new DirectionalAnimation { Type = DirectionalAnimation.DirectionType.Single, Prefix = "idle", AnimNames = new string[1], Flipped = new DirectionalAnimation.FlipType[1] }; DirectionalAnimation almostdone = new DirectionalAnimation { Type = DirectionalAnimation.DirectionType.Single, Prefix = "intro", AnimNames = new string[1], Flipped = new DirectionalAnimation.FlipType[1] }; aiAnimator.OtherAnimations = new List <AIAnimator.NamedDirectionalAnimation> { new AIAnimator.NamedDirectionalAnimation { name = "intro", anim = almostdone } }; bool flag3 = BishopCollection == null; if (flag3) { BishopCollection = SpriteBuilder.ConstructCollection(prefab, "FlameChamber_Collection"); UnityEngine.Object.DontDestroyOnLoad(BishopCollection); for (int i = 0; i < spritePaths.Length; i++) { SpriteBuilder.AddSpriteToCollection(spritePaths[i], BishopCollection); } SpriteBuilder.AddAnimation(companion.spriteAnimator, BishopCollection, new List <int> { 0, 1 }, "idle", tk2dSpriteAnimationClip.WrapMode.Loop).fps = 7f; SpriteBuilder.AddAnimation(companion.spriteAnimator, BishopCollection, new List <int> { 2, 3, 4, 5, 6, 7, 8 }, "intro", tk2dSpriteAnimationClip.WrapMode.Once).fps = 7f; } var bs = prefab.GetComponent <BehaviorSpeculator>(); BehaviorSpeculator behaviorSpeculator = EnemyDatabase.GetOrLoadByGuid("01972dee89fc4404a5c408d50007dad5").behaviorSpeculator; bs.OverrideBehaviors = behaviorSpeculator.OverrideBehaviors; bs.OtherBehaviors = behaviorSpeculator.OtherBehaviors; shootpoint = new GameObject("attach"); shootpoint.transform.parent = companion.transform; shootpoint.transform.position = companion.sprite.WorldCenter; GameObject m_CachedGunAttachPoint = companion.transform.Find("attach").gameObject; bs.TargetBehaviors = new List <TargetBehaviorBase> { new TargetPlayerBehavior { Radius = 35f, LineOfSight = false, ObjectPermanence = true, SearchInterval = 0.25f, PauseOnTargetSwitch = false, PauseTime = 0.25f } }; float[] angles = { 45, 135, 225, 135 }; bs.MovementBehaviors = new List <MovementBehaviorBase> { }; bs.AttackBehaviorGroup.AttackBehaviors = new List <AttackBehaviorGroup.AttackGroupItem> { }; bs.InstantFirstTick = behaviorSpeculator.InstantFirstTick; bs.TickInterval = behaviorSpeculator.TickInterval; bs.PostAwakenDelay = behaviorSpeculator.PostAwakenDelay; bs.RemoveDelayOnReinforce = behaviorSpeculator.RemoveDelayOnReinforce; bs.OverrideStartingFacingDirection = behaviorSpeculator.OverrideStartingFacingDirection; bs.StartingFacingDirection = behaviorSpeculator.StartingFacingDirection; bs.SkipTimingDifferentiator = behaviorSpeculator.SkipTimingDifferentiator; Game.Enemies.Add("cak:killshrine", companion.aiActor); } }