Ejemplo n.º 1
0
        private IEnumerator DelayedPostProcess(Projectile bulletToClone)
        {
            yield return(null);

            if (bulletToClone.GetComponent <RC360TurretShot>() != null)
            {
                yield break;
            }
            if (self.PossibleSourceGun == null || bulletToClone.PossibleSourceGun == null)
            {
                yield break;
            }
            if (bulletToClone.PossibleSourceGun == self.PossibleSourceGun)
            {
                float angle = bulletToClone.Direction.ToAngle();
                if (owner.PlayerHasActiveSynergy("I Call Hacks"))
                {
                    angle = self.specRigidbody.UnitCenter.GetVectorToNearestEnemy().ToAngle();
                }
                GameObject newBulletOBJ     = FakePrefab.Clone(bulletToClone.gameObject);
                GameObject spawnedBulletOBJ = SpawnManager.SpawnProjectile(newBulletOBJ, self.sprite.WorldCenter, Quaternion.Euler(0f, 0f, angle), true);
                Projectile component        = spawnedBulletOBJ.GetComponent <Projectile>();
                if (component != null)
                {
                    component.Owner   = owner;
                    component.Shooter = owner.specRigidbody;
                }
            }
            yield break;
        }
Ejemplo n.º 2
0
        public static void Add()
        {
            Gun gun = ETGMod.Databases.Items.NewGun("St4ke", "st4ke");

            Game.Items.Rename("outdated_gun_mods:st4ke", "nn:st4ke");
            gun.gameObject.AddComponent <St4ke>();
            gun.SetShortDescription("For Robot Vampires");
            gun.SetLongDescription("Fires miniature tesla coils that stick into walls." + "\n\nFollowing the success of her remote diote transmitter experiment, the tinker set about seeing if she could make both ends of the tesla-relay mobile.");

            gun.SetupSprite(null, "st4ke_idle_001", 8);

            gun.SetAnimationFPS(gun.shootAnimation, 17);

            gun.gunSwitchGroup = (PickupObjectDatabase.GetById(153) as Gun).gunSwitchGroup;

            gun.AddProjectileModuleFrom(PickupObjectDatabase.GetById(56) as Gun, true, false);

            //GUN STATS
            gun.DefaultModule.ammoCost      = 1;
            gun.DefaultModule.shootStyle    = ProjectileModule.ShootStyle.SemiAutomatic;
            gun.DefaultModule.sequenceStyle = ProjectileModule.ProjectileSequenceStyle.Random;
            gun.reloadTime = 1f;
            gun.DefaultModule.cooldownTime           = 0.15f;
            gun.DefaultModule.numberOfShotsInClip    = 4;
            gun.barrelOffset.transform.localPosition = new Vector3(1.68f, 0.62f, 0f);
            gun.SetBaseMaxAmmo(175);
            gun.gunSwitchGroup = (PickupObjectDatabase.GetById(153) as Gun).gunSwitchGroup;
            gun.ammo           = 175;
            gun.gunClass       = GunClass.PISTOL;
            //BULLET STATS
            Projectile projectile = UnityEngine.Object.Instantiate <Projectile>(gun.DefaultModule.projectiles[0]);

            projectile.gameObject.SetActive(false);
            FakePrefab.MarkAsFakePrefab(projectile.gameObject);
            UnityEngine.Object.DontDestroyOnLoad(projectile);
            gun.DefaultModule.projectiles[0] = projectile;
            projectile.baseData.damage       = 8f;
            projectile.pierceMinorBreakables = true;
            projectile.SetProjectileSpriteRight("st4keproj", 13, 7, true, tk2dBaseSprite.Anchor.MiddleCenter, 9, 5);
            St4keProj          orAddComponent = projectile.gameObject.GetOrAddComponent <St4keProj>();
            PierceProjModifier piercing       = projectile.gameObject.GetOrAddComponent <PierceProjModifier>();

            piercing.penetration++;

            gun.DefaultModule.ammoType       = GameUIAmmoType.AmmoType.CUSTOM;
            gun.DefaultModule.customAmmoType = CustomClipAmmoTypeToolbox.AddCustomAmmoType("Stk4ke Bullets", "NevernamedsItems/Resources/CustomGunAmmoTypes/st4ke_clipfull", "NevernamedsItems/Resources/CustomGunAmmoTypes/st4ke_clipempty");

            gun.quality = PickupObject.ItemQuality.A;
            ETGMod.Databases.Items.Add(gun, null, "ANY");

            St4keID = gun.PickupObjectId;
            gun.AddToSubShop(ItemBuilder.ShopType.Trorc);

            LinkVFXPrefab = FakePrefab.Clone(Game.Items["shock_rounds"].GetComponent <ComplexProjectileModifier>().ChainLightningVFX);
            FakePrefab.MarkAsFakePrefab(LinkVFXPrefab);
            UnityEngine.Object.DontDestroyOnLoad(LinkVFXPrefab);
        }
