// Token: 0x0600308B RID: 12427 RVA: 0x000D147C File Offset: 0x000CF67C
 private void FireBullet(Transform modelTransform, Ray laserRay, string targetMuzzle)
 {
     if (this.effectPrefab)
     {
         EffectManager.SimpleMuzzleFlash(this.effectPrefab, base.gameObject, targetMuzzle, false);
     }
     if (base.isAuthority)
     {
         BulletAttack bulletAttack = new BulletAttack();
         bulletAttack.owner           = base.gameObject;
         bulletAttack.weapon          = base.gameObject;
         bulletAttack.origin          = laserRay.origin;
         bulletAttack.aimVector       = laserRay.direction;
         bulletAttack.minSpread       = this.minSpread;
         bulletAttack.maxSpread       = this.maxSpread;
         bulletAttack.bulletCount     = 1U;
         bulletAttack.damage          = this.damageCoefficient * this.damageStat / this.fireFrequency;
         bulletAttack.procCoefficient = this.procCoefficient / this.fireFrequency;
         bulletAttack.force           = this.force;
         bulletAttack.muzzleName      = targetMuzzle;
         bulletAttack.hitEffectPrefab = this.hitEffectPrefab;
         bulletAttack.isCrit          = Util.CheckRoll(this.critStat, base.characterBody.master);
         bulletAttack.HitEffectNormal = false;
         bulletAttack.radius          = 0f;
         bulletAttack.maxDistance     = this.maxDistance;
         this.ModifyBullet(bulletAttack);
         bulletAttack.Fire();
     }
 }
Esempio n. 2
0
 //Called by base onenter, we replace it with our own special bullet
 public override void FireBullet(Ray aimRay)
 {
     //Play the sound
     Util.PlaySound(this.assetRef.fireSoundString, base.gameObject);
     //Network check
     if (base.isAuthority)
     {
         //Set the damage accordingly
         this.damage = this.baseDamageCoef * base.characterBody.damage;
         //Create the bulletattack
         attack = new BulletAttack
         {
             origin             = aimRay.origin,
             aimVector          = aimRay.direction,
             tracerEffectPrefab = this.assetRef.tracerEffectPrefab,
             muzzleName         = this.assetRef.muzzleName,
             hitEffectPrefab    = this.assetRef.hitEffectPrefab,
             damage             = this.damage,
             owner           = base.gameObject,
             isCrit          = this.isCrit,
             maxDistance     = 1000f,
             smartCollision  = true,
             procCoefficient = this.procCoef,
             HitEffectNormal = false,
             falloffModel    = BulletAttack.FalloffModel.None,
             weapon          = base.gameObject,
             hitCallback     = CallBack
         };
         //Fire
         attack.Fire();
     }
     //Apply the muzzleflash
     EffectManager.SimpleMuzzleFlash(assetRef.muzzleFlashPrefab, base.gameObject, this.assetRef.muzzleName, false);
 }
Esempio n. 3
0
        public override void OnEnter()
        {
            base.OnEnter();
            this.duration = FireLightsOut.baseDuration / this.attackSpeedStat;
            base.AddRecoil(-3f * FireLightsOut.recoilAmplitude, -4f * FireLightsOut.recoilAmplitude, -0.5f * FireLightsOut.recoilAmplitude, 0.5f * FireLightsOut.recoilAmplitude);
            Ray aimRay = base.GetAimRay();

            base.StartAimMode(aimRay, 2f, false);
            string muzzleName = "MuzzlePistol";

            Util.PlaySound(FireLightsOut.attackSoundString, base.gameObject);
            base.PlayAnimation("Gesture, Additive", "FireRevolver");
            base.PlayAnimation("Gesture, Override", "FireRevolver");
            if (FireLightsOut.effectPrefab)
            {
                EffectManager.SimpleMuzzleFlash(FireLightsOut.effectPrefab, base.gameObject, muzzleName, false);
            }
            if (base.isAuthority)
            {
                BulletAttack bulletAttack = new BulletAttack();
                bulletAttack.owner              = base.gameObject;
                bulletAttack.weapon             = base.gameObject;
                bulletAttack.origin             = aimRay.origin;
                bulletAttack.aimVector          = aimRay.direction;
                bulletAttack.minSpread          = FireLightsOut.minSpread;
                bulletAttack.maxSpread          = FireLightsOut.maxSpread;
                bulletAttack.bulletCount        = (uint)((FireLightsOut.bulletCount > 0) ? FireLightsOut.bulletCount : 0);
                bulletAttack.damage             = FireLightsOut.damageCoefficient * this.damageStat;
                bulletAttack.force              = FireLightsOut.force;
                bulletAttack.falloffModel       = BulletAttack.FalloffModel.None;
                bulletAttack.tracerEffectPrefab = FireLightsOut.tracerEffectPrefab;
                bulletAttack.muzzleName         = muzzleName;
                bulletAttack.hitEffectPrefab    = FireLightsOut.hitEffectPrefab;
                bulletAttack.isCrit             = Util.CheckRoll(this.critStat, base.characterBody.master);
                bulletAttack.HitEffectNormal    = false;
                bulletAttack.radius             = 0.5f;
                bulletAttack.maxDistance        = 500f;

                if (!ignoreArmor)
                {
                    bulletAttack.damageType |= DamageType.ResetCooldownsOnKill;
                }
                else
                {
                    bulletAttack.damageType = (DamageType.ResetCooldownsOnKill | DamageType.BypassArmor);
                }
                bulletAttack.smartCollision = true;

                if (gainDamageWithLevel)
                {
                    float bonusDamage = gainDamgeWithLevelAmount * (base.gameObject.GetComponent <CharacterBody>().level - 1);
                    if (gainDamgeWithLevelMax > 0f && bonusDamage > gainDamgeWithLevelMax)
                    {
                        bonusDamage = gainDamgeWithLevelMax;
                    }
                    bulletAttack.damage = (FireLightsOut.damageCoefficient + bonusDamage) * this.damageStat;
                }
                bulletAttack.Fire();
            }
        }
