Ejemplo n.º 1
0
        public static void ConstructOffsetsFromAnchor(this tk2dSpriteDefinition def, tk2dBaseSprite.Anchor anchor, Vector2?scale = null, bool fixesScale = false, bool changesCollider = true)
        {
            if (!scale.HasValue)
            {
                scale = new Vector2?(def.position3);
            }
            if (fixesScale)
            {
                Vector2 fixedScale = scale.Value - def.position0.XY();
                scale = new Vector2?(fixedScale);
            }
            float xOffset = 0;

            if (anchor == tk2dBaseSprite.Anchor.LowerCenter || anchor == tk2dBaseSprite.Anchor.MiddleCenter || anchor == tk2dBaseSprite.Anchor.UpperCenter)
            {
                xOffset = -(scale.Value.x / 2f);
            }
            else if (anchor == tk2dBaseSprite.Anchor.LowerRight || anchor == tk2dBaseSprite.Anchor.MiddleRight || anchor == tk2dBaseSprite.Anchor.UpperRight)
            {
                xOffset = -scale.Value.x;
            }
            float yOffset = 0;

            if (anchor == tk2dBaseSprite.Anchor.MiddleLeft || anchor == tk2dBaseSprite.Anchor.MiddleCenter || anchor == tk2dBaseSprite.Anchor.MiddleLeft)
            {
                yOffset = -(scale.Value.y / 2f);
            }
            else if (anchor == tk2dBaseSprite.Anchor.UpperLeft || anchor == tk2dBaseSprite.Anchor.UpperCenter || anchor == tk2dBaseSprite.Anchor.UpperRight)
            {
                yOffset = -scale.Value.y;
            }
            def.MakeOffset(new Vector2(xOffset, yOffset), changesCollider);
        }
Ejemplo n.º 2
0
        // Token: 0x06000099 RID: 153 RVA: 0x00007FFC File Offset: 0x000061FC
        public static void ConstructOffsetsFromAnchor(this tk2dSpriteDefinition def, tk2dBaseSprite.Anchor anchor, Vector2 scale)
        {
            float x    = 0f;
            bool  flag = anchor == tk2dBaseSprite.Anchor.LowerCenter || anchor == tk2dBaseSprite.Anchor.MiddleCenter || anchor == tk2dBaseSprite.Anchor.UpperCenter;

            if (flag)
            {
                x = -(scale.x / 2f);
            }
            else
            {
                bool flag2 = anchor == tk2dBaseSprite.Anchor.LowerRight || anchor == tk2dBaseSprite.Anchor.MiddleRight || anchor == tk2dBaseSprite.Anchor.UpperRight;
                if (flag2)
                {
                    x = -scale.x;
                }
            }
            float y     = 0f;
            bool  flag3 = anchor == tk2dBaseSprite.Anchor.MiddleLeft || anchor == tk2dBaseSprite.Anchor.MiddleCenter || anchor == tk2dBaseSprite.Anchor.MiddleLeft;

            if (flag3)
            {
                y = -(scale.y / 2f);
            }
            else
            {
                bool flag4 = anchor == tk2dBaseSprite.Anchor.UpperLeft || anchor == tk2dBaseSprite.Anchor.UpperCenter || anchor == tk2dBaseSprite.Anchor.UpperRight;
                if (flag4)
                {
                    y = -scale.y;
                }
            }
            def.MakeOffset(new Vector2(x, y));
        }
