Ejemplo n.º 1
0
        public virtual void InheritData(Gun source)
        {
            AdvancedGunBehaviour component = source.GetComponent <AdvancedGunBehaviour>();

            if (component != null)
            {
                this.preventNormalFireAudio    = component.preventNormalFireAudio;
                this.preventNormalReloadAudio  = component.preventNormalReloadAudio;
                this.overrideNormalReloadAudio = component.overrideNormalReloadAudio;
                this.overrideNormalFireAudio   = component.overrideNormalFireAudio;
                this.everPickedUpByPlayer      = component.everPickedUpByPlayer;
                this.everPickedUp = component.everPickedUp;
            }
        }
Ejemplo n.º 2
0
        public static void Init()
        {
            Gun gun = ETGMod.Databases.Items.NewGun("Bullat Launcher", "batlauncher");

            Game.Items.Rename("outdated_gun_mods:bullat_launcher", "spapi:bullat_launcher");
            GunExt.SetShortDescription(gun, "Fires Bullats");
            GunExt.SetLongDescription(gun, "Shoots angry bullats.\n\nCatching Bullats is fairly easy and every good gundead hunter has to have a Bullat collection. Frifle through had an idea to weaponize his collection, and made this gun.");
            GunExt.SetupSprite(gun, null, "batlauncher_idle_001", 16);
            GunExt.AddProjectileModuleFrom(gun, "klobb", true, false);
            gun.DefaultModule.shootStyle = ProjectileModule.ShootStyle.Charged;
            AdvancedGunBehaviour advancedGunBehaviour = gun.gameObject.AddComponent <AdvancedGunBehaviour>();

            advancedGunBehaviour.preventNormalFireAudio = true;
            gun.DefaultModule.angleVariance             = 0;
            gun.DefaultModule.ammoType = GameUIAmmoType.AmmoType.MEDIUM_BULLET;
            AIActor    bullat        = EnemyDatabase.GetOrLoadByGuid("2feb50a6a40f4f50982e89fd276f6f15");
            Projectile toInstantiate = null;

            foreach (AttackBehaviorBase behav in bullat.behaviorSpeculator.AttackBehaviors)
            {
                if (behav is AttackBehaviorGroup)
                {
                    foreach (AttackBehaviorGroup.AttackGroupItem item in (behav as AttackBehaviorGroup).AttackBehaviors)
                    {
                        if (item.Behavior is SuicideShotBehavior)
                        {
                            toInstantiate = bullat.bulletBank.GetBullet((item.Behavior as SuicideShotBehavior).bulletBankName).BulletObject.GetComponent <Projectile>();
                        }
                    }
                }
                else if (behav is SuicideShotBehavior)
                {
                    toInstantiate = bullat.bulletBank.GetBullet((behav as SuicideShotBehavior).bulletBankName).BulletObject.GetComponent <Projectile>();
                }
            }
            Projectile projectile = UnityEngine.Object.Instantiate(toInstantiate);

            projectile.gameObject.SetActive(false);
            FakePrefab.MarkAsFakePrefab(projectile.gameObject);
            UnityEngine.Object.DontDestroyOnLoad(projectile);
            gun.DefaultModule.chargeProjectiles = new List <ProjectileModule.ChargeProjectile>
            {
                new ProjectileModule.ChargeProjectile
                {
                    ChargeTime = 1.5f,
                    Projectile = projectile
                }
            };
            projectile.transform.parent    = gun.barrelOffset;
            projectile.collidesWithEnemies = true;
            projectile.baseData.damage     = 20f;
            gun.gunHandedness = GunHandedness.OneHanded;
            projectile.name   = "Bullat_Projectile";
            gun.DefaultModule.cooldownTime        = 0.5f;
            gun.DefaultModule.numberOfShotsInClip = 1;
            gun.DefaultModule.ammoType            = GameUIAmmoType.AmmoType.CUSTOM;
            gun.DefaultModule.customAmmoType      = "finished small";
            gun.muzzleFlashEffects.type           = VFXPoolType.None;
            gun.reloadTime = 1.5f;
            gun.SetBaseMaxAmmo(50);
            gun.quality = PickupObject.ItemQuality.C;
            gun.barrelOffset.transform.localPosition = new Vector3(1.25f, 1.0625f, 0f);
            gun.encounterTrackable.EncounterGuid     = "batlauncher";
            gun.gunClass = GunClass.CHARGE;
            gun.GetComponent <tk2dSpriteAnimator>().GetClipByName(gun.chargeAnimation).frames[1].FrameToDefinition().MakeOffset(new Vector2(-0.0625f, 0.0625f));
            gun.GetComponent <tk2dSpriteAnimator>().GetClipByName(gun.chargeAnimation).frames[3].FrameToDefinition().MakeOffset(new Vector2(-0.0625f, 0.0625f));
            gun.GetComponent <tk2dSpriteAnimator>().GetClipByName(gun.shootAnimation).frames[0].eventAudio    = "Play_ENM_bullat_tackle_01";
            gun.GetComponent <tk2dSpriteAnimator>().GetClipByName(gun.shootAnimation).frames[0].triggerEvent  = true;
            gun.GetComponent <tk2dSpriteAnimator>().GetClipByName(gun.chargeAnimation).frames[0].eventAudio   = "Play_ENM_bullat_charge_01";
            gun.GetComponent <tk2dSpriteAnimator>().GetClipByName(gun.chargeAnimation).frames[0].triggerEvent = true;
            gun.GetComponent <tk2dSpriteAnimator>().GetClipByName(gun.chargeAnimation).wrapMode  = tk2dSpriteAnimationClip.WrapMode.LoopSection;
            gun.GetComponent <tk2dSpriteAnimator>().GetClipByName(gun.chargeAnimation).loopStart = 2;
            ETGMod.Databases.Items.Add(gun, null, "ANY");
            gun.AddToTrorkShop();
            gun.AddToBlacksmithShop();
            gun.RemovePeskyQuestionmark();
            gun.PlaceItemInAmmonomiconAfterItemById(22);
            AdvancedInfiniteAmmoSynergyProcessor processor = gun.gameObject.AddComponent <AdvancedInfiniteAmmoSynergyProcessor>();

            processor.RequiredSynergy = "#KING_BULLAT_SHOOTER";
            processor.PreventsReload  = false;
        }