Ejemplo n.º 3
0
        public static void Add()
        {
            Gun gun = ETGMod.Databases.Items.NewGun("Malicious Railcannon", "maliciousrailcannon");

            Gungeon.Game.Items.Rename("outdated_gun_mods:malicious_railcannon", "psm:malicious_railcannon");
            gun.gameObject.AddComponent <MaliciousRailcannon>();
            gun.SetShortDescription("EXPLODED");
            gun.SetLongDescription("Shoots a hitscan beam, which spawns an explosion wherever it hits. Use at your own risk.\n\ndevilmayquake.com");
            gun.SetupSprite(null, "maliciousrailcannon_idle_001", 1);
            gun.SetAnimationFPS(gun.reloadAnimation, 1);

            Gun gun3 = PickupObjectDatabase.GetById(38) as Gun;

            gun.AddProjectileModuleFrom("klobb", true, false);
            gun.SetBaseMaxAmmo(210);

            gun.DefaultModule.customAmmoType = gun3.DefaultModule.customAmmoType;
            gun.DefaultModule.ammoType       = gun3.DefaultModule.ammoType;
            gun.DefaultModule.ammoCost       = 1;
            gun.DefaultModule.shootStyle     = ProjectileModule.ShootStyle.SemiAutomatic;
            gun.DefaultModule.angleVariance  = 0;

            gun.damageModifier                    = 1;
            gun.reloadTime                        = 3f;
            gun.DefaultModule.cooldownTime        = 0.2f;
            gun.DefaultModule.numberOfShotsInClip = 1;
            gun.quality            = PickupObject.ItemQuality.S;
            gun.gunClass           = GunClass.RIFLE;
            gun.CanBeDropped       = true;
            gun.muzzleFlashEffects = gun3.muzzleFlashEffects;

            ETGMod.Databases.Items.Add(gun, null, "ANY");

            Projectile projectile = Instantiate <Projectile>(gun3.DefaultModule.projectiles[0]);

            projectile.gameObject.SetActive(false);
            FakePrefab.MarkAsFakePrefab(projectile.gameObject);
            UnityEngine.Object.DontDestroyOnLoad(projectile);


            GameObject linkVFXPrefab = FakePrefab.Clone(Game.Items["shock_rounds"].GetComponent <ComplexProjectileModifier>().ChainLightningVFX);

            projectile.transform.parent        = gun.barrelOffset;
            projectile.sprite.renderer.enabled = false;
            projectile.baseData.speed          = 12;
            projectile.hitEffects  = null;
            projectile.DestroyMode = Projectile.ProjectileDestroyMode.None;
            projectile.specRigidbody.CollideWithOthers  = false;
            projectile.specRigidbody.CollideWithTileMap = false;
            MaliciousBeamHandler beamHandler = projectile.gameObject.AddComponent <MaliciousBeamHandler>();

            beamHandler.linkVFXPrefab        = linkVFXPrefab;
            beamHandler.wait                 = 0.25f;
            projectile.baseData.damage       = 0f;
            gun.DefaultModule.projectiles[0] = projectile;
        }
Ejemplo n.º 4
0
        private IEnumerator HandleAddToList(Projectile proj)
        {
            yield return(null);

            ProjAndPositionData newData = new ProjAndPositionData();

            newData.projectile = FakePrefab.Clone(proj.gameObject);
            newData.position   = proj.specRigidbody.UnitCenter;
            newData.angle      = proj.Direction.ToAngle();
            yield return(new WaitForSeconds(0.01f));

            storedProjectiles.Add(newData);
            yield break;
        }