Ejemplo n.º 3
0
        public static void ConstructOffsetsFromAnchor(this tk2dSpriteDefinition def, tk2dBaseSprite.Anchor anchor, Vector2 scale, bool changesCollider = true)
        {
            float xOffset = 0;

            if (anchor == tk2dBaseSprite.Anchor.LowerCenter || anchor == tk2dBaseSprite.Anchor.MiddleCenter || anchor == tk2dBaseSprite.Anchor.UpperCenter)
            {
                xOffset = -(scale.x / 2f);
            }
            else if (anchor == tk2dBaseSprite.Anchor.LowerRight || anchor == tk2dBaseSprite.Anchor.MiddleRight || anchor == tk2dBaseSprite.Anchor.UpperRight)
            {
                xOffset = -scale.x;
            }
            float yOffset = 0;

            if (anchor == tk2dBaseSprite.Anchor.MiddleLeft || anchor == tk2dBaseSprite.Anchor.MiddleCenter || anchor == tk2dBaseSprite.Anchor.MiddleLeft)
            {
                yOffset = -(scale.y / 2f);
            }
            else if (anchor == tk2dBaseSprite.Anchor.UpperLeft || anchor == tk2dBaseSprite.Anchor.UpperCenter || anchor == tk2dBaseSprite.Anchor.UpperRight)
            {
                yOffset = -scale.y;
            }
            def.MakeOffset(new Vector2(xOffset, yOffset), changesCollider);
        }
        public static void Add()
        {
            Gun gun = ETGMod.Databases.Items.NewGun("Bullet Blade", "bulletblade");

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

            behav.preventNormalFireAudio   = true;
            behav.preventNormalReloadAudio = true;
            //behav.overrideNormalFireAudio = "Play_OBJ_gate_slam_01";//"Play_ENM_gunnut_swing_01";

            gun.SetShortDescription("Forged of Pure Bullet");
            gun.SetLongDescription("The hefty blade of the fearsome armoured sentinels that tread the Gungeon's Halls." + "\n\nHas claimed the life of many a careless gungeoneer with it's wide spread.");
            gun.SetupSprite(null, "bulletblade_idle_001", 8);
            gun.SetAnimationFPS(gun.shootAnimation, 12);
            gun.SetAnimationFPS(gun.chargeAnimation, 6);

            gun.AddPassiveStatModifier(PlayerStats.StatType.Curse, 1f, StatModifier.ModifyMethod.ADDITIVE);

            gun.GetComponent <tk2dSpriteAnimator>().GetClipByName(gun.shootAnimation).frames[0].eventAudio   = "Play_ENM_gunnut_shockwave_01";
            gun.GetComponent <tk2dSpriteAnimator>().GetClipByName(gun.shootAnimation).frames[0].triggerEvent = true;

            for (int i = 0; i < 45; i++)
            {
                gun.AddProjectileModuleFrom(PickupObjectDatabase.GetById(86) as Gun, true, false);
            }

            //GUN STATS
            foreach (ProjectileModule mod in gun.Volley.projectiles)
            {
                mod.ammoCost            = 1;
                mod.shootStyle          = ProjectileModule.ShootStyle.Charged;
                mod.sequenceStyle       = ProjectileModule.ProjectileSequenceStyle.Random;
                mod.cooldownTime        = 2.5f;
                mod.angleVariance       = 70f;
                mod.numberOfShotsInClip = 1;
                Projectile projectile = UnityEngine.Object.Instantiate <Projectile>(mod.projectiles[0]);
                mod.projectiles[0] = projectile;
                projectile.gameObject.SetActive(false);
                FakePrefab.MarkAsFakePrefab(projectile.gameObject);
                UnityEngine.Object.DontDestroyOnLoad(projectile);
                projectile.baseData.damage *= 1.6f;
                projectile.baseData.speed  *= 0.6f;
                projectile.baseData.range  *= 1f;
                projectile.SetProjectileSpriteRight("enemystyle_projectile", 10, 10, true, tk2dBaseSprite.Anchor.MiddleCenter, 8, 8);
                if (mod != gun.DefaultModule)
                {
                    mod.ammoCost = 0;
                }
                projectile.transform.parent = gun.barrelOffset;

                ProjectileModule.ChargeProjectile chargeProj = new ProjectileModule.ChargeProjectile
                {
                    Projectile = projectile,
                    ChargeTime = 1f,
                };
                mod.chargeProjectiles = new List <ProjectileModule.ChargeProjectile> {
                    chargeProj
                };
            }
            gun.reloadTime = 1f;
            gun.SetBaseMaxAmmo(50);
            gun.quality  = PickupObject.ItemQuality.B;
            gun.gunClass = GunClass.CHARGE;
            gun.GetComponent <tk2dSpriteAnimator>().GetClipByName(gun.chargeAnimation).wrapMode  = tk2dSpriteAnimationClip.WrapMode.LoopSection;
            gun.GetComponent <tk2dSpriteAnimator>().GetClipByName(gun.chargeAnimation).loopStart = 4;

            tk2dSpriteAnimationClip chargeClip = gun.GetComponent <tk2dSpriteAnimator>().GetClipByName(gun.chargeAnimation);

            foreach (tk2dSpriteAnimationFrame frame in chargeClip.frames)
            {
                tk2dSpriteDefinition def = frame.spriteCollection.spriteDefinitions[frame.spriteId];
                if (def != null)
                {
                    def.MakeOffset(new Vector2(-0.56f, -2.31f));
                }
            }
            tk2dSpriteAnimationClip fireClip = gun.GetComponent <tk2dSpriteAnimator>().GetClipByName(gun.shootAnimation);

            foreach (tk2dSpriteAnimationFrame frame in fireClip.frames)
            {
                tk2dSpriteDefinition def = frame.spriteCollection.spriteDefinitions[frame.spriteId];
                if (def != null)
                {
                    def.MakeOffset(new Vector2(-0.56f, -2.31f));
                }
            }

            gun.encounterTrackable.EncounterGuid = "this is the Bullet Blade";
            ETGMod.Databases.Items.Add(gun, null, "ANY");
            gun.barrelOffset.transform.localPosition = new Vector3(3.18f, -0.31f, 0f);
            BulletBladeID = gun.PickupObjectId;

            gun.SetupUnlockOnCustomFlag(CustomDungeonFlags.JAMMEDGUNNUT_QUEST_REWARDED, true);
        }