Ejemplo n.º 3
0
        public static void Init()
        {
            Gun gun = ETGMod.Databases.Items.NewGun("Super Bullat Launcher", "superbatlauncher");

            Game.Items.Rename("outdated_gun_mods:super_bullat_launcher", "spapi:bullat_launcher+king_bullat_shooter");
            GunExt.SetShortDescription(gun, "Fires Bullats");
            GunExt.SetLongDescription(gun, "Shoots angry bullats.\n\nCatching Bullats is fairly easy and every good gundead hunter has to have a Bullat collection. Frifle through had an idea to weaponize his collection, and made this gun.");
            GunExt.SetupSprite(gun, null, "superbatlauncher_idle_001", 12);
            for (int i = 0; i < 12; i++)
            {
                GunExt.AddProjectileModuleFrom(gun, "klobb", true, false);
            }
            int j = 0;

            foreach (ProjectileModule mod in gun.Volley.projectiles)
            {
                mod.angleVariance       = 0;
                mod.shootStyle          = ProjectileModule.ShootStyle.Charged;
                mod.cooldownTime        = 0.5f;
                mod.numberOfShotsInClip = 10;
                Projectile projectile = Instantiate(Toolbox.GetGunById(38).DefaultModule.projectiles[0]);
                projectile.gameObject.SetActive(false);
                FakePrefab.MarkAsFakePrefab(projectile.gameObject);
                DontDestroyOnLoad(projectile);
                projectile.transform.parent = gun.barrelOffset;
                projectile.baseData.damage  = 15f;
                projectile.name             = "SuperBullat_Projectile";
                BounceProjModifier modifier = projectile.gameObject.GetOrAddComponent <BounceProjModifier>();
                modifier.numberOfBounces = 1;
                mod.chargeProjectiles    = new List <ProjectileModule.ChargeProjectile>
                {
                    new ProjectileModule.ChargeProjectile
                    {
                        ChargeTime = 1.5f,
                        Projectile = projectile
                    }
                };
                mod.ammoType       = GameUIAmmoType.AmmoType.CUSTOM;
                mod.customAmmoType = "finished small";
                mod.angleFromAim   = j * 30;
                j++;
            }
            AdvancedGunBehaviour advancedGunBehaviour = gun.gameObject.AddComponent <AdvancedGunBehaviour>();

            advancedGunBehaviour.preventNormalFireAudio = true;
            gun.muzzleFlashEffects.type = VFXPoolType.None;
            gun.reloadTime    = 1.5f;
            gun.gunHandedness = GunHandedness.OneHanded;
            gun.SetBaseMaxAmmo(50);
            gun.InfiniteAmmo = true;
            gun.quality      = PickupObject.ItemQuality.EXCLUDED;
            gun.barrelOffset.transform.localPosition = new Vector3(1.625f, 1.5625f, 0f);
            gun.encounterTrackable.EncounterGuid     = "superbatlauncher";
            gun.gunClass = GunClass.CHARGE;
            gun.GetComponent <tk2dSpriteAnimator>().GetClipByName(gun.shootAnimation).frames[0].eventAudio    = "Play_ENM_bullat_tackle_01";
            gun.GetComponent <tk2dSpriteAnimator>().GetClipByName(gun.shootAnimation).frames[0].triggerEvent  = true;
            gun.GetComponent <tk2dSpriteAnimator>().GetClipByName(gun.chargeAnimation).frames[0].eventAudio   = "Play_ENM_bullat_charge_01";
            gun.GetComponent <tk2dSpriteAnimator>().GetClipByName(gun.chargeAnimation).frames[0].triggerEvent = true;
            gun.GetComponent <tk2dSpriteAnimator>().GetClipByName(gun.chargeAnimation).wrapMode  = tk2dSpriteAnimationClip.WrapMode.LoopSection;
            gun.GetComponent <tk2dSpriteAnimator>().GetClipByName(gun.chargeAnimation).loopStart = 1;
            ETGMod.Databases.Items.Add(gun, null, "ANY");
            gun.AddToTrorkShop();
            gun.AddToBlacksmithShop();
            gun.RemovePeskyQuestionmark();
            gun.PlaceItemInAmmonomiconAfterItemById(22);
        }