Ejemplo n.º 5
0
        private static IEnumerator HandleShadowChainDelay(Projectile proj, int amount, float delay, float scaleMult, Projectile overrideproj, bool shadowcolour = false)
        {
            GameObject prefab = FakePrefab.Clone(proj.gameObject);

            if (overrideproj != null)
            {
                prefab = FakePrefab.Clone(overrideproj.gameObject);
            }
            Projectile prefabproj = prefab.GetComponent <Projectile>();

            prefabproj.Owner   = proj.Owner;
            prefabproj.Shooter = proj.Shooter;
            Vector3 position = proj.transform.position;

            float rotation = proj.Direction.ToAngle(); //Here's where the projectile direction is assigned

            bool isInitialProjectile = true;

            yield return(null);

            for (int i = 0; i < amount; i++)
            {
                if (delay > 0f)
                {
                    float ela = 0f;
                    if (isInitialProjectile)
                    {
                        float initDelay = delay - 0.03f;
                        while (ela < initDelay)
                        {
                            ela += BraveTime.DeltaTime;
                            yield return(null);
                        }
                        isInitialProjectile = false;
                    }
                    else
                    {
                        while (ela < delay)
                        {
                            ela += BraveTime.DeltaTime;
                            yield return(null);
                        }
                    }
                }
                ChainedShadowBulletsHandler.SpawnShadowBullet(prefabproj, position, rotation, scaleMult, shadowcolour);
            }
            yield break;
        }
        private IEnumerator ConsumeProjectile(Projectile bullet)
        {
            yield return(null);

            GameObject newBulletOBJ = FakePrefab.Clone(bullet.gameObject);

            newBulletOBJ.SetActive(false);
            FakePrefab.MarkAsFakePrefab(newBulletOBJ);
            UnityEngine.Object.DontDestroyOnLoad(newBulletOBJ);

            storedProjectiles.Add(newBulletOBJ.GetComponent <Projectile>());
            yield return(null);

            Destroy(bullet.gameObject);
            yield break;
        }
Ejemplo n.º 7
0
        private void Update()
        {
            if (this.LinkVFXPrefab == null)
            {
                this.LinkVFXPrefab = FakePrefab.Clone(Game.Items["shock_rounds"].GetComponent <ComplexProjectileModifier>().ChainLightningVFX);
            }
            if (bolaProjectileA && bolaProjectileB && this.extantLink == null)
            {
                tk2dTiledSprite component = SpawnManager.SpawnVFX(this.LinkVFXPrefab, false).GetComponent <tk2dTiledSprite>();
                this.extantLink = component;
            }

            if (bolaProjectileA == null || bolaProjectileB == null)
            {
                Uncouple();
                m_projectile.DieInAir();
            }
        }
Ejemplo n.º 8
0
        protected override void DoEffect(PlayerController user)
        {
            float            roomPosX         = user.transform.position.x - user.CurrentRoom.area.basePosition.x;
            float            roomPosY         = user.transform.position.y - user.CurrentRoom.area.basePosition.y;
            float            xOffSet          = 1;
            float            yOffSet          = 0;
            Vector2          posInCurrentRoom = new Vector2(roomPosX + xOffSet, roomPosY + yOffSet);
            GameObject       regularbarrel    = sharedAssets2.LoadAsset <GameObject>("Barrel_collection");
            GameObject       barrelPrefab     = FakePrefab.Clone(regularbarrel);
            DungeonPlaceable woodbox          = sharedAssets2.LoadAsset <DungeonPlaceable>("Barrel_collection");

            woodbox.InstantiateObject(user.CurrentRoom, posInCurrentRoom.ToIntVector2());
            bool flag = woodbox != null;

            if (flag)
            {
                woodbox.InstantiateObject(user.CurrentRoom, posInCurrentRoom.ToIntVector2());
            }
        }
        public static void Init()
        {
            string     itemName     = "Electrum Rounds";
            string     resourceName = "NevernamedsItems/Resources/NeoItemSprites/electrumrounds_icon";
            GameObject obj          = new GameObject(itemName);
            var        item         = obj.AddComponent <ElectrumRounds>();

            ItemBuilder.AddSpriteToObject(itemName, resourceName, obj);
            string shortDesc = "Zip Zop Zap";
            string longDesc  = "Fast, penetrative bullets made of gold and silver alloy. Highly conductive, it maintains a powerful electric bond with it's home holster.";

            ItemBuilder.SetupItem(item, shortDesc, longDesc, "nn");
            item.quality = PickupObject.ItemQuality.S;
            ItemBuilder.AddPassiveStatModifier(item, PlayerStats.StatType.ProjectileSpeed, 1.7f, StatModifier.ModifyMethod.MULTIPLICATIVE);
            ItemBuilder.AddPassiveStatModifier(item, PlayerStats.StatType.AdditionalShotPiercing, 1, StatModifier.ModifyMethod.ADDITIVE);

            linkVFX = FakePrefab.Clone(PickupObjectDatabase.GetById(298).GetComponent <ComplexProjectileModifier>().ChainLightningVFX);
            FakePrefab.MarkAsFakePrefab(linkVFX);
            UnityEngine.Object.DontDestroyOnLoad(linkVFX);
            item.SetupUnlockOnCustomFlag(CustomDungeonFlags.ADVDRAGUN_KILLED_ROBOT, true);
        }