Ejemplo n.º 5
0
        public static void Init()
        {
            Gun gun = ETGMod.Databases.Items.NewGun("High-Quality Gun", "hd");

            Game.Items.Rename("outdated_gun_mods:high-quality_gun", "spapi:high_quality_gun");
            gun.gameObject.AddComponent <HDGun>();
            GunExt.SetShortDescription(gun, "HD!");
            GunExt.SetLongDescription(gun, "Bullets charm enemies.\n\nThis gun is just magnum, but but has 4 times more pixels. Because of that, it seems very weird among all other guns, but at the same time looks kinda cool!");
            GunExt.SetupSprite(gun, null, "hd_idle_001", 8);
            GunExt.SetAnimationFPS(gun, gun.shootAnimation, 13);
            GunExt.SetAnimationFPS(gun, gun.reloadAnimation, 12);
            GunExt.AddProjectileModuleFrom(gun, Toolbox.GetGunById(38), true, false);
            gun.gunSwitchGroup = "Magnum";
            VFXPool pool = new VFXPool();

            pool.type = VFXPoolType.All;
            VFXComplex complex = new VFXComplex();
            VFXObject  vfObj   = new VFXObject();
            GameObject obj     = new GameObject("hd_smoke");

            obj.SetActive(false);
            FakePrefab.MarkAsFakePrefab(obj);
            UnityEngine.Object.DontDestroyOnLoad(obj);
            tk2dSprite              sprite     = obj.AddComponent <tk2dSprite>();
            tk2dSpriteAnimator      animator   = obj.AddComponent <tk2dSpriteAnimator>();
            tk2dSpriteAnimationClip clip       = new tk2dSpriteAnimationClip();
            GameObject              origEffect = Toolbox.GetGunById(38).muzzleFlashEffects.effects[0].effects[0].effect;
            VFXObject origVfEffect             = Toolbox.GetGunById(38).muzzleFlashEffects.effects[0].effects[0];

            clip.fps    = origEffect.GetAnyComponent <tk2dSpriteAnimator>().DefaultClip.fps;
            clip.frames = new tk2dSpriteAnimationFrame[0];
            for (int i = 1; i < 4; i++)
            {
                tk2dSpriteAnimationFrame frame = new tk2dSpriteAnimationFrame();
                frame.spriteId = Toolbox.VFXCollection.GetSpriteIdByName("hd_smoke_00" + i);
                Toolbox.VFXCollection.inst.spriteDefinitions[frame.spriteId] = Toolbox.VFXCollection.inst.spriteDefinitions[origEffect.GetAnyComponent <tk2dSpriteAnimator>().DefaultClip.frames[i - 1].spriteId].CopyDefinitionFrom();
                frame.spriteCollection = Toolbox.VFXCollection;
                clip.frames            = clip.frames.Concat(new tk2dSpriteAnimationFrame[] { frame }).ToArray();
            }
            clip.wrapMode = tk2dSpriteAnimationClip.WrapMode.Once;
            clip.name     = "start";
            animator.spriteAnimator.Library       = animator.gameObject.AddComponent <tk2dSpriteAnimation>();
            animator.spriteAnimator.Library.clips = new tk2dSpriteAnimationClip[] { clip };
            animator.playAutomatically            = true;
            animator.DefaultClipId = animator.GetClipIdByName("start");
            SpriteAnimatorKiller kill = animator.gameObject.AddComponent <SpriteAnimatorKiller>();

            kill.fadeTime             = -1f;
            kill.animator             = animator;
            kill.delayDestructionTime = -1f;
            obj.gameObject.SetLayerRecursively(LayerMask.NameToLayer("Unpixelated"));
            vfObj.orphaned        = origVfEffect.orphaned;
            vfObj.attached        = origVfEffect.attached;
            vfObj.persistsOnDeath = origVfEffect.persistsOnDeath;
            vfObj.usesZHeight     = origVfEffect.usesZHeight;
            vfObj.zHeight         = origVfEffect.zHeight;
            vfObj.alignment       = origVfEffect.alignment;
            vfObj.destructible    = origVfEffect.destructible;
            vfObj.effect          = obj;
            VFXObject  vfObj2 = new VFXObject();
            GameObject obj2   = new GameObject("hd_flare");

            obj2.SetActive(false);
            FakePrefab.MarkAsFakePrefab(obj2);
            UnityEngine.Object.DontDestroyOnLoad(obj2);
            tk2dSprite              sprite2     = obj2.AddComponent <tk2dSprite>();
            tk2dSpriteAnimator      animator2   = obj2.AddComponent <tk2dSpriteAnimator>();
            tk2dSpriteAnimationClip clip2       = new tk2dSpriteAnimationClip();
            GameObject              origEffect2 = Toolbox.GetGunById(38).muzzleFlashEffects.effects[0].effects[1].effect;
            VFXObject origVfEffect2             = Toolbox.GetGunById(38).muzzleFlashEffects.effects[0].effects[1];

            clip2.fps    = origEffect2.GetAnyComponent <tk2dSpriteAnimator>().DefaultClip.fps;
            clip2.frames = new tk2dSpriteAnimationFrame[0];
            for (int i = 1; i < 6; i++)
            {
                tk2dSpriteAnimationFrame frame = new tk2dSpriteAnimationFrame();
                frame.spriteId = Toolbox.VFXCollection.GetSpriteIdByName("hd_flare_00" + i);
                Toolbox.VFXCollection.inst.spriteDefinitions[frame.spriteId] = Toolbox.VFXCollection.inst.spriteDefinitions[origEffect2.GetAnyComponent <tk2dSpriteAnimator>().DefaultClip.frames[i - 1].spriteId].CopyDefinitionFrom();
                frame.spriteCollection = Toolbox.VFXCollection;
                clip2.frames           = clip2.frames.Concat(new tk2dSpriteAnimationFrame[] { frame }).ToArray();
            }
            clip2.wrapMode = tk2dSpriteAnimationClip.WrapMode.Once;
            clip2.name     = "start";
            animator2.spriteAnimator.Library       = animator2.gameObject.AddComponent <tk2dSpriteAnimation>();
            animator2.spriteAnimator.Library.clips = new tk2dSpriteAnimationClip[] { clip2 };
            animator2.playAutomatically            = true;
            animator2.DefaultClipId = animator2.GetClipIdByName("start");
            SpriteAnimatorKiller kill2 = animator2.gameObject.AddComponent <SpriteAnimatorKiller>();

            kill2.fadeTime             = -1f;
            kill2.animator             = animator2;
            kill2.delayDestructionTime = -1f;
            obj2.gameObject.SetLayerRecursively(LayerMask.NameToLayer("Unpixelated"));
            vfObj2.orphaned        = origVfEffect2.orphaned;
            vfObj2.attached        = origVfEffect2.attached;
            vfObj2.persistsOnDeath = origVfEffect2.persistsOnDeath;
            vfObj2.usesZHeight     = origVfEffect2.usesZHeight;
            vfObj2.zHeight         = origVfEffect2.zHeight;
            vfObj2.alignment       = origVfEffect2.alignment;
            vfObj2.destructible    = origVfEffect2.destructible;
            vfObj2.effect          = obj2;
            complex.effects        = new VFXObject[] { vfObj, vfObj2 };
            pool.effects           = new VFXComplex[] { complex };
            gun.muzzleFlashEffects = pool;
            Projectile projectile = UnityEngine.Object.Instantiate <Projectile>((PickupObjectDatabase.GetById(38) as Gun).DefaultModule.projectiles[0]);

            projectile.gameObject.SetActive(false);
            FakePrefab.MarkAsFakePrefab(projectile.gameObject);
            UnityEngine.Object.DontDestroyOnLoad(projectile);
            gun.DefaultModule.projectiles[0] = projectile;
            gun.OverrideAngleSnap            = null;
            projectile.transform.parent      = gun.barrelOffset;
            projectile.AppliesCharm          = true;
            projectile.CharmApplyChance      = 100f;
            projectile.baseData.damage       = 20f;
            projectile.charmEffect           = (PickupObjectDatabase.GetById(527) as BulletStatusEffectItem).CharmModifierEffect;
            projectile.GetAnySprite().spriteId = ETGMod.Databases.Items.ProjectileCollection.inst.GetSpriteIdByName("hd_bullet_001");
            ETGMod.Databases.Items.ProjectileCollection.inst.spriteDefinitions[projectile.GetAnySprite().spriteId] =
                ETGMod.Databases.Items.ProjectileCollection.inst.spriteDefinitions[(PickupObjectDatabase.GetById(38) as Gun).DefaultModule.projectiles[0].GetAnySprite().spriteId].CopyDefinitionFrom();
            gun.DefaultModule.numberOfShotsInClip = 8;
            projectile.name = "Charmingly_HD_Projectile";
            gun.reloadTime  = 1.0f;
            gun.SetBaseMaxAmmo(280);
            gun.quality = PickupObject.ItemQuality.S;
            gun.encounterTrackable.EncounterGuid = "hd";
            gun.gunClass = GunClass.PISTOL;
            GameObject shellCasing = UnityEngine.Object.Instantiate(Toolbox.GetGunById(38).shellCasing);

            shellCasing.SetActive(false);
            FakePrefab.MarkAsFakePrefab(shellCasing);
            tk2dSpriteAnimator      gunAnim    = gun.GetComponent <tk2dSpriteAnimator>();
            tk2dSpriteAnimationClip reloadClip = gunAnim.GetClipByName(gun.reloadAnimation);

            reloadClip.frames = new tk2dSpriteAnimationFrame[0];
            foreach (string text in reloadFrames)
            {
                tk2dSpriteAnimationFrame frame = new tk2dSpriteAnimationFrame {
                    spriteCollection = ETGMod.Databases.Items.WeaponCollection, spriteId = ETGMod.Databases.Items.WeaponCollection.GetSpriteIdByName(text)
                };
                reloadClip.frames = reloadClip.frames.Concat(new tk2dSpriteAnimationFrame[] { frame }).ToArray();
            }
            UnityEngine.Object.DontDestroyOnLoad(shellCasing);
            shellCasing.GetAnyComponent <tk2dBaseSprite>().SetSprite(Toolbox.VFXCollection, Toolbox.VFXCollection.GetSpriteIdByName("hd_shell_001"));
            Toolbox.VFXCollection.spriteDefinitions[shellCasing.GetAnyComponent <tk2dBaseSprite>().spriteId] =
                Toolbox.GetGunById(38).shellCasing.GetAnyComponent <tk2dBaseSprite>().Collection.spriteDefinitions[Toolbox.GetGunById(38).shellCasing.GetAnyComponent <tk2dBaseSprite>().spriteId].CopyDefinitionFrom();
            shellCasing.AddComponent <AlwaysUnpixeledBehaviour>();
            gun.shellCasing            = shellCasing;
            gun.shellsToLaunchOnFire   = 0;
            gun.shellsToLaunchOnReload = 6;
            gun.reloadShellLaunchFrame = 2;
            gun.barrelOffset.transform.localPosition = new Vector3(1.0625f, 0.5625f, 0f);
            ETGMod.Databases.Items.Add(gun, null, "ANY");
            gun.AddToCursulaShop();
            gun.AddToBlacksmithShop();
            gun.RemovePeskyQuestionmark();
            gun.PlaceItemInAmmonomiconAfterItemById(38);
            ItemBuilder.AddPassiveStatModifier(gun, PlayerStats.StatType.Coolness, 3, StatModifier.ModifyMethod.ADDITIVE);
            tk2dSpriteDefinition ammonomiconDef = AmmonomiconController.ForceInstance.EncounterIconCollection.spriteDefinitions[AmmonomiconController.ForceInstance.EncounterIconCollection.GetSpriteIdByName("hd_idle_001")];

            ammonomiconDef.position1                  = new Vector3(ammonomiconDef.position1.x / 2, ammonomiconDef.position1.y / 2, ammonomiconDef.position1.z / 2);
            ammonomiconDef.position2                  = new Vector3(ammonomiconDef.position2.x / 2, ammonomiconDef.position2.y / 2, ammonomiconDef.position2.z / 2);
            ammonomiconDef.position3                  = new Vector3(ammonomiconDef.position3.x / 2, ammonomiconDef.position3.y / 2, ammonomiconDef.position3.z / 2);
            ammonomiconDef.boundsDataCenter           = new Vector3(ammonomiconDef.boundsDataCenter.x / 2, ammonomiconDef.boundsDataCenter.y / 2, ammonomiconDef.boundsDataCenter.z / 2);
            ammonomiconDef.boundsDataExtents          = new Vector3(ammonomiconDef.boundsDataExtents.x / 2, ammonomiconDef.boundsDataExtents.y / 2, ammonomiconDef.boundsDataExtents.z / 2);
            ammonomiconDef.untrimmedBoundsDataCenter  = new Vector3(ammonomiconDef.untrimmedBoundsDataCenter.x / 2, ammonomiconDef.untrimmedBoundsDataCenter.y / 2, ammonomiconDef.untrimmedBoundsDataCenter.z / 2);
            ammonomiconDef.untrimmedBoundsDataExtents = new Vector3(ammonomiconDef.untrimmedBoundsDataExtents.x / 2, ammonomiconDef.untrimmedBoundsDataExtents.y / 2, ammonomiconDef.untrimmedBoundsDataExtents.z / 2);
            List <tk2dSpriteDefinition> affected = new List <tk2dSpriteDefinition>();

            foreach (tk2dSpriteAnimationClip clip3 in gun.GetGunAnimationClips())
            {
                if (clip3.frames != null)
                {
                    foreach (tk2dSpriteAnimationFrame frame in clip3.frames)
                    {
                        if (frame != null && frame.spriteCollection != null)
                        {
                            tk2dSpriteDefinition def = frame.spriteCollection.spriteDefinitions[frame.spriteId];
                            if (def != null && !affected.Contains(def))
                            {
                                def.position1                  = new Vector3(def.position1.x / 2, def.position1.y / 2, def.position1.z / 2);
                                def.position2                  = new Vector3(def.position2.x / 2, def.position2.y / 2, def.position2.z / 2);
                                def.position3                  = new Vector3(def.position3.x / 2, def.position3.y / 2, def.position3.z / 2);
                                def.boundsDataCenter           = new Vector3(def.boundsDataCenter.x / 2, def.boundsDataCenter.y / 2, def.boundsDataCenter.z / 2);
                                def.boundsDataExtents          = new Vector3(def.boundsDataExtents.x / 2, def.boundsDataExtents.y / 2, def.boundsDataExtents.z / 2);
                                def.untrimmedBoundsDataCenter  = new Vector3(def.untrimmedBoundsDataCenter.x / 2, def.untrimmedBoundsDataCenter.y / 2, def.untrimmedBoundsDataCenter.z / 2);
                                def.untrimmedBoundsDataExtents = new Vector3(def.untrimmedBoundsDataExtents.x / 2, def.untrimmedBoundsDataExtents.y / 2, def.untrimmedBoundsDataExtents.z / 2);
                                def.RemoveOffset();
                                affected.Add(def);
                            }
                        }
                    }
                }
            }
            affected.Clear();
            int index = 0;

            foreach (tk2dSpriteAnimationFrame frame in gun.GetComponent <tk2dSpriteAnimator>().GetClipByName(gun.idleAnimation).frames)
            {
                tk2dSpriteDefinition def = frame.spriteCollection.spriteDefinitions[frame.spriteId];
                if (def != null && !affected.Contains(def))
                {
                    def.MakeOffset(offsets[0][index]);
                    affected.Add(def);
                }
                index++;
            }
            index = 0;
            foreach (tk2dSpriteAnimationFrame frame in gun.GetComponent <tk2dSpriteAnimator>().GetClipByName(gun.shootAnimation).frames)
            {
                tk2dSpriteDefinition def = frame.spriteCollection.spriteDefinitions[frame.spriteId];
                if (def != null && !affected.Contains(def))
                {
                    def.MakeOffset(offsets[1][index]);
                    affected.Add(def);
                }
                index++;
            }
            index = 0;
            foreach (tk2dSpriteAnimationFrame frame in gun.GetComponent <tk2dSpriteAnimator>().GetClipByName(gun.reloadAnimation).frames)
            {
                tk2dSpriteDefinition def = frame.spriteCollection.spriteDefinitions[frame.spriteId];
                if (def != null && !affected.Contains(def))
                {
                    def.MakeOffset(offsets[2][index]);
                    affected.Add(def);
                }
                index++;
            }
            AdvancedHoveringGunSynergyProcessor processor = gun.gameObject.AddComponent <AdvancedHoveringGunSynergyProcessor>();

            processor.RequiredSynergy              = "#LOW-QUALITY_HELP";
            processor.TargetGunID                  = 38;
            processor.UsesMultipleGuns             = false;
            processor.PositionType                 = HoveringGunController.HoverPosition.CIRCULATE;
            processor.AimType                      = HoveringGunController.AimType.PLAYER_AIM;
            processor.FireType                     = HoveringGunController.FireType.ON_RELOAD;
            processor.FireCooldown                 = 0.2f;
            processor.FireDuration                 = 0f;
            processor.OnlyOnEmptyReload            = false;
            processor.ShootAudioEvent              = "";
            processor.OnEveryShotAudioEvent        = "";
            processor.FinishedShootingAudioEvent   = "";
            processor.Trigger                      = AdvancedHoveringGunSynergyProcessor.TriggerStyle.CONSTANT;
            processor.NumToTrigger                 = 1;
            processor.TriggerDuration              = 0f;
            processor.ConsumesTargetGunAmmo        = false;
            processor.ChanceToConsumeTargetGunAmmo = 0f;
        }
