Пример #1
0
        public void MiniGunShoot(Player player, Item item, Projectile Lead, int projType, int damage, float knockBack, string sound)
        {
            if (comboTime <= 0)
            {
                soundInstance = Main.PlaySound(SoundLoader.customSoundType, (int)player.Center.X, (int)player.Center.Y, mod.GetSoundSlot(SoundType.Custom, "Sounds/" + sound));
                if (soundInstance != null)
                {
                    soundInstance.Volume *= 1f - 0.25f * (scalePlus / 20f);
                }

                float spray = 1f * (scalePlus / 20f);

                float scaleFactor2 = 14f;
                for (int i = 0; i < miniGunAmt; i++)
                {
                    float   rot     = Lead.velocity.ToRotation() + (float)Angle.ConvertToRadians(Main.rand.Next(18) * 10) - (float)Math.PI / 2f;
                    Vector2 vector3 = Lead.Center + rot.ToRotationVector2() * 7f * spray;
                    Vector2 vector5 = Vector2.Normalize(Lead.velocity) * scaleFactor2;
                    vector5 = vector5.RotatedBy((Main.rand.NextDouble() * 0.12 - 0.06) * spray, default(Vector2));
                    if (float.IsNaN(vector5.X) || float.IsNaN(vector5.Y))
                    {
                        vector5 = -Vector2.UnitY;
                    }
                    int proj = Projectile.NewProjectile(vector3.X, vector3.Y, vector5.X, vector5.Y, projType, damage, knockBack, player.whoAmI, 0f, 0f);
                    Main.projectile[proj].ai[0] = Lead.whoAmI;
                    MProjectile mProj = (MProjectile)Main.projectile[proj].modProjectile;
                    mProj.waveDir = waveDir;
                }

                waveDir *= -1;

                comboTime  = useTimeMax;
                useTimeMax = Math.Max(useTimeMax - miniRateIncr, comboUseTime);

                MGlobalItem mi = item.GetGlobalItem <MGlobalItem>();
                if (miniCostNum == 0)
                {
                    mi.statMissiles -= 1;
                }

                miniCostNum++;
                if (miniCostNum > miniGunCostReduct)
                {
                    miniCostNum = 0;
                }
            }
            else
            {
                comboTime--;
            }
            scalePlus = Math.Min(scalePlus + (2f / useTimeMax), 20f);
            ChargeLead chLead = (ChargeLead)Lead.modProjectile;

            chLead.extraScale = 0.3f * (scalePlus / 20f);
        }
Пример #2
0
 public override void AI()
 {
     projectile.ai[1] = (float)mod.BuffType("CPSprayed");
     MProjectile.MidasAI(projectile, 107, 221, 48, 167);
 }