Ejemplo n.º 10
0
 public override void Update()
 {
     if (this.LinkVFXPrefab == null)
     {
         this.LinkVFXPrefab = FakePrefab.Clone(Game.Items["shock_rounds"].GetComponent <ComplexProjectileModifier>().ChainLightningVFX);
     }
     if (this.Owner && this.Owner.IsInCombat && this.extantLink == null)
     {
         tk2dTiledSprite component = SpawnManager.SpawnVFX(this.LinkVFXPrefab, false).GetComponent <tk2dTiledSprite>();
         this.extantLink = component;
     }
     else if (this.Owner && this.Owner.IsInCombat && this.extantLink != null)
     {
         UpdateLink(this.Owner, this.extantLink);
     }
     else if (extantLink != null)
     {
         SpawnManager.Despawn(extantLink.gameObject);
         extantLink = null;
     }
     base.Update();
 }
        public void ModifyVolley(ProjectileVolleyData volleyToModify)
        {
            float randoAngle = UnityEngine.Random.Range(1, 360);
            int   count      = volleyToModify.projectiles.Count;

            for (int i = 0; i < count; i++)
            {
                ProjectileModule projectileModule = volleyToModify.projectiles[i];
                int sourceIndex = i;
                if (projectileModule.CloneSourceIndex >= 0)
                {
                    sourceIndex = projectileModule.CloneSourceIndex;
                }
                ProjectileModule projectileModule2 = ProjectileModule.CreateClone(projectileModule, false, sourceIndex);
                projectileModule2.angleFromAim             = randoAngle;
                projectileModule2.ignoredForReloadPurposes = true;
                projectileModule2.ammoCost = 0;
                if (Owner && Owner.PlayerHasActiveSynergy("Heads, Shoulders, Knees, and Toes"))
                {
                    for (int r = 0; r < projectileModule.projectiles.Count; r++)
                    {
                        Projectile startProj = projectileModule.projectiles[r];
                        if (startProj)
                        {
                            Projectile clonedProj = FakePrefab.Clone(startProj.gameObject).GetComponent <Projectile>();
                            if (clonedProj)
                            {
                                clonedProj.baseData.damage      *= 2;
                                projectileModule2.projectiles[r] = clonedProj;
                            }
                        }
                    }
                }
                volleyToModify.projectiles.Add(projectileModule2);
            }
        }
Ejemplo n.º 12
0
 private void Start()
 {
     this.Owner         = this.m_owner;
     this.LinkVFXPrefab = FakePrefab.Clone(Game.Items["shock_rounds"].GetComponent <ComplexProjectileModifier>().ChainLightningVFX);
 }
