// Token: 0x06002C46 RID: 11334 RVA: 0x000BAEC8 File Offset: 0x000B90C8 public override void FixedUpdate() { base.FixedUpdate(); if (!this.reloaded && base.fixedAge >= this.reloadTime) { if (base.skillLocator) { GenericSkill primary = base.skillLocator.primary; if (primary) { primary.Reset(); Util.PlaySound(Reload.soundString, base.gameObject); } } this.reloaded = true; } if (base.fixedAge >= this.duration && base.isAuthority) { this.outer.SetNextStateToMain(); return; } }
public override void WriteNewHooks() { if (BarrageScalesWithAttackSpeed.Value && BarrageScaleModifier.IsNotDefault()) { On.EntityStates.Commando.CommandoWeapon.FireBarrage.OnEnter += (orig, self) => { orig(self); Assembly assembly = self.GetType().Assembly; Type fireBarr = assembly.GetClass("EntityStates.Commando.CommandoWeapon", "FireBarrage"); FieldInfo attackSpeed = typeof(BaseState).GetField("attackSpeedStat", BindingFlags.NonPublic | BindingFlags.Instance); FieldInfo durationBetweenShots = fireBarr.GetField("durationBetweenShots", BindingFlags.NonPublic | BindingFlags.Instance); float attackSpeedF = (float)attackSpeed?.GetValue(self); int baseShot = BarrageBaseShotAmount.ValueConfigWrapper.IsDefault() ? VanillaBarrageBaseShotAmount : BarrageBaseShotAmount.ValueConfigWrapper.Value; durationBetweenShots?.SetValue(self, (BarrageBaseDurationBetweenShots.ValueConfigWrapper.IsDefault() ? VanillaBarrageBaseDurationBetweenShots : BarrageBaseDurationBetweenShots.ValueConfigWrapper.FloatValue) / attackSpeedF / BarrageScaleModifier.FloatValue); fireBarr.SetFieldValue("bulletCount", baseShot + (int)((attackSpeedF - 1) * BarrageScaleModifier.FloatValue * baseShot)); }; } On.EntityStates.Commando.DodgeState.OnEnter += (orig, self) => { orig(self); if (DashResetsSecondCooldown.Value) { Assembly assembly = self.GetType().Assembly; Type entityState = assembly.GetClass("EntityStates", "EntityState"); SkillLocator locator = (SkillLocator)entityState .GetProperty("skillLocator", BindingFlags.NonPublic | BindingFlags.Instance) ?.GetValue(self, null); GenericSkill skill2 = locator.GetSkill(SkillSlot.Secondary); skill2.Reset(); } if (DashInvulnerability.Value) { if (DashInvulnerabilityTimer.IsDefault()) { Transform transform = self.InvokeMethod <Transform>("GetModelTransform"); HurtBoxGroup hurtBoxGroup = transform.GetComponent <HurtBoxGroup>(); ++hurtBoxGroup.hurtBoxesDeactivatorCounter; } else { self.outer.commonComponents.characterBody.AddTimedBuff(BuffIndex.HiddenInvincibility, DashInvulnerabilityTimer.FloatValue); } } }; On.EntityStates.Commando.DodgeState.OnExit += (orig, self) => { if (DashInvulnerability.Value && DashInvulnerabilityTimer.IsDefault()) { Transform transform = self.InvokeMethod <Transform>("GetModelTransform"); HurtBoxGroup hurtBoxGroup = transform.GetComponent <HurtBoxGroup>(); --hurtBoxGroup.hurtBoxesDeactivatorCounter; } orig(self); }; if (PistolHitLowerBarrageCooldown.Value && PistolHitLowerBarrageCooldownPercent.IsNotDefault()) { Type gsType = typeof(GenericSkill); FieldInfo rechargeStopwatch = gsType.GetField("rechargeStopwatch", BindingFlags.NonPublic | BindingFlags.Instance); FieldInfo finalRechargeInterval = gsType.GetField("finalRechargeInterval", BindingFlags.NonPublic | BindingFlags.Instance); IL.EntityStates.Commando.CommandoWeapon.FirePistol2.FireBullet += il => { ILCursor c = new ILCursor(il); c.GotoNext(x => x.MatchCallvirt(typeof(RoR2.BulletAttack).FullName, "Fire")); c.EmitDelegate <Func <BulletAttack, BulletAttack> >((BulletAttack ba) => { ba.hitCallback = (ref BulletAttack.BulletHit info) => { bool result = ba.DefaultHitCallback(ref info); if (info.entityObject?.GetComponent <HealthComponent>()) { SkillLocator skillLocator = ba.owner.GetComponent <SkillLocator>(); GenericSkill special = skillLocator.special; rechargeStopwatch.SetValue(special, (float)rechargeStopwatch.GetValue(special) + (float)finalRechargeInterval.GetValue(special) * PistolHitLowerBarrageCooldownPercent.FloatValue); } return(result); }; return(ba); }); }; } }