Merged Gacruxian Mollusk and added 0.11.5 optimizations to it.

This commit is contained in:
Ozzatron committed 2019-10-09 23:21:48 -04:00
commit e5b9f3d2e1
9 files changed
+242 -1

No files matched your search

+13 -1
View File
@@ -6812,7 +6812,7 @@ namespace CalamityMod.CalPlayer
#region Fishing
public override void CatchFish(Item fishingRod, Item bait, int power, int liquidType, int poolSize, int worldLayer, int questFish, ref int caughtType, ref bool junk)
{
if (ZoneAstral)
if (ZoneAstral && liquidType == 0) //Astral Infection, fishing in water
{
if (caughtType == ItemID.WoodenCrate)
{
@@ -6858,6 +6858,10 @@ namespace CalamityMod.CalPlayer
{
caughtType = mod.ItemType("UrsaSergeant");
}
else if (Main.rand.NextBool(25))
{
caughtType = mod.ItemType("GacruxianMollusk");
}
else
{
caughtType = mod.ItemType("TwinklingPollox");
@@ -6948,6 +6952,14 @@ namespace CalamityMod.CalPlayer
}
}
}
public override void GetFishingLevel(Item fishingRod, Item bait, ref int fishingLevel)
{
if ((ZoneAstral || ZoneAbyss || ZoneSulphur) && bait.type = mod.ItemType("ArcturusAstroidean"))
{
fishingLevel = (int)(fishingLevel * 1.1f);
}
}
#endregion
#region Frame Effects
@@ -0,0 +1,53 @@
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
namespace CalamityMod.Items.CalamityCustomThrowingDamage
{
public class GacruxianMollusk : CalamityDamageItem
{
public static int BaseDamage = 50;
public static float Knockback = 5f;
public static float Speed = 8f;
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Gacruxian Mollusk");
Tooltip.SetDefault("Releases homing sparks while traveling\n" +
"Stealth strikes release homing snails that create even more sparks");
}
public override void SafeSetDefaults()
{
item.damage = BaseDamage;
item.rare = 4;
item.knockBack = Knockback;
item.autoReuse = true;
item.useTime = 15;
item.useAnimation = 15;
item.useStyle = 1;
item.width = 24;
item.height = 22;
item.UseSound = SoundID.Item1;
item.noMelee = true;
item.noUseGraphic = true;
item.shoot = mod.ProjectileType("GacruxianProj");
item.shootSpeed = Speed;
item.value = Item.buyPrice(0, 0, 20, 0);
item.Calamity().rogue = true;
//item.maxStack = 999; not consumable because imagine knowing how to fish up more than one of an item
//item.consumable = true;
}
public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
{
if (player.Calamity().StealthStrikeAvailable())
{
int p = Projectile.NewProjectile(position, new Vector2(speedX, speedY), mod.ProjectileType("GacruxianProj"), damage, knockBack, player.whoAmI, 0f, 1f);
Main.projectile[p].Calamity().stealthStrike = true;
return false;
}
return true;
}
}
}
File renamed without changes.

Before

Width:  |  Height:  |  Size: 651 B

After

Width:  |  Height:  |  Size: 651 B

+1
View File
@@ -9,6 +9,7 @@ namespace CalamityMod.Items.Fishing
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Arcturus Astroidean");
Tooltip.SetDefault("Increases fishing power if used in the Astral Infection or Sulphurous Sea");
}
public override void SetDefaults()
+6
View File
@@ -22,6 +22,12 @@ namespace CalamityMod.Items.Fishing
item.height = 32;
item.rare = 2;
item.value = Item.sellPrice(gold: 1);
item.createTile = mod.TileType("AstralCrate");
item.useTurn = true;
item.autoReuse = true;
item.useAnimation = 15;
item.useTime = 10;
item.useStyle = 1;
}
public override bool CanRightClick()
+93
View File
@@ -0,0 +1,93 @@
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Rogue
{
public class GacruxianHome : ModProjectile
{
private int sparkTrailTimer = 10;
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Mollusk");
}
public override void SetDefaults()
{
projectile.width = 20;
projectile.height = 20;
projectile.aiStyle = 18;
projectile.friendly = true;
projectile.Calamity().rogue = true;
projectile.penetrate = 5;
projectile.timeLeft = 180;
projectile.ignoreWater = true;
aiType = 274;
projectile.usesLocalNPCImmunity = true;
projectile.localNPCHitCooldown = 5;
}
public override void AI()
{
sparkTrailTimer--;
if (Main.rand.NextBool(4))
{
Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, mod.DustType("AstralOrange"), projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f);
}
if (sparkTrailTimer == 0)
{
if (projectile.owner == Main.myPlayer)
{
int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0f, projectile.velocity.Y * 0f, mod.ProjectileType("UltimusCleaverDust"), (int)((double)projectile.damage * 0.75), projectile.knockBack, projectile.owner, 0f, 0f);
Main.projectile[proj].Calamity().forceRogue = true;
}
sparkTrailTimer = 10;
}
float num472 = projectile.Center.X;
float num473 = projectile.Center.Y;
float num474 = 600f;
bool flag17 = false;
for (int num475 = 0; num475 < 200; num475++)
{
if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1))
{
float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2);
float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2);
float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477);
if (num478 < num474)
{
num474 = num478;
num472 = num476;
num473 = num477;
flag17 = true;
}
}
}
if (flag17)
{
float num483 = 25f;
Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f);
float num484 = num472 - vector35.X;
float num485 = num473 - vector35.Y;
float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485));
num486 = num483 / num486;
num484 *= num486;
num485 *= num486;
projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f;
projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f;
}
}
public override void Kill(int timeLeft)
{
for (int i = 0; i <= 10; i++)
{
Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, mod.DustType("AstralOrange"), projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f);
}
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 651 B

+76
View File
@@ -0,0 +1,76 @@
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Rogue
{
public class GacruxianProj : ModProjectile
{
private int sparkTrailTimer = 10;
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Mollusk");
}
public override void SetDefaults()
{
projectile.width = 20;
projectile.height = 20;
projectile.friendly = true;
projectile.penetrate = 1;
projectile.aiStyle = 113;
projectile.timeLeft = 600;
aiType = 598;
projectile.Calamity().rogue = true;
}
public override void AI()
{
if (projectile.ai[1] == 1f && projectile.owner == Main.myPlayer)
{
sparkTrailTimer--;
if (Main.rand.NextBool(4))
{
Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, mod.DustType("AstralOrange"), projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f);
}
if (sparkTrailTimer == 0)
{
if (projectile.owner == Main.myPlayer)
{
Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0f, projectile.velocity.Y * 0f, mod.ProjectileType("GacruxianHome"), (int)((double)projectile.damage * 0.75), projectile.knockBack, projectile.owner, 0f, 0f);
}
sparkTrailTimer = 10;
}
}
else
{
sparkTrailTimer--;
if (Main.rand.NextBool(4))
{
Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, mod.DustType("AstralOrange"), projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f);
}
if (sparkTrailTimer == 0)
{
if (projectile.owner == Main.myPlayer)
{
int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0f, projectile.velocity.Y * 0f, mod.ProjectileType("UltimusCleaverDust"), (int)((double)projectile.damage * 0.75), projectile.knockBack, projectile.owner, 0f, 0f);
Main.projectile[proj].Calamity().forceRogue = true;
}
sparkTrailTimer = 10;
}
}
}
public override void Kill(int timeLeft)
{
for (int i = 0; i <= 10; i++)
{
Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, mod.DustType("AstralOrange"), projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f);
}
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 651 B