Ejemplo n.º 13
0
        private void CreateNewSubBeams()
        {
            ClearExtantSubBeams();
            float ProjectileInterval = splitAngles / ((float)amtToSplitTo - 1);
            float currentAngle       = basicBeamController.GetFinalBoneDirection();
            float startAngle         = currentAngle + (splitAngles * 0.5f);
            int   iteration          = 0;

            for (int i = 0; i < amtToSplitTo; i++)
            {
                LinkedList <BasicBeamController.BeamBone> bones;
                bones = OMITBReflectionHelpers.ReflectGetField <LinkedList <BasicBeamController.BeamBone> >(typeof(BasicBeamController), "m_bones", basicBeamController);
                LinkedListNode <BasicBeamController.BeamBone> linkedListNode = null;
                if (bones != null)
                {
                    linkedListNode = bones.Last;
                }
                else
                {
                    Debug.LogError("Bones was NULL"); return;
                }

                Vector2 bonePosition = basicBeamController.GetBonePosition(linkedListNode.Value);

                float finalAngle = startAngle - (ProjectileInterval * iteration);

                GameObject newSubBeamPrefab = FakePrefab.Clone(projectile.gameObject);
                if (newSubBeamPrefab == null)
                {
                    Debug.LogError("BeamSplitComp: Cloned Beam Prefab was NULL!");
                }

                BeamController controllerPrefab = newSubBeamPrefab.GetComponent <BeamController>();
                if (controllerPrefab == null)
                {
                    Debug.LogError("BeamSplitComp: ControllerPrefab was NULL!");
                }
                if (controllerPrefab is BasicBeamController)
                {
                    GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(controllerPrefab.gameObject);

                    BasicBeamController newBasicSubBeam = gameObject.GetComponent <BasicBeamController>();
                    newBasicSubBeam.State              = BasicBeamController.BeamState.Firing;
                    newBasicSubBeam.HitsPlayers        = false;
                    newBasicSubBeam.HitsEnemies        = true;
                    newBasicSubBeam.Origin             = bonePosition;
                    newBasicSubBeam.Direction          = finalAngle.DegreeToVector2();
                    newBasicSubBeam.usesChargeDelay    = false;
                    newBasicSubBeam.muzzleAnimation    = string.Empty;
                    newBasicSubBeam.chargeAnimation    = string.Empty;
                    newBasicSubBeam.beamStartAnimation = string.Empty;
                    newBasicSubBeam.projectile.Owner   = this.projectile.Owner;
                    newBasicSubBeam.Owner              = this.basicBeamController.Owner;
                    newBasicSubBeam.Gun = this.basicBeamController.Gun;
                    if (originalRange > 0)
                    {
                        newBasicSubBeam.projectile.baseData.range = originalRange;
                    }
                    newBasicSubBeam.projectile.baseData.damage *= dmgMultOnSplit;

                    if (newBasicSubBeam.GetComponent <BeamSplittingModifier>())
                    {
                        Destroy(newBasicSubBeam.GetComponent <BeamSplittingModifier>());
                    }

                    subBeams.Add(newBasicSubBeam, (ProjectileInterval * iteration));
                }
                else
                {
                    Debug.LogError("BeamSplitComp: Controller prefab was not beam????");
                }

                iteration++;
            }
        }
        public static void Add()
        {
            Gun gun = ETGMod.Databases.Items.NewGun("Copper Sidearm", "coppersidearm");

            Game.Items.Rename("outdated_gun_mods:copper_sidearm", "nn:copper_sidearm");
            gun.gameObject.AddComponent <CopperSidearm>();
            gun.SetShortDescription("Conductive");
            gun.SetLongDescription("A prime conductor of electricity, the bullets from this gun connect back to the wielder by an electric arc." + "\n\nSmells faintly of wax.");

            gun.SetupSprite(null, "coppersidearm_idle_001", 8);

            gun.SetAnimationFPS(gun.shootAnimation, 16);
            gun.SetAnimationFPS(gun.reloadAnimation, 1);
            gun.gunSwitchGroup = (PickupObjectDatabase.GetById(545) as Gun).gunSwitchGroup;

            gun.AddProjectileModuleFrom(PickupObjectDatabase.GetById(86) as Gun, true, false);

            //GUN STATS
            gun.DefaultModule.ammoCost      = 1;
            gun.DefaultModule.shootStyle    = ProjectileModule.ShootStyle.SemiAutomatic;
            gun.DefaultModule.sequenceStyle = ProjectileModule.ProjectileSequenceStyle.Random;
            gun.reloadTime = 1f;
            gun.DefaultModule.cooldownTime           = 0.2f;
            gun.muzzleFlashEffects                   = (PickupObjectDatabase.GetById(97) as Gun).muzzleFlashEffects;
            gun.DefaultModule.numberOfShotsInClip    = 6;
            gun.barrelOffset.transform.localPosition = new Vector3(1.56f, 0.62f, 0f);
            gun.SetBaseMaxAmmo(200);
            gun.gunClass           = GunClass.PISTOL;
            gun.muzzleFlashEffects = (PickupObjectDatabase.GetById(23) as Gun).muzzleFlashEffects;

            //BULLET STATS
            Projectile projectile = UnityEngine.Object.Instantiate <Projectile>(gun.DefaultModule.projectiles[0]);

            projectile.gameObject.SetActive(false);
            FakePrefab.MarkAsFakePrefab(projectile.gameObject);
            UnityEngine.Object.DontDestroyOnLoad(projectile);
            gun.DefaultModule.projectiles[0] = projectile;
            projectile.baseData.damage       = 6f;
            projectile.baseData.speed       *= 0.5f;
            projectile.baseData.range       *= 10f;
            projectile.SetProjectileSpriteRight("coppersidearm_projectile", 10, 10, true, tk2dBaseSprite.Anchor.MiddleCenter, 8, 8);

            GameObject LinkVFXPrefab = FakePrefab.Clone(Game.Items["shock_rounds"].GetComponent <ComplexProjectileModifier>().ChainLightningVFX);

            FakePrefab.MarkAsFakePrefab(LinkVFXPrefab);
            UnityEngine.Object.DontDestroyOnLoad(LinkVFXPrefab);
            OwnerConnectLightningModifier litening = projectile.gameObject.AddComponent <OwnerConnectLightningModifier>();

            litening.linkPrefab = LinkVFXPrefab;

            PierceProjModifier piercing = projectile.gameObject.AddComponent <PierceProjModifier>();

            piercing.penetration = 1;

            gun.DefaultModule.ammoType       = GameUIAmmoType.AmmoType.CUSTOM;
            gun.DefaultModule.customAmmoType = CustomClipAmmoTypeToolbox.AddCustomAmmoType("CopperSidearm Bullets", "NevernamedsItems/Resources/CustomGunAmmoTypes/coppersidearm_clipfull", "NevernamedsItems/Resources/CustomGunAmmoTypes/coppersidearm_clipempty");

            gun.quality = PickupObject.ItemQuality.C;
            ETGMod.Databases.Items.Add(gun, null, "ANY");

            CopperSidearmID = gun.PickupObjectId;
        }
