private void CharacterMaster_OnInventoryChanged(On.RoR2.CharacterMaster.orig_OnInventoryChanged orig, CharacterMaster self) { orig(self); if (self.hasBody) { if (self.GetBody().baseNameToken == "PALADIN_NAME") { Misc.PaladinSwordController swordComponent = self.GetBody().GetComponent <Misc.PaladinSwordController>(); if (swordComponent) { swordComponent.CheckInventory(); } } } }
public void OnProjectileImpact(ProjectileImpactInfo impactInfo) { if (!this.alive) { return; } BullseyeSearch search = new BullseyeSearch { teamMaskFilter = TeamMask.all, filterByLoS = false, searchOrigin = this.transform.position, searchDirection = Random.onUnitSphere, sortMode = BullseyeSearch.SortMode.Distance, maxDistanceFilter = 24f, maxAngleFilter = 360f }; search.RefreshCandidates(); search.FilterOutGameObject(base.gameObject); HurtBox target = search.GetResults().FirstOrDefault <HurtBox>(); if (target) { if (target.healthComponent && target.healthComponent.body) { if (target.healthComponent.body.baseNameToken == "PALADIN_NAME") { PaladinSwordController swordController = target.healthComponent.body.GetComponent <PaladinSwordController>(); if (swordController) { swordController.ApplyLightningBuff(); } } } } }