Ejemplo n.º 1
0
        public override void OnEnter()
        {
            base.OnEnter();
            if (base.isAuthority)
            {
                //this.targetTracker = base.GetComponent<TargetTracker>();
                this.ownerPrefab = base.gameObject;
                CharacterBody   targetBody      = this.targetPrefab.GetComponent <CharacterBody>();
                CharacterBody   ownerBody       = this.ownerPrefab.GetComponent <CharacterBody>();
                GameObject      bodyPrefab      = BodyCatalog.FindBodyPrefab(targetBody);
                CharacterMaster characterMaster = MasterCatalog.allAiMasters.FirstOrDefault((CharacterMaster master) => master.bodyPrefab == bodyPrefab);
                this.masterSummon         = new MasterSummon();
                masterSummon.masterPrefab = characterMaster.gameObject;
                masterSummon.position     = ownerBody.footPosition;
                CharacterDirection component = ownerBody.GetComponent <CharacterDirection>();
                masterSummon.rotation           = (component ? Quaternion.Euler(0f, component.yaw, 0f) : ownerBody.transform.rotation);
                masterSummon.summonerBodyObject = (ownerBody ? ownerBody.gameObject : null);

                CharacterMaster characterMaster2 = masterSummon.Perform();

                GameObject       trackingTargetAsGO = this.targetTracker.GetTrackingTargetAsGO();
                RoR2.Console.Log log = new RoR2.Console.Log();
                if (trackingTargetAsGO != null)
                {
                    log.message = "REEE";
                    RoR2.Console.logs.Add(log);
                }
                else
                {
                    log.message = "YEET";
                    RoR2.Console.logs.Add(log);
                }
            }
        }
Ejemplo n.º 2
0
        private void CharacterMaster_TransformBody1(On.RoR2.CharacterMaster.orig_TransformBody orig, CharacterMaster self, string bodyName)
        {
            if (bodyName == "HereticBody" && self.GetComponent <BaseAI>())
            {
                var newSummon = new MasterSummon()
                {
                    ignoreTeamMemberLimit = true,
                    inventoryToCopy       = self.inventory,
                    masterPrefab          = Resources.Load <GameObject>("prefabs/charactermasters/hereticmonstermaster"),
                    position          = self.GetBody()?.footPosition ?? Vector3.zero,
                    useAmbientLevel   = true,
                    teamIndexOverride = self.teamIndex
                };
                var newMaster = newSummon.Perform();

                return;
            }
            orig(self, bodyName);
            var body = self.GetBody();

            if (body)
            {
                TeleportHelper.TeleportBody(body, Vector3.zero);
                body.healthComponent?.Suicide();
            }
        }
Ejemplo n.º 3
0
        private void SummonFriend(On.RoR2.CharacterBody.orig_FixedUpdate orig, CharacterBody self)
        {
            if (NetworkServer.active && self.master)
            {
                var LunarChimeraComponent = self.master.GetComponent <LunarChimeraComponent>();
                if (!LunarChimeraComponent)
                {
                    LunarChimeraComponent = self.masterObject.AddComponent <LunarChimeraComponent>();
                }

                var SummonerBodyMaster = self.master;
                if (SummonerBodyMaster) //Check if we're a minion or not. If we are, we don't summon a friend.
                {
                    if (SummonerBodyMaster.teamIndex == TeamIndex.Player && !self.isPlayerControlled)
                    {
                        orig(self);
                        return;
                    }
                }

                int InventoryCount = GetCount(self);
                if (InventoryCount > 0)
                {
                    if (LunarChimeraComponent.LastChimeraSpawned == null || !LunarChimeraComponent.LastChimeraSpawned.master || !LunarChimeraComponent.LastChimeraSpawned.master.hasBody)
                    {
                        LunarChimeraComponent.LastChimeraSpawned = null;
                        LunarChimeraComponent.ResummonCooldown  -= Time.fixedDeltaTime;
                        if (LunarChimeraComponent.ResummonCooldown <= 0f)
                        {
                            var minDistance = 10f;
                            var maxDistance = 20f;


                            MasterSummon masterSummon = new MasterSummon
                            {
                                masterPrefab = characterPrefab,
                                position     = self.transform.position + new Vector3(UnityEngine.Random.Range(minDistance, maxDistance),
                                                                                     5,
                                                                                     UnityEngine.Random.Range(minDistance, maxDistance)),
                                rotation              = self.transform.rotation,
                                summonerBodyObject    = self.gameObject,
                                ignoreTeamMemberLimit = true,
                                teamIndexOverride     = new TeamIndex?(TeamIndex.Player)
                            };
                            masterSummon.Perform();
                            RecentlySpawned = true;

                            if (RecentlySpawned)
                            {
                                LunarChimeraComponent.ResummonCooldown = lunarChimeraResummonCooldownDuration;
                                RecentlySpawned = false;
                            }
                        }
                    }
                }
            }
            orig(self);
        }