Ejemplo n.º 15
0
        public static void Add()
        {
            Gun gun = ETGMod.Databases.Items.NewGun("Bola Gun", "bolagun");

            Game.Items.Rename("outdated_gun_mods:bola_gun", "nn:bola_gun");
            var behav = gun.gameObject.AddComponent <BolaGun>();

            gun.SetShortDescription("Deathly Strands");
            gun.SetLongDescription("Fires swinging bolas connected by frazzling energy beams." + "\n\nThe wide swing of the bolas renders the weapon ineffective in narrow corridors.");

            gun.SetupSprite(null, "bolagun_idle_001", 8);

            gun.SetAnimationFPS(gun.shootAnimation, 12);

            gun.AddProjectileModuleFrom(PickupObjectDatabase.GetById(56) as Gun, true, false);
            gun.gunSwitchGroup = (PickupObjectDatabase.GetById(150) as Gun).gunSwitchGroup;
            gun.gunClass       = GunClass.RIFLE;
            //GUN STATS
            gun.DefaultModule.ammoCost      = 1;
            gun.DefaultModule.shootStyle    = ProjectileModule.ShootStyle.SemiAutomatic;
            gun.DefaultModule.sequenceStyle = ProjectileModule.ProjectileSequenceStyle.Random;
            gun.reloadTime = 1.2f;
            gun.DefaultModule.cooldownTime = 0.3f;
            //gun.muzzleFlashEffects.type = VFXPoolType.None;
            gun.DefaultModule.numberOfShotsInClip    = 7;
            gun.barrelOffset.transform.localPosition = new Vector3(2.56f, 0.81f, 0f);
            gun.SetBaseMaxAmmo(210);
            gun.carryPixelOffset = new IntVector2(10, -3);
            //Bola Stats
            Projectile projectile2 = UnityEngine.Object.Instantiate <Projectile>((PickupObjectDatabase.GetById(56) as Gun).DefaultModule.projectiles[0]);

            projectile2.gameObject.SetActive(false);
            FakePrefab.MarkAsFakePrefab(projectile2.gameObject);
            UnityEngine.Object.DontDestroyOnLoad(projectile2);
            projectile2.baseData.speed  *= 1f;
            projectile2.baseData.range  *= 1f;
            projectile2.baseData.damage *= 2f;
            projectile2.SetProjectileSpriteRight("bolagun_projectile", 9, 9, true, tk2dBaseSprite.Anchor.MiddleCenter, 7, 7);

            //BULLET STATS
            Projectile projectile = UnityEngine.Object.Instantiate <Projectile>(gun.DefaultModule.projectiles[0]);

            projectile.gameObject.SetActive(false);
            FakePrefab.MarkAsFakePrefab(projectile.gameObject);
            UnityEngine.Object.DontDestroyOnLoad(projectile);
            gun.DefaultModule.projectiles[0] = projectile;
            projectile.baseData.damage       = 7f;
            projectile.baseData.speed       *= 0.5f;
            projectile.baseData.range       *= 10f;

            BolaControlla controlla = projectile.gameObject.AddComponent <BolaControlla>();

            controlla.bolaPrefab = projectile2.gameObject;
            projectile.sprite.renderer.enabled = false;
            NoCollideBehaviour noCollide = projectile.gameObject.AddComponent <NoCollideBehaviour>();

            noCollide.worksOnEnemies     = true;
            noCollide.worksOnProjectiles = true;

            projectile.transform.parent = gun.barrelOffset;

            gun.DefaultModule.ammoType       = GameUIAmmoType.AmmoType.CUSTOM;
            gun.DefaultModule.customAmmoType = CustomClipAmmoTypeToolbox.AddCustomAmmoType("Bola Gun Bullets", "NevernamedsItems/Resources/CustomGunAmmoTypes/bolagun_clipfull", "NevernamedsItems/Resources/CustomGunAmmoTypes/bolagun_clipempty");

            gun.quality = PickupObject.ItemQuality.A;
            ETGMod.Databases.Items.Add(gun, null, "ANY");

            BolaGunID = gun.PickupObjectId;

            LinkVFX = FakePrefab.Clone(Game.Items["shock_rounds"].GetComponent <ComplexProjectileModifier>().ChainLightningVFX);
        }