Ejemplo n.º 6
0
        public static void Add()
        {
            Gun gun = ETGMod.Databases.Items.NewGun("Pumhart", "pumhart");

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

            gun.SetShortDescription("Mega Bore");
            gun.SetLongDescription("A magnificent example of bombard weaponry, built to slay giants!" + "\n\nNormally impossible for a single person to wield, Gunymede's reduced gravity somewhat allows this ridiculous feat.");

            gun.SetupSprite(null, "pumhart_idle_001", 8);
            gun.SetAnimationFPS(gun.chargeAnimation, 1);

            gun.AddProjectileModuleFrom(PickupObjectDatabase.GetById(86) as Gun, true, false);
            gun.AddCurrentGunStatModifier(PlayerStats.StatType.MovementSpeed, 0.6f, StatModifier.ModifyMethod.MULTIPLICATIVE);
            gun.AddCurrentGunStatModifier(PlayerStats.StatType.DodgeRollSpeedMultiplier, 0.6f, StatModifier.ModifyMethod.MULTIPLICATIVE);
            //GUN STATS
            gun.DefaultModule.ammoCost      = 1;
            gun.DefaultModule.shootStyle    = ProjectileModule.ShootStyle.Charged;
            gun.DefaultModule.sequenceStyle = ProjectileModule.ProjectileSequenceStyle.Random;
            gun.reloadTime                           = 5f;
            gun.muzzleFlashEffects                   = (PickupObjectDatabase.GetById(37) as Gun).muzzleFlashEffects;
            gun.DefaultModule.cooldownTime           = 5f;
            gun.DefaultModule.angleVariance          = 0;
            gun.DefaultModule.numberOfShotsInClip    = 1;
            gun.barrelOffset.transform.localPosition = new Vector3(6.43f, 1.81f, 0f);
            gun.SetBaseMaxAmmo(10);
            gun.ammo     = 10;
            gun.gunClass = GunClass.CHARGE;

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

            projectile.gameObject.SetActive(false);
            FakePrefab.MarkAsFakePrefab(projectile.gameObject);
            UnityEngine.Object.DontDestroyOnLoad(projectile);
            projectile.baseData.damage = 100f;
            projectile.baseData.force *= 10f;
            projectile.baseData.speed *= 1f;
            projectile.baseData.range *= 100f;
            PierceProjModifier pierce = projectile.gameObject.GetOrAddComponent <PierceProjModifier>();

            pierce.penetration += 70;
            MaintainDamageOnPierce maintainDMG = projectile.gameObject.GetOrAddComponent <MaintainDamageOnPierce>();

            pierce.penetratesBreakables = true;
            BlockEnemyProjectilesMod block = projectile.gameObject.GetOrAddComponent <BlockEnemyProjectilesMod>();

            block.projectileSurvives = true;
            BounceProjModifier bounce = projectile.gameObject.GetOrAddComponent <BounceProjModifier>();

            bounce.numberOfBounces      += 70;
            bounce.additionalScreenShake = (PickupObjectDatabase.GetById(37) as Gun).DefaultModule.chargeProjectiles[0].Projectile.GetComponent <BounceProjModifier>().additionalScreenShake;
            projectile.hitEffects.overrideMidairDeathVFX = (PickupObjectDatabase.GetById(37) as Gun).DefaultModule.chargeProjectiles[0].Projectile.hitEffects.overrideMidairDeathVFX;
            projectile.hitEffects.alwaysUseMidair        = true;
            projectile.SetProjectileSpriteRight("pumhart_proj", 48, 48, false, tk2dBaseSprite.Anchor.MiddleCenter, 30, 30);

            ProjectileModule.ChargeProjectile chargeProj = new ProjectileModule.ChargeProjectile
            {
                Projectile = projectile,
                ChargeTime = 5,
            };
            gun.DefaultModule.chargeProjectiles = new List <ProjectileModule.ChargeProjectile> {
                chargeProj
            };

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

            gun.GetComponent <tk2dSpriteAnimator>().GetClipByName(gun.chargeAnimation).wrapMode  = tk2dSpriteAnimationClip.WrapMode.LoopSection;
            gun.GetComponent <tk2dSpriteAnimator>().GetClipByName(gun.chargeAnimation).loopStart = 4;

            tk2dSpriteAnimationClip chargeClip = gun.GetComponent <tk2dSpriteAnimator>().GetClipByName(gun.chargeAnimation);

            foreach (tk2dSpriteAnimationFrame frame in chargeClip.frames)
            {
                tk2dSpriteDefinition def = frame.spriteCollection.spriteDefinitions[frame.spriteId];
                if (def != null)
                {
                    def.MakeOffset(new Vector2(-2.12f, -1.75f));
                }
            }
            tk2dSpriteAnimationClip fireClip = gun.GetComponent <tk2dSpriteAnimator>().GetClipByName(gun.shootAnimation);

            foreach (tk2dSpriteAnimationFrame frame in fireClip.frames)
            {
                tk2dSpriteDefinition def = frame.spriteCollection.spriteDefinitions[frame.spriteId];
                if (def != null)
                {
                    def.MakeOffset(new Vector2(-2.12f, -1.75f));
                }
            }
            gun.gunSwitchGroup = (PickupObjectDatabase.GetById(37) as Gun).gunSwitchGroup;

            gun.gunScreenShake = new ScreenShakeSettings(5f, 1f, 0.5f, 0.5f);
            PumhartID          = gun.PickupObjectId;
        }