Esempio n. 4
0
        private void FireMissile(HurtBox target, Vector3 position)
        {
            var aimVector = target.transform.position - position;

            BulletAttack bulletAttack = default;

            bulletAttack.owner              = base.gameObject;
            bulletAttack.weapon             = base.gameObject;
            bulletAttack.origin             = position;
            bulletAttack.aimVector          = aimVector;
            bulletAttack.minSpread          = this.minSpread;
            bulletAttack.maxSpread          = this.maxSpread;
            bulletAttack.bulletCount        = 1U;
            bulletAttack.damage             = damageCoefficient * this.damageStat;
            bulletAttack.force              = this.force;
            bulletAttack.falloffModel       = BulletAttack.FalloffModel.None;
            bulletAttack.tracerEffectPrefab = this.tracerEffectPrefab;
            bulletAttack.muzzleName         = "MuzzlePistol";
            bulletAttack.hitEffectPrefab    = this.hitEffectPrefab;
            bulletAttack.isCrit             = base.RollCrit();
            bulletAttack.HitEffectNormal    = false;
            bulletAttack.radius             = this.bulletRadius;
            bulletAttack.damageType        |= DamageType.BonusToLowHealth | DamageType.GiveSkullOnKill;
            bulletAttack.smartCollision     = true;
            bulletAttack.Fire();
        }
 // Token: 0x06000763 RID: 1891 RVA: 0x000243B8 File Offset: 0x000225B8
 private void FireBullet(Transform modelTransform, Ray aimRay, string targetMuzzle)
 {
     if (FireBeam.effectPrefab)
     {
         EffectManager.instance.SimpleMuzzleFlash(FireBeam.effectPrefab, base.gameObject, targetMuzzle, false);
     }
     if (base.isAuthority)
     {
         BulletAttack bulletAttack = new BulletAttack();
         bulletAttack.owner           = base.gameObject;
         bulletAttack.weapon          = base.gameObject;
         bulletAttack.origin          = aimRay.origin;
         bulletAttack.aimVector       = aimRay.direction;
         bulletAttack.minSpread       = FireBeam.minSpread;
         bulletAttack.maxSpread       = FireBeam.maxSpread;
         bulletAttack.bulletCount     = 1u;
         bulletAttack.damage          = FireBeam.damageCoefficient * this.damageStat / FireBeam.fireFrequency;
         bulletAttack.force           = FireBeam.force;
         bulletAttack.muzzleName      = targetMuzzle;
         bulletAttack.hitEffectPrefab = FireBeam.hitEffectPrefab;
         bulletAttack.isCrit          = Util.CheckRoll(this.critStat, base.characterBody.master);
         bulletAttack.HitEffectNormal = false;
         bulletAttack.radius          = 0f;
         bulletAttack.maxDistance     = FireBeam.maxDistance;
         bulletAttack.damageType     |= DamageType.SlowOnHit;
         bulletAttack.Fire();
     }
 }
Esempio n. 6
0
        private void FireShotgun2_FireBullet(On.EntityStates.Bandit2.Weapon.FireShotgun2.orig_FireBullet orig, EntityStates.Bandit2.Weapon.FireShotgun2 self, Ray aimRay)
        {
            self.StartAimMode(aimRay, 3f, false);
            self.DoFireEffects();
            self.PlayFireAnimation();
            self.AddRecoil(-1f * self.recoilAmplitudeY, -1.5f * self.recoilAmplitudeY, -1f * self.recoilAmplitudeX, 1f * self.recoilAmplitudeX);
            if (self.isAuthority)
            {
                Vector3 rhs         = Vector3.Cross(Vector3.up, aimRay.direction);
                Vector3 axis        = Vector3.Cross(aimRay.direction, rhs);
                float   spreadBloom = self.characterBody.spreadBloomAngle;

                float angle = 0f;
                float num2  = 0f;
                if (self.bulletCount > 1)
                { //here
                    var ResultMult = CalculateSpreadMultiplier(self.characterBody.inventory, false);
                    num2 = UnityEngine.Random.Range(SimpleSpread(ResultMult, self.minFixedSpreadYaw + spreadBloom),
                                                    SimpleSpread(ResultMult, self.maxFixedSpreadYaw + spreadBloom)) * 2f;
                    angle = num2 / (self.bulletCount - 1);
                }
                Vector3    direction = Quaternion.AngleAxis(-num2 * 0.5f, axis) * aimRay.direction;
                Quaternion rotation  = Quaternion.AngleAxis(angle, axis);
                Ray        aimRay2   = new Ray(aimRay.origin, direction);
                for (int i = 0; i < self.bulletCount; i++)
                {
                    BulletAttack bulletAttack = self.GenerateBulletAttack(aimRay2);
                    self.ModifyBullet(bulletAttack);
                    bulletAttack.Fire();
                    aimRay2.direction = rotation * aimRay2.direction;
                }
            }
        }
Esempio n. 7
0
 private void FireBullet(Transform modelTransform, Ray aimRay, string targetMuzzle, float maxDistance)
 {
     if ((bool)effectPrefab)
     {
         EffectManager.SimpleMuzzleFlash(effectPrefab, base.gameObject, targetMuzzle, transmit: false);
     }
     if (base.isAuthority)
     {
         BulletAttack bulletAttack = new BulletAttack();
         bulletAttack.owner           = base.gameObject;
         bulletAttack.weapon          = base.gameObject;
         bulletAttack.origin          = aimRay.origin;
         bulletAttack.aimVector       = aimRay.direction;
         bulletAttack.minSpread       = minSpread;
         bulletAttack.maxSpread       = maxSpread;
         bulletAttack.bulletCount     = 1u;
         bulletAttack.damage          = damageCoefficient * damageStat / fireFrequency;
         bulletAttack.force           = force;
         bulletAttack.muzzleName      = targetMuzzle;
         bulletAttack.hitEffectPrefab = hitEffectPrefab;
         bulletAttack.isCrit          = Util.CheckRoll(critStat, base.characterBody.master);
         bulletAttack.procCoefficient = procCoefficientPerTick;
         bulletAttack.HitEffectNormal = false;
         bulletAttack.radius          = 0f;
         bulletAttack.maxDistance     = maxDistance;
         bulletAttack.Fire();
     }
 }