Ejemplo n.º 16
0
        // Token: 0x0600086E RID: 2158 RVA: 0x000676D4 File Offset: 0x000658D4
        private void SplitProjectile()
        {
            PlayerController player = this.parentOwner;
            float            num    = this.splitAngles / ((float)this.amtToSplitTo);
            float            num2   = this.parentProjectile.Direction.ToAngle();
            float            num3   = num2 + this.splitAngles * 0.5f;
            int num4 = 0;

            if (parentOwner.CurrentGun.Volley.projectiles.Count > 10)
            {
                // too many projectiles ajkla;sdlf;lfjksladlf
                ProjectileSplitController component2 = parentProjectile.gameObject.GetComponent <ProjectileSplitController>();
                UnityEngine.Object.Destroy(component2);
            }
            else
            {
                for (int i = 0; i < this.amtToSplitTo; i++)
                {
                    float      num5       = num3 - num * (float)num4;
                    GameObject prefab     = FakePrefab.Clone(this.parentProjectile.gameObject);
                    GameObject gameObject = SpawnManager.SpawnProjectile(prefab, this.parentProjectile.sprite.WorldCenter, Quaternion.Euler(0f, 0f, num5), true);
                    Projectile component  = gameObject.GetComponent <Projectile>();
                    bool       flag       = component != null;
                    if (flag)
                    {
                        component.Owner            = this.parentOwner;
                        component.Shooter          = this.parentOwner.specRigidbody;
                        component.baseData.damage *= this.dmgMultAfterSplit;
                        component.RuntimeUpdateScale(this.sizeMultAfterSplit);
                        ProjectileSplitController component2 = component.gameObject.GetComponent <ProjectileSplitController>();
                        bool flag2 = component2 && this.removeComponentAfterUse;
                        if (flag2)
                        {
                            UnityEngine.Object.Destroy(component2);
                        }
                        if (parentProjectile.AdditionalScaleMultiplier >= 1.04f)
                        {
                            UnityEngine.Object.Destroy(component2);
                        }
                    }
                    num4++;
                }
                float mirrorAngle = splitAngles * -1;
                float number      = mirrorAngle / ((float)this.amtToSplitTo);
                float number2     = this.parentProjectile.Direction.ToAngle();
                float number3     = number2 + mirrorAngle * 0.5f;
                int   number4     = 0;
                for (int i = 0; i < this.amtToSplitTo; i++)
                {
                    float      number5    = number3 - number * (float)number4;
                    GameObject prefab     = FakePrefab.Clone(this.parentProjectile.gameObject);
                    GameObject gameObject = SpawnManager.SpawnProjectile(prefab, this.parentProjectile.sprite.WorldCenter, Quaternion.Euler(0f, 0f, number5), true);
                    Projectile component  = gameObject.GetComponent <Projectile>();
                    bool       flag       = component != null;
                    if (flag)
                    {
                        component.Owner   = this.parentOwner;
                        component.Shooter = this.parentOwner.specRigidbody;
                        if (this.parentProjectile.baseData.damage < this.parentProjectile.GetCachedBaseDamage * .4)
                        {
                        }
                        else
                        {
                            component.baseData.damage *= this.dmgMultAfterSplit;
                        }

                        component.RuntimeUpdateScale(this.sizeMultAfterSplit);
                        ProjectileSplitController component2 = component.gameObject.GetComponent <ProjectileSplitController>();

                        bool flag2 = component2 && this.removeComponentAfterUse;
                        if (flag2)
                        {
                            UnityEngine.Object.Destroy(component2);
                        }
                        if (parentProjectile.AdditionalScaleMultiplier >= 1.04f)
                        {
                            UnityEngine.Object.Destroy(component2);
                        }
                    }
                    number4++;
                }


                UnityEngine.Object.Destroy(this.parentProjectile.gameObject);
            }
        }
