public static void Add()
        {
            Gun gun = ETGMod.Databases.Items.NewGun("Paintball Gun", "paintballgun");

            Game.Items.Rename("outdated_gun_mods:paintball_gun", "nn:paintball_gun");
            gun.gameObject.AddComponent <PaintballGun>();
            gun.SetShortDescription("The Colours, Duke!");
            gun.SetLongDescription("Small rubbery pellets loaded with lethal old-school lead paint." + "\n\nBrought to the Gungeon by an amateur artist who wished to flee his debts.");

            gun.SetupSprite(null, "paintballgun_idle_001", 8);
            gun.SetAnimationFPS(gun.shootAnimation, 14);

            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.1f;
            gun.DefaultModule.cooldownTime        = 0.1f;
            gun.DefaultModule.numberOfShotsInClip = 10;
            gun.SetBaseMaxAmmo(300);
            gun.gunClass = GunClass.PISTOL;

            //BULLET STATS
            Projectile projectile = gun.DefaultModule.projectiles[0].gameObject.InstantiateAndFakeprefab().GetComponent <Projectile>();

            gun.DefaultModule.projectiles[0] = projectile;
            projectile.baseData.damage       = 7.5f;
            RandomiseProjectileColourComponent paintballController = projectile.gameObject.AddComponent <RandomiseProjectileColourComponent>();

            paintballController.ApplyColourToHitEnemies = true;
            paintballController.paintballGun            = true;

            gun.quality = PickupObject.ItemQuality.C;

            gun.encounterTrackable.EncounterGuid = "this is the Paintball Gun";
            ETGMod.Databases.Items.Add(gun, null, "ANY");
        }
Esempio n. 2
0
        public static void Add()
        {
            Gun gun = ETGMod.Databases.Items.NewGun("Gumgun", "gumgun");

            Game.Items.Rename("outdated_gun_mods:gumgun", "nn:gumgun");
            gun.gameObject.AddComponent <Gumgun>();
            gun.SetShortDescription("Wumderful");
            gun.SetLongDescription("Fires globs of gum at your foes." + "\nHolding down fire causes it to enter 'Gumzooka' mode." + "\n\nThis tiny handcannon was designed for use by small creatures with no hands." + "\nCan you still call it a handcannon then?");

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

            gun.SetAnimationFPS(gun.shootAnimation, 15);
            gun.SetAnimationFPS(gun.chargeAnimation, 3);
            gun.gunSwitchGroup = (PickupObjectDatabase.GetById(13) as Gun).gunSwitchGroup;
            gun.gunHandedness  = GunHandedness.HiddenOneHanded;
            gun.AddProjectileModuleFrom(PickupObjectDatabase.GetById(56) as Gun, true, false);

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

            //GUN STATS
            gun.DefaultModule.ammoCost      = 1;
            gun.DefaultModule.shootStyle    = ProjectileModule.ShootStyle.Charged;
            gun.DefaultModule.sequenceStyle = ProjectileModule.ProjectileSequenceStyle.Random;
            gun.reloadTime                           = 1.1f;
            gun.muzzleFlashEffects                   = (PickupObjectDatabase.GetById(334) as Gun).muzzleFlashEffects;
            gun.gunClass                             = GunClass.CHARGE;
            gun.DefaultModule.cooldownTime           = 0.2f;
            gun.DefaultModule.numberOfShotsInClip    = 25;
            gun.barrelOffset.transform.localPosition = new Vector3(0.56f, 0.31f, 0f);
            gun.SetBaseMaxAmmo(300);
            gun.ammo = 300;

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

            projectile.gameObject.SetActive(false);
            FakePrefab.MarkAsFakePrefab(projectile.gameObject);
            UnityEngine.Object.DontDestroyOnLoad(projectile);
            RandomiseProjectileColourComponent colour = projectile.gameObject.GetOrAddComponent <RandomiseProjectileColourComponent>();

            projectile.baseData.damage *= 1.4f;
            projectile.AnimateProjectile(new List <string> {
                "gumgun_smallproj_001",
                "gumgun_smallproj_002",
                "gumgun_smallproj_001",
                "gumgun_smallproj_003",
            }, 10, true, new List <IntVector2> {
                new IntVector2(13, 10),
                new IntVector2(15, 8),
                new IntVector2(13, 10),
                new IntVector2(11, 12),
            }, AnimateBullet.ConstructListOfSameValues(false, 4), AnimateBullet.ConstructListOfSameValues(tk2dBaseSprite.Anchor.MiddleCenter, 4), AnimateBullet.ConstructListOfSameValues(true, 4), AnimateBullet.ConstructListOfSameValues(false, 4),
                                         AnimateBullet.ConstructListOfSameValues <Vector3?>(null, 4), AnimateBullet.ConstructListOfSameValues <IntVector2?>(new IntVector2(12, 9), 4), AnimateBullet.ConstructListOfSameValues <IntVector2?>(null, 4), AnimateBullet.ConstructListOfSameValues <Projectile>(null, 4));


            //CHARGE BULLET STATS
            Projectile chargeprojectile = UnityEngine.Object.Instantiate <Projectile>((PickupObjectDatabase.GetById(56) as Gun).DefaultModule.projectiles[0]);

            chargeprojectile.gameObject.SetActive(false);
            FakePrefab.MarkAsFakePrefab(chargeprojectile.gameObject);
            UnityEngine.Object.DontDestroyOnLoad(chargeprojectile);
            RandomiseProjectileColourComponent colour2 = chargeprojectile.gameObject.GetOrAddComponent <RandomiseProjectileColourComponent>();

            chargeprojectile.baseData.damage *= 4;
            chargeprojectile.AnimateProjectile(new List <string> {
                "gumgun_bigproj_001",
                "gumgun_bigproj_002",
                "gumgun_bigproj_001",
                "gumgun_bigproj_003",
            }, 10, true, new List <IntVector2> {
                new IntVector2(21, 14),
                new IntVector2(23, 12),
                new IntVector2(21, 14),
                new IntVector2(19, 16),
            }, AnimateBullet.ConstructListOfSameValues(false, 4), AnimateBullet.ConstructListOfSameValues(tk2dBaseSprite.Anchor.MiddleCenter, 4), AnimateBullet.ConstructListOfSameValues(true, 4), AnimateBullet.ConstructListOfSameValues(false, 4),
                                               AnimateBullet.ConstructListOfSameValues <Vector3?>(null, 4), AnimateBullet.ConstructListOfSameValues <IntVector2?>(new IntVector2(14, 8), 4), AnimateBullet.ConstructListOfSameValues <IntVector2?>(null, 4), AnimateBullet.ConstructListOfSameValues <Projectile>(null, 4));

            ProjectileModule.ChargeProjectile chargeProj1 = new ProjectileModule.ChargeProjectile
            {
                Projectile = projectile,
                ChargeTime = 0f,
                VfxPool    = null,
            };

            ProjectileModule.ChargeProjectile chargeProj2 = new ProjectileModule.ChargeProjectile
            {
                Projectile = chargeprojectile,
                ChargeTime = 1f,
            };
            gun.DefaultModule.chargeProjectiles = new List <ProjectileModule.ChargeProjectile> {
                chargeProj1, chargeProj2
            };

            gun.quality = PickupObject.ItemQuality.C;
            ETGMod.Databases.Items.Add(gun, null, "ANY");
            GumgunID = gun.PickupObjectId;
            Gumgun.BuildDenkSnavelPrefab();
        }