public override void OnEnter() { base.OnEnter(); float baseMaxDuration = 2f; float autoFireDuration = baseMaxDuration / attackSpeedStat; Ray aimRay = base.GetAimRay(); base.StartAimMode(aimRay, 2f, false); base.PlayAnimation("Gesture, Additive", "FireNovaBomb", "FireShotgun", autoFireDuration * 3f); base.PlayAnimation("Gesture, Override", "FireNovaBomb", "FireShotgun", autoFireDuration * 3f); bool isAuthority = base.isAuthority; if (NetworkServer.active) { CharacterMaster characterMaster = new MasterSummon { masterPrefab = MasterCatalog.FindMasterPrefab("ImpMaster"), position = base.characterBody.transform.position, rotation = base.transform.rotation, summonerBodyObject = base.characterBody.gameObject, ignoreTeamMemberLimit = true, teamIndexOverride = TeamIndex.Player, }.Perform(); characterMaster.GetBody().AddBuff(BuffIndex.AffixRed); characterMaster.GetBody().inventory.GiveRandomItems(base.characterBody.inventory.GetTotalItemCountOfTier(ItemTier.Tier1) + base.characterBody.inventory.GetTotalItemCountOfTier(ItemTier.Tier2) + base.characterBody.inventory.GetTotalItemCountOfTier(ItemTier.Tier3) + base.characterBody.inventory.GetTotalItemCountOfTier(ItemTier.Lunar) + base.characterBody.inventory.GetTotalItemCountOfTier(ItemTier.Boss)); characterMaster.inventory.GiveItem(ItemIndex.HealthDecay, 30); } base.OnExit(); }
public override void OnExit() { if (this.goodPlacement && base.characterBody.isPlayerControlled) { Util.PlaySound(CreatePounder.fireSoundString, base.gameObject); if (this.areaIndicatorInstance && NetworkServer.active) { CharacterMaster characterMaster = new MasterSummon { masterPrefab = MasterCatalog.FindMasterPrefab("MercMonsterMaster"), position = base.characterBody.transform.position, rotation = characterBody.transform.rotation, summonerBodyObject = base.gameObject, ignoreTeamMemberLimit = true, teamIndexOverride = characterBody.teamComponent.teamIndex }.Perform(); base.skillLocator.utility.DeductStock(1); base.characterMotor.Motor.SetPosition(areaIndicatorInstance.transform.position); EffectData effectData = new EffectData(); effectData.rotation = Util.QuaternionSafeLookRotation(areaIndicatorInstance.transform.position - base.characterMotor.transform.position); effectData.origin = base.characterMotor.transform.position; EffectManager.SpawnEffect(EntityStates.Huntress.BlinkState.blinkPrefab, effectData, false); EffectData effectData2 = new EffectData(); effectData.rotation = Util.QuaternionSafeLookRotation(areaIndicatorInstance.transform.position - base.characterMotor.transform.position); effectData.origin = areaIndicatorInstance.transform.position; EffectManager.SpawnEffect(EntityStates.Huntress.BlinkState.blinkPrefab, effectData, false); base.characterBody.AddTimedBuff(BuffIndex.Cloak, 5f); base.characterBody.AddTimedBuff(BuffIndex.ElephantArmorBoost, 3f); base.characterBody.AddTimedBuff(BuffIndex.Immune, 2f); characterMaster.loadout.bodyLoadoutManager.SetSkillVariant(characterBody.bodyIndex, 0, (uint)Random.Range(0, characterBody.skillLocator.primary.skillFamily.variants.Length)); characterMaster.loadout.bodyLoadoutManager.SetSkillVariant(characterBody.bodyIndex, 1, (uint)Random.Range(0, characterBody.skillLocator.secondary.skillFamily.variants.Length)); characterMaster.loadout.bodyLoadoutManager.SetSkillVariant(characterBody.bodyIndex, 2, (uint)Random.Range(0, characterBody.skillLocator.utility.skillFamily.variants.Length)); characterMaster.loadout.bodyLoadoutManager.SetSkillVariant(characterBody.bodyIndex, 3, (uint)Random.Range(0, characterBody.skillLocator.special.skillFamily.variants.Length)); characterMaster.loadout.bodyLoadoutManager.SetSkinIndex(characterBody.bodyIndex, (uint)Random.Range(0, SkinCatalog.GetBodySkinCount(characterBody.bodyIndex))); characterMaster.GetBody().baseDamage = 0f; characterMaster.inventory.GiveItem(ItemIndex.HealthDecay, 10); characterMaster.GetBody().inventory.SetEquipmentIndex(EquipmentIndex.AffixHaunted); } } EntityState.Destroy(this.areaIndicatorInstance.gameObject); base.characterBody.crosshairPrefab = this.cachedCrosshairPrefab; base.OnExit(); this.outer.SetNextStateToMain(); }
private void SummonDrone(CharacterBody ownerBody, GameObject droneMasterPrefab, int counter = 1) { if (!ownerBody || !droneMasterPrefab) { Log.Warning("Machines.SummonDrone: ownerBody or droneMasterPrefab is null. Cancel drone summon."); return; } CharacterMaster characterMaster = new MasterSummon { masterPrefab = droneMasterPrefab, position = ownerBody.transform.position - (ownerBody.transform.forward.normalized * counter) + (.25f * counter * Vector3.up), rotation = ownerBody.transform.rotation, summonerBodyObject = ownerBody.gameObject, ignoreTeamMemberLimit = true, useAmbientLevel = true }.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 = summonDroneMaterial; temporaryOverlay.AddToCharacerModel(component.modelTransform.GetComponent <CharacterModel>()); } } RepositionGroundedDrones(characterMaster.GetBody(), ownerBody.transform.position); } }
public static bool Init() { On.RoR2.CharacterMaster.GetDeployableSameSlotLimit += (orig, self, slot) => { if (slot == (DeployableSlot)7) { return(self.inventory.GetItemCount(ItemIndex.EquipmentMagazine)); } return(orig(self, slot)); }; On.RoR2.EquipmentSlot.PerformEquipmentAction += (orig, self, equipmentIndex) => { CharacterBody characterBody = self.characterBody; string characterMaster = ""; bool temp = orig(self, equipmentIndex); if (self.characterBody.inputBank.activateEquipment.justPressed) { switch (equipmentIndex) { case EquipmentIndex.AffixWhite: { characterMaster = "BisonMaster"; temp = true; } break; case EquipmentIndex.AffixGold: { characterMaster = "TitanGoldMaster"; temp = true; } break; case EquipmentIndex.AffixHaunted: { characterMaster = "BellMaster"; temp = true; } break; case EquipmentIndex.AffixPoison: { characterMaster = "ImpMaster"; temp = true; } break; case EquipmentIndex.AffixRed: { characterMaster = "LemurianMaster"; } break; case EquipmentIndex.AffixBlue: { characterMaster = "WispMaster"; } break; case EquipmentIndex.AffixYellow: { characterMaster = "ElectricWormMaster"; temp = true; } break; } if (characterMaster != "") { CharacterMaster newcharacterMaster = new MasterSummon { masterPrefab = MasterCatalog.FindMasterPrefab(characterMaster), position = characterBody.footPosition + characterBody.transform.up, rotation = characterBody.transform.rotation, summonerBodyObject = null, ignoreTeamMemberLimit = true, teamIndexOverride = characterBody.teamComponent.teamIndex }.Perform(); newcharacterMaster.inventory.CopyItemsFrom(characterBody.inventory); newcharacterMaster.inventory.ResetItem(ItemIndex.AutoCastEquipment); newcharacterMaster.inventory.CopyEquipmentFrom(characterBody.inventory); newcharacterMaster.GetBody().modelLocator.modelBaseTransform.localScale *= 0.25f; Deployable deployable = newcharacterMaster.gameObject.GetComponent <Deployable>(); if (!deployable) { deployable = newcharacterMaster.gameObject.AddComponent <Deployable>(); } int deployableCount = characterBody.master.GetDeployableCount((DeployableSlot)7); self.characterBody.master.AddDeployable(deployable, (DeployableSlot)7); deployable.onUndeploy = new UnityEngine.Events.UnityEvent(); deployable.onUndeploy.AddListener(() => newcharacterMaster.TrueKill()); } } return(temp); }; return(true); }