Esempio n. 8
0
        private void FireBeam_FixedUpdate(On.EntityStates.EngiTurret.EngiTurretWeapon.FireBeam.orig_FixedUpdate orig, FireBeam self)
        {
            float optionFireTimer = self.fireTimer + Time.fixedDeltaTime;

            orig(self);
            if (DroneNameCheck(self.characterBody, "RoboBallGreenBuddy") || DroneNameCheck(self.characterBody, "RoboBallRedBuddy"))
            {
                FireForAllOptions(self.characterBody, (option, behavior, target, direction) =>
                {
                    Ray laserRay   = new Ray(option.transform.position, direction);
                    float rate     = self.fireFrequency * self.characterBody.attackSpeed;
                    float fraction = 1f / rate;
                    if (optionFireTimer > fraction)
                    {
                        if (self.effectPrefab)
                        {
                            option.MuzzleEffect(self.effectPrefab, false);
                        }
                        if (self.isAuthority)
                        {
                            BulletAttack bulletAttack = new BulletAttack()
                            {
                                owner           = self.gameObject,
                                weapon          = option,
                                origin          = laserRay.origin,
                                aimVector       = laserRay.direction,
                                minSpread       = self.minSpread,
                                maxSpread       = self.maxSpread,
                                bulletCount     = 1U,
                                damage          = self.damageCoefficient * self.damageStat / self.fireFrequency * damageMultiplier,
                                procCoefficient = self.procCoefficient * self.fireFrequency,
                                force           = self.force * damageMultiplier,
                                muzzleName      = self.muzzleString,
                                hitEffectPrefab = self.hitEffectPrefab,
                                isCrit          = self.characterBody.RollCrit(),
                                HitEffectNormal = false,
                                radius          = 0f,
                                maxDistance     = self.maxDistance
                            };
                            self.ModifyBullet(bulletAttack);
                            if (!empathyCoresOptionSyncEffect)
                            {
                                bulletAttack.tracerEffectPrefab = FireGatling.tracerEffectPrefab;
                            }
                            bulletAttack.Fire();
                        }
                    }
                    if (empathyCoresOptionSyncEffect && behavior.U.SafeCheck("laserEffectInstance") && behavior.U.SafeCheck("laserEffectInstanceEndTransform"))
                    {
                        Vector3 position = ((GameObject)behavior.U["laserEffectInstance"]).transform.parent.position;
                        Vector3 point    = laserRay.GetPoint(self.maxDistance);
                        if (Physics.Raycast(laserRay.origin, laserRay.direction, out RaycastHit raycastHit, self.maxDistance,
                                            LayerIndex.world.mask | LayerIndex.entityPrecise.mask, QueryTriggerInteraction.UseGlobal))
                        {
                            point = raycastHit.point;
                        }
                        ((Transform)behavior.U["laserEffectInstanceEndTransform"]).position = point;
                    }
                });
 // Token: 0x0600038B RID: 907 RVA: 0x0000E544 File Offset: 0x0000C744
 protected virtual void FireBullet(Ray aimRay)
 {
     base.StartAimMode(aimRay, 3f, false);
     this.DoFireEffects();
     this.PlayFireAnimation();
     if (base.isAuthority)
     {
         BulletAttack bulletAttack = this.GenerateBulletAttack(aimRay);
         this.ModifyBullet(bulletAttack);
         bulletAttack.Fire();
     }
 }
 // Token: 0x06002A06 RID: 10758 RVA: 0x000B0A24 File Offset: 0x000AEC24
 protected virtual void FireBullet(Ray aimRay)
 {
     base.StartAimMode(aimRay, 3f, false);
     this.DoFireEffects();
     this.PlayFireAnimation();
     base.AddRecoil(-1f * this.recoilAmplitudeY, -1.5f * this.recoilAmplitudeY, -1f * this.recoilAmplitudeX, 1f * this.recoilAmplitudeX);
     if (base.isAuthority)
     {
         BulletAttack bulletAttack = this.GenerateBulletAttack(aimRay);
         this.ModifyBullet(bulletAttack);
         bulletAttack.Fire();
     }
 }
Esempio n. 11
0
        public override void OnEnter()
        {
            base.OnEnter();

            duration = baseDuration / attackSpeedStat;
            AddRecoil(-3f * recoilAmplitude, -4f * recoilAmplitude, -0.5f * recoilAmplitude, 0.5f * recoilAmplitude);
            Ray aimRay = GetAimRay();

            StartAimMode(aimRay, 2f, false);
            string muzzleName = "MuzzlePistol";

            Util.PlaySound(attackSoundString, gameObject);
            PlayAnimation("Gesture, Additive", "FireRevolver");
            PlayAnimation("Gesture, Override", "FireRevolver");
            if (effectPrefab)
            {
                EffectManager.instance.SimpleMuzzleFlash(effectPrefab, gameObject, muzzleName, true);
            }
            if (isAuthority)
            {
                skill = gameObject?.GetComponentInChildren <SkillLocator>();
                BulletAttack bulletAttack = new BulletAttack
                {
                    owner              = gameObject,
                    weapon             = gameObject,
                    origin             = aimRay.origin,
                    aimVector          = aimRay.direction,
                    minSpread          = minSpread,
                    maxSpread          = maxSpread,
                    bulletCount        = (uint)((bulletCount > 0) ? bulletCount : 0),
                    damage             = damageCoefficient * damageStat,
                    force              = force,
                    falloffModel       = BulletAttack.FalloffModel.None,
                    tracerEffectPrefab = tracerEffectPrefab,
                    muzzleName         = muzzleName,
                    hitEffectPrefab    = hitEffectPrefab,
                    isCrit             = Util.CheckRoll(critStat, characterBody.master),
                    HitEffectNormal    = false,
                    radius             = 0.5f,
                    smartCollision     = true
                };
                bulletAttack.damageType |= DamageType.ResetCooldownsOnKill;
                if (Timer.Timer.flag)
                {
                    bulletAttack.hitCallback = new BulletAttack.HitCallback(Hit) + bulletAttack.hitCallback;
                }
                bulletAttack.Fire();
            }
        }
            private void ShootAtTarget()
            {
                FindTarget();
                //this.targetFinder.maxDistanceFilter = cfgWolfRadius.Value;
                this.targetFinder.RefreshCandidates();
                this.targetFinder.FilterOutGameObject(base.gameObject);

                var result = targetFinder.GetResults().FirstOrDefault <HurtBox>();

                if (result)
                {
                    BulletAttack bulletAttack = new BulletAttack()
                    {
                        aimVector          = characterMaster.GetBody().corePosition - result.healthComponent.body.corePosition,
                        bulletCount        = (uint)cfgChainsPelletCount.Value,
                        damage             = cfgChainsDamageCoefficient.Value * characterMaster.GetBody().damage,
                        damageType         = DamageType.Generic,
                        owner              = gameObject,
                        falloffModel       = BulletAttack.FalloffModel.Buckshot,
                        tracerEffectPrefab = EntityStates.CaptainDefenseMatrixItem.DefenseMatrixOn.tracerEffectPrefab
                    };
                    bulletAttack.Fire();
                }
            }
 public override void FireBullet(Ray aimRay)
 {
     base.StartAimMode(aimRay, 3f, false);
     this.DoFireEffects();
     this.PlayFireAnimation();
     base.AddRecoil(-1f * this.recoilAmplitudeY, -1.5f * this.recoilAmplitudeY, -1f * this.recoilAmplitudeX, 1f * this.recoilAmplitudeX);
     if (base.isAuthority)
     {
         Vector3 rhs  = Vector3.Cross(Vector3.up, aimRay.direction);
         Vector3 axis = Vector3.Cross(aimRay.direction, rhs);
         float   num  = 0f;
         if (base.characterBody)
         {
             num = base.characterBody.spreadBloomAngle;
         }
         float angle = 0f;
         float num2  = 0f;
         if (this.bulletCount > 1)
         {
             var accuracy = statsController.bulletAccuracy;
             num2 = UnityEngine.Random.Range(SimpleSpread(accuracy, this.minFixedSpreadYaw + num),
                                             SimpleSpread(accuracy, this.maxFixedSpreadYaw + num)) * 2f;
             angle = num2 / (float)(this.bulletCount - 1);
         }
         Vector3    direction = Quaternion.AngleAxis(-num2 * 0.5f, axis) * aimRay.direction;
         Quaternion rotation  = Quaternion.AngleAxis(angle, axis);
         Ray        aimRay2   = new Ray(aimRay.origin, direction);
         for (int i = 0; i < this.bulletCount; i++)
         {
             BulletAttack bulletAttack = base.GenerateBulletAttack(aimRay2);
             this.ModifyBullet(bulletAttack);
             bulletAttack.Fire();
             aimRay2.direction = rotation * aimRay2.direction;
         }
     }
 }
        // Token: 0x06002E87 RID: 11911 RVA: 0x000C5B08 File Offset: 0x000C3D08
        private void FireBeamServer(Ray aimRay, GameObject tracerEffectPrefab, float maxDistance, bool isInitialBeam)
        {
            bool         didHit       = false;
            BulletAttack bulletAttack = new BulletAttack
            {
                origin                  = aimRay.origin,
                aimVector               = aimRay.direction,
                bulletCount             = 1U,
                damage                  = base.GetDamage() * FireMainBeamState.mainBeamDamageCoefficient,
                damageColorIndex        = DamageColorIndex.Item,
                damageType              = DamageType.Generic,
                falloffModel            = BulletAttack.FalloffModel.None,
                force                   = FireMainBeamState.mainBeamForce,
                hitEffectPrefab         = FireMainBeamState.mainBeamImpactEffect,
                HitEffectNormal         = false,
                hitMask                 = LayerIndex.entityPrecise.mask,
                isCrit                  = this.isCrit,
                maxDistance             = maxDistance,
                minSpread               = 0f,
                maxSpread               = 0f,
                muzzleName              = "",
                owner                   = base.ownerBody.gameObject,
                procChainMask           = default(ProcChainMask),
                procCoefficient         = FireMainBeamState.mainBeamProcCoefficient,
                queryTriggerInteraction = QueryTriggerInteraction.UseGlobal,
                radius                  = FireMainBeamState.mainBeamRadius,
                smartCollision          = true,
                sniper                  = false,
                spreadPitchScale        = 1f,
                spreadYawScale          = 1f,
                stopperMask             = LayerIndex.world.mask,
                tracerEffectPrefab      = (isInitialBeam ? tracerEffectPrefab : null),
                weapon                  = base.gameObject
            };
            TeamIndex teamIndex = base.ownerBody.teamComponent.teamIndex;

            bulletAttack.hitCallback = delegate(ref BulletAttack.BulletHit info)
            {
                bool flag = bulletAttack.DefaultHitCallback(ref info);
                if (!isInitialBeam)
                {
                    return(true);
                }
                if (flag)
                {
                    HealthComponent healthComponent = info.hitHurtBox ? info.hitHurtBox.healthComponent : null;
                    if (healthComponent && healthComponent.alive && info.hitHurtBox.teamIndex != teamIndex)
                    {
                        flag = false;
                    }
                }
                if (!flag)
                {
                    didHit = true;
                    this.beamHitPosition = info.point;
                }
                return(flag);
            };
            bulletAttack.Fire();
            if (!didHit)
            {
                RaycastHit raycastHit;
                if (Physics.Raycast(aimRay, out raycastHit, FireMainBeamState.mainBeamMaxDistance, LayerIndex.world.mask, QueryTriggerInteraction.Ignore))
                {
                    didHit = true;
                    this.beamHitPosition = raycastHit.point;
                }
                else
                {
                    this.beamHitPosition = aimRay.GetPoint(FireMainBeamState.mainBeamMaxDistance);
                }
            }
            if (didHit & isInitialBeam)
            {
                FireProjectileInfo fireProjectileInfo = default(FireProjectileInfo);
                fireProjectileInfo.projectilePrefab = FireMainBeamState.secondBombPrefab;
                fireProjectileInfo.owner            = base.ownerBody.gameObject;
                fireProjectileInfo.position         = this.beamHitPosition - aimRay.direction * 0.5f;
                fireProjectileInfo.rotation         = Quaternion.identity;
                fireProjectileInfo.damage           = base.GetDamage() * FireMainBeamState.secondBombDamageCoefficient;
                fireProjectileInfo.damageColorIndex = DamageColorIndex.Item;
                fireProjectileInfo.crit             = this.isCrit;
                ProjectileManager.instance.FireProjectile(fireProjectileInfo);
            }
            if (!isInitialBeam)
            {
                EffectData effectData = new EffectData
                {
                    origin = aimRay.origin,
                    start  = base.transform.position
                };
                effectData.SetNetworkedObjectReference(base.gameObject);
                EffectManager.SpawnEffect(tracerEffectPrefab, effectData, true);
            }
        }
Esempio n. 15
0
        private void FireProjectiles()
        {
            if (!this.hasFallen)
            {
                this.hasFallen = true;

                if (this.cometParticle)
                {
                    this.cometParticle.Play();
                }

                Util.PlayAttackSpeedSound(DiggerPlugin.Sounds.ToTheStars, base.gameObject, 0.5f);

                base.gameObject.layer = LayerIndex.defaultLayer.intVal;
                base.characterMotor.Motor.RebuildCollidableLayers();

                base.PlayAnimation("FullBody, Override", "FallingCometEnd");

                Transform modelTransform = base.GetModelTransform();
                if (modelTransform)
                {
                    TemporaryOverlay temporaryOverlay = modelTransform.gameObject.AddComponent <TemporaryOverlay>();
                    temporaryOverlay.duration              = 2.5f;
                    temporaryOverlay.animateShaderAlpha    = true;
                    temporaryOverlay.alphaCurve            = AnimationCurve.EaseInOut(0f, 1f, 1f, 0f);
                    temporaryOverlay.destroyComponentOnEnd = true;
                    temporaryOverlay.originalMaterial      = Resources.Load <Material>("Materials/matOnFire");
                    temporaryOverlay.AddToCharacerModel(modelTransform.GetComponent <CharacterModel>());
                }

                if (base.isAuthority)
                {
                    Ray     aimRay = base.GetAimRay();
                    Vector3 aimer  = Vector3.down;

                    BulletAttack bulletAttack = new BulletAttack
                    {
                        owner              = base.gameObject,
                        weapon             = base.gameObject,
                        muzzleName         = "Chest",
                        origin             = aimRay.origin,
                        aimVector          = aimer,
                        minSpread          = 0f,
                        maxSpread          = base.characterBody.spreadBloomAngle,
                        radius             = 0.35f,
                        bulletCount        = 1U,
                        procCoefficient    = .5f,
                        damage             = base.characterBody.damage * ToTheStars.damageCoefficient,
                        force              = 3,
                        falloffModel       = BulletAttack.FalloffModel.None,
                        tracerEffectPrefab = this.tracerEffectPrefab,
                        hitEffectPrefab    = this.hitEffectPrefab,
                        isCrit             = base.RollCrit(),
                        HitEffectNormal    = false,
                        stopperMask        = LayerIndex.world.mask,
                        smartCollision     = true,
                        maxDistance        = 300f
                    };

                    for (int j = 0; j < 3; j++)
                    {
                        for (int i = 0; i <= 9; i++)
                        {
                            float theta = Random.Range(0.0f, 6.28f);
                            float x     = Mathf.Cos(theta);
                            float z     = Mathf.Sin(theta);
                            float c     = i * 0.3777f;
                            c       *= (1f / 12f);
                            aimer.x += c * x;
                            aimer.z += c * z;
                            bulletAttack.aimVector = aimer;
                            bulletAttack.Fire();
                            aimer = Vector3.down;
                        }
                    }

                    EffectData effectData = new EffectData();
                    effectData.origin   = aimRay.origin + (1 * Vector3.down);
                    effectData.scale    = 8;
                    effectData.rotation = major;

                    EffectManager.SpawnEffect(smokeEffectPrefab, effectData, true);
                    effectData.scale = 16;
                    EffectManager.SpawnEffect(flashEffectPrefab, effectData, true);
                }
            }
        }
Esempio n. 16
0
        private void EquipmentSlot_Execute(On.RoR2.EquipmentSlot.orig_Execute orig, EquipmentSlot self)
        {
            if (NetworkServer.active)
            {
                var characterBody = self.characterBody;
                if (characterBody)
                {
                    var inventory = characterBody.inventory;
                    if (inventory && inventory.GetItemCount(catalogIndex) > 0)
                    {
                        var gameObject = characterBody.gameObject;
                        var inputBank  = characterBody.inputBank;
                        var master     = characterBody.master;

                        /*
                         * if (inputBank)
                         * {
                         *  var skill1 = inputBank.skill1;
                         *  var wasPressed = skill1.down;
                         *  var lastDirection = inputBank.aimDirection;
                         *  var segment = RingTriggers_Radius / Mathf.Max(RingTriggers_FireAmount,1);
                         *  master.enabled = false;
                         *  for (int i = 0; i < RingTriggers_FireAmount; i++)
                         *  {
                         *      skill1.PushState(true);
                         *      inputBank.aimDirection = new Vector3(inputBank.aimDirection.x, segment*(i+1), inputBank.aimDirection.y);
                         *  }
                         *  skill1.PushState(wasPressed);
                         *  inputBank.aimDirection = lastDirection;
                         *  master.enabled = true;
                         * }*/

                        var skillLocator = characterBody.skillLocator;
                        Debug.Log("Primary Skilltoken " + skillLocator.primary.skillNameToken);
                        if (skillLocator)
                        {
                            var primary = skillLocator.primary;
                            //var secondary = skillLocator.secondary;
                            //var utility = skillLocator.utility;
                            //var special = skillLocator.special;
                            var attackType = "";

                            var soundString = "";

                            BulletAttack bulletAttack = new BulletAttack
                            {
                                owner  = gameObject,
                                weapon = gameObject,
                                origin = inputBank.aimOrigin,
                                isCrit = Util.CheckRoll(characterBody.crit, master),
                                damage = characterBody.damage
                            };

                            OverlapAttack overlapAttack = new OverlapAttack
                            {
                                attacker  = gameObject,
                                inflictor = gameObject,
                                teamIndex = characterBody.teamComponent.teamIndex
                            };

                            FireProjectileInfo fireProjectileInfo = new FireProjectileInfo
                            {
                                owner  = gameObject,
                                crit   = Util.CheckRoll(characterBody.crit, master),
                                damage = characterBody.damage,
                                force  = 0
                            };

                            if (primary)
                            {
                                Debug.Log("Primary Skilltoken " + skillLocator.primary.skillNameToken);
                                switch (skillLocator.primary.skillNameToken)
                                {
                                case "COMMANDO_PRIMARY_NAME":     //double tap
                                    attackType                   = "bullet";
                                    bulletAttack.minSpread       = FirePistol.minSpread;
                                    bulletAttack.maxSpread       = FirePistol.maxSpread;
                                    bulletAttack.damage         *= FirePistol.damageCoefficient;
                                    bulletAttack.force           = FirePistol.force;
                                    bulletAttack.hitEffectPrefab = FirePistol.hitEffectPrefab;
                                    break;

                                case "MERC_PRIMARY_NAME":     //Laser Sword
                                    attackType = "melee";
                                    overlapAttack.damageType = DamageType.ApplyMercExpose;
                                    overlapAttack.damage     = characterBody.damage;
                                    soundString = GroundLight2.slash3Sound;
                                    break;

                                case "ENGI_PRIMARY_NAME":     //Bouncing Grenades
                                    attackType = "projectile";
                                    fireProjectileInfo.projectilePrefab = FireGrenades.projectilePrefab;
                                    fireProjectileInfo.damage          *= FireGrenades.damageCoefficient;
                                    fireProjectileInfo.force            = 0;
                                    fireProjectileInfo.target           = null;
                                    fireProjectileInfo.speedOverride    = -1;
                                    soundString = FireGrenades.attackSoundString;
                                    break;

                                case "Strafe":
                                    attackType = "orb";
                                    break;

                                case "Flurry":
                                    attackType = "orb";
                                    break;

                                case "MAGE_PRIMARY_FIRE_NAME":     //Flame Bolt
                                    attackType = "projectile";
                                    fireProjectileInfo.projectilePrefab = Resources.Load <GameObject>("prefabs/projectiles/MageFirebolt");
                                    fireProjectileInfo.damage          *= 2.2f;
                                    fireProjectileInfo.force            = 20f;
                                    break;

                                case "MAGE_PRIMARY_LIGHTNING_NAME":     //Plasma Bolt
                                    attackType = "projectile";
                                    fireProjectileInfo.projectilePrefab = Resources.Load <GameObject>("prefabs/projectiles/MageLightningboltBasic");
                                    fireProjectileInfo.damage          *= 2.2f;
                                    fireProjectileInfo.force            = 20f;
                                    break;

                                case "TOOLBOT_PRIMARY_NAME":     //Auto-Nailgun
                                    attackType = "bullet";
                                    bulletAttack.bulletCount        = 1;
                                    bulletAttack.falloffModel       = BulletAttack.FalloffModel.DefaultBullet;
                                    bulletAttack.force              = BaseNailgunState.force;
                                    bulletAttack.HitEffectNormal    = BaseNailgunState.hitEffectPrefab;
                                    bulletAttack.procChainMask      = default;
                                    bulletAttack.procCoefficient    = BaseNailgunState.procCoefficient;
                                    bulletAttack.maxDistance        = BaseNailgunState.maxDistance;
                                    bulletAttack.radius             = 0f;
                                    bulletAttack.minSpread          = 0f;
                                    bulletAttack.hitEffectPrefab    = BaseNailgunState.hitEffectPrefab;
                                    bulletAttack.maxSpread          = 0f;
                                    bulletAttack.smartCollision     = false;
                                    bulletAttack.sniper             = false;
                                    bulletAttack.tracerEffectPrefab = BaseNailgunState.tracerEffectPrefab;
                                    break;

                                case "TOOLBOT_PRIMARY_ALT1_NAME":     //Rebar Puncher
                                    attackType = "bullet";
                                    bulletAttack.stopperMask     = LayerIndex.world.mask;
                                    bulletAttack.falloffModel    = BulletAttack.FalloffModel.None;
                                    bulletAttack.hitEffectPrefab = Resources.Load <GameObject>("prefabs/effects/impacteffects/ImpactSpear");
                                    break;

                                case "TOOLBOT_PRIMARY_ALT2_NAME":     //Scrap Launcher
                                    attackType = "projectile";
                                    fireProjectileInfo.projectilePrefab = Resources.Load <GameObject>("prefabs/projectiles/ToolbotGrenadeLauncherProjectile");
                                    fireProjectileInfo.damage          *= 3.6f;
                                    break;

                                case "TOOLBOT_PRIMARY_ALT3_NAME":     //Power-Saw
                                    attackType                    = "melee";
                                    overlapAttack.damage          = FireBuzzsaw.damageCoefficientPerSecond * characterBody.damage / FireBuzzsaw.baseFireFrequency;
                                    overlapAttack.procCoefficient = FireBuzzsaw.procCoefficientPerSecond / FireBuzzsaw.baseFireFrequency;
                                    overlapAttack.hitEffectPrefab = FireBuzzsaw.impactEffectPrefab;
                                    //Transform modelTransform = characterBody.gameObject.GetModelTransform();
                                    //overlapAttack.hitBoxGroup = Array.Find<HitBoxGroup>(modelTransform.GetComponents<HitBoxGroup>(), (HitBoxGroup element) => element.groupName == "Buzzsaw");
                                    break;

                                case "TREEBOT_PRIMARY_NAME":     //DIRECTIVE: Inject
                                    attackType = "projectile";
                                    fireProjectileInfo.projectilePrefab = FireSyringe.finalProjectilePrefab;
                                    fireProjectileInfo.damage          *= FireSyringe.damageCoefficient;
                                    fireProjectileInfo.force            = FireSyringe.force;
                                    soundString = FireSyringe.finalAttackSound;
                                    break;

                                case "Knuckleboom":
                                    attackType = "melee";
                                    break;

                                case "Vicious Wounds":
                                    attackType = "melee";
                                    break;

                                case "CAPTAIN_PRIMARY_NAME":     //Vulcan Shotgun
                                    attackType = "bullet";
                                    bulletAttack.falloffModel    = BulletAttack.FalloffModel.DefaultBullet;
                                    bulletAttack.procCoefficient = 0.75f;
                                    bulletAttack.bulletCount     = 8;
                                    bulletAttack.damage         *= 1.2f;
                                    bulletAttack.maxSpread       = 5f;
                                    break;

                                // Enforcer //
                                case "Riot Shotgun":
                                    attackType = "bullet";
                                    break;

                                case "Super Shotgun":
                                    attackType = "bullet";
                                    break;

                                case "Assault Rifle":
                                    attackType = "bullet";
                                    break;

                                default:
                                    break;
                                }
                            }

                            switch (attackType)
                            {
                            case "bullet":
                                for (int i = 0; i < RingTriggers_FireAmount; i++)
                                {
                                    bulletAttack.origin    = characterBody.characterMotor.capsuleCollider.center;
                                    bulletAttack.aimVector = new Vector3(0, degrees * i, 0);
                                    bulletAttack.Fire();
                                    Util.PlaySound(soundString, gameObject);
                                }
                                break;

                            case "projectile":
                                for (int i = 0; i < RingTriggers_FireAmount; i++)
                                {
                                    fireProjectileInfo.position = characterBody.characterMotor.capsuleCollider.center;
                                    fireProjectileInfo.rotation = Util.QuaternionSafeLookRotation(new Vector3(0, degrees * i, 0));
                                    ProjectileManager.instance.FireProjectile(fireProjectileInfo);
                                    Util.PlaySound(soundString, gameObject);
                                }
                                break;

                            default:
                                break;
                            }
                        }
                    }
                }
            }
            orig(self);
        }
Esempio n. 17
0
        public override void OnEnter()
        {
            base.OnEnter();
            base.AddRecoil(-1f * Scatter.recoilAmplitude, -2f * Scatter.recoilAmplitude, -0.5f * Scatter.recoilAmplitude, 0.5f * Scatter.recoilAmplitude);

            this.maxDuration = Scatter.baseMaxDuration / this.attackSpeedStat;
            this.minDuration = Scatter.baseMinDuration / this.attackSpeedStat;
            Util.PlaySound(Scatter.attackSoundString, base.gameObject);
            base.characterBody.skillLocator.primary.rechargeStopwatch = 0f;
            if (!Scatter.noReload && base.characterBody.skillLocator.primary.stock == 0)
            {
                Util.PlaySound("Play_commando_M2_grenade_throw", base.gameObject);
            }

            Ray aimRay = base.GetAimRay();

            base.StartAimMode(aimRay, 2f, false);

            if (BanditReloaded.BanditReloaded.useOldModel)
            {
                base.PlayAnimation("Gesture, Additive", "FireShotgun", "FireShotgun.playbackRate", this.maxDuration * 0.8f);
                base.PlayAnimation("Gesture, Override", "FireShotgun", "FireShotgun.playbackRate", this.maxDuration * 0.8f);
            }
            else
            {
                base.PlayAnimation("Gesture, Additive", "FireMainWeapon", "FireMainWeapon.playbackRate", this.maxDuration);
            }

            string muzzleName = "MuzzleShotgun";

            if (Scatter.effectPrefab)
            {
                EffectManager.SimpleMuzzleFlash(Scatter.effectPrefab, base.gameObject, muzzleName, false);
            }
            if (base.isAuthority)
            {
                BulletAttack ba = new BulletAttack
                {
                    owner              = base.gameObject,
                    weapon             = base.gameObject,
                    origin             = aimRay.origin,
                    aimVector          = aimRay.direction,
                    minSpread          = 0f,
                    maxSpread          = Mathf.Max(Scatter.spreadBloomValue, base.characterBody.spreadBloomAngle),
                    bulletCount        = Scatter.pelletCount,
                    procCoefficient    = Scatter.procCoefficient,
                    damage             = Scatter.damageCoefficient * this.damageStat,
                    force              = Scatter.force,
                    falloffModel       = BulletAttack.FalloffModel.DefaultBullet,
                    tracerEffectPrefab = Scatter.tracerEffectPrefab,
                    muzzleName         = muzzleName,
                    hitEffectPrefab    = Scatter.hitEffectPrefab,
                    isCrit             = Util.CheckRoll(this.critStat, base.characterBody.master),
                    HitEffectNormal    = false,
                    radius             = Scatter.bulletRadius,
                    smartCollision     = true,
                    maxDistance        = Scatter.range,
                    stopperMask        = Scatter.penetrateEnemies ? LayerIndex.world.mask : LayerIndex.entityPrecise.mask
                };
                ba.Fire();
                base.characterBody.AddSpreadBloom(Scatter.spreadBloomValue);
            }
        }
Esempio n. 18
0
        public override void OnEnter()
        {
            attackString       = FireEmbers.attackString;
            minSpread          = FireEmbers.minSpread;
            maxSpread          = FireEmbers.maxSpread;
            bulletCount        = FireEmbers.bulletCount;
            tracerEffectPrefab = FireEmbers.tracerEffectPrefab;
            hitEffectPrefab    = FireEmbers.hitEffectPrefab;
            effectPrefab       = FireEmbers.effectPrefab;
            damageCoefficient  = FireEmbers.damageCoefficient;

            base.OnEnter();
            Ray    aimRay = GetAimRay();
            string text1  = "MuzzleLeft";
            string text2  = "MuzzleRight";

            duration = baseDuration / attackSpeedStat;
            Util.PlayAttackSpeedSound(attackString, base.gameObject, attackSpeedStat);
            StartAimMode(aimRay);
            if ((bool)effectPrefab)
            {
                EffectManager.SimpleMuzzleFlash(effectPrefab, base.gameObject, text1, transmit: false);
                EffectManager.SimpleMuzzleFlash(effectPrefab, base.gameObject, text2, transmit: false);
            }
            PlayAnimation("Gesture", "FireCannons", "FireCannons.playbackRate", duration);
            if (!base.isAuthority || !base.modelLocator || !base.modelLocator.modelTransform)
            {
                return;
            }
            ChildLocator component = base.modelLocator.modelTransform.GetComponent <ChildLocator>();

            if ((bool)component)
            {
                int       childIndex  = component.FindChildIndex(text1);
                int       childIndex2 = component.FindChildIndex(text2);
                Transform transform   = component.FindChild(childIndex);
                Transform transform2  = component.FindChild(childIndex2);
                if ((bool)transform)
                {
                    BulletAttack bulletAttack = new BulletAttack();
                    bulletAttack.owner              = base.gameObject;
                    bulletAttack.weapon             = base.gameObject;
                    bulletAttack.origin             = aimRay.origin;
                    bulletAttack.aimVector          = aimRay.direction;
                    bulletAttack.minSpread          = minSpread;
                    bulletAttack.maxSpread          = maxSpread;
                    bulletAttack.bulletCount        = (uint)((bulletCount > 0) ? bulletCount : 0);
                    bulletAttack.damage             = damageCoefficient * damageStat;
                    bulletAttack.force              = force;
                    bulletAttack.tracerEffectPrefab = tracerEffectPrefab;
                    bulletAttack.muzzleName         = text1;
                    bulletAttack.hitEffectPrefab    = hitEffectPrefab;
                    bulletAttack.isCrit             = Util.CheckRoll(critStat, base.characterBody.master);
                    bulletAttack.falloffModel       = BulletAttack.FalloffModel.DefaultBullet;
                    bulletAttack.HitEffectNormal    = false;
                    bulletAttack.radius             = 0.5f;
                    bulletAttack.procCoefficient    = 1f / (float)bulletCount;
                    bulletAttack.Fire();
                }
                if ((bool)transform2)
                {
                    BulletAttack bulletAttack = new BulletAttack();
                    bulletAttack.owner              = base.gameObject;
                    bulletAttack.weapon             = base.gameObject;
                    bulletAttack.origin             = aimRay.origin;
                    bulletAttack.aimVector          = aimRay.direction;
                    bulletAttack.minSpread          = minSpread;
                    bulletAttack.maxSpread          = maxSpread;
                    bulletAttack.bulletCount        = (uint)((bulletCount > 0) ? bulletCount : 0);
                    bulletAttack.damage             = damageCoefficient * damageStat;
                    bulletAttack.force              = force;
                    bulletAttack.tracerEffectPrefab = tracerEffectPrefab;
                    bulletAttack.muzzleName         = text2;
                    bulletAttack.hitEffectPrefab    = hitEffectPrefab;
                    bulletAttack.isCrit             = Util.CheckRoll(critStat, base.characterBody.master);
                    bulletAttack.falloffModel       = BulletAttack.FalloffModel.DefaultBullet;
                    bulletAttack.HitEffectNormal    = false;
                    bulletAttack.radius             = 0.5f;
                    bulletAttack.procCoefficient    = 1f / (float)bulletCount;
                    bulletAttack.Fire();
                }
            }
        }
Esempio n. 19
0
        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);
                        }
                    }
                }
            }
        }
