public override void OnLoad() { base.OnLoad(); itemDef.name = "MysticsItems_RiftLensDebuff"; SetItemTierWhenAvailable(ItemTier.NoTier); itemDef.canRemove = false; itemDef.pickupIconSprite = Main.AssetBundle.LoadAsset <Sprite>("Assets/Items/Rift Lens Debuff/Icon.png"); GameObject debuffedVFX = Main.AssetBundle.LoadAsset <GameObject>("Assets/Items/Rift Lens Debuff/RiftLensAfflictionVFX.prefab"); GameObject vfxOrigin = debuffedVFX.transform.Find("Origin").gameObject; CustomTempVFXManagement.MysticsRisky2UtilsTempVFX tempVFX = debuffedVFX.AddComponent <CustomTempVFXManagement.MysticsRisky2UtilsTempVFX>(); RotateAroundAxis rotateAroundAxis = vfxOrigin.AddComponent <RotateAroundAxis>(); rotateAroundAxis.relativeTo = Space.Self; rotateAroundAxis.rotateAroundAxis = RotateAroundAxis.RotationAxis.X; rotateAroundAxis.slowRotationSpeed = 30f; rotateAroundAxis.speed = RotateAroundAxis.Speed.Slow; ObjectScaleCurve fadeOut = vfxOrigin.AddComponent <ObjectScaleCurve>(); fadeOut.overallCurve = new AnimationCurve { keys = new Keyframe[] { new Keyframe(0f, 1f, Mathf.Tan(180f * Mathf.Deg2Rad), Mathf.Tan(-20f * Mathf.Deg2Rad)), new Keyframe(1f, 0f, Mathf.Tan(160f * Mathf.Deg2Rad), 0f) } }; fadeOut.useOverallCurveOnly = true; fadeOut.enabled = false; fadeOut.timeMax = 0.6f; tempVFX.exitBehaviours = new MonoBehaviour[] { fadeOut }; CustomTempVFXManagement.allVFX.Add(new CustomTempVFXManagement.VFXInfo { prefab = debuffedVFX, condition = (x) => { Inventory inventory = x.inventory; if (inventory) { return(inventory.GetItemCount(MysticsItemsContent.Items.MysticsItems_RiftLensDebuff) > 0); } return(false); }, radius = CustomTempVFXManagement.DefaultRadiusCall }); }
public override void OnLoad() { base.OnLoad(); itemDef.name = "MysticsItems_DeathCeremony"; SetItemTierWhenAvailable(ItemTier.Tier2); itemDef.tags = new ItemTag[] { ItemTag.Damage }; itemDef.pickupModelPrefab = PrepareModel(Main.AssetBundle.LoadAsset <GameObject>("Assets/Items/Death Ceremony/Model.prefab")); HopooShaderToMaterial.Standard.Apply(itemDef.pickupModelPrefab.GetComponentInChildren <Renderer>().sharedMaterial); HopooShaderToMaterial.Standard.Emission(itemDef.pickupModelPrefab.GetComponentInChildren <Renderer>().sharedMaterial, 1f); itemDef.pickupIconSprite = Main.AssetBundle.LoadAsset <Sprite>("Assets/Items/Death Ceremony/Icon.png"); itemDisplayPrefab = PrepareItemDisplayModel(PrefabAPI.InstantiateClone(itemDef.pickupModelPrefab, itemDef.pickupModelPrefab.name + "Display", false)); onSetupIDRS += () => { AddDisplayRule("CommandoBody", "CalfL", new Vector3(0.07748F, 0.19394F, -0.03508F), new Vector3(351.2407F, 38.31051F, 271.2653F), new Vector3(0.08418F, 0.08418F, 0.08418F)); AddDisplayRule("HuntressBody", "CalfL", new Vector3(0.01081F, 0.33039F, -0.04676F), new Vector3(271.8222F, -0.00021F, 329.7724F), new Vector3(0.07837F, 0.07837F, 0.07837F)); AddDisplayRule("Bandit2Body", "CalfL", new Vector3(0.03402F, 0.33989F, -0.05447F), new Vector3(275.6507F, 198.2068F, 136.1487F), new Vector3(0.07333F, 0.07333F, 0.07333F)); AddDisplayRule("ToolbotBody", "CalfL", new Vector3(-0.76507F, 2.13588F, -0.16809F), new Vector3(0F, 0F, 92.59356F), new Vector3(0.6665F, 0.6665F, 0.6665F)); AddDisplayRule("EngiBody", "CalfL", new Vector3(0.06642F, 0.07521F, -0.07491F), new Vector3(2.18099F, 54.26896F, 272.251F), new Vector3(0.07373F, 0.07373F, 0.07373F)); AddDisplayRule("EngiTurretBody", "LegBar2", new Vector3(-0.00001F, 0.25339F, 0.2332F), new Vector3(87.51187F, 180F, 180F), new Vector3(0.31299F, 0.31299F, 0.31299F)); AddDisplayRule("EngiWalkerTurretBody", "LegBar2", new Vector3(-0.00001F, 0.32614F, 0.3331F), new Vector3(80.43612F, 180F, 180F), new Vector3(0.35353F, 0.35353F, 0.35353F)); AddDisplayRule("MageBody", "CalfL", new Vector3(-0.05753F, 0.055F, -0.00398F), new Vector3(283.2863F, 250.2234F, 182.1714F), new Vector3(0.08759F, 0.08759F, 0.08759F)); AddDisplayRule("MercBody", "CalfL", new Vector3(0F, 0.06378F, -0.0637F), new Vector3(275.3986F, 0F, 0F), new Vector3(0.0835F, 0.0835F, 0.0835F)); AddDisplayRule("TreebotBody", "FootFrontL", new Vector3(-0.00003F, 0.2441F, -0.14866F), new Vector3(270.8983F, 0F, 0F), new Vector3(0.20205F, 0.20205F, 0.20205F)); AddDisplayRule("LoaderBody", "CalfL", new Vector3(0.10101F, 0.10896F, -0.05009F), new Vector3(286.7617F, 305.9382F, 3.19435F), new Vector3(0.10456F, 0.10456F, 0.10456F)); AddDisplayRule("CrocoBody", "CalfL", new Vector3(-0.72054F, 1.36348F, -0.3729F), new Vector3(355.4709F, 323.8942F, 83.82096F), new Vector3(0.78694F, 0.78694F, 0.78694F)); AddDisplayRule("CaptainBody", "CalfL", new Vector3(0F, 0.05716F, -0.09369F), new Vector3(287.3015F, 0F, 0F), new Vector3(0.10502F, 0.10502F, 0.10502F)); AddDisplayRule("BrotherBody", "CalfL", BrotherInfection.green, new Vector3(0.00384F, 0.00536F, -0.03235F), new Vector3(14.82572F, 260.7474F, 350.3363F), new Vector3(0.04861F, 0.10534F, 0.10724F)); AddDisplayRule("ScavBody", "CalfL", new Vector3(0.33272F, -0.17368F, -1.09799F), new Vector3(277.8127F, 180F, 165.8016F), new Vector3(1.08614F, 1.08614F, 1.08614F)); if (SoftDependencies.SoftDependenciesCore.itemDisplaysSniper) { AddDisplayRule("SniperClassicBody", "CalfL", new Vector3(-0.04687F, 0.03461F, 0.08856F), new Vector3(80.03226F, 0F, 32.95736F), new Vector3(0.07694F, 0.07694F, 0.07694F)); } AddDisplayRule("RailgunnerBody", "CalfL", new Vector3(0.07292F, 0.00507F, 0.09758F), new Vector3(65.51882F, 247.9167F, 209.6704F), new Vector3(0.10736F, 0.10736F, 0.10736F)); AddDisplayRule("VoidSurvivorBody", "ThighL", new Vector3(0.08283F, 0.31418F, 0.06681F), new Vector3(11.83692F, 314.669F, 281.4625F), new Vector3(0.09226F, 0.09226F, 0.09226F)); }; GameObject debuffedVFX = Main.AssetBundle.LoadAsset <GameObject>("Assets/Items/Death Ceremony/MarkedVFX.prefab"); GameObject vfxOrigin = debuffedVFX.transform.Find("Origin").gameObject; vfxOrigin.transform.localScale *= 3f; CustomTempVFXManagement.MysticsRisky2UtilsTempVFX tempVFX = debuffedVFX.AddComponent <CustomTempVFXManagement.MysticsRisky2UtilsTempVFX>(); RotateAroundAxis rotateAroundAxis = vfxOrigin.gameObject.AddComponent <RotateAroundAxis>(); rotateAroundAxis.relativeTo = Space.Self; rotateAroundAxis.rotateAroundAxis = RotateAroundAxis.RotationAxis.X; rotateAroundAxis.fastRotationSpeed = 17f; rotateAroundAxis.speed = RotateAroundAxis.Speed.Fast; rotateAroundAxis = vfxOrigin.gameObject.AddComponent <RotateAroundAxis>(); rotateAroundAxis.relativeTo = Space.Self; rotateAroundAxis.rotateAroundAxis = RotateAroundAxis.RotationAxis.Z; rotateAroundAxis.fastRotationSpeed = 34f; rotateAroundAxis.speed = RotateAroundAxis.Speed.Fast; ObjectScaleCurve fadeOut = vfxOrigin.AddComponent <ObjectScaleCurve>(); fadeOut.overallCurve = new AnimationCurve { keys = new Keyframe[] { new Keyframe(0f, 1f, Mathf.Tan(180f * Mathf.Deg2Rad), Mathf.Tan(-20f * Mathf.Deg2Rad)), new Keyframe(1f, 0f, Mathf.Tan(160f * Mathf.Deg2Rad), 0f) } }; fadeOut.useOverallCurveOnly = true; fadeOut.enabled = false; fadeOut.timeMax = 0.2f; tempVFX.exitBehaviours = new MonoBehaviour[] { fadeOut }; ObjectScaleCurve fadeIn = vfxOrigin.AddComponent <ObjectScaleCurve>(); fadeIn.overallCurve = new AnimationCurve { keys = new Keyframe[] { new Keyframe(0f, 0f, Mathf.Tan(180f * Mathf.Deg2Rad), Mathf.Tan(70f * Mathf.Deg2Rad)), new Keyframe(1f, 1f, Mathf.Tan(-160f * Mathf.Deg2Rad), 0f) } }; fadeIn.useOverallCurveOnly = true; fadeIn.enabled = false; fadeIn.timeMax = 0.2f; tempVFX.enterBehaviours = new MonoBehaviour[] { fadeIn }; CustomTempVFXManagement.allVFX.Add(new CustomTempVFXManagement.VFXInfo { prefab = debuffedVFX, condition = (x) => { var component = x.GetComponent <MysticsItemsDeathCeremonyMark>(); if (component) { return(component.markTimer > 0f); } return(false); }, radius = CustomTempVFXManagement.DefaultRadiusCall }); damageShareOrbEffect = Main.AssetBundle.LoadAsset <GameObject>("Assets/Items/Death Ceremony/DeathCeremonyOrbEffect.prefab"); EffectComponent effectComponent = damageShareOrbEffect.AddComponent <EffectComponent>(); effectComponent.positionAtReferencedTransform = false; effectComponent.parentToReferencedTransform = false; effectComponent.applyScale = true; VFXAttributes vfxAttributes = damageShareOrbEffect.AddComponent <VFXAttributes>(); vfxAttributes.vfxPriority = VFXAttributes.VFXPriority.Low; vfxAttributes.vfxIntensity = VFXAttributes.VFXIntensity.Low; OrbEffect orbEffect = damageShareOrbEffect.AddComponent <OrbEffect>(); orbEffect.startVelocity1 = new Vector3(-10f, 0f, -10f); orbEffect.startVelocity2 = new Vector3(-10f, 10f, 10f); orbEffect.endVelocity1 = new Vector3(-10f, 0f, -10f); orbEffect.endVelocity2 = new Vector3(10f, 10f, 10f); orbEffect.movementCurve = new AnimationCurve { keys = new Keyframe[] { new Keyframe(0f, 0f), new Keyframe(1f, 1f) }, preWrapMode = WrapMode.Clamp, postWrapMode = WrapMode.Clamp }; orbEffect.faceMovement = true; orbEffect.callArrivalIfTargetIsGone = false; DestroyOnTimer destroyOnTimer = damageShareOrbEffect.transform.Find("Trail").gameObject.AddComponent <DestroyOnTimer>(); destroyOnTimer.duration = 0.5f; destroyOnTimer.enabled = false; MysticsRisky2Utils.MonoBehaviours.MysticsRisky2UtilsOrbEffectOnArrivalDefaults onArrivalDefaults = damageShareOrbEffect.AddComponent <MysticsRisky2Utils.MonoBehaviours.MysticsRisky2UtilsOrbEffectOnArrivalDefaults>(); onArrivalDefaults.orbEffect = orbEffect; onArrivalDefaults.transformsToUnparentChildren = new Transform[] { damageShareOrbEffect.transform }; onArrivalDefaults.componentsToEnable = new MonoBehaviour[] { destroyOnTimer }; MysticsItemsContent.Resources.effectPrefabs.Add(damageShareOrbEffect); CharacterBody.onBodyStartGlobal += CharacterBody_onBodyStartGlobal; GenericGameEvents.OnHitEnemy += GenericGameEvents_OnHitEnemy; R2API.RecalculateStatsAPI.GetStatCoefficients += RecalculateStatsAPI_GetStatCoefficients; }
public override void OnLoad() { base.OnLoad(); itemDef.name = "MysticsItems_AllyDeathRevenge"; SetItemTierWhenAvailable(ItemTier.Tier2); itemDef.tags = new ItemTag[] { ItemTag.Damage, ItemTag.Utility, ItemTag.AIBlacklist }; MysticsItemsContent.Resources.unlockableDefs.Add(GetUnlockableDef()); itemDef.pickupModelPrefab = PrepareModel(Main.AssetBundle.LoadAsset <GameObject>("Assets/Items/Ally Death Revenge/Model.prefab")); itemDef.pickupIconSprite = Main.AssetBundle.LoadAsset <Sprite>("Assets/Items/Ally Death Revenge/Icon.png"); ModelPanelParameters modelPanelParams = itemDef.pickupModelPrefab.GetComponentInChildren <ModelPanelParameters>(); modelPanelParams.minDistance = 0.75f; modelPanelParams.maxDistance = 1.5f; itemDisplayPrefab = PrepareItemDisplayModel(PrefabAPI.InstantiateClone(itemDef.pickupModelPrefab, itemDef.pickupModelPrefab.name + "Display", false)); onSetupIDRS += () => { AddDisplayRule("CommandoBody", "LowerArmR", new Vector3(0.001F, 0.274F, -0.078F), new Vector3(7.29F, 186.203F, 0.157F), new Vector3(0.277F, 0.389F, 0.277F)); AddDisplayRule("HuntressBody", "HandL", new Vector3(-0.014F, 0.004F, 0.035F), new Vector3(6.909F, 1.748F, 74.816F), new Vector3(0.187F, 0.174F, 0.187F)); AddDisplayRule("Bandit2Body", "Stomach", new Vector3(-0.069F, -0.12F, -0.197F), new Vector3(18.152F, 14.491F, 196.624F), new Vector3(0.348F, 0.348F, 0.348F)); AddDisplayRule("ToolbotBody", "HandR", new Vector3(-0.059F, 0.587F, 1.939F), new Vector3(356.736F, 85.148F, 90.496F), new Vector3(3.014F, 3.241F, 3.014F)); AddDisplayRule("EngiBody", "HandL", new Vector3(0F, 0.104F, 0.042F), new Vector3(3.001F, 0F, 0F), new Vector3(0.259F, 0.259F, 0.259F)); AddDisplayRule("EngiTurretBody", "Head", new Vector3(0.026F, 0.602F, -1.541F), new Vector3(22.044F, 48.281F, 206.737F), new Vector3(0.74F, 0.74F, 0.74F)); AddDisplayRule("EngiWalkerTurretBody", "Head", new Vector3(-0.248F, 1.434F, -0.84F), new Vector3(300.601F, 223.502F, 297.144F), new Vector3(0.659F, 0.801F, 0.643F)); AddDisplayRule("MageBody", "HandL", new Vector3(-0.011F, 0.074F, 0.104F), new Vector3(0F, 0F, 355.462F), new Vector3(0.22F, 0.22F, 0.22F)); AddDisplayRule("MercBody", "HandR", new Vector3(0F, 0.112F, 0.103F), new Vector3(14.285F, 0F, 0F), new Vector3(0.427F, 0.427F, 0.427F)); AddDisplayRule("TreebotBody", "WeaponPlatform", new Vector3(0F, 0.889F, 0.308F), new Vector3(0F, 0F, 0F), new Vector3(0.846F, 0.846F, 0.846F)); AddDisplayRule("LoaderBody", "MechHandL", new Vector3(-0.073F, 0.379F, 0.15F), new Vector3(5.558F, 330.424F, 0F), new Vector3(0.36F, 0.36F, 0.36F)); AddDisplayRule("CrocoBody", "HandL", new Vector3(-1.286F, 0.394F, 0.102F), new Vector3(56.075F, 280.047F, 0F), new Vector3(3.614F, 2.545F, 4.003F)); AddDisplayRule("CaptainBody", "HandR", new Vector3(-0.086F, 0.125F, 0.016F), new Vector3(14.676F, 274.88F, 359.215F), new Vector3(0.248F, 0.248F, 0.248F)); AddDisplayRule("BrotherBody", "HandL", BrotherInfection.green, new Vector3(0.019F, -0.013F, 0.017F), new Vector3(348.105F, 324.594F, 242.165F), new Vector3(0.061F, 0.019F, 0.061F)); AddDisplayRule("ScavBody", "HandL", new Vector3(-3.491F, 2.547F, -2.4F), new Vector3(354.216F, 329.486F, 87.688F), new Vector3(7.501F, 7.7F, 7.501F)); if (SoftDependencies.SoftDependenciesCore.itemDisplaysSniper) { AddDisplayRule("SniperClassicBody", "LowerArmR", new Vector3(-0.00116F, 0.35526F, -0.02252F), new Vector3(12.00797F, 359.9336F, 355.1882F), new Vector3(0.2754F, 0.2754F, 0.2754F)); } AddDisplayRule("RailgunnerBody", "Pelvis", new Vector3(0.1939F, 0.23069F, 0.00249F), new Vector3(5.45999F, 119.7464F, 17.75949F), new Vector3(0.33522F, 0.33522F, 0.33522F)); AddDisplayRule("VoidSurvivorBody", "Head", new Vector3(-0.06693F, -1.12064F, -0.77318F), new Vector3(90F, 0F, 0F), new Vector3(0.5795F, 0.5795F, 0.5795F)); }; itemDef.pickupModelPrefab.transform.Find("mdlAllyDeathRevenge").Rotate(new Vector3(0f, 0f, 160f), Space.Self); itemDef.pickupModelPrefab.transform.Find("mdlAllyDeathRevenge").localScale *= 0.8f; GlobalEventManager.onCharacterDeathGlobal += GlobalEventManager_onCharacterDeathGlobal; Overlays.CreateOverlay(Main.AssetBundle.LoadAsset <Material>("Assets/Items/Ally Death Revenge/matAllyDeathRevengeOverlay.mat"), delegate(CharacterModel model) { return(model.body ? model.body.HasBuff(MysticsItemsContent.Buffs.MysticsItems_AllyDeathRevenge) : false); }); GameObject burningVFX = Main.AssetBundle.LoadAsset <GameObject>("Assets/Items/Ally Death Revenge/BurningVFX.prefab"); CustomTempVFXManagement.MysticsRisky2UtilsTempVFX tempVFX = burningVFX.AddComponent <CustomTempVFXManagement.MysticsRisky2UtilsTempVFX>(); tempVFX.rotateWithParent = true; tempVFX.enterObjects = new GameObject[] { burningVFX.transform.Find("Origin").gameObject }; Material matBurningVFX = burningVFX.transform.Find("Origin/Left").gameObject.GetComponent <Renderer>().sharedMaterial; HopooShaderToMaterial.CloudRemap.Apply( matBurningVFX, Main.AssetBundle.LoadAsset <Texture>("Assets/Items/Ally Death Revenge/texRampAllyDeathRevengeBurningEyes.png") ); HopooShaderToMaterial.CloudRemap.Boost(matBurningVFX, 3f); burningVFX.transform.Find("Origin").gameObject.AddComponent <RotateObject>().rotationSpeed = new Vector3(0f, 400f, 0f); CustomTempVFXManagement.allVFX.Add(new CustomTempVFXManagement.VFXInfo { prefab = burningVFX, condition = (x) => x.HasBuff(MysticsItemsContent.Buffs.MysticsItems_AllyDeathRevenge), radius = CustomTempVFXManagement.DefaultRadiusCall, child = "Head" }); sfx = ScriptableObject.CreateInstance <NetworkSoundEventDef>(); sfx.eventName = "Play_item_allydeathrevenge_proc"; MysticsItemsContent.Resources.networkSoundEventDefs.Add(sfx); }
public override void OnLoad() { buffDef.name = "MysticsItems_Deafened"; buffDef.buffColor = new Color32(255, 195, 112, 255); buffDef.isDebuff = true; buffDef.iconSprite = Main.AssetBundle.LoadAsset <Sprite>("Assets/Buffs/Deafened.png"); Equipment.Microphone.buffDef = buffDef; R2API.RecalculateStatsAPI.GetStatCoefficients += RecalculateStatsAPI_GetStatCoefficients; GameObject debuffedVFX = Main.AssetBundle.LoadAsset <GameObject>("Assets/Equipment/Microphone/DeafenedVFX.prefab"); GameObject vfxOrigin = debuffedVFX.transform.Find("Origin").gameObject; CustomTempVFXManagement.MysticsRisky2UtilsTempVFX tempVFX = debuffedVFX.AddComponent <CustomTempVFXManagement.MysticsRisky2UtilsTempVFX>(); RotateAroundAxis rotateAroundAxis = vfxOrigin.transform.Find("Ring").gameObject.AddComponent <RotateAroundAxis>(); rotateAroundAxis.relativeTo = Space.Self; rotateAroundAxis.rotateAroundAxis = RotateAroundAxis.RotationAxis.X; rotateAroundAxis.fastRotationSpeed = 100f; rotateAroundAxis.speed = RotateAroundAxis.Speed.Fast; rotateAroundAxis = vfxOrigin.transform.Find("Ring (1)").gameObject.AddComponent <RotateAroundAxis>(); rotateAroundAxis.relativeTo = Space.Self; rotateAroundAxis.rotateAroundAxis = RotateAroundAxis.RotationAxis.Z; rotateAroundAxis.fastRotationSpeed = 50f; rotateAroundAxis.speed = RotateAroundAxis.Speed.Fast; ObjectScaleCurve fadeOut = vfxOrigin.AddComponent <ObjectScaleCurve>(); fadeOut.overallCurve = new AnimationCurve { keys = new Keyframe[] { new Keyframe(0f, 1f, Mathf.Tan(180f * Mathf.Deg2Rad), Mathf.Tan(-20f * Mathf.Deg2Rad)), new Keyframe(1f, 0f, Mathf.Tan(160f * Mathf.Deg2Rad), 0f) } }; fadeOut.useOverallCurveOnly = true; fadeOut.enabled = false; fadeOut.timeMax = 0.6f; tempVFX.exitBehaviours = new MonoBehaviour[] { fadeOut }; ObjectScaleCurve fadeIn = vfxOrigin.AddComponent <ObjectScaleCurve>(); fadeIn.overallCurve = new AnimationCurve { keys = new Keyframe[] { new Keyframe(0f, 0f, Mathf.Tan(180f * Mathf.Deg2Rad), Mathf.Tan(70f * Mathf.Deg2Rad)), new Keyframe(1f, 1f, Mathf.Tan(-160f * Mathf.Deg2Rad), 0f) } }; fadeIn.useOverallCurveOnly = true; fadeIn.enabled = false; fadeIn.timeMax = 0.6f; tempVFX.enterBehaviours = new MonoBehaviour[] { fadeIn }; CustomTempVFXManagement.allVFX.Add(new CustomTempVFXManagement.VFXInfo { prefab = debuffedVFX, condition = (x) => x.HasBuff(buffDef), radius = CustomTempVFXManagement.DefaultRadiusCall }); }