// Token: 0x0600223B RID: 8763 RVA: 0x000942A5 File Offset: 0x000924A5 static CombatHealthBarViewer() { GlobalEventManager.onClientDamageNotified += delegate(DamageDealtMessage msg) { if (!msg.victim || msg.isSilent) { return; } HealthComponent component = msg.victim.GetComponent <HealthComponent>(); if (!component || component.dontShowHealthbar) { return; } TeamIndex objectTeam = TeamComponent.GetObjectTeam(component.gameObject); foreach (CombatHealthBarViewer combatHealthBarViewer in CombatHealthBarViewer.instancesList) { if (msg.attacker == combatHealthBarViewer.viewerBodyObject && combatHealthBarViewer.viewerBodyObject) { combatHealthBarViewer.HandleDamage(component, objectTeam); } } }; }
// Token: 0x06002EDC RID: 11996 RVA: 0x000C7828 File Offset: 0x000C5A28 private void FixedUpdateServer() { this.destroyTimer -= Time.fixedDeltaTime; if (!this.beginEndingGame) { if (this.destroyTimer <= 0f) { this.destroyTimer = EndingGame.timeBetweenDestroy; ReadOnlyCollection <TeamComponent> teamMembers = TeamComponent.GetTeamMembers(TeamIndex.Player); if (teamMembers.Count <= 0) { this.beginEndingGame = true; return; } GameObject gameObject = teamMembers[0].gameObject; CharacterBody component = gameObject.GetComponent <CharacterBody>(); if (component) { EffectManager.SpawnEffect(EndingGame.destroyEffectPrefab, new EffectData { origin = component.corePosition, scale = component.radius }, true); EntityState.Destroy(gameObject.gameObject); return; } } } else { this.endGameTimer += Time.fixedDeltaTime; if (this.endGameTimer >= EndingGame.timeUntilEndGame && Run.instance) { this.DoFinalAction(); } } }
// Token: 0x06002F99 RID: 12185 RVA: 0x000CBD3C File Offset: 0x000C9F3C private void FireOrbArrow() { if (hasFiredArrow || !NetworkServer.active) { return; } base.skillLocator.secondary.DeductStock(1); hasFiredArrow = true; LightningOrb lightningOrb = new LightningOrb(); lightningOrb.lightningType = (LightningOrb.LightningType)(-1); lightningOrb.damageValue = base.characterBody.damage * 0.75f; lightningOrb.isCrit = Util.CheckRoll(base.characterBody.crit, base.characterBody.master); lightningOrb.teamIndex = TeamComponent.GetObjectTeam(base.gameObject); lightningOrb.attacker = base.gameObject; lightningOrb.procCoefficient = 0.05f; lightningOrb.bouncesRemaining = 3; lightningOrb.targetsToFindPerBounce = 2; lightningOrb.speed = 20; lightningOrb.bouncedObjects = new List <HealthComponent>(); lightningOrb.range = 105; lightningOrb.damageCoefficientPerBounce = 2f; lightningOrb.SetFieldValue("canBounceOnSameTarget", true); HurtBox hurtBox = initialOrbTarget; if (hurtBox) { lightningOrb.origin = transform.position; lightningOrb.target = hurtBox; OrbManager.instance.AddOrb(lightningOrb); } }
// Token: 0x060031ED RID: 12781 RVA: 0x000D7694 File Offset: 0x000D5894 private void CastSmoke() { if (!this.hasCastSmoke) { Util.PlaySound(CastSmokescreen.startCloakSoundString, base.gameObject); } else { Util.PlaySound(CastSmokescreen.stopCloakSoundString, base.gameObject); } EffectManager.SpawnEffect(CastSmokescreen.smokescreenEffectPrefab, new EffectData { origin = base.transform.position }, false); int layerIndex = this.animator.GetLayerIndex("Impact"); if (layerIndex >= 0) { this.animator.SetLayerWeight(layerIndex, 2f); this.animator.PlayInFixedTime("LightImpact", layerIndex, 0f); } if (NetworkServer.active) { new BlastAttack { attacker = base.gameObject, inflictor = base.gameObject, teamIndex = TeamComponent.GetObjectTeam(base.gameObject), baseDamage = this.damageStat * CastSmokescreen.damageCoefficient, baseForce = CastSmokescreen.forceMagnitude, position = base.transform.position, radius = CastSmokescreen.radius, falloffModel = BlastAttack.FalloffModel.None, damageType = DamageType.Stun1s }.Fire(); } }
// Token: 0x060004CA RID: 1226 RVA: 0x00014218 File Offset: 0x00012418 public override void OnEnter() { base.OnEnter(); this.modelTransform = base.GetModelTransform(); Util.PlaySound(DashSlam.initialAttackSoundString, base.gameObject); this.initialAimVector = Vector3.ProjectOnPlane(base.GetAimRay().direction, Vector3.up); base.characterMotor.velocity.y = 0f; base.characterDirection.forward = this.initialAimVector; this.attack = new BlastAttack(); this.attack.attacker = base.gameObject; this.attack.inflictor = base.gameObject; this.attack.teamIndex = TeamComponent.GetObjectTeam(this.attack.attacker); this.attack.baseDamage = DashSlam.damageCoefficient * this.damageStat; this.attack.damageType = DamageType.Stun1s; this.attack.baseForce = DashSlam.baseForceMagnitude; this.attack.radius = DashSlam.blastAttackRadius + base.characterBody.radius; this.attack.falloffModel = BlastAttack.FalloffModel.None; if (this.modelTransform) { this.modelChildLocator = this.modelTransform.GetComponent <ChildLocator>(); if (this.modelChildLocator) { GameObject original = DashSlam.chargeEffectPrefab; Transform transform = this.modelChildLocator.FindChild("HandL"); Transform transform2 = this.modelChildLocator.FindChild("HandR"); if (transform) { this.leftHandChargeEffect = UnityEngine.Object.Instantiate <GameObject>(original, transform); } if (transform2) { this.rightHandChargeEffect = UnityEngine.Object.Instantiate <GameObject>(original, transform2); } this.EnableIndicator("GroundSlamIndicator", this.modelChildLocator); } } }
private void On_CMOnHitGround(On.RoR2.CharacterMotor.orig_OnHitGround orig, CharacterMotor self, CharacterMotor.HitGroundInfo ghi) { orig(self, ghi); CharacterBody body = self.GetFieldValue <CharacterBody>("body"); if (!body) { return; } if (GetCount(body) > 0 && Math.Abs(ghi.velocity.y) > velThreshold) { float scalefac = Mathf.Lerp(0f, baseDamage + (GetCount(body) - 1f) * stackDamage, Mathf.InverseLerp(velThreshold, velMax + velThreshold, Math.Abs(ghi.velocity.y))); //most properties borrowed from H3AD-5T v2 BlastAttack blastAttack = new BlastAttack { attacker = body.gameObject, inflictor = body.gameObject, teamIndex = TeamComponent.GetObjectTeam(body.gameObject), position = ghi.position, procCoefficient = 0.5f, radius = 10f, baseForce = 2000f, bonusForce = Vector3.up * 2000f, baseDamage = body.damage * scalefac, falloffModel = BlastAttack.FalloffModel.SweetSpot, crit = Util.CheckRoll(body.crit, body.master), damageColorIndex = DamageColorIndex.Item, attackerFiltering = AttackerFiltering.NeverHit }; blastAttack.Fire(); EffectData effectData = new EffectData { origin = ghi.position, scale = 10f }; EffectManager.SpawnEffect(Resources.Load <GameObject>("Prefabs/Effects/ImpactEffects/BootShockwave"), effectData, true); } }
public override void OnEnter() { base.OnEnter(); aimRay = base.GetAimRay(); this.duration = this.baseDuration; if (base.isAuthority) { base.characterBody.AddBuff(RoR2Content.Buffs.HiddenInvincibility); blastAttack = new BlastAttack(); blastAttack.radius = 25f; blastAttack.procCoefficient = 1f; blastAttack.position = aimRay.origin; blastAttack.attacker = base.gameObject; blastAttack.crit = Util.CheckRoll(base.characterBody.crit, base.characterBody.master); blastAttack.baseDamage = 0.1f; blastAttack.falloffModel = BlastAttack.FalloffModel.None; blastAttack.baseForce = 3f; blastAttack.teamIndex = TeamComponent.GetObjectTeam(blastAttack.attacker); blastAttack.damageType = DamageType.Stun1s; blastAttack.attackerFiltering = AttackerFiltering.NeverHit; blastAttack.Fire(); EffectData effectData = new EffectData(); effectData.origin = aimRay.origin; effectData.scale = 15; EffectManager.SpawnEffect(slashPrefab, effectData, false); Util.PlaySound("Backblast", base.gameObject); getHitList(blastAttack); victimBodyList.ForEach(Suck); base.characterMotor.velocity = -60 * aimRay.direction; } }
public override void OnEnter() { base.OnEnter(); this.rootMotionAccumulator = base.GetModelRootMotionAccumulator(); this.modelAnimator = base.GetModelAnimator(); this.duration = HeadbuttState.baseDuration / this.attackSpeedStat; this.attack = new OverlapAttack(); this.attack.attacker = base.gameObject; this.attack.inflictor = base.gameObject; this.attack.teamIndex = TeamComponent.GetObjectTeam(this.attack.attacker); this.attack.damage = HeadbuttState.damageCoefficient * this.damageStat; this.attack.hitEffectPrefab = HeadbuttState.hitEffectPrefab; Transform modelTransform = base.GetModelTransform(); if (modelTransform) { this.attack.hitBoxGroup = Array.Find <HitBoxGroup>(modelTransform.GetComponents <HitBoxGroup>(), (HitBoxGroup element) => element.groupName == "Headbutt"); } Util.PlaySound(HeadbuttState.attackSoundString, base.gameObject); base.PlayCrossfade("Body", "Headbutt", "Headbutt.playbackRate", this.duration, 0.1f); }
public bool IsHealable(SmartEntity target, object self) { if (target == null) { return(false); } SmartEntity smartEntity = (SmartEntity)self; if (target == smartEntity) { return(false); } TroopComponent troopComp = target.TroopComp; HealthComponent healthComp = target.HealthComp; TeamComponent teamComp = target.TeamComp; if (troopComp == null || healthComp == null || teamComp == null) { return(false); } if (target.TeamComp.TeamType != smartEntity.TeamComp.TeamType) { return(false); } if (TroopController.IsEntityPhantom(target)) { return(false); } if (TroopController.IsEntityHealer(target)) { return(false); } TroopComponent troopComp2 = smartEntity.TroopComp; return(troopComp2 == null || !TroopController.IsEntityHealer(smartEntity) || this.CanBeHealed(target, smartEntity)); }
private void ServerProc() { List <TeamComponent> teamMembers = new List <TeamComponent>(); bool isFF = FriendlyFireManager.friendlyFireMode != FriendlyFireManager.FriendlyFireMode.Off; if (isFF || teamFilter.teamIndex != TeamIndex.Monster) { teamMembers.AddRange(TeamComponent.GetTeamMembers(TeamIndex.Monster)); } if (isFF || teamFilter.teamIndex != TeamIndex.Neutral) { teamMembers.AddRange(TeamComponent.GetTeamMembers(TeamIndex.Neutral)); } if (isFF || teamFilter.teamIndex != TeamIndex.Player) { teamMembers.AddRange(TeamComponent.GetTeamMembers(TeamIndex.Player)); } float sqrad = radius * radius; teamMembers.Remove(owner.GetComponent <TeamComponent>()); foreach (TeamComponent tcpt in teamMembers) { if ((tcpt.transform.position - transform.position).sqrMagnitude <= sqrad) { if (tcpt.body && tcpt.body.mainHurtBox && tcpt.body.isActiveAndEnabled && damage > 0f) { OrbManager.instance.AddOrb(new LightningOrb { attacker = owner, bouncesRemaining = 0, damageColorIndex = DamageColorIndex.Bleed, damageType = DamageType.AOE, damageValue = damage, isCrit = false, lightningType = LightningOrb.LightningType.RazorWire, origin = transform.position, procChainMask = default,
public EatResponse OnEvent(EventId id, object cookie) { if (id == EventId.TroopPlacedOnBoard) { if (this.IsEventValidForGoal()) { SmartEntity smartEntity = (SmartEntity)cookie; if (smartEntity != null) { TeamComponent teamComponent = smartEntity.Get <TeamComponent>(); SpawnComponent spawnComponent = smartEntity.Get <SpawnComponent>(); TroopComponent troopComponent = smartEntity.Get <TroopComponent>(); if (troopComponent.TroopType.Type != TroopType.Hero) { if (troopComponent != null && teamComponent != null && teamComponent.TeamType == TeamType.Attacker && (spawnComponent == null || !spawnComponent.IsSummoned())) { this.parent.Progress(this, troopComponent.TroopType.Size); } } } } } return(EatResponse.NotEaten); }
private void ForceNameplateUpdate() { Debug.LogWarning($"Forcing ally {master.GetBody()?.GetDisplayName()} to have player nameplate."); TeamComponent team = master.GetBodyObject().GetComponent <TeamComponent>(); if (!team) { Debug.LogError("Could not find TeamComponent!"); return; } FieldInfo indicatorField = typeof(TeamComponent) .GetField("indicator", BindingFlags.Instance | BindingFlags.NonPublic); GameObject indicator = (GameObject)indicatorField.GetValue(team); if (indicator) { Destroy(indicator); indicatorField.SetValue(team, null); } typeof(TeamComponent) .GetMethod("SetupIndicator", BindingFlags.Instance | BindingFlags.NonPublic) .Invoke(team, new object[0]); }
// Token: 0x060008CE RID: 2254 RVA: 0x0002C6C4 File Offset: 0x0002A8C4 public override void OnEnter() { base.OnEnter(); Transform modelTransform = base.GetModelTransform(); this.animator = modelTransform.GetComponent <Animator>(); this.headbuttDuration = Headbutt.baseHeadbuttDuration / this.attackSpeedStat; Util.PlaySound(Headbutt.attackSoundString, base.gameObject); base.PlayCrossfade("Body", "Headbutt", "Headbutt.playbackRate", this.headbuttDuration, 0.2f); base.characterMotor.moveDirection = Vector3.zero; base.characterDirection.moveVector = base.characterDirection.forward; this.attack = new OverlapAttack(); this.attack.attacker = base.gameObject; this.attack.inflictor = base.gameObject; this.attack.teamIndex = TeamComponent.GetObjectTeam(this.attack.attacker); this.attack.damage = Headbutt.damageCoefficient * this.damageStat; this.attack.hitEffectPrefab = Headbutt.hitEffectPrefab; this.attack.forceVector = Vector3.up * Headbutt.upwardForceMagnitude; this.attack.pushAwayForce = Headbutt.awayForceMagnitude; if (modelTransform) { this.attack.hitBoxGroup = Array.Find <HitBoxGroup>(modelTransform.GetComponents <HitBoxGroup>(), (HitBoxGroup element) => element.groupName == "Headbutt"); } }
private void DoFreeze() { List <TeamComponent> teamMembers = new List <TeamComponent>(); bool isFF = FriendlyFireManager.friendlyFireMode != FriendlyFireManager.FriendlyFireMode.Off; if (isFF || myTeam != TeamIndex.Monster) { teamMembers.AddRange(TeamComponent.GetTeamMembers(TeamIndex.Monster)); } if (isFF || myTeam != TeamIndex.Neutral) { teamMembers.AddRange(TeamComponent.GetTeamMembers(TeamIndex.Neutral)); } if (isFF || myTeam != TeamIndex.Player) { teamMembers.AddRange(TeamComponent.GetTeamMembers(TeamIndex.Player)); } foreach (TeamComponent tcpt in teamMembers) { if (!Util.CheckRoll(Snowglobe.instance.procRate)) { continue; } var ssoh = tcpt.gameObject.GetComponent <SetStateOnHurt>(); var hcpt = tcpt.gameObject.GetComponent <HealthComponent>(); if (ssoh?.canBeFrozen == true) { hcpt.body.AddTimedBuff(ClassicItemsPlugin.freezeBuff, Snowglobe.instance.freezeTime); ssoh.SetFrozen(Snowglobe.instance.freezeTime); } if ((ssoh?.canBeFrozen == true || Snowglobe.instance.slowUnfreezable) && hcpt) { hcpt.body.AddTimedBuff(BuffIndex.Slow60, Snowglobe.instance.slowTime); } } }
private void ServerFixedUpdate() { UpdateGurrenPassive(); var hasFullEnergyBuff = this.body.HasBuff(Modules.Buffs.maxSpiralPowerBuff); var hasFullEnergyDeBuff = this.body.HasBuff(Modules.Buffs.maxSpiralPowerDeBuff); var hasKaminaBuff = this.body.HasBuff(Modules.Buffs.kaminaBuff); if (energyUptimeStopwatch < C_MaxEnergyUptime) { energyUptimeStopwatch += Time.fixedDeltaTime; } if (trottleUpdateTime < C_MaxTrottleUpdateTime) { trottleUpdateTime += Time.fixedDeltaTime; } if (trottleUpdateTime >= C_MaxTrottleUpdateTime) { trottleUpdateTime = 0f; var monsterCount = TeamComponent.GetTeamMembers(TeamIndex.Monster).Count; this.monsterCountCoefficient = ((float)monsterCount / 40.0f); if (this.body.healthComponent.fullCombinedHealth != 0) { this.healthCoefficient = this.body.healthComponent.missingCombinedHealth / this.body.healthComponent.fullCombinedHealth; } var newChargeRate = 0.0f; if (this.body.HasBuff(Modules.Buffs.maxSpiralPowerBuff)) { newChargeRate = 0.2f; } else if (healthCoefficient >= 1.0f) { newChargeRate = -0.2f; } else if (energyUptimeStopwatch < C_MaxEnergyUptime) { newChargeRate = ((this.healthCoefficient + this.monsterCountCoefficient) / ((hasFullEnergyDeBuff) ? 120f : 60f)) * this.energyModifier; if (hasKaminaBuff) { newChargeRate *= 2; } } else { newChargeRate = (this.energy > (5.0f + this.body.level))? (hasFullEnergyDeBuff) ? -0.03f : -0.01f : 0.02f; } if (this.charge_rate != newChargeRate) { this.NetworkChargeRate = newChargeRate; this.body.statsDirty = true; } } this.NetworkEnergy = Mathf.Clamp(this.energy + this.charge_rate * Time.fixedDeltaTime * C_SPIRALENERGYCAP, 0.0f, C_SPIRALENERGYCAP); if (!this.hadFullBuff && !hasFullEnergyDeBuff && this.energy >= C_SPIRALENERGYCAP) { this.body.AddTimedBuff(Modules.Buffs.maxSpiralPowerBuff, 100f); this.hadFullBuff = true; } else if (this.hadFullBuff && !hasFullEnergyBuff) { this.body.AddTimedBuff(Modules.Buffs.maxSpiralPowerDeBuff, 120f); this.hadFullBuff = false; } }
private void PushEnemiesServer() { if (!NetworkServer.active) { return; } List <HealthComponent> hcList = new List <HealthComponent>(); Collider[] array = Physics.OverlapBox(base.transform.position + aimRay.direction * HeatWave.hitboxOffset, HeatWave.hitboxDimensions, Quaternion.LookRotation(aimRay.direction, Vector3.up), LayerIndex.entityPrecise.mask); for (int i = 0; i < array.Length; i++) { HurtBox hurtBox = array[i].GetComponent <HurtBox>(); if (hurtBox) { HealthComponent healthComponent = hurtBox.healthComponent; ProjectileController pc = array[i].GetComponentInParent <ProjectileController>(); if (healthComponent && !pc && !hcList.Contains(healthComponent)) { hcList.Add(healthComponent); TeamComponent component2 = healthComponent.GetComponent <TeamComponent>(); if (component2.teamIndex != base.teamComponent.teamIndex) { CharacterBody cb = healthComponent.body; if (cb) { Vector3 forceVector = HeatWave.force * aimRay.direction; Rigidbody rb = cb.rigidbody; if (rb) { forceVector *= Mathf.Min(Mathf.Max(rb.mass / 100f, 1f), maxForceScale); } healthComponent.TakeDamageForce(new DamageInfo { attacker = base.gameObject, inflictor = base.gameObject, damage = 0f, damageColorIndex = DamageColorIndex.Default, damageType = DamageType.NonLethal, crit = false, dotIndex = DotController.DotIndex.None, force = forceVector, position = base.transform.position, procChainMask = default(ProcChainMask), procCoefficient = 0f }, true, true); if (this.hasHeat) //only deal damage if there is sufficient heat { float heatMult = this.heatLevel / HeatWave.heatCost; healthComponent.TakeDamage(new DamageInfo { attacker = base.gameObject, inflictor = base.gameObject, damage = this.damageStat * HeatWave.damageCoefficient * heatMult, damageColorIndex = DamageColorIndex.Default, damageType = DamageType.IgniteOnHit, crit = base.RollCrit(), dotIndex = DotController.DotIndex.None, force = Vector3.zero, position = base.transform.position, procChainMask = default(ProcChainMask), procCoefficient = 1f }); GlobalEventManager.instance.OnHitEnemy(new DamageInfo { attacker = base.gameObject, inflictor = base.gameObject, damage = this.damageStat * HeatWave.damageCoefficient * heatMult, damageColorIndex = DamageColorIndex.Default, damageType = DamageType.IgniteOnHit, crit = base.RollCrit(), dotIndex = DotController.DotIndex.None, force = Vector3.zero, position = base.transform.position, procChainMask = default(ProcChainMask), procCoefficient = 1f }, healthComponent.gameObject); } } } } } } }
// Token: 0x06002F00 RID: 12032 RVA: 0x000C84B4 File Offset: 0x000C66B4 private void ExitCleanup() { if (this.isExiting) { return; } this.isExiting = true; base.gameObject.layer = LayerIndex.defaultLayer.intVal; base.characterMotor.Motor.RebuildCollidableLayers(); Util.PlaySound(this.endSoundString, base.gameObject); this.CreateBlinkEffect(Util.GetCorePosition(base.gameObject)); this.modelTransform = base.GetModelTransform(); if (this.blastAttackDamageCoefficient > 0f) { new BlastAttack { attacker = base.gameObject, inflictor = base.gameObject, teamIndex = TeamComponent.GetObjectTeam(base.gameObject), baseDamage = this.damageStat * this.blastAttackDamageCoefficient, baseForce = this.blastAttackForce, position = this.blinkDestination, radius = this.blastAttackRadius, falloffModel = BlastAttack.FalloffModel.Linear }.Fire(); } if (this.disappearWhileBlinking) { if (this.modelTransform && this.destealthMaterial) { TemporaryOverlay temporaryOverlay = this.animator.gameObject.AddComponent <TemporaryOverlay>(); temporaryOverlay.duration = 1f; temporaryOverlay.destroyComponentOnEnd = true; temporaryOverlay.originalMaterial = this.destealthMaterial; temporaryOverlay.inspectorCharacterModel = this.animator.gameObject.GetComponent <CharacterModel>(); temporaryOverlay.alphaCurve = AnimationCurve.EaseInOut(0f, 1f, 1f, 0f); temporaryOverlay.animateShaderAlpha = true; } if (this.characterModel) { this.characterModel.invisibilityCount--; } if (this.hurtboxGroup) { HurtBoxGroup hurtBoxGroup = this.hurtboxGroup; int hurtBoxesDeactivatorCounter = hurtBoxGroup.hurtBoxesDeactivatorCounter - 1; hurtBoxGroup.hurtBoxesDeactivatorCounter = hurtBoxesDeactivatorCounter; } if (this.childLocator) { this.childLocator.FindChild("DustCenter").gameObject.SetActive(true); } base.PlayAnimation("Gesture, Additive", "BlinkEnd", "BlinkEnd.playbackRate", this.exitDuration); } if (this.blinkDestinationInstance) { EntityState.Destroy(this.blinkDestinationInstance); } if (base.characterMotor) { base.characterMotor.enabled = true; } }
private void LoadEntities() { throw new NotImplementedException(); int entitesCount = _savedComponents.Positions.Length; int?firstEntityIndex = null; _context.ReplacePlayerEntity(_savedComponents.PlayerEntityId); for (int i = 0; i < entitesCount; i++) { GameEntity entity = _context.CreateEntity(); if (!firstEntityIndex.HasValue) { firstEntityIndex = entity.creationIndex; } int currentEntityIndex = entity.creationIndex; int componentIndex = currentEntityIndex - firstEntityIndex.Value; IdComponent savedId = _savedComponents.Ids[componentIndex]; entity.ReplaceId(savedId.Id); bool[] componentPresence = _savedComponents.EntityToHasComponent[savedId.Id]; PositionComponent savedPosition = _savedComponents.Positions[componentIndex]; if (componentPresence[GameComponentsLookup.Position]) { entity.AddPosition(savedPosition.Position); entity.AddPositionAfterLastTurn(default(Position)); } VisionComponent savedVision = _savedComponents.Visions[componentIndex]; if (componentPresence[GameComponentsLookup.Vision]) { entity.AddVision(savedVision.VisionRange, savedVision.PerceptionRange, savedVision.EntitiesNoticed ?? new HashSet <Guid>()); } RecipeeComponent savedRecipee = _savedComponents.Recipees[componentIndex]; if (componentPresence[GameComponentsLookup.Recipee]) { entity.AddRecipee(savedRecipee.RecipeeName); } EnergyComponent savedEnergy = _savedComponents.Energies[componentIndex]; if (componentPresence[GameComponentsLookup.Energy]) { entity.AddEnergy(savedEnergy.EnergyGainPerSegment, savedEnergy.Energy); } IntegrityComponent savedIntegrity = _savedComponents.Integrities[componentIndex]; if (componentPresence[GameComponentsLookup.Integrity]) { entity.AddIntegrity(savedIntegrity.Integrity, savedIntegrity.MaxIntegrity); } SkillsComponent savedSkill = _savedComponents.Skills[componentIndex]; if (componentPresence[GameComponentsLookup.Skills]) { entity.AddSkills(savedSkill.Skills); } StomachComponent savedStomach = _savedComponents.Stomachs[componentIndex]; if (componentPresence[GameComponentsLookup.Stomach]) { entity.AddStomach(savedStomach.Satiation, savedStomach.MaxSatiation); } TeamComponent savedTeam = _savedComponents.Teams[componentIndex]; if (componentPresence[GameComponentsLookup.Team]) { entity.AddTeam(savedTeam.Team); } LooksComponent savedLooks = _savedComponents.Looks[componentIndex]; if (componentPresence[GameComponentsLookup.Looks]) { entity.AddLooks(savedLooks.BodySprite); } EdibleComponent savedEdible = _savedComponents.Edibles[componentIndex]; if (componentPresence[GameComponentsLookup.Edible]) { entity.AddEdible(savedEdible.Satiety); } if (componentPresence[GameComponentsLookup.BlockingPosition]) { entity.isBlockingPosition = true; } entity.isFinishedTurn = true; if (_context.playerEntity.Id == entity.id.Id) { entity.isPlayerControlled = true; } } }
private void FireServer(Ray aimRay) { bool hasHit = false; Vector3 hitPoint = Vector3.zero; float hitDistance = 0f; HealthComponent hitHealthComponent = null; var bulletAttack = new BulletAttack { bulletCount = 1, aimVector = aimRay.direction, origin = aimRay.origin, damage = YokoShootRifle.damageCoefficient * this.damageStat, damageColorIndex = DamageColorIndex.Default, damageType = DamageType.Generic, falloffModel = BulletAttack.FalloffModel.DefaultBullet, maxDistance = YokoShootRifle.range, force = YokoShootRifle.force, hitMask = LayerIndex.CommonMasks.bullet, minSpread = 0f, maxSpread = 0f, isCrit = base.RollCrit(), owner = base.gameObject, muzzleName = muzzleString, smartCollision = false, procChainMask = default(ProcChainMask), procCoefficient = procCoefficient, radius = 0.75f, sniper = false, stopperMask = LayerIndex.CommonMasks.bullet, weapon = null, tracerEffectPrefab = Modules.Assets.yokoRifleBeamEffect, spreadPitchScale = 0f, spreadYawScale = 0f, queryTriggerInteraction = QueryTriggerInteraction.UseGlobal, hitEffectPrefab = Modules.Assets.yokoRifleHitSmallEffect, }; if (maxRicochetCount > 0 && bulletAttack.isCrit) { bulletAttack.hitCallback = delegate(BulletAttack bulletAttackRef, ref BulletHit hitInfo) { var result = BulletAttack.defaultHitCallback(bulletAttackRef, ref hitInfo); hasHit = true; hitPoint = hitInfo.point; hitDistance = hitInfo.distance; if (hitInfo.hitHurtBox) { hitHealthComponent = hitInfo.hitHurtBox.healthComponent; } return(result); }; } bulletAttack.filterCallback = delegate(BulletAttack bulletAttackRef, ref BulletAttack.BulletHit info) { return((!info.entityObject || info.entityObject != bulletAttack.owner) && BulletAttack.defaultFilterCallback(bulletAttackRef, ref info)); }; bulletAttack.Fire(); if (hasHit) { this.Explode(hitPoint, bulletAttack.isCrit, (hitHealthComponent) ? hitHealthComponent.gameObject : null); if (hitHealthComponent != null) { if (bulletAttack.isCrit) { CritRicochetOrb critRicochetOrb = new CritRicochetOrb(); critRicochetOrb.bouncesRemaining = maxRicochetCount - 1; critRicochetOrb.resetBouncedObjects = resetBouncedObjects; critRicochetOrb.damageValue = bulletAttack.damage; critRicochetOrb.isCrit = base.RollCrit(); critRicochetOrb.teamIndex = TeamComponent.GetObjectTeam(base.gameObject); critRicochetOrb.attacker = base.gameObject; critRicochetOrb.attackerBody = base.characterBody; critRicochetOrb.procCoefficient = bulletAttack.procCoefficient; critRicochetOrb.duration = 0.1f; critRicochetOrb.bouncedObjects = new List <HealthComponent>(); critRicochetOrb.range = Mathf.Max(30f, hitDistance); critRicochetOrb.tracerEffectPrefab = Modules.Assets.yokoRifleBeamEffect; critRicochetOrb.hitEffectPrefab = Modules.Assets.yokoRifleHitSmallEffect; critRicochetOrb.hitSoundString = "TTGLTokoRifleCrit"; critRicochetOrb.origin = hitPoint; critRicochetOrb.bouncedObjects.Add(hitHealthComponent); var nextTarget = critRicochetOrb.PickNextTarget(hitPoint); if (nextTarget) { critRicochetOrb.target = nextTarget; OrbManager.instance.AddOrb(critRicochetOrb); } } } } }
public void Awake() { ReadConfig(); SetupArtifact(); On.RoR2.CharacterMaster.OnBodyDeath += (orig, master, body) => { bool couldrespawn = false; if (master.inventory.GetItemCount(RoR2Content.Items.ExtraLife) > 0) { couldrespawn = true; } orig(master, body); if (!couldrespawn) { DropStolenInventory(body); } }; On.RoR2.CharacterBody.Start += (orig, body) => { UpdateThiefBuff(body); orig(body); }; //Enemy Item Pickup Related Hooks On.RoR2.GenericPickupController.BodyHasPickupPermission += (orig, body) => { if (body.masterObject) { if (body.inventory) { if (RunArtifactManager.instance.IsArtifactEnabled(Grief.artifactIndex) && EnemyCanPickup.Value) { MinionOwnership minionowner = body.master.minionOwnership; if (!minionowner || !minionowner.ownerMaster) { return(true); } } else if (body.masterObject.GetComponent <PlayerCharacterMasterController>()) { TeamComponent component = body.GetComponent <TeamComponent>(); if (component && component.teamIndex == TeamIndex.Player) { return(true); } } } } return(false); }; On.RoR2.GenericPickupController.AttemptGrant += (orig, gpc, body) => { orig(gpc, body); if (RunArtifactManager.instance.IsArtifactEnabled(Grief.artifactIndex) && EnemyCanPickup.Value) { TeamComponent component = body.GetComponent <TeamComponent>(); if (component && component.teamIndex != TeamIndex.Player) { Inventory inventory = body.inventory; if (inventory) { PickupDef pickupDef = PickupCatalog.GetPickupDef(gpc.pickupIndex); if (pickupDef.itemIndex != ItemIndex.None) { gpc.gameObject.SetActive(false); inventory.GiveItem(pickupDef.itemIndex, 1); Chat.AddPickupMessage(body, ((pickupDef != null) ? pickupDef.nameToken : null) ?? PickupCatalog.invalidPickupToken, (pickupDef != null) ? pickupDef.baseColor : Color.black, 1); if (body) { Util.PlaySound("Play_UI_item_pickup", body.gameObject); } AddToStolenInventory(body, body.master.gameObject, pickupDef.itemIndex, 1); UnityEngine.Object.Destroy(gpc.gameObject); } } } } }; //Setup Grief from Damage Report On.RoR2.CharacterBody.OnTakeDamageServer += (orig, charbody, damageReport) => { orig(charbody, damageReport); if (RunArtifactManager.instance.IsArtifactEnabled(Grief.artifactIndex)) { if (charbody.master) { CharacterMaster master = charbody.master; if (master.playerCharacterMasterController) { SetupGriefFromDamageReport(master, damageReport); } } } }; }
// Token: 0x06001F21 RID: 7969 RVA: 0x00087164 File Offset: 0x00085364 public void OnProjectileImpact(ProjectileImpactInfo impactInfo) { if (!this.alive) { return; } Collider collider = impactInfo.collider; if (collider) { DamageInfo damageInfo = new DamageInfo(); if (this.projectileDamage) { damageInfo.damage = this.projectileDamage.damage; damageInfo.crit = this.projectileDamage.crit; damageInfo.attacker = (this.projectileController.owner ? this.projectileController.owner.gameObject : null); damageInfo.inflictor = base.gameObject; damageInfo.position = impactInfo.estimatedPointOfImpact; damageInfo.force = this.projectileDamage.force * base.transform.forward; damageInfo.procChainMask = this.projectileController.procChainMask; damageInfo.procCoefficient = this.projectileController.procCoefficient; damageInfo.damageColorIndex = this.projectileDamage.damageColorIndex; damageInfo.damageType = this.projectileDamage.damageType; } else { Debug.Log("No projectile damage component!"); } HurtBox component = collider.GetComponent <HurtBox>(); if (component) { HealthComponent healthComponent = component.healthComponent; if (healthComponent) { if (healthComponent.gameObject == this.projectileController.owner) { return; } TeamComponent component2 = healthComponent.GetComponent <TeamComponent>(); TeamFilter component3 = base.GetComponent <TeamFilter>(); bool flag = false; if (component2 && component3) { flag = (component2.teamIndex == component3.teamIndex); } if (!flag) { Util.PlaySound(this.enemyHitSoundString, base.gameObject); if (NetworkServer.active) { damageInfo.ModifyDamageInfo(component.damageModifier); healthComponent.TakeDamage(damageInfo); GlobalEventManager.instance.OnHitEnemy(damageInfo, component.healthComponent.gameObject); } } this.alive = false; } } else if (this.destroyOnWorld) { this.alive = false; } damageInfo.position = base.transform.position; if (NetworkServer.active) { GlobalEventManager.instance.OnHitAll(damageInfo, collider.gameObject); } } if (!this.alive) { if (NetworkServer.active && this.impactEffect) { EffectManager.SimpleImpactEffect(this.impactEffect, impactInfo.estimatedPointOfImpact, -base.transform.forward, !this.projectileController.isPrediction); } Util.PlaySound(this.hitSoundString, base.gameObject); if (this.destroyWhenNotAlive) { UnityEngine.Object.Destroy(base.gameObject); } } }
protected override Entity AddComponentAndDispatchAddEvent(ComponentBase comp, Type compCls) { bool flag = false; if (comp is AreaTriggerComponent) { this.AreaTriggerComp = (AreaTriggerComponent)comp; flag = true; } if (comp is ArmoryComponent) { this.ArmoryComp = (ArmoryComponent)comp; flag = true; } if (comp is AssetComponent) { this.AssetComp = (AssetComponent)comp; flag = true; } if (comp is AttackerComponent) { this.AttackerComp = (AttackerComponent)comp; flag = true; } if (comp is BarracksComponent) { this.BarracksComp = (BarracksComponent)comp; flag = true; } if (comp is BoardItemComponent) { this.BoardItemComp = (BoardItemComponent)comp; flag = true; } if (comp is BuildingAnimationComponent) { this.BuildingAnimationComp = (BuildingAnimationComponent)comp; flag = true; } if (comp is BuildingComponent) { this.BuildingComp = (BuildingComponent)comp; flag = true; } if (comp is ChampionComponent) { this.ChampionComp = (ChampionComponent)comp; flag = true; } if (comp is CivilianComponent) { this.CivilianComp = (CivilianComponent)comp; flag = true; } if (comp is ClearableComponent) { this.ClearableComp = (ClearableComponent)comp; flag = true; } if (comp is DamageableComponent) { this.DamageableComp = (DamageableComponent)comp; flag = true; } if (comp is DefenderComponent) { this.DefenderComp = (DefenderComponent)comp; flag = true; } if (comp is DefenseLabComponent) { this.DefenseLabComp = (DefenseLabComponent)comp; flag = true; } if (comp is DroidComponent) { this.DroidComp = (DroidComponent)comp; flag = true; } if (comp is DroidHutComponent) { this.DroidHutComp = (DroidHutComponent)comp; flag = true; } if (comp is SquadBuildingComponent) { this.SquadBuildingComp = (SquadBuildingComponent)comp; flag = true; } if (comp is NavigationCenterComponent) { this.NavigationCenterComp = (NavigationCenterComponent)comp; flag = true; } if (comp is FactoryComponent) { this.FactoryComp = (FactoryComponent)comp; flag = true; } if (comp is CantinaComponent) { this.CantinaComp = (CantinaComponent)comp; flag = true; } if (comp is FleetCommandComponent) { this.FleetCommandComp = (FleetCommandComponent)comp; flag = true; } if (comp is FollowerComponent) { this.FollowerComp = (FollowerComponent)comp; flag = true; } if (comp is GameObjectViewComponent) { this.GameObjectViewComp = (GameObjectViewComponent)comp; flag = true; } if (comp is GeneratorComponent) { this.GeneratorComp = (GeneratorComponent)comp; flag = true; } if (comp is GeneratorViewComponent) { this.GeneratorViewComp = (GeneratorViewComponent)comp; flag = true; } if (comp is HealerComponent) { this.HealerComp = (HealerComponent)comp; flag = true; } if (comp is TroopShieldComponent) { this.TroopShieldComp = (TroopShieldComponent)comp; flag = true; } if (comp is TroopShieldViewComponent) { this.TroopShieldViewComp = (TroopShieldViewComponent)comp; flag = true; } if (comp is TroopShieldHealthComponent) { this.TroopShieldHealthComp = (TroopShieldHealthComponent)comp; flag = true; } if (comp is HealthComponent) { this.HealthComp = (HealthComponent)comp; flag = true; } if (comp is HealthViewComponent) { this.HealthViewComp = (HealthViewComponent)comp; flag = true; } if (comp is HQComponent) { this.HQComp = (HQComponent)comp; flag = true; } if (comp is KillerComponent) { this.KillerComp = (KillerComponent)comp; flag = true; } if (comp is LootComponent) { this.LootComp = (LootComponent)comp; flag = true; } if (comp is MeterShaderComponent) { this.MeterShaderComp = (MeterShaderComponent)comp; flag = true; } if (comp is OffenseLabComponent) { this.OffenseLabComp = (OffenseLabComponent)comp; flag = true; } if (comp is PathingComponent) { this.PathingComp = (PathingComponent)comp; flag = true; } if (comp is SecondaryTargetsComponent) { this.SecondaryTargetsComp = (SecondaryTargetsComponent)comp; flag = true; } if (comp is ShieldBorderComponent) { this.ShieldBorderComp = (ShieldBorderComponent)comp; flag = true; } if (comp is ShieldGeneratorComponent) { this.ShieldGeneratorComp = (ShieldGeneratorComponent)comp; flag = true; } if (comp is SizeComponent) { this.SizeComp = (SizeComponent)comp; flag = true; } if (comp is ShooterComponent) { this.ShooterComp = (ShooterComponent)comp; flag = true; } if (comp is StarportComponent) { this.StarportComp = (StarportComponent)comp; flag = true; } if (comp is StateComponent) { this.StateComp = (StateComponent)comp; flag = true; } if (comp is StorageComponent) { this.StorageComp = (StorageComponent)comp; flag = true; } if (comp is SupportComponent) { this.SupportComp = (SupportComponent)comp; flag = true; } if (comp is SupportViewComponent) { this.SupportViewComp = (SupportViewComponent)comp; flag = true; } if (comp is TacticalCommandComponent) { this.TacticalCommandComp = (TacticalCommandComponent)comp; flag = true; } if (comp is ChampionPlatformComponent) { this.ChampionPlatformComp = (ChampionPlatformComponent)comp; flag = true; } if (comp is TeamComponent) { this.TeamComp = (TeamComponent)comp; flag = true; } if (comp is TrackingComponent) { this.TrackingComp = (TrackingComponent)comp; flag = true; } if (comp is TrackingGameObjectViewComponent) { this.TrackingGameObjectViewComp = (TrackingGameObjectViewComponent)comp; flag = true; } if (comp is TransformComponent) { this.TransformComp = (TransformComponent)comp; flag = true; } if (comp is TransportComponent) { this.TransportComp = (TransportComponent)comp; flag = true; } if (comp is TroopComponent) { this.TroopComp = (TroopComponent)comp; flag = true; } if (comp is TurretBuildingComponent) { this.TurretBuildingComp = (TurretBuildingComponent)comp; flag = true; } if (comp is TurretShooterComponent) { this.TurretShooterComp = (TurretShooterComponent)comp; flag = true; } if (comp is WalkerComponent) { this.WalkerComp = (WalkerComponent)comp; flag = true; } if (comp is WallComponent) { this.WallComp = (WallComponent)comp; flag = true; } if (comp is BuffComponent) { this.BuffComp = (BuffComponent)comp; flag = true; } if (comp is TrapComponent) { this.TrapComp = (TrapComponent)comp; flag = true; } if (comp is TrapViewComponent) { this.TrapViewComp = (TrapViewComponent)comp; flag = true; } if (comp is HousingComponent) { this.HousingComp = (HousingComponent)comp; flag = true; } if (comp is ScoutTowerComponent) { this.ScoutTowerComp = (ScoutTowerComponent)comp; flag = true; } if (comp is SpawnComponent) { this.SpawnComp = (SpawnComponent)comp; flag = true; } if (!flag && compCls != null) { Service.Logger.Error("Invalid component add: " + compCls.Name); } return(base.AddComponentAndDispatchAddEvent(comp, compCls)); }
public override object Remove(Type compCls) { if (compCls == typeof(AreaTriggerComponent)) { this.AreaTriggerComp = null; } else if (compCls == typeof(ArmoryComponent)) { this.ArmoryComp = null; } else if (compCls == typeof(AssetComponent)) { this.AssetComp = null; } else if (compCls == typeof(AttackerComponent)) { this.AttackerComp = null; } else if (compCls == typeof(BarracksComponent)) { this.BarracksComp = null; } else if (compCls == typeof(BoardItemComponent)) { this.BoardItemComp = null; } else if (compCls == typeof(BuildingAnimationComponent)) { this.BuildingAnimationComp = null; } else if (compCls == typeof(BuildingComponent)) { this.BuildingComp = null; } else if (compCls == typeof(CantinaComponent)) { this.CantinaComp = null; } else if (compCls == typeof(ChampionComponent)) { this.ChampionComp = null; } else if (compCls == typeof(CivilianComponent)) { this.CivilianComp = null; } else if (compCls == typeof(ClearableComponent)) { this.ClearableComp = null; } else if (compCls == typeof(DamageableComponent)) { this.DamageableComp = null; } else if (compCls == typeof(DefenderComponent)) { this.DefenderComp = null; } else if (compCls == typeof(DefenseLabComponent)) { this.DefenseLabComp = null; } else if (compCls == typeof(DroidComponent)) { this.DroidComp = null; } else if (compCls == typeof(DroidHutComponent)) { this.DroidHutComp = null; } else if (compCls == typeof(SquadBuildingComponent)) { this.SquadBuildingComp = null; } else if (compCls == typeof(NavigationCenterComponent)) { this.NavigationCenterComp = null; } else if (compCls == typeof(FactoryComponent)) { this.FactoryComp = null; } else if (compCls == typeof(FleetCommandComponent)) { this.FleetCommandComp = null; } else if (compCls == typeof(FollowerComponent)) { this.FollowerComp = null; } else if (compCls == typeof(GameObjectViewComponent)) { this.GameObjectViewComp = null; } else if (compCls == typeof(GeneratorComponent)) { this.GeneratorComp = null; } else if (compCls == typeof(GeneratorViewComponent)) { this.GeneratorViewComp = null; } else if (compCls == typeof(HealerComponent)) { this.HealerComp = null; } else if (compCls == typeof(HealthComponent)) { this.HealthComp = null; } else if (compCls == typeof(TroopShieldComponent)) { this.TroopShieldComp = null; } else if (compCls == typeof(TroopShieldViewComponent)) { this.TroopShieldViewComp = null; } else if (compCls == typeof(TroopShieldHealthComponent)) { this.TroopShieldHealthComp = null; } else if (compCls == typeof(HealthViewComponent)) { this.HealthViewComp = null; } else if (compCls == typeof(HQComponent)) { this.HQComp = null; } else if (compCls == typeof(KillerComponent)) { this.KillerComp = null; } else if (compCls == typeof(LootComponent)) { this.LootComp = null; } else if (compCls == typeof(MeterShaderComponent)) { this.MeterShaderComp = null; } else if (compCls == typeof(OffenseLabComponent)) { this.OffenseLabComp = null; } else if (compCls == typeof(PathingComponent)) { this.PathingComp = null; } else if (compCls == typeof(SecondaryTargetsComponent)) { this.SecondaryTargetsComp = null; } else if (compCls == typeof(ShieldBorderComponent)) { this.ShieldBorderComp = null; } else if (compCls == typeof(ShieldGeneratorComponent)) { this.ShieldGeneratorComp = null; } else if (compCls == typeof(SizeComponent)) { this.SizeComp = null; } else if (compCls == typeof(ShooterComponent)) { this.ShooterComp = null; } else if (compCls == typeof(StarportComponent)) { this.StarportComp = null; } else if (compCls == typeof(StateComponent)) { this.StateComp = null; } else if (compCls == typeof(StorageComponent)) { this.StorageComp = null; } else if (compCls == typeof(SupportComponent)) { this.SupportComp = null; } else if (compCls == typeof(SupportViewComponent)) { this.SupportViewComp = null; } else if (compCls == typeof(TacticalCommandComponent)) { this.TacticalCommandComp = null; } else if (compCls == typeof(ChampionPlatformComponent)) { this.ChampionPlatformComp = null; } else if (compCls == typeof(TeamComponent)) { this.TeamComp = null; } else if (compCls == typeof(TrackingComponent)) { this.TrackingComp = null; } else if (compCls == typeof(TrackingGameObjectViewComponent)) { this.TrackingGameObjectViewComp = null; } else if (compCls == typeof(TransformComponent)) { this.TransformComp = null; } else if (compCls == typeof(TransportComponent)) { this.TransportComp = null; } else if (compCls == typeof(TroopComponent)) { this.TroopComp = null; } else if (compCls == typeof(TurretBuildingComponent)) { this.TurretBuildingComp = null; } else if (compCls == typeof(TurretShooterComponent)) { this.TurretShooterComp = null; } else if (compCls == typeof(WalkerComponent)) { this.WalkerComp = null; } else if (compCls == typeof(WallComponent)) { this.WallComp = null; } else if (compCls == typeof(BuffComponent)) { this.BuffComp = null; } else if (compCls == typeof(TrapComponent)) { this.TrapComp = null; } else if (compCls == typeof(TrapViewComponent)) { this.TrapViewComp = null; } else if (compCls == typeof(HousingComponent)) { this.HousingComp = null; } else if (compCls == typeof(SpawnComponent)) { this.SpawnComp = null; } return(base.Remove(compCls)); }
public void Awake() { IL.RoR2.GlobalEventManager.OnCharacterDeath += (il) => { var c = new ILCursor(il); c.GotoNext( x => x.MatchLdloc(32) ); instr2 = c.Next.Operand; c.Index += 1; c.EmitDelegate <Func <int, int> >((toothcount) => { toothcount = 0; System.Collections.ObjectModel.ReadOnlyCollection <TeamComponent> teammembers = TeamComponent.GetTeamMembers(TeamIndex.Player); for (int i = 0; i < teammembers.Count; i++) { if (Util.LookUpBodyNetworkUser(teammembers[i].gameObject)) { CharacterBody component = teammembers[i].GetComponent <CharacterBody>(); if (component && component.inventory) { toothcount += component.inventory.GetItemCount(ItemIndex.Tooth); } } } Debug.Log(toothcount); return(toothcount); }); c.GotoNext( x => x.MatchLdloc(32) ); c.Index += 1; c.EmitDelegate <Func <int, int> >((toothcount) => { toothcount = 0; System.Collections.ObjectModel.ReadOnlyCollection <TeamComponent> teammembers = TeamComponent.GetTeamMembers(TeamIndex.Player); for (int i = 0; i < teammembers.Count; i++) { if (Util.LookUpBodyNetworkUser(teammembers[i].gameObject)) { CharacterBody component = teammembers[i].GetComponent <CharacterBody>(); if (component && component.inventory) { toothcount += component.inventory.GetItemCount(ItemIndex.Tooth); } } } Debug.Log(toothcount); return(toothcount); }); c.GotoNext( x => x.MatchLdloc(52), x => x.MatchLdloc(52), x => x.MatchLdloc(52) ); c.Index += 5; c.Remove(); c.Emit(OpCodes.Ldloc_S, instr2); c.EmitDelegate <Action <GameObject, int> >((healthOrbGameObject, toothCount) => { float toothamount = 0; System.Collections.ObjectModel.ReadOnlyCollection <TeamComponent> teammembers = TeamComponent.GetTeamMembers(TeamIndex.Player); for (int i = 0; i < teammembers.Count; i++) { if (Util.LookUpBodyNetworkUser(teammembers[i].gameObject)) { CharacterBody component = teammembers[i].GetComponent <CharacterBody>(); if (component && component.inventory) { toothamount += component.inventory.GetItemCount(ItemIndex.Tooth); } } } Debug.Log("Total tooth amount : " + toothamount); healthOrbGameObject.GetComponent <TeamFilter>().teamIndex = TeamIndex.Player; healthOrbGameObject.GetComponentInChildren <HealthPickup>().flatHealing = 0f; healthOrbGameObject.GetComponentInChildren <HealthPickup>().fractionalHealing = healingStack1 + healingOtherStacks * (toothamount - 1); UnityEngine.Networking.NetworkServer.Spawn(healthOrbGameObject); }); //Debug.Log(il.ToString()); }; }
internal static void CreatePrefab() { // first clone the commando prefab so we can turn that into our own survivor characterPrefab = PrefabAPI.InstantiateClone(Resources.Load <GameObject>("Prefabs/CharacterBodies/CommandoBody"), "ExampleSurvivorBody", true, "C:\\Users\\test\\Documents\\ror2mods\\ExampleSurvivor\\ExampleSurvivor\\ExampleSurvivor\\ExampleSurvivor.cs", "CreatePrefab", 151); characterPrefab.GetComponent <NetworkIdentity>().localPlayerAuthority = true; // create the model here, we're gonna replace commando's model with our own GameObject model = CreateModel(characterPrefab); GameObject gameObject = new GameObject("ModelBase"); gameObject.transform.parent = characterPrefab.transform; gameObject.transform.localPosition = new Vector3(0f, -0.81f, 0f); gameObject.transform.localRotation = Quaternion.identity; gameObject.transform.localScale = new Vector3(1f, 1f, 1f); GameObject gameObject2 = new GameObject("CameraPivot"); gameObject2.transform.parent = gameObject.transform; gameObject2.transform.localPosition = new Vector3(0f, 1.6f, 0f); gameObject2.transform.localRotation = Quaternion.identity; gameObject2.transform.localScale = Vector3.one; GameObject gameObject3 = new GameObject("AimOrigin"); gameObject3.transform.parent = gameObject.transform; gameObject3.transform.localPosition = new Vector3(0f, 1.4f, 0f); gameObject3.transform.localRotation = Quaternion.identity; gameObject3.transform.localScale = Vector3.one; Transform transform = model.transform; transform.parent = gameObject.transform; transform.localPosition = Vector3.zero; transform.localScale = new Vector3(0.01f, 0.01f, 0.01f); transform.localRotation = Quaternion.identity; CharacterDirection characterDirection = characterPrefab.GetComponent <CharacterDirection>(); characterDirection.moveVector = Vector3.zero; characterDirection.targetTransform = gameObject.transform; characterDirection.overrideAnimatorForwardTransform = null; characterDirection.rootMotionAccumulator = null; characterDirection.modelAnimator = model.GetComponentInChildren <Animator>(); characterDirection.driveFromRootRotation = false; characterDirection.turnSpeed = 720f; // set up the character body here CharacterBody bodyComponent = characterPrefab.GetComponent <CharacterBody>(); bodyComponent.bodyIndex = -1; bodyComponent.baseNameToken = "EXAMPLESURVIVOR_NAME"; // name token bodyComponent.subtitleNameToken = "EXAMPLESURVIVOR_SUBTITLE"; // subtitle token- used for umbras bodyComponent.bodyFlags = CharacterBody.BodyFlags.ImmuneToExecutes; bodyComponent.rootMotionInMainState = false; bodyComponent.mainRootSpeed = 0; bodyComponent.baseMaxHealth = 90; bodyComponent.levelMaxHealth = 24; bodyComponent.baseRegen = 0.5f; bodyComponent.levelRegen = 0.25f; bodyComponent.baseMaxShield = 0; bodyComponent.levelMaxShield = 0; bodyComponent.baseMoveSpeed = 7; bodyComponent.levelMoveSpeed = 0; bodyComponent.baseAcceleration = 80; bodyComponent.baseJumpPower = 15; bodyComponent.levelJumpPower = 0; bodyComponent.baseDamage = 15; bodyComponent.levelDamage = 3f; bodyComponent.baseAttackSpeed = 1; bodyComponent.levelAttackSpeed = 0; bodyComponent.baseCrit = 1; bodyComponent.levelCrit = 0; bodyComponent.baseArmor = 0; bodyComponent.levelArmor = 0; bodyComponent.baseJumpCount = 1; bodyComponent.sprintingSpeedMultiplier = 1.45f; bodyComponent.wasLucky = false; bodyComponent.hideCrosshair = false; bodyComponent.aimOriginTransform = gameObject3.transform; bodyComponent.hullClassification = HullClassification.Human; bodyComponent.portraitIcon = Assets.charPortrait; bodyComponent.isChampion = false; bodyComponent.currentVehicle = null; bodyComponent.skinIndex = 0U; // the charactermotor controls the survivor's movement and stuff CharacterMotor characterMotor = characterPrefab.GetComponent <CharacterMotor>(); characterMotor.walkSpeedPenaltyCoefficient = 1f; characterMotor.characterDirection = characterDirection; characterMotor.muteWalkMotion = false; characterMotor.mass = 100f; characterMotor.airControl = 0.25f; characterMotor.disableAirControlUntilCollision = false; characterMotor.generateParametersOnAwake = true; characterMotor.useGravity = true; characterMotor.isFlying = false; InputBankTest inputBankTest = characterPrefab.GetComponent <InputBankTest>(); inputBankTest.moveVector = Vector3.zero; CameraTargetParams cameraTargetParams = characterPrefab.GetComponent <CameraTargetParams>(); cameraTargetParams.cameraParams = Resources.Load <GameObject>("Prefabs/CharacterBodies/CommandoBody").GetComponent <CameraTargetParams>().cameraParams; cameraTargetParams.cameraPivotTransform = null; cameraTargetParams.aimMode = CameraTargetParams.AimType.Standard; cameraTargetParams.recoil = Vector2.zero; cameraTargetParams.idealLocalCameraPos = Vector3.zero; cameraTargetParams.dontRaycastToPivot = false; // this component is used to locate the character model(duh), important to set this up here ModelLocator modelLocator = characterPrefab.GetComponent <ModelLocator>(); modelLocator.modelTransform = transform; modelLocator.modelBaseTransform = gameObject.transform; modelLocator.dontReleaseModelOnDeath = false; modelLocator.autoUpdateModelTransform = true; modelLocator.dontDetatchFromParent = false; modelLocator.noCorpse = false; modelLocator.normalizeToFloor = false; // set true if you want your character to rotate on terrain like acrid does modelLocator.preserveModel = false; // childlocator is something that must be set up in the unity project, it's used to find any child objects for things like footsteps or muzzle flashes // also important to set up if you want quality ChildLocator childLocator = model.GetComponent <ChildLocator>(); // this component is used to handle all overlays and whatever on your character, without setting this up you won't get any cool effects like burning or freeze on the character // it goes on the model object of course CharacterModel characterModel = model.AddComponent <CharacterModel>(); characterModel.body = bodyComponent; characterModel.baseRendererInfos = new CharacterModel.RendererInfo[] { // set up multiple rendererinfos if needed, but for this example there's only the one new CharacterModel.RendererInfo { defaultMaterial = model.GetComponentInChildren <SkinnedMeshRenderer>().material, renderer = model.GetComponentInChildren <SkinnedMeshRenderer>(), defaultShadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.On, ignoreOverlays = false } }; characterModel.autoPopulateLightInfos = true; characterModel.invisibilityCount = 0; characterModel.temporaryOverlays = new List <TemporaryOverlay>(); TeamComponent teamComponent = null; if (characterPrefab.GetComponent <TeamComponent>() != null) { teamComponent = characterPrefab.GetComponent <TeamComponent>(); } else { teamComponent = characterPrefab.GetComponent <TeamComponent>(); } teamComponent.hideAllyCardDisplay = false; teamComponent.teamIndex = TeamIndex.None; HealthComponent healthComponent = characterPrefab.GetComponent <HealthComponent>(); healthComponent.health = 90f; healthComponent.shield = 0f; healthComponent.barrier = 0f; healthComponent.magnetiCharge = 0f; healthComponent.body = null; healthComponent.dontShowHealthbar = false; healthComponent.globalDeathEventChanceCoefficient = 1f; characterPrefab.GetComponent <Interactor>().maxInteractionDistance = 3f; characterPrefab.GetComponent <InteractionDriver>().highlightInteractor = true; // this disables ragdoll since the character's not set up for it, and instead plays a death animation CharacterDeathBehavior characterDeathBehavior = characterPrefab.GetComponent <CharacterDeathBehavior>(); characterDeathBehavior.deathStateMachine = characterPrefab.GetComponent <EntityStateMachine>(); characterDeathBehavior.deathState = new SerializableEntityStateType(typeof(GenericCharacterDeath)); // edit the sfxlocator if you want different sounds SfxLocator sfxLocator = characterPrefab.GetComponent <SfxLocator>(); sfxLocator.deathSound = "Play_ui_player_death"; sfxLocator.barkSound = ""; sfxLocator.openSound = ""; sfxLocator.landingSound = "Play_char_land"; sfxLocator.fallDamageSound = "Play_char_land_fall_damage"; sfxLocator.aliveLoopStart = ""; sfxLocator.aliveLoopStop = ""; Rigidbody rigidbody = characterPrefab.GetComponent <Rigidbody>(); rigidbody.mass = 100f; rigidbody.drag = 0f; rigidbody.angularDrag = 0f; rigidbody.useGravity = false; rigidbody.isKinematic = true; rigidbody.interpolation = RigidbodyInterpolation.None; rigidbody.collisionDetectionMode = CollisionDetectionMode.Discrete; rigidbody.constraints = RigidbodyConstraints.None; CapsuleCollider capsuleCollider = characterPrefab.GetComponent <CapsuleCollider>(); capsuleCollider.isTrigger = false; capsuleCollider.material = null; capsuleCollider.center = new Vector3(0f, 0f, 0f); capsuleCollider.radius = 0.5f; capsuleCollider.height = 1.82f; capsuleCollider.direction = 1; KinematicCharacterMotor kinematicCharacterMotor = characterPrefab.GetComponent <KinematicCharacterMotor>(); kinematicCharacterMotor.CharacterController = characterMotor; kinematicCharacterMotor.Capsule = capsuleCollider; kinematicCharacterMotor.Rigidbody = rigidbody; capsuleCollider.radius = 0.5f; capsuleCollider.height = 1.82f; capsuleCollider.center = new Vector3(0, 0, 0); capsuleCollider.material = null; kinematicCharacterMotor.DetectDiscreteCollisions = false; kinematicCharacterMotor.GroundDetectionExtraDistance = 0f; kinematicCharacterMotor.MaxStepHeight = 0.2f; kinematicCharacterMotor.MinRequiredStepDepth = 0.1f; kinematicCharacterMotor.MaxStableSlopeAngle = 55f; kinematicCharacterMotor.MaxStableDistanceFromLedge = 0.5f; kinematicCharacterMotor.PreventSnappingOnLedges = false; kinematicCharacterMotor.MaxStableDenivelationAngle = 55f; kinematicCharacterMotor.RigidbodyInteractionType = RigidbodyInteractionType.None; kinematicCharacterMotor.PreserveAttachedRigidbodyMomentum = true; kinematicCharacterMotor.HasPlanarConstraint = false; kinematicCharacterMotor.PlanarConstraintAxis = Vector3.up; kinematicCharacterMotor.StepHandling = StepHandlingMethod.None; kinematicCharacterMotor.LedgeHandling = true; kinematicCharacterMotor.InteractiveRigidbodyHandling = true; kinematicCharacterMotor.SafeMovement = false; // this sets up the character's hurtbox, kinda confusing, but should be fine as long as it's set up in unity right HurtBoxGroup hurtBoxGroup = model.AddComponent <HurtBoxGroup>(); HurtBox componentInChildren = model.GetComponentInChildren <CapsuleCollider>().gameObject.AddComponent <HurtBox>(); componentInChildren.gameObject.layer = LayerIndex.entityPrecise.intVal; componentInChildren.healthComponent = healthComponent; componentInChildren.isBullseye = true; componentInChildren.damageModifier = HurtBox.DamageModifier.Normal; componentInChildren.hurtBoxGroup = hurtBoxGroup; componentInChildren.indexInGroup = 0; hurtBoxGroup.hurtBoxes = new HurtBox[] { componentInChildren }; hurtBoxGroup.mainHurtBox = componentInChildren; hurtBoxGroup.bullseyeCount = 1; // this is for handling footsteps, not needed but polish is always good FootstepHandler footstepHandler = model.AddComponent <FootstepHandler>(); footstepHandler.baseFootstepString = "Play_player_footstep"; footstepHandler.sprintFootstepOverrideString = ""; footstepHandler.enableFootstepDust = true; footstepHandler.footstepDustPrefab = Resources.Load <GameObject>("Prefabs/GenericFootstepDust"); // ragdoll controller is a pain to set up so we won't be doing that here.. RagdollController ragdollController = model.AddComponent <RagdollController>(); ragdollController.bones = null; ragdollController.componentsToDisableOnRagdoll = null; // this handles the pitch and yaw animations, but honestly they are nasty and a huge pain to set up so i didn't bother AimAnimator aimAnimator = model.AddComponent <AimAnimator>(); aimAnimator.inputBank = inputBankTest; aimAnimator.directionComponent = characterDirection; aimAnimator.pitchRangeMax = 55f; aimAnimator.pitchRangeMin = -50f; aimAnimator.yawRangeMin = -44f; aimAnimator.yawRangeMax = 44f; aimAnimator.pitchGiveupRange = 30f; aimAnimator.yawGiveupRange = 10f; aimAnimator.giveupDuration = 8f; }
public override void OnEnter() { base.OnEnter(); attackSpeedStat = (body ? body.attackSpeed : 1f) * baseAttackSpeedMultiplier; duration = baseDuration / attackSpeedStat; if (armAnimator) { PlayAnimationOnAnimator(armAnimator, "Additive", "Swing", "Swing.playbackRate", duration); } soundID = Util.PlayAttackSpeedSound(initialSoundString, gameObject, attackSpeedStat); meleeAttackDelay = baseMeleeAttackDelay / attackSpeedStat; attackFireDuration = baseAttackFireDuration / attackSpeedStat; UpdateTransform(); if (isAuthority) { //crit = body && bodyMaster && Util.CheckRoll(body.crit, bodyMaster); hitBoxGroup = gameObject.GetComponentInChildren <HitBoxGroup>(); if (hitBoxGroup) { OverlapAttack overlapAttack = new OverlapAttack(); overlapAttack.attacker = body ? body.gameObject : gameObject; overlapAttack.damage = (body ? body.damage : 1f) * (damageCoefficient + damageCoefficientPerCharge * (body ? (float)body.GetBuffCount(MysticsItemsContent.Buffs.MysticsItems_MechanicalArmCharge) : 0f)); overlapAttack.damageColorIndex = DamageColorIndex.Default; overlapAttack.damageType = DamageType.Generic; overlapAttack.forceVector = forceVector; overlapAttack.hitBoxGroup = hitBoxGroup; overlapAttack.hitEffectPrefab = hitEffectPrefab; NetworkSoundEventDef networkSoundEventDef = impactSound; overlapAttack.impactSound = (networkSoundEventDef != null) ? networkSoundEventDef.index : NetworkSoundEventIndex.Invalid; overlapAttack.inflictor = gameObject; overlapAttack.isCrit = crit; overlapAttack.procChainMask = default(ProcChainMask); overlapAttack.pushAwayForce = pushAwayForce; overlapAttack.procCoefficient = procCoefficient; overlapAttack.teamIndex = TeamComponent.GetObjectTeam(body ? body.gameObject : gameObject); this.overlapAttack = overlapAttack; if (NetworkServer.active) { if (body) { var whiletries = 1000; while (body.HasBuff(MysticsItemsContent.Buffs.MysticsItems_MechanicalArmCharge) && whiletries-- > 0) { body.RemoveBuff(MysticsItemsContent.Buffs.MysticsItems_MechanicalArmCharge); } } /* * while (body && body.HasBuff(MysticsItemsContent.Buffs.MysticsItems_MechanicalArmCharge)) * body.RemoveBuff(MysticsItemsContent.Buffs.MysticsItems_MechanicalArmCharge); */ } } } if (armChildLocator) { for (var i = 1; i <= 6; i++) { var armBone = armChildLocator.FindChild("Arm" + i); if (armBone) { DynamicBone dynamicBone = armBone.GetComponent <DynamicBone>(); if (dynamicBone) { dynamicBone.enabled = false; } } } } }
public override void OnEnter() { base.OnEnter(); Ray aimRay = base.GetAimRay(); this.duration = this.baseDuration; Util.PlaySound(DiggerPlugin.Sounds.Backblast, base.gameObject); base.StartAimMode(0.6f, true); base.characterMotor.disableAirControlUntilCollision = false; float angle = Vector3.Angle(new Vector3(0, -1, 0), aimRay.direction); if (angle < 60) { base.PlayAnimation("FullBody, Override", "BackblastUp"); } else if (angle > 120) { base.PlayAnimation("FullBody, Override", "BackblastDown"); } else { base.PlayAnimation("FullBody, Override", "Backblast"); } if (NetworkServer.active) { base.characterBody.AddBuff(RoR2Content.Buffs.HiddenInvincibility); } if (base.isAuthority) { Vector3 theSpot = aimRay.origin + 2 * aimRay.direction; BlastAttack blastAttack = new BlastAttack(); blastAttack.radius = 14f; blastAttack.procCoefficient = 1f; blastAttack.position = theSpot; blastAttack.attacker = base.gameObject; blastAttack.crit = Util.CheckRoll(base.characterBody.crit, base.characterBody.master); blastAttack.baseDamage = base.characterBody.damage * BackBlast.damageCoefficient; blastAttack.falloffModel = BlastAttack.FalloffModel.None; blastAttack.baseForce = 500f; blastAttack.teamIndex = TeamComponent.GetObjectTeam(blastAttack.attacker); blastAttack.damageType = DamageType.Stun1s; blastAttack.attackerFiltering = AttackerFiltering.NeverHit; BlastAttack.Result result = blastAttack.Fire(); EffectData effectData = new EffectData(); effectData.origin = theSpot; effectData.scale = 15; EffectManager.SpawnEffect(DiggerPlugin.DiggerPlugin.backblastEffect, effectData, false); base.characterMotor.velocity = -80 * aimRay.direction; Compacted?.Invoke(result.hitCount); } }
public Team Put(int id, TeamDTO value) { Team model = ITeamRepository.Get(id); if (value.RealeaseYear != 0) { model.RealeaseYear = value.RealeaseYear; } if (value.Team_name != null) { model.Team_name = value.Team_name; } if (value.Image != null) { model.Image = value.Image; } if (value.ComponentsId != null) { IEnumerable <TeamComponent> teamComponents = ITeamComponentRepository.GetAll().Where(x => x.TeamId == id); foreach (TeamComponent teamComponent in teamComponents) { ITeamComponentRepository.Delete(teamComponent); } for (int i = 0; i < value.ComponentsId.Count; i++) { TeamComponent newTeamComponent = new TeamComponent() { ComponentId = value.ComponentsId[i], TeamId = model.Id }; ITeamComponentRepository.Create(newTeamComponent); } } if (value.Employees != null) { IEnumerable <Employee> employees = IEmployeeRepository.GetAll().Where(x => x.TeamId == id); foreach (Employee employee in employees) { IEmployeeRepository.Delete(employee); } foreach (EmployeeDTO employee in value.Employees) { Employee newEmployee = new Employee() { TeamId = model.Id, First_name = employee.First_name, Second_name = employee.Second_name, Function = employee.Function, Age = employee.Age }; IEmployeeRepository.Create(newEmployee); } } if (value.RacesId != null) { IEnumerable <TeamRace> teamRaces = ITeamRaceRepository.GetAll().Where(x => x.TeamId == id); foreach (TeamRace teamRace in teamRaces) { ITeamRaceRepository.Delete(teamRace); } for (int i = 0; i < value.RacesId.Count; i++) { TeamRace newTeamRace = new TeamRace() { TeamId = model.Id, RaceId = value.RacesId[i] }; ITeamRaceRepository.Create(newTeamRace); } } return(ITeamRepository.Update(model)); }
// Token: 0x06002062 RID: 8290 RVA: 0x00098894 File Offset: 0x00096A94 private void Update() { this.fpsStopwatch += Time.unscaledDeltaTime; this.fpsDisplayStopwatch += Time.unscaledDeltaTime; float num = 1f / Time.unscaledDeltaTime; if (this.fpsStopwatch >= 1f / this.fpsAverageFrequency) { this.fpsStopwatch = 0f; DebugStats.fpsTimestamps.Enqueue(num); if (DebugStats.fpsTimestamps.Count > this.fpsTimestampCount) { DebugStats.fpsTimestamps.Dequeue(); } } if (this.fpsDisplayStopwatch > this.fpsAverageDisplayUpdateFrequency) { this.fpsDisplayStopwatch = 0f; float averageFPS = this.GetAverageFPS(); this.fpsAverageText.text = string.Concat(new string[] { "FPS: ", Mathf.Round(num).ToString(), " (", averageFPS.ToString(), ")" }); TextMeshProUGUI textMeshProUGUI = this.fpsAverageText; textMeshProUGUI.text = string.Concat(new string[] { textMeshProUGUI.text, "\n ms: ", (Mathf.Round(100000f / num) / 100f).ToString(), "(", (Mathf.Round(100000f / averageFPS) / 100f).ToString(), ")" }); } this.budgetStopwatch += Time.unscaledDeltaTime; this.budgetDisplayStopwatch += Time.unscaledDeltaTime; float num2 = (float)VFXBudget.totalCost; if (this.budgetStopwatch >= 1f / this.budgetAverageFrequency) { this.budgetStopwatch = 0f; DebugStats.budgetTimestamps.Enqueue(num2); if (DebugStats.budgetTimestamps.Count > this.budgetTimestampCount) { DebugStats.budgetTimestamps.Dequeue(); } } if (this.budgetDisplayStopwatch > 1f) { this.budgetDisplayStopwatch = 0f; float averageParticleCost = this.GetAverageParticleCost(); this.budgetAverageText.text = string.Concat(new string[] { "Particle Cost: ", Mathf.Round(num2).ToString(), " (", averageParticleCost.ToString(), ")" }); } if (this.teamText) { string str = "Allies: " + TeamComponent.GetTeamMembers(TeamIndex.Player).Count + "\n"; string str2 = "Enemies: " + TeamComponent.GetTeamMembers(TeamIndex.Monster).Count + "\n"; string str3 = "Bosses: " + BossGroup.GetTotalBossCount() + "\n"; string text = "Directors:"; foreach (CombatDirector combatDirector in CombatDirector.instancesList) { string text2 = "\n==[" + combatDirector.gameObject.name + "]=="; if (combatDirector.enabled) { string text3 = "\n - Credit: " + combatDirector.monsterCredit.ToString(); string text4 = "\n - Target: " + (combatDirector.currentSpawnTarget ? combatDirector.currentSpawnTarget.name : "null"); string text5 = "\n - Last Spawn Card: "; if (combatDirector.lastAttemptedMonsterCard != null && combatDirector.lastAttemptedMonsterCard.spawnCard) { text5 += combatDirector.lastAttemptedMonsterCard.spawnCard.name; } string text6 = "\n - Reroll Timer: " + Mathf.Round(combatDirector.monsterSpawnTimer); text2 = string.Concat(new string[] { text2, text3, text4, text5, text6 }); } else { text2 += " (Off)"; } text = text + text2 + "\n \n"; } this.teamText.text = str + str2 + str3 + text; } }
private static void ReplaceTeam(GameEntity company, TeamComponent t) { company.ReplaceTeam(t.Morale, t.Organisation, t.Managers, t.Workers, t.TeamStatus); }