Ejemplo n.º 4
0
        public CharacterMaster SummonHeretic(GameObject summonerBodyObject, Vector3 spawnPosition)
        {
            if (!NetworkServer.active)
            {
                Debug.LogWarning("[Server] function 'SummonHeretic(UnityEngine.GameObject)' called on client");
                return(null);
            }
            MasterSummon masterSummon = new MasterSummon
            {
                masterPrefab          = MasterCatalog.FindMasterPrefab("HereticMonsterMaster"),
                position              = spawnPosition,
                rotation              = Quaternion.identity,
                summonerBodyObject    = summonerBodyObject,
                ignoreTeamMemberLimit = true,
                useAmbientLevel       = new bool?(true),
            };
            CharacterMaster characterMaster = masterSummon.Perform();

            if (characterMaster)
            {
                GameObject bodyObject = characterMaster.GetBodyObject();
                if (bodyObject)
                {
                    ModelLocator component = bodyObject.GetComponent <ModelLocator>();
                    if (component && component.modelTransform)
                    {
                        TemporaryOverlay temporaryOverlay = component.modelTransform.gameObject.AddComponent <TemporaryOverlay>();
                        temporaryOverlay.duration              = 0.5f;
                        temporaryOverlay.animateShaderAlpha    = true;
                        temporaryOverlay.alphaCurve            = AnimationCurve.EaseInOut(0f, 1f, 1f, 0f);
                        temporaryOverlay.destroyComponentOnEnd = true;
                        temporaryOverlay.originalMaterial      = Resources.Load <Material>("Materials/matSummonDrone");
                        temporaryOverlay.AddToCharacerModel(component.modelTransform.GetComponent <CharacterModel>());
                    }
                    var inventory = characterMaster.inventory;
                    if (inventory)
                    {
                        inventory.CopyItemsFrom(summonerBodyObject.GetComponent <CharacterBody>().inventory);
                    }
                }
            }
            if (characterMaster && characterMaster.bodyInstanceObject)
            {
                characterMaster.GetBody().AddTimedBuff(RoR2Content.Buffs.Immune, 3f);
                GameObject gameObject = Resources.Load <GameObject>("Prefabs/Effects/HippoRezEffect");
                if (gameObject)
                {
                    EffectManager.SpawnEffect(gameObject, new EffectData
                    {
                        origin   = spawnPosition,
                        rotation = characterMaster.bodyInstanceObject.transform.rotation
                    }, true);
                }
            }
            return(characterMaster);
        }
            public void Start()
            {
                if (!bossMaster)
                {
                    var masterSummon = new MasterSummon()
                    {
                        ignoreTeamMemberLimit = true,
                        masterPrefab          = Enemies.LordofTheJammedMonster.masterPrefab,
                        position          = transform.position,
                        teamIndexOverride = TeamIndex.Monster
                    };

                    bossMaster = masterSummon.Perform();
                    bossBody   = bossMaster.GetBody();
                }
            }