Ejemplo n.º 17
0
        private void OnGuonHitByBullet(SpeculativeRigidbody myRigidbody, PixelCollider myCollider, SpeculativeRigidbody other, PixelCollider otherCollider)
        {
            if (Owner && this.m_extantOrbital)
            {
                if (other.projectile && other.projectile.Owner is PlayerController)
                {
                    if (other.projectile.gameObject.GetComponent <KaleidoscopicBullet>() == null)
                    {
                        float anglesOfSpread = 40;
                        if (Owner.PlayerHasActiveSynergy("Kaleidoscopicer Guon Stone"))
                        {
                            anglesOfSpread = 20;
                        }
                        float ProjectileInterval = anglesOfSpread / ((float)6 - 1);
                        float currentAngle       = other.projectile.Direction.ToAngle();
                        float startAngle         = currentAngle + (anglesOfSpread * 0.5f);
                        int   iteration          = 0;
                        for (int i = 0; i < 6; i++)
                        {
                            float finalAngle = startAngle - (ProjectileInterval * iteration);

                            GameObject newBulletOBJ     = FakePrefab.Clone(other.projectile.gameObject);
                            GameObject spawnedBulletOBJ = SpawnManager.SpawnProjectile(newBulletOBJ, other.projectile.LastPosition, Quaternion.Euler(0f, 0f, finalAngle), true);
                            Projectile component        = spawnedBulletOBJ.GetComponent <Projectile>();
                            if (component != null)
                            {
                                component.Owner   = Owner;
                                component.Shooter = Owner.specRigidbody;
                                if (!Owner.PlayerHasActiveSynergy(synergyNameForIndex[i]))
                                {
                                    component.baseData.damage *= 0.5f;
                                    component.RuntimeUpdateScale(0.9f);
                                }
                                else
                                {
                                    component.baseData.speed *= 1.2f;
                                    component.baseData.range *= 3f;
                                    BounceProjModifier bounce = component.gameObject.GetComponent <BounceProjModifier>();
                                    if (bounce)
                                    {
                                        bounce.numberOfBounces++;
                                    }
                                    else
                                    {
                                        component.gameObject.AddComponent <BounceProjModifier>();
                                    }
                                }
                                component.AdjustPlayerProjectileTint(indexToColors[i], 2);
                            }
                            spawnedBulletOBJ.AddComponent <KaleidoscopicBullet>();
                            iteration++;
                        }
                        UnityEngine.Object.Destroy(other.projectile.gameObject);
                    }
                    PhysicsEngine.SkipCollision = true;
                }
                else if (other.projectile && !(other.projectile.Owner is PlayerController))
                {
                    PhysicsEngine.SkipCollision = false;
                }
            }
        }