Ejemplo n.º 4
0
        public static void Init()
        {
            Gun gun = ETGMod.Databases.Items.NewGun("SpecialGUN", "special_gun");

            Game.Items.Rename("outdated_gun_mods:specialgun", "spapi:specialgun");
            GunExt.SetShortDescription(gun, "GunAPI When?");
            GunExt.SetLongDescription(gun, "Gun made by a sentient golden lock. Smites all things unworthy of living in Gungeon.\n\nThe word \"BAD\" can be heard from inside.");
            GunExt.SetupSprite(gun, null, "special_gun_idle_001", 8);
            GunExt.SetAnimationFPS(gun, gun.shootAnimation, 11);
            GunExt.SetAnimationFPS(gun, gun.reloadAnimation, 11);
            GunExt.AddProjectileModuleFrom(gun, "klobb", true, false);
            AdvancedGunBehaviour behav = gun.gameObject.AddComponent <AdvancedGunBehaviour>();

            behav.preventNormalReloadAudio  = true;
            behav.overrideNormalReloadAudio = "Play_WPN_magnum_reload_01";
            gun.gunSwitchGroup              = "BeholsterEye";
            gun.DefaultModule.shootStyle    = ProjectileModule.ShootStyle.SemiAutomatic;
            gun.DefaultModule.angleVariance = 0;
            gun.DefaultModule.ammoType      = GameUIAmmoType.AmmoType.MEDIUM_BULLET;
            SpecialGunProjectile projectile = Toolbox.CopyFields <SpecialGunProjectile>(UnityEngine.Object.Instantiate((PickupObjectDatabase.GetById(35) as Gun).DefaultModule.projectiles[0]));

            projectile.gameObject.SetActive(false);
            FakePrefab.MarkAsFakePrefab(projectile.gameObject);
            UnityEngine.Object.DontDestroyOnLoad(projectile);
            gun.DefaultModule.projectiles[0]      = projectile;
            projectile.transform.parent           = gun.barrelOffset;
            projectile.baseData.damage            = 10f;
            projectile.baseData.speed             = 20f;
            gun.carryPixelOffset                 += new IntVector2(1, 0);
            gun.DefaultModule.cooldownTime        = 0.15f;
            gun.DefaultModule.numberOfShotsInClip = 7;
            gun.reloadTime = 0.78f;
            gun.SetBaseMaxAmmo(100);
            gun.muzzleFlashEffects = Toolbox.GetGunById(53).muzzleFlashEffects;
            gun.quality            = PickupObject.ItemQuality.S;
            gun.barrelOffset.transform.localPosition = new Vector3(1.7f, 0.65f, 0f);
            gun.encounterTrackable.EncounterGuid     = "special_gun";
            gun.gunClass = GunClass.PISTOL;
            int index = 0;

            foreach (tk2dSpriteAnimationFrame frame in gun.GetComponent <tk2dSpriteAnimator>().GetClipByName(gun.idleAnimation).frames)
            {
                tk2dSpriteDefinition def = frame.spriteCollection.spriteDefinitions[frame.spriteId];
                if (def != null)
                {
                    def.MakeOffset(offsets[0][index]);
                }
                index++;
            }
            index = 0;
            foreach (tk2dSpriteAnimationFrame frame in gun.GetComponent <tk2dSpriteAnimator>().GetClipByName(gun.shootAnimation).frames)
            {
                tk2dSpriteDefinition def = frame.spriteCollection.spriteDefinitions[frame.spriteId];
                if (def != null)
                {
                    def.MakeOffset(offsets[1][index]);
                }
                index++;
            }
            index = 0;
            foreach (tk2dSpriteAnimationFrame frame in gun.GetComponent <tk2dSpriteAnimator>().GetClipByName(gun.reloadAnimation).frames)
            {
                tk2dSpriteDefinition def = frame.spriteCollection.spriteDefinitions[frame.spriteId];
                if (def != null)
                {
                    def.MakeOffset(offsets[2][index]);
                }
                index++;
            }
            gun.GetComponent <tk2dSpriteAnimator>().GetClipByName(gun.idleAnimation).frames   = new tk2dSpriteAnimationFrame[0];
            gun.GetComponent <tk2dSpriteAnimator>().GetClipByName(gun.shootAnimation).frames  = new tk2dSpriteAnimationFrame[0];
            gun.GetComponent <tk2dSpriteAnimator>().GetClipByName(gun.reloadAnimation).frames = new tk2dSpriteAnimationFrame[0];
            index = 0;
            foreach (string name in spriteNames[0])
            {
                tk2dSpriteAnimationFrame frame = new tk2dSpriteAnimationFrame {
                    spriteId = ETGMod.Databases.Items.WeaponCollection.GetSpriteIdByName(name), spriteCollection = ETGMod.Databases.Items.WeaponCollection
                };
                Toolbox.Add(ref gun.GetComponent <tk2dSpriteAnimator>().GetClipByName(gun.idleAnimation).frames, frame);
                index++;
            }
            index = 0;
            foreach (string name in spriteNames[1])
            {
                tk2dSpriteAnimationFrame frame = new tk2dSpriteAnimationFrame {
                    spriteId = ETGMod.Databases.Items.WeaponCollection.GetSpriteIdByName(name), spriteCollection = ETGMod.Databases.Items.WeaponCollection
                };
                Toolbox.Add(ref gun.GetComponent <tk2dSpriteAnimator>().GetClipByName(gun.shootAnimation).frames, frame);
                index++;
            }
            index = 0;
            foreach (string name in spriteNames[2])
            {
                tk2dSpriteAnimationFrame frame = new tk2dSpriteAnimationFrame {
                    spriteId = ETGMod.Databases.Items.WeaponCollection.GetSpriteIdByName(name), spriteCollection = ETGMod.Databases.Items.WeaponCollection
                };
                Toolbox.Add(ref gun.GetComponent <tk2dSpriteAnimator>().GetClipByName(gun.reloadAnimation).frames, frame);
                index++;
            }
            gun.GetComponent <tk2dSpriteAnimator>().GetClipByName(gun.reloadAnimation).frames[3].eventAudio   = "Play_WPN_SAA_spin_01";
            gun.GetComponent <tk2dSpriteAnimator>().GetClipByName(gun.reloadAnimation).frames[3].triggerEvent = true;
            ETGMod.Databases.Items.Add(gun, null, "ANY");
            gun.AddToTrorkShop();
            gun.AddToBlacksmithShop();
            gun.RemovePeskyQuestionmark();
            gun.PlaceItemInAmmonomiconAfterItemById(22);
            GameObject         obj      = SpriteBuilder.SpriteFromResource("SpecialItemPack/Resources/rad_vfx_bad_intro_001", new GameObject("SmiteVFX")).ProcessGameObject();
            tk2dSpriteAnimator animator = obj.AddComponent <tk2dSpriteAnimator>();

            animator.Library = obj.AddComponent <tk2dSpriteAnimation>();
            tk2dSpriteAnimationClip clip = new tk2dSpriteAnimationClip {
                name = "idle", fps = 7, frames = new tk2dSpriteAnimationFrame[0], wrapMode = tk2dSpriteAnimationClip.WrapMode.Once
            };

            foreach (string spritePath in smiteVFXSpritePaths)
            {
                int id = SpriteBuilder.AddSpriteToCollection(spritePath, SpriteBuilder.itemCollection);
                tk2dSpriteAnimationFrame frame = new tk2dSpriteAnimationFrame {
                    spriteId = id, spriteCollection = SpriteBuilder.itemCollection
                };
                frame.FrameToDefinition().ConstructOffsetsFromAnchor(tk2dBaseSprite.Anchor.MiddleCenter, frame.FrameToDefinition().position3);
                Toolbox.Add(ref clip.frames, frame);
            }
            animator.Library.clips     = new tk2dSpriteAnimationClip[] { clip };
            animator.playAutomatically = true;
            animator.DefaultClipId     = animator.GetClipIdByName("idle");
            SpriteAnimatorKiller kill = animator.gameObject.AddComponent <SpriteAnimatorKiller>();

            kill.fadeTime             = -1f;
            kill.animator             = animator;
            kill.delayDestructionTime = -1f;
            SmiteVFX = obj;
            GameObject         obj2      = SpriteBuilder.SpriteFromResource("SpecialItemPack/Resources/rad_vfx_bad_intro_001", new GameObject("SmiteVFX")).ProcessGameObject();
            tk2dSpriteAnimator animator2 = obj2.AddComponent <tk2dSpriteAnimator>();

            animator2.Library = obj2.AddComponent <tk2dSpriteAnimation>();
            tk2dSpriteAnimationClip clip2 = new tk2dSpriteAnimationClip {
                name = "idle", fps = 7, frames = new tk2dSpriteAnimationFrame[0], wrapMode = tk2dSpriteAnimationClip.WrapMode.Once
            };

            foreach (string spritePath in notSmiteVFXSpritePaths)
            {
                int id = SpriteBuilder.AddSpriteToCollection(spritePath, SpriteBuilder.itemCollection);
                tk2dSpriteAnimationFrame frame = new tk2dSpriteAnimationFrame {
                    spriteId = id, spriteCollection = SpriteBuilder.itemCollection
                };
                frame.FrameToDefinition().ConstructOffsetsFromAnchor(tk2dBaseSprite.Anchor.MiddleCenter, frame.FrameToDefinition().position3);
                Toolbox.Add(ref clip2.frames, frame);
            }
            animator2.Library.clips     = new tk2dSpriteAnimationClip[] { clip2 };
            animator2.playAutomatically = true;
            animator2.DefaultClipId     = animator2.GetClipIdByName("idle");
            SpriteAnimatorKiller kill2 = animator2.gameObject.AddComponent <SpriteAnimatorKiller>();

            kill2.fadeTime             = -1f;
            kill2.animator             = animator2;
            kill2.delayDestructionTime = -1f;
            NotSmiteVFX = obj2;
        }