Ejemplo n.º 6
0
        public CharacterMaster SummonMage(GameObject summonerBody, Vector3 spawnPosition)
        {
            if (!NetworkServer.active)
            {
                return(null);
            }
            Inventory    summonerInventory = summonerBody.GetComponent <CharacterBody>()?.inventory ? summonerBody.GetComponent <CharacterBody>().inventory : null;
            MasterSummon masterSummon      = new MasterSummon
            {
                masterPrefab          = MageMasterPrefab,
                position              = spawnPosition,
                rotation              = Quaternion.identity,
                summonerBodyObject    = summonerBody ?? null,
                ignoreTeamMemberLimit = true,
                useAmbientLevel       = new bool?(true),
                inventoryToCopy       = cfgCopyInventory.Value ? summonerInventory : null,
            };
            CharacterMaster characterMaster = masterSummon.Perform();

            if (characterMaster)
            {
                DontDestroyOnLoad(characterMaster);
                if (characterMaster.inventory)
                {
                    characterMaster.inventory.GiveItem(RoR2Content.Items.ExtraLife, cfgLives.Value);
                }

                GameObject bodyObject = characterMaster.GetBodyObject();
                if (bodyObject)
                {
                    ModelLocator component = bodyObject.GetComponent <ModelLocator>();
                    if (component && component.modelTransform)
                    {
                        TemporaryOverlay temporaryOverlay = component.modelTransform.gameObject.AddComponent <TemporaryOverlay>();
                        temporaryOverlay.duration              = 0.5f;
                        temporaryOverlay.animateShaderAlpha    = true;
                        temporaryOverlay.alphaCurve            = AnimationCurve.EaseInOut(0f, 1f, 1f, 0f);
                        temporaryOverlay.destroyComponentOnEnd = true;
                        temporaryOverlay.originalMaterial      = Resources.Load <Material>("Materials/matSummonDrone");
                        temporaryOverlay.AddToCharacerModel(component.modelTransform.GetComponent <CharacterModel>());
                    }
                }
            }
            return(characterMaster);
        }
Ejemplo n.º 7
0
            public CharacterMaster SummonDrone(GameObject bodyPrefab, Vector3 spawnPosition, EquipmentIndex equipmentIndex = EquipmentIndex.None)
            {
                if (!NetworkServer.active)
                {
                    Debug.LogWarning("[Server] function 'RoR2.CharacterMaster RoR2.MithrixSpawnsDronesActivator::SummonMaster(UnityEngine.GameObject)' called on client");
                    return(null);
                }
                MasterSummon masterSummon = new MasterSummon
                {
                    masterPrefab          = masterPrefab,
                    position              = spawnPosition,
                    rotation              = Quaternion.identity,
                    summonerBodyObject    = bodyPrefab,
                    ignoreTeamMemberLimit = true,
                    useAmbientLevel       = new bool?(true),
                };
                CharacterMaster characterMaster = masterSummon.Perform();

                if (characterMaster)
                {
                    GameObject bodyObject = characterMaster.GetBodyObject();
                    if (bodyObject)
                    {
                        ModelLocator component = bodyObject.GetComponent <ModelLocator>();
                        if (component && component.modelTransform)
                        {
                            TemporaryOverlay temporaryOverlay = component.modelTransform.gameObject.AddComponent <TemporaryOverlay>();
                            temporaryOverlay.duration              = 0.5f;
                            temporaryOverlay.animateShaderAlpha    = true;
                            temporaryOverlay.alphaCurve            = AnimationCurve.EaseInOut(0f, 1f, 1f, 0f);
                            temporaryOverlay.destroyComponentOnEnd = true;
                            temporaryOverlay.originalMaterial      = Resources.Load <Material>("Materials/matSummonDrone");
                            temporaryOverlay.AddToCharacerModel(component.modelTransform.GetComponent <CharacterModel>());
                        }
                        var inventory = characterMaster.inventory;
                        if (inventory)
                        {
                            inventory.SetEquipmentIndex(equipmentIndex);
                        }
                    }
                }
                return(characterMaster);
            }
Ejemplo n.º 8
0
        public override GameObject DoSpawn(Vector3 position, Quaternion rotation, DirectorSpawnRequest directorSpawnRequest)
        {
            MasterSummon summon = new MasterSummon
            {
                masterPrefab          = this.prefab,
                position              = position,
                rotation              = rotation,
                summonerBodyObject    = directorSpawnRequest.summonerBodyObject,
                teamIndexOverride     = directorSpawnRequest.teamIndexOverride,
                ignoreTeamMemberLimit = directorSpawnRequest.ignoreTeamMemberLimit
            };

            if (playerbotName != null)
            {
                summon.preSpawnSetupCallback += OnPreSpawn;
            }
            CharacterMaster characterMaster = summon.Perform();

            if (characterMaster == null)
            {
                return(null);
            }
            return(characterMaster.gameObject);
        }