Пример #3
0
        public override void HoldItem(Player player)
        {
            if (player.whoAmI == Main.myPlayer)
            {
                MPlayer     mp = player.GetModPlayer <MPlayer>();
                MGlobalItem mi = item.GetGlobalItem <MGlobalItem>();

                int chCost = (int)((float)chargeCost * mp.missileCost);
                comboCostUseTime = (int)Math.Round(60.0 / (double)(comboDrain * mp.missileCost));
                isCharge        &= (mi.statMissiles >= chCost || (isHeldCombo > 0 && initialShot));

                item.autoReuse = (isCharge || isSeeker);

                if (isCharge)
                {
                    if (!mp.ballstate && !mp.shineActive && !player.dead && !player.noItems)
                    {
                        Vector2 oPos = player.RotatedRelativePoint(player.MountedCenter, true);

                        float MY = Main.mouseY + Main.screenPosition.Y;
                        float MX = Main.mouseX + Main.screenPosition.X;
                        if (player.gravDir == -1f)
                        {
                            MY = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY;
                        }

                        float targetrotation = (float)Math.Atan2((MY - oPos.Y), (MX - oPos.X));

                        Vector2 velocity = targetrotation.ToRotationVector2() * item.shootSpeed;

                        float dmgMult = chargeMult;
                        int   damage  = player.GetWeaponDamage(item);

                        if (player.controlUseItem && chargeLead != -1 && Main.projectile[chargeLead].active && Main.projectile[chargeLead].owner == player.whoAmI && Main.projectile[chargeLead].type == mod.ProjectileType("ChargeLead"))
                        {
                            if (mp.statCharge < MPlayer.maxCharge)
                            {
                                mp.statCharge = Math.Min(mp.statCharge + 1, MPlayer.maxCharge);
                            }
                            if (isHeldCombo > 0)
                            {
                                if (mi.statMissiles > 0)
                                {
                                    if (mp.statCharge >= MPlayer.maxCharge)
                                    {
                                        if (isMiniGun)
                                        {
                                            this.MiniGunShoot(player, item, Main.projectile[chargeLead], mod.ProjectileType(chargeShot), (int)((float)damage * dmgMult), comboKnockBack, chargeShotSound);
                                        }
                                        else
                                        {
                                            if (comboTime <= 0)
                                            {
                                                for (int i = 0; i < comboShotAmt; i++)
                                                {
                                                    int proj = Projectile.NewProjectile(oPos.X, oPos.Y, velocity.X, velocity.Y, mod.ProjectileType(chargeShot), (int)((float)damage * dmgMult), comboKnockBack, player.whoAmI);
                                                    Main.projectile[proj].ai[0] = chargeLead;
                                                }
                                                comboTime = comboUseTime;
                                            }

                                            if (isHeldCombo == 2 && comboTime > 0)
                                            {
                                                comboTime--;
                                            }
                                        }

                                        if (!initialShot)
                                        {
                                            if (useFlameSounds || useVortexSounds)
                                            {
                                                int type = mod.ProjectileType("FlamethrowerLead");
                                                if (useVortexSounds)
                                                {
                                                    type = mod.ProjectileType("VortexComboLead");
                                                }
                                                int proj = Projectile.NewProjectile(oPos.X, oPos.Y, velocity.X, velocity.Y, type, 0, 0, player.whoAmI);
                                                Main.projectile[proj].ai[0] = chargeLead;
                                            }

                                            mi.statMissiles = Math.Max(mi.statMissiles - chCost, 0);

                                            initialShot = true;
                                        }

                                        if (comboCostUseTime > 0)
                                        {
                                            //if(comboCostTime <= 0)
                                            if (comboCostTime > comboCostUseTime)
                                            {
                                                mi.statMissiles = Math.Max(mi.statMissiles - 1, 0);
                                                //comboCostTime = comboCostUseTime;
                                                comboCostTime = 0;
                                            }
                                            else
                                            {
                                                //comboCostTime--;
                                                comboCostTime++;
                                            }
                                        }
                                    }
                                }
                                else
                                {
                                    Main.projectile[chargeLead].Kill();
                                }
                            }
                        }
                        else
                        {
                            if (isHeldCombo <= 0 || mp.statCharge < MPlayer.maxCharge)
                            {
                                if (mp.statCharge >= MPlayer.maxCharge && mi.statMissiles >= chCost)
                                {
                                    if (isShotgun)
                                    {
                                        for (int i = 0; i < shotgunAmt; i++)
                                        {
                                            int     k          = i - (shotgunAmt / 2);
                                            Vector2 shotGunVel = Vector2.Normalize(velocity) * (item.shootSpeed + 4f);
                                            double  rot        = Angle.ConvertToRadians(4.0 * k);
                                            shotGunVel = shotGunVel.RotatedBy(rot, default(Vector2));
                                            if (float.IsNaN(shotGunVel.X) || float.IsNaN(shotGunVel.Y))
                                            {
                                                shotGunVel = -Vector2.UnitY;
                                            }
                                            int chargeProj = Projectile.NewProjectile(oPos.X, oPos.Y, shotGunVel.X, shotGunVel.Y, mod.ProjectileType(chargeShot), (int)((float)damage * dmgMult), item.knockBack, player.whoAmI);
                                        }
                                    }
                                    else
                                    {
                                        int chargeProj = Projectile.NewProjectile(oPos.X, oPos.Y, velocity.X, velocity.Y, mod.ProjectileType(chargeShot), (int)((float)damage * dmgMult), item.knockBack, player.whoAmI);
                                    }
                                    mi.statMissiles -= chCost;
                                }
                                else if (mp.statCharge > 0)
                                {
                                    int shotProj = Projectile.NewProjectile(oPos.X, oPos.Y, velocity.X, velocity.Y, mod.ProjectileType(shot), damage, item.knockBack, player.whoAmI);
                                    mi.statMissiles -= 1;
                                }
                            }

                            if (chargeLead == -1 || !Main.projectile[chargeLead].active || Main.projectile[chargeLead].owner != player.whoAmI || Main.projectile[chargeLead].type != mod.ProjectileType("ChargeLead"))
                            {
                                mp.statCharge = 0;
                            }

                            comboTime     = 0;
                            comboCostTime = 0;
                            scalePlus     = 0f;
                            initialShot   = false;
                        }
                    }
                    else if (!mp.ballstate)
                    {
                        mp.statCharge = 0;
                        comboTime     = 0;
                        comboCostTime = 0;
                        scalePlus     = 0f;
                        initialShot   = false;
                    }
                }
                else
                {
                    mp.statCharge = 0;
                    comboTime     = 0;
                    comboCostTime = 0;
                    scalePlus     = 0f;
                    initialShot   = false;
                }

                if (targetingDelay > 0)
                {
                    targetingDelay--;
                }

                if (isSeeker && !mp.ballstate && !mp.shineActive && !player.dead && !player.noItems)
                {
                    Vector2 oPos = player.RotatedRelativePoint(player.MountedCenter, true);
                    float   MY   = Main.mouseY + Main.screenPosition.Y;
                    float   MX   = Main.mouseX + Main.screenPosition.X;
                    if (player.gravDir == -1f)
                    {
                        MY = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY;
                    }
                    Rectangle mouse          = new Rectangle((int)MX - 1, (int)MY - 1, 2, 2);
                    float     targetrotation = (float)Math.Atan2((MY - oPos.Y), (MX - oPos.X));
                    Vector2   velocity       = targetrotation.ToRotationVector2() * item.shootSpeed;
                    int       damage         = player.GetWeaponDamage(item);
                    if (player.controlUseItem && chargeLead != -1 && Main.projectile[chargeLead].active && Main.projectile[chargeLead].owner == player.whoAmI && Main.projectile[chargeLead].type == mod.ProjectileType("SeekerMissileLead"))
                    {
                        if (mi.seekerCharge < MGlobalItem.seekerMaxCharge)
                        {
                            mi.seekerCharge = Math.Min(mi.seekerCharge + 1, MGlobalItem.seekerMaxCharge);
                        }
                        else
                        {
                            for (int i = 0; i < Main.maxNPCs; i++)
                            {
                                NPC npc = Main.npc[i];
                                if (npc.active && npc.chaseable && !npc.dontTakeDamage && !npc.friendly)                                // && !npc.immortal)
                                {
                                    Rectangle npcRect = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height);
                                    bool      flag    = false;
                                    for (int j = 0; j < mi.seekerTarget.Length; j++)
                                    {
                                        if (mi.seekerTarget[j] == npc.whoAmI)
                                        {
                                            flag = true;
                                        }
                                    }
                                    if (mouse.Intersects(npcRect) && mi.seekerTarget[targetNum] <= -1 && (targetingDelay <= 0 || !flag /*prevTarget != npc.whoAmI*/) && mi.statMissiles > mi.numSeekerTargets)
                                    {
                                        mi.seekerTarget[targetNum] = npc.whoAmI;
                                        targetNum++;
                                        if (targetNum > 4)
                                        {
                                            targetNum = 0;
                                        }
                                        targetingDelay = 40;
                                        Main.PlaySound(SoundLoader.customSoundType, (int)oPos.X, (int)oPos.Y, mod.GetSoundSlot(SoundType.Custom, "Sounds/SeekerLockSound"));
                                    }
                                }
                            }

                            int num = 10;
                            while (mi.seekerTarget[targetNum] > -1 && num > 0)
                            {
                                targetNum++;
                                if (targetNum > 4)
                                {
                                    targetNum = 0;
                                }
                                num--;
                            }

                            mi.numSeekerTargets = 0;
                            for (int i = 0; i < mi.seekerTarget.Length; i++)
                            {
                                if (mi.seekerTarget[i] > -1)
                                {
                                    mi.numSeekerTargets++;

                                    if (!Main.npc[mi.seekerTarget[i]].active)
                                    {
                                        mi.seekerTarget[i] = -1;
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        if (mi.seekerCharge >= MGlobalItem.seekerMaxCharge && mi.numSeekerTargets > 0)
                        {
                            for (int i = 0; i < mi.seekerTarget.Length; i++)
                            {
                                if (mi.seekerTarget[i] > -1)
                                {
                                    int         shotProj = Projectile.NewProjectile(oPos.X, oPos.Y, velocity.X, velocity.Y, mod.ProjectileType(shot), damage, item.knockBack, player.whoAmI);
                                    MProjectile mProj    = (MProjectile)Main.projectile[shotProj].modProjectile;
                                    mProj.seekTarget            = mi.seekerTarget[i];
                                    mProj.seeking               = true;
                                    mProj.projectile.netUpdate2 = true;
                                    mi.statMissiles             = Math.Max(mi.statMissiles - 1, 0);
                                }
                            }

                            Main.PlaySound(SoundLoader.customSoundType, (int)oPos.X, (int)oPos.Y, mod.GetSoundSlot(SoundType.Custom, "Sounds/SeekerMissileSound"));
                        }
                        else if (mi.seekerCharge > 0)
                        {
                            int shotProj = Projectile.NewProjectile(oPos.X, oPos.Y, velocity.X, velocity.Y, mod.ProjectileType(shot), damage, item.knockBack, player.whoAmI);
                            Main.PlaySound(SoundLoader.customSoundType, (int)oPos.X, (int)oPos.Y, mod.GetSoundSlot(SoundType.Custom, "Sounds/" + shotSound));

                            mi.statMissiles -= 1;
                        }
                        if (chargeLead == -1 || !Main.projectile[chargeLead].active || Main.projectile[chargeLead].owner != player.whoAmI || Main.projectile[chargeLead].type != mod.ProjectileType("SeekerMissileLead"))
                        {
                            mi.seekerCharge = 0;
                        }
                        mi.numSeekerTargets = 0;
                        for (int k = 0; k < mi.seekerTarget.Length; k++)
                        {
                            mi.seekerTarget[k] = -1;
                        }
                        targetNum      = 0;
                        targetingDelay = 0;
                    }
                }
                else
                {
                    mi.seekerCharge     = 0;
                    mi.numSeekerTargets = 0;
                    for (int k = 0; k < mi.seekerTarget.Length; k++)
                    {
                        mi.seekerTarget[k] = -1;
                    }
                    targetNum      = 0;
                    targetingDelay = 0;
                }
            }
        }
Пример #4
0
 public override void AI()
 {
     projectile.ai[1] = (float)mod.BuffType("MSprayed");
     MProjectile.MidasAI(projectile, 37, 207, -1, -1);
 }
Пример #5
0
 public override void AI()
 {
     projectile.ai[1] = (float)mod.BuffType("STSprayed");
     MProjectile.MidasAI(projectile, 9, 168, 11, 83);
 }
Пример #6
0
 public override void AI()
 {
     projectile.ai[1] = (float)mod.BuffType("GPSprayed");
     MProjectile.MidasAI(projectile, 8, 221, 10, 84);
 }
Пример #7
0
 public override void AI()
 {
     projectile.ai[1] = (float)mod.BuffType("CSprayed");
     MProjectile.MidasAI(projectile, 211, -1, 128, -1);
 }
Пример #8
0
 public override void AI()
 {
     projectile.ai[1] = (float)mod.BuffType("ATSprayed");
     MProjectile.MidasAI(projectile, 111, 223, 50, 30);
 }
Пример #9
0
 public override void AI()
 {
     projectile.ai[1] = (float)mod.BuffType("OHSprayed");
     MProjectile.MidasAI(projectile, 56, 58, 224, 12);
 }
Пример #10
0
 public override void AI()
 {
     projectile.ai[1] = (float)mod.BuffType("MOSprayed");
     MProjectile.MidasAI(projectile, 108, 222, 49, 103);
 }
Пример #11
0
 public override void AI()
 {
     projectile.ai[1] = (float)mod.BuffType("DCSprayed");
     MProjectile.MidasAI(projectile, 22, 204, 14, 125);
 }
Пример #12
0
 public override void AI()
 {
     projectile.ai[1] = (float)mod.BuffType("ILSprayed");
     MProjectile.MidasAI(projectile, 6, 167, 8, 82);
 }
Пример #13
0
 public override void AI()
 {
     projectile.ai[1] = (float)mod.BuffType("CTSprayed");
     MProjectile.MidasAI(projectile, 7, 166, 9, 81);
 }