fixed aether's whisper and ocean spirit

This commit is contained in:
termigator1359 committed 2020-07-30 22:06:27 -04:00
1 parent 2b60b367d9
commit 61b2f8bc6f
2 files changed
+141 -132

No files matched your search

+83 -63
View File
@@ -9,55 +9,73 @@ using Terraria.ModLoader;
namespace CalamityMod.Items.Weapons.Typeless
{
public class AethersWhisper : ModItem
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Aether's Whisper");
Tooltip.SetDefault("Inflicts several long-lasting debuffs and splits on tile hits\n" +
"Projectiles gain damage as they travel\n" +
"Right click to change from magic to ranged damage");
}
public class AethersWhisper : ModItem
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Aether's Whisper");
Tooltip.SetDefault("Inflicts several long-lasting debuffs and splits on tile hits\n" +
"Projectiles gain damage as they travel\n" +
"Right click to change from magic to ranged damage\n" +
"Right click consumes no mana");
}
public override void SetDefaults()
{
item.damage = 1150;
item.magic = true;
item.mana = 30;
item.width = 118;
item.height = 38;
item.useTime = 24;
item.useAnimation = 24;
item.useStyle = ItemUseStyleID.HoldingOut;
item.noMelee = true;
item.knockBack = 5.5f;
item.value = Item.buyPrice(1, 40, 0, 0);
item.rare = 10;
item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon");
item.autoReuse = true;
item.shootSpeed = 12f;
item.shoot = ModContent.ProjectileType<AetherBeam>();
item.Calamity().customRarity = CalamityRarity.PureGreen;
}
public override void SetDefaults()
{
item.damage = 1150;
item.knockBack = 5.5f;
item.useTime = item.useAnimation = 24;
item.shootSpeed = 12f;
item.shoot = ModContent.ProjectileType<AetherBeam>();
item.mana = 30;
item.magic = true;
item.autoReuse = true;
public override Vector2? HoldoutOffset() => new Vector2(-10, 0);
item.width = 118;
item.height = 38;
item.noMelee = true;
item.useStyle = ItemUseStyleID.HoldingOut;
item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon");
item.value = Item.buyPrice(1, 40, 0, 0);
item.rare = 10;
item.Calamity().customRarity = CalamityRarity.PureGreen;
}
public override bool AltFunctionUse(Player player) => true;
public override Vector2? HoldoutOffset() => new Vector2(-10, 0);
public override bool CanUseItem(Player player)
{
if (player.altFunctionUse == 2)
{
item.ranged = true;
item.magic = false;
}
else
{
item.ranged = false;
item.magic = true;
}
return base.CanUseItem(player);
}
public override bool AltFunctionUse(Player player) => true;
public override bool CanUseItem(Player player)
{
if (player.altFunctionUse == 2)
{
item.ranged = true;
item.magic = false;
}
else
{
item.ranged = false;
item.magic = true;
}
return base.CanUseItem(player);
}
public override bool OnPickup(Player player)
{
item.ranged = false;
item.magic = true;
return true;
}
public override void UpdateInventory(Player player)
{
// Reset to magic if not using an item to prevent sorting bugs.
if (player.itemAnimation <= 0)
{
item.ranged = false;
item.magic = true;
}
}
public override void ModifyManaCost(Player player, ref float reduce, ref float mult)
{
@@ -65,23 +83,25 @@ namespace CalamityMod.Items.Weapons.Typeless
mult *= 0f;
}
public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
{
float ai0 = player.altFunctionUse == 2 ? 1f : 0f;
Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, ai0, 0f);
return false;
}
public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
{
// This is coded weirdly because it defaults to using magic boosts without this.
int dmg = player.GetWeaponDamage(player.ActiveItem());
float ai0 = player.altFunctionUse == 2 ? 1f : 0f;
Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, dmg, knockBack, player.whoAmI, ai0, 0f);
return false;
}
public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ModContent.ItemType<PlasmaRod>());
recipe.AddIngredient(ModContent.ItemType<Lazhar>());
recipe.AddIngredient(ModContent.ItemType<SpectreRifle>());
recipe.AddIngredient(ModContent.ItemType<TwistingNether>(), 3);
recipe.AddTile(TileID.LunarCraftingStation);
recipe.SetResult(this);
recipe.AddRecipe();
}
}
public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ModContent.ItemType<PlasmaRod>());
recipe.AddIngredient(ModContent.ItemType<Lazhar>());
recipe.AddIngredient(ModContent.ItemType<SpectreRifle>());
recipe.AddIngredient(ModContent.ItemType<TwistingNether>(), 3);
recipe.AddTile(TileID.LunarCraftingStation);
recipe.SetResult(this);
recipe.AddRecipe();
}
}
}
+58 -69
View File
@@ -51,7 +51,8 @@ namespace CalamityMod.Projectiles.Pets
{
projectile.timeLeft = 2;
}
if (sleepyTimer < 180)
bool sleepy = sleepyTimer >= 180;
if (!sleepy)
{
projectile.frameCounter++;
if (projectile.frameCounter > 6)
@@ -71,7 +72,7 @@ namespace CalamityMod.Projectiles.Pets
{
if (projectile.frame >= 16)
{
projectile.frame = sleepyTimer >= 180 ? 16 : 8;
projectile.frame = sleepy ? 16 : 8;
}
}
underwater = player.IsUnderwater() || modPlayer.leviathanAndSirenLore;
@@ -92,7 +93,7 @@ namespace CalamityMod.Projectiles.Pets
}
else
{
if (sleepyTimer < 180)
if (!sleepy)
{
sleepyTimer++;
lightLevel = 1;
@@ -116,126 +117,114 @@ namespace CalamityMod.Projectiles.Pets
break;
}
float num23 = 0.2f;
float num24 = 5f;
Vector2 vector4 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f);
float num25 = player.position.X + (float)(player.width / 2) - vector4.X;
float num26 = player.position.Y + player.gfxOffY + (float)(player.height / 2) - vector4.Y;
if (player.controlLeft && sleepyTimer < 180)
float velAdjustment = 0.2f;
float speedLimit = 5f;
Vector2 playerVec = player.Center - projectile.Center;
playerVec.Y += player.gfxOffY;
if (player.controlLeft && !sleepy)
{
num25 -= 120f;
playerVec.X -= 120f;
}
else if (player.controlRight && sleepyTimer < 180)
else if (player.controlRight && !sleepy)
{
num25 += 120f;
playerVec.X += 120f;
}
if (player.controlDown && sleepyTimer < 180)
if (player.controlDown && !sleepy)
{
num26 += 120f;
playerVec.Y += 120f;
}
else
{
if (player.controlUp && sleepyTimer < 180)
if (player.controlUp && !sleepy)
{
num26 -= 120f;
playerVec.Y -= 120f;
}
num26 -= 60f;
playerVec.Y -= 60f;
}
float num27 = (float)Math.Sqrt((double)(num25 * num25 + num26 * num26));
if (num27 > 1000f)
if (projectile.velocity.X < -0.25f || (player.controlLeft && !sleepy))
{
projectile.position.X += num25;
projectile.position.Y += num26;
projectile.direction = -1; //face left
}
else if (projectile.velocity.X > 0.25f || (player.controlRight && !sleepy))
{
projectile.direction = 1; //face right
}
projectile.spriteDirection = projectile.direction;
float playerDist = playerVec.Length();
if (playerDist > 1000f)
{
projectile.position.X += playerVec.X;
projectile.position.Y += playerVec.Y;
}
if (projectile.localAI[0] == 1f)
{
if (num27 < 10f && Math.Abs(player.velocity.X) + Math.Abs(player.velocity.Y) < num24 && player.velocity.Y == 0f)
if (playerDist < 10f && player.velocity.Length() < speedLimit && player.velocity.Y == 0f)
{
projectile.localAI[0] = 0f;
}
num24 = 12f;
if (num27 < num24)
speedLimit = 12f;
if (playerDist < speedLimit)
{
projectile.velocity.X = num25;
projectile.velocity.Y = num26;
projectile.velocity = playerVec;
}
else
{
num27 = num24 / num27;
projectile.velocity.X = num25 * num27;
projectile.velocity.Y = num26 * num27;
playerDist = speedLimit / playerDist;
projectile.velocity = playerVec * playerDist;
}
if (projectile.velocity.X > 0.5f)
{
projectile.direction = -1;
}
else if (projectile.velocity.X < -0.5f)
{
projectile.direction = 1;
}
projectile.spriteDirection = projectile.direction;
projectile.rotation = projectile.velocity.X * 0.05f;
return;
}
if (num27 > 200f)
if (playerDist > 200f)
{
projectile.localAI[0] = 1f;
}
if (projectile.velocity.X > 0.5f)
if (playerDist < 10f)
{
projectile.direction = -1;
}
else if (projectile.velocity.X < -0.5f)
{
projectile.direction = 1;
}
projectile.spriteDirection = projectile.direction;
if (num27 < 10f)
{
projectile.velocity.X = num25;
projectile.velocity.Y = num26;
projectile.velocity.X = playerVec.X;
projectile.velocity.Y = playerVec.Y;
projectile.rotation = projectile.velocity.X * 0.05f;
if (num27 < num24)
if (playerDist < speedLimit)
{
projectile.position += projectile.velocity;
projectile.velocity *= 0f;
num23 = 0f;
velAdjustment = 0f;
}
projectile.direction = -player.direction;
}
num27 = num24 / num27;
num25 *= num27;
num26 *= num27;
if (projectile.velocity.X < num25)
playerDist = speedLimit / playerDist;
playerVec *= playerDist;
if (projectile.velocity.X < playerVec.X)
{
projectile.velocity.X += num23;
projectile.velocity.X += velAdjustment;
if (projectile.velocity.X < 0f)
{
projectile.velocity.X = projectile.velocity.X * 0.99f;
projectile.velocity.X *= 0.99f;
}
}
if (projectile.velocity.X > num25)
if (projectile.velocity.X > playerVec.X)
{
projectile.velocity.X -= num23;
projectile.velocity.X -= velAdjustment;
if (projectile.velocity.X > 0f)
{
projectile.velocity.X = projectile.velocity.X * 0.99f;
projectile.velocity.X *= 0.99f;
}
}
if (projectile.velocity.Y < num26)
if (projectile.velocity.Y < playerVec.Y)
{
projectile.velocity.Y += num23;
projectile.velocity.Y += velAdjustment;
if (projectile.velocity.Y < 0f)
{
projectile.velocity.Y = projectile.velocity.Y * 0.99f;
projectile.velocity.Y *= 0.99f;
}
}
if (projectile.velocity.Y > num26)
if (projectile.velocity.Y > playerVec.Y)
{
projectile.velocity.Y -= num23;
projectile.velocity.Y -= velAdjustment;
if (projectile.velocity.Y > 0f)
{
projectile.velocity.Y = projectile.velocity.Y * 0.99f;
projectile.velocity.Y *= 0.99f;
}
}
if (projectile.velocity.X != 0f || projectile.velocity.Y != 0f)