Victide Resprite 1.4 merge commit (see PR)
No files matched your search
@@ -1,4 +1,4 @@
|
||||
using CalamityMod.CalPlayer;
|
||||
using CalamityMod.CalPlayer;
|
||||
using CalamityMod.Projectiles.Summon;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
@@ -9,8 +9,8 @@ namespace CalamityMod.Buffs.Summon
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Urchin");
|
||||
Description.SetDefault("The urchin will protect you");
|
||||
DisplayName.SetDefault("Sea Snail");
|
||||
Description.SetDefault("Meow?");
|
||||
Main.buffNoTimeDisplay[Type] = true;
|
||||
Main.buffNoSave[Type] = true;
|
||||
//Main.persistentBuff[Type] = true;
|
||||
@@ -19,11 +19,14 @@ namespace CalamityMod.Buffs.Summon
|
||||
public override void Update(Player player, ref int buffIndex)
|
||||
{
|
||||
CalamityPlayer modPlayer = player.Calamity();
|
||||
if (player.ownedProjectileCounts[ModContent.ProjectileType<Urchin>()] > 0)
|
||||
|
||||
|
||||
if (player.ownedProjectileCounts[ModContent.ProjectileType<VictideSeaSnail>()] > 0)
|
||||
{
|
||||
modPlayer.vUrchin = true;
|
||||
modPlayer.victideSnail = true;
|
||||
}
|
||||
if (!modPlayer.vUrchin)
|
||||
|
||||
if (!modPlayer.victideSnail)
|
||||
{
|
||||
player.DelBuff(buffIndex);
|
||||
buffIndex--;
|
||||
|
||||
|
Before Width: | Height: | Size: 459 B After Width: | Height: | Size: 794 B |
@@ -617,6 +617,7 @@ namespace CalamityMod.CalPlayer
|
||||
public bool eskimoSet = false; //vanilla armor
|
||||
public bool meteorSet = false; //vanilla armor, for space gun nerf
|
||||
public bool victideSet = false;
|
||||
public bool victideSummoner = false;
|
||||
public bool sulfurSet = false;
|
||||
public bool sulfurJump = false;
|
||||
public bool jumpAgainSulfur = false;
|
||||
@@ -715,7 +716,6 @@ namespace CalamityMod.CalPlayer
|
||||
public bool omegaBlueChestplate = false;
|
||||
public bool omegaBlueSet = false;
|
||||
public bool omegaBlueHentai = false;
|
||||
public bool urchin = false;
|
||||
public bool valkyrie = false;
|
||||
public bool slimeGod = false;
|
||||
public bool molluskSet = false;
|
||||
@@ -941,7 +941,7 @@ namespace CalamityMod.CalPlayer
|
||||
public bool hauntedDishes = false;
|
||||
public bool stormjaw = false;
|
||||
public bool sGod = false;
|
||||
public bool vUrchin = false;
|
||||
public bool victideSnail = false;
|
||||
public bool cSpirit = false;
|
||||
public bool rOrb = false;
|
||||
public bool dCrystal = false;
|
||||
@@ -1778,6 +1778,7 @@ namespace CalamityMod.CalPlayer
|
||||
meteorSet = false; //vanilla armor, for Space Gun nerf
|
||||
|
||||
victideSet = false;
|
||||
victideSummoner = false;
|
||||
|
||||
sulfurSet = false;
|
||||
sulfurJump = false;
|
||||
@@ -2021,7 +2022,7 @@ namespace CalamityMod.CalPlayer
|
||||
sandnado = false;
|
||||
plantera = false;
|
||||
aProbe = false;
|
||||
vUrchin = false;
|
||||
victideSnail = false;
|
||||
cSpirit = false;
|
||||
rOrb = false;
|
||||
dCrystal = false;
|
||||
@@ -2038,7 +2039,6 @@ namespace CalamityMod.CalPlayer
|
||||
redDevil = false;
|
||||
valkyrie = false;
|
||||
slimeGod = false;
|
||||
urchin = false;
|
||||
chaosSpirit = false;
|
||||
daedalusCrystal = false;
|
||||
shellfish = false;
|
||||
@@ -5807,6 +5807,21 @@ namespace CalamityMod.CalPlayer
|
||||
Player.back = (sbyte)EquipLoader.GetEquipSlot(Mod, "XerocPlateMail", EquipType.Back);
|
||||
Player.neck = (sbyte)EquipLoader.GetEquipSlot(Mod, "XerocPlateMail", EquipType.Neck);
|
||||
}
|
||||
|
||||
bool victideBreastplateVisible = Player.body == EquipLoader.GetEquipSlot(Mod, "VictideBreastplate", EquipType.Body);
|
||||
//Give the player faulds if either the body armor or the leggings are equipped
|
||||
if (victideBreastplateVisible || Player.legs == EquipLoader.GetEquipSlot(Mod, "VictideGreaves", EquipType.Legs))
|
||||
{
|
||||
Player.waist = (sbyte)EquipLoader.GetEquipSlot(Mod, "VictideFaulds", EquipType.Waist);
|
||||
|
||||
//Also prevent the player from having any front drawing accs which would be wildly offset because of the different proportions.
|
||||
if (victideBreastplateVisible)
|
||||
{
|
||||
Player.front = -1;
|
||||
Player.handoff = -1;
|
||||
Player.handon = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.CalPlayer.DrawLayers
|
||||
{
|
||||
|
||||
//Extends the player's body sprite to draw over the head, useful for bulky chestplates such as the victide breastplate.
|
||||
public class BodyBulkLayer : PlayerDrawLayer
|
||||
{
|
||||
public override Position GetDefaultPosition() => new AfterParent(PlayerDrawLayers.Head);
|
||||
|
||||
public override bool GetDefaultVisibility(PlayerDrawSet drawInfo) => drawInfo.shadow == 0f || !drawInfo.drawPlayer.dead;
|
||||
|
||||
protected override void Draw(ref PlayerDrawSet drawInfo)
|
||||
{
|
||||
//While the extra bulk draws over the players head position, we don't want to have it drawn when the head alone is being drawn.
|
||||
if (drawInfo.headOnlyRender)
|
||||
return;
|
||||
|
||||
Player drawPlayer = drawInfo.drawPlayer;
|
||||
int bodyItem = drawPlayer.armor[1].type;
|
||||
if (drawPlayer.armor[11].type > ItemID.None)
|
||||
bodyItem = drawPlayer.armor[11].type;
|
||||
|
||||
if (ModContent.GetModItem(bodyItem) is IBulkyArmor chestplateBulkDrawer)
|
||||
{
|
||||
int dyeShader = drawPlayer.dye?[1].dye ?? 0;
|
||||
Vector2 drawPosition = drawInfo.Position - Main.screenPosition;
|
||||
|
||||
// Using drawPlayer to get width & height and such is perfectly fine, on the other hand. Just center everything
|
||||
drawPosition += new Vector2((drawPlayer.width - drawPlayer.bodyFrame.Width) / 2f, drawPlayer.height - drawPlayer.bodyFrame.Height + 4f);
|
||||
|
||||
//Convert to int to remove the jitter.
|
||||
drawPosition = new Vector2((int)drawPosition.X, (int)drawPosition.Y);
|
||||
|
||||
//Some dispalcements
|
||||
drawPosition += drawPlayer.bodyPosition + drawInfo.bodyVect;
|
||||
|
||||
//Grab the extension texture
|
||||
Texture2D extraPieceTexture = ModContent.Request<Texture2D>(chestplateBulkDrawer.BulkTexture).Value;
|
||||
|
||||
//Get the frame of the extension based on the players body frame
|
||||
Rectangle frame = extraPieceTexture.Frame(1, 20, 0, drawPlayer.bodyFrame.Y / drawPlayer.bodyFrame.Height);
|
||||
|
||||
DrawData pieceDrawData = new DrawData(extraPieceTexture, drawPosition, frame, drawInfo.colorArmorBody, drawPlayer.fullRotation, drawInfo.bodyVect, 1f, drawInfo.playerEffect, 0)
|
||||
{
|
||||
shader = dyeShader
|
||||
};
|
||||
drawInfo.DrawDataCache.Add(pieceDrawData);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria.DataStructures;
|
||||
|
||||
/// <summary>
|
||||
/// Interface that can be used by chestplates to appear extra bulky, by drawing partly over the players helmet with an extra layer
|
||||
/// </summary>
|
||||
public interface IBulkyArmor
|
||||
{
|
||||
/// <summary>
|
||||
/// The texture of the part that goes above the helmet
|
||||
/// This should be the same size as a regular equipped sprite (20 x 560 in 1x1)
|
||||
/// </summary>
|
||||
string BulkTexture { get; }
|
||||
}
|
||||
@@ -1352,7 +1352,7 @@ namespace CalamityMod
|
||||
ItemType<MoltenAmputator>(),
|
||||
ItemType<NanoblackReaperRogue>(),
|
||||
ItemType<SandDollar>(),
|
||||
ItemType<SeashellBoomerang>(),
|
||||
ItemType<FishboneBoomerang>(),
|
||||
ItemType<Shroomerang>(),
|
||||
ItemType<Valediction>(),
|
||||
ItemType<FrostcrushValari>(),
|
||||
@@ -1383,7 +1383,7 @@ namespace CalamityMod
|
||||
ProjectileType<FallenPaladinsHammerProj>(),
|
||||
ProjectileType<SandDollarProj>(),
|
||||
ProjectileType<SandDollarStealth>(),
|
||||
ProjectileType<SeashellBoomerangProjectile>(),
|
||||
ProjectileType<FishboneBoomerangProjectile>(),
|
||||
ProjectileType<ShroomerangProj>(),
|
||||
ProjectileType<TriactisHammerProj>(),
|
||||
ProjectileType<ValedictionBoomerang>(),
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace CalamityMod.Items.Accessories
|
||||
AddIngredient(ItemID.CratePotion, 8).
|
||||
AddRecipeGroup("Boss2Material", 5).
|
||||
AddIngredient<SeaPrism>(10).
|
||||
AddIngredient<VictideBar>(3).
|
||||
AddIngredient<SeaRemains>(3).
|
||||
AddTile(TileID.Anvils).
|
||||
Register();
|
||||
}
|
||||
|
||||
@@ -32,10 +32,7 @@ namespace CalamityMod.Items.Accessories
|
||||
{
|
||||
player.statDefense += 5;
|
||||
}
|
||||
if ((player.armor[0].type == ModContent.ItemType<VictideHeadgear>() || player.armor[0].type == ModContent.ItemType<VictideHelm>() ||
|
||||
player.armor[0].type == ModContent.ItemType<VictideHelmet>() || player.armor[0].type == ModContent.ItemType<VictideMask>() ||
|
||||
player.armor[0].type == ModContent.ItemType<VictideVisage>()) &&
|
||||
player.armor[1].type == ModContent.ItemType<VictideBreastplate>() && player.armor[2].type == ModContent.ItemType<VictideLeggings>())
|
||||
if (player.Calamity().victideSet)
|
||||
{
|
||||
player.moveSpeed += 0.1f;
|
||||
player.lifeRegen += 2;
|
||||
@@ -45,7 +42,7 @@ namespace CalamityMod.Items.Accessories
|
||||
public override void AddRecipes()
|
||||
{
|
||||
CreateRecipe().
|
||||
AddIngredient<VictideBar>(5).
|
||||
AddIngredient<SeaRemains>(5).
|
||||
AddIngredient(ItemID.Coral, 5).
|
||||
AddTile(TileID.Anvils).
|
||||
Register();
|
||||
|
||||
|
Before Width: | Height: | Size: 709 B After Width: | Height: | Size: 1009 B |
@@ -48,7 +48,7 @@ namespace CalamityMod.Items.Armor
|
||||
{
|
||||
CreateRecipe().
|
||||
AddIngredient(ItemID.SpiderGreaves).
|
||||
AddIngredient<VictideBar>(9).
|
||||
AddIngredient<SeaRemains>(9).
|
||||
AddIngredient<PlantyMush>(8).
|
||||
AddIngredient<AbyssGravel>(15).
|
||||
AddIngredient<DepthCells>(4).
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace CalamityMod.Items.Armor
|
||||
{
|
||||
CreateRecipe().
|
||||
AddIngredient(ItemID.SpiderBreastplate).
|
||||
AddIngredient<VictideBar>(12).
|
||||
AddIngredient<SeaRemains>(12).
|
||||
AddIngredient<PlantyMush>(10).
|
||||
AddIngredient<AbyssGravel>(18).
|
||||
AddIngredient<DepthCells>(5).
|
||||
|
||||
@@ -69,7 +69,7 @@ namespace CalamityMod.Items.Armor
|
||||
{
|
||||
CreateRecipe().
|
||||
AddIngredient(ItemID.SpiderMask).
|
||||
AddIngredient<VictideBar>(5).
|
||||
AddIngredient<SeaRemains>(5).
|
||||
AddIngredient<PlantyMush>(6).
|
||||
AddIngredient<AbyssGravel>(11).
|
||||
AddIngredient<DepthCells>(3).
|
||||
|
||||
@@ -6,14 +6,32 @@ using Terraria.ModLoader;
|
||||
namespace CalamityMod.Items.Armor
|
||||
{
|
||||
[AutoloadEquip(EquipType.Body)]
|
||||
public class VictideBreastplate : ModItem
|
||||
public class VictideBreastplate : ModItem, IBulkyArmor
|
||||
{
|
||||
public string BulkTexture => "CalamityMod/Items/Armor/VictideBreastplate_Bulk";
|
||||
|
||||
public override void Load()
|
||||
{
|
||||
if (Main.netMode != NetmodeID.Server)
|
||||
{
|
||||
//register the faulds texture. This appears either when the leggings or the chestplate is equipped (both works)
|
||||
EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Armor/VictideFaulds_Waist", EquipType.Waist, name: "VictideFaulds");
|
||||
}
|
||||
}
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
SacrificeTotal = 1;
|
||||
DisplayName.SetDefault("Victide Breastplate");
|
||||
Tooltip.SetDefault("5% increased damage reduction and critical strike chance\n" +
|
||||
"+5 defense and 10% increased damage reduction while submerged in liquid");
|
||||
|
||||
if (Main.netMode != NetmodeID.Server)
|
||||
{
|
||||
int equipSlot = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Body);
|
||||
ArmorIDs.Body.Sets.HidesArms[equipSlot] = true;
|
||||
ArmorIDs.Body.Sets.HidesTopSkin[equipSlot] = true;
|
||||
}
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
@@ -39,7 +57,7 @@ namespace CalamityMod.Items.Armor
|
||||
public override void AddRecipes()
|
||||
{
|
||||
CreateRecipe().
|
||||
AddIngredient<VictideBar>(5).
|
||||
AddIngredient<SeaRemains>(5).
|
||||
AddTile(TileID.Anvils).
|
||||
Register();
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 652 B After Width: | Height: | Size: 756 B |
|
Before Width: | Height: | Size: 3.9 KiB After Width: | Height: | Size: 6.5 KiB |
|
After Width: | Height: | Size: 833 B |
|
After Width: | Height: | Size: 2.7 KiB |
@@ -6,14 +6,21 @@ using Terraria.ModLoader;
|
||||
namespace CalamityMod.Items.Armor
|
||||
{
|
||||
[AutoloadEquip(EquipType.Legs)]
|
||||
public class VictideLeggings : ModItem
|
||||
[LegacyName("VictideLeggings")]
|
||||
public class VictideGreaves : ModItem
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
SacrificeTotal = 1;
|
||||
DisplayName.SetDefault("Victide Leggings");
|
||||
DisplayName.SetDefault("Victide Greaves");
|
||||
Tooltip.SetDefault("Movement speed increased by 8%\n" +
|
||||
"Movement speed increased by 30% while submerged in liquid");
|
||||
|
||||
if (Main.netMode != NetmodeID.Server)
|
||||
{
|
||||
int equipSlot = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Legs);
|
||||
ArmorIDs.Legs.Sets.HidesBottomSkin[equipSlot] = true;
|
||||
}
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
@@ -33,7 +40,7 @@ namespace CalamityMod.Items.Armor
|
||||
public override void AddRecipes()
|
||||
{
|
||||
CreateRecipe().
|
||||
AddIngredient<VictideBar>(4).
|
||||
AddIngredient<SeaRemains>(4).
|
||||
AddTile(TileID.Anvils).
|
||||
Register();
|
||||
}
|
||||
|
After Width: | Height: | Size: 536 B |
|
After Width: | Height: | Size: 3.7 KiB |
@@ -7,12 +7,13 @@ using Terraria.ModLoader;
|
||||
namespace CalamityMod.Items.Armor
|
||||
{
|
||||
[AutoloadEquip(EquipType.Head)]
|
||||
public class VictideMask : ModItem
|
||||
[LegacyName("VictideMask")]
|
||||
public class VictideHeadMagic : ModItem
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
SacrificeTotal = 1;
|
||||
DisplayName.SetDefault("Victide Mask");
|
||||
DisplayName.SetDefault("Victide Hermit Helmet");
|
||||
Tooltip.SetDefault("5% increased magic damage");
|
||||
}
|
||||
|
||||
@@ -27,7 +28,7 @@ namespace CalamityMod.Items.Armor
|
||||
|
||||
public override bool IsArmorSet(Item head, Item body, Item legs)
|
||||
{
|
||||
return body.type == ModContent.ItemType<VictideBreastplate>() && legs.type == ModContent.ItemType<VictideLeggings>();
|
||||
return body.type == ModContent.ItemType<VictideBreastplate>() && legs.type == ModContent.ItemType<VictideGreaves>();
|
||||
}
|
||||
|
||||
public override void UpdateArmorSet(Player player)
|
||||
@@ -54,7 +55,7 @@ namespace CalamityMod.Items.Armor
|
||||
public override void AddRecipes()
|
||||
{
|
||||
CreateRecipe().
|
||||
AddIngredient<VictideBar>(3).
|
||||
AddIngredient<SeaRemains>(3).
|
||||
AddTile(TileID.Anvils).
|
||||
Register();
|
||||
}
|
||||
|
After Width: | Height: | Size: 789 B |
|
After Width: | Height: | Size: 1.8 KiB |
@@ -7,12 +7,13 @@ using Terraria.ModLoader;
|
||||
namespace CalamityMod.Items.Armor
|
||||
{
|
||||
[AutoloadEquip(EquipType.Head)]
|
||||
public class VictideHelm : ModItem
|
||||
[LegacyName("VictideHelm")]
|
||||
public class VictideHeadMelee : ModItem
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
SacrificeTotal = 1;
|
||||
DisplayName.SetDefault("Victide Helm");
|
||||
DisplayName.SetDefault("Victide Shellmet");
|
||||
Tooltip.SetDefault("5% increased melee damage");
|
||||
}
|
||||
|
||||
@@ -27,7 +28,7 @@ namespace CalamityMod.Items.Armor
|
||||
|
||||
public override bool IsArmorSet(Item head, Item body, Item legs)
|
||||
{
|
||||
return body.type == ModContent.ItemType<VictideBreastplate>() && legs.type == ModContent.ItemType<VictideLeggings>();
|
||||
return body.type == ModContent.ItemType<VictideBreastplate>() && legs.type == ModContent.ItemType<VictideGreaves>();
|
||||
}
|
||||
|
||||
public override void UpdateArmorSet(Player player)
|
||||
@@ -56,7 +57,7 @@ namespace CalamityMod.Items.Armor
|
||||
public override void AddRecipes()
|
||||
{
|
||||
CreateRecipe().
|
||||
AddIngredient<VictideBar>(3).
|
||||
AddIngredient<SeaRemains>(3).
|
||||
AddTile(TileID.Anvils).
|
||||
Register();
|
||||
}
|
||||
|
After Width: | Height: | Size: 673 B |
|
After Width: | Height: | Size: 1.5 KiB |
@@ -7,12 +7,13 @@ using Terraria.ModLoader;
|
||||
namespace CalamityMod.Items.Armor
|
||||
{
|
||||
[AutoloadEquip(EquipType.Head)]
|
||||
public class VictideVisage : ModItem
|
||||
[LegacyName("VictideVisage")]
|
||||
public class VictideHeadRanged : ModItem
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
SacrificeTotal = 1;
|
||||
DisplayName.SetDefault("Victide Visage");
|
||||
DisplayName.SetDefault("Victide Coral Turban");
|
||||
Tooltip.SetDefault("5% increased ranged damage");
|
||||
}
|
||||
|
||||
@@ -27,7 +28,7 @@ namespace CalamityMod.Items.Armor
|
||||
|
||||
public override bool IsArmorSet(Item head, Item body, Item legs)
|
||||
{
|
||||
return body.type == ModContent.ItemType<VictideBreastplate>() && legs.type == ModContent.ItemType<VictideLeggings>();
|
||||
return body.type == ModContent.ItemType<VictideBreastplate>() && legs.type == ModContent.ItemType<VictideGreaves>();
|
||||
}
|
||||
|
||||
public override void UpdateArmorSet(Player player)
|
||||
@@ -54,7 +55,7 @@ namespace CalamityMod.Items.Armor
|
||||
public override void AddRecipes()
|
||||
{
|
||||
CreateRecipe().
|
||||
AddIngredient<VictideBar>(3).
|
||||
AddIngredient<SeaRemains>(3).
|
||||
AddTile(TileID.Anvils).
|
||||
Register();
|
||||
}
|
||||
|
After Width: | Height: | Size: 652 B |
|
After Width: | Height: | Size: 1.6 KiB |
@@ -7,12 +7,13 @@ using Terraria.ModLoader;
|
||||
namespace CalamityMod.Items.Armor
|
||||
{
|
||||
[AutoloadEquip(EquipType.Head)]
|
||||
public class VictideHeadgear : ModItem
|
||||
[LegacyName("VictideHeadgear")]
|
||||
public class VictideHeadRogue : ModItem
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
SacrificeTotal = 1;
|
||||
DisplayName.SetDefault("Victide Headgear");
|
||||
DisplayName.SetDefault("Victide Headcrab");
|
||||
Tooltip.SetDefault("5% increased rogue damage");
|
||||
}
|
||||
|
||||
@@ -27,7 +28,7 @@ namespace CalamityMod.Items.Armor
|
||||
|
||||
public override bool IsArmorSet(Item head, Item body, Item legs)
|
||||
{
|
||||
return body.type == ModContent.ItemType<VictideBreastplate>() && legs.type == ModContent.ItemType<VictideLeggings>();
|
||||
return body.type == ModContent.ItemType<VictideBreastplate>() && legs.type == ModContent.ItemType<VictideGreaves>();
|
||||
}
|
||||
|
||||
public override void UpdateArmorSet(Player player)
|
||||
@@ -60,7 +61,7 @@ namespace CalamityMod.Items.Armor
|
||||
public override void AddRecipes()
|
||||
{
|
||||
CreateRecipe().
|
||||
AddIngredient<VictideBar>(3).
|
||||
AddIngredient<SeaRemains>(3).
|
||||
AddTile(TileID.Anvils).
|
||||
Register();
|
||||
}
|
||||
|
After Width: | Height: | Size: 604 B |
|
After Width: | Height: | Size: 1.4 KiB |
@@ -10,12 +10,14 @@ using Terraria.ModLoader;
|
||||
namespace CalamityMod.Items.Armor
|
||||
{
|
||||
[AutoloadEquip(EquipType.Head)]
|
||||
public class VictideHelmet : ModItem
|
||||
[LegacyName("VictideHelmet")]
|
||||
public class VictideHeadSummon : ModItem
|
||||
{
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
SacrificeTotal = 1;
|
||||
DisplayName.SetDefault("Victide Helmet");
|
||||
DisplayName.SetDefault("Victide Mask");
|
||||
Tooltip.SetDefault("10% increased minion damage");
|
||||
}
|
||||
|
||||
@@ -30,7 +32,7 @@ namespace CalamityMod.Items.Armor
|
||||
|
||||
public override bool IsArmorSet(Item head, Item body, Item legs)
|
||||
{
|
||||
return body.type == ModContent.ItemType<VictideBreastplate>() && legs.type == ModContent.ItemType<VictideLeggings>();
|
||||
return body.type == ModContent.ItemType<VictideBreastplate>() && legs.type == ModContent.ItemType<VictideGreaves>();
|
||||
}
|
||||
|
||||
public override void UpdateArmorSet(Player player)
|
||||
@@ -43,7 +45,7 @@ namespace CalamityMod.Items.Armor
|
||||
"+1 max minion";
|
||||
CalamityPlayer modPlayer = player.Calamity();
|
||||
modPlayer.victideSet = true;
|
||||
modPlayer.urchin = true;
|
||||
modPlayer.victideSummoner = true;
|
||||
player.maxMinions++;
|
||||
if (player.whoAmI == Main.myPlayer)
|
||||
{
|
||||
@@ -52,11 +54,11 @@ namespace CalamityMod.Items.Armor
|
||||
player.AddBuff(ModContent.BuffType<VictideSummonSetBuff>(), 3600, true);
|
||||
}
|
||||
var source = player.GetSource_ItemUse(Item);
|
||||
if (player.ownedProjectileCounts[ModContent.ProjectileType<Urchin>()] < 1)
|
||||
if (player.ownedProjectileCounts[ModContent.ProjectileType<VictideSeaSnail>()] < 1)
|
||||
{
|
||||
int baseDamage = 7;
|
||||
int minionDamage = (int)player.GetDamage<GenericDamageClass>().CombineWith(player.GetDamage<SummonDamageClass>()).ApplyTo(baseDamage);
|
||||
int p = Projectile.NewProjectile(source, player.Center, -Vector2.UnitY, ModContent.ProjectileType<Urchin>(), minionDamage, 0f, Main.myPlayer, 0f, 0f);
|
||||
int p = Projectile.NewProjectile(source, player.Center, -Vector2.UnitY, ModContent.ProjectileType<VictideSeaSnail>(), minionDamage, 0f, Main.myPlayer, 0f, 0f);
|
||||
if (Main.projectile.IndexInRange(p))
|
||||
Main.projectile[p].originalDamage = baseDamage;
|
||||
}
|
||||
@@ -77,7 +79,7 @@ namespace CalamityMod.Items.Armor
|
||||
public override void AddRecipes()
|
||||
{
|
||||
CreateRecipe().
|
||||
AddIngredient<VictideBar>(3).
|
||||
AddIngredient<SeaRemains>(3).
|
||||
AddTile(TileID.Anvils).
|
||||
Register();
|
||||
}
|
||||
|
After Width: | Height: | Size: 643 B |
|
After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 396 B |
|
Before Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 488 B |
|
Before Width: | Height: | Size: 3.4 KiB |
|
Before Width: | Height: | Size: 425 B |
|
Before Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 364 B |
|
Before Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 346 B |
|
Before Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 454 B |
|
Before Width: | Height: | Size: 3.4 KiB |
@@ -4,12 +4,13 @@ using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Items.Materials
|
||||
{
|
||||
public class VictideBar : ModItem
|
||||
[LegacyName("VictideBar")]
|
||||
public class SeaRemains : ModItem
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
SacrificeTotal = 25;
|
||||
DisplayName.SetDefault("Victide Bar");
|
||||
DisplayName.SetDefault("Sea Remains");
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
|
After Width: | Height: | Size: 773 B |
|
Before Width: | Height: | Size: 585 B |
@@ -36,7 +36,7 @@ namespace CalamityMod.Items.Tools
|
||||
public override void AddRecipes()
|
||||
{
|
||||
CreateRecipe().
|
||||
AddIngredient<VictideBar>(3).
|
||||
AddIngredient<SeaRemains>(3).
|
||||
AddTile(TileID.Anvils).
|
||||
Register();
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 963 B After Width: | Height: | Size: 1.1 KiB |
@@ -36,7 +36,7 @@ namespace CalamityMod.Items.Tools
|
||||
public override void AddRecipes()
|
||||
{
|
||||
CreateRecipe().
|
||||
AddIngredient<VictideBar>(2).
|
||||
AddIngredient<SeaRemains>(2).
|
||||
AddTile(TileID.Anvils).
|
||||
Register();
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 852 B After Width: | Height: | Size: 1.0 KiB |
@@ -1,6 +1,9 @@
|
||||
using CalamityMod.Items.Materials;
|
||||
using System.Linq;
|
||||
using CalamityMod.Items.Materials;
|
||||
using CalamityMod.Projectiles.Magic;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
@@ -8,37 +11,81 @@ namespace CalamityMod.Items.Weapons.Magic
|
||||
{
|
||||
public class CoralSpout : ModItem
|
||||
{
|
||||
public static readonly SoundStyle ChargeSound = SoundID.LiquidsHoneyWater with { Type = SoundType.Sound };
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Coral Spout");
|
||||
Tooltip.SetDefault("Casts coral water spouts that lay on the ground and damage enemies");
|
||||
Tooltip.SetDefault("Casts a shotgun-like blast of coral shards\n" +
|
||||
"Keep the attack button held down to narrow the spread\n" +
|
||||
"Fully charging the attack releases a single, bigger chunk of coral that sticks to enemies\n" +
|
||||
"Grabbing the chunk of coral after it falls from the enemy replenishes 100 mana\n" +
|
||||
//Lore tooltip time. Sekiro.
|
||||
"[c/5C95A1:Knowledge is important, and the Old Sea Kingdom’s many scribes knew it had to be preserved at any cost.]\n" +
|
||||
"[c/5C95A1:Their libraries were much larger than most, because of the water-proof stone tablets occupying them.]"
|
||||
);
|
||||
SacrificeTotal = 1;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.damage = 17;
|
||||
Item.damage = 7;
|
||||
Item.DamageType = DamageClass.Magic;
|
||||
Item.mana = 4;
|
||||
Item.mana = 7;
|
||||
Item.width = 28;
|
||||
Item.height = 30;
|
||||
Item.useTime = 26;
|
||||
Item.useAnimation = 26;
|
||||
Item.useStyle = ItemUseStyleID.Shoot;
|
||||
Item.noMelee = true;
|
||||
Item.channel = true;
|
||||
Item.knockBack = 2f;
|
||||
Item.value = Item.buyPrice(0, 2, 0, 0);
|
||||
Item.rare = ItemRarityID.Green;
|
||||
Item.UseSound = SoundID.Item17;
|
||||
Item.autoReuse = true;
|
||||
Item.shoot = ModContent.ProjectileType<CoralSpike>();
|
||||
Item.shoot = ModContent.ProjectileType<CoralSpoutHoldout>();
|
||||
Item.shootSpeed = 16f;
|
||||
}
|
||||
|
||||
public override void HoldItem(Player player)
|
||||
{
|
||||
player.Calamity().mouseWorldListener = true;
|
||||
}
|
||||
|
||||
public override bool CanUseItem(Player player)
|
||||
{
|
||||
return !Main.projectile.Any(n => n.active && n.owner == player.whoAmI && n.type == ModContent.ProjectileType<CoralSpoutHoldout>());
|
||||
}
|
||||
|
||||
public override void UseItemFrame(Player player)
|
||||
{
|
||||
//Calculate the dirction in which the players arms should be pointing at.
|
||||
Vector2 playerToCursor = (player.Calamity().mouseWorld - player.Center).SafeNormalize(Vector2.UnitX);
|
||||
float armPointingDirection = (playerToCursor.ToRotation());
|
||||
|
||||
player.SetCompositeArmBack(true, Player.CompositeArmStretchAmount.Full, armPointingDirection - MathHelper.PiOver2);
|
||||
player.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, armPointingDirection - MathHelper.PiOver2);
|
||||
}
|
||||
|
||||
public override void UseStyle(Player player, Rectangle heldItemFrame)
|
||||
{
|
||||
if (player.Calamity().mouseWorld.X > player.Center.X)
|
||||
{
|
||||
player.ChangeDir(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
player.ChangeDir(-1);
|
||||
}
|
||||
|
||||
CalamityUtils.CleanHoldStyle(player, player.compositeFrontArm.rotation + MathHelper.PiOver2, player.GetFrontHandPosition(player.compositeFrontArm.stretch, player.compositeFrontArm.rotation).Floor(), new Vector2(32, 0), new Vector2(-10, 8));
|
||||
}
|
||||
|
||||
public override void AddRecipes()
|
||||
{
|
||||
CreateRecipe().
|
||||
AddIngredient<VictideBar>(2).
|
||||
AddIngredient<SeaRemains>(2).
|
||||
AddIngredient(ItemID.Coral, 5).
|
||||
AddTile(TileID.Bookcases).
|
||||
Register();
|
||||
|
||||
|
Before Width: | Height: | Size: 584 B After Width: | Height: | Size: 756 B |
@@ -1,21 +1,28 @@
|
||||
using CalamityMod.Items.Materials;
|
||||
using CalamityMod.Projectiles.Melee.Yoyos;
|
||||
using System.Linq;
|
||||
using CalamityMod.Items.Materials;
|
||||
using CalamityMod.Projectiles.Melee;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using static Terraria.ModLoader.ModContent;
|
||||
|
||||
namespace CalamityMod.Items.Weapons.Melee
|
||||
{
|
||||
public class Cnidarian : ModItem
|
||||
{
|
||||
public override string Texture => "CalamityMod/Items/Weapons/Melee/CnidarianFishingRod";
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Cnidarian");
|
||||
Tooltip.SetDefault("Fires a seashell when enemies are near\n" +
|
||||
"A very agile yoyo");
|
||||
ItemID.Sets.Yoyo[Item.type] = true;
|
||||
ItemID.Sets.GamepadExtraRange[Item.type] = 15;
|
||||
ItemID.Sets.GamepadSmartQuickReach[Item.type] = true;
|
||||
Tooltip.SetDefault("Fishes up an electric jellyfish\n" +
|
||||
"Periodically sends out sparks to electrocute nearby enemies.\n" +
|
||||
//Lore tooltip time. Elden Ring.
|
||||
"[c/5C95A1:From looking at their less sapient brethren, the Old Kingdom’s inhabitants adapted tools and weapons designed for underwater efficiency.]\n" +
|
||||
"[c/5C95A1:The electric properties of ghost bells remain useful even after death, having been commonly used as conduits.]"
|
||||
);
|
||||
SacrificeTotal = 1;
|
||||
}
|
||||
|
||||
@@ -30,25 +37,122 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
Item.useAnimation = 25;
|
||||
Item.autoReuse = true;
|
||||
|
||||
Item.holdStyle = 16; //Custom hold style
|
||||
Item.useStyle = ItemUseStyleID.Shoot;
|
||||
Item.UseSound = SoundID.Item1;
|
||||
Item.channel = true;
|
||||
Item.noUseGraphic = true;
|
||||
//Item.noUseGraphic = true;
|
||||
Item.noMelee = true;
|
||||
|
||||
Item.shoot = ModContent.ProjectileType<CnidarianYoyo>();
|
||||
Item.shoot = ModContent.ProjectileType<CnidarianJellyfishOnTheString>();
|
||||
Item.shootSpeed = 10f;
|
||||
|
||||
Item.rare = ItemRarityID.Green;
|
||||
Item.value = Item.buyPrice(gold: 2);
|
||||
}
|
||||
|
||||
public override bool CanUseItem(Player player)
|
||||
{
|
||||
return !Main.projectile.Any(n => n.active && n.owner == player.whoAmI && n.type == ProjectileType<CnidarianJellyfishOnTheString>());
|
||||
}
|
||||
|
||||
public override void AddRecipes()
|
||||
{
|
||||
CreateRecipe().
|
||||
AddIngredient<VictideBar>(2).
|
||||
AddIngredient<SeaRemains>(2).
|
||||
AddTile(TileID.Anvils).
|
||||
Register();
|
||||
}
|
||||
|
||||
public override void HoldItem(Player player)
|
||||
{
|
||||
player.Calamity().mouseWorldListener = true;
|
||||
}
|
||||
|
||||
|
||||
#region drawing stuff
|
||||
public void SetItemInHand(Player player, Rectangle heldItemFrame)
|
||||
{
|
||||
//Make the player face where they're aiming.
|
||||
if (player.Calamity().mouseWorld.X > player.Center.X)
|
||||
{
|
||||
player.ChangeDir(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
player.ChangeDir(-1);
|
||||
}
|
||||
|
||||
CalamityUtils.CleanHoldStyle(player, player.compositeFrontArm.rotation + MathHelper.PiOver2, player.GetFrontHandPosition(player.compositeFrontArm.stretch, player.compositeFrontArm.rotation).Floor(), new Vector2(42, 34), new Vector2(-15, 11));
|
||||
}
|
||||
|
||||
|
||||
public void SetPlayerArms(Player player)
|
||||
{
|
||||
//Calculate the dirction in which the players arms should be pointing at.
|
||||
Vector2 playerToCursor = (player.Calamity().mouseWorld - player.Center).SafeNormalize(Vector2.UnitX);
|
||||
float armPointingDirection = (playerToCursor.ToRotation());
|
||||
|
||||
|
||||
//"crop" the rotation so the player only tilts the fishing rod slightly up and slightly down.
|
||||
if (armPointingDirection < MathHelper.PiOver2 && armPointingDirection >= -MathHelper.PiOver2)
|
||||
{
|
||||
armPointingDirection = -MathHelper.PiOver2 + MathHelper.PiOver4 + MathHelper.PiOver2 * Utils.GetLerpValue(0f, MathHelper.Pi, armPointingDirection + MathHelper.PiOver2, true);
|
||||
}
|
||||
|
||||
//It gets a bit harder if its pointing left; ouch
|
||||
else
|
||||
{
|
||||
if (armPointingDirection > 0)
|
||||
armPointingDirection = MathHelper.PiOver2 + MathHelper.PiOver4 + MathHelper.PiOver4 * Utils.GetLerpValue(0f, MathHelper.PiOver2, armPointingDirection - MathHelper.PiOver2, true);
|
||||
else
|
||||
armPointingDirection = -MathHelper.Pi + MathHelper.PiOver4 * Utils.GetLerpValue(-MathHelper.Pi, -MathHelper.PiOver4, armPointingDirection, true);
|
||||
}
|
||||
|
||||
player.SetCompositeArmBack(true, Player.CompositeArmStretchAmount.Full, armPointingDirection - MathHelper.PiOver2);
|
||||
player.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, armPointingDirection - MathHelper.PiOver2);
|
||||
}
|
||||
|
||||
public override void HoldStyle(Player player, Rectangle heldItemFrame)
|
||||
{
|
||||
SetItemInHand(player, heldItemFrame);
|
||||
}
|
||||
|
||||
public override void UseStyle(Player player, Rectangle heldItemFrame)
|
||||
{
|
||||
SetItemInHand(player, heldItemFrame);
|
||||
}
|
||||
|
||||
public override void HoldItemFrame(Player player)
|
||||
{
|
||||
SetPlayerArms(player);
|
||||
}
|
||||
|
||||
public override void UseItemFrame(Player player)
|
||||
{
|
||||
SetPlayerArms(player);
|
||||
}
|
||||
|
||||
public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale)
|
||||
{
|
||||
Texture2D properSprite = ModContent.Request<Texture2D>("CalamityMod/Items/Weapons/Melee/Cnidarian").Value;
|
||||
|
||||
//Scale the jellyfish sprite properly, since its larger than the fishing rod (Largest dimension of the jellyfish sprite : 52. Largest dimension of the fishing rod : 42)
|
||||
float scaleRatio = 42 / 52f;
|
||||
//Offset the jellyfish sprite properly, since the fishing rod is larger than the jellyfish (Jellyfish width : 28px, Fishing rod width : 42)
|
||||
Vector2 positionOffset = new Vector2(21 - 14, 0) * scale;
|
||||
|
||||
spriteBatch.Draw(properSprite, position + positionOffset, null, drawColor, 0f, origin, scale * scaleRatio, 0, 0);
|
||||
return false;
|
||||
}
|
||||
|
||||
public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI)
|
||||
{
|
||||
Texture2D properSprite = ModContent.Request<Texture2D>("CalamityMod/Items/Weapons/Melee/Cnidarian").Value;
|
||||
|
||||
spriteBatch.Draw(properSprite, Item.position - Main.screenPosition, null, lightColor, rotation, properSprite.Size() / 2f, scale, 0, 0);
|
||||
return false;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 691 B After Width: | Height: | Size: 982 B |
|
After Width: | Height: | Size: 827 B |
@@ -66,7 +66,7 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
public override void AddRecipes()
|
||||
{
|
||||
CreateRecipe().
|
||||
AddIngredient<VictideBar>(5).
|
||||
AddIngredient<SeaRemains>(5).
|
||||
AddIngredient(ItemID.SharkFin, 2).
|
||||
AddRecipeGroup("AnyAdamantiteBar", 5).
|
||||
AddIngredient<DepthCells>(10).
|
||||
|
||||
@@ -6,42 +6,54 @@ using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Items.Weapons.Melee
|
||||
{
|
||||
public class UrchinSpear : ModItem
|
||||
[LegacyName("UrchinSpear")]
|
||||
public class RedtideSpear : ModItem
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Urchin Spear");
|
||||
Tooltip.SetDefault("Poisons enemies and fires short-range stingers");
|
||||
DisplayName.SetDefault("Redtide Spear");
|
||||
Tooltip.SetDefault("Poisons enemies on hit\n"+
|
||||
"Aiming the spear in front of you while running holds it down with increased knockback\n"+
|
||||
"Releasing the attack button after the charge makes an upwards slash, sending enemies flying into the air\n"+
|
||||
//Lore tooltip time. Dark souls.
|
||||
"[c/5C95A1:The people of the sea were adept hunters, but they abhorred unnecessary violence.]\n" +
|
||||
"[c/5C95A1:Unfortunately, neighboring nations were brutish, so they fashioned their tools for war.]");
|
||||
SacrificeTotal = 1;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.width = 56;
|
||||
Item.damage = 28;
|
||||
Item.damage = 33;
|
||||
Item.DamageType = DamageClass.Melee;
|
||||
Item.noMelee = true;
|
||||
Item.useTurn = true;
|
||||
Item.noUseGraphic = true;
|
||||
Item.useAnimation = 25;
|
||||
Item.useStyle = ItemUseStyleID.Shoot;
|
||||
Item.channel = true;
|
||||
Item.useTime = 25;
|
||||
Item.knockBack = 5f;
|
||||
Item.UseSound = SoundID.Item1;
|
||||
Item.UseSound = null;
|
||||
Item.autoReuse = true;
|
||||
Item.height = 56;
|
||||
Item.value = Item.buyPrice(0, 2, 0, 0);
|
||||
Item.rare = ItemRarityID.Green;
|
||||
Item.shoot = ModContent.ProjectileType<UrchinSpearProjectile>();
|
||||
Item.shoot = ModContent.ProjectileType<RedtideSpearProjectile>();
|
||||
Item.shootSpeed = 4f;
|
||||
}
|
||||
|
||||
public override void HoldItem(Player player)
|
||||
{
|
||||
player.Calamity().mouseWorldListener = true;
|
||||
}
|
||||
|
||||
public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0;
|
||||
|
||||
public override void AddRecipes()
|
||||
{
|
||||
CreateRecipe().
|
||||
AddIngredient<VictideBar>(4).
|
||||
AddIngredient<SeaRemains>(4).
|
||||
AddTile(TileID.Anvils).
|
||||
Register();
|
||||
}
|
||||
|
After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 784 B |
@@ -1,51 +1,57 @@
|
||||
using Terraria.DataStructures;
|
||||
using System.Linq;
|
||||
using CalamityMod.Items.Materials;
|
||||
using CalamityMod.Projectiles.Melee;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Items.Weapons.Melee
|
||||
{
|
||||
public class RedtideSword : ModItem
|
||||
[LegacyName("RedtideSword")]
|
||||
public class UrchinMace : ModItem
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Redtide Sword");
|
||||
Tooltip.SetDefault("Throws short-range whirlpools");
|
||||
DisplayName.SetDefault("Urchin Mace");
|
||||
Tooltip.SetDefault("Throws out a whirlpool when released at full charge");
|
||||
SacrificeTotal = 1;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.width = 42;
|
||||
Item.damage = 35;
|
||||
Item.damage = 20;
|
||||
Item.channel = true;
|
||||
Item.noUseGraphic = true;
|
||||
Item.noMelee = true;
|
||||
Item.useTurn = true;
|
||||
Item.DamageType = DamageClass.Melee;
|
||||
Item.useAnimation = 19;
|
||||
Item.useStyle = ItemUseStyleID.Swing;
|
||||
Item.useTime = 19;
|
||||
Item.useTurn = true;
|
||||
Item.knockBack = 4;
|
||||
Item.UseSound = SoundID.Item1;
|
||||
Item.autoReuse = true;
|
||||
Item.height = 42;
|
||||
Item.height = 48;
|
||||
Item.value = Item.buyPrice(0, 2, 0, 0);
|
||||
Item.rare = ItemRarityID.Green;
|
||||
Item.shoot = ModContent.ProjectileType<RedtideWhirlpool>();
|
||||
Item.shoot = ModContent.ProjectileType<UrchinMaceProjectile>();
|
||||
Item.shootSpeed = 9f;
|
||||
}
|
||||
|
||||
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
|
||||
public override void HoldItem(Player player)
|
||||
{
|
||||
Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage / 2, knockback, player.whoAmI, 0f, 0f);
|
||||
return false;
|
||||
player.Calamity().mouseWorldListener = true;
|
||||
}
|
||||
|
||||
public override bool CanUseItem(Player player)
|
||||
{
|
||||
return !Main.projectile.Any(n => n.active && n.owner == player.whoAmI && n.type == ModContent.ProjectileType<UrchinMaceProjectile>());
|
||||
}
|
||||
|
||||
public override void AddRecipes()
|
||||
{
|
||||
CreateRecipe().
|
||||
AddIngredient<VictideBar>(3).
|
||||
AddIngredient<SeaRemains>(3).
|
||||
AddTile(TileID.Anvils).
|
||||
Register();
|
||||
}
|
||||
|
After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 939 B |
@@ -70,7 +70,7 @@ namespace CalamityMod.Items.Weapons.Ranged
|
||||
AddIngredient<AerialiteBar>(2).
|
||||
AddIngredient<SeaPrism>(10).
|
||||
AddIngredient<PrismShard>(15).
|
||||
AddIngredient<VictideBar>(5).
|
||||
AddIngredient<SeaRemains>(5).
|
||||
AddTile(TileID.Anvils).
|
||||
Register();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,131 @@
|
||||
using CalamityMod.Items.Materials;
|
||||
using CalamityMod.Projectiles.Ranged;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Items.Weapons.Ranged
|
||||
{
|
||||
[LegacyName("Seabow")]
|
||||
public class ReedBlowgun : ModItem
|
||||
{
|
||||
public static readonly SoundStyle BubbleBurstSound = new ("CalamityMod/Sounds/Custom/PistolShrimpBubbleBurst") { PitchVariance = 0.15f, Volume = 0.2f};
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Reed Blowgun");
|
||||
Tooltip.SetDefault("Fires a high-pressure stream of bubbles\n" +
|
||||
//Lore tooltip time. King's field
|
||||
"[c/5C95A1:The Old Sea Kingdom never truly sought to expand beyond its initial borders.]\n" +
|
||||
"[c/5C95A1:However, they had a perfect track record of repelling any invasions, thanks to their insurmountable advantage in the water.]"
|
||||
);
|
||||
|
||||
SacrificeTotal = 1;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.damage = 19;
|
||||
Item.DamageType = DamageClass.Ranged;
|
||||
Item.width = 22;
|
||||
Item.height = 46;
|
||||
Item.useTime = 25;
|
||||
Item.useAnimation = 25;
|
||||
Item.useStyle = ItemUseStyleID.Shoot;
|
||||
Item.holdStyle = 16;
|
||||
Item.noMelee = true;
|
||||
Item.knockBack = 13.5f;
|
||||
Item.value = Item.buyPrice(0, 2, 0, 0);
|
||||
Item.rare = ItemRarityID.Green;
|
||||
Item.UseSound = null;
|
||||
Item.autoReuse = true;
|
||||
Item.shoot = ModContent.ProjectileType<PressurizedBubbleStream>();
|
||||
Item.shootSpeed = 16f;
|
||||
Item.Calamity().canFirePointBlankShots = true;
|
||||
}
|
||||
|
||||
public override void HoldItem(Player player)
|
||||
{
|
||||
player.Calamity().mouseWorldListener = true;
|
||||
}
|
||||
|
||||
public override void ModifyShootStats(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback)
|
||||
{
|
||||
velocity = velocity.RotatedByRandom(0.01f);
|
||||
}
|
||||
|
||||
public void SetItemInHand(Player player, Rectangle heldItemFrame)
|
||||
{
|
||||
//Make the player face where they're aiming.
|
||||
if (Main.MouseWorld.X > player.Center.X)
|
||||
{
|
||||
player.ChangeDir(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
player.ChangeDir(-1);
|
||||
}
|
||||
|
||||
float blowpipeRotation = player.compositeBackArm.rotation + MathHelper.PiOver2 + player.direction * MathHelper.PiOver4 / 3f;
|
||||
|
||||
Vector2 blowpipePosition = player.GetBackHandPosition(player.compositeBackArm.stretch, player.compositeBackArm.rotation).Floor() + Vector2.UnitY * 7f;
|
||||
if (player.direction > 0)
|
||||
blowpipePosition += Vector2.UnitX * -9f;
|
||||
|
||||
CalamityUtils.CleanHoldStyle(player, blowpipeRotation, blowpipePosition, new Vector2(50, 18), new Vector2(-17, 6));
|
||||
}
|
||||
|
||||
|
||||
public void SetPlayerArms(Player player, bool frontArm = false)
|
||||
{
|
||||
//Make the player face where they're aiming.
|
||||
if (player.Calamity().mouseWorld.X > player.Center.X)
|
||||
{
|
||||
player.ChangeDir(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
player.ChangeDir(-1);
|
||||
}
|
||||
|
||||
//Calculate the dirction in which the players arms should be pointing at.
|
||||
Vector2 playerToCursor = (player.Calamity().mouseWorld - player.Center).SafeNormalize(Vector2.UnitX);
|
||||
float pointingDirection = (playerToCursor.ToRotation());
|
||||
|
||||
if (frontArm)
|
||||
player.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, pointingDirection - MathHelper.PiOver2);
|
||||
player.SetCompositeArmBack(true, Player.CompositeArmStretchAmount.Full, pointingDirection - MathHelper.PiOver2);
|
||||
player.headRotation = pointingDirection;
|
||||
}
|
||||
|
||||
public override void HoldStyle(Player player, Rectangle heldItemFrame)
|
||||
{
|
||||
SetItemInHand(player, heldItemFrame);
|
||||
}
|
||||
|
||||
public override void UseStyle(Player player, Rectangle heldItemFrame)
|
||||
{
|
||||
SetItemInHand(player, heldItemFrame);
|
||||
}
|
||||
|
||||
public override void HoldItemFrame(Player player)
|
||||
{
|
||||
SetPlayerArms(player);
|
||||
}
|
||||
|
||||
public override void UseItemFrame(Player player)
|
||||
{
|
||||
SetPlayerArms(player, true);
|
||||
}
|
||||
|
||||
public override void AddRecipes()
|
||||
{
|
||||
CreateRecipe().
|
||||
AddIngredient<SeaRemains>(2).
|
||||
AddTile(TileID.Anvils).
|
||||
Register();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 587 B |
@@ -1,57 +0,0 @@
|
||||
using Terraria.DataStructures;
|
||||
using CalamityMod.Items.Materials;
|
||||
using CalamityMod.Projectiles.Ranged;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Items.Weapons.Ranged
|
||||
{
|
||||
public class Seabow : ModItem
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Seabow");
|
||||
Tooltip.SetDefault("Fires slow-moving water blasts");
|
||||
SacrificeTotal = 1;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.damage = 12;
|
||||
Item.DamageType = DamageClass.Ranged;
|
||||
Item.width = 22;
|
||||
Item.height = 46;
|
||||
Item.useTime = 25;
|
||||
Item.useAnimation = 25;
|
||||
Item.useStyle = ItemUseStyleID.Shoot;
|
||||
Item.noMelee = true;
|
||||
Item.knockBack = 2.5f;
|
||||
Item.value = Item.buyPrice(0, 2, 0, 0);
|
||||
Item.rare = ItemRarityID.Green;
|
||||
Item.UseSound = SoundID.Item5;
|
||||
Item.autoReuse = true;
|
||||
Item.shoot = ProjectileID.PurificationPowder;
|
||||
Item.shootSpeed = 16f;
|
||||
Item.useAmmo = AmmoID.Arrow;
|
||||
Item.Calamity().canFirePointBlankShots = true;
|
||||
}
|
||||
|
||||
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
|
||||
{
|
||||
float SpeedX = velocity.X + (float)Main.rand.Next(-30, 31) * 0.05f;
|
||||
float SpeedY = velocity.Y + (float)Main.rand.Next(-30, 31) * 0.05f;
|
||||
Projectile.NewProjectile(source, position.X, position.Y, SpeedX * 0.5f, SpeedY * 0.5f, ModContent.ProjectileType<SandWater>(), (int)(damage * 0.4), 0f, player.whoAmI);
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void AddRecipes()
|
||||
{
|
||||
CreateRecipe().
|
||||
AddIngredient<VictideBar>(2).
|
||||
AddTile(TileID.Anvils).
|
||||
Register();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 822 B |
@@ -1,39 +1,51 @@
|
||||
using Terraria.DataStructures;
|
||||
using System.Linq;
|
||||
using CalamityMod.Items.Materials;
|
||||
using CalamityMod.Projectiles.Rogue;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Items.Weapons.Rogue
|
||||
{
|
||||
public class SeashellBoomerang : ModItem
|
||||
[LegacyName("SeashellBoomerang")]
|
||||
public class FishboneBoomerang : ModItem
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Seashell Boomerang");
|
||||
Tooltip.SetDefault("Stealth strikes fire seashells at nearby enemies");
|
||||
DisplayName.SetDefault("Fishbone Boomerang");
|
||||
Tooltip.SetDefault("Stealth strikes make the boomerang ricochet between enemies\n" +
|
||||
//lore tooltip u get the thing
|
||||
"[c/5C95A1:Though the evaporating Sea Kingdom fought a losing battle, its proud inhabitants did not go down easily.]\n" +
|
||||
"[c/5C95A1:As a last resort, they had to fashion weapons from the skeletons of dead animals.]"
|
||||
);
|
||||
SacrificeTotal = 1;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.width = 18;
|
||||
Item.damage = 15;
|
||||
Item.damage = 24;
|
||||
Item.noMelee = true;
|
||||
Item.noUseGraphic = true;
|
||||
Item.useAnimation = 15;
|
||||
Item.useStyle = ItemUseStyleID.Swing;
|
||||
Item.useTime = 15;
|
||||
Item.knockBack = 5.5f;
|
||||
Item.UseSound = SoundID.Item1;
|
||||
Item.UseSound = null;
|
||||
Item.height = 34;
|
||||
Item.value = Item.buyPrice(0, 2, 0, 0);
|
||||
Item.rare = ItemRarityID.Green;
|
||||
Item.shoot = ModContent.ProjectileType<SeashellBoomerangProjectile>();
|
||||
Item.shootSpeed = 11.5f;
|
||||
Item.shoot = ModContent.ProjectileType<FishboneBoomerangProjectile>();
|
||||
Item.shootSpeed = 3f;
|
||||
Item.DamageType = RogueDamageClass.Instance;
|
||||
Item.autoReuse = true;
|
||||
}
|
||||
|
||||
public override bool CanUseItem(Player player)
|
||||
{
|
||||
return !Main.projectile.Any(n => n.active && n.owner == player.whoAmI && n.type == ModContent.ProjectileType<FishboneBoomerangProjectile>());
|
||||
}
|
||||
|
||||
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
|
||||
@@ -47,7 +59,7 @@ namespace CalamityMod.Items.Weapons.Rogue
|
||||
public override void AddRecipes()
|
||||
{
|
||||
CreateRecipe().
|
||||
AddIngredient<VictideBar>(2).
|
||||
AddIngredient<SeaRemains>(2).
|
||||
AddTile(TileID.Anvils).
|
||||
Register();
|
||||
}
|
||||
|
After Width: | Height: | Size: 765 B |
|
Before Width: | Height: | Size: 492 B |
@@ -83,7 +83,7 @@ Stealth strikes travel slower and are rapidly orbited by the smaller disks");
|
||||
public override void AddRecipes()
|
||||
{
|
||||
CreateRecipe().
|
||||
AddIngredient<SeashellBoomerang>().
|
||||
AddIngredient<FishboneBoomerang>().
|
||||
AddIngredient<Equanimity>().
|
||||
AddIngredient(ItemID.ThornChakram).
|
||||
AddIngredient<LivingShard>(8).
|
||||
|
||||
@@ -544,7 +544,7 @@ namespace CalamityMod
|
||||
|
||||
// Victide
|
||||
if (setBonus == "victide_summon" || setBonus == "victide summon")
|
||||
return mp.urchin; // the bool set directly by VictideHelmet.UpdateArmorSet
|
||||
return mp.victideSummoner; // the bool set directly by VictideHelmet.UpdateArmorSet
|
||||
else if (setBonus == "victide" || setBonus.StartsWith("victide_") || setBonus.StartsWith("victide "))
|
||||
return mp.victideSet;
|
||||
|
||||
@@ -862,7 +862,7 @@ namespace CalamityMod
|
||||
if (setBonus == "victide_summon" || setBonus == "victide summon")
|
||||
{
|
||||
mp.victideSet = enabled;
|
||||
mp.urchin = enabled; // LATER -- remove this when player.urchin actually controls victide summoner
|
||||
mp.victideSummoner = enabled;
|
||||
return true;
|
||||
}
|
||||
else if (setBonus == "victide" || setBonus.StartsWith("victide_") || setBonus.StartsWith("victide "))
|
||||
|
||||
@@ -0,0 +1,109 @@
|
||||
using System;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.NPCs
|
||||
{
|
||||
public class CalamityFallDamageNPC : GlobalNPC
|
||||
{
|
||||
/// <summary>
|
||||
/// How much "gravity damage" is this npc slated to recieve once it hits the ground.
|
||||
/// </summary>
|
||||
private int potentialEnergyDamage = 0;
|
||||
/// <summary>
|
||||
/// This keeps track of the last recorded velocity, so that we can dispel the potential fall damage if the enemy slows their fall down by any means
|
||||
/// </summary>
|
||||
private Vector2 OldVelocity = Vector2.Zero;
|
||||
/// <summary>
|
||||
/// This keeps track of the last recorded velocity, because terraria is dumb and we need two of them
|
||||
/// </summary>
|
||||
private Vector2 OlderVelocity = Vector2.Zero;
|
||||
private float terminalVelocityForFullFallDamage = 0;
|
||||
|
||||
public int PotentialEnergyDamage
|
||||
{
|
||||
get
|
||||
{
|
||||
return potentialEnergyDamage;
|
||||
}
|
||||
|
||||
private set
|
||||
{
|
||||
//You can't stack gravity damage. Higher "gravity" simply replaces the gravity damage.
|
||||
potentialEnergyDamage = value == 0 ? 0 : Math.Max(potentialEnergyDamage, value);
|
||||
}
|
||||
}
|
||||
|
||||
public bool FallDamageSusceptible => PotentialEnergyDamage > 0;
|
||||
|
||||
public override bool InstancePerEntity => true;
|
||||
|
||||
public override GlobalNPC Clone(NPC npc, NPC npcClone)
|
||||
{
|
||||
CalamityFallDamageNPC myClone = (CalamityFallDamageNPC)base.Clone(npc, npcClone);
|
||||
|
||||
myClone.potentialEnergyDamage = potentialEnergyDamage;
|
||||
myClone.OldVelocity = OldVelocity;
|
||||
myClone.OlderVelocity = OlderVelocity;
|
||||
myClone.terminalVelocityForFullFallDamage = terminalVelocityForFullFallDamage;
|
||||
|
||||
return myClone;
|
||||
}
|
||||
|
||||
public override void SetDefaults(NPC npc)
|
||||
{
|
||||
PotentialEnergyDamage = 0;
|
||||
OldVelocity = Vector2.Zero;
|
||||
OlderVelocity = Vector2.Zero;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets up a NPC to recieve fall damage when they hit the ground.
|
||||
/// </summary>
|
||||
/// <param name="npc">The npc to apply fall damage to</param>
|
||||
/// <param name="potentialDamage">The maximum fall damage taken by the npc once they hit the ground</param>
|
||||
/// <param name="terminalVelocityForFullDamage">The downwards velocity necessary to recieve the full fall damage. By default 10, the npc max fall speed</param>
|
||||
public void ApplyFallDamage(NPC npc, int potentialDamage, float terminalVelocityForFullDamage = 10f)
|
||||
{
|
||||
//NPCs that don't collide with tiles simply don't get fall damage, lol.
|
||||
if (npc.noTileCollide)
|
||||
return;
|
||||
|
||||
PotentialEnergyDamage = potentialDamage;
|
||||
OldVelocity = npc.velocity;
|
||||
OlderVelocity = npc.velocity;
|
||||
terminalVelocityForFullFallDamage = terminalVelocityForFullDamage;
|
||||
}
|
||||
|
||||
public override void PostAI(NPC npc)
|
||||
{
|
||||
if (FallDamageSusceptible)
|
||||
{
|
||||
float newVerticalVelocity = npc.velocity.Y;
|
||||
float oldVerticalVelocity = OldVelocity.Y;
|
||||
float olderVerticalVelocity = OlderVelocity.Y;
|
||||
|
||||
//If the thing flies back up, cancel the fall dmg
|
||||
if (newVerticalVelocity < 0 && oldVerticalVelocity >= 0)
|
||||
PotentialEnergyDamage = 0;
|
||||
|
||||
//Same goes for if it slows its fall.
|
||||
//We use 3 variables cuz there is a frame inbetween the fall and the landing where the velocity is still set to something.
|
||||
if (newVerticalVelocity > 0 && olderVerticalVelocity > 0 && oldVerticalVelocity < olderVerticalVelocity)
|
||||
PotentialEnergyDamage = 0;
|
||||
|
||||
//If the npc hit a tile/Came to a stop after falling
|
||||
if (newVerticalVelocity == 0 && oldVerticalVelocity > 0)
|
||||
{
|
||||
//I don't think a tile check below the npc is necessary but if we find weird edge cases ill add it
|
||||
npc.StrikeNPC((int)(PotentialEnergyDamage * Math.Clamp(olderVerticalVelocity / terminalVelocityForFullFallDamage, 0f, 1f)), 0f, 1, fromNet: true);
|
||||
PotentialEnergyDamage = 0;
|
||||
}
|
||||
|
||||
OlderVelocity = OldVelocity;
|
||||
OldVelocity = npc.velocity;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 226 B |
@@ -0,0 +1,40 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Particles
|
||||
{
|
||||
public class CuteManaStarParticle : Particle
|
||||
{
|
||||
public override string Texture => "CalamityMod/Particles/CuteStars";
|
||||
public override bool UseCustomDraw => false;
|
||||
public override bool SetLifetime => true;
|
||||
public override int FrameVariants => 2;
|
||||
|
||||
public float Opacity;
|
||||
|
||||
public CuteManaStarParticle(Vector2 position, Vector2 speed, float scale = 1f, float opacity = 1f, int lifetime = 20)
|
||||
{
|
||||
Position = position;
|
||||
Scale = scale;
|
||||
Color = Color.White;
|
||||
Opacity = opacity;
|
||||
Velocity = speed;
|
||||
Rotation = Main.rand.NextFloat(MathHelper.TwoPi);
|
||||
Lifetime = lifetime;
|
||||
Variant = Main.rand.Next(2);
|
||||
}
|
||||
|
||||
public override void Update()
|
||||
{
|
||||
Opacity *= 0.96f;
|
||||
Color = Color.White * Opacity;
|
||||
Lighting.AddLight(Position, Color.DodgerBlue.ToVector3());
|
||||
Velocity *= 0.9f;
|
||||
if (Velocity.Length() <= 0.01f)
|
||||
GeneralParticleHandler.RemoveParticle(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 328 B |
@@ -0,0 +1,55 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using static CalamityMod.CalamityUtils;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Particles
|
||||
{
|
||||
public class DirectionalPulseRing : Particle
|
||||
{
|
||||
public override string Texture => "CalamityMod/Particles/HollowCircleHardEdge";
|
||||
public override bool UseAdditiveBlend => true;
|
||||
public override bool SetLifetime => true;
|
||||
public override bool UseCustomDraw => true;
|
||||
|
||||
private float OriginalScale;
|
||||
private float FinalScale;
|
||||
private float opacity;
|
||||
private Vector2 Squish;
|
||||
private Color BaseColor;
|
||||
|
||||
public DirectionalPulseRing(Vector2 position, Vector2 velocity, Color color, Vector2 squish, float rotation, float originalScale, float finalScale, int lifeTime)
|
||||
{
|
||||
Position = position;
|
||||
Velocity = velocity;
|
||||
BaseColor = color;
|
||||
OriginalScale = originalScale;
|
||||
FinalScale = finalScale;
|
||||
Scale = originalScale;
|
||||
Lifetime = lifeTime;
|
||||
Squish = squish;
|
||||
Rotation = rotation;
|
||||
}
|
||||
|
||||
public override void Update()
|
||||
{
|
||||
float pulseProgress = PiecewiseAnimation(LifetimeCompletion, new CurveSegment[] { new CurveSegment(EasingType.PolyOut, 0f, 0f, 1f, 4) });
|
||||
Scale = MathHelper.Lerp(OriginalScale, FinalScale, pulseProgress);
|
||||
|
||||
opacity = (float)Math.Sin(MathHelper.PiOver2 + LifetimeCompletion * MathHelper.PiOver2);
|
||||
|
||||
Color = BaseColor * opacity;
|
||||
Lighting.AddLight(Position, Color.R / 255f, Color.G / 255f, Color.B / 255f);
|
||||
Velocity *= 0.95f;
|
||||
}
|
||||
|
||||
public override void CustomDraw(SpriteBatch spriteBatch)
|
||||
{
|
||||
Texture2D tex = ModContent.Request<Texture2D>(Texture).Value;
|
||||
spriteBatch.Draw(tex, Position - Main.screenPosition, null, Color * opacity, Rotation, tex.Size() / 2f, Scale * Squish, SpriteEffects.None, 0);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
|
||||
|
||||
namespace CalamityMod.Particles
|
||||
{
|
||||
//This is mostly so i can easily get it to draw over the reed blowgun.
|
||||
public class GenericBubbleParticle : Particle
|
||||
{
|
||||
public override string Texture => "CalamityMod/Particles/Bubble";
|
||||
public override bool UseHalfTransparency => true;
|
||||
public override bool SetLifetime => true;
|
||||
public override bool Important => true;
|
||||
|
||||
public GenericBubbleParticle(Vector2 position, Vector2 velocity, float scale, float rotation, int lifeTime = 50)
|
||||
{
|
||||
Position = position;
|
||||
Velocity = velocity;
|
||||
Color = Color.White;
|
||||
Scale = scale;
|
||||
Rotation = rotation;
|
||||
Lifetime = lifeTime;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Particles
|
||||
{
|
||||
public class UrchinSpikeParticle : Particle
|
||||
{
|
||||
public override string Texture => "CalamityMod/Particles/UrchinSpikes";
|
||||
public override bool UseCustomDraw => true;
|
||||
public override bool SetLifetime => true;
|
||||
public override int FrameVariants => 6;
|
||||
|
||||
public float Opacity;
|
||||
|
||||
public UrchinSpikeParticle(Vector2 position, Vector2 speed, float rotation, float scale = 1f, float opacity = 1f, int lifetime = 20)
|
||||
{
|
||||
Position = position;
|
||||
Scale = scale;
|
||||
Color = Color.White;
|
||||
Opacity = opacity;
|
||||
Velocity = speed;
|
||||
Rotation = rotation;
|
||||
Lifetime = lifetime;
|
||||
Variant = Main.rand.Next(6);
|
||||
}
|
||||
|
||||
public override void Update()
|
||||
{
|
||||
Opacity *= 0.98f;
|
||||
Color = Lighting.GetColor((int)Position.X / 16, (int)Position.Y / 16) * Opacity;
|
||||
Velocity *= 0.9f;
|
||||
if (Velocity.Length() <= 0.01f)
|
||||
GeneralParticleHandler.RemoveParticle(this);
|
||||
}
|
||||
|
||||
public override void CustomDraw(SpriteBatch spriteBatch)
|
||||
{
|
||||
Texture2D texture = GeneralParticleHandler.GetTexture(Type);
|
||||
Rectangle frame = new Rectangle(8 * Variant, 0, 6, 10);
|
||||
spriteBatch.Draw(texture, Position - Main.screenPosition, frame, Color, Rotation, frame.Size() * 0.5f, Scale, SpriteEffects.None, 0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 571 B |
@@ -2937,12 +2937,12 @@ namespace CalamityMod.Projectiles
|
||||
{
|
||||
int projectile2 = Projectile.NewProjectile(projectile.GetSource_FromThis(), spawnPos, velocity, spawnedProjectile, (int)(projectile.damage * damageMult), projectile.knockBack, projectile.owner, 0f, 0f);
|
||||
|
||||
if (projectile.type == ProjectileType<CnidarianYoyo>() || projectile.type == ProjectileType<GodsGambitYoyo>() ||
|
||||
if (projectile.type == ProjectileType<GodsGambitYoyo>() ||
|
||||
projectile.type == ProjectileType<ShimmersparkYoyo>() || projectile.type == ProjectileType<VerdantYoyo>())
|
||||
if (projectile2.WithinBounds(Main.maxProjectiles))
|
||||
Main.projectile[projectile2].Calamity().forceMelee = true;
|
||||
|
||||
if (projectile.type == ProjectileType<SeashellBoomerangProjectile>())
|
||||
if (projectile.type == ProjectileType<FishboneBoomerangProjectile>())
|
||||
if (projectile2.WithinBounds(Main.maxProjectiles))
|
||||
Main.projectile[projectile2].Calamity().forceRogue = true;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,19 @@
|
||||
using System;
|
||||
using System;
|
||||
using CalamityMod.Particles;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Magic
|
||||
{
|
||||
public class CoralSpike : ModProjectile
|
||||
{
|
||||
public ref float ChargeCompletion => ref Projectile.ai[0];
|
||||
|
||||
public static int DustPick => Main.rand.NextBool(2) ? 255 : Main.rand.NextBool() ? 282 : Main.rand.NextBool() ? 281 : 280;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Coral Spike");
|
||||
@@ -14,17 +24,51 @@ namespace CalamityMod.Projectiles.Magic
|
||||
Projectile.width = 30;
|
||||
Projectile.height = 30;
|
||||
Projectile.friendly = true;
|
||||
Projectile.aiStyle = 14;
|
||||
Projectile.penetrate = 4;
|
||||
Projectile.penetrate = 1;
|
||||
Projectile.timeLeft = 360;
|
||||
Projectile.tileCollide = true;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.DamageType = DamageClass.Magic;
|
||||
Projectile.usesLocalNPCImmunity = true;
|
||||
Projectile.localNPCHitCooldown = 10;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Projectile.velocity.X *= 0.9f;
|
||||
Projectile.velocity.Y *= 0.99f;
|
||||
Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f;
|
||||
Projectile.velocity *= 0.96f;
|
||||
Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + 1.57f;
|
||||
|
||||
if (Projectile.velocity.Length() < 2f)
|
||||
Projectile.Kill();
|
||||
|
||||
int dustOpacity = (int)(200 * (1 - ChargeCompletion));
|
||||
float dustScale = Main.rand.NextFloat(1f, 1.4f) * (0.6f + 0.4f * ChargeCompletion);
|
||||
Vector2 dustVelocity = Projectile.velocity.SafeNormalize(Vector2.Zero).RotatedByRandom(MathHelper.PiOver4 * 0.6f) * 4f + Main.rand.NextVector2Circular(4f, 4f);
|
||||
Dust dust = Dust.NewDustPerfect(Projectile.Center, DustPick, dustVelocity, Alpha: dustOpacity, Scale : dustScale);
|
||||
dust.noGravity = true;
|
||||
}
|
||||
|
||||
public override void Kill(int timeLeft)
|
||||
{
|
||||
if (timeLeft != 0)
|
||||
SoundEngine.PlaySound(SoundID.Dig with { Volume = SoundID.Dig.Volume * 0.4f}, Projectile.Center);
|
||||
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
float angle = Main.rand.NextFloat(MathHelper.TwoPi);
|
||||
|
||||
Particle spike = new UrchinSpikeParticle(Projectile.Center + angle.ToRotationVector2() * 2f, angle.ToRotationVector2() * 6f, angle + MathHelper.PiOver2, Main.rand.NextFloat(1f, 1.3f), lifetime: Main.rand.Next(10) + 25);
|
||||
GeneralParticleHandler.SpawnParticle(spike);
|
||||
}
|
||||
|
||||
int dustCount = Main.rand.Next(7);
|
||||
for (int i = 0; i < dustCount; i++)
|
||||
{
|
||||
int dustOpacity = (int)(200 * (1 - ChargeCompletion));
|
||||
float dustScale = Main.rand.NextFloat(1f, 1.4f) * (0.6f + 0.4f * ChargeCompletion);
|
||||
Dust dust = Dust.NewDustPerfect(Projectile.Center, DustPick, Main.rand.NextVector2Circular(7f, 7f), Alpha: dustOpacity, Scale: dustScale);
|
||||
dust.noGravity = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 519 B After Width: | Height: | Size: 431 B |
@@ -0,0 +1,146 @@
|
||||
using System;
|
||||
using CalamityMod.Items.Weapons.Magic;
|
||||
using CalamityMod.Particles;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
|
||||
namespace CalamityMod.Projectiles.Magic
|
||||
{
|
||||
//Holdout, but invisible. It may as well be named "CoralSpoutHandler"
|
||||
public class CoralSpoutHoldout : ModProjectile
|
||||
{
|
||||
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
|
||||
|
||||
public static float MaxCharge = 50;
|
||||
public static int ShotProjectiles = 5;
|
||||
|
||||
public ref float Charge => ref Projectile.ai[0];
|
||||
public float ChargeProgress => MathHelper.Clamp(Charge, 0, MaxCharge) / MaxCharge;
|
||||
public float FullChargeProgress => MathHelper.Clamp(Charge, 0, MaxCharge * 1.5f) / (MaxCharge * 1.5f);
|
||||
public float Spread => MathHelper.PiOver2 * (1 - (float)Math.Pow(ChargeProgress, 1.5) * 0.95f);
|
||||
|
||||
public Player Owner => Main.player[Projectile.owner];
|
||||
|
||||
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Coral Spout");
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 30;
|
||||
Projectile.height = 30;
|
||||
Projectile.friendly = true;
|
||||
Projectile.DamageType = DamageClass.Magic;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.tileCollide = false;
|
||||
}
|
||||
|
||||
public override bool? CanDamage()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public override bool ShouldUpdatePosition()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
if (Owner.channel)
|
||||
{
|
||||
Projectile.timeLeft = 2;
|
||||
Owner.itemTime = 25;
|
||||
Owner.itemAnimation = 25;
|
||||
Owner.heldProj = Projectile.whoAmI;
|
||||
}
|
||||
|
||||
float pointingRotation = (Owner.Calamity().mouseWorld - Owner.MountedCenter).ToRotation();
|
||||
Projectile.Center = Owner.MountedCenter + pointingRotation.ToRotationVector2() * 40f;
|
||||
|
||||
if (Projectile.soundDelay <= 0)
|
||||
{
|
||||
SoundEngine.PlaySound(CoralSpout.ChargeSound with { Pitch = 0.5f * ChargeProgress}, Owner.MountedCenter);
|
||||
Projectile.soundDelay = 10;
|
||||
}
|
||||
|
||||
if (Charge == (int)(MaxCharge * 1.5f) && Owner.whoAmI == Main.myPlayer)
|
||||
{
|
||||
SoundEngine.PlaySound(SoundID.MaxMana, Owner.MountedCenter);
|
||||
}
|
||||
|
||||
Charge++;
|
||||
}
|
||||
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
Main.spriteBatch.End();
|
||||
Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
|
||||
|
||||
Texture2D texture = ModContent.Request<Texture2D>("CalamityMod/Projectiles/Summon/DeathstareBeam").Value;
|
||||
|
||||
for (int i = -1; i <= 1; i += 2)
|
||||
{
|
||||
float angle = (Owner.MountedCenter - Owner.Calamity().mouseWorld).ToRotation() + (Spread / 2f) * i - MathHelper.PiOver2;
|
||||
Vector2 scale = new Vector2(0.2f, 1f) * 3f;
|
||||
Main.EntitySpriteDraw(texture, Owner.MountedCenter - Main.screenPosition, null, Color.DodgerBlue * 0.5f * (float)Math.Sqrt(ChargeProgress), angle, new Vector2(texture.Width / 2f, texture.Height), scale, 0, 0);
|
||||
}
|
||||
|
||||
Main.spriteBatch.End();
|
||||
Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void Kill(int timeLeft)
|
||||
{
|
||||
float mainAngle = (Projectile.Center - Owner.MountedCenter).ToRotation();
|
||||
|
||||
if (FullChargeProgress < 1)
|
||||
{
|
||||
SoundEngine.PlaySound(SoundID.Item167 with { Volume = SoundID.Item167.Volume * 0.4f + 0.2f * ChargeProgress }, Owner.MountedCenter);
|
||||
|
||||
|
||||
for (int i = 0; i < ShotProjectiles; i++)
|
||||
{
|
||||
float angleOffset = MathHelper.Lerp(Spread * -0.5f, Spread * 0.5f, i / (float)ShotProjectiles);
|
||||
Vector2 direction = (mainAngle + angleOffset).ToRotationVector2();
|
||||
|
||||
if (Owner.whoAmI == Main.myPlayer)
|
||||
{
|
||||
float speed = 10 + 15 * ChargeProgress;
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Owner.MountedCenter + direction * 30f, direction * speed, ModContent.ProjectileType<CoralSpike>(), Projectile.damage, Projectile.knockBack, Owner.whoAmI, ChargeProgress);
|
||||
}
|
||||
|
||||
Color pulseColor = Main.rand.NextBool() ? Color.Coral : Color.DeepSkyBlue;
|
||||
Particle pulse = new DirectionalPulseRing(Owner.MountedCenter + direction * 44f, Vector2.Zero, pulseColor, new Vector2(0.5f, 1f), direction.ToRotation(), 0.04f, 0.2f, 30);
|
||||
GeneralParticleHandler.SpawnParticle(pulse);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
SoundEngine.PlaySound(SoundID.Item42, Owner.MountedCenter);
|
||||
Vector2 direction = mainAngle.ToRotationVector2();
|
||||
|
||||
if (Owner.whoAmI == Main.myPlayer)
|
||||
{
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Owner.MountedCenter + direction * 30f, direction * 35, ModContent.ProjectileType<ManaChargedCoral>(), (int)Projectile.damage * (ShotProjectiles + 1), Projectile.knockBack, Owner.whoAmI);
|
||||
}
|
||||
|
||||
Color pulseColor = Main.rand.NextBool() ? Color.Coral : Color.DeepSkyBlue;
|
||||
Particle pulse = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, pulseColor, new Vector2(0.5f, 1f), direction.ToRotation(), 0.05f, 0.34f + Main.rand.NextFloat(0.3f), 30);
|
||||
GeneralParticleHandler.SpawnParticle(pulse);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,278 @@
|
||||
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;
|
||||
|
||||
namespace CalamityMod.Projectiles.Magic
|
||||
{
|
||||
public class ManaChargedCoral : ModProjectile
|
||||
{
|
||||
public Player Owner => Main.player[Projectile.owner];
|
||||
public static float FullMana => 180f;
|
||||
public ref float ManaCharge => ref Projectile.ai[0];
|
||||
public NPC StuckNPC => Projectile.numHits > 0 ? Main.npc[(int)Projectile.ai[1]] : null;
|
||||
public ref float DetachmentEffectsComplete => ref Projectile.localAI[0];
|
||||
public bool Stuck => (StuckNPC != null && StuckNPC.active && ManaCharge < FullMana);
|
||||
public bool HasStuck => (Projectile.numHits > 0);
|
||||
|
||||
Vector2 offsetFromStuckNPC;
|
||||
float rotationFromStuckNPC;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Mana-charged Coral");
|
||||
Main.projFrames[Projectile.type] = 3;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 30;
|
||||
Projectile.height = 30;
|
||||
Projectile.friendly = true;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.timeLeft = 360;
|
||||
Projectile.DamageType = DamageClass.Magic;
|
||||
Projectile.usesLocalNPCImmunity = true;
|
||||
Projectile.localNPCHitCooldown = 10;
|
||||
}
|
||||
|
||||
public override bool ShouldUpdatePosition()
|
||||
{
|
||||
return !Stuck;
|
||||
}
|
||||
|
||||
public override bool? CanDamage()
|
||||
{
|
||||
return Projectile.numHits == 0;
|
||||
}
|
||||
|
||||
public override bool OnTileCollide(Vector2 oldVelocity)
|
||||
{
|
||||
if (HasStuck)
|
||||
{
|
||||
Projectile.velocity.X *= 0.86f;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
if (Projectile.frame == 0)
|
||||
Projectile.frame = Main.rand.Next(3) + 1;
|
||||
|
||||
//Stay anchored to the enemy it's stuck in and emit charge particles.
|
||||
if (Stuck)
|
||||
{
|
||||
Projectile.Center = StuckNPC.Center + offsetFromStuckNPC.RotatedBy(StuckNPC.rotation) * StuckNPC.scale;
|
||||
Projectile.rotation = StuckNPC.rotation + rotationFromStuckNPC;
|
||||
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.timeLeft++;
|
||||
ManaCharge++;
|
||||
|
||||
if (Main.rand.NextBool(5))
|
||||
{
|
||||
Particle lilStar = new CuteManaStarParticle(Projectile.Center + Main.rand.NextVector2Circular(19f, 19f), Main.rand.NextVector2Circular(4f, 4f) - Vector2.UnitY * 6f * Main.rand.NextFloat(0.6f, 1.2f), Main.rand.NextFloat(0.8f, 1.8f), lifetime: Main.rand.Next(14) + 14);
|
||||
GeneralParticleHandler.SpawnParticle(lilStar);
|
||||
}
|
||||
}
|
||||
|
||||
//Act as a magnetized collectible.
|
||||
else if (HasStuck)
|
||||
{
|
||||
if (DetachmentEffectsComplete != 1f)
|
||||
{
|
||||
Projectile.tileCollide = true;
|
||||
Projectile.timeLeft = 360;
|
||||
DetachmentEffectsComplete = 1f;
|
||||
Projectile.velocity = Vector2.UnitY.RotatedByRandom(MathHelper.PiOver2) * -1 * (Main.rand.NextFloat(5f) + 5f);
|
||||
}
|
||||
|
||||
if (Projectile.velocity.X != 0)
|
||||
Projectile.rotation += 0.02f * Math.Sign(Projectile.velocity.X) * Math.Clamp(Projectile.velocity.Length(), 0f, 5f);
|
||||
|
||||
Projectile.velocity.X *= 0.987f;
|
||||
Projectile.velocity.Y += 0.8f;
|
||||
|
||||
float distanceToOwner = (Owner.Center - Projectile.Center).Length();
|
||||
if (distanceToOwner < 170f)
|
||||
{
|
||||
Projectile.timeLeft++;
|
||||
|
||||
Projectile.velocity = (Owner.Center - Projectile.Center).SafeNormalize(Vector2.Zero) * Math.Max(distanceToOwner * 0.09f, 8f);
|
||||
|
||||
if (distanceToOwner < 10f)
|
||||
Projectile.Kill();
|
||||
}
|
||||
|
||||
//particles
|
||||
|
||||
if (Main.rand.NextBool(2))
|
||||
{
|
||||
Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(15f, 15f), 45, Vector2.UnitY * -7f, Alpha: Main.rand.Next(100) + 120, Scale: Main.rand.NextFloat(1f, 2f));
|
||||
dust.noGravity = true;
|
||||
}
|
||||
|
||||
if (Main.rand.NextBool(5))
|
||||
{
|
||||
Particle lilStar = new CuteManaStarParticle(Projectile.Center + Main.rand.NextVector2Circular(19f, 19f), -Vector2.UnitY * 6f * Main.rand.NextFloat(0.6f, 1.2f), Main.rand.NextFloat(0.8f, 1.8f), lifetime: Main.rand.Next(14) + 14);
|
||||
GeneralParticleHandler.SpawnParticle(lilStar);
|
||||
}
|
||||
}
|
||||
|
||||
//the flung state.
|
||||
else
|
||||
{
|
||||
float fallSpeed = Projectile.velocity.Y;
|
||||
if (Projectile.velocity.X != 0)
|
||||
Projectile.rotation += 0.02f * Math.Sign(Projectile.velocity.X) * Math.Clamp(Projectile.velocity.Length(), 0f, 5f);
|
||||
|
||||
if (Projectile.timeLeft < 345)
|
||||
Projectile.velocity += Vector2.UnitY * 0.5f * (1 - Math.Clamp((Projectile.timeLeft - 310f) / 35f, 0f, 1f));
|
||||
|
||||
Projectile.velocity *= 0.98f;
|
||||
|
||||
if (Projectile.velocity.Y > 0)
|
||||
Projectile.velocity.Y = Math.Clamp(Projectile.velocity.Y, 0, Math.Max(18f, fallSpeed));
|
||||
|
||||
//Sharticles
|
||||
if (Main.rand.NextBool(2))
|
||||
{
|
||||
Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(15f, 15f), 15, Projectile.velocity * 0.3f, Alpha: Main.rand.Next(100) + 120, Scale: Main.rand.NextFloat(1f, 2f));
|
||||
dust.noGravity = true;
|
||||
}
|
||||
|
||||
if (Main.rand.NextBool(3))
|
||||
{
|
||||
Particle lilStar = new CuteManaStarParticle(Projectile.Center, Projectile.velocity * 0.2f + Main.rand.NextVector2Circular(5f, 5f) - Vector2.UnitY * 3f, Main.rand.NextFloat(0.8f, 1.8f), lifetime: Main.rand.Next(14) + 14);
|
||||
GeneralParticleHandler.SpawnParticle(lilStar);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
|
||||
{
|
||||
SoundEngine.PlaySound(SoundID.GlommerBounce, Projectile.Center);
|
||||
Projectile.velocity = Vector2.Zero;
|
||||
Projectile.ai[1] = target.whoAmI; //Assign the stuck npc.
|
||||
offsetFromStuckNPC = (Projectile.Center - target.Center).RotatedBy(-target.rotation) / target.scale;
|
||||
rotationFromStuckNPC = Projectile.rotation - target.rotation;
|
||||
}
|
||||
|
||||
public override void Kill(int timeLeft)
|
||||
{
|
||||
if ((Owner.Center - Projectile.Center).Length() < 10f && HasStuck)
|
||||
{
|
||||
SoundEngine.PlaySound(SoundID.Item28 with { Volume = SoundID.Item28.Volume * 0.8f }, Projectile.Center);
|
||||
|
||||
//To reach full mana, it needs to have stayed at least half the time needed. If you just one shot an enemy with it, you'll only get 10 mana
|
||||
int manaGained = Math.Max(10, (int)Math.Floor(100 * Math.Clamp(ManaCharge * 2f / FullMana, 0f, 1f)));
|
||||
Owner.statMana += manaGained;
|
||||
if (Main.myPlayer == Owner.whoAmI)
|
||||
Owner.ManaEffect(manaGained);
|
||||
|
||||
if (Owner.statMana > Owner.statManaMax2)
|
||||
Owner.statMana = Owner.statManaMax2;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
//don't play the thuk sound & do the particles if it dies of natural causes
|
||||
if (timeLeft != 0)
|
||||
{
|
||||
SoundEngine.PlaySound(SoundID.Item171, Projectile.Center);
|
||||
|
||||
//Particles, with extra ones if it crashed chargeless
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
float angle = Main.rand.NextFloat(MathHelper.TwoPi);
|
||||
|
||||
Particle spike = new UrchinSpikeParticle(Projectile.Center + angle.ToRotationVector2() * 2f, angle.ToRotationVector2() * 6f, angle + MathHelper.PiOver2, Main.rand.NextFloat(1f, 1.3f), lifetime: Main.rand.Next(10) + 25);
|
||||
GeneralParticleHandler.SpawnParticle(spike);
|
||||
}
|
||||
|
||||
int dustCount = Main.rand.Next(7);
|
||||
for (int i = 0; i < dustCount; i++)
|
||||
{
|
||||
int dustOpacity = (int)(200 * Main.rand.NextFloat(0.5f, 1f));
|
||||
float dustScale = Main.rand.NextFloat(1f, 1.4f);
|
||||
int dustType = CoralSpike.DustPick; //Epic reuse of static method babey
|
||||
Vector2 dustVelocity = (dustType == 255 ? 1 : -1) * Projectile.velocity.RotatedByRandom(MathHelper.PiOver4) * 0.6f + Main.rand.NextVector2Circular(7f, 7f);
|
||||
|
||||
Dust dust = Dust.NewDustPerfect(Projectile.Center, dustType, dustVelocity, Alpha: dustOpacity, Scale: dustScale);
|
||||
dust.noGravity = true;
|
||||
}
|
||||
|
||||
int goreNumber = Main.rand.Next(4);
|
||||
|
||||
for (int i = 0; i < goreNumber; i++)
|
||||
{
|
||||
int goreID = Main.rand.NextBool() ? 266 : Main.rand.NextBool() ? 971 : 972;
|
||||
Gore bone = Gore.NewGorePerfect(Projectile.GetSource_FromAI(), Projectile.position, Projectile.velocity * -0.2f + Main.rand.NextVector2Circular(5f, 5f), goreID);
|
||||
bone.scale = Main.rand.NextFloat(0.6f, 1f) * (goreID == 972 ? 0.7f : 1f); //Shrink the larger bones
|
||||
bone.type = goreID; //Gotta do that or else itll spawn gores from the general pool :(
|
||||
}
|
||||
}
|
||||
|
||||
else if (HasStuck)
|
||||
{
|
||||
for (int i = 0; i < 14; i++)
|
||||
{
|
||||
Vector2 direction = Main.rand.NextVector2Circular(10f, 10f);
|
||||
Dust dust = Dust.NewDustPerfect(Projectile.Center + direction, 45, direction + Vector2.UnitY * -7f, Alpha: Main.rand.Next(100) + 120, Scale: Main.rand.NextFloat(1f, 2f));
|
||||
dust.noGravity = true;
|
||||
}
|
||||
|
||||
SoundEngine.PlaySound(SoundID.Item29 with { Volume = SoundID.Item29.Volume * 0.4f, Pitch = -0.3f }, Projectile.Center);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
Texture2D texture = ModContent.Request<Texture2D>(Texture).Value;
|
||||
Vector2 position = Projectile.Center - Main.screenPosition;
|
||||
int variant = (int)(Projectile.frame - 1);
|
||||
Rectangle frame = new Rectangle(0, 26 * variant, 24, 24);
|
||||
float scale = 1.3f;
|
||||
|
||||
Main.EntitySpriteDraw(texture, position, frame, lightColor, Projectile.rotation, frame.Size() / 2f, scale, 0, 0);
|
||||
|
||||
if (Stuck || HasStuck)
|
||||
{
|
||||
Main.spriteBatch.End();
|
||||
Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
|
||||
|
||||
Texture2D bloomTex = ModContent.Request<Texture2D>("CalamityMod/Particles/BloomCircle").Value;
|
||||
float bloomSize = (float)Math.Sin(Main.GlobalTimeWrappedHourly * 3f) * 0.1f + 0.4f;
|
||||
|
||||
float period = (int)(FullMana / 4f);
|
||||
|
||||
float pulseProgress = Main.GlobalTimeWrappedHourly % period / period;
|
||||
|
||||
if (Stuck)
|
||||
{
|
||||
pulseProgress = (ManaCharge % period) / period;
|
||||
}
|
||||
|
||||
float overimageSize = scale + (float)Math.Sqrt(pulseProgress) * 0.4f;
|
||||
float overimageOpacity = (float)Math.Sin(pulseProgress * MathHelper.PiOver2 + MathHelper.PiOver2) * 0.7f;
|
||||
|
||||
Main.EntitySpriteDraw(bloomTex, position, null, Color.DodgerBlue * 0.3f, 0, bloomTex.Size() / 2f, bloomSize, 0, 0);
|
||||
|
||||
Main.EntitySpriteDraw(texture, position, frame, Color.DodgerBlue * overimageOpacity, Projectile.rotation, frame.Size() / 2f, overimageSize, 0, 0);
|
||||
|
||||
Main.spriteBatch.End();
|
||||
Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 1.3 KiB |
@@ -0,0 +1,330 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using CalamityMod.Particles;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using static CalamityMod.CalamityUtils;
|
||||
using static Terraria.ModLoader.ModContent;
|
||||
|
||||
namespace CalamityMod.Projectiles.Melee
|
||||
{
|
||||
public class VerletSimulatedSegment
|
||||
{
|
||||
public Vector2 position, oldPosition;
|
||||
public bool locked;
|
||||
|
||||
public VerletSimulatedSegment(Vector2 _position, bool _locked = false)
|
||||
{
|
||||
position = _position;
|
||||
oldPosition = _position;
|
||||
locked = _locked;
|
||||
}
|
||||
}
|
||||
|
||||
public class CnidarianJellyfishOnTheString : ModProjectile
|
||||
{
|
||||
public const int SegmentCount = 10;
|
||||
public const float SegmentDistance = 20;
|
||||
public static int FadeoutTime = 20;
|
||||
public static int ElectrifyTimer = 180;
|
||||
public static float ZapDamageMultiplier = 0.75f;
|
||||
|
||||
//Sounds
|
||||
public static readonly SoundStyle ZapSound = SoundID.Item94 with { Volume = SoundID.Item94.Volume * 0.5f };
|
||||
public static readonly SoundStyle SlapSound = new("CalamityMod/Sounds/Custom/WetSlap", 4);
|
||||
|
||||
internal PrimitiveTrail TrailRenderer;
|
||||
|
||||
public List<VerletSimulatedSegment> Segments;
|
||||
public Player Owner => Main.player[Projectile.owner];
|
||||
public ref float Initialized => ref Projectile.ai[0];
|
||||
public ref float Timer => ref Projectile.ai[1];
|
||||
public Vector2 CnidarianPos => Segments[SegmentCount - 1].position;
|
||||
public float TotalChainLength => (SegmentCount - 1) * SegmentCount;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Cnidarian");
|
||||
ProjectileID.Sets.YoyosLifeTimeMultiplier[Projectile.type] = 7f;
|
||||
ProjectileID.Sets.YoyosMaximumRange[Projectile.type] = 240f;
|
||||
ProjectileID.Sets.YoyosTopSpeed[Projectile.type] = 11f;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.aiStyle = -1;
|
||||
Projectile.width = 28;
|
||||
Projectile.height = 28;
|
||||
Projectile.scale = 1.15f;
|
||||
Projectile.friendly = true;
|
||||
Projectile.DamageType = DamageClass.Melee;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.MaxUpdates = 2;
|
||||
Projectile.usesLocalNPCImmunity = true;
|
||||
Projectile.localNPCHitCooldown = 20;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.tileCollide = false;
|
||||
}
|
||||
|
||||
public void SetOrigin(Vector2 position)
|
||||
{
|
||||
Projectile.Center = position;
|
||||
if ((Projectile.Center - Owner.Center).Length() > 380f)
|
||||
Projectile.Center = Owner.Center + (Projectile.Center - Owner.Center).SafeNormalize(Vector2.One) * 380f;
|
||||
}
|
||||
|
||||
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox)
|
||||
{
|
||||
return Collision.CheckAABBvAABBCollision(targetHitbox.TopLeft(), targetHitbox.Size(), CnidarianPos - Projectile.Hitbox.Size() / 2f, Projectile.Hitbox.Size());
|
||||
}
|
||||
|
||||
public override bool? CanCutTiles()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
//Initialize the segments
|
||||
SetOrigin(Owner.Calamity().mouseWorld);
|
||||
|
||||
Segments = new List<VerletSimulatedSegment>(SegmentCount);
|
||||
for (int i = 0; i < SegmentCount; i++)
|
||||
{
|
||||
VerletSimulatedSegment segment = new VerletSimulatedSegment(Projectile.Center + Vector2.UnitY * SegmentDistance * i);
|
||||
Segments.Add(segment);
|
||||
}
|
||||
|
||||
Segments[0].locked = true;
|
||||
|
||||
int j = 0;
|
||||
foreach (VerletSimulatedSegment segment in Segments)
|
||||
{
|
||||
CritSpark particle = new CritSpark(segment.position, Vector2.UnitY * (-1f * j / (float)SegmentCount), Color.White, Color.Cyan, 1f, 10);
|
||||
GeneralParticleHandler.SpawnParticle(particle);
|
||||
j++;
|
||||
}
|
||||
|
||||
|
||||
Initialized = 1f;
|
||||
return;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Projectile.velocity = Vector2.Zero;
|
||||
|
||||
if (Initialized == 0f)
|
||||
Initialize();
|
||||
|
||||
if (Owner.channel)
|
||||
Projectile.timeLeft = FadeoutTime;
|
||||
|
||||
SetOrigin(Projectile.Center.MoveTowards(Owner.Calamity().mouseWorld, 10f));
|
||||
|
||||
SimulateSegments();
|
||||
|
||||
Electrify(3, 300f);
|
||||
|
||||
|
||||
if ((Projectile.Center - Owner.Center).Length() > 3200f) //200 blocks
|
||||
Projectile.Kill();
|
||||
|
||||
Timer++;
|
||||
}
|
||||
|
||||
public void Electrify(int maxTargets, float targettingDistance)
|
||||
{
|
||||
//The volt bunnys gores could be nice to look at, but may be too much for this. Maybe for a future ghost bell upgrade?
|
||||
|
||||
float timeAfterZap = MathHelper.Clamp(20 - (Timer - 20f) % ElectrifyTimer, 0, 20);
|
||||
float postZapTime = 1 - timeAfterZap / 20f;
|
||||
|
||||
Lighting.AddLight(CnidarianPos, Color.DeepSkyBlue.ToVector3() * (1 - postZapTime));
|
||||
|
||||
if (Timer % ElectrifyTimer == ElectrifyTimer - 1)
|
||||
{
|
||||
|
||||
SoundEngine.PlaySound(ZapSound, CnidarianPos);
|
||||
int maxDust = 2 + Main.rand.Next(3);
|
||||
for (int i = 0; i < maxDust; i++)
|
||||
{
|
||||
Dust.NewDustDirect(Projectile.Center, 0, 0, 226, -3f + Main.rand.NextFloat(0, 6f), -5f, Scale: Main.rand.NextFloat(0.2f, 1f));
|
||||
|
||||
Dust.NewDustDirect(CnidarianPos, 0, 0, 226, -4f + Main.rand.NextFloat(0, 8f), -3f, Scale: Main.rand.NextFloat(0.2f, 1f));
|
||||
}
|
||||
|
||||
int[] targetArray = new int[maxTargets];
|
||||
int targetsAquired = 0;
|
||||
|
||||
for (int i = 0; i < Main.maxNPCs; i++)
|
||||
{
|
||||
if (targetsAquired == maxTargets)
|
||||
break;
|
||||
|
||||
if (Main.npc[i].CanBeChasedBy(Projectile))
|
||||
{
|
||||
if ((CnidarianPos - Main.npc[i].Center).Length() < targettingDistance)
|
||||
{
|
||||
targetArray[targetsAquired] = i;
|
||||
targetsAquired++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If there is anything to actually shoot at, pick targets at random and fire.
|
||||
if (targetsAquired > 0)
|
||||
{
|
||||
Vector2 velocity;
|
||||
|
||||
for (int i = 0; i < targetsAquired; i++)
|
||||
{
|
||||
velocity = (Main.npc[targetArray[i]].Center - CnidarianPos).SafeNormalize(Vector2.Zero) * 10f;
|
||||
|
||||
for (int j = 0; j < 3; j++)
|
||||
{
|
||||
Color bloomColor = Main.rand.NextBool() ? (Main.rand.NextBool() ? Color.Gold : Color.Cyan) : Color.SpringGreen;
|
||||
ElectricSpark spark = new ElectricSpark(CnidarianPos, velocity.RotatedByRandom(MathHelper.PiOver2) * Main.rand.NextFloat(0.2f, 1.3f), Color.Gold, bloomColor, 0.5f + Main.rand.NextFloat(0.5f), 30, bloomScale: 2) ;
|
||||
GeneralParticleHandler.SpawnParticle(spark);
|
||||
}
|
||||
|
||||
if (Projectile.owner == Main.myPlayer)
|
||||
{
|
||||
Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), CnidarianPos, velocity, ProjectileType<CnidarianSpark>(), (int)(Projectile.damage * ZapDamageMultiplier), Projectile.knockBack, Projectile.owner, targetArray[i], 0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void SimulateSegments()
|
||||
{
|
||||
Segments[0].oldPosition = Segments[0].position;
|
||||
Segments[0].position = Projectile.Center;
|
||||
|
||||
//https://youtu.be/PGk0rnyTa1U?t=400 we use verlet integration chains here
|
||||
foreach (VerletSimulatedSegment segment in Segments)
|
||||
{
|
||||
if (!segment.locked)
|
||||
{
|
||||
Vector2 positionBeforeUpdate = segment.position;
|
||||
|
||||
segment.position += (segment.position - segment.oldPosition); // This adds conservation of energy to the segments. This makes it super bouncy and shouldnt be used but it's really funny
|
||||
segment.position += Vector2.UnitY * 0.3f; //=> This adds gravity to the segments.
|
||||
|
||||
segment.oldPosition = positionBeforeUpdate;
|
||||
}
|
||||
}
|
||||
|
||||
for (int k = 0; k < 10; k++)
|
||||
{
|
||||
for (int j = 0; j < SegmentCount - 1; j++)
|
||||
{
|
||||
VerletSimulatedSegment pointA = Segments[j];
|
||||
VerletSimulatedSegment pointB = Segments[j + 1];
|
||||
Vector2 segmentCenter = (pointA.position + pointB.position) / 2f;
|
||||
Vector2 segmentDirection = Utils.SafeNormalize(pointA.position - pointB.position, Vector2.UnitY);
|
||||
|
||||
if (!pointA.locked)
|
||||
pointA.position = segmentCenter + segmentDirection * SegmentDistance / 2f;
|
||||
|
||||
if (!pointB.locked)
|
||||
pointB.position = segmentCenter - segmentDirection * SegmentDistance / 2f;
|
||||
|
||||
Segments[j] = pointA;
|
||||
Segments[j + 1] = pointB;
|
||||
}
|
||||
}
|
||||
|
||||
Projectile.netUpdate = true;
|
||||
Projectile.netSpam = 0;
|
||||
}
|
||||
|
||||
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
|
||||
{
|
||||
//Play a wet slap sound if you hit an enemy fast enough
|
||||
float centrifugalForce = Math.Clamp((Segments[SegmentCount - 1].position - Segments[SegmentCount - 1].oldPosition).Length() * 2f, 0f, 130f) / 130f;
|
||||
if (centrifugalForce > 0.2f)
|
||||
SoundEngine.PlaySound(SlapSound with { Volume = SlapSound.Volume * centrifugalForce + 0.8f}, target.position);
|
||||
|
||||
}
|
||||
|
||||
//Squish animation keys
|
||||
public CurveSegment anticipation = new CurveSegment(EasingType.PolyInOut, 0f, 1f, 0.35f, 3);
|
||||
public CurveSegment contraction = new CurveSegment(EasingType.PolyOut, 0.5f, 1.35f, -0.85f, 5);
|
||||
public CurveSegment retract = new CurveSegment(EasingType.SineInOut, 0.7f, 0.5f, 0.5f);
|
||||
internal float StretchRatio() => PiecewiseAnimation(MathHelper.Clamp((Timer + 45) % ElectrifyTimer, 0, 80) / 80f, new CurveSegment[] { anticipation, contraction, retract });
|
||||
|
||||
public float PrimWidthFunction(float completionRatio)
|
||||
{
|
||||
return 1.6f;
|
||||
}
|
||||
|
||||
public Color PrimColorFunction(float completionRatio)
|
||||
{
|
||||
float timeAfterZap = MathHelper.Clamp( 20 - (Timer - 5 - completionRatio * 12f) % ElectrifyTimer, 0, 20);
|
||||
float postZapTime = 1 - timeAfterZap / 20f;
|
||||
|
||||
Color startingColor = Color.Lerp(Color.Cyan, Color.Maroon, (float)Math.Pow(postZapTime, 2f)) * (Projectile.timeLeft / (float)FadeoutTime);
|
||||
Color endColor = Color.DarkCyan * 0f;
|
||||
return Color.Lerp(endColor, startingColor, (float)Math.Pow(completionRatio, 1.5D)) * 0.7f;
|
||||
}
|
||||
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
if (TrailRenderer is null)
|
||||
TrailRenderer = new PrimitiveTrail(PrimWidthFunction, PrimColorFunction);
|
||||
|
||||
Vector2[] segmentPositions = Segments.Select(x => x.position).ToArray();
|
||||
|
||||
TrailRenderer.Draw(segmentPositions, -Main.screenPosition, 66);
|
||||
|
||||
|
||||
Texture2D tex = Request<Texture2D>(Texture).Value;
|
||||
|
||||
Vector2 squish = new Vector2(2 - StretchRatio(), StretchRatio());
|
||||
|
||||
float centrifugalForce = Math.Clamp((Segments[SegmentCount - 1].position - Segments[SegmentCount - 1].oldPosition).Length() * 2f - 10f, 0f, 130f) / 150f;
|
||||
Vector2 centrifugalSquish = new Vector2(1 - centrifugalForce * 0.66f, 1 + centrifugalForce * 2.2f);
|
||||
squish *= centrifugalSquish;
|
||||
|
||||
float rotation = (Segments[SegmentCount - 1].position - Segments[SegmentCount - 2].position).ToRotation() - MathHelper.PiOver2;
|
||||
lightColor = Lighting.GetColor((int)CnidarianPos.X / 16, (int)CnidarianPos.Y / 16);
|
||||
|
||||
|
||||
Main.EntitySpriteDraw(tex, Segments[SegmentCount - 1].position - Main.screenPosition, null, Projectile.GetAlpha(lightColor) * (Projectile.timeLeft / (float)FadeoutTime), rotation, tex.Size() / 2f, Projectile.scale * squish, SpriteEffects.None, 0);
|
||||
|
||||
//Add a blue glowing overlay quickly following a zap
|
||||
float timeAfterZap = MathHelper.Clamp(20 - (Timer - 15f) % ElectrifyTimer, 0, 20);
|
||||
float postZapTime = 1 - timeAfterZap / 20f;
|
||||
|
||||
if (postZapTime < 1)
|
||||
{
|
||||
Main.spriteBatch.End();
|
||||
Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
|
||||
|
||||
Main.EntitySpriteDraw(tex, Segments[SegmentCount - 1].position - Main.screenPosition, null, Color.DeepSkyBlue * (1 - postZapTime), rotation, tex.Size() / 2f, (Projectile.scale + postZapTime * 1.4f) * squish, 0f, 0);
|
||||
|
||||
Main.spriteBatch.End();
|
||||
Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void SendExtraAI(BinaryWriter writer)
|
||||
{
|
||||
writer.WriteVector2(Segments[SegmentCount - 1].position);
|
||||
}
|
||||
|
||||
public override void ReceiveExtraAI(BinaryReader reader)
|
||||
{
|
||||
Segments[SegmentCount - 1].position = reader.ReadVector2();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 533 B |
@@ -0,0 +1,69 @@
|
||||
using CalamityMod.Particles;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Melee
|
||||
{
|
||||
public class CnidarianSpark : ModProjectile
|
||||
{
|
||||
public ref float Target => ref Projectile.ai[0];
|
||||
public Vector2 initialVelocity;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Spark");
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 6;
|
||||
Projectile.height = 6;
|
||||
Projectile.friendly = true;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.DamageType = DamageClass.Melee;
|
||||
Projectile.penetrate = 1;
|
||||
Projectile.timeLeft = 15;
|
||||
}
|
||||
|
||||
|
||||
public override bool? CanHitNPC(NPC target)
|
||||
{
|
||||
if (Main.npc[(int)Target] != target)
|
||||
return false;
|
||||
|
||||
return base.CanHitNPC(target);
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
if (Projectile.velocity != Vector2.Zero)
|
||||
initialVelocity = Projectile.velocity;
|
||||
|
||||
Projectile.velocity = Vector2.Zero;
|
||||
|
||||
if (Main.npc[(int)Target] != null)
|
||||
{
|
||||
Projectile.Center = Vector2.Lerp(Projectile.Center, Main.npc[(int)Target].Center, 0.4f);
|
||||
Projectile.rotation = (Projectile.Center - Main.npc[(int)Target].Center).ToRotation() - MathHelper.PiOver2;
|
||||
}
|
||||
|
||||
Color bloomColor = Main.rand.NextBool() ? (Main.rand.NextBool() ? Color.Gold : Color.Cyan) : Color.SpringGreen;
|
||||
CritSpark particle = new CritSpark(Projectile.Center, (Projectile.rotation + MathHelper.PiOver2).ToRotationVector2() * 4f, Color.LightSkyBlue, bloomColor, 0.8f, 10, bloomScale: 2f);
|
||||
GeneralParticleHandler.SpawnParticle(particle);
|
||||
}
|
||||
|
||||
public override void Kill(int timeLeft)
|
||||
{
|
||||
SoundEngine.PlaySound(CnidarianJellyfishOnTheString.ZapSound, Projectile.Center);
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
Color bloomColor = Main.rand.NextBool() ? (Main.rand.NextBool() ? Color.Gold : Color.Cyan) : Color.SpringGreen;
|
||||
CritSpark particle = new CritSpark(Projectile.Center, initialVelocity * i, Color.LightSkyBlue, bloomColor, 0.8f, 10, bloomScale: 2f);
|
||||
GeneralParticleHandler.SpawnParticle(particle);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 198 B |
|
After Width: | Height: | Size: 264 B |
@@ -1,90 +1,76 @@
|
||||
using System;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using Terraria.Audio;
|
||||
|
||||
namespace CalamityMod.Projectiles.Melee
|
||||
{
|
||||
public class RedtideWhirlpool : ModProjectile
|
||||
{
|
||||
public override string Texture => "CalamityMod/Projectiles/Melee/BrinyTyphoonBubble";
|
||||
public Player Owner => Main.player[Projectile.owner];
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Whirlpool");
|
||||
Main.projFrames[Projectile.type] = 3;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 60;
|
||||
Projectile.height = 60;
|
||||
Projectile.scale = 0.5f;
|
||||
Projectile.friendly = true;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.penetrate = 2;
|
||||
Projectile.DamageType = DamageClass.Melee;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.timeLeft = 40;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Lighting.AddLight(Projectile.Center, 0f, 0f, Projectile.scale * 1.5f);
|
||||
int num626 = 6;
|
||||
for (int num627 = 0; num627 < num626; num627++)
|
||||
Projectile.velocity *= 0.97f;
|
||||
Projectile.rotation += MathHelper.PiOver4 / 2.4f * Math.Sign(Projectile.velocity.X);
|
||||
|
||||
int dustCount = Main.rand.Next(4);
|
||||
float offset = Main.rand.NextFloat(MathHelper.TwoPi);
|
||||
for (int i = 0; i < dustCount; i++)
|
||||
{
|
||||
Vector2 vector45 = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f;
|
||||
vector45 = vector45.RotatedBy((double)(num627 - (num626 / 2 - 1)) * 3.1415926535897931 / (double)(float)num626, default) + Projectile.Center;
|
||||
Vector2 value15 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8);
|
||||
int num628 = Dust.NewDust(vector45 + value15, 0, 0, 172, value15.X * 2f, value15.Y * 2f, 100, default, Projectile.scale);
|
||||
Main.dust[num628].noGravity = true;
|
||||
Main.dust[num628].noLight = true;
|
||||
Main.dust[num628].velocity /= 4f;
|
||||
Main.dust[num628].velocity -= Projectile.velocity;
|
||||
float angle = i / (float)dustCount * MathHelper.TwoPi + offset;
|
||||
Vector2 dustPos = Projectile.Center + angle.ToRotationVector2() * 46f;
|
||||
Dust dust = Dust.NewDustPerfect(dustPos, 176, (angle - MathHelper.PiOver2 * Math.Sign(Projectile.velocity.X)).ToRotationVector2() * 8f + Projectile.velocity, Scale: Main.rand.NextFloat(1.6f, 3f));
|
||||
dust.noGravity = true;
|
||||
}
|
||||
if (Projectile.scale <= 1f)
|
||||
{
|
||||
Projectile.scale *= 1.015f;
|
||||
}
|
||||
if (Projectile.scale >= 1f)
|
||||
{
|
||||
Projectile.Kill();
|
||||
}
|
||||
Projectile.frameCounter++;
|
||||
if (Projectile.frameCounter > 3)
|
||||
{
|
||||
Projectile.frame++;
|
||||
Projectile.frameCounter = 0;
|
||||
}
|
||||
if (Projectile.frame >= 3)
|
||||
{
|
||||
Projectile.frame = 0;
|
||||
}
|
||||
Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2;
|
||||
}
|
||||
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
Texture2D texture2D13 = ModContent.Request<Texture2D>(Texture).Value;
|
||||
int num214 = ModContent.Request<Texture2D>(Texture).Value.Height / Main.projFrames[Projectile.type];
|
||||
int y6 = num214 * Projectile.frame;
|
||||
Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), Projectile.scale, SpriteEffects.None, 0);
|
||||
Texture2D texture = ModContent.Request<Texture2D>(Texture).Value;
|
||||
|
||||
SpriteEffects flip = Math.Sign(Projectile.velocity.X) < 0? SpriteEffects.None : SpriteEffects.FlipHorizontally;
|
||||
|
||||
Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, null, lightColor * 0.3f, Projectile.rotation * 1.2f, texture.Size() / 2f, 1.5f, flip, 0);
|
||||
Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, null, lightColor * 0.4f, Projectile.rotation, texture.Size() / 2f, 2f, flip, 0);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void Kill(int timeLeft)
|
||||
{
|
||||
SoundEngine.PlaySound(SoundID.NPCDeath19, Projectile.position);
|
||||
int num226 = 36;
|
||||
for (int num227 = 0; num227 < num226; num227++)
|
||||
|
||||
int dustCount = 36;
|
||||
for (int i = 0; i < dustCount; i++)
|
||||
{
|
||||
Vector2 vector6 = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f;
|
||||
vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + Projectile.Center;
|
||||
Vector2 vector7 = vector6 - Projectile.Center;
|
||||
int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 172, vector7.X * 2f, vector7.Y * 2f, 100, default, 1.4f);
|
||||
Main.dust[num228].noGravity = true;
|
||||
Main.dust[num228].noLight = true;
|
||||
Main.dust[num228].velocity = vector7;
|
||||
Vector2 offset = Vector2.Normalize(Projectile.velocity) * new Vector2(Projectile.width / 2f, Projectile.height) * 0.75f;
|
||||
offset = offset.RotatedBy(((i - (dustCount / 2 - 1)) * MathHelper.TwoPi / (float)dustCount), default) + Projectile.Center;
|
||||
Vector2 dustDirection = offset - Projectile.Center;
|
||||
Dust dust = Dust.NewDustPerfect(offset + dustDirection, 172, Vector2.Zero, 100, default, 1.4f);
|
||||
dust.noGravity = true;
|
||||
dust.noLight = true;
|
||||
dust.velocity = dustDirection;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
After Width: | Height: | Size: 1.9 KiB |
@@ -0,0 +1,340 @@
|
||||
using System;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using ReLogic.Utilities;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using static CalamityMod.CalamityUtils;
|
||||
|
||||
namespace CalamityMod.Projectiles.Melee.Spears
|
||||
{
|
||||
public class RedtideSpearProjectile : ModProjectile
|
||||
{
|
||||
public Player Owner => Main.player[Projectile.owner];
|
||||
public static int Lifetime = 28;
|
||||
public int Timer => Lifetime - Projectile.timeLeft;
|
||||
|
||||
private SlotId ChargeWindSoundSlot;
|
||||
public ActiveSound ChargeWindSound
|
||||
{
|
||||
get
|
||||
{
|
||||
ActiveSound sound;
|
||||
if (SoundEngine.TryGetActiveSound(ChargeWindSoundSlot, out sound))
|
||||
return sound;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public int ChargeDirection => Math.Sign(Projectile.velocity.X);
|
||||
|
||||
#region Thrust
|
||||
//Basic animation variables.
|
||||
public float ThrustProgress => Timer / (float)Lifetime;
|
||||
public float BaseRotation => Projectile.velocity.ToRotation();
|
||||
public float ThrustRotation => BaseRotation + Owner.direction * RotationShift;
|
||||
|
||||
//Thrust animation keys
|
||||
public CurveSegment thrust = new CurveSegment(EasingType.PolyIn, 0f, 0.15f, 0.85f, 3);
|
||||
public CurveSegment hold = new CurveSegment(EasingType.SineBump, 0.3f, 1f, 0.2f);
|
||||
public CurveSegment retract = new CurveSegment(EasingType.PolyOut, 0.7f, 1f, -1f, 2);
|
||||
public CurveSegment correct = new CurveSegment(EasingType.PolyIn, 0.85f, 0f, 0.17f);
|
||||
internal float Displacement => PiecewiseAnimation(ThrustProgress, new CurveSegment[] { thrust, hold, retract, correct });
|
||||
|
||||
internal const float startRotation = MathHelper.PiOver4 * 0.1f;
|
||||
internal const float downwardsRotation = MathHelper.PiOver4 * 0.15f;
|
||||
internal const float upwardsRotation = MathHelper.PiOver4 * -0.44f;
|
||||
internal const float loweredTime = 0.25f;
|
||||
|
||||
public CurveSegment downwards = new CurveSegment(EasingType.SineOut, 0f, startRotation, downwardsRotation, 2);
|
||||
public CurveSegment raiseback = new CurveSegment(EasingType.SineIn, loweredTime, startRotation + downwardsRotation, upwardsRotation);
|
||||
public CurveSegment stayUp = new CurveSegment(EasingType.Linear, 0.8f, startRotation + downwardsRotation + upwardsRotation, 0f);
|
||||
internal float RotationShift => PiecewiseAnimation(ThrustProgress, new CurveSegment[] { downwards, raiseback, stayUp });
|
||||
public int InitializationTime => (int)(loweredTime * Lifetime);
|
||||
#endregion
|
||||
|
||||
#region Drag along the ground
|
||||
|
||||
|
||||
public static int MaxRunTime = 300;
|
||||
//Player can only do the run attack while moving fast horizontally in the direction of the thrust, but remaining on the ground
|
||||
public bool CanRunAttack => Math.Abs(Owner.velocity.Y) <= 0.8f && Math.Abs(Owner.velocity.X) >= Owner.maxRunSpeed * 0.7f && Math.Sign(Owner.velocity.X) == ChargeDirection && Owner.channel && !RunBroken;
|
||||
//You can only start a run attack if you meet the other conditions, but ALSO you can't do it if you are aiming too much upwards or downwards
|
||||
public bool CanStartRunAttack => CanRunAttack && Math.Abs(Owner.Calamity().mouseWorld.Y - Owner.MountedCenter.Y) <= 300;
|
||||
public ref float RunTimer => ref Projectile.ai[0];
|
||||
//The window of time during which the run hasn't fully started, and is indentical to the regular thrust's start. This tells us when we can no longer do this switch.
|
||||
public bool FullyRunning => RunTimer > InitializationTime;
|
||||
|
||||
//Basically tracks if the run has been broken, either because the player did not try to run at all, stopped running, or ran for too long.
|
||||
public bool RunBroken
|
||||
{
|
||||
get => Projectile.ai[1] > 0f;
|
||||
set { Projectile.ai[1] = value ? 1f : 0f; }
|
||||
}
|
||||
|
||||
public static int UpThrustLifetime = 20;
|
||||
public int UpThrustTimer => UpThrustLifetime - Projectile.timeLeft;
|
||||
public float UpThrustProgress => UpThrustTimer / (float)UpThrustLifetime;
|
||||
|
||||
//Gets the ideal rotation for the spear while running. Basically, slightly angled downwards towards the ground, to the left or right of the player depending on the direction
|
||||
public float IdealSpearRotationForRun
|
||||
{
|
||||
get
|
||||
{
|
||||
float rotation = MathHelper.PiOver4 * 0.12f;
|
||||
|
||||
if (ChargeDirection > 0)
|
||||
return rotation;
|
||||
|
||||
//Mirror the angle if facing left.
|
||||
return MathHelper.Pi - rotation - MathHelper.TwoPi;
|
||||
}
|
||||
}
|
||||
|
||||
//Properly wrap the angle. Indeed, the angles on the left suddenly go from Pi to -Pi
|
||||
public float ProjectileRotationButWrappedForTransition
|
||||
{
|
||||
get
|
||||
{
|
||||
if (ChargeDirection < 0 && Projectile.rotation > 0)
|
||||
return Projectile.rotation - MathHelper.TwoPi;
|
||||
|
||||
return Projectile.rotation;
|
||||
}
|
||||
}
|
||||
|
||||
public CurveSegment transitionSegment => new CurveSegment(EasingType.PolyInOut, 0f, ProjectileRotationButWrappedForTransition, IdealSpearRotationForRun - ProjectileRotationButWrappedForTransition, 2);
|
||||
internal float RunAttackRotation => PiecewiseAnimation(Math.Clamp(RunTimer / 30f, 0f, 1f), new CurveSegment[] { transitionSegment });
|
||||
|
||||
|
||||
public CurveSegment anticipationDown => new CurveSegment(EasingType.SineIn, 0f, IdealSpearRotationForRun, ChargeDirection * MathHelper.PiOver4 * 0.1f, 2);
|
||||
public CurveSegment upthrust => new CurveSegment(EasingType.SineOut, 0.4f, IdealSpearRotationForRun + ChargeDirection * MathHelper.PiOver4 * 0.1f, ChargeDirection * MathHelper.PiOver2 * -0.75f);
|
||||
public CurveSegment holdup => new CurveSegment(EasingType.Linear, 0.8f, IdealSpearRotationForRun + ChargeDirection * MathHelper.PiOver2 * -0.7f, -0.14f);
|
||||
internal float UpThrustRotation => PiecewiseAnimation(UpThrustProgress, new CurveSegment[] { anticipationDown, upthrust, holdup });
|
||||
|
||||
|
||||
public CurveSegment goback = new CurveSegment(EasingType.SineOut, 0f, 0.68f, -0.2f);
|
||||
public CurveSegment goforwardfast = new CurveSegment(EasingType.PolyIn, 0.33f, 0.58f, 0.7f, 3);
|
||||
public CurveSegment gobounce = new CurveSegment(EasingType.Linear, 0.6f, 1.28f, 0f);
|
||||
public CurveSegment gobackagain = new CurveSegment(EasingType.SineOut, 0.86f, 1.28f, -0.2f);
|
||||
internal float UpThrustDisplacement => PiecewiseAnimation(UpThrustProgress, new CurveSegment[] { goback, goforwardfast, gobounce, gobackagain });
|
||||
|
||||
#endregion
|
||||
|
||||
#region General calculations
|
||||
public enum AttackState { ForwardThrust, RunAttack, UpwardsThrust };
|
||||
public AttackState CurrentAttackState => (RunBroken && !FullyRunning) ? AttackState.ForwardThrust : (RunBroken || RunTimer > MaxRunTime) ? AttackState.UpwardsThrust : AttackState.RunAttack;
|
||||
|
||||
//Gets the proper rotation based on the current state of the spear
|
||||
public float AppropriateRotation
|
||||
{
|
||||
get
|
||||
{
|
||||
//If the player isn't fully running yet, we just don't care about the actual attack, and have them have the default thrust rotation
|
||||
if (!FullyRunning)
|
||||
return ThrustRotation;
|
||||
|
||||
if (CurrentAttackState == AttackState.RunAttack)
|
||||
return RunAttackRotation;
|
||||
|
||||
if (CurrentAttackState == AttackState.UpwardsThrust)
|
||||
return UpThrustRotation;
|
||||
|
||||
return ThrustRotation;
|
||||
}
|
||||
}
|
||||
|
||||
//Gets the proper displacement based on the state of the spear
|
||||
public float AppropriateDisplacement
|
||||
{
|
||||
get
|
||||
{
|
||||
//If the player isn't fully running yet, we just don't care about the actual attack, and have them have the default thrust rotation
|
||||
if (!FullyRunning)
|
||||
return Displacement;
|
||||
|
||||
//If the player is running, make them keep the lance a bit behind as they run
|
||||
if (CurrentAttackState == AttackState.RunAttack)
|
||||
return MathHelper.Lerp(0.93f, 0.68f, Math.Clamp(RunTimer / 30f, 0f, 1f));
|
||||
|
||||
if (CurrentAttackState == AttackState.UpwardsThrust)
|
||||
return UpThrustDisplacement;
|
||||
|
||||
return Displacement;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Redtide Spear");
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 56;
|
||||
Projectile.DamageType = DamageClass.Melee; //Dictates whether this is a melee-class weapon.
|
||||
Projectile.timeLeft = Lifetime;
|
||||
Projectile.height = 56;
|
||||
Projectile.friendly = true;
|
||||
Projectile.hostile = false;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.ownerHitCheck = true;
|
||||
}
|
||||
|
||||
public override bool ShouldUpdatePosition()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox)
|
||||
{
|
||||
float collisionPoint = 0f;
|
||||
float bladeLenght = 85 * Projectile.scale;
|
||||
float bladeWidth = 20 * Projectile.scale;
|
||||
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center + AppropriateRotation.ToRotationVector2() * bladeLenght * -0.5f, Projectile.Center + ThrustRotation.ToRotationVector2() * bladeLenght * 0.5f, bladeWidth, ref collisionPoint);
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
UpThrustLifetime = 20;
|
||||
|
||||
|
||||
//If the player starts the attack without being able to do a run attack, mark the run as "broken" from the start.
|
||||
if (Projectile.timeLeft == Lifetime && RunTimer == 0 && !CanStartRunAttack)
|
||||
{
|
||||
RunBroken = true;
|
||||
}
|
||||
|
||||
if (CurrentAttackState == AttackState.RunAttack)
|
||||
{
|
||||
//Keep the projectile alive during the run attack.
|
||||
//The fullyRunning check is important, because the animation timer relies on the projectiles time left for the startup animation.
|
||||
if (FullyRunning)
|
||||
Projectile.timeLeft++;
|
||||
|
||||
else
|
||||
//We never actually use Projectile.rotation to draw or do any collision calculations.
|
||||
//Instead, we use it to keep track of the final rotation of the spear BEFORE it was fully running
|
||||
//We proceed to use this value to smooth the transition between the start of the thrust animation with the run animation.
|
||||
Projectile.rotation = AppropriateRotation;
|
||||
|
||||
//If at any point of the run attack, something happens to interrupt it, break the run and transition back into a forward or upwards thrust, depending on how long the player ran.
|
||||
if (!CanRunAttack)
|
||||
{
|
||||
RunBroken = true;
|
||||
//If the player was running for long enough, allow them to do a thrust attack. For this, we change the animation timer.
|
||||
if (FullyRunning)
|
||||
{
|
||||
Projectile.timeLeft = UpThrustLifetime;
|
||||
}
|
||||
}
|
||||
|
||||
ActiveSound soundOut;
|
||||
if (!SoundEngine.TryGetActiveSound(ChargeWindSoundSlot, out soundOut) || !soundOut.IsPlaying)
|
||||
ChargeWindSoundSlot = SoundEngine.PlaySound(SoundID.DD2_BookStaffTwisterLoop with { IsLooped = true, Volume = SoundID.DD2_BookStaffTwisterLoop.Volume * 0.7f }, Projectile.Center);
|
||||
|
||||
else
|
||||
{
|
||||
soundOut.Volume = MathHelper.Lerp(0f, SoundID.DD2_BookStaffTwisterLoop.Volume * 0.7f, Math.Clamp(RunTimer / 120f, 0f, 1f));
|
||||
soundOut.Position = Projectile.Center;
|
||||
}
|
||||
|
||||
RunTimer++;
|
||||
|
||||
if (Main.rand.NextBool())
|
||||
{
|
||||
int dustOpacity = Main.rand.Next(80);
|
||||
float dustScale = Main.rand.NextFloat(1f, 1.4f);
|
||||
Vector2 dustVelocity = (AppropriateRotation + MathHelper.Pi).ToRotationVector2().RotatedByRandom(MathHelper.PiOver4) * Main.rand.NextFloat(0.5f, 5f);
|
||||
Dust dust = Dust.NewDustPerfect(Projectile.Center + AppropriateRotation.ToRotationVector2() * 40f, 16, dustVelocity, Alpha: dustOpacity, Scale: dustScale);
|
||||
}
|
||||
}
|
||||
|
||||
//Basic spear attack
|
||||
else if (CurrentAttackState == AttackState.ForwardThrust)
|
||||
{
|
||||
if (ThrustProgress == 0.5f)
|
||||
SoundEngine.PlaySound(SoundID.DD2_JavelinThrowersAttack, Projectile.Center);
|
||||
}
|
||||
|
||||
else if (CurrentAttackState == AttackState.UpwardsThrust)
|
||||
{
|
||||
ActiveSound soundOut;
|
||||
|
||||
|
||||
if (SoundEngine.TryGetActiveSound(ChargeWindSoundSlot, out soundOut))
|
||||
{
|
||||
soundOut.Volume *= 0.7f;
|
||||
soundOut.Position = Projectile.Center;
|
||||
if (soundOut.Volume < 0.2f)
|
||||
soundOut.Stop();
|
||||
}
|
||||
|
||||
if (ThrustProgress == 0.5f)
|
||||
SoundEngine.PlaySound(SoundID.DD2_MonkStaffSwing, Projectile.Center);
|
||||
}
|
||||
|
||||
UpdateOwnerVars();
|
||||
Vector2 thrust = AppropriateRotation.ToRotationVector2() * (AppropriateDisplacement * 40f + 5f);
|
||||
|
||||
//During the run anim, make the spear bob up and down.
|
||||
if (CurrentAttackState == AttackState.RunAttack)
|
||||
thrust -= Vector2.UnitY * 2f * MathHelper.Clamp(0.5f + 0.8f * (float)Math.Sin(Main.GlobalTimeWrappedHourly * 20f), 0f, 1f);
|
||||
|
||||
Projectile.Center = Owner.MountedCenter + thrust;
|
||||
}
|
||||
|
||||
public void UpdateOwnerVars()
|
||||
{
|
||||
Owner.direction = Math.Sign(BaseRotation.ToRotationVector2().X);
|
||||
Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, AppropriateRotation - MathHelper.PiOver2);
|
||||
Owner.heldProj = Projectile.whoAmI;
|
||||
Owner.itemTime = 2;
|
||||
Owner.itemAnimation = 2;
|
||||
|
||||
//Add more latency after an upwards thrust, for impact purposes
|
||||
if (CurrentAttackState == AttackState.UpwardsThrust)
|
||||
{
|
||||
Owner.itemTime = 20;
|
||||
Owner.itemAnimation = 20;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
|
||||
{
|
||||
//Send the enemy flying up if hit by the upwards thrust.
|
||||
if (CurrentAttackState == AttackState.UpwardsThrust)
|
||||
{
|
||||
target.velocity.Y -= 12 * (float)Math.Sqrt(target.knockBackResist);
|
||||
target.FallingNPC().ApplyFallDamage(target, 50, 5f);
|
||||
}
|
||||
|
||||
target.AddBuff(BuffID.Poisoned, 180);
|
||||
|
||||
//Give a sliver of iframes to the player so its safer to ram into hordes (which is fun and should be encouraged)
|
||||
if (CurrentAttackState == AttackState.RunAttack)
|
||||
Owner.GiveIFrames(5);
|
||||
}
|
||||
|
||||
public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection)
|
||||
{
|
||||
//Boost the knockback during the run attack
|
||||
if (CurrentAttackState == AttackState.RunAttack)
|
||||
knockback *= 1.35f;
|
||||
}
|
||||
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
Texture2D texture = ModContent.Request<Texture2D>(Texture).Value;
|
||||
|
||||
Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, null, lightColor, AppropriateRotation + MathHelper.PiOver2 * 1.5f - MathHelper.ToRadians(12), texture.Size() / 2f, Projectile.scale, 0, 0);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 1.2 KiB |
@@ -1,44 +0,0 @@
|
||||
using System;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using CalamityMod.Projectiles.BaseProjectiles;
|
||||
namespace CalamityMod.Projectiles.Melee.Spears
|
||||
{
|
||||
public class UrchinSpearProjectile : BaseSpearProjectile
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Spear");
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 56; //The width of the .png file in pixels divided by 2.
|
||||
Projectile.aiStyle = 19;
|
||||
Projectile.DamageType = DamageClass.Melee; //Dictates whether this is a melee-class weapon.
|
||||
Projectile.timeLeft = 90;
|
||||
Projectile.height = 56; //The height of the .png file in pixels divided by 2.
|
||||
Projectile.friendly = true;
|
||||
Projectile.hostile = false;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.ownerHitCheck = true;
|
||||
}
|
||||
|
||||
public override float InitialSpeed => 3f;
|
||||
public override float ReelbackSpeed => 2.4f;
|
||||
public override float ForwardSpeed => 0.95f;
|
||||
public override Action<Projectile> EffectBeforeReelback => (proj) =>
|
||||
{
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X + Projectile.velocity.X, Projectile.Center.Y + Projectile.velocity.Y,
|
||||
Projectile.velocity.X * 1.6f, Projectile.velocity.Y * 1.6f, ModContent.ProjectileType<UrchinSpikeFugu>(), Projectile.damage, Projectile.knockBack * 0.5f, Projectile.owner, 0f, 0f);
|
||||
};
|
||||
|
||||
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
|
||||
{
|
||||
target.AddBuff(BuffID.Poisoned, 180);
|
||||
}
|
||||
}
|
||||
}
|
||||