Svant
This commit is contained in:
1 parent
8e41cbb392
commit
613dae463b
5 files changed
+139
-64
No files matched your search
@@ -15,8 +15,6 @@ namespace CalamityMod.Items.Weapons.Ranged
|
||||
public class Infinity : ModItem, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Items.Weapons.Ranged";
|
||||
internal int rotation = 0;
|
||||
internal bool limit = true;
|
||||
public int SineCounter = 0;
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
@@ -27,11 +25,10 @@ namespace CalamityMod.Items.Weapons.Ranged
|
||||
{
|
||||
Item.width = 56;
|
||||
Item.height = 24;
|
||||
Item.damage = 90;
|
||||
Item.damage = 85;
|
||||
Item.DamageType = DamageClass.Ranged;
|
||||
Item.useTime = 1;
|
||||
Item.useAnimation = 4;
|
||||
Item.useLimitPerAnimation = 9;
|
||||
Item.useStyle = ItemUseStyleID.Shoot;
|
||||
Item.noMelee = true;
|
||||
Item.knockBack = 1f;
|
||||
@@ -75,7 +72,7 @@ namespace CalamityMod.Items.Weapons.Ranged
|
||||
//If left click, do the same as above but spawn Charged Blasts instead
|
||||
Vector2 helixVel1 = (velocity * Main.rand.NextFloat(0.9f, 1.1f)).RotatedBy(MathHelper.ToRadians(sine));
|
||||
Vector2 helixVel2 = (velocity * Main.rand.NextFloat(0.9f, 1.1f)).RotatedBy(MathHelper.ToRadians(-sine));
|
||||
int shot1 = Projectile.NewProjectile(source, position.X, position.Y, helixVel1.X, helixVel1.Y, ModContent.ProjectileType<ChargedBlast>(), damage, knockback, player.whoAmI, 0f, 1, 1f);
|
||||
int shot1 = Projectile.NewProjectile(source, position.X, position.Y, helixVel1.X, helixVel1.Y, ModContent.ProjectileType<ChargedBlast>(), damage, knockback, player.whoAmI, 0f, 0, 1f);
|
||||
int shot2 = Projectile.NewProjectile(source, position.X, position.Y, helixVel2.X, helixVel2.Y, ModContent.ProjectileType<ChargedBlast>(), damage, knockback, player.whoAmI, 0f, 0, 1f);
|
||||
}
|
||||
}
|
||||
@@ -86,7 +83,12 @@ namespace CalamityMod.Items.Weapons.Ranged
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public override bool CanConsumeAmmo(Item ammo, Player player)
|
||||
{
|
||||
if (Main.rand.Next(0, 100) > 80 && SineCounter % 4 == 0)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
public override void AddRecipes()
|
||||
{
|
||||
CreateRecipe().
|
||||
|
||||
@@ -65,6 +65,12 @@ namespace CalamityMod.Items.Weapons.Ranged
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public override bool CanConsumeAmmo(Item ammo, Player player)
|
||||
{
|
||||
if (Main.rand.Next(0, 100) < 60)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void AddRecipes()
|
||||
{
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using System;
|
||||
using CalamityMod.Items.Materials;
|
||||
using CalamityMod.Particles;
|
||||
using CalamityMod.Projectiles.Ranged;
|
||||
using CalamityMod.Rarities;
|
||||
using CalamityMod.Tiles.Furniture.CraftingStations;
|
||||
using Microsoft.Xna.Framework;
|
||||
@@ -13,16 +15,19 @@ namespace CalamityMod.Items.Weapons.Ranged
|
||||
public class Svantechnical : ModItem, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Items.Weapons.Ranged";
|
||||
public int SineCounter = 0;
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true;
|
||||
}
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.width = 60;
|
||||
Item.height = 26;
|
||||
Item.damage = 150;
|
||||
Item.damage = 200;
|
||||
Item.DamageType = DamageClass.Ranged;
|
||||
Item.useTime = 2;
|
||||
Item.useAnimation = 24;
|
||||
Item.reuseDelay = 10;
|
||||
Item.useLimitPerAnimation = 12;
|
||||
Item.useTime = 1;
|
||||
Item.useAnimation = 3;
|
||||
Item.useStyle = ItemUseStyleID.Shoot;
|
||||
Item.noMelee = true;
|
||||
Item.knockBack = 3.5f;
|
||||
@@ -33,70 +38,67 @@ namespace CalamityMod.Items.Weapons.Ranged
|
||||
|
||||
Item.UseSound = SoundID.Item31;
|
||||
Item.autoReuse = true;
|
||||
Item.shootSpeed = 12f;
|
||||
Item.shootSpeed = 6f;
|
||||
Item.shoot = ProjectileID.PurificationPowder;
|
||||
Item.useAmmo = AmmoID.Bullet;
|
||||
Item.Calamity().canFirePointBlankShots = true;
|
||||
}
|
||||
|
||||
public override Vector2? HoldoutOffset() => new Vector2(-5, 0);
|
||||
|
||||
public override void HoldItem(Player player) => player.scope = true;
|
||||
|
||||
public override bool CanConsumeAmmo(Item ammo, Player player)
|
||||
public override bool AltFunctionUse(Player player)
|
||||
{
|
||||
if (Main.rand.Next(0, 100) < 70)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void HoldItem(Player player) => player.scope = false;
|
||||
|
||||
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
|
||||
{
|
||||
int i = Main.myPlayer;
|
||||
float sSpeed = Item.shootSpeed;
|
||||
player.itemTime = Item.useTime;
|
||||
Vector2 realPlayerPos = player.RotatedRelativePoint(player.MountedCenter, true);
|
||||
float mouseXDist = (float)Main.mouseX + Main.screenPosition.X - realPlayerPos.X;
|
||||
float mouseYDist = (float)Main.mouseY + Main.screenPosition.Y - realPlayerPos.Y;
|
||||
if (player.gravDir == -1f)
|
||||
position = position + (player.Calamity().mouseWorld - player.MountedCenter).SafeNormalize(Vector2.UnitX) * 65;
|
||||
float sine = (float)Math.Sin(SineCounter * 0.175f / MathHelper.Pi) * 4f;
|
||||
float sine2 = (float)Math.Sin(SineCounter * 0.275f / MathHelper.Pi) * 2f;
|
||||
SineCounter++;
|
||||
if (SineCounter % 4 == 0)
|
||||
{
|
||||
mouseYDist = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - realPlayerPos.Y;
|
||||
if (player.altFunctionUse == 2)
|
||||
{
|
||||
//If you right click, shoots a helix of normal bullets
|
||||
Vector2 helixVel1 = (velocity * Main.rand.NextFloat(0.9f, 1.1f)).RotatedBy(MathHelper.ToRadians(sine));
|
||||
Vector2 helixVel2 = (velocity * Main.rand.NextFloat(0.9f, 1.1f)).RotatedBy(MathHelper.ToRadians(-sine));
|
||||
Vector2 helixVel3 = (velocity * Main.rand.NextFloat(0.9f, 1.1f)).RotatedBy(MathHelper.ToRadians(sine2));
|
||||
int shot1 = Projectile.NewProjectile(source, position.X, position.Y, helixVel1.X, helixVel1.Y, type, damage, knockback, player.whoAmI, 0f, 0f);
|
||||
int shot2 = Projectile.NewProjectile(source, position.X, position.Y, helixVel2.X, helixVel2.Y, type, damage, knockback, player.whoAmI, 0f, 0f);
|
||||
int shot3 = Projectile.NewProjectile(source, position.X, position.Y, helixVel3.X, helixVel3.Y, type, damage, knockback, player.whoAmI, 0f, 0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
//If left click, do the same as above but spawn Charged Blasts instead
|
||||
Vector2 helixVel1 = (velocity * Main.rand.NextFloat(0.9f, 1.1f)).RotatedBy(MathHelper.ToRadians(sine));
|
||||
Vector2 helixVel2 = (velocity * Main.rand.NextFloat(0.9f, 1.1f)).RotatedBy(MathHelper.ToRadians(-sine));
|
||||
Vector2 helixVel3 = (velocity * Main.rand.NextFloat(0.9f, 1.1f)).RotatedBy(MathHelper.ToRadians(sine2));
|
||||
int shot1 = Projectile.NewProjectile(source, position.X, position.Y, helixVel1.X, helixVel1.Y, ModContent.ProjectileType<ChargedBlast>(), damage, knockback, player.whoAmI, 0f, 0, 2f);
|
||||
int shot2 = Projectile.NewProjectile(source, position.X, position.Y, helixVel2.X, helixVel2.Y, ModContent.ProjectileType<ChargedBlast>(), damage, knockback, player.whoAmI, 0f, 0, 4f);
|
||||
int shot3 = Projectile.NewProjectile(source, position.X, position.Y, helixVel3.X, helixVel3.Y, ModContent.ProjectileType<ChargedBlast>(), damage, knockback, player.whoAmI, 0f, 0, 3f);
|
||||
}
|
||||
}
|
||||
float mouseDistance = (float)Math.Sqrt((double)(mouseXDist * mouseXDist + mouseYDist * mouseYDist));
|
||||
if ((float.IsNaN(mouseXDist) && float.IsNaN(mouseYDist)) || (mouseXDist == 0f && mouseYDist == 0f))
|
||||
else if (player.altFunctionUse != 2)
|
||||
{
|
||||
mouseXDist = (float)player.direction;
|
||||
mouseYDist = 0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
mouseDistance = sSpeed / mouseDistance;
|
||||
}
|
||||
float randXOffset = mouseXDist;
|
||||
float randYOffset = mouseYDist;
|
||||
randXOffset += (float)Main.rand.Next(-1, 2) * 0.5f;
|
||||
randYOffset += (float)Main.rand.Next(-1, 2) * 0.5f;
|
||||
if (Collision.CanHitLine(player.Center, 0, 0, realPlayerPos + new Vector2(randXOffset, randYOffset) * 2f, 0, 0))
|
||||
{
|
||||
realPlayerPos += new Vector2(randXOffset, randYOffset);
|
||||
}
|
||||
Projectile.NewProjectile(source, position.X, position.Y - player.gravDir * 4f, randXOffset, randYOffset, type, damage, knockback, i, 0f, (float)Main.rand.Next(12) / 6f);
|
||||
int bulletAmt = Main.rand.Next(2, 4);
|
||||
for (int index = 0; index < bulletAmt; ++index)
|
||||
{
|
||||
float SpeedX = velocity.X + (float)Main.rand.Next(-60, 61) * 0.05f;
|
||||
float SpeedY = velocity.Y + (float)Main.rand.Next(-60, 61) * 0.05f;
|
||||
Projectile.NewProjectile(source, realPlayerPos.X, realPlayerPos.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI, 0f, 0f);
|
||||
Particle spark2 = new LineParticle(position + Main.rand.NextVector2Circular(6, 6), (velocity * 4).RotatedByRandom(0.35f) * Main.rand.NextFloat(0.8f, 1.2f), false, Main.rand.Next(15, 25 + 1), Main.rand.NextFloat(1.5f, 2f), Main.rand.NextBool() ? Color.MediumOrchid : Color.DarkViolet);
|
||||
GeneralParticleHandler.SpawnParticle(spark2);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public override bool CanConsumeAmmo(Item ammo, Player player)
|
||||
{
|
||||
if (Main.rand.Next(0, 100) > 90 && SineCounter % 4 == 0)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void AddRecipes()
|
||||
{
|
||||
CreateRecipe().
|
||||
AddIngredient<SDFMG>().
|
||||
AddIngredient(ItemID.SoulofMight, 10).
|
||||
AddIngredient(ItemID.SoulofSight, 10).
|
||||
AddIngredient(ItemID.SoulofFright, 10).
|
||||
AddIngredient<Infinity>().
|
||||
AddIngredient<ShadowspecBar>(5).
|
||||
AddTile<DraedonsForge>().
|
||||
Register();
|
||||
|
||||
@@ -15,6 +15,7 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
public override string Texture => "CalamityMod/Projectiles/LaserProj";
|
||||
public Color baseColor = Color.White;
|
||||
public bool outOfTime = false;
|
||||
public Vector2 baseVel;
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
ProjectileID.Sets.TrailCacheLength[Projectile.type] = 15;
|
||||
@@ -34,8 +35,27 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
bool Shredder = Projectile.ai[2] == 0;
|
||||
bool Infinity = Projectile.ai[2] == 1;
|
||||
bool Svant = Projectile.ai[2] == 2 || Projectile.ai[2] == 3 || Projectile.ai[2] == 4;
|
||||
|
||||
if (baseColor == Color.White)
|
||||
baseColor = (Projectile.ai[2] == 1 ? new Color(229, 49, 39) : Color.DodgerBlue);
|
||||
{
|
||||
baseColor = (Infinity ? new Color(229, 49, 39) : Svant ? Color.DarkViolet : Color.DodgerBlue);
|
||||
if (Projectile.ai[2] == 3)
|
||||
{
|
||||
baseColor = Color.Violet;
|
||||
}
|
||||
if (Projectile.ai[2] == 4)
|
||||
{
|
||||
baseColor = Color.MediumOrchid;
|
||||
}
|
||||
baseVel = Projectile.velocity;
|
||||
if (Svant)
|
||||
Projectile.ArmorPenetration = 100;
|
||||
if (Infinity)
|
||||
Projectile.ArmorPenetration = 25;
|
||||
}
|
||||
Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2;
|
||||
if (Projectile.timeLeft == 2)
|
||||
outOfTime = true;
|
||||
@@ -49,16 +69,16 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
if (Projectile.owner == Main.myPlayer)
|
||||
{
|
||||
for (int k = 0; k < projectiles; k++)
|
||||
Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, -Projectile.velocity.RotatedByRandom(0.9f) * Main.rand.NextFloat(0.6f, 0.7f), ModContent.ProjectileType<ChargedBlastSplit>(), (int)(Projectile.damage * (Projectile.ai[2] == 1 ? 0.3f : 0.5f)), Projectile.knockBack * 0.8f, Main.myPlayer, 0, 0, Projectile.ai[2] == 1 ? 1 : 0);
|
||||
Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, -baseVel.RotatedByRandom(0.9f) * Main.rand.NextFloat(0.6f, 0.7f), ModContent.ProjectileType<ChargedBlastSplit>(), (int)(Projectile.damage * (Projectile.ai[2] > 0 ? 0.3f : 0.5f)), Projectile.knockBack * 0.8f, Main.myPlayer, 0, 0, Projectile.ai[2]);
|
||||
}
|
||||
for (int k = 0; k < 3; k++)
|
||||
{
|
||||
Particle spark2 = new LineParticle(Projectile.Center, (-Projectile.velocity * 4).RotatedByRandom(0.9f) * Main.rand.NextFloat(0.8f, 1.2f), false, Main.rand.Next(25, 32 + 1), Main.rand.NextFloat(1.5f, 2f), baseColor);
|
||||
Particle spark2 = new LineParticle(Projectile.Center, (-baseVel * 4).RotatedByRandom(0.9f) * Main.rand.NextFloat(0.8f, 1.2f), false, Main.rand.Next(25, 32 + 1), Main.rand.NextFloat(1.5f, 2f), baseColor);
|
||||
GeneralParticleHandler.SpawnParticle(spark2);
|
||||
}
|
||||
if (Projectile.ai[2] == 1)
|
||||
{
|
||||
Particle spark2 = new LineParticle(Projectile.Center, (-Projectile.velocity * 5).RotatedByRandom(0.9f) * Main.rand.NextFloat(0.8f, 1.2f), false, Main.rand.Next(35, 48 + 1), Main.rand.NextFloat(2.3f, 3f), baseColor);
|
||||
Particle spark2 = new LineParticle(Projectile.Center, (-baseVel * 5).RotatedByRandom(0.9f) * Main.rand.NextFloat(0.8f, 1.2f), false, Main.rand.Next(35, 48 + 1), Main.rand.NextFloat(2.3f, 3f), baseColor);
|
||||
GeneralParticleHandler.SpawnParticle(spark2);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
using CalamityMod.Particles;
|
||||
using System;
|
||||
using CalamityMod.Particles;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using Terraria.Utilities.Terraria.Utilities;
|
||||
|
||||
namespace CalamityMod.Projectiles.Ranged
|
||||
{
|
||||
@@ -15,6 +17,9 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
public Color baseColor = Color.White;
|
||||
public int tileHits = 4;
|
||||
public Vector2 startVel;
|
||||
public bool goToMouse = true;
|
||||
bool direction;
|
||||
public float homeSpeed;
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
ProjectileID.Sets.TrailCacheLength[Projectile.type] = 15;
|
||||
@@ -36,22 +41,58 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
bool InfinityShot = Projectile.ai[2] == 1;
|
||||
Player player = Main.player[Projectile.owner];
|
||||
bool Shredder = Projectile.ai[2] == 0;
|
||||
bool Infinity = Projectile.ai[2] == 1;
|
||||
bool Svant = Projectile.ai[2] == 2 || Projectile.ai[2] == 3 || Projectile.ai[2] == 4;
|
||||
|
||||
if (baseColor == Color.White)
|
||||
{
|
||||
baseColor = (InfinityShot ? new Color(229, 49, 39) : Color.DodgerBlue);
|
||||
baseColor = (Infinity ? new Color(229, 49, 39) : Svant ? Color.DarkViolet : Color.DodgerBlue);
|
||||
if (Projectile.ai[2] == 3)
|
||||
baseColor = Color.Violet;
|
||||
if (Projectile.ai[2] == 4)
|
||||
baseColor = Color.MediumOrchid;
|
||||
startVel = Projectile.velocity;
|
||||
if (InfinityShot)
|
||||
if (Infinity)
|
||||
{
|
||||
Projectile.timeLeft = 340;
|
||||
Projectile.ArmorPenetration = 25;
|
||||
}
|
||||
if (Svant)
|
||||
{
|
||||
Projectile.timeLeft = 640;
|
||||
Projectile.ArmorPenetration = 100;
|
||||
}
|
||||
direction = Main.rand.NextBool();
|
||||
homeSpeed = Main.rand.NextFloat(5, 8);
|
||||
}
|
||||
Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2;
|
||||
|
||||
if (Projectile.timeLeft < 290 && InfinityShot)
|
||||
if (Projectile.timeLeft < 290 && Infinity)
|
||||
{
|
||||
Projectile.velocity.X = MathHelper.Lerp(Projectile.velocity.X, -startVel.X, 0.02f);
|
||||
Projectile.velocity.Y = MathHelper.Lerp(Projectile.velocity.Y, -startVel.Y, 0.02f);
|
||||
}
|
||||
if (InfinityShot)
|
||||
if (Projectile.timeLeft <= 500 && Svant && goToMouse && Projectile.timeLeft % Projectile.extraUpdates == 0)
|
||||
{
|
||||
Vector2 mouseSpot = (player.Calamity().mouseWorld - Projectile.Center).SafeNormalize(Vector2.UnitX) * homeSpeed;
|
||||
Projectile.velocity.X = MathHelper.Lerp(Projectile.velocity.X, mouseSpot.X, 0.085f);
|
||||
Projectile.velocity.Y = MathHelper.Lerp(Projectile.velocity.Y, mouseSpot.Y, 0.085f);
|
||||
if (Vector2.Distance(Projectile.Center, player.Calamity().mouseWorld) < 80)
|
||||
{
|
||||
Projectile.timeLeft = 300;
|
||||
Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitX) * homeSpeed;
|
||||
goToMouse = false;
|
||||
}
|
||||
}
|
||||
if (!goToMouse)
|
||||
{
|
||||
float sine = (float)Math.Sin(Projectile.timeLeft * 0.375f / MathHelper.Pi) * 2.5f;
|
||||
Vector2 offset = Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(MathHelper.PiOver2) * sine * (direction ? 1 : -1);
|
||||
Projectile.Center += offset;
|
||||
}
|
||||
if (Infinity || Svant)
|
||||
{
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.penetrate = -1;
|
||||
@@ -64,6 +105,10 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
Particle spark2 = new LineParticle(Projectile.Center, (Projectile.velocity * 5).RotatedByRandom(0.4f) * Main.rand.NextFloat(0.8f, 1.2f), false, Main.rand.Next(8, 11 + 1), Main.rand.NextFloat(0.5f, 1f), baseColor);
|
||||
GeneralParticleHandler.SpawnParticle(spark2);
|
||||
}
|
||||
}
|
||||
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
|
||||
{
|
||||
|
||||
}
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user