protected override bool PerformEquipmentAction(RoR2.EquipmentSlot slot) { if (!slot.characterBody) { return(false); } var body = slot.characterBody; if (NetworkServer.active) { var supernova = new RoR2.BlastAttack() { radius = 40, procCoefficient = 0.25f, position = body.corePosition, attacker = body.gameObject, crit = RoR2.Util.CheckRoll(body.crit, body.master), baseDamage = body.damage * 4, falloffModel = RoR2.BlastAttack.FalloffModel.None, baseForce = body.damage * 100, teamIndex = !body.teamComponent.teamIndex.Equals(TeamIndex.None) ? body.teamComponent.teamIndex : TeamIndex.None, damageType = DamageType.IgniteOnHit, attackerFiltering = AttackerFiltering.NeverHit }; supernova.Fire(); RoR2.EffectData effectData = new RoR2.EffectData(); effectData.origin = body.corePosition; effectData.scale = 40f; RoR2.EffectManager.SpawnEffect(Resources.Load <GameObject>("Prefabs/Effects/ImpactEffects/ExplosionVFX"), effectData, true); return(true); } return(false); }
private void EquipmentUpdate(On.RoR2.EquipmentSlot.orig_Update orig, RoR2.EquipmentSlot self) { if (self.equipmentIndex == equipmentDef.equipmentIndex) { var selfDisplay = self.FindActiveEquipmentDisplay(); var body = self.characterBody; if (selfDisplay && body) { var bulletTracker = body.GetComponent <JarBulletTracker>(); var input = body.inputBank; if (input && bulletTracker) { //Debug.Log($"Update ChargeTime: {bulletTracker.ChargeTime}"); if (bulletTracker.ChargeTime > 0) { selfDisplay.rotation = Quaternion.Slerp(selfDisplay.rotation, RoR2.Util.QuaternionSafeLookRotation(input.aimDirection), 0.15f); orig(self); return; } } selfDisplay.rotation = Quaternion.Slerp(selfDisplay.rotation, RoR2.Util.QuaternionSafeLookRotation(Vector3.up), 0.15f); } } orig(self); }
protected override bool PerformEquipmentAction(RoR2.EquipmentSlot slot) { if (!slot.characterBody) { return(false); } var body = slot.characterBody; return(false); }
protected override bool ActivateEquipment(RoR2.EquipmentSlot slot) { if (!slot.characterBody) { return(false); } var body = slot.characterBody; if (NetworkServer.active) { body.AddTimedBuffAuthority(LightningStormBuffIndex, DurationOfLightningStormBuff); } return(true); }
protected override bool OnEquipUseInner(RoR2.EquipmentSlot slot) { var body = slot.characterBody; if (!body) { return(false); } List <Collider> colliders = new List <Collider>(); new RoR2.SphereSearch { origin = body.corePosition, radius = 10, mask = RoR2.LayerIndex.entityPrecise.mask }.RefreshCandidates().OrderCandidatesByDistance().GetColliders(colliders); foreach (Collider collider in colliders) { var master = collider.GetComponentInParent <RoR2.CharacterMaster>(); var targetbody = collider.GetComponentInParent <RoR2.CharacterBody>(); if (master && targetbody) { if (targetbody.teamComponent && !targetbody.GetComponent <FrenzyPotionTracker>()) { if (!targetbody.isPlayerControlled) { var FrenzyTracker = targetbody.gameObject.AddComponent <FrenzyPotionTracker>(); FrenzyTracker.originalTeam = master.teamIndex; FrenzyTracker.frenziedBody = targetbody; targetbody.AddTimedBuffAuthority(FrenziedDebuff, 20); } } } } return(true); }
protected override bool PerformEquipmentAction(RoR2.EquipmentSlot slot) { if (!slot.characterBody || !slot.characterBody.teamComponent) { return(false); } var body = slot.characterBody; var bodyIdentity = body.gameObject.GetComponent <NetworkIdentity>(); var bulletTracker = body.GetComponent <JarBulletTracker>(); if (!bulletTracker) { bulletTracker = body.gameObject.AddComponent <JarBulletTracker>(); bulletTracker.body = body; } var equipmentDisplayTransform = slot.FindActiveEquipmentDisplay(); if (equipmentDisplayTransform) { bulletTracker.TargetTransform = equipmentDisplayTransform; } if (bulletTracker.jarBullets.Count > 0 && bulletTracker.ChargeTime <= 0 && bulletTracker.SuckTime <= 0) { bulletTracker.ChargeTime = 1; bulletTracker.RefireTime = 0.2f; return(true); } else if (bulletTracker.jarBullets.Count <= 0 && bulletTracker.SuckTime <= 0) { bulletTracker.IsSuckingProjectiles = false; bulletTracker.SuckTime = projectileAbsorptionTime; } return(false); }
protected override bool PerformEquipmentAction(RoR2.EquipmentSlot slot) { if (!slot.characterBody) { return(false); } var body = slot.characterBody; for (int i = 1; i <= 16; i++) { var newProjectileInfo = new FireProjectileInfo { owner = body.gameObject, projectilePrefab = HyperchargedProjectile, speedOverride = 150.0f, damage = body.damage, damageTypeOverride = null, damageColorIndex = DamageColorIndex.Default, procChainMask = default }; var theta = (Math.PI * 2) / 16; var angle = theta * i; var radius = 20 + random.RangeFloat(-15, 15); var positionChosen = new Vector3((float)(radius * Math.Cos(angle) + body.corePosition.x), body.corePosition.y + 1, (float)(radius * Math.Sin(angle) + body.corePosition.z)); var raycastedChosen = MiscUtils.RaycastToFloor(positionChosen, 1000f); if (raycastedChosen != null) { positionChosen = raycastedChosen.Value; } newProjectileInfo.position = positionChosen; newProjectileInfo.rotation = RoR2.Util.QuaternionSafeLookRotation(positionChosen + Vector3.down); ProjectileManager.instance.FireProjectile(newProjectileInfo); } return(true); }
private bool EquipmentSlotExecuteIfReady(On.RoR2.EquipmentSlot.orig_ExecuteIfReady orig, RoR2.EquipmentSlot self) { if (self.equipmentIndex == EquipmentIndex.Lightning && SceneManager.GetActiveScene().name == "bazaar" && self.characterBody.master.inventory.GetItemCount(ItemIndex.AutoCastEquipment) > 0) { return(false); } return(orig(self)); }
private bool PerformEquipmentAction(On.RoR2.EquipmentSlot.orig_PerformEquipmentAction orig, RoR2.EquipmentSlot self, EquipmentIndex equipmentIndex) { if (equipmentIndex == Index) { return(ActivateEquipment(self)); } else { return(orig(self, equipmentIndex)); } }
protected override bool PerformEquipmentAction(RoR2.EquipmentSlot slot) { return(false); }