Ejemplo n.º 7
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;
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Used to create new VFX. Place sprites inside of Mods/YourModFolder/sprites/VFX Collection, inside the EtG directory. Each parameter that is a list must have an entry for each sprite of the animation
        /// </summary>
        /// <param name="name">The name of the VFX</param>
        /// <param name="spriteNames">The name of the sprites for the VFX, like VFX_001, VFX_002, etc.</param>
        /// <param name="fps">The frame rate the animation will play at</param>
        /// <param name="spriteSizes">The size of each sprite in the animation. Must have an IntVector2 entry for each sprite in the animation</param>
        /// <param name="anchors">I don't know what exactly this does</param>
        /// <param name="manualOffsets">I don't know what exactly this does</param>
        /// <param name="orphaned">I don't know what exactly this does</param>
        /// <param name="attached">I don't know what exactly this does</param>
        /// <param name="persistsOnDeath">Best left false</param>
        /// <param name="usesZHeight">Change if needed</param>
        /// <param name="zHeight">Change if needed, but usually left at 0</param>
        /// <param name="alignment">Leave at Fixed</param>
        /// <param name="destructible">Always set to true</param>
        /// <param name="emissivePowers">Doesn't seem to work, set all entries at 0. Might cause bugs if tinkered with</param>
        /// <param name="emissiveColors">Does't seem to work, set all entries to VFXLibrary.emptyColor. Might cause bugs if tinkered with</param>
        /// <returns></returns>
        public static VFXPool CreateMuzzleflash(string name, List <string> spriteNames, int fps, List <IntVector2> spriteSizes, List <tk2dBaseSprite.Anchor> anchors, List <Vector2> manualOffsets, bool orphaned, bool attached, bool persistsOnDeath,
                                                bool usesZHeight, float zHeight, VFXAlignment alignment, bool destructible, List <float> emissivePowers, List <Color> emissiveColors)
        {
            VFXPool pool = new VFXPool();

            pool.type = VFXPoolType.All;
            VFXComplex complex = new VFXComplex();
            VFXObject  vfObj   = new VFXObject();
            GameObject obj     = new GameObject(name);

            obj.SetActive(false);
            FakePrefab.MarkAsFakePrefab(obj);
            UnityEngine.Object.DontDestroyOnLoad(obj);
            tk2dSprite              sprite   = obj.AddComponent <tk2dSprite>();
            tk2dSpriteAnimator      animator = obj.AddComponent <tk2dSpriteAnimator>();
            tk2dSpriteAnimationClip clip     = new tk2dSpriteAnimationClip();

            clip.fps    = fps;
            clip.frames = new tk2dSpriteAnimationFrame[0];
            for (int i = 0; i < spriteNames.Count; i++)
            {
                string                spriteName   = spriteNames[i];
                IntVector2            spriteSize   = spriteSizes[i];
                tk2dBaseSprite.Anchor anchor       = anchors[i];
                Vector2               manualOffset = manualOffsets[i];
                float emissivePower            = emissivePowers[i];
                Color emissiveColor            = emissiveColors[i];
                tk2dSpriteAnimationFrame frame = new tk2dSpriteAnimationFrame();
                frame.spriteId = VFXCollection.GetSpriteIdByName(spriteName);
                tk2dSpriteDefinition def = SetupDefinitionForShellSprite(spriteName, frame.spriteId, spriteSize.x, spriteSize.y);
                def.ConstructOffsetsFromAnchor(anchor, def.position3);
                def.MakeOffset(manualOffset);
                def.material.shader = ShaderCache.Acquire("Brave/LitTk2dCustomFalloffTintableTiltedCutoutEmissive");
                def.material.SetFloat("_EmissiveColorPower", emissivePower);
                def.material.SetColor("_EmissiveColor", emissiveColor);
                def.material.SetTexture("_MainTex", def.material.GetTexture("_MainTex"));
                def.materialInst.shader = ShaderCache.Acquire("Brave/LitTk2dCustomFalloffTintableTiltedCutoutEmissive");
                def.materialInst.SetFloat("_EmissiveColorPower", emissivePower);
                def.materialInst.SetColor("_EmissiveColor", emissiveColor);
                def.materialInst.SetTexture("_MainTex", def.materialInst.GetTexture("_MainTex"));
                frame.spriteCollection = VFXCollection;
                clip.frames            = clip.frames.Concat(new tk2dSpriteAnimationFrame[] { frame }).ToArray();
            }
            sprite.renderer.material.shader = ShaderCache.Acquire("Brave/LitTk2dCustomFalloffTintableTiltedCutoutEmissive");
            sprite.renderer.material.SetFloat("_EmissiveColorPower", emissivePowers[0]);
            sprite.renderer.material.SetColor("_EmissiveColor", emissiveColors[0]);
            sprite.renderer.material.SetTexture("_MainTex", sprite.renderer.material.GetTexture("_MainTex"));
            clip.wrapMode = tk2dSpriteAnimationClip.WrapMode.Once;
            clip.name     = "start";
            animator.spriteAnimator.Library         = animator.gameObject.AddComponent <tk2dSpriteAnimation>();
            animator.spriteAnimator.Library.clips   = new tk2dSpriteAnimationClip[] { clip };
            animator.spriteAnimator.Library.enabled = true;
            SpriteAnimatorKiller kill = animator.gameObject.AddComponent <SpriteAnimatorKiller>();

            kill.fadeTime             = -1f;
            kill.animator             = animator;
            kill.delayDestructionTime = -1f;
            vfObj.orphaned            = orphaned;
            vfObj.attached            = attached;
            vfObj.persistsOnDeath     = persistsOnDeath;
            vfObj.usesZHeight         = usesZHeight;
            vfObj.zHeight             = zHeight;
            vfObj.alignment           = alignment;
            vfObj.destructible        = destructible;
            vfObj.effect               = obj;
            complex.effects            = new VFXObject[] { vfObj };
            pool.effects               = new VFXComplex[] { complex };
            animator.playAutomatically = true;
            animator.DefaultClipId     = animator.GetClipIdByName("start");
            return(pool);
        }
        public static void Add()
        {
            Gun gun = ETGMod.Databases.Items.NewGun("Carnwennan", "carnwennan");

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

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


            gun.SetShortDescription("Prosper");
            gun.SetLongDescription("This ancient magical dagger was stolen from the ruins of Castle Blamalot." + "\n\nWhile both it's range and power are lacking, you sense a strange, bountiful energy in the blade.");
            gun.SetupSprite(null, "carnwennan_idle_001", 8);


            gun.SetAnimationFPS(gun.shootAnimation, 12);

            gun.AddPassiveStatModifier(PlayerStats.StatType.Curse, 1f, StatModifier.ModifyMethod.ADDITIVE);


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


            gun.DefaultModule.ammoCost      = 1;
            gun.DefaultModule.shootStyle    = ProjectileModule.ShootStyle.SemiAutomatic;
            gun.DefaultModule.sequenceStyle = ProjectileModule.ProjectileSequenceStyle.Random;
            gun.reloadTime = 1.05f;
            gun.DefaultModule.cooldownTime           = 0.3f;
            gun.muzzleFlashEffects.type              = VFXPoolType.None;
            gun.DefaultModule.numberOfShotsInClip    = 5;
            gun.barrelOffset.transform.localPosition = new Vector3(9f / 16f, 4f / 16f, 0f);
            gun.SetBaseMaxAmmo(50);
            gun.quality  = PickupObject.ItemQuality.D;
            gun.gunClass = GunClass.SILLY;

            //BULLET STATS
            Projectile projectile = (PickupObjectDatabase.GetById(86) as Gun).DefaultModule.projectiles[0].gameObject.InstantiateAndFakeprefab().GetComponent <Projectile>();

            gun.DefaultModule.projectiles[0] = projectile;
            gun.InfiniteAmmo                   = true;
            projectile.baseData.damage         = 4f;
            projectile.baseData.speed         *= 1.2f;
            projectile.sprite.renderer.enabled = false;


            CarnwennanSlashModifier slash = projectile.gameObject.AddComponent <CarnwennanSlashModifier>();

            slash.DestroyBaseAfterFirstSlash           = true;
            slash.slashParameters                      = new SlashData();
            slash.slashParameters.soundEvent           = null;
            slash.slashParameters.projInteractMode     = SlashDoer.ProjInteractMode.IGNORE;
            slash.slashParameters.playerKnockbackForce = 0;
            slash.SlashDamageUsesBaseProjectileDamage  = true;
            slash.slashParameters.enemyKnockbackForce  = 10;
            slash.slashParameters.doVFX                = false;
            slash.slashParameters.doHitVFX             = true;
            slash.slashParameters.slashRange           = 2f;

            gun.DefaultModule.ammoType = GameUIAmmoType.AmmoType.BEAM;

            tk2dSpriteAnimationClip reloadClip = gun.GetComponent <tk2dSpriteAnimator>().GetClipByName(gun.reloadAnimation);

            foreach (tk2dSpriteAnimationFrame frame in reloadClip.frames)
            {
                tk2dSpriteDefinition def = frame.spriteCollection.spriteDefinitions[frame.spriteId];
                if (def != null)
                {
                    def.MakeOffset(new Vector2(-0.81f, -2.18f));
                }
            }
            tk2dSpriteAnimationClip fireClip = gun.GetComponent <tk2dSpriteAnimator>().GetClipByName(gun.shootAnimation);

            foreach (tk2dSpriteAnimationFrame frame in fireClip.frames)
            {
                tk2dSpriteDefinition def = frame.spriteCollection.spriteDefinitions[frame.spriteId];
                if (def != null)
                {
                    def.MakeOffset(new Vector2(-0.81f, -2.18f));
                }
            }

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

            gun.SetupUnlockOnCustomFlag(CustomDungeonFlags.BOSSRUSH_BULLET, true);
        }