Esempio n. 20
0
        // Token: 0x060004AF RID: 1199 RVA: 0x000137A4 File Offset: 0x000119A4
        public override void OnEnter()
        {
            base.OnEnter();
            float num = 0f;

            if (base.skillLocator)
            {
                GenericSkill secondary = base.skillLocator.secondary;
                if (secondary)
                {
                    EntityStateMachine stateMachine = secondary.stateMachine;
                    if (stateMachine)
                    {
                        ScopeSniper scopeSniper = stateMachine.state as ScopeSniper;
                        if (scopeSniper != null)
                        {
                            num = scopeSniper.charge;
                            scopeSniper.charge = 0f;
                        }
                    }
                }
            }
            base.AddRecoil(-1f * FireRifle.recoilAmplitude, -2f * FireRifle.recoilAmplitude, -0.5f * FireRifle.recoilAmplitude, 0.5f * FireRifle.recoilAmplitude);
            this.duration = FireRifle.baseDuration / this.attackSpeedStat;
            Ray aimRay = base.GetAimRay();

            base.StartAimMode(aimRay, 2f, false);
            Util.PlaySound(FireRifle.attackSoundString, base.gameObject);
            base.PlayAnimation("Gesture", "FireShotgun", "FireShotgun.playbackRate", this.duration * 1.1f);
            string muzzleName = "MuzzleShotgun";

            if (FireRifle.effectPrefab)
            {
                EffectManager.instance.SimpleMuzzleFlash(FireRifle.effectPrefab, base.gameObject, muzzleName, false);
            }
            if (base.isAuthority)
            {
                BulletAttack bulletAttack = new BulletAttack();
                bulletAttack.owner              = base.gameObject;
                bulletAttack.weapon             = base.gameObject;
                bulletAttack.origin             = aimRay.origin;
                bulletAttack.aimVector          = aimRay.direction;
                bulletAttack.minSpread          = 0f;
                bulletAttack.maxSpread          = base.characterBody.spreadBloomAngle;
                bulletAttack.bulletCount        = (uint)((FireRifle.bulletCount > 0) ? FireRifle.bulletCount : 0);
                bulletAttack.procCoefficient    = 1f / (float)FireRifle.bulletCount;
                bulletAttack.damage             = Mathf.LerpUnclamped(FireRifle.minChargeDamageCoefficient, FireRifle.maxChargeDamageCoefficient, num) * this.damageStat / (float)FireRifle.bulletCount;
                bulletAttack.force              = Mathf.LerpUnclamped(FireRifle.minChargeForce, FireRifle.maxChargeForce, num);
                bulletAttack.falloffModel       = BulletAttack.FalloffModel.None;
                bulletAttack.tracerEffectPrefab = FireRifle.tracerEffectPrefab;
                bulletAttack.muzzleName         = muzzleName;
                bulletAttack.hitEffectPrefab    = FireRifle.hitEffectPrefab;
                bulletAttack.isCrit             = Util.CheckRoll(this.critStat, base.characterBody.master);
                if (num == 1f)
                {
                    bulletAttack.stopperMask = LayerIndex.world.mask;
                }
                bulletAttack.HitEffectNormal = false;
                bulletAttack.radius          = 0f;
                bulletAttack.sniper          = true;
                bulletAttack.Fire();
            }
            base.characterBody.AddSpreadBloom(FireRifle.spreadBloomValue);
        }
