Merge branch '1.4' of https://github.com/CalamityTeam/CalamityMod into 1.4
No files matched your search
@@ -0,0 +1,33 @@
|
||||
using CalamityMod.CalPlayer;
|
||||
using CalamityMod.Items.Weapons.Summon;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Buffs.Summon
|
||||
{
|
||||
public class ExoskeletonCannons : ModBuff
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Ares' Cannons");
|
||||
Description.SetDefault("Pulse cannon not included");
|
||||
Main.buffNoTimeDisplay[Type] = true;
|
||||
Main.buffNoSave[Type] = true;
|
||||
}
|
||||
|
||||
public override void Update(Player player, ref int buffIndex)
|
||||
{
|
||||
CalamityPlayer modPlayer = player.Calamity();
|
||||
if (AresExoskeleton.ArmExists(player))
|
||||
modPlayer.AresCannons = true;
|
||||
|
||||
if (modPlayer.AresCannons)
|
||||
player.buffTime[buffIndex] = 18000;
|
||||
else
|
||||
{
|
||||
player.DelBuff(buffIndex);
|
||||
buffIndex--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 604 B |
@@ -36,6 +36,7 @@ using CalamityMod.Items.VanillaArmorChanges;
|
||||
using CalamityMod.Items.Weapons.Melee;
|
||||
using CalamityMod.Items.Weapons.Ranged;
|
||||
using CalamityMod.Items.Weapons.Rogue;
|
||||
using CalamityMod.Items.Weapons.Summon;
|
||||
using CalamityMod.NPCs;
|
||||
using CalamityMod.NPCs.Abyss;
|
||||
using CalamityMod.NPCs.ExoMechs.Apollo;
|
||||
@@ -606,6 +607,7 @@ namespace CalamityMod.CalPlayer
|
||||
public bool BloomStoneRegen = false;
|
||||
public bool ChaosStone = false;
|
||||
public bool CryoStone = false;
|
||||
public bool voidField = false;
|
||||
#endregion
|
||||
|
||||
#region Armor Set
|
||||
@@ -987,6 +989,7 @@ namespace CalamityMod.CalPlayer
|
||||
public bool eyeOfNight = false;
|
||||
public bool soulSeeker = false;
|
||||
public bool perditionBeacon = false;
|
||||
public bool AresCannons = false;
|
||||
|
||||
public List<DeadMinionProperties> PendingProjectilesToRespawn = new List<DeadMinionProperties>();
|
||||
|
||||
@@ -1707,6 +1710,7 @@ namespace CalamityMod.CalPlayer
|
||||
BloomStoneRegen = false;
|
||||
ChaosStone = false;
|
||||
CryoStone = false;
|
||||
voidField = false;
|
||||
|
||||
daedalusReflect = false;
|
||||
daedalusSplit = false;
|
||||
@@ -2057,6 +2061,7 @@ namespace CalamityMod.CalPlayer
|
||||
eyeOfNight = false;
|
||||
soulSeeker = false;
|
||||
perditionBeacon = false;
|
||||
AresCannons = false;
|
||||
|
||||
disableVoodooSpawns = false;
|
||||
disablePerfCystSpawns = false;
|
||||
@@ -5601,6 +5606,9 @@ namespace CalamityMod.CalPlayer
|
||||
Player.head = EquipLoader.GetEquipSlot(Mod, snowmanNoseless ? "PopoNoseless" : "Popo", EquipType.Head);
|
||||
Player.face = -1;
|
||||
}
|
||||
else if (AresExoskeleton.ArmExists(Player))
|
||||
Player.body = EquipLoader.GetEquipSlot(Mod, "AresExoskeleton", EquipType.Body);
|
||||
|
||||
else if ((abyssalDivingSuitPower || abyssalDivingSuitForce) && !abyssalDivingSuitHide)
|
||||
{
|
||||
Player.legs = EquipLoader.GetEquipSlot(Mod, "AbyssalDivingSuit", EquipType.Legs);
|
||||
@@ -6419,7 +6427,7 @@ namespace CalamityMod.CalPlayer
|
||||
var source = Player.GetSource_Accessory(FindAccessory(ModContent.ItemType<Items.Accessories.InkBomb>()));
|
||||
if (Player.whoAmI == Main.myPlayer && !Player.HasCooldown(Cooldowns.InkBomb.ID))
|
||||
{
|
||||
Player.AddCooldown(Cooldowns.InkBomb.ID, CalamityUtils.SecondsToFrames(20));
|
||||
Player.AddCooldown(Cooldowns.InkBomb.ID, CalamityUtils.SecondsToFrames(25));
|
||||
rogueStealth += 0.5f;
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
|
||||
@@ -1388,7 +1388,7 @@ namespace CalamityMod.CalPlayer
|
||||
}
|
||||
if (corrosiveSpine)
|
||||
{
|
||||
target.AddBuff(BuffID.Venom, 240);
|
||||
target.AddBuff(BuffID.Poisoned, 240);
|
||||
}
|
||||
if (aWeapon)
|
||||
{
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
|
||||
namespace CalamityMod.DataStructures
|
||||
{
|
||||
|
||||
// Restarting the sprite batch for each different projectile is analogously equivalent to creating an entire new factory just to build a single car.
|
||||
// It is inefficient and leads to performance problems as many projectiles do it.
|
||||
// To mitigate this problem, a special interface exists for the purpose of deferring drawing of certain entities to a time in which they all may be
|
||||
// subject to the same additive draw state before all of the spritebatch's contents are flushed.
|
||||
// Manual drawing hooks should not be utilized when using this interface, such as ModNPC.PreDraw.
|
||||
|
||||
// The implementation of this is almost identical to that of SLR but they're both so simple that it really shouldn't matter.
|
||||
public interface IAdditiveDrawer
|
||||
{
|
||||
void AdditiveDraw(SpriteBatch spriteBatch);
|
||||
}
|
||||
}
|
||||
@@ -49,6 +49,7 @@ namespace CalamityMod.ILEditing
|
||||
IL.Terraria.Player.QuickHeal += ConditionallyReplaceManaSickness;
|
||||
IL.Terraria.Player.QuickMana += ConditionallyReplaceManaSickness;
|
||||
IL.Terraria.Player.ItemCheck_Inner += ConditionallyReplaceManaSickness;
|
||||
IL.Terraria.Main.DoDraw += AdditiveDrawing;
|
||||
On.Terraria.Main.SortDrawCacheWorms += DrawFusableParticles;
|
||||
On.Terraria.Main.DrawInfernoRings += DrawForegroundParticles;
|
||||
On.Terraria.Main.SetDisplayMode += ResetRenderTargetSizes;
|
||||
@@ -161,6 +162,7 @@ namespace CalamityMod.ILEditing
|
||||
IL.Terraria.Player.QuickHeal -= ConditionallyReplaceManaSickness;
|
||||
IL.Terraria.Player.QuickMana -= ConditionallyReplaceManaSickness;
|
||||
IL.Terraria.Player.ItemCheck_Inner -= ConditionallyReplaceManaSickness;
|
||||
IL.Terraria.Main.DoDraw -= AdditiveDrawing;
|
||||
On.Terraria.Main.SortDrawCacheWorms -= DrawFusableParticles;
|
||||
On.Terraria.Main.DrawInfernoRings -= DrawForegroundParticles;
|
||||
On.Terraria.Main.SetDisplayMode -= ResetRenderTargetSizes;
|
||||
|
||||
@@ -38,6 +38,8 @@ using Terraria.ModLoader;
|
||||
using Terraria.UI.Gamepad;
|
||||
using Terraria.Utilities;
|
||||
using Terraria.Graphics.Light;
|
||||
using Terraria.GameContent.Events;
|
||||
using CalamityMod.DataStructures;
|
||||
using CalamityMod.Particles.Metaballs;
|
||||
|
||||
namespace CalamityMod.ILEditing
|
||||
@@ -637,10 +639,45 @@ namespace CalamityMod.ILEditing
|
||||
}
|
||||
#endregion Fire Cursor Effect for the Calamity Accessory
|
||||
|
||||
#region Custom Draw Layers
|
||||
private static void AdditiveDrawing(ILContext il)
|
||||
{
|
||||
ILCursor cursor = new(il);
|
||||
if (!cursor.TryGotoNext(MoveType.After, i => i.MatchCall<MoonlordDeathDrama>("DrawWhite")))
|
||||
return;
|
||||
|
||||
cursor.EmitDelegate<Action>(() =>
|
||||
{
|
||||
Main.spriteBatch.SetBlendState(BlendState.Additive);
|
||||
|
||||
// Draw Projectiles.
|
||||
for (int i = 0; i < Main.maxProjectiles; i++)
|
||||
{
|
||||
if (!Main.projectile[i].active)
|
||||
continue;
|
||||
|
||||
if (Main.projectile[i].ModProjectile is IAdditiveDrawer d)
|
||||
d.AdditiveDraw(Main.spriteBatch);
|
||||
}
|
||||
|
||||
// Draw NPCs.
|
||||
for (int i = 0; i < Main.maxNPCs; i++)
|
||||
{
|
||||
if (!Main.npc[i].active)
|
||||
continue;
|
||||
|
||||
if (Main.npc[i].ModNPC is IAdditiveDrawer d)
|
||||
d.AdditiveDraw(Main.spriteBatch);
|
||||
}
|
||||
|
||||
Main.spriteBatch.SetBlendState(BlendState.AlphaBlend);
|
||||
});
|
||||
}
|
||||
#endregion Custom Draw Layers
|
||||
|
||||
#region General Particle Rendering
|
||||
private static void DrawFusableParticles(On.Terraria.Main.orig_SortDrawCacheWorms orig, Main self)
|
||||
{
|
||||
|
||||
DeathAshParticle.DrawAll();
|
||||
FusableParticleManager.RenderAllFusableParticles();
|
||||
|
||||
|
||||
@@ -174,7 +174,7 @@ namespace CalamityMod.ILEditing
|
||||
{
|
||||
cache.Add(new OrderedProjectileEntry()
|
||||
{
|
||||
Proj = Main.projectile[i] ?? new Projectile(),
|
||||
Proj = Main.projectile[i] ?? new(),
|
||||
OriginalIndex = i
|
||||
});
|
||||
}
|
||||
@@ -182,12 +182,18 @@ namespace CalamityMod.ILEditing
|
||||
});
|
||||
cursor.Emit(OpCodes.Stsfld, typeof(ILChanges).GetField("OrderedProjectiles", BindingFlags.Static | BindingFlags.Public));
|
||||
|
||||
// Find the update loop update local index.
|
||||
int updateLoopLocalIndex = -1;
|
||||
cursor.GotoNext(i => i.MatchStloc(out updateLoopLocalIndex));
|
||||
|
||||
// Go before the declaration of the projectile loop index and declare the ordered projectile.
|
||||
if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchStsfld<Main>("ProjectileUpdateLoopIndex")))
|
||||
cursor.Goto(0);
|
||||
if (!cursor.TryGotoNext(MoveType.After, i => i.MatchStsfld<Main>("ProjectileUpdateLoopIndex")))
|
||||
{
|
||||
LogFailure("Projectile Update Priority fix", "Could not locate the ProjectileUpdateLoopIndex field.");
|
||||
return;
|
||||
}
|
||||
int updateIndexPosition = cursor.Index;
|
||||
|
||||
// Replace the projectile reference on the Projectile.Update call.
|
||||
if (!cursor.TryGotoNext(MoveType.After, i => i.MatchLdelemRef()))
|
||||
@@ -199,14 +205,21 @@ namespace CalamityMod.ILEditing
|
||||
// Pop the Main.projectile[i] reference and replace it with OrderedProjectiles[i].Proj.
|
||||
cursor.Emit(OpCodes.Pop);
|
||||
cursor.Emit(OpCodes.Ldsfld, typeof(ILChanges).GetField("OrderedProjectiles", BindingFlags.Static | BindingFlags.Public));
|
||||
cursor.Emit(OpCodes.Ldloc, 29);
|
||||
cursor.Emit(OpCodes.Ldloc, updateLoopLocalIndex);
|
||||
cursor.Emit(OpCodes.Callvirt, typeof(List<OrderedProjectileEntry>).GetMethod("get_Item"));
|
||||
cursor.Emit(OpCodes.Ldfld, typeof(OrderedProjectileEntry).GetField("Proj"));
|
||||
|
||||
// Remove the direct i reference in the Update call and replace it with the original index in the cache, to prevent update ID
|
||||
// Pop the direct i reference in the Update call and replace it with the original index in the cache, to prevent update ID
|
||||
// mismatches.
|
||||
cursor.Remove();
|
||||
cursor.Emit(OpCodes.Ldloc, 29);
|
||||
cursor.Goto(updateIndexPosition);
|
||||
|
||||
if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchCall<Projectile>("Call")))
|
||||
{
|
||||
LogFailure("Projectile Update Priority fix", "Could not locate the projectile Update call.");
|
||||
return;
|
||||
}
|
||||
cursor.Emit(OpCodes.Pop);
|
||||
cursor.Emit(OpCodes.Ldloc, updateLoopLocalIndex);
|
||||
cursor.EmitDelegate<Func<int, int>>(i => OrderedProjectiles[i].OriginalIndex);
|
||||
}
|
||||
#endregion Fix Projectile Update Priority Problems
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using Terraria;
|
||||
|
||||
namespace CalamityMod.InverseKinematics
|
||||
{
|
||||
public class CyclicCoordinateDescentUpdateRule : IInverseKinematicsUpdateRule
|
||||
{
|
||||
public float AngularOffsetAcceleration;
|
||||
public float AngularDeviationLenience;
|
||||
public CyclicCoordinateDescentUpdateRule(float angularOffsetAcceleration, float angularDeviationLenience)
|
||||
{
|
||||
AngularOffsetAcceleration = angularOffsetAcceleration;
|
||||
AngularDeviationLenience = angularDeviationLenience;
|
||||
}
|
||||
|
||||
public void Update(LimbCollection limbs, Vector2 destination)
|
||||
{
|
||||
float distanceFromStart = Vector2.Distance(destination, limbs.ConnectPoint);
|
||||
float distanceFromEnd = Vector2.Distance(destination, limbs.EndPoint);
|
||||
float slowdownInterpolant = Utils.GetLerpValue(8f, 40f, distanceFromEnd, true);
|
||||
slowdownInterpolant *= Utils.GetLerpValue(8f, 40f, distanceFromStart, true);
|
||||
|
||||
Vector2 originalEndPoint = limbs.EndPoint;
|
||||
for (int i = limbs.Limbs.Length - 1; i >= 0; i--)
|
||||
{
|
||||
// Move based on angular offsets. Movement is dampened the closer a limb is to being the first limb.
|
||||
Vector2 currentToEndOffset = originalEndPoint - limbs.Limbs[i].ConnectPoint;
|
||||
Vector2 currentToDestinationOffset = destination - limbs.Limbs[i].ConnectPoint;
|
||||
Vector2 perpendicularDirection = currentToDestinationOffset.RotatedBy(MathHelper.PiOver2);
|
||||
float angularOffset = currentToEndOffset.AngleBetween(currentToDestinationOffset) * (float)Math.Sqrt((i + 1f) / limbs.Limbs.Length);
|
||||
|
||||
// Determine direction by choosing the angle which approaches the destination faster.
|
||||
float leftAngularOffset = currentToEndOffset.AngleBetween(currentToDestinationOffset - perpendicularDirection);
|
||||
float rightAngularOffset = currentToEndOffset.AngleBetween(currentToDestinationOffset + perpendicularDirection);
|
||||
if (leftAngularOffset > rightAngularOffset)
|
||||
angularOffset *= -1f;
|
||||
|
||||
// Perform safety checks on the result of the underlying arccosines.
|
||||
if (float.IsNaN(angularOffset))
|
||||
break;
|
||||
|
||||
// Update rotation.
|
||||
limbs.Limbs[i].Rotation += angularOffset * slowdownInterpolant * AngularOffsetAcceleration;
|
||||
|
||||
// And limit it so that it doesn't look weird.
|
||||
if (i > 0)
|
||||
{
|
||||
float behindRotation = (float)limbs.Limbs[i - 1].Rotation;
|
||||
limbs.Limbs[i].Rotation = MathHelper.Clamp((float)limbs.Limbs[i].Rotation, behindRotation - AngularDeviationLenience, behindRotation + AngularDeviationLenience);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
|
||||
namespace CalamityMod.InverseKinematics
|
||||
{
|
||||
public interface IInverseKinematicsUpdateRule
|
||||
{
|
||||
void Update(LimbCollection limbs, Vector2 destination);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
|
||||
namespace CalamityMod.InverseKinematics
|
||||
{
|
||||
public class Limb
|
||||
{
|
||||
// Doubles are used instead of floats as a means of providing sufficient precision to not cause erroneous results when
|
||||
// doing approximations of derivative limits with small divisors.
|
||||
public double Rotation;
|
||||
public double Length;
|
||||
public Vector2 ConnectPoint;
|
||||
public Vector2 EndPoint => ConnectPoint + ((float)Rotation).ToRotationVector2() * (float)Length;
|
||||
|
||||
public Limb(float rotation, float length)
|
||||
{
|
||||
Rotation = rotation;
|
||||
Length = length;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using System.Linq;
|
||||
|
||||
namespace CalamityMod.InverseKinematics
|
||||
{
|
||||
public class LimbCollection
|
||||
{
|
||||
public Limb[] Limbs;
|
||||
public IInverseKinematicsUpdateRule UpdateRule;
|
||||
public Vector2 ConnectPoint => Limbs.First().ConnectPoint;
|
||||
public Vector2 EndPoint => Limbs.Last().EndPoint;
|
||||
public double TotalLength => Limbs.Sum(l => l.Length);
|
||||
|
||||
public LimbCollection(IInverseKinematicsUpdateRule updateRule, int limbCount, float limbLength)
|
||||
{
|
||||
UpdateRule = updateRule;
|
||||
|
||||
Limbs = new Limb[limbCount];
|
||||
for (int i = 0; i < limbCount; i++)
|
||||
Limbs[i] = new Limb(0f, limbLength);
|
||||
}
|
||||
|
||||
public LimbCollection(IInverseKinematicsUpdateRule updateRule, params float[] limbLengths)
|
||||
{
|
||||
UpdateRule = updateRule;
|
||||
|
||||
int limbCount = limbLengths.Length;
|
||||
Limbs = new Limb[limbCount];
|
||||
for (int i = 0; i < limbCount; i++)
|
||||
Limbs[i] = new Limb(0f, limbLengths[i]);
|
||||
}
|
||||
|
||||
public void UpdateConnectPoints(Vector2? connectPoint = null)
|
||||
{
|
||||
if (connectPoint.HasValue)
|
||||
Limbs[0].ConnectPoint = connectPoint.Value;
|
||||
|
||||
for (int i = 1; i < Limbs.Length; i++)
|
||||
Limbs[i].ConnectPoint = Limbs[i - 1].EndPoint;
|
||||
}
|
||||
|
||||
public Limb this[int index]
|
||||
{
|
||||
get => Limbs[index];
|
||||
set => Limbs[index] = value;
|
||||
}
|
||||
|
||||
public void Update(Vector2 connectPoint, Vector2 destination)
|
||||
{
|
||||
UpdateRule.Update(this, destination);
|
||||
Limbs[0].ConnectPoint = connectPoint;
|
||||
UpdateConnectPoints(connectPoint);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
using CalamityMod.CalPlayer;
|
||||
using CalamityMod.Items.Materials;
|
||||
using CalamityMod.Projectiles.Typeless;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
using Terraria.ID;
|
||||
|
||||
namespace CalamityMod.Items.Accessories
|
||||
{
|
||||
[AutoloadEquip(EquipType.Back)]
|
||||
public class QuiverofNihility : ModItem
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
SacrificeTotal = 1;
|
||||
DisplayName.SetDefault("Quiver of Nihility");
|
||||
Tooltip.SetDefault("'Filled with a substance darker than the night sky'\n"+"Summons a ring of four void fields to orbit you\n" + "Arrows that pass through these fields gain a 20% damage boost and double the speed");
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.width = 42;
|
||||
Item.height = 36;
|
||||
Item.value = CalamityGlobalItem.Rarity12BuyPrice;
|
||||
Item.Calamity().customRarity = CalamityRarity.Turquoise;
|
||||
Item.Calamity().donorItem = true;
|
||||
Item.accessory = true;
|
||||
}
|
||||
|
||||
public override bool CanEquipAccessory(Player player, int slot, bool modded)
|
||||
{
|
||||
if (player.Calamity().voidField)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void UpdateAccessory(Player player, bool hideVisual)
|
||||
{
|
||||
CalamityPlayer modPlayer = player.Calamity();
|
||||
modPlayer.voidField = true;
|
||||
if (player.whoAmI == Main.myPlayer)
|
||||
{
|
||||
var source = player.GetSource_Accessory(Item);
|
||||
if (player.ownedProjectileCounts[ModContent.ProjectileType<VoidFieldGenerator>()] < 4)
|
||||
{
|
||||
for (int v = 0; v < 4; v++)
|
||||
{
|
||||
Projectile.NewProjectileDirect(source, player.Center, Vector2.Zero, ModContent.ProjectileType<VoidFieldGenerator>(), 0, 0f, Main.myPlayer, v);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public override void AddRecipes()
|
||||
{
|
||||
CreateRecipe().
|
||||
AddRecipeGroup("QuiversGroup").
|
||||
AddIngredient<DarkPlasma>(3).
|
||||
AddIngredient<GalacticaSingularity>(5).
|
||||
AddTile(TileID.LunarCraftingStation).
|
||||
Register();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 3.5 KiB |
@@ -406,7 +406,7 @@ namespace CalamityMod.Items.Armor.DesertProwler
|
||||
|
||||
public override void OnSpawn(Projectile projectile, IEntitySource source)
|
||||
{
|
||||
if (projectile.damage > 0)
|
||||
if (projectile.damage > 0 && !Main.gameMenu)
|
||||
{
|
||||
if (projectile.owner >= 0 && DesertProwlerHat.ShroudedInSmoke(Main.player[projectile.owner], out var cd) && projectile.DamageType.CountsAsClass(DamageClass.Ranged))
|
||||
{
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using CalamityMod.Cooldowns;
|
||||
using CalamityMod.Items.Accessories.Vanity;
|
||||
using CalamityMod.Items.Materials;
|
||||
using CalamityMod.Items.Materials;
|
||||
using CalamityMod.Particles;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria.DataStructures;
|
||||
using CalamityMod.Items.Accessories.Vanity;
|
||||
using CalamityMod.Cooldowns;
|
||||
using Terraria.Audio;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using static Microsoft.Xna.Framework.Input.Keys;
|
||||
using static Terraria.ModLoader.ModContent;
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ using CalamityMod.Items.Mounts;
|
||||
using CalamityMod.Items.Weapons.Melee;
|
||||
using CalamityMod.Items.Weapons.Ranged;
|
||||
using CalamityMod.Items.Weapons.Rogue;
|
||||
using CalamityMod.Items.Weapons.Summon;
|
||||
using CalamityMod.NPCs.ExoMechs.Ares;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
@@ -60,6 +61,7 @@ namespace CalamityMod.Items.TreasureBags
|
||||
{
|
||||
DropHelper.DropItem(s, player, ModContent.ItemType<PhotonRipper>());
|
||||
DropHelper.DropItem(s, player, ModContent.ItemType<TheJailor>());
|
||||
DropHelper.DropItem(s, player, ModContent.ItemType<AresExoskeleton>());
|
||||
}
|
||||
if (DownedBossSystem.downedThanatos)
|
||||
{
|
||||
|
||||
@@ -3,6 +3,7 @@ using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using CalamityMod.Projectiles.Melee.Shortswords;
|
||||
|
||||
namespace CalamityMod.Items.Weapons.Melee
|
||||
{
|
||||
@@ -17,40 +18,28 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.useStyle = ItemUseStyleID.Thrust;
|
||||
Item.useStyle = ItemUseStyleID.Rapier;
|
||||
Item.useTurn = false;
|
||||
Item.useAnimation = 12;
|
||||
Item.useTime = 12;
|
||||
Item.useAnimation = 18;
|
||||
Item.useTime = 18;
|
||||
Item.width = 32;
|
||||
Item.height = 32;
|
||||
Item.damage = 23;
|
||||
Item.DamageType = DamageClass.Melee;
|
||||
Item.knockBack = 5.5f;
|
||||
Item.UseSound = SoundID.Item1;
|
||||
Item.useTurn = true;
|
||||
Item.autoReuse = true;
|
||||
Item.noUseGraphic = true;
|
||||
Item.noMelee = true;
|
||||
|
||||
Item.shoot = ModContent.ProjectileType<AquaticDischargeProj>();
|
||||
Item.shootSpeed = 2f;
|
||||
Item.value = Item.buyPrice(0, 2, 0, 0);
|
||||
Item.rare = ItemRarityID.Green;
|
||||
}
|
||||
|
||||
public override void MeleeEffects(Player player, Rectangle hitbox)
|
||||
{
|
||||
if (Main.rand.NextBool(5))
|
||||
Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 226);
|
||||
}
|
||||
|
||||
public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit)
|
||||
{
|
||||
var source = player.GetSource_ItemUse(Item);
|
||||
int sparkDamage = player.CalcIntDamage<MeleeDamageClass>(0.5f * Item.damage);
|
||||
Projectile.NewProjectile(source, target.Center, Vector2.Zero, ModContent.ProjectileType<Spark>(), sparkDamage, knockback, Main.myPlayer);
|
||||
}
|
||||
|
||||
public override void OnHitPvp(Player player, Player target, int damage, bool crit)
|
||||
{
|
||||
var source = player.GetSource_ItemUse(Item);
|
||||
int sparkDamage = player.CalcIntDamage<MeleeDamageClass>(0.5f * Item.damage);
|
||||
Projectile.NewProjectile(source, target.Center, Vector2.Zero, ModContent.ProjectileType<Spark>(), sparkDamage, Item.knockBack, Main.myPlayer);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,11 @@
|
||||
using Terraria.DataStructures;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using CalamityMod.Buffs.DamageOverTime;
|
||||
using CalamityMod.Items.Materials;
|
||||
using CalamityMod.Projectiles.Melee;
|
||||
using CalamityMod.Projectiles.Melee.Shortswords;
|
||||
using CalamityMod.Tiles.Furniture.CraftingStations;
|
||||
|
||||
|
||||
namespace CalamityMod.Items.Weapons.Melee
|
||||
{
|
||||
public class CosmicShiv : ModItem
|
||||
@@ -15,75 +13,30 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Cosmic Shiv");
|
||||
Tooltip.SetDefault("Definitely don't underestimate the power of shivs\n" +
|
||||
"Fires a cosmic beam that homes in on enemies\n" +
|
||||
Tooltip.SetDefault("Fires a cosmic beam that homes in on enemies\n" +
|
||||
"Upon hitting an enemy, a barrage of offscreen objects home in on the enemy as well as raining stars");
|
||||
SacrificeTotal = 1;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.useStyle = ItemUseStyleID.Thrust;
|
||||
Item.useTurn = false;
|
||||
Item.useStyle = ItemUseStyleID.Rapier;
|
||||
Item.useAnimation = 18;
|
||||
Item.useTime = 18;
|
||||
Item.width = 44;
|
||||
Item.height = 44;
|
||||
|
||||
Item.damage = 218;
|
||||
|
||||
Item.DamageType = DamageClass.Melee;
|
||||
Item.knockBack = 9f;
|
||||
Item.UseSound = SoundID.Item1;
|
||||
Item.useTurn = true;
|
||||
Item.autoReuse = true;
|
||||
Item.shoot = ModContent.ProjectileType<CosmicShivBall>();
|
||||
Item.shootSpeed = 14f;
|
||||
Item.noUseGraphic = true;
|
||||
Item.noMelee = true;
|
||||
Item.shoot = ModContent.ProjectileType<CosmicShivProj>();
|
||||
Item.shootSpeed = 2.4f;
|
||||
|
||||
Item.value = CalamityGlobalItem.Rarity14BuyPrice;
|
||||
Item.Calamity().customRarity = CalamityRarity.DarkBlue;
|
||||
Item.Calamity().donorItem = true;
|
||||
}
|
||||
|
||||
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
|
||||
{
|
||||
Projectile.NewProjectile(source, position.X, position.Y, Item.shootSpeed * player.direction, 0f, type, damage, knockback, player.whoAmI);
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void MeleeEffects(Player player, Rectangle hitbox)
|
||||
{
|
||||
Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 173);
|
||||
}
|
||||
|
||||
public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit)
|
||||
{
|
||||
for (int k = 0; k < 36; k++)
|
||||
{
|
||||
int dustID = Dust.NewDust(new Vector2(player.position.X, player.position.Y + 16f), player.width, player.height - 16, 173, 0f, 0f, 0, default, 1f);
|
||||
Main.dust[dustID].velocity *= 3f;
|
||||
Main.dust[dustID].scale *= 2f;
|
||||
}
|
||||
|
||||
target.AddBuff(ModContent.BuffType<BrimstoneFlames>(), 120);
|
||||
target.AddBuff(BuffID.Frostburn, 120);
|
||||
target.AddBuff(ModContent.BuffType<HolyFlames>(), 120);
|
||||
target.AddBuff(ModContent.BuffType<GodSlayerInferno>(), 120);
|
||||
}
|
||||
|
||||
public override void OnHitPvp(Player player, Player target, int damage, bool crit)
|
||||
{
|
||||
for (int k = 0; k < 36; k++)
|
||||
{
|
||||
int dustID = Dust.NewDust(new Vector2(player.position.X, player.position.Y + 16f), player.width, player.height - 16, 173, 0f, 0f, 0, default, 1f);
|
||||
Main.dust[dustID].velocity *= 3f;
|
||||
Main.dust[dustID].scale *= 2f;
|
||||
}
|
||||
|
||||
target.AddBuff(ModContent.BuffType<BrimstoneFlames>(), 120);
|
||||
target.AddBuff(BuffID.Frostburn, 120);
|
||||
target.AddBuff(ModContent.BuffType<HolyFlames>(), 120);
|
||||
target.AddBuff(ModContent.BuffType<GodSlayerInferno>(), 120);
|
||||
Item.Calamity().donorItem = true; //Yatagarasu#0001
|
||||
}
|
||||
|
||||
public override void AddRecipes()
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using Terraria.DataStructures;
|
||||
using CalamityMod.Buffs.DamageOverTime;
|
||||
using CalamityMod.Items.Materials;
|
||||
using CalamityMod.Projectiles.Melee;
|
||||
using CalamityMod.Projectiles.Melee.Shortswords;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
@@ -15,61 +15,29 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Elemental Shiv");
|
||||
Tooltip.SetDefault("Don't underestimate the power of shivs\n" +
|
||||
"Shoots a rainbow shiv that spawns additional shivs on hit");
|
||||
Tooltip.SetDefault("Shoots a rainbow shiv that spawns additional shivs on hit");
|
||||
SacrificeTotal = 1;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.useStyle = ItemUseStyleID.Thrust;
|
||||
Item.useTurn = false;
|
||||
Item.useStyle = ItemUseStyleID.Rapier;
|
||||
Item.useAnimation = 10;
|
||||
Item.useTime = 10;
|
||||
Item.width = 44;
|
||||
Item.height = 44;
|
||||
Item.damage = 168;
|
||||
Item.DamageType = DamageClass.Melee;
|
||||
Item.damage = 190;
|
||||
Item.knockBack = 8.5f;
|
||||
Item.UseSound = SoundID.Item1;
|
||||
Item.useTurn = true;
|
||||
Item.autoReuse = true;
|
||||
Item.shoot = ModContent.ProjectileType<ElementBallShiv>();
|
||||
Item.shootSpeed = 14f;
|
||||
Item.noUseGraphic = true;
|
||||
Item.noMelee = true;
|
||||
Item.shoot = ModContent.ProjectileType<ElementalShivProj>();
|
||||
Item.shootSpeed = 2.4f;
|
||||
Item.value = CalamityGlobalItem.Rarity11BuyPrice;
|
||||
Item.rare = ItemRarityID.Purple;
|
||||
}
|
||||
|
||||
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
|
||||
{
|
||||
Projectile.NewProjectile(source, position.X, position.Y, Item.shootSpeed * player.direction, 0f, type, (int)(damage * 0.5), knockback, player.whoAmI, 0f, 0f);
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void MeleeEffects(Player player, Rectangle hitbox)
|
||||
{
|
||||
if (Main.rand.NextBool(5))
|
||||
{
|
||||
int num250 = Dust.NewDust(new Vector2((float)hitbox.X, (float)hitbox.Y), hitbox.Width, hitbox.Height, 66, (float)(player.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.3f);
|
||||
Main.dust[num250].velocity *= 0.2f;
|
||||
Main.dust[num250].noGravity = true;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit)
|
||||
{
|
||||
target.AddBuff(ModContent.BuffType<BrimstoneFlames>(), 120);
|
||||
target.AddBuff(BuffID.Frostburn, 120);
|
||||
target.AddBuff(ModContent.BuffType<HolyFlames>(), 120);
|
||||
}
|
||||
|
||||
public override void OnHitPvp(Player player, Player target, int damage, bool crit)
|
||||
{
|
||||
target.AddBuff(ModContent.BuffType<BrimstoneFlames>(), 120);
|
||||
target.AddBuff(BuffID.Frostburn, 120);
|
||||
target.AddBuff(ModContent.BuffType<HolyFlames>(), 120);
|
||||
}
|
||||
|
||||
public override void AddRecipes()
|
||||
{
|
||||
CreateRecipe().
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
using Terraria.DataStructures;
|
||||
using CalamityMod.Buffs.DamageOverTime;
|
||||
using CalamityMod.Items.Materials;
|
||||
using CalamityMod.Items.Materials;
|
||||
using CalamityMod.Items.Placeables.Ores;
|
||||
using CalamityMod.Projectiles.Melee;
|
||||
using Microsoft.Xna.Framework;
|
||||
using CalamityMod.Projectiles.Melee.Shortswords;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
@@ -23,72 +20,28 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.useStyle = ItemUseStyleID.Thrust;
|
||||
Item.useTurn = false;
|
||||
Item.useStyle = ItemUseStyleID.Rapier;
|
||||
Item.useAnimation = 10;
|
||||
Item.useTime = 10;
|
||||
Item.width = 44;
|
||||
Item.height = 44;
|
||||
Item.damage = 110;
|
||||
Item.DamageType = DamageClass.Melee;
|
||||
Item.knockBack = 10f;
|
||||
Item.UseSound = SoundID.Item1;
|
||||
Item.useTurn = true;
|
||||
Item.autoReuse = true;
|
||||
Item.shoot = ModContent.ProjectileType<GalileosMoon>();
|
||||
Item.shootSpeed = 14f;
|
||||
Item.noUseGraphic = true;
|
||||
Item.noMelee = true;
|
||||
Item.shoot = ModContent.ProjectileType<GalileoGladiusProj>();
|
||||
Item.shootSpeed = 2.4f;
|
||||
|
||||
Item.value = CalamityGlobalItem.Rarity13BuyPrice;
|
||||
Item.Calamity().customRarity = CalamityRarity.PureGreen;
|
||||
}
|
||||
|
||||
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
|
||||
{
|
||||
int moonDamage = (int)(damage * 0.3333f);
|
||||
Projectile.NewProjectile(source, position.X, position.Y, Item.shootSpeed * player.direction, 0f, type, moonDamage, knockback, player.whoAmI, 0f, 0f);
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void MeleeEffects(Player player, Rectangle hitbox)
|
||||
{
|
||||
if (Main.rand.NextBool(5))
|
||||
{
|
||||
int num250 = Dust.NewDust(new Vector2((float)hitbox.X, (float)hitbox.Y), hitbox.Width, hitbox.Height, (Main.rand.NextBool(2) ? 20 : 176), (float)(player.direction * 2), 0f, 150, default, 1.3f);
|
||||
Main.dust[num250].velocity *= 0.2f;
|
||||
Main.dust[num250].noGravity = true;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit)
|
||||
{
|
||||
target.AddBuff(ModContent.BuffType<Nightwither>(), 300);
|
||||
SpawnMeteor(player);
|
||||
}
|
||||
|
||||
public override void OnHitPvp(Player player, Player target, int damage, bool crit)
|
||||
{
|
||||
target.AddBuff(ModContent.BuffType<Nightwither>(), 300);
|
||||
SpawnMeteor(player);
|
||||
}
|
||||
|
||||
private void SpawnMeteor(Player player)
|
||||
{
|
||||
if (player.whoAmI == Main.myPlayer)
|
||||
{
|
||||
var source = player.GetSource_ItemUse(Item);
|
||||
if (player.Calamity().galileoCooldown <= 0)
|
||||
{
|
||||
int damage = player.GetWeaponDamage(player.ActiveItem()) * 2;
|
||||
CalamityUtils.ProjectileRain(source, player.Center, 400f, 100f, 500f, 800f, 25f, ModContent.ProjectileType<GalileosPlanet>(), damage, 15f, player.whoAmI);
|
||||
player.Calamity().galileoCooldown = 15;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void AddRecipes()
|
||||
{
|
||||
CreateRecipe().
|
||||
AddIngredient(ItemID.Gladius). //This may be too rare for this recipe, we'll see I guess. - Merkalto
|
||||
AddIngredient(ItemID.Gladius).
|
||||
AddIngredient<Lumenyl>(8).
|
||||
AddIngredient<RuinousSoul>(5).
|
||||
AddIngredient<ExodiumCluster>(15).
|
||||
|
||||
@@ -5,13 +5,12 @@ using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using CalamityMod.Projectiles.Melee.Shortswords;
|
||||
|
||||
namespace CalamityMod.Items.Weapons.Melee
|
||||
{
|
||||
public class Lucrecia : ModItem
|
||||
{
|
||||
public const int OnHitIFrames = 5;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Lucrecia");
|
||||
@@ -23,58 +22,24 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.useStyle = ItemUseStyleID.Thrust;
|
||||
Item.useStyle = ItemUseStyleID.Rapier;
|
||||
Item.useTurn = false;
|
||||
Item.useAnimation = 25;
|
||||
Item.useTime = 25;
|
||||
Item.width = 58;
|
||||
Item.height = 58;
|
||||
Item.damage = 90;
|
||||
Item.DamageType = DamageClass.Melee;
|
||||
Item.knockBack = 8.25f;
|
||||
Item.UseSound = SoundID.Item1;
|
||||
Item.useTurn = true;
|
||||
Item.autoReuse = true;
|
||||
Item.shoot = ModContent.ProjectileType<DNA>();
|
||||
Item.shootSpeed = 32f;
|
||||
Item.noUseGraphic = true;
|
||||
Item.noMelee = true;
|
||||
Item.shoot = ModContent.ProjectileType<LucreciaProj>();
|
||||
Item.shootSpeed = 2f;
|
||||
Item.value = Item.buyPrice(0, 80, 0, 0);
|
||||
Item.rare = ItemRarityID.Yellow;
|
||||
}
|
||||
|
||||
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
|
||||
{
|
||||
Projectile.NewProjectile(source, position.X, position.Y, Item.shootSpeed * player.direction, 0f, type, damage, knockback, player.whoAmI, 0f, 0f);
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void MeleeEffects(Player player, Rectangle hitbox)
|
||||
{
|
||||
if (Main.rand.NextBool(5))
|
||||
{
|
||||
Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 234);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit)
|
||||
{
|
||||
player.GiveIFrames(OnHitIFrames, false);
|
||||
}
|
||||
|
||||
public override void OnHitPvp(Player player, Player target, int damage, bool crit)
|
||||
{
|
||||
bool isImmune = false;
|
||||
for (int j = 0; j < player.hurtCooldowns.Length; j++)
|
||||
{
|
||||
if (player.hurtCooldowns[j] > 0)
|
||||
isImmune = true;
|
||||
}
|
||||
if (!isImmune)
|
||||
{
|
||||
player.immune = true;
|
||||
player.immuneTime = Item.useTime / 5;
|
||||
}
|
||||
}
|
||||
|
||||
public override void AddRecipes()
|
||||
{
|
||||
CreateRecipe().
|
||||
|
||||
@@ -3,6 +3,7 @@ using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using CalamityMod.Projectiles.Melee.Shortswords;
|
||||
|
||||
namespace CalamityMod.Items.Weapons.Melee
|
||||
{
|
||||
@@ -17,46 +18,23 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.useStyle = ItemUseStyleID.Thrust;
|
||||
Item.useStyle = ItemUseStyleID.Rapier;
|
||||
Item.useTurn = false;
|
||||
Item.useAnimation = 10;
|
||||
Item.useTime = 10;
|
||||
Item.width = 32;
|
||||
Item.height = 32;
|
||||
Item.damage = 60;
|
||||
Item.DamageType = DamageClass.Melee;
|
||||
Item.knockBack = 7f;
|
||||
Item.UseSound = SoundID.Item1;
|
||||
Item.useTurn = true;
|
||||
Item.autoReuse = true;
|
||||
Item.noUseGraphic = true;
|
||||
Item.noMelee = true;
|
||||
|
||||
Item.shoot = ModContent.ProjectileType<SubmarineShockerProj>();
|
||||
Item.shootSpeed = 2f;
|
||||
Item.value = Item.buyPrice(0, 36, 0, 0);
|
||||
Item.rare = ItemRarityID.Pink;
|
||||
}
|
||||
|
||||
public override void MeleeEffects(Player player, Rectangle hitbox)
|
||||
{
|
||||
if (Main.rand.NextBool(5))
|
||||
{
|
||||
int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 226);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit)
|
||||
{
|
||||
var source = player.GetSource_ItemUse(Item);
|
||||
if (crit)
|
||||
damage /= 2;
|
||||
|
||||
Projectile.NewProjectile(source, target.Center, Vector2.Zero, ModContent.ProjectileType<Spark>(), (int)(damage * 0.7f), knockback, Main.myPlayer);
|
||||
}
|
||||
|
||||
public override void OnHitPvp(Player player, Player target, int damage, bool crit)
|
||||
{
|
||||
var source = player.GetSource_ItemUse(Item);
|
||||
if (crit)
|
||||
damage /= 2;
|
||||
|
||||
Projectile.NewProjectile(source, target.Center, Vector2.Zero, ModContent.ProjectileType<Spark>(), (int)(damage * 0.7f), Item.knockBack, Main.myPlayer);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,170 @@
|
||||
using CalamityMod.Items.Materials;
|
||||
using CalamityMod.Projectiles.Ranged;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using Terraria.Audio;
|
||||
using System.Linq;
|
||||
|
||||
namespace CalamityMod.Items.Weapons.Ranged
|
||||
{
|
||||
public class TheSevensStriker : ModItem
|
||||
{
|
||||
public static readonly SoundStyle RouletteSound = new("CalamityMod/Sounds/Item/SevensStrikerRoulette") { Volume = 0.6f, SoundLimitBehavior = SoundLimitBehavior.ReplaceOldest};
|
||||
public static readonly SoundStyle RouletteTickSound = new("CalamityMod/Sounds/Item/SevensStrikerRouletteTick") { Volume = 0.5f};
|
||||
|
||||
public static readonly SoundStyle BustSound = new("CalamityMod/Sounds/Item/SevensStrikerBust");
|
||||
public static readonly SoundStyle DoublesSound = new("CalamityMod/Sounds/Item/SevensStrikerDoubles");
|
||||
public static readonly SoundStyle TriplesSound = new("CalamityMod/Sounds/Item/SevensStrikerTriples");
|
||||
public static readonly SoundStyle JackpotSound = new("CalamityMod/Sounds/Item/SevensStrikerJackpot");
|
||||
public static readonly SoundStyle CoinSound = new("CalamityMod/Sounds/Item/SevensStrikerCoinShot") { MaxInstances = 0, PitchVariance = 0.5f };
|
||||
|
||||
public static int ShotCoin = 0;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
SacrificeTotal = 1;
|
||||
DisplayName.SetDefault("The Sevens Striker");
|
||||
Tooltip.SetDefault("'A gun given to a great gunslinger\n"+
|
||||
"Forged by the arms of a man given no name'\n"+
|
||||
"Consumes coins to power a slot machine with several different outcomes\n"+
|
||||
"Quality of the outcome depends on the coin inputted\n"+
|
||||
"Right click to rapidly fire a spread of coins\n"+
|
||||
"The gun refuses to fire platinum coins for its right click");
|
||||
ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.damage = 400;
|
||||
Item.knockBack = 9f;
|
||||
Item.useTime = 30;
|
||||
Item.useAnimation = 30;
|
||||
Item.DamageType = DamageClass.Ranged;
|
||||
Item.noMelee = true;
|
||||
Item.channel = true;
|
||||
Item.useTurn = true;
|
||||
Item.autoReuse = true;
|
||||
Item.width = 170;
|
||||
Item.height = 56;
|
||||
Item.useStyle = ItemUseStyleID.Shoot;
|
||||
Item.useAmmo = AmmoID.Coin;
|
||||
Item.shootSpeed = 24f;
|
||||
Item.reuseDelay = 0;
|
||||
Item.shoot = ProjectileID.PurificationPowder;
|
||||
Item.value = CalamityGlobalItem.Rarity12BuyPrice;
|
||||
Item.Calamity().customRarity = CalamityRarity.Turquoise;
|
||||
Item.Calamity().donorItem = true;
|
||||
}
|
||||
|
||||
public override bool AltFunctionUse(Player player) => true;
|
||||
|
||||
public override bool? UseItem(Player player)
|
||||
{
|
||||
if (player.altFunctionUse == 2)
|
||||
{
|
||||
long coinCount = Utils.CoinsCount(out bool overflow, player.inventory);
|
||||
|
||||
if (overflow || coinCount > 10000)
|
||||
{
|
||||
player.BuyItem(10000);
|
||||
ShotCoin = ProjectileID.GoldCoin;
|
||||
}
|
||||
else if (coinCount > 100)
|
||||
{
|
||||
player.BuyItem(100);
|
||||
ShotCoin = ProjectileID.SilverCoin;
|
||||
}
|
||||
else
|
||||
{
|
||||
player.BuyItem(1);
|
||||
ShotCoin = ProjectileID.CopperCoin;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Item.shoot = ModContent.ProjectileType<SevensStrikerHoldout>();
|
||||
}
|
||||
return base.UseItem(player);
|
||||
}
|
||||
public override bool CanConsumeAmmo(Item ammo, Player player) => player.altFunctionUse == 2 ? false : true;
|
||||
|
||||
public override Vector2? HoldoutOffset() => new Vector2(-30, -11);
|
||||
|
||||
|
||||
public override void UseAnimation(Player player)
|
||||
{
|
||||
if (player.altFunctionUse == 2f)
|
||||
{
|
||||
Item.UseSound = CoinSound;
|
||||
Item.noUseGraphic = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
Item.UseSound = null;
|
||||
Item.noUseGraphic = true;
|
||||
}
|
||||
}
|
||||
|
||||
public override float UseTimeMultiplier(Player player)
|
||||
{
|
||||
if (player.altFunctionUse == 2f)
|
||||
return 0.1f;
|
||||
|
||||
return 1f;
|
||||
}
|
||||
|
||||
public override bool CanUseItem(Player player)
|
||||
{
|
||||
if (player.ownedProjectileCounts[ModContent.ProjectileType<SevensStrikerHoldout>()] <= 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (player.altFunctionUse == 2)
|
||||
{
|
||||
Utils.CoinsCount(out bool overflow, player.inventory);
|
||||
return overflow;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
|
||||
{
|
||||
if (player.altFunctionUse == 2f)
|
||||
{
|
||||
Vector2 shootVelocity = velocity;
|
||||
Vector2 shootDirection = shootVelocity.SafeNormalize(Vector2.UnitX * player.direction);
|
||||
Vector2 gunTip = position + shootDirection * Item.scale * 90f;
|
||||
gunTip.Y -= 20f;
|
||||
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
float SpeedX = velocity.X + Main.rand.Next(-15, 16) * 0.05f;
|
||||
float SpeedY = velocity.Y + Main.rand.Next(-15, 16) * 0.05f;
|
||||
|
||||
Projectile.NewProjectile(source, gunTip.X, gunTip.Y, SpeedX, SpeedY, ShotCoin, (int)(damage * 0.07f), knockback, player.whoAmI);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType<SevensStrikerHoldout>(), damage * 7, knockback, player.whoAmI, type, 0f);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void AddRecipes()
|
||||
{
|
||||
CreateRecipe().
|
||||
AddIngredient(ItemID.CoinGun).
|
||||
AddIngredient<ClockGatlignum>(1).
|
||||
AddIngredient(ItemID.PlatinumCoin, 7).
|
||||
AddIngredient(ItemID.GoldCoin, 77).
|
||||
AddIngredient<TwistingNether>(2).
|
||||
AddIngredient(ItemID.LunarBar, 12).
|
||||
AddTile(TileID.LunarCraftingStation).
|
||||
Register();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 2.4 KiB |
@@ -23,11 +23,11 @@ namespace CalamityMod.Items.Weapons.Rogue
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.width = 80;
|
||||
Item.damage = 62;
|
||||
Item.damage = 25;
|
||||
Item.noMelee = true;
|
||||
Item.noUseGraphic = true;
|
||||
Item.useAnimation = 40;
|
||||
Item.useTime = 40;
|
||||
Item.useAnimation = 50;
|
||||
Item.useTime = 50;
|
||||
Item.useStyle = ItemUseStyleID.Swing;
|
||||
Item.knockBack = 4f;
|
||||
Item.UseSound = SoundID.Item1;
|
||||
@@ -45,8 +45,8 @@ namespace CalamityMod.Items.Weapons.Rogue
|
||||
{
|
||||
if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike
|
||||
{
|
||||
damage = (int)(damage * 0.8);
|
||||
int proj = Projectile.NewProjectile(source, position, velocity, type, damage / 2, knockback, player.whoAmI);
|
||||
damage = (int)(damage * 1.1);
|
||||
int proj = Projectile.NewProjectile(source, position, velocity * 1.1f, type, damage / 2, knockback, player.whoAmI);
|
||||
if (proj.WithinBounds(Main.maxProjectiles))
|
||||
{
|
||||
Main.projectile[proj].Calamity().stealthStrike = true;
|
||||
|
||||
@@ -0,0 +1,146 @@
|
||||
using Terraria.DataStructures;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using CalamityMod.Projectiles.Summon.SmallAresArms;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using CalamityMod.Particles;
|
||||
|
||||
namespace CalamityMod.Items.Weapons.Summon
|
||||
{
|
||||
public class AresExoskeleton : ModItem
|
||||
{
|
||||
public int FrameCounter = 0;
|
||||
|
||||
public int Frame = 0;
|
||||
|
||||
public const int BoxParticleLifetime = 95;
|
||||
|
||||
public const int PlasmaCannonShootRate = 30;
|
||||
|
||||
public const int TeslaCannonShootRate = 48;
|
||||
|
||||
public const int LaserCannonNormalShootRate = 30;
|
||||
|
||||
public const int GaussNukeShootRate = 210;
|
||||
|
||||
public const float TargetingDistance = 1020f;
|
||||
|
||||
public const float MinionSlotsPerCannon = 2f;
|
||||
|
||||
// Multiple orbs can arc together when there are 2+ tesla cannons, resulting in a LOT of hits.
|
||||
// The local i-frames are also quite high to combat this problem.
|
||||
public const float TeslaOrbDamageFactor = 0.625f;
|
||||
|
||||
public const float NukeDamageFactor = 1.5f;
|
||||
|
||||
public const float MaxNukeExplosionRadius = 720f;
|
||||
|
||||
public const float TeslaOrbDetatchDistance = 1500f;
|
||||
|
||||
public static bool ArmExists(Player player)
|
||||
{
|
||||
if (player.ownedProjectileCounts[ModContent.ProjectileType<ExoskeletonPlasmaCannon>()] >= 1)
|
||||
return true;
|
||||
if (player.ownedProjectileCounts[ModContent.ProjectileType<ExoskeletonTeslaCannon>()] >= 1)
|
||||
return true;
|
||||
if (player.ownedProjectileCounts[ModContent.ProjectileType<ExoskeletonLaserCannon>()] >= 1)
|
||||
return true;
|
||||
if (player.ownedProjectileCounts[ModContent.ProjectileType<ExoskeletonGaussNukeCannon>()] >= 1)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void Load()
|
||||
{
|
||||
// Add the body equip texture.
|
||||
if (Main.netMode != NetmodeID.Server)
|
||||
EquipLoader.AddEquipTexture(Mod, $"{Texture}_{EquipType.Body}", EquipType.Body, this);
|
||||
}
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Ares' Exoskeleton");
|
||||
Tooltip.SetDefault("Creates a panel with four slots and four choices above it: Plasma, Tesla, Laser, and Gauss\n" +
|
||||
"Clicking one of the choices and then clicking one of the slots allows you to summon a cannon that stays close to you and attacks nearby enemies\n" +
|
||||
"Clicking on a slot that's already occupied destroys its associated cannon and clears the slot\n" +
|
||||
$"Cannons take {MinionSlotsPerCannon} minion slots each");
|
||||
SacrificeTotal = 1;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.mana = 80;
|
||||
Item.damage = 672;
|
||||
Item.useStyle = ItemUseStyleID.HoldUp;
|
||||
Item.noUseGraphic = true;
|
||||
Item.width = Item.height = 36;
|
||||
Item.useTime = Item.useAnimation = 9;
|
||||
Item.noMelee = true;
|
||||
Item.knockBack = 1f;
|
||||
|
||||
Item.value = CalamityGlobalItem.RarityVioletBuyPrice;
|
||||
Item.Calamity().customRarity = CalamityRarity.Violet;
|
||||
|
||||
Item.UseSound = SoundID.Item117;
|
||||
Item.shoot = ModContent.ProjectileType<ExoskeletonPlasmaCannon>();
|
||||
Item.shootSpeed = 10f;
|
||||
Item.DamageType = DamageClass.Summon;
|
||||
}
|
||||
|
||||
public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frameI, Color drawColor, Color itemColor, Vector2 origin, float scale)
|
||||
{
|
||||
Texture2D texture = ModContent.Request<Texture2D>("CalamityMod/Items/Weapons/Summon/AresExoskeleton").Value;
|
||||
if (ArmExists(Main.LocalPlayer))
|
||||
{
|
||||
texture = ModContent.Request<Texture2D>("CalamityMod/Items/Weapons/Summon/AresExoskeletonRemote").Value;
|
||||
position.X += scale * 6f;
|
||||
}
|
||||
|
||||
spriteBatch.Draw(texture, position, new(0, 0, texture.Width, texture.Height), Color.White, 0f, origin, scale, 0, 0);
|
||||
return false;
|
||||
}
|
||||
|
||||
public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI)
|
||||
{
|
||||
Texture2D texture = ModContent.Request<Texture2D>("CalamityMod/Items/Weapons/Summon/AresExoskeleton").Value;
|
||||
spriteBatch.Draw(texture, Item.position - Main.screenPosition, Item.GetCurrentFrame(ref Frame, ref FrameCounter, 1, 1), lightColor, 0f, Vector2.Zero, 1f, 0, 0);
|
||||
return false;
|
||||
}
|
||||
|
||||
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
|
||||
{
|
||||
int panelID = ModContent.ProjectileType<ExoskeletonPanel>();
|
||||
|
||||
// If the player owns a panel, make it fade away.
|
||||
if (player.ownedProjectileCounts[panelID] >= 1)
|
||||
{
|
||||
for (int i = 0; i < Main.maxProjectiles; i++)
|
||||
{
|
||||
if (Main.projectile[i].type != panelID || Main.projectile[i].owner != player.whoAmI || !Main.projectile[i].active)
|
||||
continue;
|
||||
|
||||
Main.projectile[i].ai[0] = 1f;
|
||||
Main.projectile[i].netUpdate = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Otherwise, create one. While it doesn't do damage on its own, it does store it for reference by the cannons that might be spawned.
|
||||
else
|
||||
{
|
||||
int panel = Projectile.NewProjectile(source, position, Vector2.Zero, panelID, damage, 0f, player.whoAmI);
|
||||
if (Main.projectile.IndexInRange(panel))
|
||||
Main.projectile[panel].originalDamage = Item.damage;
|
||||
|
||||
// Also throw a cool mechanical box particle out.
|
||||
Vector2 boxVelocity = -Vector2.UnitY.RotatedByRandom(0.7f) * 6f + Vector2.UnitX * player.direction * 4f;
|
||||
Particle box = new AresSummonCrateParticle(player, boxVelocity, BoxParticleLifetime);
|
||||
GeneralParticleHandler.SpawnParticle(box);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 507 B |
|
After Width: | Height: | Size: 414 B |
|
After Width: | Height: | Size: 5.6 KiB |
@@ -1367,7 +1367,7 @@ namespace CalamityMod.NPCs
|
||||
break;
|
||||
|
||||
case NPCID.TheDestroyer:
|
||||
SetNewShopVariable(new int[] { NPCID.DD2Bartender, NPCID.Stylist, NPCID.Truffle, ModContent.NPCType<THIEF>() }, NPC.downedMechBossAny);
|
||||
SetNewShopVariable(new int[] { NPCID.DD2Bartender, NPCID.Stylist, NPCID.Truffle }, NPC.downedMechBossAny);
|
||||
SetNewShopVariable(new int[] { NPCID.Stylist, ModContent.NPCType<DILF>(), ModContent.NPCType<FAP>(), ModContent.NPCType<THIEF>() }, NPC.downedMechBoss1 || !NPC.downedMechBoss2 || !NPC.downedMechBoss3);
|
||||
SetNewBossJustDowned(npc);
|
||||
|
||||
@@ -1379,7 +1379,7 @@ namespace CalamityMod.NPCs
|
||||
case NPCID.Retinazer:
|
||||
if (lastTwinStanding)
|
||||
{
|
||||
SetNewShopVariable(new int[] { NPCID.DD2Bartender, NPCID.Stylist, NPCID.Truffle, ModContent.NPCType<THIEF>() }, NPC.downedMechBossAny);
|
||||
SetNewShopVariable(new int[] { NPCID.DD2Bartender, NPCID.Stylist, NPCID.Truffle }, NPC.downedMechBossAny);
|
||||
SetNewShopVariable(new int[] { NPCID.Stylist, ModContent.NPCType<DILF>(), ModContent.NPCType<FAP>(), ModContent.NPCType<THIEF>() }, !NPC.downedMechBoss1 || NPC.downedMechBoss2 || !NPC.downedMechBoss3);
|
||||
SetNewBossJustDowned(npc);
|
||||
|
||||
@@ -1389,7 +1389,7 @@ namespace CalamityMod.NPCs
|
||||
break;
|
||||
|
||||
case NPCID.SkeletronPrime:
|
||||
SetNewShopVariable(new int[] { NPCID.DD2Bartender, NPCID.Stylist, NPCID.Truffle, ModContent.NPCType<THIEF>() }, NPC.downedMechBossAny);
|
||||
SetNewShopVariable(new int[] { NPCID.DD2Bartender, NPCID.Stylist, NPCID.Truffle }, NPC.downedMechBossAny);
|
||||
SetNewShopVariable(new int[] { NPCID.Stylist, ModContent.NPCType<DILF>(), ModContent.NPCType<FAP>(), ModContent.NPCType<THIEF>() }, !NPC.downedMechBoss1 || !NPC.downedMechBoss2 || NPC.downedMechBoss3);
|
||||
SetNewBossJustDowned(npc);
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@ using Terraria.ModLoader;
|
||||
using Terraria.Audio;
|
||||
using Terraria.GameContent.ItemDropRules;
|
||||
using CalamityMod.Sounds;
|
||||
using CalamityMod.Items.Weapons.Summon;
|
||||
|
||||
namespace CalamityMod.NPCs.ExoMechs.Ares
|
||||
{
|
||||
@@ -185,8 +186,8 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
|
||||
//We'll probably want a custom background for Exos like ML has.
|
||||
//BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Exo,
|
||||
|
||||
// Will move to localization whenever that is cleaned up.
|
||||
new FlavorTextBestiaryInfoElement("While it is the most flamboyant of Draedon’s machines, it appears to be lacking some finish, though this trait does not compromise its killing potential whatsoever.")
|
||||
// Will move to localization whenever that is cleaned up.
|
||||
new FlavorTextBestiaryInfoElement("While it is the most flamboyant of Draedon’s machines, it appears to be lacking some finish, though this trait does not compromise its killing potential whatsoever.")
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1370,6 +1371,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
|
||||
// Ares weapons
|
||||
normalOnly.Add(ItemDropRule.ByCondition(DropHelper.If(AresLoot), ModContent.ItemType<PhotonRipper>()));
|
||||
normalOnly.Add(ItemDropRule.ByCondition(DropHelper.If(AresLoot), ModContent.ItemType<TheJailor>()));
|
||||
normalOnly.Add(ItemDropRule.ByCondition(DropHelper.If(AresLoot), ModContent.ItemType<AresExoskeleton>()));
|
||||
|
||||
// Twins weapons
|
||||
normalOnly.Add(ItemDropRule.ByCondition(DropHelper.If(ApolloLoot), ModContent.ItemType<TheAtomSplitter>()));
|
||||
|
||||
@@ -1514,8 +1514,6 @@ namespace CalamityMod.NPCs.Providence
|
||||
{
|
||||
CalamityGlobalNPC.SetNewBossJustDowned(NPC);
|
||||
|
||||
CalamityGlobalNPC.SetNewShopVariable(new int[] { ModContent.NPCType<THIEF>() }, DownedBossSystem.downedProvidence);
|
||||
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient && NPC.Top.Y >= (Main.maxTilesY - 240f) * 16f)
|
||||
SpawnLootBox();
|
||||
|
||||
|
||||
|
After Width: | Height: | Size: 912 B |
@@ -0,0 +1,52 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using System;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
|
||||
namespace CalamityMod.Particles
|
||||
{
|
||||
public class AresSummonCrateParticle : Particle
|
||||
{
|
||||
public override bool SetLifetime => true;
|
||||
public override string Texture => "CalamityMod/Particles/AresSummonCrate";
|
||||
public override bool UseCustomDraw => true;
|
||||
|
||||
public AresSummonCrateParticle(Player owner, Vector2 velocity, int lifetime)
|
||||
{
|
||||
Position = owner.Center - Vector2.UnitY * 4f;
|
||||
Scale = 1f;
|
||||
Color = Color.White;
|
||||
Velocity = velocity;
|
||||
Rotation = 0f;
|
||||
Lifetime = lifetime;
|
||||
}
|
||||
|
||||
public override void Update()
|
||||
{
|
||||
Rotation += Math.Sign(Velocity.X) * 0.05f;
|
||||
Velocity.X *= 0.95f;
|
||||
Velocity.Y += 0.24f;
|
||||
if (Collision.SolidCollision(Position - Vector2.One * Scale * 19f, (int)(Scale * 38f), (int)(Scale * 38f), true))
|
||||
{
|
||||
Velocity.X *= 0.8f;
|
||||
Rotation = 0f;
|
||||
Velocity.Y = 0f;
|
||||
}
|
||||
}
|
||||
|
||||
public override void CustomDraw(SpriteBatch spriteBatch)
|
||||
{
|
||||
Texture2D texture = GeneralParticleHandler.GetTexture(Type);
|
||||
Color lightColor = Lighting.GetColor(Position.ToTileCoordinates());
|
||||
|
||||
int frameY = (int)Math.Round(MathHelper.Lerp(0f, 2f, (float)Math.Pow(LifetimeCompletion, 0.16f)));
|
||||
Rectangle frame = texture.Frame(1, 3, 0, frameY);
|
||||
float opacity = MathHelper.Clamp(1f - (float)Math.Pow(LifetimeCompletion, 7f), 0f, 1f);
|
||||
spriteBatch.Draw(texture, Position - Main.screenPosition, frame, lightColor * opacity, Rotation, frame.Size() * 0.5f, Scale, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Terraria;
|
||||
using Terraria.Graphics.Shaders;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Particles.Metaballs
|
||||
{
|
||||
//This is basically just the Stream Gouge set but purple
|
||||
public class VoidGeneratorParticleSet : BaseFusableParticleSet
|
||||
{
|
||||
public override float BorderSize => 3f;
|
||||
public override bool BorderShouldBeSolid => false;
|
||||
public override Color BorderColor => Color.Lerp(Color.Purple, Color.Black, 0.75f) * 0.85f;
|
||||
|
||||
public override List<Effect> BackgroundShaders => new List<Effect>()
|
||||
{
|
||||
GameShaders.Misc["CalamityMod:BaseFusableParticleEdge"].Shader,
|
||||
};
|
||||
public override List<Texture2D> BackgroundTextures => new List<Texture2D>()
|
||||
{
|
||||
ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/ParticleBackgrounds/StreamGougeLayer").Value,
|
||||
};
|
||||
public override FusableParticle SpawnParticle(Vector2 center, float sizeStrength)
|
||||
{
|
||||
Particles.Add(new FusableParticle(center, sizeStrength));
|
||||
return Particles.Last();
|
||||
}
|
||||
|
||||
public override void UpdateBehavior(FusableParticle particle)
|
||||
{
|
||||
particle.Size = MathHelper.Clamp(particle.Size - 1f, 0f, 200f) * 0.98f;
|
||||
}
|
||||
|
||||
public override void PrepareOptionalShaderData(Effect effect, int index)
|
||||
{
|
||||
switch (index)
|
||||
{
|
||||
// Background.
|
||||
case 0:
|
||||
Vector2 offset = Vector2.UnitX * Main.GlobalTimeWrappedHourly * 0.045f;
|
||||
effect.Parameters["generalBackgroundOffset"].SetValue(offset);
|
||||
effect.Parameters["upscaleFactor"].SetValue(Vector2.One * -0.3f);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public override void DrawParticles()
|
||||
{
|
||||
Texture2D fusableParticleBase = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/FusableParticleBase").Value;
|
||||
foreach (FusableParticle particle in Particles)
|
||||
{
|
||||
Vector2 drawPosition = particle.Center - Main.screenPosition;
|
||||
Vector2 origin = fusableParticleBase.Size() * 0.5f;
|
||||
Vector2 scale = Vector2.One * particle.Size / fusableParticleBase.Size();
|
||||
Main.spriteBatch.Draw(fusableParticleBase, drawPosition, null, Color.White, 0f, origin, scale, SpriteEffects.None, 0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
using System;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
|
||||
@@ -12,11 +11,11 @@ namespace CalamityMod.Particles
|
||||
public override string Texture => "CalamityMod/Particles/WulfrumHat";
|
||||
public override bool UseCustomDraw => true;
|
||||
|
||||
public int Direction ;
|
||||
public int Direction;
|
||||
|
||||
public WulfrumHatParticle(Player owner, Vector2 velocity, int lifetime)
|
||||
{
|
||||
Position = owner.Center - Vector2.UnitY * 20f;;
|
||||
Position = owner.Center - Vector2.UnitY * 20f;
|
||||
Direction = owner.direction;
|
||||
Scale = 1f;
|
||||
Color = Color.White;
|
||||
|
||||
@@ -0,0 +1,129 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using Terraria;
|
||||
using Terraria.Enums;
|
||||
using Terraria.ModLoader;
|
||||
using static CalamityMod.CalamityUtils;
|
||||
|
||||
namespace CalamityMod.Projectiles.BaseProjectiles
|
||||
{
|
||||
public abstract class BaseShortswordProjectile : ModProjectile
|
||||
{
|
||||
public enum ShortswordType
|
||||
{
|
||||
TypicalShortsword
|
||||
}
|
||||
|
||||
|
||||
#region Virtual Values
|
||||
// Typical shortsword virtual values
|
||||
public virtual float FadeInDuration => 7f;
|
||||
public virtual float FadeOutDuration => 4f;
|
||||
public virtual float TotalDuration => 16f;
|
||||
public virtual Action<Projectile> EffectBeforePullback => null;
|
||||
public virtual ShortswordType ShortswordAIType => ShortswordType.TypicalShortsword;
|
||||
#endregion
|
||||
|
||||
public float CollisionWidth => 4f * Projectile.scale;
|
||||
public float FullUse => Timer / 14f;
|
||||
public Player Owner => Main.player[Projectile.owner];
|
||||
|
||||
|
||||
public int Timer
|
||||
{
|
||||
get => (int)Projectile.ai[0];
|
||||
set => Projectile.ai[0] = value;
|
||||
}
|
||||
public virtual void Behavior()
|
||||
{
|
||||
Player player = Main.player[Projectile.owner];
|
||||
|
||||
if (ShortswordAIType == ShortswordType.TypicalShortsword && !player.frozen)
|
||||
{
|
||||
player.direction = Projectile.direction;
|
||||
player.heldProj = Projectile.whoAmI;
|
||||
player.itemTime = player.itemAnimation;
|
||||
|
||||
|
||||
Timer += 1;
|
||||
if (Timer >= TotalDuration)
|
||||
{
|
||||
Projectile.Kill();
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
player.heldProj = Projectile.whoAmI;
|
||||
}
|
||||
|
||||
// Fade in and out
|
||||
Projectile.Opacity = Utils.GetLerpValue(0f, FadeInDuration, Timer, clamped: true) * Utils.GetLerpValue(TotalDuration, TotalDuration - FadeOutDuration, Timer, clamped: true);
|
||||
|
||||
// If we haven't done the special effect yet (assuming there is one), do it.
|
||||
// Note : Null Coalescing does not work in this case because we are invoking a method, not setting a value.
|
||||
if (Projectile.localAI[0] == 0f && EffectBeforePullback != null && Main.myPlayer == Projectile.owner)
|
||||
{
|
||||
Projectile.localAI[0] = 1f;
|
||||
EffectBeforePullback.Invoke(Projectile);
|
||||
}
|
||||
|
||||
// Keep locked onto the player, but extend further based on the given velocity (Requires ShouldUpdatePosition returning false to work)
|
||||
Vector2 playerCenter = player.RotatedRelativePoint(player.MountedCenter, reverseRotation: false, addGfxOffY: false);
|
||||
Projectile.Center = playerCenter + Projectile.velocity * (Timer - 1f);
|
||||
|
||||
// Rotate the sprite
|
||||
Projectile.Center = Owner.MountedCenter + OffsetFromPlayer;
|
||||
Projectile.scale = 1f + (float)Math.Sin(FullUse * MathHelper.Pi) * 0.2f;
|
||||
|
||||
// Set spriteDirection based on moving left or right. Left -1, right 1
|
||||
Projectile.spriteDirection = (Vector2.Dot(Projectile.velocity, Vector2.UnitX) >= 0f).ToDirectionInt();
|
||||
|
||||
// Point towards where it is moving, applied offset for top right of the sprite respecting spriteDirection
|
||||
Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2 - MathHelper.PiOver4 * Projectile.spriteDirection;
|
||||
|
||||
// The code in this method is important to align the sprite with the hitbox how we want it to
|
||||
SetVisualOffsets();
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void SetVisualOffsets() // Intentionally blank
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual void ExtraBehavior() // Intentionally blank
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Behavior();
|
||||
ExtraBehavior();
|
||||
}
|
||||
|
||||
public override bool ShouldUpdatePosition() => false;
|
||||
public CurveSegment ThrustSegment = new CurveSegment(LinearEasing, 0f, 0f, 1f, 3);
|
||||
public CurveSegment HoldSegment = new CurveSegment(SineBumpEasing, 0.2f, 1f, 0.2f);
|
||||
public CurveSegment RetractSegment = new CurveSegment(PolyOutEasing, 0.76f, 1f, -0.8f, 3);
|
||||
public CurveSegment BumpSegment = new CurveSegment(SineBumpEasing, 0.9f, 0.2f, 0.15f);
|
||||
internal float DistanceFromPlayer => PiecewiseAnimation(FullUse, new CurveSegment[] { ThrustSegment, HoldSegment, RetractSegment, BumpSegment });
|
||||
public Vector2 OffsetFromPlayer => Projectile.velocity * DistanceFromPlayer * 12f;
|
||||
|
||||
public override void CutTiles()
|
||||
{
|
||||
// "cutting tiles" refers to breaking pots, grass, queen bee larva, etc.
|
||||
DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile;
|
||||
Vector2 start = Projectile.Center;
|
||||
Vector2 end = start + Projectile.velocity.SafeNormalize(-Vector2.UnitY) * 10f;
|
||||
Utils.PlotTileLine(start, end, CollisionWidth, DelegateMethods.CutTiles);
|
||||
}
|
||||
|
||||
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox)
|
||||
{
|
||||
float collisionPoint = 0f;
|
||||
float bladeLenght = 12f * Projectile.scale;
|
||||
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.MountedCenter + OffsetFromPlayer, Owner.MountedCenter + OffsetFromPlayer + (Projectile.velocity * bladeLenght), 24, ref collisionPoint);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 1019 B After Width: | Height: | Size: 383 B |
@@ -94,7 +94,6 @@ namespace CalamityMod.Projectiles.Boss
|
||||
|
||||
Dust dust = Main.dust[num54];
|
||||
dust.velocity *= 3f;
|
||||
dust = Main.dust[num54];
|
||||
|
||||
num54 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 100, default, 0.8f);
|
||||
Main.dust[num54].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f;
|
||||
@@ -105,8 +104,6 @@ namespace CalamityMod.Projectiles.Boss
|
||||
Main.dust[num54].noGravity = true;
|
||||
Main.dust[num54].fadeIn = 1f;
|
||||
Main.dust[num54].color = Color.Green * 0.5f;
|
||||
|
||||
dust = Main.dust[num54];
|
||||
}
|
||||
for (int num55 = 0; num55 < 20; num55++)
|
||||
{
|
||||
@@ -122,7 +119,6 @@ namespace CalamityMod.Projectiles.Boss
|
||||
|
||||
Dust dust = Main.dust[num56];
|
||||
dust.velocity *= 0.5f;
|
||||
dust = Main.dust[num56];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,6 +81,9 @@ namespace CalamityMod.Projectiles
|
||||
/// </summary>
|
||||
public bool DealsDefenseDamage = false;
|
||||
|
||||
// Nihility Quiver
|
||||
public bool nihilicArrow = false;
|
||||
|
||||
// Rogue Stuff
|
||||
public bool stealthStrike = false;
|
||||
public int stealthStrikeHitCount = 0;
|
||||
@@ -2475,6 +2478,11 @@ namespace CalamityMod.Projectiles
|
||||
return new Color(255, 255, 255, projectile.alpha);
|
||||
}
|
||||
|
||||
if (projectile.Calamity().nihilicArrow)
|
||||
{
|
||||
return Color.Black;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using CalamityMod.Items.Weapons.Melee;
|
||||
using CalamityMod.Projectiles.Melee.Shortswords;
|
||||
using System;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
@@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
{
|
||||
if (Projectile.alpha < 170 && Projectile.alpha + 5 >= 170)
|
||||
{
|
||||
for (int num55 = 0; num55 < 8; num55++)
|
||||
for (int num55 = 0; num55 < 3; num55++)
|
||||
{
|
||||
int num56 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 234, Projectile.velocity.X * 0.005f, Projectile.velocity.Y * 0.005f, 200, default, 1f);
|
||||
Main.dust[num56].noGravity = true;
|
||||
@@ -73,7 +73,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
Projectile.Kill();
|
||||
}
|
||||
}
|
||||
if (Main.rand.NextBool(4))
|
||||
if (Main.rand.NextBool(10))
|
||||
{
|
||||
Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 234, Projectile.velocity.X * 0.005f, Projectile.velocity.Y * 0.005f);
|
||||
}
|
||||
@@ -81,7 +81,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
|
||||
public override void Kill(int timeLeft)
|
||||
{
|
||||
for (int k = 0; k < 3; k++)
|
||||
for (int k = 0; k < 1; k++)
|
||||
{
|
||||
Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 234, Projectile.oldVelocity.X * 0.005f, Projectile.oldVelocity.Y * 0.005f);
|
||||
}
|
||||
@@ -89,7 +89,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
|
||||
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
|
||||
{
|
||||
Main.player[Projectile.owner].GiveIFrames(Lucrecia.OnHitIFrames);
|
||||
Main.player[Projectile.owner].GiveIFrames(LucreciaProj.OnHitIFrames);
|
||||
target.immune[Projectile.owner] = 5;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using CalamityMod.Items.Weapons.Melee;
|
||||
using CalamityMod.Projectiles.Melee.Shortswords;
|
||||
using System;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
@@ -50,7 +50,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
{
|
||||
if (Projectile.alpha < 170 && Projectile.alpha + 5 >= 170)
|
||||
{
|
||||
for (int num55 = 0; num55 < 8; num55++)
|
||||
for (int num55 = 0; num55 < 3; num55++)
|
||||
{
|
||||
int num56 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 234, Projectile.velocity.X * 0.005f, Projectile.velocity.Y * 0.005f, 200, default, 1f);
|
||||
Main.dust[num56].noGravity = true;
|
||||
@@ -63,7 +63,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
Projectile.Kill();
|
||||
}
|
||||
}
|
||||
if (Main.rand.NextBool(4))
|
||||
if (Main.rand.NextBool(10))
|
||||
{
|
||||
Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 234, Projectile.velocity.X * 0.005f, Projectile.velocity.Y * 0.005f);
|
||||
}
|
||||
@@ -71,7 +71,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
|
||||
public override void Kill(int timeLeft)
|
||||
{
|
||||
for (int k = 0; k < 3; k++)
|
||||
for (int k = 0; k < 1; k++)
|
||||
{
|
||||
Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 234, Projectile.oldVelocity.X * 0.005f, Projectile.oldVelocity.Y * 0.005f);
|
||||
}
|
||||
@@ -79,7 +79,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
|
||||
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
|
||||
{
|
||||
Main.player[Projectile.owner].GiveIFrames(Lucrecia.OnHitIFrames);
|
||||
Main.player[Projectile.owner].GiveIFrames(LucreciaProj.OnHitIFrames);
|
||||
target.immune[Projectile.owner] = 5;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
Projectile.DamageType = DamageClass.Melee;
|
||||
Projectile.penetrate = 1;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.timeLeft = 120;
|
||||
Projectile.timeLeft = 60;
|
||||
Projectile.aiStyle = 27;
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
if (Projectile.timeLeft > 115)
|
||||
if (Projectile.timeLeft > 50)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
@@ -44,7 +44,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
|
||||
public override void Kill(int timeLeft)
|
||||
{
|
||||
for (int k = 0; k < 4; k++)
|
||||
for (int k = 0; k < 2; k++)
|
||||
{
|
||||
int rainbow = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 66, (float)(Projectile.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f);
|
||||
Main.dust[rainbow].noGravity = true;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using CalamityMod.Buffs.DamageOverTime;
|
||||
using CalamityMod.Buffs.DamageOverTime;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
@@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
Projectile.DamageType = DamageClass.Melee;
|
||||
Projectile.penetrate = 1;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.timeLeft = 600;
|
||||
Projectile.timeLeft = 90;
|
||||
Projectile.aiStyle = 27;
|
||||
Projectile.extraUpdates = 1;
|
||||
}
|
||||
@@ -30,7 +30,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
public override void AI()
|
||||
{
|
||||
if (Projectile.velocity.Length() < 25f && Projectile.timeLeft % 2 == 0)
|
||||
Projectile.velocity *= 1.04f;
|
||||
Projectile.velocity *= 2.08f;
|
||||
|
||||
int rainbow = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 66, (float)(Projectile.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.3f);
|
||||
Main.dust[rainbow].noGravity = true;
|
||||
@@ -52,7 +52,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
if (Projectile.timeLeft > 595)
|
||||
if (Projectile.timeLeft > 85)
|
||||
return false;
|
||||
|
||||
CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1);
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
using System;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using Microsoft.Xna.Framework;
|
||||
|
||||
using CalamityMod.Projectiles.BaseProjectiles;
|
||||
|
||||
namespace CalamityMod.Projectiles.Melee.Shortswords
|
||||
{
|
||||
public class AquaticDischargeProj: BaseShortswordProjectile
|
||||
{
|
||||
public override string Texture => "CalamityMod/Items/Weapons/Melee/AquaticDischarge";
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Aquatic Discharge");
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.Size = new Vector2(16);
|
||||
Projectile.friendly = true;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.scale = 1f;
|
||||
Projectile.DamageType = TrueMeleeDamageClass.Instance;
|
||||
Projectile.ownerHitCheck = true;
|
||||
Projectile.timeLeft = 360;
|
||||
Projectile.hide = true;
|
||||
Projectile.ownerHitCheck = true;
|
||||
}
|
||||
|
||||
public override void SetVisualOffsets()
|
||||
{
|
||||
const int HalfSpriteWidth = 32 / 2;
|
||||
const int HalfSpriteHeight = 32 / 2;
|
||||
|
||||
int HalfProjWidth = Projectile.width / 2;
|
||||
int HalfProjHeight = Projectile.height / 2;
|
||||
|
||||
DrawOriginOffsetX = 0;
|
||||
DrawOffsetX = -(HalfSpriteWidth - HalfProjWidth);
|
||||
DrawOriginOffsetY = -(HalfSpriteHeight - HalfProjHeight);
|
||||
}
|
||||
|
||||
public override void ExtraBehavior()
|
||||
{
|
||||
if (Main.rand.NextBool(5))
|
||||
Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Electric);
|
||||
}
|
||||
|
||||
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
|
||||
{
|
||||
Player player = Main.player[Projectile.owner];
|
||||
var source = Projectile.GetSource_FromThis();
|
||||
int sparkDamage = player.CalcIntDamage<MeleeDamageClass>(0.5f * Projectile.damage);
|
||||
Projectile.NewProjectile(source, target.Center, Vector2.Zero, ModContent.ProjectileType<Spark>(), sparkDamage, knockback, Main.myPlayer);
|
||||
}
|
||||
|
||||
public override void OnHitPvp(Player target, int damage, bool crit)
|
||||
{
|
||||
Player player = Main.player[Projectile.owner];
|
||||
var source = Projectile.GetSource_FromThis();
|
||||
int sparkDamage = player.CalcIntDamage<MeleeDamageClass>(0.5f * Projectile.damage);
|
||||
Projectile.NewProjectile(source, target.Center, Vector2.Zero, ModContent.ProjectileType<Spark>(), sparkDamage, Projectile.knockBack, Main.myPlayer);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using Microsoft.Xna.Framework;
|
||||
using CalamityMod.Buffs.DamageOverTime;
|
||||
using System;
|
||||
|
||||
using CalamityMod.Projectiles.BaseProjectiles;
|
||||
|
||||
namespace CalamityMod.Projectiles.Melee.Shortswords
|
||||
{
|
||||
public class CosmicShivProj : BaseShortswordProjectile
|
||||
{
|
||||
public override string Texture => "CalamityMod/Items/Weapons/Melee/CosmicShiv";
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Cosmic Shiv");
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.Size = new Vector2(24);
|
||||
Projectile.friendly = true;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.scale = 1f;
|
||||
Projectile.DamageType = TrueMeleeDamageClass.Instance;
|
||||
Projectile.ownerHitCheck = true;
|
||||
Projectile.timeLeft = 360;
|
||||
Projectile.extraUpdates = 1;
|
||||
Projectile.hide = true;
|
||||
Projectile.ownerHitCheck = true;
|
||||
}
|
||||
|
||||
public override Action<Projectile> EffectBeforePullback => (proj) =>
|
||||
{
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity * 14f, ModContent.ProjectileType<CosmicShivBall>(), (int)(Projectile.damage * 0.5), Projectile.knockBack, Projectile.owner, 0f, 0f);
|
||||
};
|
||||
|
||||
public override void SetVisualOffsets()
|
||||
{
|
||||
const int HalfSpriteWidth = 48 / 2;
|
||||
const int HalfSpriteHeight = 48 / 2;
|
||||
|
||||
int HalfProjWidth = Projectile.width / 2;
|
||||
int HalfProjHeight = Projectile.height / 2;
|
||||
|
||||
DrawOriginOffsetX = 0;
|
||||
DrawOffsetX = -(HalfSpriteWidth - HalfProjWidth);
|
||||
DrawOriginOffsetY = -(HalfSpriteHeight - HalfProjHeight);
|
||||
}
|
||||
|
||||
public override void ExtraBehavior()
|
||||
{
|
||||
Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 173);
|
||||
}
|
||||
|
||||
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
|
||||
{
|
||||
for (int k = 0; k < 36; k++)
|
||||
{
|
||||
int dustID = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height -16, 173, 0f, 0f, 0, default, 1f);
|
||||
Main.dust[dustID].velocity *= 3f;
|
||||
Main.dust[dustID].scale *= 2f;
|
||||
}
|
||||
|
||||
target.AddBuff(ModContent.BuffType<BrimstoneFlames>(), 120);
|
||||
target.AddBuff(BuffID.Frostburn, 120);
|
||||
target.AddBuff(ModContent.BuffType<HolyFlames>(), 120);
|
||||
target.AddBuff(ModContent.BuffType<GodSlayerInferno>(), 120);
|
||||
}
|
||||
|
||||
public override void OnHitPvp(Player target, int damage, bool crit)
|
||||
{
|
||||
for (int k = 0; k < 36; k++)
|
||||
{
|
||||
int dustID = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height - 16, 173, 0f, 0f, 0, default, 1f);
|
||||
Main.dust[dustID].velocity *= 3f;
|
||||
Main.dust[dustID].scale *= 2f;
|
||||
}
|
||||
|
||||
target.AddBuff(ModContent.BuffType<BrimstoneFlames>(), 120);
|
||||
target.AddBuff(BuffID.Frostburn, 120);
|
||||
target.AddBuff(ModContent.BuffType<HolyFlames>(), 120);
|
||||
target.AddBuff(ModContent.BuffType<GodSlayerInferno>(), 120);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using Microsoft.Xna.Framework;
|
||||
using CalamityMod.Buffs.DamageOverTime;
|
||||
using System;
|
||||
|
||||
using CalamityMod.Projectiles.BaseProjectiles;
|
||||
|
||||
namespace CalamityMod.Projectiles.Melee.Shortswords
|
||||
{
|
||||
public class ElementalShivProj: BaseShortswordProjectile
|
||||
{
|
||||
public override string Texture => "CalamityMod/Items/Weapons/Melee/ElementalShiv";
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Elemental Shiv"); // TODO: Make this one function like PiercingStarlight
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.Size = new Vector2(22);
|
||||
Projectile.friendly = true;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.scale = 1f;
|
||||
Projectile.DamageType = TrueMeleeDamageClass.Instance;
|
||||
Projectile.ownerHitCheck = true;
|
||||
Projectile.timeLeft = 360;
|
||||
Projectile.extraUpdates = 1;
|
||||
Projectile.hide = true;
|
||||
Projectile.ownerHitCheck = true;
|
||||
}
|
||||
|
||||
public override Action<Projectile> EffectBeforePullback => (proj) =>
|
||||
{
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity * 14f, ModContent.ProjectileType<ElementBallShiv>(), (int)(Projectile.damage * 0.5), Projectile.knockBack, Projectile.owner, 0f, 0f);
|
||||
};
|
||||
|
||||
public override void SetVisualOffsets()
|
||||
{
|
||||
const int HalfSpriteWidth = 44 / 2;
|
||||
const int HalfSpriteHeight = 44 / 2;
|
||||
|
||||
int HalfProjWidth = Projectile.width / 2;
|
||||
int HalfProjHeight = Projectile.height / 2;
|
||||
|
||||
DrawOriginOffsetX = 0;
|
||||
DrawOffsetX = -(HalfSpriteWidth - HalfProjWidth);
|
||||
DrawOriginOffsetY = -(HalfSpriteHeight - HalfProjHeight);
|
||||
}
|
||||
|
||||
public override void ExtraBehavior()
|
||||
{
|
||||
if (Main.rand.NextBool(5))
|
||||
{
|
||||
int num250 = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 66, (float)(Projectile.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.3f);
|
||||
Main.dust[num250].velocity *= 0.2f;
|
||||
Main.dust[num250].noGravity = true;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
|
||||
{
|
||||
target.AddBuff(ModContent.BuffType<BrimstoneFlames>(), 120);
|
||||
target.AddBuff(BuffID.Frostburn, 120);
|
||||
target.AddBuff(ModContent.BuffType<HolyFlames>(), 120);
|
||||
}
|
||||
|
||||
public override void OnHitPvp(Player target, int damage, bool crit)
|
||||
{
|
||||
target.AddBuff(ModContent.BuffType<BrimstoneFlames>(), 120);
|
||||
target.AddBuff(BuffID.Frostburn, 120);
|
||||
target.AddBuff(ModContent.BuffType<HolyFlames>(), 120);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using Microsoft.Xna.Framework;
|
||||
using CalamityMod.Buffs.DamageOverTime;
|
||||
using System;
|
||||
|
||||
using CalamityMod.Projectiles.BaseProjectiles;
|
||||
|
||||
namespace CalamityMod.Projectiles.Melee.Shortswords
|
||||
{
|
||||
public class GalileoGladiusProj : BaseShortswordProjectile
|
||||
{
|
||||
public override string Texture => "CalamityMod/Items/Weapons/Melee/GalileoGladius";
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Galileo Gladius"); // TODO: Make it function like Gladius, not like PiercingStarlight.
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.Size = new Vector2(24);
|
||||
Projectile.friendly = true;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.scale = 1f;
|
||||
Projectile.DamageType = TrueMeleeDamageClass.Instance;
|
||||
Projectile.ownerHitCheck = true;
|
||||
Projectile.timeLeft = 360;
|
||||
Projectile.extraUpdates = 1;
|
||||
Projectile.hide = true;
|
||||
Projectile.ownerHitCheck = true;
|
||||
}
|
||||
|
||||
public override Action<Projectile> EffectBeforePullback => (proj) =>
|
||||
{
|
||||
int moonDamage = (int)(Projectile.damage * 0.3333f);
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity * 10f, ModContent.ProjectileType<GalileosMoon>(), moonDamage, Projectile.knockBack, Projectile.owner, 0f, 0f);
|
||||
};
|
||||
|
||||
public override void SetVisualOffsets()
|
||||
{
|
||||
const int HalfSpriteWidth = 42 / 2;
|
||||
const int HalfSpriteHeight = 46 / 2;
|
||||
|
||||
int HalfProjWidth = Projectile.width / 2;
|
||||
int HalfProjHeight = Projectile.height / 2;
|
||||
|
||||
DrawOriginOffsetX = 0;
|
||||
DrawOffsetX = -(HalfSpriteWidth - HalfProjWidth);
|
||||
DrawOriginOffsetY = -(HalfSpriteHeight - HalfProjHeight);
|
||||
}
|
||||
|
||||
public override void ExtraBehavior()
|
||||
{
|
||||
if (Main.rand.NextBool(5))
|
||||
{
|
||||
int num250 = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, (Main.rand.NextBool(2) ? 20 : 176), (float)(Main.player[Projectile.owner].direction * 2), 0f, 150, default, 1.3f);
|
||||
Main.dust[num250].velocity *= 0.2f;
|
||||
Main.dust[num250].noGravity = true;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
|
||||
{
|
||||
target.AddBuff(ModContent.BuffType<Nightwither>(), 300);
|
||||
SpawnMeteor(Main.player[Projectile.owner]);
|
||||
}
|
||||
|
||||
public override void OnHitPvp(Player target, int damage, bool crit)
|
||||
{
|
||||
target.AddBuff(ModContent.BuffType<Nightwither>(), 300);
|
||||
SpawnMeteor(Main.player[Projectile.owner]);
|
||||
}
|
||||
|
||||
private void SpawnMeteor(Player player)
|
||||
{
|
||||
if (player.whoAmI == Main.myPlayer)
|
||||
{
|
||||
var source = player.GetSource_FromThis();
|
||||
if (player.Calamity().galileoCooldown <= 0)
|
||||
{
|
||||
int damage = player.GetWeaponDamage(player.ActiveItem()) * 2;
|
||||
CalamityUtils.ProjectileRain(source, player.Center, 400f, 100f, 500f, 800f, 25f, ModContent.ProjectileType<GalileosPlanet>(), damage, 15f, player.whoAmI);
|
||||
player.Calamity().galileoCooldown = 15;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using CalamityMod.Projectiles.BaseProjectiles;
|
||||
|
||||
namespace CalamityMod.Projectiles.Melee.Shortswords
|
||||
{
|
||||
public class LucreciaProj: BaseShortswordProjectile
|
||||
{
|
||||
public const int OnHitIFrames = 5;
|
||||
public override string Texture => "CalamityMod/Items/Weapons/Melee/Lucrecia";
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Lucrecia");
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.Size = new Vector2(31);
|
||||
Projectile.friendly = true;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.scale = 1f;
|
||||
Projectile.DamageType = TrueMeleeDamageClass.Instance;
|
||||
Projectile.ownerHitCheck = true;
|
||||
Projectile.timeLeft = 360;
|
||||
Projectile.hide = true;
|
||||
Projectile.ownerHitCheck = true;
|
||||
}
|
||||
|
||||
public override Action<Projectile> EffectBeforePullback => (proj) =>
|
||||
{
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity * 12f, ModContent.ProjectileType<DNA>(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f);
|
||||
};
|
||||
|
||||
|
||||
public override void SetVisualOffsets()
|
||||
{
|
||||
const int HalfSpriteWidth = 62 / 2;
|
||||
const int HalfSpriteHeight = 62 / 2;
|
||||
|
||||
int HalfProjWidth = Projectile.width / 2;
|
||||
int HalfProjHeight = Projectile.height / 2;
|
||||
|
||||
DrawOriginOffsetX = 0;
|
||||
DrawOffsetX = -(HalfSpriteWidth - HalfProjWidth);
|
||||
DrawOriginOffsetY = -(HalfSpriteHeight - HalfProjHeight);
|
||||
}
|
||||
|
||||
public override void ExtraBehavior()
|
||||
{
|
||||
if (Main.rand.NextBool(5))
|
||||
Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.BoneTorch);
|
||||
}
|
||||
|
||||
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
|
||||
{
|
||||
Main.player[Projectile.owner].GiveIFrames(OnHitIFrames, false);
|
||||
}
|
||||
|
||||
public override void OnHitPvp(Player target, int damage, bool crit)
|
||||
{
|
||||
Player player = Main.player[Projectile.owner];
|
||||
bool isImmune = false;
|
||||
for (int j = 0; j < player.hurtCooldowns.Length; j++)
|
||||
{
|
||||
if (player.hurtCooldowns[j] > 0)
|
||||
isImmune = true;
|
||||
}
|
||||
if (!isImmune)
|
||||
{
|
||||
Owner.GiveIFrames(OnHitIFrames, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using Microsoft.Xna.Framework;
|
||||
|
||||
using CalamityMod.Projectiles.BaseProjectiles;
|
||||
|
||||
namespace CalamityMod.Projectiles.Melee.Shortswords
|
||||
{
|
||||
public class SubmarineShockerProj: BaseShortswordProjectile
|
||||
{
|
||||
public override string Texture => "CalamityMod/Items/Weapons/Melee/SubmarineShocker";
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Submarine Shocker");
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.Size = new Vector2(16);
|
||||
Projectile.friendly = true;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.scale = 1f;
|
||||
Projectile.DamageType = TrueMeleeDamageClass.Instance;
|
||||
Projectile.ownerHitCheck = true;
|
||||
Projectile.timeLeft = 360;
|
||||
Projectile.hide = true;
|
||||
Projectile.ownerHitCheck = true;
|
||||
}
|
||||
|
||||
public override void SetVisualOffsets()
|
||||
{
|
||||
const int HalfSpriteWidth = 32 / 2;
|
||||
const int HalfSpriteHeight = 32 / 2;
|
||||
|
||||
int HalfProjWidth = Projectile.width / 2;
|
||||
int HalfProjHeight = Projectile.height / 2;
|
||||
|
||||
DrawOriginOffsetX = 0;
|
||||
DrawOffsetX = -(HalfSpriteWidth - HalfProjWidth);
|
||||
DrawOriginOffsetY = -(HalfSpriteHeight - HalfProjHeight);
|
||||
}
|
||||
|
||||
public override void ExtraBehavior()
|
||||
{
|
||||
if (Main.rand.NextBool(5))
|
||||
Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Electric);
|
||||
}
|
||||
|
||||
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
|
||||
{
|
||||
var source = Projectile.GetSource_FromThis();
|
||||
if (crit)
|
||||
damage /= 2;
|
||||
Projectile.NewProjectile(source, target.Center, Vector2.Zero, ModContent.ProjectileType<Spark>(), (int)(damage * 0.7f), knockback, Main.myPlayer);
|
||||
}
|
||||
|
||||
public override void OnHitPvp(Player target, int damage, bool crit)
|
||||
{
|
||||
var source = Projectile.GetSource_FromThis();
|
||||
if (crit)
|
||||
damage /= 2;
|
||||
Projectile.NewProjectile(source, target.Center, Vector2.Zero, ModContent.ProjectileType<Spark>(), (int)(damage * 0.7f), Projectile.knockBack, Main.myPlayer);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
using Terraria.ID;
|
||||
using Terraria.Audio;
|
||||
|
||||
namespace CalamityMod.Projectiles.Ranged
|
||||
{
|
||||
public class SevensStrikerBrick : ModProjectile
|
||||
{
|
||||
public override string Texture => "CalamityMod/Items/Weapons/Rogue/ThrowingBrick";
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Brick");
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 19;
|
||||
Projectile.height = 19;
|
||||
Projectile.friendly = true;
|
||||
Projectile.DamageType = DamageClass.Ranged;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
//Constant rotation and gravity
|
||||
Projectile.rotation += 0.4f * Projectile.direction;
|
||||
Projectile.velocity.Y = Projectile.velocity.Y + 0.3f;
|
||||
if (Projectile.velocity.Y > 16f)
|
||||
{
|
||||
Projectile.velocity.Y = 16f;
|
||||
}
|
||||
//Dust trail
|
||||
if (Main.rand.NextBool(13))
|
||||
{
|
||||
Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 22, Projectile.velocity.X * 0.25f, Projectile.velocity.Y * 0.25f, 150, default, 0.9f);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Kill(int timeLeft)
|
||||
{
|
||||
SoundEngine.PlaySound(SoundID.Item50, Projectile.position);
|
||||
//Dust on impact
|
||||
int dust_splash = 0;
|
||||
while (dust_splash < 9)
|
||||
{
|
||||
Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 9, -Projectile.velocity.X * 0.15f, -Projectile.velocity.Y * 0.15f, 120, default, 1.5f);
|
||||
dust_splash += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using Terraria.Audio;
|
||||
|
||||
namespace CalamityMod.Projectiles.Ranged
|
||||
{
|
||||
public class SevensStrikerCherry : ModProjectile
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Cherry");
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 20;
|
||||
Projectile.height = 20;
|
||||
Projectile.friendly = true;
|
||||
Projectile.DamageType = DamageClass.Ranged;
|
||||
Projectile.timeLeft = 480;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Projectile.rotation += 0.1f * Projectile.direction;
|
||||
}
|
||||
|
||||
public override void Kill(int timeLeft)
|
||||
{
|
||||
if (Projectile.owner == Main.myPlayer)
|
||||
{
|
||||
for (int f = 0; f < 3; f++)
|
||||
{
|
||||
Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f);
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType<SevensStrikerCherrySplit>(), (int)(Projectile.damage * 0.4), 0f, Projectile.owner);
|
||||
}
|
||||
}
|
||||
SoundEngine.PlaySound(SoundID.NPCDeath1, Projectile.position);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 492 B |
@@ -0,0 +1,32 @@
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Ranged
|
||||
{
|
||||
public class SevensStrikerCherrySplit : ModProjectile
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Cherry");
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 20;
|
||||
Projectile.height = 20;
|
||||
Projectile.friendly = true;
|
||||
Projectile.DamageType = DamageClass.Ranged;
|
||||
Projectile.timeLeft = 240;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Projectile.rotation += 0.4f * Projectile.direction;
|
||||
Projectile.velocity.Y += 0.2f;
|
||||
if (Projectile.velocity.Y > 16f)
|
||||
{
|
||||
Projectile.velocity.Y = 16f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 377 B |
@@ -0,0 +1,28 @@
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Ranged
|
||||
{
|
||||
public class SevensStrikerGrape : ModProjectile
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Grapes");
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 20;
|
||||
Projectile.height = 20;
|
||||
Projectile.friendly = true;
|
||||
Projectile.DamageType = DamageClass.Ranged;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.timeLeft = 480;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Projectile.rotation += 0.1f * Projectile.direction;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 478 B |
@@ -0,0 +1,342 @@
|
||||
using CalamityMod.Sounds;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using CalamityMod.Items.Weapons.Ranged;
|
||||
using ReLogic.Utilities;
|
||||
|
||||
namespace CalamityMod.Projectiles.Ranged
|
||||
{
|
||||
public class SevensStrikerHoldout : ModProjectile
|
||||
{
|
||||
public bool rolling = true; // If the slot machine is currently rolling
|
||||
public bool shotonce = false; // So that the first shot doesn't consume two ammo
|
||||
public int shottimer = 0; // Solely exists so that the Platinum shots aren't instantaneous
|
||||
public int rolltimer = 60; // Cooldown for the slot machine so that it doesn't instantly role
|
||||
public int soundtimer = 0; // Counts how long the slot machine has been spinning + the cooldown
|
||||
|
||||
public SlotId RouletteSoundSlot;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Sevens Striker");
|
||||
Main.projFrames[Projectile.type] = 19;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 160;
|
||||
Projectile.height = 62;
|
||||
Projectile.friendly = true;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.DamageType = DamageClass.Ranged;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.alpha = 255;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Player player = Main.player[Projectile.owner];
|
||||
Vector2 playerpos = player.RotatedRelativePoint(player.MountedCenter, true);
|
||||
bool shouldBeHeld = player.channel && !player.noItems && !player.CCed;
|
||||
|
||||
int shot = ProjectileID.CopperCoin;
|
||||
float scaleFactor = 14f;
|
||||
int weaponDamage = player.GetWeaponDamage(player.ActiveItem());
|
||||
float weaponKnockback = player.ActiveItem().knockBack;
|
||||
|
||||
// Consumes a coin, stores it, then calculates what effect will be executed
|
||||
if (Projectile.ai[1] == 0)
|
||||
{
|
||||
// These checks are here so that the weapon doesn't consume two coins when first used
|
||||
if (shotonce)
|
||||
{
|
||||
if (player.PickAmmo(player.ActiveItem(), out shot, out scaleFactor, out weaponDamage, out weaponKnockback, out _))
|
||||
{
|
||||
Projectile.ai[0] = shot;
|
||||
Projectile.ai[1] = CalculateOutcome();
|
||||
}
|
||||
else
|
||||
{
|
||||
Projectile.Kill();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Projectile.ai[1] = CalculateOutcome();
|
||||
shotonce = true;
|
||||
}
|
||||
}
|
||||
|
||||
rolltimer--;
|
||||
soundtimer++;
|
||||
|
||||
// While the slot machine is rolling, play the animation
|
||||
if (rolling)
|
||||
{
|
||||
Projectile.frameCounter++;
|
||||
}
|
||||
// Make sure that it defaults at frame 1
|
||||
else
|
||||
{
|
||||
Projectile.frame = 0;
|
||||
}
|
||||
if (Projectile.frameCounter > 6)
|
||||
{
|
||||
Projectile.frame++;
|
||||
Projectile.frameCounter = 0;
|
||||
}
|
||||
// Once the animation is finished, stop rolling, set the extra timer to 16 frames, and reset the sprite to frame 0
|
||||
if (Projectile.frame >= Main.projFrames[Projectile.type])
|
||||
{
|
||||
rolling = false;
|
||||
rolltimer = 16;
|
||||
Projectile.frame = 0;
|
||||
}
|
||||
|
||||
if (Main.myPlayer == Projectile.owner)
|
||||
{
|
||||
if (shouldBeHeld && Projectile.ai[1] != 0)
|
||||
{
|
||||
// Holdout stuff
|
||||
float holdscale = player.ActiveItem().shootSpeed * Projectile.scale;
|
||||
Vector2 playerpos2 = playerpos;
|
||||
Vector2 going = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - playerpos2;
|
||||
if (player.gravDir == -1f)
|
||||
{
|
||||
going.Y = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - playerpos2.Y;
|
||||
}
|
||||
Vector2 normalizedgoing = Vector2.Normalize(going);
|
||||
if (float.IsNaN(normalizedgoing.X) || float.IsNaN(normalizedgoing.Y))
|
||||
{
|
||||
normalizedgoing = -Vector2.UnitY;
|
||||
}
|
||||
normalizedgoing *= holdscale;
|
||||
if (normalizedgoing.X != Projectile.velocity.X || normalizedgoing.Y != Projectile.velocity.Y)
|
||||
{
|
||||
Projectile.netUpdate = true;
|
||||
}
|
||||
Projectile.velocity = normalizedgoing * 0.55f;
|
||||
|
||||
// If the animation isn't playing and the cooldown timer is at or below 0
|
||||
if (!rolling && rolltimer <= 0)
|
||||
{
|
||||
//Jackpot gets special benefits since it shoots multiple rounds
|
||||
if (Projectile.ai[1] == 4)
|
||||
{
|
||||
shottimer++;
|
||||
// Play a sound and display the jackpot text
|
||||
if (shottimer == 1)
|
||||
{
|
||||
SoundEngine.PlaySound(TheSevensStriker.JackpotSound, Projectile.Center);
|
||||
CombatText.NewText(player.getRect(), Color.Gold, "Jackpot!!!", true);
|
||||
}
|
||||
// Every 5 frames, shoot 7 coins. The first 5 frames are excluded for timing purposes
|
||||
if (shottimer % 5 == 0 && shottimer > 5)
|
||||
{
|
||||
Shoot(7, ModContent.ProjectileType<SevensStrikerPlatinumCoin>(), weaponDamage, weaponKnockback, (int)scaleFactor * 2f, 0.3f);
|
||||
SoundEngine.PlaySound(TheSevensStriker.CoinSound, Projectile.Center);
|
||||
}
|
||||
// After 7 waves have been shot, reset the gun and roll again
|
||||
if (shottimer > 40)
|
||||
{
|
||||
soundtimer = 0;
|
||||
rolling = true;
|
||||
Projectile.ai[1] = 0;
|
||||
shottimer = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
shottimer++;
|
||||
|
||||
if (shottimer == 1)
|
||||
{
|
||||
// The other three outcomes
|
||||
switch (Projectile.ai[1])
|
||||
{
|
||||
// A single brick that deals 10% damage
|
||||
case 1:
|
||||
Shoot(1, ModContent.ProjectileType<SevensStrikerBrick>(), (int)(Projectile.damage * 0.1f), 0, 2f, 0);
|
||||
CombatText.NewText(player.getRect(), Color.Gray, "Bust!", true);
|
||||
SoundEngine.PlaySound(TheSevensStriker.BustSound, Projectile.Center);
|
||||
break;
|
||||
// 7 exploding oranges
|
||||
case 2:
|
||||
Shoot(7, ModContent.ProjectileType<SevensStrikerOrange>(), Projectile.damage, Projectile.knockBack, 2f, 0.2f);
|
||||
CombatText.NewText(player.getRect(), Color.Orange, "Doubles!", true);
|
||||
SoundEngine.PlaySound(TheSevensStriker.DoublesSound, Projectile.Center);
|
||||
break;
|
||||
// 7 piercing grapes with 7 tighter splitting cherries
|
||||
case 3:
|
||||
Shoot(7, ModContent.ProjectileType<SevensStrikerCherry>(), Projectile.damage, Projectile.knockBack, 1.5f, 0.1f);
|
||||
Shoot(7, ModContent.ProjectileType<SevensStrikerGrape>(), Projectile.damage, Projectile.knockBack, 2f, 0.2f);
|
||||
CombatText.NewText(player.getRect(), Color.Red, "Triples!", true);
|
||||
SoundEngine.PlaySound(TheSevensStriker.TriplesSound, Projectile.Center);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Reset the gun and roll again
|
||||
if (shottimer > 16)
|
||||
{
|
||||
soundtimer = 0;
|
||||
rolling = true;
|
||||
Projectile.ai[1] = 0;
|
||||
shottimer = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// If the player can't use the gun, KILL it
|
||||
else
|
||||
{
|
||||
Projectile.Kill();
|
||||
}
|
||||
}
|
||||
|
||||
// Sounds
|
||||
// Crank & new casino
|
||||
if (Projectile.frameCounter == 0 && Projectile.frame == 2 * (Main.projFrames[Projectile.type] / 19))
|
||||
{
|
||||
SoundEngine.PlaySound(SoundID.Item108 with { Volume = SoundID.Item108.Volume * 0.9f }, Projectile.Center);
|
||||
RouletteSoundSlot = SoundEngine.PlaySound(TheSevensStriker.RouletteSound, Projectile.Center);
|
||||
}
|
||||
// Clicks for when each slot is finished
|
||||
if (soundtimer == 96 || soundtimer == 108 || soundtimer == 120)
|
||||
{
|
||||
SoundEngine.PlaySound(TheSevensStriker.RouletteTickSound, Projectile.Center);
|
||||
}
|
||||
|
||||
// Holdout stuff
|
||||
Projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - Projectile.Size / 2f;
|
||||
Projectile.rotation = Projectile.velocity.ToRotation();
|
||||
Projectile.spriteDirection = Projectile.direction;
|
||||
Projectile.timeLeft = 2;
|
||||
player.ChangeDir(Projectile.direction);
|
||||
player.heldProj = Projectile.whoAmI;
|
||||
player.itemTime = 2;
|
||||
player.itemAnimation = 2;
|
||||
player.itemRotation = (float)Math.Atan2((double)(Projectile.velocity.Y * (float)Projectile.direction), (double)(Projectile.velocity.X * (float)Projectile.direction));
|
||||
}
|
||||
|
||||
// Calculates which attack will occur based on coin.
|
||||
public int CalculateOutcome()
|
||||
{
|
||||
switch (Projectile.ai[0])
|
||||
{
|
||||
// Copper Coins have:
|
||||
// 50% chance for a brick
|
||||
// 30% chance for oranges
|
||||
// 15% chance for grapes and cherries
|
||||
// 5% chance for a jackpot
|
||||
case ProjectileID.CopperCoin:
|
||||
{
|
||||
int roll = Main.rand.Next(100);
|
||||
if (roll <= 50)
|
||||
return 1;
|
||||
else if (roll > 50 && roll <= 80)
|
||||
return 2;
|
||||
else if (roll > 80 && roll <= 95)
|
||||
return 3;
|
||||
else
|
||||
return 4;
|
||||
}
|
||||
// Silver Coins have:
|
||||
// 20% chance for a brick
|
||||
// 50% chance for oranges
|
||||
// 20% chance for grapes and cherries
|
||||
// 10% chance for a jackpot
|
||||
case ProjectileID.SilverCoin:
|
||||
{
|
||||
int roll = Main.rand.Next(100);
|
||||
if (roll <= 20)
|
||||
return 1;
|
||||
else if (roll > 20 && roll <= 70)
|
||||
return 2;
|
||||
else if (roll > 70 && roll <= 90)
|
||||
return 3;
|
||||
else
|
||||
return 4;
|
||||
}
|
||||
// Gold Coins have:
|
||||
// 5% chance for a brick
|
||||
// 30% chance for oranges
|
||||
// 50% chance for grapes and cherries
|
||||
// 15% chance for a jackpot
|
||||
case ProjectileID.GoldCoin:
|
||||
{
|
||||
int roll = Main.rand.Next(100);
|
||||
if (roll <= 5)
|
||||
return 1;
|
||||
else if (roll > 5 && roll <= 35)
|
||||
return 2;
|
||||
else if (roll > 35 && roll <= 85)
|
||||
return 3;
|
||||
else
|
||||
return 4;
|
||||
}
|
||||
// Platinum Coins are a guaranteed jackpot
|
||||
case ProjectileID.PlatinumCoin:
|
||||
return 4;
|
||||
}
|
||||
// This should never be returned
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Where the shooting takes place (wow!)
|
||||
public void Shoot(int projcount, int type, int damage, float kb, float scaleFactor, float spreadfactor)
|
||||
{
|
||||
Player player = Main.player[Projectile.owner];
|
||||
Vector2 armPosition = player.RotatedRelativePoint(player.MountedCenter, true);
|
||||
armPosition += Projectile.velocity.SafeNormalize(player.direction * Vector2.UnitX) * 32f;
|
||||
armPosition.Y -= 20f;
|
||||
Vector2 shootDirection = (Main.MouseWorld - Projectile.Center).SafeNormalize(-Vector2.UnitY);
|
||||
Vector2 gunTip = armPosition + shootDirection * player.ActiveItem().scale * 90f;
|
||||
for (int i = 0; i < projcount; ++i)
|
||||
{
|
||||
Vector2 perturbedSpeed = Projectile.velocity.RotatedBy(MathHelper.Lerp(-spreadfactor, spreadfactor, i / 7f)) * scaleFactor;
|
||||
int p = Projectile.NewProjectile(Projectile.GetSource_FromThis(), gunTip, perturbedSpeed, type, damage, kb, Main.player[Projectile.owner].whoAmI);
|
||||
if (Main.projectile.IndexInRange(p))
|
||||
Main.projectile[p].originalDamage = damage;
|
||||
|
||||
}
|
||||
}
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
Player Owner = Main.player[Projectile.owner];
|
||||
Texture2D gun = ModContent.Request<Texture2D>("CalamityMod/Projectiles/Ranged/SevensStrikerHoldout").Value;
|
||||
|
||||
SpriteEffects flip = Projectile.direction < 0 ? SpriteEffects.FlipHorizontally : SpriteEffects.None;
|
||||
|
||||
float drawAngle = Projectile.rotation + (Owner.direction < 0 ? MathHelper.Pi : 0);
|
||||
Vector2 drawOrigin = new Vector2(Owner.direction < 0 ? gun.Width - 33f : 33f, 33f);
|
||||
Vector2 drawOffset = Owner.MountedCenter + Projectile.rotation.ToRotationVector2() - Main.screenPosition;
|
||||
drawOffset.Y -= 10;
|
||||
int indframeheight = gun.Height / Main.projFrames[Projectile.type];
|
||||
int currentframe = indframeheight * Projectile.frame;
|
||||
Rectangle frame = new Rectangle(0, currentframe, gun.Width, indframeheight);
|
||||
|
||||
Main.EntitySpriteDraw(gun, drawOffset, frame, lightColor, drawAngle, drawOrigin, Projectile.scale, flip, 0);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void Kill(int timeLeft)
|
||||
{
|
||||
if (SoundEngine.TryGetActiveSound(RouletteSoundSlot, out var dringdring))
|
||||
{
|
||||
dringdring.Stop();
|
||||
}
|
||||
|
||||
Main.player[Projectile.owner].SetDummyItemTime(12);
|
||||
}
|
||||
|
||||
public override bool? CanDamage() => false;
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 39 KiB |
@@ -0,0 +1,54 @@
|
||||
using CalamityMod.Particles;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Ranged
|
||||
{
|
||||
public class SevensStrikerOrange : ModProjectile
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Orange");
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 20;
|
||||
Projectile.height = 20;
|
||||
Projectile.friendly = true;
|
||||
Projectile.DamageType = DamageClass.Ranged;
|
||||
Projectile.usesIDStaticNPCImmunity = true;
|
||||
Projectile.idStaticNPCHitCooldown = 1;
|
||||
Projectile.timeLeft = 480;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Projectile.rotation += 0.1f * Projectile.direction;
|
||||
Projectile.velocity.Y += 0.2f;
|
||||
if (Projectile.velocity.Y > 16f)
|
||||
{
|
||||
Projectile.velocity.Y = 16f;
|
||||
}
|
||||
}
|
||||
|
||||
public override void Kill(int timeLeft)
|
||||
{
|
||||
Projectile.position = Projectile.Center;
|
||||
Projectile.width = Projectile.height = 48;
|
||||
Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2);
|
||||
Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2);
|
||||
SoundEngine.PlaySound(SoundID.Item14, Projectile.Center);
|
||||
//Explosion copied over from another ranged orange explosive gravity-affected plant projectile
|
||||
for (int i = 0; i < 15; i++)
|
||||
{
|
||||
Particle smoke = new SmallSmokeParticle(Projectile.Center + Main.rand.NextVector2Circular(15f, 15f), Vector2.Zero, Color.Orange, new Color(40, 40, 40), Main.rand.NextFloat(0.8f, 1.6f), 145 - Main.rand.Next(30));
|
||||
smoke.Velocity = (smoke.Position - Projectile.Center) * 0.2f + Projectile.velocity;
|
||||
GeneralParticleHandler.SpawnParticle(smoke);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 517 B |
@@ -0,0 +1,30 @@
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Ranged
|
||||
{
|
||||
public class SevensStrikerPlatinumCoin : ModProjectile
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Platinum Coin");
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.CloneDefaults(ProjectileID.PlatinumCoin);
|
||||
Projectile.DamageType = DamageClass.Ranged;
|
||||
Projectile.aiStyle = 1;
|
||||
AIType = ProjectileID.PlatinumCoin;
|
||||
Projectile.width = 10; //Cool gaming facts: the vanilla coin projectiles are literally 4 pixels in hitbox size
|
||||
Projectile.height = 10;
|
||||
Projectile.CritChance = 50;
|
||||
}
|
||||
|
||||
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
|
||||
{
|
||||
target.AddBuff(BuffID.Midas, 25200); // 7 Minutes of Midas
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 189 B |
@@ -24,6 +24,7 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
Projectile.DamageType = RogueDamageClass.Instance;
|
||||
Projectile.penetrate = 1;
|
||||
Projectile.timeLeft = 300;
|
||||
Projectile.tileCollide = false;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
@@ -42,6 +43,11 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
|
||||
Projectile.ai[1]++;
|
||||
|
||||
if (Projectile.ai[0] != 0)
|
||||
{
|
||||
Projectile.tileCollide = true;
|
||||
}
|
||||
|
||||
// Stealth skulls instantly home in
|
||||
if (Projectile.ai[0] == 0)
|
||||
{
|
||||
|
||||
|
After Width: | Height: | Size: 2.1 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 1.9 KiB |
|
After Width: | Height: | Size: 3.7 KiB |
|
After Width: | Height: | Size: 933 B |
|
After Width: | Height: | Size: 799 B |
|
After Width: | Height: | Size: 165 B |
@@ -0,0 +1,158 @@
|
||||
using CalamityMod.Projectiles.BaseProjectiles;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using ReLogic.Content;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Summon.SmallAresArms
|
||||
{
|
||||
public class CannonLaserbeam : BaseLaserbeamProjectile
|
||||
{
|
||||
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
|
||||
|
||||
public Player Owner => Main.player[Projectile.owner];
|
||||
|
||||
public Projectile OwnerProjectile => CalamityUtils.FindProjectileByIdentity((int)Projectile.ai[1], Projectile.owner);
|
||||
|
||||
public const int LifetimeConst = 75;
|
||||
public override float MaxScale => 0.5f + (float)Math.Cos(Main.GlobalTimeWrappedHourly * 10f) * 0.07f;
|
||||
public override float MaxLaserLength => 1560f;
|
||||
public override float Lifetime => LifetimeConst;
|
||||
public override Color LaserOverlayColor => Color.White;
|
||||
public override Color LightCastColor => LaserOverlayColor;
|
||||
public override Texture2D LaserBeginTexture => ModContent.Request<Texture2D>("CalamityMod/Projectiles/Boss/ThanatosBeamStart", AssetRequestMode.ImmediateLoad).Value;
|
||||
public override Texture2D LaserMiddleTexture => ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/Lasers/ThanatosBeamMiddle", AssetRequestMode.ImmediateLoad).Value;
|
||||
public override Texture2D LaserEndTexture => ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/Lasers/ThanatosBeamEnd", AssetRequestMode.ImmediateLoad).Value;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Exothermal Deathray");
|
||||
Main.projFrames[Projectile.type] = 5;
|
||||
ProjectileID.Sets.MinionShot[Projectile.type] = true;
|
||||
}
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = Projectile.height = 38;
|
||||
Projectile.friendly = true;
|
||||
Projectile.minion = true;
|
||||
Projectile.minionSlots = 0f;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.alpha = 255;
|
||||
Projectile.localNPCHitCooldown = 14;
|
||||
Projectile.scale = 0.5f;
|
||||
Projectile.usesLocalNPCImmunity = true;
|
||||
Projectile.hide = true;
|
||||
Projectile.Calamity().UpdatePriority = 1f;
|
||||
}
|
||||
|
||||
public override float DetermineLaserLength()
|
||||
{
|
||||
float[] samples = new float[4];
|
||||
Collision.LaserScan(Projectile.Center, Projectile.velocity, Projectile.width * Projectile.scale, MaxLaserLength, samples);
|
||||
return samples.Average();
|
||||
}
|
||||
|
||||
public override void UpdateLaserMotion()
|
||||
{
|
||||
if (OwnerProjectile is null)
|
||||
{
|
||||
Projectile.Kill();
|
||||
return;
|
||||
}
|
||||
Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2;
|
||||
}
|
||||
|
||||
public override void AttachToSomething()
|
||||
{
|
||||
Projectile ownerProjectile = OwnerProjectile;
|
||||
if (ownerProjectile is null)
|
||||
{
|
||||
Projectile.Kill();
|
||||
return;
|
||||
}
|
||||
|
||||
float attachmentOffset = ownerProjectile.width * ownerProjectile.scale * 0.75f;
|
||||
Projectile.Center = ownerProjectile.Center + ownerProjectile.rotation.ToRotationVector2() * attachmentOffset - Owner.velocity;
|
||||
Projectile.rotation = ownerProjectile.rotation;
|
||||
Projectile.velocity = Projectile.rotation.ToRotationVector2();
|
||||
|
||||
// Update frames.
|
||||
Projectile.frame = Projectile.frameCounter++ / 5 % Main.projFrames[Type];
|
||||
}
|
||||
|
||||
public override bool ShouldUpdatePosition() => false;
|
||||
|
||||
public override void DrawBehind(int index, List<int> behindNPCsAndTiles, List<int> behindNPCs, List<int> behindProjectiles, List<int> overPlayers, List<int> overWiresUI)
|
||||
{
|
||||
overPlayers.Add(index);
|
||||
}
|
||||
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
// This should never happen, but just in case.
|
||||
if (Projectile.velocity == Vector2.Zero || Projectile.localAI[0] < 2f)
|
||||
return false;
|
||||
|
||||
Color beamColor = LaserOverlayColor;
|
||||
Rectangle startFrameArea = LaserBeginTexture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame);
|
||||
Rectangle middleFrameArea = LaserMiddleTexture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame);
|
||||
Rectangle endFrameArea = LaserEndTexture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame);
|
||||
|
||||
// Start texture drawing.
|
||||
Main.EntitySpriteDraw(LaserBeginTexture,
|
||||
Projectile.Center - Main.screenPosition,
|
||||
startFrameArea,
|
||||
beamColor,
|
||||
Projectile.rotation,
|
||||
startFrameArea.Size() * new Vector2(0.5f, 1f),
|
||||
Projectile.scale,
|
||||
SpriteEffects.None,
|
||||
0);
|
||||
|
||||
// Prepare things for body drawing.
|
||||
float laserBodyLength = LaserLength + middleFrameArea.Height;
|
||||
Vector2 centerOnLaser = Projectile.Center;
|
||||
|
||||
// Body drawing.
|
||||
if (laserBodyLength > 0f)
|
||||
{
|
||||
float laserOffset = middleFrameArea.Height * Projectile.scale;
|
||||
float incrementalBodyLength = 0f;
|
||||
while (incrementalBodyLength + 1f < laserBodyLength)
|
||||
{
|
||||
Main.EntitySpriteDraw(LaserMiddleTexture,
|
||||
centerOnLaser - Main.screenPosition,
|
||||
middleFrameArea,
|
||||
beamColor,
|
||||
Projectile.rotation,
|
||||
middleFrameArea.Size() * 0.5f,
|
||||
Projectile.scale,
|
||||
SpriteEffects.None,
|
||||
0);
|
||||
incrementalBodyLength += laserOffset;
|
||||
centerOnLaser += Projectile.velocity * laserOffset;
|
||||
middleFrameArea.Y += LaserMiddleTexture.Height / Main.projFrames[Projectile.type];
|
||||
if (middleFrameArea.Y + middleFrameArea.Height > LaserMiddleTexture.Height)
|
||||
middleFrameArea.Y = 0;
|
||||
}
|
||||
}
|
||||
|
||||
Vector2 laserEndCenter = centerOnLaser - Main.screenPosition;
|
||||
Main.EntitySpriteDraw(LaserEndTexture,
|
||||
laserEndCenter,
|
||||
endFrameArea,
|
||||
beamColor,
|
||||
Projectile.rotation,
|
||||
endFrameArea.Size() * 0.5f,
|
||||
Projectile.scale,
|
||||
SpriteEffects.None,
|
||||
0);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,218 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
using CalamityMod.Items.Weapons.Summon;
|
||||
using CalamityMod.InverseKinematics;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using System.IO;
|
||||
using CalamityMod.Buffs.Summon;
|
||||
|
||||
namespace CalamityMod.Projectiles.Summon.SmallAresArms
|
||||
{
|
||||
public abstract class ExoskeletonCannon : ModProjectile
|
||||
{
|
||||
public int ShootTimer;
|
||||
|
||||
public int HoverOffsetIndex => (int)Projectile.ai[0];
|
||||
|
||||
public bool TargetingSomething => Projectile.ai[1] == 1f;
|
||||
|
||||
public Player Owner => Main.player[Projectile.owner];
|
||||
|
||||
public LimbCollection Limbs = new(new CyclicCoordinateDescentUpdateRule(0.27f, MathHelper.PiOver2), 70f, 82f);
|
||||
|
||||
public static readonly Vector2[] HoverOffsetTable = new Vector2[]
|
||||
{
|
||||
new(300f, 96f),
|
||||
new(-300f, 96f),
|
||||
new(190f, -102f),
|
||||
new(-190f, -102f)
|
||||
};
|
||||
|
||||
public static readonly float[] RotationalClampTable = new float[]
|
||||
{
|
||||
0.23f,
|
||||
MathHelper.Pi - 0.23f,
|
||||
0.2f,
|
||||
MathHelper.Pi - 0.2f
|
||||
};
|
||||
|
||||
public virtual bool UsesSuperpredictiveness => false;
|
||||
|
||||
public virtual Vector2 DrawOffset => new((OwnerRestingOffset.X > 0f).ToDirectionInt() * 6f, -6f);
|
||||
|
||||
public virtual Vector2 ConnectOffset => HoverOffsetIndex >= 2 ? new((OwnerRestingOffset.X > 0f).ToDirectionInt() * 14f, -30f) : Vector2.Zero;
|
||||
|
||||
public abstract int ShootRate { get; }
|
||||
|
||||
public abstract float ShootSpeed { get; }
|
||||
|
||||
public abstract Vector2 OwnerRestingOffset { get; }
|
||||
|
||||
public abstract void ClampFirstLimbRotation(ref double limbRotation);
|
||||
|
||||
public abstract void ShootAtTarget(NPC target, Vector2 shootDirection);
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
ShootTimer = Main.rand?.Next(ShootRate) ?? 0;
|
||||
Projectile.width = 94;
|
||||
Projectile.height = 40;
|
||||
Projectile.friendly = true;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.netImportant = true;
|
||||
Projectile.minion = true;
|
||||
Projectile.minionSlots = AresExoskeleton.MinionSlotsPerCannon;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.timeLeft = 900000;
|
||||
Projectile.scale = 1f;
|
||||
Projectile.DamageType = DamageClass.Summon;
|
||||
}
|
||||
|
||||
public override void SendExtraAI(BinaryWriter writer)
|
||||
{
|
||||
writer.Write(Projectile.rotation);
|
||||
writer.Write(Limbs?.Limbs?.Length ?? 0);
|
||||
for (int i = 0; i < Limbs.Limbs.Length; i++)
|
||||
writer.Write(Limbs[i].Rotation);
|
||||
}
|
||||
|
||||
public override void ReceiveExtraAI(BinaryReader reader)
|
||||
{
|
||||
Projectile.rotation = reader.ReadSingle();
|
||||
|
||||
int limbCount = Limbs.Limbs.Length;
|
||||
for (int i = 0; i < limbCount; i++)
|
||||
{
|
||||
Limbs[i].Rotation = reader.ReadDouble();
|
||||
if (i >= 1)
|
||||
Limbs[i].ConnectPoint = Limbs[i - 1].EndPoint;
|
||||
}
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
// Update limbs.
|
||||
if (Main.myPlayer == Projectile.owner)
|
||||
{
|
||||
Vector2 connectPosition = Main.LocalPlayer.Center + ConnectOffset;
|
||||
connectPosition.X += (OwnerRestingOffset.X > 0f).ToDirectionInt() * Projectile.scale * 20f;
|
||||
Vector2 endPosition = Owner.Center + OwnerRestingOffset;
|
||||
endPosition += (Main.MouseWorld - endPosition) * 0.075f;
|
||||
|
||||
ClampFirstLimbRotation(ref Limbs[0].Rotation);
|
||||
Limbs.Update(connectPosition, endPosition);
|
||||
|
||||
Projectile.netSpam = 0;
|
||||
Projectile.netUpdate = true;
|
||||
}
|
||||
|
||||
Projectile.ai[1] = 0f;
|
||||
Projectile.velocity = Vector2.Zero;
|
||||
Projectile.Center = Limbs.EndPoint;
|
||||
|
||||
// Handle buffs.
|
||||
Owner.AddBuff(ModContent.BuffType<ExoskeletonCannons>(), 3600);
|
||||
if (Owner.dead)
|
||||
Owner.Calamity().AresCannons = false;
|
||||
if (Owner.Calamity().AresCannons)
|
||||
Projectile.timeLeft = 2;
|
||||
|
||||
// Look at the mouse if not targetting anything.
|
||||
// If something is being targeted, look at them instead.
|
||||
float idealRotation = Main.myPlayer != Projectile.owner ? Projectile.rotation : Projectile.AngleTo(Main.MouseWorld);
|
||||
NPC potentialTarget = Projectile.Center.ClosestNPCAt(AresExoskeleton.TargetingDistance);
|
||||
if (potentialTarget != null)
|
||||
{
|
||||
Projectile.ai[1] = 1f;
|
||||
|
||||
idealRotation = Projectile.AngleTo(potentialTarget.Center);
|
||||
if (UsesSuperpredictiveness)
|
||||
idealRotation = CalamityUtils.CalculatePredictiveAimToTarget(Projectile.Center, potentialTarget, ShootSpeed).ToRotation();
|
||||
|
||||
ShootTimer++;
|
||||
if (ShootTimer >= ShootRate)
|
||||
{
|
||||
ShootAtTarget(potentialTarget, idealRotation.ToRotationVector2());
|
||||
ShootTimer = 0;
|
||||
}
|
||||
}
|
||||
|
||||
Projectile.rotation = Projectile.rotation.AngleLerp(idealRotation, 0.15f);
|
||||
Projectile.spriteDirection = (Math.Cos(Projectile.rotation) > 0f).ToDirectionInt();
|
||||
}
|
||||
|
||||
public void DefaultDrawCannon(Texture2D glowmask)
|
||||
{
|
||||
Texture2D texture = ModContent.Request<Texture2D>(Texture).Value;
|
||||
Rectangle frame = texture.Frame(2, Main.projFrames[Type], TargetingSomething.ToInt(), Projectile.frame);
|
||||
Vector2 origin = frame.Size() * 0.5f;
|
||||
Vector2 drawPosition = Projectile.Center - Main.screenPosition;
|
||||
SpriteEffects direction = Projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally;
|
||||
float rotation = Projectile.rotation;
|
||||
if (Projectile.spriteDirection == -1)
|
||||
rotation += MathHelper.Pi;
|
||||
|
||||
DrawLimbs();
|
||||
|
||||
Color lightColor = Lighting.GetColor(Projectile.Center.ToTileCoordinates());
|
||||
Main.EntitySpriteDraw(texture, drawPosition, frame, Projectile.GetAlpha(lightColor), rotation, origin, Projectile.scale, direction, 0);
|
||||
Main.EntitySpriteDraw(glowmask, drawPosition, frame, Projectile.GetAlpha(Color.White), rotation, origin, Projectile.scale, direction, 0);
|
||||
}
|
||||
|
||||
public void DrawLimbs()
|
||||
{
|
||||
// Draw the arms. Third and onward arms use the otherwise unused old Ares arm segment texture.
|
||||
int frame = (int)(Main.GlobalTimeWrappedHourly * 8.1f) % 9;
|
||||
for (int i = 0; i < Limbs.Limbs.Length; i++)
|
||||
{
|
||||
float scale = Projectile.scale;
|
||||
float rotation = (float)Limbs[i].Rotation;
|
||||
Vector2 segmentOriginFactor = new(0f, 0.5f);
|
||||
SpriteEffects segmentDirection = SpriteEffects.FlipHorizontally;
|
||||
Texture2D segmentTexture = ModContent.Request<Texture2D>("CalamityMod/NPCs/ExoMechs/Ares/AresArmSegment").Value;
|
||||
Texture2D glowmaskTexture = null;
|
||||
|
||||
Rectangle segmentFrame = segmentTexture.Frame(1, 24, 0, (int)(Main.GlobalTimeWrappedHourly * 13f + i) % 24);
|
||||
if (i == 0)
|
||||
{
|
||||
segmentTexture = ModContent.Request<Texture2D>("CalamityMod/Projectiles/Summon/SmallAresArms/ArmPart1").Value;
|
||||
glowmaskTexture = ModContent.Request<Texture2D>("CalamityMod/Projectiles/Summon/SmallAresArms/ArmPart1Glowmask").Value;
|
||||
}
|
||||
if (i == 1)
|
||||
{
|
||||
segmentTexture = ModContent.Request<Texture2D>("CalamityMod/Projectiles/Summon/SmallAresArms/ArmPart2").Value;
|
||||
glowmaskTexture = ModContent.Request<Texture2D>("CalamityMod/Projectiles/Summon/SmallAresArms/ArmPart2Glowmask").Value;
|
||||
}
|
||||
if (i <= 1)
|
||||
{
|
||||
segmentFrame = segmentTexture.Frame(1, 9, 0, frame);
|
||||
segmentDirection = OwnerRestingOffset.X < 0f ? SpriteEffects.FlipHorizontally : SpriteEffects.None;
|
||||
if (OwnerRestingOffset.X < 0f)
|
||||
{
|
||||
segmentOriginFactor.X = 1f;
|
||||
rotation += MathHelper.Pi;
|
||||
}
|
||||
}
|
||||
else
|
||||
scale *= 0.67f;
|
||||
|
||||
Color segmentColor = Lighting.GetColor(Limbs[i].ConnectPoint.ToTileCoordinates());
|
||||
Vector2 segmentDrawPosition = Limbs[i].ConnectPoint - Main.screenPosition;
|
||||
Main.spriteBatch.DrawLineBetter(Limbs[i].ConnectPoint, Limbs[i].EndPoint, Color.Cyan, 3f);
|
||||
Main.EntitySpriteDraw(segmentTexture, segmentDrawPosition, segmentFrame, Projectile.GetAlpha(segmentColor), rotation, segmentFrame.Size() * segmentOriginFactor, scale, segmentDirection, 0);
|
||||
if (glowmaskTexture != null)
|
||||
Main.EntitySpriteDraw(glowmaskTexture, segmentDrawPosition, segmentFrame, Projectile.GetAlpha(Color.White), rotation, segmentFrame.Size() * segmentOriginFactor, scale, segmentDirection, 0);
|
||||
}
|
||||
|
||||
// Draw the shoulders on top of everything else.
|
||||
Vector2 shoulderPosition = Limbs.ConnectPoint + DrawOffset * Projectile.scale;
|
||||
Color shoulderColor = Lighting.GetColor(Limbs.ConnectPoint.ToTileCoordinates());
|
||||
Texture2D shoulderTexture = ModContent.Request<Texture2D>("CalamityMod/Projectiles/Summon/SmallAresArms/ArmTopShoulder").Value;
|
||||
SpriteEffects shoulderDirection = OwnerRestingOffset.X < 0f ? SpriteEffects.FlipHorizontally : SpriteEffects.None;
|
||||
Rectangle shoulderFrame = shoulderTexture.Frame(1, 9, 0, frame);
|
||||
Main.EntitySpriteDraw(shoulderTexture, shoulderPosition - Main.screenPosition, shoulderFrame, Projectile.GetAlpha(shoulderColor), 0f, shoulderFrame.Size() * 0.5f, Projectile.scale, shoulderDirection, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,142 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
using Terraria.Audio;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using CalamityMod.Sounds;
|
||||
using CalamityMod.Items.Weapons.Summon;
|
||||
using System;
|
||||
|
||||
namespace CalamityMod.Projectiles.Summon.SmallAresArms
|
||||
{
|
||||
public class ExoskeletonGaussNukeCannon : ExoskeletonCannon
|
||||
{
|
||||
public int NukeRebuildTime => ShootRate - 45;
|
||||
|
||||
public ref float RebuildTimer => ref Projectile.localAI[0];
|
||||
|
||||
public override int ShootRate => AresExoskeleton.GaussNukeShootRate;
|
||||
|
||||
public override float ShootSpeed => 16f;
|
||||
|
||||
public override Vector2 OwnerRestingOffset => HoverOffsetTable[HoverOffsetIndex];
|
||||
|
||||
public override void ClampFirstLimbRotation(ref double limbRotation) => limbRotation = RotationalClampTable[HoverOffsetIndex];
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Gauss Nuke");
|
||||
Main.projFrames[Type] = 12;
|
||||
}
|
||||
|
||||
public override void ShootAtTarget(NPC target, Vector2 shootDirection)
|
||||
{
|
||||
// Play the large gun fire sound.
|
||||
SoundEngine.PlaySound(CommonCalamitySounds.LargeWeaponFireSound with { Volume = 0.4f }, Projectile.Center);
|
||||
|
||||
// Start the rebuild timer.
|
||||
RebuildTimer = 1f;
|
||||
|
||||
// Shoot the fireball. This only happens for the owner client.
|
||||
if (Main.myPlayer != Projectile.owner)
|
||||
return;
|
||||
|
||||
int nukeID = ModContent.ProjectileType<MinionGaussNuke>();
|
||||
Vector2 laserVelocity = shootDirection * ShootSpeed;
|
||||
int laser = Projectile.NewProjectile(Projectile.GetSource_FromAI(), Projectile.Center, laserVelocity, nukeID, (int)(Projectile.damage * AresExoskeleton.NukeDamageFactor), 0f, Projectile.owner);
|
||||
if (Main.projectile.IndexInRange(laser))
|
||||
Main.projectile[laser].originalDamage = (int)(Projectile.originalDamage * AresExoskeleton.NukeDamageFactor);
|
||||
}
|
||||
|
||||
public override void PostAI()
|
||||
{
|
||||
Projectile.frameCounter++;
|
||||
Projectile.frame = Projectile.frameCounter / 5 % 6;
|
||||
if (RebuildTimer >= 1f)
|
||||
{
|
||||
RebuildTimer++;
|
||||
Projectile.frame += 6;
|
||||
}
|
||||
|
||||
if (RebuildTimer >= NukeRebuildTime)
|
||||
{
|
||||
RebuildTimer = 0f;
|
||||
Projectile.frameCounter = 0;
|
||||
Projectile.frame = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
Texture2D texture = ModContent.Request<Texture2D>(Texture).Value;
|
||||
Texture2D glowmask = ModContent.Request<Texture2D>("CalamityMod/Projectiles/Summon/SmallAresArms/ExoskeletonGaussNukeCannonGlowmask").Value;
|
||||
|
||||
// The two stabilizers have two different shades of lighting, thus necessitating two different textures.
|
||||
Texture2D stabilizer = ModContent.Request<Texture2D>("CalamityMod/Projectiles/Summon/SmallAresArms/ExoskeletonGaussNukeStabilizer").Value;
|
||||
Texture2D stabilizer2 = ModContent.Request<Texture2D>("CalamityMod/Projectiles/Summon/SmallAresArms/ExoskeletonGaussNukeStabilizerBottom").Value;
|
||||
Texture2D crystal = ModContent.Request<Texture2D>("CalamityMod/Projectiles/Summon/SmallAresArms/ExoskeletonGaussNukeCrystal").Value;
|
||||
Texture2D core = ModContent.Request<Texture2D>("CalamityMod/Projectiles/Summon/SmallAresArms/ExoskeletonGaussNukeCore").Value;
|
||||
Rectangle frame = texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame);
|
||||
|
||||
float stabilizerRotationInterpolant = (float)Math.Pow(Utils.GetLerpValue(NukeRebuildTime * 0.75f, NukeRebuildTime * 0.92f, RebuildTimer, true), 1.7);
|
||||
Vector2 origin = frame.Size() * 0.5f;
|
||||
Vector2 crystalOrigin = crystal.Size() * new Vector2(Projectile.spriteDirection == 1 ? 1f : 0f, 0.5f);
|
||||
Vector2 stabilizerOrigin = stabilizer.Size() * new Vector2(0.5f, 1f);
|
||||
Vector2 coreOrigin = core.Size() * new Vector2(Projectile.spriteDirection == 1 ? 0f : 1f, 0.5f);
|
||||
Vector2 perpendicularStabilizerOffset = (Projectile.rotation + MathHelper.PiOver2).ToRotationVector2() * Projectile.scale * MathHelper.Lerp(18f, 10f, stabilizerRotationInterpolant);
|
||||
|
||||
Vector2 drawPosition = Projectile.Center - Main.screenPosition;
|
||||
SpriteEffects direction = Projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally;
|
||||
float rotation = Projectile.rotation;
|
||||
if (Projectile.spriteDirection == -1)
|
||||
rotation += MathHelper.Pi;
|
||||
|
||||
DrawLimbs();
|
||||
|
||||
// Draw the nuke pieces when rebuilding. This is done before the cannon itself is drawn, to make it look like they're attached to it.
|
||||
if (RebuildTimer >= 1f)
|
||||
{
|
||||
float componentDirection = rotation + MathHelper.Pi;
|
||||
float stabilizerDirection = componentDirection;
|
||||
if (Projectile.spriteDirection == -1)
|
||||
stabilizerDirection += MathHelper.Pi;
|
||||
|
||||
Vector2 aimDirection = Projectile.rotation.ToRotationVector2();
|
||||
|
||||
// Draw the crystal.
|
||||
float crystalOffsetInterpolant = Utils.GetLerpValue(0f, NukeRebuildTime * 0.5f, RebuildTimer, true);
|
||||
Vector2 crystalOffset = aimDirection * crystalOffsetInterpolant * Projectile.scale * (crystal.Width - 15f);
|
||||
Main.EntitySpriteDraw(crystal, drawPosition + crystalOffset, null, Projectile.GetAlpha(lightColor), rotation, crystalOrigin, Projectile.scale, direction, 0);
|
||||
|
||||
// Draw the stabilizers.
|
||||
float stabilizerOffsetInterpolant = Utils.GetLerpValue(NukeRebuildTime * 0.5f, NukeRebuildTime * 0.75f, RebuildTimer, true);
|
||||
float stabilizerOffsetMagnitude = MathHelper.Lerp(-stabilizer.Width * 0.32f, stabilizer.Width * 0.4f - 8f, stabilizerOffsetInterpolant) * Projectile.scale;
|
||||
float leftStabilizerRotation = stabilizerDirection + MathHelper.Pi - (1f - stabilizerRotationInterpolant) * 0.42f;
|
||||
float rightStabilizerRotation = stabilizerDirection + (1f - stabilizerRotationInterpolant) * 0.42f;
|
||||
Vector2 stabilizerOffset = aimDirection * stabilizerOffsetMagnitude;
|
||||
Color stabilizerColor = Projectile.GetAlpha(lightColor) * (float)Math.Pow(stabilizerOffsetInterpolant, 1.61);
|
||||
Vector2 leftStabilizerPosition = drawPosition + stabilizerOffset - perpendicularStabilizerOffset * 0.9f;
|
||||
Vector2 rightStabilizerPosition = drawPosition + stabilizerOffset + perpendicularStabilizerOffset;
|
||||
SpriteEffects leftStabilizerDirection = direction;
|
||||
SpriteEffects rightStabilizerDirection = direction ^ SpriteEffects.FlipHorizontally;
|
||||
if (Projectile.spriteDirection == -1)
|
||||
{
|
||||
leftStabilizerDirection ^= SpriteEffects.FlipHorizontally;
|
||||
rightStabilizerDirection ^= SpriteEffects.FlipHorizontally;
|
||||
Utils.Swap(ref stabilizer, ref stabilizer2);
|
||||
}
|
||||
Main.EntitySpriteDraw(stabilizer, leftStabilizerPosition, null, stabilizerColor, leftStabilizerRotation, stabilizerOrigin, Projectile.scale, leftStabilizerDirection, 0);
|
||||
Main.EntitySpriteDraw(stabilizer2, rightStabilizerPosition, null, stabilizerColor, rightStabilizerRotation, stabilizerOrigin, Projectile.scale, rightStabilizerDirection, 0);
|
||||
|
||||
// Draw the core.
|
||||
Vector2 coreDrawPosition = drawPosition + aimDirection * Projectile.scale * -12f;
|
||||
Main.EntitySpriteDraw(core, coreDrawPosition, null, Projectile.GetAlpha(lightColor) * stabilizerRotationInterpolant, rotation, coreOrigin, Projectile.scale, direction, 0);
|
||||
}
|
||||
|
||||
Main.EntitySpriteDraw(texture, drawPosition, frame, Projectile.GetAlpha(lightColor), rotation, origin, Projectile.scale, direction, 0);
|
||||
Main.EntitySpriteDraw(glowmask, drawPosition, frame, Projectile.GetAlpha(Color.White), rotation, origin, Projectile.scale, direction, 0);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 5.4 KiB |
|
After Width: | Height: | Size: 1.9 KiB |
|
After Width: | Height: | Size: 470 B |
|
After Width: | Height: | Size: 345 B |
|
After Width: | Height: | Size: 401 B |
|
After Width: | Height: | Size: 395 B |
@@ -0,0 +1,105 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
using Terraria.Audio;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using CalamityMod.Sounds;
|
||||
using CalamityMod.Items.Weapons.Summon;
|
||||
using System.IO;
|
||||
|
||||
namespace CalamityMod.Projectiles.Summon.SmallAresArms
|
||||
{
|
||||
public class ExoskeletonLaserCannon : ExoskeletonCannon
|
||||
{
|
||||
public ref float ShootCounter => ref Projectile.localAI[0];
|
||||
|
||||
// This is how many small, regular lasers will happen before the laser will charge up and prepare a laserbeam.
|
||||
public const int NormalLasersBeforeBeam = 6;
|
||||
|
||||
public override int ShootRate => ShootCounter % NormalLasersBeforeBeam == 0f ? 150 : AresExoskeleton.LaserCannonNormalShootRate;
|
||||
|
||||
public override float ShootSpeed => 13.5f;
|
||||
|
||||
public override Vector2 OwnerRestingOffset => HoverOffsetTable[HoverOffsetIndex];
|
||||
|
||||
public override void ClampFirstLimbRotation(ref double limbRotation) => limbRotation = RotationalClampTable[HoverOffsetIndex];
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Laser Cannon");
|
||||
Main.projFrames[Type] = 6;
|
||||
}
|
||||
|
||||
public override void SendExtraAI(BinaryWriter writer)
|
||||
{
|
||||
writer.Write(ShootCounter);
|
||||
base.SendExtraAI(writer);
|
||||
}
|
||||
|
||||
public override void ReceiveExtraAI(BinaryReader reader)
|
||||
{
|
||||
ShootCounter = reader.ReadSingle();
|
||||
base.ReceiveExtraAI(reader);
|
||||
}
|
||||
|
||||
public override void ShootAtTarget(NPC target, Vector2 shootDirection)
|
||||
{
|
||||
// Play the laser cannon fire sound.
|
||||
SoundEngine.PlaySound(CommonCalamitySounds.LaserCannonSound with { Volume = 0.4f }, Projectile.Center);
|
||||
|
||||
// Create a burst of dust.
|
||||
for (int i = 0; i < 24; i++)
|
||||
{
|
||||
Dust laserEnergy = Dust.NewDustPerfect(Projectile.Center + shootDirection * Projectile.width * Projectile.scale * 0.45f, 182);
|
||||
laserEnergy.velocity = (MathHelper.TwoPi * i / 24f).ToRotationVector2() * 4f;
|
||||
laserEnergy.scale = 1.1f;
|
||||
laserEnergy.fadeIn = 0.4f;
|
||||
laserEnergy.noGravity = true;
|
||||
}
|
||||
|
||||
// Shoot the laser. This only happens for the owner client.
|
||||
if (Main.myPlayer != Projectile.owner)
|
||||
return;
|
||||
|
||||
int laserID = ModContent.ProjectileType<MinionLaserBurst>();
|
||||
bool fireLaser = ShootCounter % NormalLasersBeforeBeam == NormalLasersBeforeBeam - 1f;
|
||||
if (fireLaser)
|
||||
laserID = ModContent.ProjectileType<CannonLaserbeam>();
|
||||
|
||||
Vector2 laserVelocity = shootDirection * ShootSpeed;
|
||||
int laser = Projectile.NewProjectile(Projectile.GetSource_FromAI(), Projectile.Center, laserVelocity, laserID, Projectile.damage, 0f, Projectile.owner);
|
||||
if (Main.projectile.IndexInRange(laser))
|
||||
{
|
||||
Main.projectile[laser].originalDamage = Projectile.originalDamage;
|
||||
if (fireLaser)
|
||||
Main.projectile[laser].ai[1] = Projectile.identity;
|
||||
}
|
||||
|
||||
// Increment the shoot counter. This decides if the cannon fires a simple laser or a beam.
|
||||
ShootCounter++;
|
||||
Projectile.netUpdate = true;
|
||||
}
|
||||
|
||||
// Create some charge dust before firing a laserbeam.
|
||||
public override void PostAI()
|
||||
{
|
||||
Projectile.frameCounter++;
|
||||
Projectile.frame = Projectile.frameCounter / 5 % Main.projFrames[Type];
|
||||
if (ShootCounter % NormalLasersBeforeBeam != NormalLasersBeforeBeam - 1f || !TargetingSomething)
|
||||
return;
|
||||
|
||||
Vector2 aimDirection = Projectile.rotation.ToRotationVector2();
|
||||
Dust laserEnergy = Dust.NewDustPerfect(Projectile.Center + aimDirection * Projectile.width * Projectile.scale * 0.51f, 182);
|
||||
laserEnergy.velocity = aimDirection.RotatedByRandom(0.48f) * Main.rand.NextFloat(3f);
|
||||
laserEnergy.scale = 1.1f;
|
||||
laserEnergy.fadeIn = 0.4f;
|
||||
laserEnergy.noGravity = true;
|
||||
}
|
||||
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
DefaultDrawCannon(ModContent.Request<Texture2D>("CalamityMod/Projectiles/Summon/SmallAresArms/ExoskeletonLaserCannonGlowmask").Value);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 3.6 KiB |
|
After Width: | Height: | Size: 1.8 KiB |
@@ -0,0 +1,369 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
using Terraria.ID;
|
||||
using CalamityMod.Items.Weapons.Summon;
|
||||
using Terraria.GameContent;
|
||||
using Terraria.Audio;
|
||||
using System.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace CalamityMod.Projectiles.Summon.SmallAresArms
|
||||
{
|
||||
public class ExoskeletonPanel : ModProjectile
|
||||
{
|
||||
public enum IconType
|
||||
{
|
||||
Inactive,
|
||||
Plasma,
|
||||
Tesla,
|
||||
Laser,
|
||||
Gauss
|
||||
}
|
||||
|
||||
public class IconState
|
||||
{
|
||||
public int PanelFlashTimer;
|
||||
|
||||
public int MousePressFrameCountdown;
|
||||
|
||||
public bool BeingHoveredOver;
|
||||
|
||||
public bool PlacedInPanel;
|
||||
|
||||
public IconType CurrentState;
|
||||
|
||||
public Texture2D IconTexture
|
||||
{
|
||||
get
|
||||
{
|
||||
Texture2D plasmaTexture = ModContent.Request<Texture2D>("CalamityMod/Projectiles/Summon/SmallAresArms/ExoskeletonPanelPlasma").Value;
|
||||
Texture2D teslaTexture = ModContent.Request<Texture2D>("CalamityMod/Projectiles/Summon/SmallAresArms/ExoskeletonPanelTesla").Value;
|
||||
Texture2D laserTexture = ModContent.Request<Texture2D>("CalamityMod/Projectiles/Summon/SmallAresArms/ExoskeletonPanelLaser").Value;
|
||||
Texture2D gaussTexture = ModContent.Request<Texture2D>("CalamityMod/Projectiles/Summon/SmallAresArms/ExoskeletonPanelGauss").Value;
|
||||
return CurrentState switch
|
||||
{
|
||||
IconType.Plasma => plasmaTexture,
|
||||
IconType.Tesla => teslaTexture,
|
||||
IconType.Laser => laserTexture,
|
||||
IconType.Gauss => gaussTexture,
|
||||
_ => null,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public Rectangle Frame
|
||||
{
|
||||
get
|
||||
{
|
||||
int frame = 0;
|
||||
if (BeingHoveredOver)
|
||||
frame = PlacedInPanel ? 3 : 1;
|
||||
if (MousePressFrameCountdown >= 1)
|
||||
frame = 2;
|
||||
if (PanelFlashTimer >= 1)
|
||||
frame = (int)Math.Round(MathHelper.Lerp(4f, 6f, PanelFlashTimer / 16f));
|
||||
|
||||
return IconTexture?.Frame(1, 7, 0, frame) ?? default;
|
||||
}
|
||||
}
|
||||
|
||||
public IconState(bool hover, bool panel, IconType state)
|
||||
{
|
||||
BeingHoveredOver = hover;
|
||||
PlacedInPanel = panel;
|
||||
CurrentState = state;
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
if (PanelFlashTimer >= 1)
|
||||
PanelFlashTimer++;
|
||||
if (PanelFlashTimer >= 16)
|
||||
PanelFlashTimer = 0;
|
||||
|
||||
if (MousePressFrameCountdown > 0)
|
||||
MousePressFrameCountdown--;
|
||||
}
|
||||
}
|
||||
|
||||
public IconType ClickedIcon = IconType.Inactive;
|
||||
|
||||
public IconState[] SelectionIcons = new IconState[]
|
||||
{
|
||||
new(false, false, IconType.Plasma),
|
||||
new(false, false, IconType.Tesla),
|
||||
new(false, false, IconType.Laser),
|
||||
new(false, false, IconType.Gauss),
|
||||
};
|
||||
|
||||
public IconState[] PanelIcons = new IconState[]
|
||||
{
|
||||
new(false, true, IconType.Inactive),
|
||||
new(false, true, IconType.Inactive),
|
||||
new(false, true, IconType.Inactive),
|
||||
new(false, true, IconType.Inactive),
|
||||
};
|
||||
|
||||
public bool ShouldDeleteArmIndex = false;
|
||||
|
||||
public int ArmIDToSpawn = -1;
|
||||
|
||||
public int ArmIndex = -1;
|
||||
|
||||
public bool FadeOut => Projectile.ai[0] == 1f;
|
||||
|
||||
public Vector2 PlayerOffset;
|
||||
|
||||
public ref float Time => ref Projectile.ai[1];
|
||||
|
||||
public static Rectangle MouseRectangle => new((int)Main.MouseScreen.X, (int)Main.MouseScreen.Y, 2, 2);
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("UI");
|
||||
ProjectileID.Sets.DrawScreenCheckFluff[Type] = 9999999;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 40;
|
||||
Projectile.height = 40;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.timeLeft = 36000;
|
||||
Projectile.Opacity = 0f;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.hide = true;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
int plasmaCannonID = ModContent.ProjectileType<ExoskeletonPlasmaCannon>();
|
||||
int teslaCannonID = ModContent.ProjectileType<ExoskeletonTeslaCannon>();
|
||||
int laserCannonID = ModContent.ProjectileType<ExoskeletonLaserCannon>();
|
||||
int gaussNukeID = ModContent.ProjectileType<ExoskeletonGaussNukeCannon>();
|
||||
int[] arms = new int[]
|
||||
{
|
||||
plasmaCannonID,
|
||||
teslaCannonID,
|
||||
laserCannonID,
|
||||
gaussNukeID,
|
||||
};
|
||||
|
||||
// Initialize things.
|
||||
if (PlayerOffset == Vector2.Zero)
|
||||
PlayerOffset = Main.MouseWorld - Main.LocalPlayer.Center;
|
||||
|
||||
// Dynamically update panel icons.
|
||||
for (int i = 0; i < 4; i++)
|
||||
PanelIcons[i].CurrentState = IconType.Inactive;
|
||||
for (int i = 0; i < Main.maxProjectiles; i++)
|
||||
{
|
||||
if (!arms.Contains(Main.projectile[i].type) || Main.projectile[i].owner != Projectile.owner || !Main.projectile[i].active)
|
||||
continue;
|
||||
|
||||
IconType stateFromID = IconType.Inactive;
|
||||
if (Main.projectile[i].type == plasmaCannonID)
|
||||
stateFromID = IconType.Plasma;
|
||||
if (Main.projectile[i].type == teslaCannonID)
|
||||
stateFromID = IconType.Tesla;
|
||||
if (Main.projectile[i].type == laserCannonID)
|
||||
stateFromID = IconType.Laser;
|
||||
if (Main.projectile[i].type == gaussNukeID)
|
||||
stateFromID = IconType.Gauss;
|
||||
|
||||
PanelIcons[(int)Main.projectile[i].ai[0]].CurrentState = stateFromID;
|
||||
}
|
||||
|
||||
// Handle fade effects.
|
||||
if (Time >= AresExoskeleton.BoxParticleLifetime)
|
||||
Projectile.Opacity = MathHelper.Clamp(Projectile.Opacity - FadeOut.ToDirectionInt() * 0.0225f, 0f, 1f);
|
||||
if (FadeOut && Projectile.Opacity <= 0f)
|
||||
Projectile.Kill();
|
||||
|
||||
if (Main.player[Projectile.owner].dead || !Main.player[Projectile.owner].active)
|
||||
Projectile.Kill();
|
||||
Time++;
|
||||
|
||||
// Create and destroy arms as necessary.
|
||||
if (Main.myPlayer != Projectile.owner)
|
||||
return;
|
||||
|
||||
if (ArmIDToSpawn >= 0)
|
||||
{
|
||||
bool armAlreadyExists = false;
|
||||
for (int i = 0; i < Main.maxProjectiles; i++)
|
||||
{
|
||||
if (!arms.Contains(Main.projectile[i].type) || Main.projectile[i].owner != Projectile.owner || !Main.projectile[i].active || Main.projectile[i].ai[0] != ArmIndex)
|
||||
continue;
|
||||
|
||||
armAlreadyExists = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!armAlreadyExists)
|
||||
{
|
||||
SoundEngine.PlaySound(SoundID.Zombie66, Projectile.Center);
|
||||
int cannon = Projectile.NewProjectile(Projectile.GetSource_FromAI(), Projectile.Center, Vector2.Zero, ArmIDToSpawn, Projectile.damage, 0f, Projectile.owner, ArmIndex);
|
||||
if (Main.projectile.IndexInRange(cannon))
|
||||
Main.projectile[cannon].originalDamage = Projectile.originalDamage;
|
||||
}
|
||||
}
|
||||
if (ShouldDeleteArmIndex)
|
||||
{
|
||||
SoundEngine.PlaySound(SoundID.Item74, Projectile.Center);
|
||||
for (int i = 0; i < Main.maxProjectiles; i++)
|
||||
{
|
||||
if (!arms.Contains(Main.projectile[i].type) || Main.projectile[i].owner != Projectile.owner || !Main.projectile[i].active || Main.projectile[i].ai[0] != ArmIndex)
|
||||
continue;
|
||||
|
||||
Main.projectile[i].Kill();
|
||||
}
|
||||
}
|
||||
|
||||
ShouldDeleteArmIndex = false;
|
||||
ArmIDToSpawn = -1;
|
||||
ArmIndex = -1;
|
||||
}
|
||||
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
// This UI only renders for the player that created it.
|
||||
if (Main.myPlayer != Projectile.owner)
|
||||
return false;
|
||||
|
||||
Texture2D panelTexture = ModContent.Request<Texture2D>(Texture).Value;
|
||||
Texture2D plasmaTexture = ModContent.Request<Texture2D>("CalamityMod/Projectiles/Summon/SmallAresArms/ExoskeletonPanelPlasma").Value;
|
||||
Texture2D arrowTexture = ModContent.Request<Texture2D>("CalamityMod/Projectiles/Summon/SmallAresArms/Arrow").Value;
|
||||
Vector2 area = plasmaTexture.Frame(1, 7, 0, 0).Size();
|
||||
Vector2 drawPosition = (Main.LocalPlayer.Center + PlayerOffset - Main.screenPosition).Floor();
|
||||
|
||||
Rectangle[] selectionIconAreas = new Rectangle[4]
|
||||
{
|
||||
Utils.CenteredRectangle(drawPosition + new Vector2(-62f, -70f) * Projectile.scale, area * Projectile.scale),
|
||||
Utils.CenteredRectangle(drawPosition + new Vector2(-22f, -70f) * Projectile.scale, area * Projectile.scale),
|
||||
Utils.CenteredRectangle(drawPosition + new Vector2(22f, -70f) * Projectile.scale, area * Projectile.scale),
|
||||
Utils.CenteredRectangle(drawPosition + new Vector2(62f, -70f) * Projectile.scale, area * Projectile.scale)
|
||||
};
|
||||
|
||||
bool hoveringOverAnySlot = false;
|
||||
bool clickedAnIconOnPanel = false;
|
||||
bool sufficientSlots = Main.LocalPlayer.maxMinions > AresExoskeleton.MinionSlotsPerCannon;
|
||||
|
||||
// Draw icon and handle hover behaviors.
|
||||
// If an arm needs to be destroyed or spawned, it will happen on the next frame in the AI update loop.
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
Texture2D selectionIconTexture = SelectionIcons[i].IconTexture;
|
||||
|
||||
// Handle selection icon click stuff.
|
||||
SelectionIcons[i].BeingHoveredOver = false;
|
||||
PanelIcons[i].BeingHoveredOver = false;
|
||||
if (selectionIconAreas[i].Intersects(MouseRectangle))
|
||||
{
|
||||
hoveringOverAnySlot = true;
|
||||
SelectionIcons[i].BeingHoveredOver = true;
|
||||
if (Main.mouseLeft && Main.mouseLeftRelease && Projectile.Opacity >= 1f)
|
||||
{
|
||||
ClickedIcon = SelectionIcons[i].CurrentState;
|
||||
SelectionIcons[i].MousePressFrameCountdown = 15;
|
||||
}
|
||||
}
|
||||
|
||||
// Handle panel icon click stuff.
|
||||
Rectangle panelArea = selectionIconAreas[i];
|
||||
panelArea.Y += (int)(Projectile.scale * 78f);
|
||||
if (panelArea.Intersects(MouseRectangle))
|
||||
{
|
||||
hoveringOverAnySlot = true;
|
||||
PanelIcons[i].BeingHoveredOver = true;
|
||||
if (Main.mouseLeft && Main.mouseLeftRelease && Projectile.Opacity >= 1f && sufficientSlots)
|
||||
{
|
||||
clickedAnIconOnPanel = true;
|
||||
PanelIcons[i].CurrentState = ClickedIcon;
|
||||
PanelIcons[i].PanelFlashTimer = 1;
|
||||
|
||||
switch (ClickedIcon)
|
||||
{
|
||||
case IconType.Plasma:
|
||||
ArmIDToSpawn = ModContent.ProjectileType<ExoskeletonPlasmaCannon>();
|
||||
break;
|
||||
case IconType.Tesla:
|
||||
ArmIDToSpawn = ModContent.ProjectileType<ExoskeletonTeslaCannon>();
|
||||
break;
|
||||
case IconType.Laser:
|
||||
ArmIDToSpawn = ModContent.ProjectileType<ExoskeletonLaserCannon>();
|
||||
break;
|
||||
case IconType.Gauss:
|
||||
ArmIDToSpawn = ModContent.ProjectileType<ExoskeletonGaussNukeCannon>();
|
||||
break;
|
||||
case IconType.Inactive:
|
||||
ShouldDeleteArmIndex = true;
|
||||
PanelIcons[i].PanelFlashTimer = 0;
|
||||
break;
|
||||
}
|
||||
ArmIndex = i;
|
||||
}
|
||||
}
|
||||
|
||||
Main.EntitySpriteDraw(selectionIconTexture, selectionIconAreas[i].Center.ToVector2(), SelectionIcons[i].Frame, Projectile.GetAlpha(Color.White), 0f, area * 0.5f, Projectile.scale, 0, 0);
|
||||
}
|
||||
|
||||
Main.EntitySpriteDraw(panelTexture, drawPosition, null, Projectile.GetAlpha(Color.White), 0f, panelTexture.Size() * 0.5f, Projectile.scale, 0, 0);
|
||||
|
||||
// Draw panel icons.
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
Rectangle panelArea = selectionIconAreas[i];
|
||||
panelArea.Y += (int)(Projectile.scale * 78f);
|
||||
Texture2D panelIconTexture = PanelIcons[i].IconTexture;
|
||||
if (panelIconTexture is not null)
|
||||
Main.EntitySpriteDraw(panelIconTexture, panelArea.Center.ToVector2(), PanelIcons[i].Frame, Projectile.GetAlpha(Color.White), 0f, area * 0.5f, Projectile.scale, 0, 0);
|
||||
|
||||
SelectionIcons[i].Update();
|
||||
PanelIcons[i].Update();
|
||||
}
|
||||
|
||||
// Draw an arrow at the mouse from the selected icon if one has been selected.
|
||||
if (ClickedIcon != IconType.Inactive)
|
||||
{
|
||||
Vector2 arrowDrawPosition = selectionIconAreas[(int)ClickedIcon - 1].Center.ToVector2();
|
||||
Vector2 arrowDirection = (Main.MouseScreen - arrowDrawPosition).SafeNormalize(Vector2.UnitY);
|
||||
arrowDrawPosition += arrowDirection * Projectile.scale * 24f;
|
||||
|
||||
Main.EntitySpriteDraw(arrowTexture, arrowDrawPosition, null, Projectile.GetAlpha(Color.White), arrowDirection.ToRotation(), arrowTexture.Size() * 0.5f, Projectile.scale, 0, 0);
|
||||
}
|
||||
|
||||
// Tell the player if they don't have enough summon slots.
|
||||
if (hoveringOverAnySlot && !sufficientSlots)
|
||||
Utils.DrawBorderStringFourWay(Main.spriteBatch, FontAssets.MouseText.Value, "Insufficient minion slots!", Main.MouseScreen.X + 20f, Main.MouseScreen.Y + 12f, Color.Cyan, Color.Black, new Vector2(0f, 0.5f));
|
||||
|
||||
// Reset the clicked icon if a click is made but not to a specific icon.
|
||||
if (!hoveringOverAnySlot && Main.mouseLeft && Main.mouseLeftRelease)
|
||||
ClickedIcon = IconType.Inactive;
|
||||
|
||||
if (hoveringOverAnySlot)
|
||||
{
|
||||
Main.blockMouse = true;
|
||||
Main.LocalPlayer.mouseInterface = true;
|
||||
}
|
||||
|
||||
// Reset the clicked icon and handle the arm creation/deletion if an icon was clicked on the panel.
|
||||
if (clickedAnIconOnPanel)
|
||||
ClickedIcon = IconType.Inactive;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void DrawBehind(int index, List<int> behindNPCsAndTiles, List<int> behindNPCs, List<int> behindProjectiles, List<int> overPlayers, List<int> overWiresUI)
|
||||
{
|
||||
overWiresUI.Add(index);
|
||||
}
|
||||
|
||||
// This is a UI. It should not do damage.
|
||||
public override bool? CanDamage() => false;
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 801 B |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
@@ -0,0 +1,93 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
using Terraria.Audio;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using CalamityMod.Items.Weapons.DraedonsArsenal;
|
||||
using CalamityMod.Items.Weapons.Summon;
|
||||
|
||||
namespace CalamityMod.Projectiles.Summon.SmallAresArms
|
||||
{
|
||||
public class ExoskeletonPlasmaCannon : ExoskeletonCannon
|
||||
{
|
||||
public override int ShootRate => AresExoskeleton.PlasmaCannonShootRate;
|
||||
|
||||
public override float ShootSpeed => 13.5f;
|
||||
|
||||
public override Vector2 OwnerRestingOffset => HoverOffsetTable[HoverOffsetIndex];
|
||||
|
||||
public override void ClampFirstLimbRotation(ref double limbRotation) => limbRotation = RotationalClampTable[HoverOffsetIndex];
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Plasma Cannon");
|
||||
Main.projFrames[Type] = 6;
|
||||
}
|
||||
|
||||
public override void PostAI()
|
||||
{
|
||||
Projectile.frameCounter++;
|
||||
Projectile.frame = Projectile.frameCounter / 5 % Main.projFrames[Type];
|
||||
}
|
||||
|
||||
public override void ShootAtTarget(NPC target, Vector2 shootDirection)
|
||||
{
|
||||
// Play the plasma caster fire sound.
|
||||
SoundEngine.PlaySound(PlasmaCaster.FireSound with { Volume = 0.4f }, Projectile.Center);
|
||||
|
||||
// Create a burst of dust.
|
||||
for (int i = 0; i < 40; i++)
|
||||
{
|
||||
float dustSpeed = Main.rand.NextFloat(1.8f, 3f);
|
||||
Vector2 dustVel = shootDirection * dustSpeed;
|
||||
dustVel = dustVel.RotatedBy(-0.35f);
|
||||
dustVel = dustVel.RotatedByRandom(2.0f * 0.35f);
|
||||
int randomDustType = Main.rand.NextBool(2) ? 107 : 110;
|
||||
|
||||
Dust plasma = Dust.NewDustDirect(Projectile.TopLeft, Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 200, default, 1.7f);
|
||||
plasma.position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 4f;
|
||||
plasma.position += shootDirection * 60f;
|
||||
plasma.noGravity = true;
|
||||
plasma.velocity *= Projectile.scale * 1.6f;
|
||||
|
||||
plasma = Dust.NewDustDirect(Projectile.TopLeft, Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 100, default, 0.8f);
|
||||
plasma.position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 4f;
|
||||
plasma.position += shootDirection * 60f;
|
||||
plasma.velocity *= Projectile.scale * 0.9f;
|
||||
|
||||
plasma.noGravity = true;
|
||||
plasma.fadeIn = 1f;
|
||||
plasma.color = Color.Green * 0.5f;
|
||||
}
|
||||
for (int i = 0; i < 20; i++)
|
||||
{
|
||||
float dustSpeed = Main.rand.NextFloat(1.8f, 3f);
|
||||
Vector2 dustVel = shootDirection * dustSpeed;
|
||||
dustVel = dustVel.RotatedBy(-0.35f);
|
||||
dustVel = dustVel.RotatedByRandom(2.0f * 0.35f);
|
||||
int randomDustType = Main.rand.NextBool(2) ? 107 : 110;
|
||||
|
||||
Dust plasma = Dust.NewDustDirect(Projectile.TopLeft, Projectile.width, Projectile.height, randomDustType, dustVel.X, dustVel.Y, 0, default, 2f);
|
||||
plasma.position = Projectile.Center + Vector2.UnitX.RotatedByRandom(MathHelper.Pi).RotatedBy(shootDirection.ToRotation()) * Projectile.width / 5f;
|
||||
plasma.position += shootDirection * 60f;
|
||||
plasma.noGravity = true;
|
||||
plasma.velocity *= Projectile.scale * 0.27f;
|
||||
}
|
||||
|
||||
// Shoot the fireball. This only happens for the owner client.
|
||||
if (Main.myPlayer != Projectile.owner)
|
||||
return;
|
||||
|
||||
Vector2 fireballVelocity = shootDirection * ShootSpeed;
|
||||
int fireball = Projectile.NewProjectile(Projectile.GetSource_FromAI(), Projectile.Center, fireballVelocity, ModContent.ProjectileType<MinionPlasmaBlast>(), Projectile.damage, 0f, Projectile.owner);
|
||||
if (Main.projectile.IndexInRange(fireball))
|
||||
Main.projectile[fireball].originalDamage = Projectile.originalDamage;
|
||||
}
|
||||
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
DefaultDrawCannon(ModContent.Request<Texture2D>("CalamityMod/Projectiles/Summon/SmallAresArms/ExoskeletonPlasmaCannonGlowmask").Value);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 3.4 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
@@ -0,0 +1,67 @@
|
||||
using CalamityMod.Sounds;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
using Terraria.Audio;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using CalamityMod.Items.Weapons.Summon;
|
||||
using System.IO;
|
||||
|
||||
namespace CalamityMod.Projectiles.Summon.SmallAresArms
|
||||
{
|
||||
public class ExoskeletonTeslaCannon : ExoskeletonCannon
|
||||
{
|
||||
public ref float TeslaOrbIndex => ref Projectile.localAI[0];
|
||||
|
||||
public override int ShootRate => AresExoskeleton.TeslaCannonShootRate;
|
||||
|
||||
public override float ShootSpeed => 12f;
|
||||
|
||||
public override bool UsesSuperpredictiveness => true;
|
||||
|
||||
public override Vector2 OwnerRestingOffset => HoverOffsetTable[HoverOffsetIndex];
|
||||
|
||||
public override void ClampFirstLimbRotation(ref double limbRotation) => limbRotation = RotationalClampTable[HoverOffsetIndex];
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Tesla Cannon");
|
||||
Main.projFrames[Type] = 6;
|
||||
}
|
||||
|
||||
public override void SendExtraAI(BinaryWriter writer) => writer.Write(TeslaOrbIndex);
|
||||
|
||||
public override void ReceiveExtraAI(BinaryReader reader) => TeslaOrbIndex = reader.ReadSingle();
|
||||
|
||||
public override void PostAI()
|
||||
{
|
||||
Projectile.frameCounter++;
|
||||
Projectile.frame = Projectile.frameCounter / 5 % Main.projFrames[Type];
|
||||
}
|
||||
|
||||
public override void ShootAtTarget(NPC target, Vector2 shootDirection)
|
||||
{
|
||||
// Play the plasma bolt fire sound.
|
||||
SoundEngine.PlaySound(CommonCalamitySounds.PlasmaBoltSound with { Volume = 0.4f }, Projectile.Center);
|
||||
|
||||
// Shoot the tesla orb. This only happens for the owner client.
|
||||
if (Main.myPlayer != Projectile.owner)
|
||||
return;
|
||||
|
||||
int damage = (int)(Projectile.damage * AresExoskeleton.TeslaOrbDamageFactor);
|
||||
Vector2 teslaOrbVelocity = shootDirection * ShootSpeed;
|
||||
int teslaOrb = Projectile.NewProjectile(Projectile.GetSource_FromAI(), Projectile.Center, teslaOrbVelocity, ModContent.ProjectileType<MinionTeslaOrb>(), damage, 0f, Projectile.owner);
|
||||
if (Main.projectile.IndexInRange(teslaOrb))
|
||||
{
|
||||
Main.projectile[teslaOrb].originalDamage = (int)(Projectile.originalDamage * AresExoskeleton.TeslaOrbDamageFactor);
|
||||
Main.projectile[teslaOrb].ai[0] = TeslaOrbIndex++ % 6;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
DefaultDrawCannon(ModContent.Request<Texture2D>("CalamityMod/Projectiles/Summon/SmallAresArms/ExoskeletonTeslaCannonGlowmask").Value);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 4.6 KiB |
|
After Width: | Height: | Size: 2.7 KiB |
@@ -0,0 +1,34 @@
|
||||
using CalamityMod.Projectiles.BaseProjectiles;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Summon.SmallAresArms
|
||||
{
|
||||
public class MinionGaussBoom : BaseMassiveExplosionProjectile
|
||||
{
|
||||
public override int Lifetime => 60;
|
||||
|
||||
// No screenshake is used for the sake of gameplay convenience.
|
||||
public override bool UsesScreenshake => false;
|
||||
public override float GetScreenshakePower(float pulseCompletionRatio) => 0f;
|
||||
public override Color GetCurrentExplosionColor(float pulseCompletionRatio) => Color.Lerp(Color.Yellow * 1.6f, Color.White, MathHelper.Clamp(pulseCompletionRatio * 2.2f, 0f, 1f));
|
||||
public override void SetStaticDefaults() => DisplayName.SetDefault("Gauss Hyperexplosion");
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = Projectile.height = 2;
|
||||
Projectile.friendly = true;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.timeLeft = Lifetime;
|
||||
Projectile.minion = true;
|
||||
Projectile.minionSlots = 0f;
|
||||
Projectile.DamageType = DamageClass.Summon;
|
||||
Projectile.usesLocalNPCImmunity = true;
|
||||
Projectile.localNPCHitCooldown = 12;
|
||||
}
|
||||
|
||||
public override void PostAI() => Lighting.AddLight(Projectile.Center, 0.2f, 0.1f, 0f);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
using CalamityMod.Items.Weapons.DraedonsArsenal;
|
||||
using CalamityMod.Items.Weapons.Summon;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Summon.SmallAresArms
|
||||
{
|
||||
public class MinionGaussNuke : ModProjectile
|
||||
{
|
||||
public override void SetStaticDefaults() => DisplayName.SetDefault("Gauss Nuke");
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = Projectile.height = 76;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.tileCollide = true;
|
||||
Projectile.timeLeft = 180;
|
||||
Projectile.friendly = true;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.minion = true;
|
||||
Projectile.minionSlots = 0f;
|
||||
Projectile.DamageType = DamageClass.Summon;
|
||||
Projectile.usesLocalNPCImmunity = true;
|
||||
Projectile.localNPCHitCooldown = 12;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
// Handle rotation.
|
||||
Projectile.rotation = Projectile.velocity.ToRotation();
|
||||
|
||||
// Home towards targets.
|
||||
NPC potentialTarget = Projectile.Center.ClosestNPCAt(960f, false);
|
||||
if (potentialTarget != null)
|
||||
Projectile.velocity = Projectile.SuperhomeTowardsTarget(potentialTarget, 23f, 10f);
|
||||
}
|
||||
|
||||
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
|
||||
{
|
||||
Projectile.Kill();
|
||||
}
|
||||
|
||||
public override void Kill(int timeLeft)
|
||||
{
|
||||
SoundEngine.PlaySound(TeslaCannon.FireSound, Projectile.Center);
|
||||
if (Main.myPlayer == Projectile.owner)
|
||||
{
|
||||
int boom = Projectile.NewProjectile(Projectile.GetSource_Death(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType<MinionGaussBoom>(), Projectile.damage, Projectile.knockBack, Projectile.owner);
|
||||
if (Main.projectile.IndexInRange(boom))
|
||||
{
|
||||
Main.projectile[boom].ai[1] = AresExoskeleton.MaxNukeExplosionRadius;
|
||||
Main.projectile[boom].originalDamage = Projectile.originalDamage;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 929 B |