Esempio n. 21
0
        public override void OnExit()
        {
            if (base.cameraTargetParams)
            {
                base.cameraTargetParams.fovOverride = -1f;
            }

            if (base.isAuthority)
            {
                Ray aimRay = base.GetAimRay();

                Vector3 aimer = Vector3.down;

                BulletAttack bulletAttack = new BulletAttack
                {
                    owner              = base.gameObject,
                    weapon             = base.gameObject,
                    muzzleName         = "Chest",
                    origin             = aimRay.origin,
                    aimVector          = aimer,
                    minSpread          = 0f,
                    maxSpread          = base.characterBody.spreadBloomAngle,
                    radius             = 0.35f,
                    bulletCount        = 1U,
                    procCoefficient    = .5f,
                    damage             = base.characterBody.damage * ToTheStars.damageCoefficient,
                    force              = 3,
                    falloffModel       = BulletAttack.FalloffModel.None,
                    tracerEffectPrefab = this.tracerEffectPrefab,
                    hitEffectPrefab    = this.hitEffectPrefab,
                    isCrit             = base.RollCrit(),
                    HitEffectNormal    = false,
                    stopperMask        = LayerIndex.world.mask,
                    smartCollision     = true,
                    maxDistance        = 300f
                };

                for (int j = 0; j < 3; j++)
                {
                    for (int i = 0; i <= 9; i++)
                    {
                        float theta = Random.Range(0.0f, 6.28f);
                        float x     = Mathf.Cos(theta);
                        float z     = Mathf.Sin(theta);
                        float c     = i * 0.3777f;
                        c       *= (1f / 12f);
                        aimer.x += c * x;
                        aimer.z += c * z;
                        bulletAttack.aimVector = aimer;
                        bulletAttack.Fire();
                        aimer = Vector3.down;
                    }
                }

                EffectData effectData = new EffectData();
                effectData.origin   = aimRay.origin + (1 * Vector3.down);
                effectData.scale    = 8;
                effectData.rotation = major;

                EffectManager.SpawnEffect(smokeEffectPrefab, effectData, true);
                effectData.scale = 16;
                EffectManager.SpawnEffect(flashEffectPrefab, effectData, true);
            }

            Util.PlaySound(DiggerPlugin.Sounds.ToTheStars, base.gameObject);

            base.gameObject.layer = LayerIndex.defaultLayer.intVal;
            base.characterMotor.Motor.RebuildCollidableLayers();

            base.PlayAnimation("FullBody, Override", "ToTheStarsEnd");

            base.OnExit();
        }