Merge branch '1.4.4' into SulphuricAcidCannon
No files matched your search
@@ -46,6 +46,8 @@ namespace CalamityMod.CalPlayer.DrawLayers
|
||||
glowMask = ModContent.Request<Texture2D>("CalamityMod/Items/Weapons/Ranged/AuralisGlow").Value;
|
||||
else if (itemType == ModContent.ItemType<AuroraBlazer>())
|
||||
glowMask = ModContent.Request<Texture2D>("CalamityMod/Items/Weapons/Ranged/AuroraBlazerGlow").Value;
|
||||
else if (itemType == ModContent.ItemType<ChromaticEruption>())
|
||||
glowMask = ModContent.Request<Texture2D>("CalamityMod/Items/Weapons/Ranged/ChromaticEruptionGlow").Value;
|
||||
else if (itemType == ModContent.ItemType<CleansingBlaze>())
|
||||
glowMask = ModContent.Request<Texture2D>("CalamityMod/Items/Weapons/Ranged/CleansingBlazeGlow").Value;
|
||||
else if (itemType == ModContent.ItemType<CosmicImmaterializer>())
|
||||
@@ -66,6 +68,8 @@ namespace CalamityMod.CalPlayer.DrawLayers
|
||||
glowMask = ModContent.Request<Texture2D>("CalamityMod/Items/Weapons/Magic/FatesRevealGlow").Value;
|
||||
else if (itemType == ModContent.ItemType<GreatswordofJudgement>())
|
||||
glowMask = ModContent.Request<Texture2D>("CalamityMod/Items/Weapons/Melee/GreatswordofJudgementGlow").Value;
|
||||
else if (itemType == ModContent.ItemType<LegionofCelestia>())
|
||||
glowMask = ModContent.Request<Texture2D>("CalamityMod/Items/Weapons/Summon/LegionofCelestiaGlow").Value;
|
||||
else if (itemType == ModContent.ItemType<NecroplasmicBeacon>())
|
||||
glowMask = ModContent.Request<Texture2D>("CalamityMod/Items/SummonItems/NecroplasmicBeaconGlow").Value;
|
||||
else if (itemType == ModContent.ItemType<Orderbringer>())
|
||||
@@ -80,6 +84,8 @@ namespace CalamityMod.CalPlayer.DrawLayers
|
||||
glowMask = ModContent.Request<Texture2D>("CalamityMod/Items/Weapons/DraedonsArsenal/PulseRifleGlow").Value;
|
||||
else if (itemType == ModContent.ItemType<SoulPiercer>())
|
||||
glowMask = ModContent.Request<Texture2D>("CalamityMod/Items/Weapons/Magic/SoulPiercerGlow").Value;
|
||||
else if (itemType == ModContent.ItemType<StarburstShiv>())
|
||||
glowMask = ModContent.Request<Texture2D>("CalamityMod/Items/Weapons/Melee/StarburstShivGlow").Value;
|
||||
else if (itemType == ModContent.ItemType<SubsumingVortex>())
|
||||
glowMask = ModContent.Request<Texture2D>("CalamityMod/Items/Weapons/Magic/SubsumingVortexSmallGlow").Value;
|
||||
else if (itemType == ModContent.ItemType<TerrorBlade>())
|
||||
|
||||
@@ -80,15 +80,8 @@ namespace CalamityMod.ILEditing
|
||||
cursor.Remove();
|
||||
cursor.Emit(OpCodes.Ldc_R4, 0.5f); // Decrease to 0.5f.
|
||||
|
||||
// Find the Frog Leg jump speed bonus and reduce it to 1.2f.
|
||||
// I don't know if this fucking does anything anymore, but I'm leaving it in just in case.
|
||||
if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdcR4(2.4f)))
|
||||
{
|
||||
LogFailure("Jump Height Boost Fixes", "Could not locate Frog Leg jump speed boost value.");
|
||||
return;
|
||||
}
|
||||
cursor.Remove();
|
||||
cursor.Emit(OpCodes.Ldc_R4, 1.2f); // Decrease to 1.2f.
|
||||
// CIT 22SEP2024: Removed the edit intended to decrease Frog Leg's jump speed boost,
|
||||
// as it was not doing anything due to vanilla changing how Frog Leg's jump speed boost is applied.
|
||||
|
||||
// Remove the jump height addition from the Werewolf buff (Moon Charm).
|
||||
if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdcI4(2)))
|
||||
|
||||
@@ -42,6 +42,7 @@ namespace CalamityMod.Items.Accessories
|
||||
modPlayer.DashID = StatisVoidSashDash.ID;
|
||||
player.dashType = 0;
|
||||
player.spikedBoots = 2;
|
||||
player.accFlipper = true;
|
||||
}
|
||||
|
||||
public override void AddRecipes()
|
||||
|
||||
|
Before Width: | Height: | Size: 469 B After Width: | Height: | Size: 402 B |
@@ -1038,7 +1038,7 @@ namespace CalamityMod.Items
|
||||
|
||||
// Lead
|
||||
if (item.type == ItemID.LeadHelmet || item.type == ItemID.LeadChainmail || item.type == ItemID.LeadGreaves)
|
||||
AddTooltip("Increases damage reduction by 3%");
|
||||
AddTooltip("Increases damage reduction by 2%");
|
||||
|
||||
// Silver
|
||||
if (item.type == ItemID.SilverHelmet)
|
||||
|
||||
@@ -126,7 +126,7 @@ namespace CalamityMod.Items
|
||||
{ ItemID.GrenadeLauncher, Do(DamageExact(112)) },
|
||||
{ ItemID.Gungnir, Do(AutoReuse, TrueMelee, UseRatio(0.8f), DamageExact(92), ShootSpeedRatio(1.25f)) },
|
||||
{ ItemID.HallowedRepeater, Do(PointBlank, UseExact(12)) },
|
||||
{ ItemID.Handgun, Do(PointBlank, UseExact(22)) },
|
||||
{ ItemID.Handgun, Do(PointBlank, UseExact(20)) },
|
||||
{ ItemID.HellwingBow, Do(PointBlank, DamageExact(16)) },
|
||||
{ ItemID.HighVelocityBullet, Do(DamageExact(13)) },
|
||||
{ ItemID.HiveFive, Do(AutoReuse, DamageExact(27)) },
|
||||
|
||||
|
Before Width: | Height: | Size: 924 B After Width: | Height: | Size: 902 B |
@@ -22,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
{
|
||||
Item.width = 124;
|
||||
Item.height = 124;
|
||||
Item.damage = 2777; // Feel free to change these 7s as balance requires. The other 7s should stay
|
||||
Item.damage = 1977; // Feel free to change these 7s as balance requires. The other 7s should stay - Update: no more 2777... :(
|
||||
Item.DamageType = TrueMeleeDamageClass.Instance;
|
||||
Item.useAnimation = 77;
|
||||
Item.useTime = 77;
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using CalamityMod.Items.Materials;
|
||||
using CalamityMod.Projectiles.Melee.Shortswords;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
@@ -13,8 +15,8 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.width = 44;
|
||||
Item.height = 44;
|
||||
Item.width = 74;
|
||||
Item.height = 94;
|
||||
Item.noMelee = true;
|
||||
Item.noUseGraphic = true;
|
||||
Item.autoReuse = true;
|
||||
@@ -32,6 +34,8 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
|
||||
public override bool MeleePrefix() => true;
|
||||
|
||||
public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) => Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request<Texture2D>("CalamityMod/Items/Weapons/Melee/StarburstShivGlow").Value);
|
||||
|
||||
public override void AddRecipes()
|
||||
{
|
||||
CreateRecipe().
|
||||
|
||||
|
Before Width: | Height: | Size: 948 B After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 1.8 KiB |
@@ -1,6 +1,7 @@
|
||||
using CalamityMod.Items.Materials;
|
||||
using CalamityMod.Projectiles.Ranged;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.ID;
|
||||
@@ -19,8 +20,8 @@ namespace CalamityMod.Items.Weapons.Ranged
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.width = 64;
|
||||
Item.height = 34;
|
||||
Item.width = 166;
|
||||
Item.height = 60;
|
||||
Item.damage = 94;
|
||||
Item.DamageType = DamageClass.Ranged;
|
||||
Item.useAnimation = Item.useTime = 6;
|
||||
@@ -54,6 +55,8 @@ namespace CalamityMod.Items.Weapons.Ranged
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) => Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request<Texture2D>("CalamityMod/Items/Weapons/Ranged/ChromaticEruptionGlow").Value);
|
||||
|
||||
public override void AddRecipes()
|
||||
{
|
||||
CreateRecipe().
|
||||
|
||||
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 3.8 KiB |
|
After Width: | Height: | Size: 2.0 KiB |
@@ -1,6 +1,11 @@
|
||||
using CalamityMod.Projectiles.Ranged;
|
||||
using System;
|
||||
using System.Diagnostics.Metrics;
|
||||
using CalamityMod.Particles;
|
||||
using CalamityMod.Projectiles.Ranged;
|
||||
using Microsoft.Build.Tasks;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
@@ -10,48 +15,108 @@ namespace CalamityMod.Items.Weapons.Ranged
|
||||
public class Leviatitan : ModItem, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Items.Weapons.Ranged";
|
||||
// Every sixth shot fires homing Aberrations, then resets the counter to 2.
|
||||
// This is intentional so you don't get the Aberrations instantly when you start firing and have to play around it.
|
||||
private int shotCounter = 1;
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.width = 82;
|
||||
Item.height = 28;
|
||||
Item.damage = 77;
|
||||
Item.damage = 121;
|
||||
Item.DamageType = DamageClass.Ranged;
|
||||
Item.useTime = 10;
|
||||
Item.useAnimation = 10;
|
||||
Item.useStyle = ItemUseStyleID.Shoot;
|
||||
Item.useTime = Item.useAnimation = 18; //Try not to change this if you can help it.
|
||||
Item.noMelee = true;
|
||||
Item.knockBack = 5f;
|
||||
Item.value = CalamityGlobalItem.RarityLimeBuyPrice;
|
||||
Item.rare = ItemRarityID.Lime;
|
||||
Item.UseSound = SoundID.Item92;
|
||||
Item.UseSound = new SoundStyle("CalamityMod/Sounds/Item/FlakKrakenShoot") { Pitch = 0.65f, Volume = 0.4f };
|
||||
Item.autoReuse = true;
|
||||
Item.shoot = ModContent.ProjectileType<AquaBlast>();
|
||||
Item.shootSpeed = 12f;
|
||||
Item.shootSpeed = 13f;
|
||||
Item.useStyle = ItemUseStyleID.Shoot;
|
||||
Item.useAmmo = AmmoID.Bullet;
|
||||
Item.Calamity().canFirePointBlankShots = true;
|
||||
}
|
||||
|
||||
public override Vector2? HoldoutOffset()
|
||||
public override Vector2? HoldoutOffset() => new Vector2(-10, 0);
|
||||
|
||||
public override bool AltFunctionUse(Player player)
|
||||
{
|
||||
return new Vector2(-15, 0);
|
||||
return true;
|
||||
}
|
||||
public override bool CanUseItem(Player player)
|
||||
{
|
||||
Item.UseSound = player.altFunctionUse == 2 ? SoundID.NPCHit56 : new SoundStyle("CalamityMod/Sounds/Item/FlakKrakenShoot") { Pitch = 0.65f, Volume = 0.3f };
|
||||
return base.CanUseItem(player);
|
||||
}
|
||||
public override float UseSpeedMultiplier(Player player) => player.altFunctionUse == 2 ? (1f / 3f) : 1f;
|
||||
|
||||
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
|
||||
{
|
||||
float SpeedX = velocity.X + Main.rand.Next(-10, 11) * 0.05f;
|
||||
float SpeedY = velocity.Y + Main.rand.Next(-10, 11) * 0.05f;
|
||||
// Reposition to the gun's tip. Calculated seperately due to the two different shot styles.
|
||||
Vector2 boulderPos = position + new Vector2(74f, player.direction * (Math.Abs(velocity.SafeNormalize(Vector2.Zero).X) < 0.02f ? -2f : -8f)).RotatedBy(velocity.ToRotation());
|
||||
Vector2 shotPos = position + new Vector2(74f, player.direction * (Math.Abs(velocity.SafeNormalize(Vector2.Zero).X) < 0.02f ? -6f : 3f)).RotatedBy(velocity.ToRotation());
|
||||
|
||||
if (type == ProjectileID.Bullet)
|
||||
if (player.altFunctionUse == 2)
|
||||
{
|
||||
if (Main.rand.NextBool(3))
|
||||
Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType<AquaBlastToxic>(), (int)(damage * 1.5), knockback, player.whoAmI);
|
||||
else
|
||||
Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType<AquaBlast>(), damage, knockback, player.whoAmI);
|
||||
int index = Projectile.NewProjectile(source, boulderPos, velocity * 0.7f, ModContent.ProjectileType<LeviatitanMeteor>(), (int)(damage * 2f), knockback, player.whoAmI);
|
||||
}
|
||||
else
|
||||
Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI);
|
||||
|
||||
{
|
||||
Projectile.NewProjectile(source, shotPos, velocity, Item.shoot, damage, knockback, player.whoAmI);
|
||||
}
|
||||
if (shotCounter == 7)
|
||||
{
|
||||
SoundEngine.PlaySound(SoundID.Zombie38 with { Volume = SoundID.Zombie38.Volume * 0.5f });
|
||||
for (int i = 0; i <= 1; i++)
|
||||
{
|
||||
float projSpeed = Item.shootSpeed;
|
||||
Projectile.NewProjectile(source, position + Main.rand.NextVector2Circular(150, 150), velocity * projSpeed, ModContent.ProjectileType<LeviatitanAberration>(), (int)(damage * 1.3), knockback, player.whoAmI);
|
||||
}
|
||||
}
|
||||
shotCounter++;
|
||||
if (shotCounter > 7)
|
||||
shotCounter = 2;
|
||||
return false;
|
||||
}
|
||||
|
||||
//Thanks to Xyk's incredible recoil code, we give both left click and right click different recoils without having to use a holdout.
|
||||
public override void UseStyle(Player player, Rectangle heldItemFrame)
|
||||
{
|
||||
player.ChangeDir(Math.Sign((player.Calamity().mouseWorld - player.Center).X));
|
||||
float itemRotation = player.compositeFrontArm.rotation + MathHelper.PiOver2 * player.gravDir;
|
||||
|
||||
float pullback = 7f;
|
||||
|
||||
float animProgress = 0.5f - player.itemTime / (float)player.itemTimeMax;
|
||||
float rotation = (player.Center - player.Calamity().mouseWorld).ToRotation() * player.gravDir + MathHelper.PiOver2;
|
||||
if (animProgress < 0.1f)
|
||||
pullback -= (2.75f) * (float)Math.Pow((0.6f - animProgress) / 0.6f, 2);
|
||||
|
||||
Vector2 itemPosition = player.MountedCenter + itemRotation.ToRotationVector2() * pullback;
|
||||
Vector2 itemSize = new Vector2(52, 28);
|
||||
Vector2 itemOrigin = new Vector2(-24, 4);
|
||||
|
||||
CalamityUtils.CleanHoldStyle(player, itemRotation, itemPosition, itemSize, itemOrigin);
|
||||
|
||||
base.UseStyle(player, heldItemFrame);
|
||||
}
|
||||
public override void UseItemFrame(Player player)
|
||||
{
|
||||
player.ChangeDir(Math.Sign((player.Calamity().mouseWorld - player.Center).X));
|
||||
|
||||
float animProgress = 0.5f - player.itemTime / (float)player.itemTimeMax;
|
||||
float rotation = (player.Center - player.Calamity().mouseWorld).ToRotation() * player.gravDir + MathHelper.PiOver2;
|
||||
if (animProgress < 0.4f)
|
||||
rotation += (player.altFunctionUse == 2 ? -0.15f : 0) * (float)Math.Pow((0.6f - animProgress) / 0.6f, 2) * player.direction;
|
||||
|
||||
player.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, rotation);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,13 +12,13 @@ namespace CalamityMod.Items.Weapons.Rogue
|
||||
[LegacyName("TerraDisk")]
|
||||
public class SamsaraSlicer : RogueWeapon
|
||||
{
|
||||
public static float Speed = 12f;
|
||||
public static float Speed = 20f;
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.width = 60;
|
||||
Item.height = 64;
|
||||
Item.damage = 100;
|
||||
Item.damage = 80;
|
||||
Item.knockBack = 4f;
|
||||
Item.useAnimation = Item.useTime = 30;
|
||||
Item.autoReuse = true;
|
||||
@@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Rogue
|
||||
Item.noUseGraphic = true;
|
||||
|
||||
Item.useStyle = ItemUseStyleID.Swing;
|
||||
Item.UseSound = SoundID.Item1;
|
||||
Item.UseSound = SoundID.DD2_GoblinBomberThrow;
|
||||
|
||||
Item.value = CalamityGlobalItem.RarityYellowBuyPrice;
|
||||
Item.rare = ItemRarityID.Yellow;
|
||||
@@ -36,10 +36,12 @@ namespace CalamityMod.Items.Weapons.Rogue
|
||||
Item.shootSpeed = Speed;
|
||||
}
|
||||
|
||||
public override float StealthVelocityMultiplier => 0.75f;
|
||||
public override float StealthVelocityMultiplier => 1.5f;
|
||||
|
||||
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
|
||||
{
|
||||
if (player.ownedProjectileCounts[type] > 4) return false;
|
||||
|
||||
int proj = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI);
|
||||
if (player.Calamity().StealthStrikeAvailable() && proj.WithinBounds(Main.maxProjectiles))
|
||||
{
|
||||
@@ -48,6 +50,12 @@ namespace CalamityMod.Items.Weapons.Rogue
|
||||
return false;
|
||||
}
|
||||
|
||||
public override bool CanUseItem(Player player)
|
||||
{
|
||||
if (player.ownedProjectileCounts[Item.shoot] > 4) return false;
|
||||
return base.CanUseItem(player);
|
||||
}
|
||||
|
||||
public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI)
|
||||
{
|
||||
Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request<Texture2D>("CalamityMod/Items/Weapons/Rogue/SamsaraSlicerGlow").Value);
|
||||
|
||||
@@ -31,22 +31,7 @@ namespace CalamityMod.Items.Weapons.Summon
|
||||
|
||||
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
|
||||
{
|
||||
Projectile flarebatMinion = Projectile.NewProjectileDirect(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI);
|
||||
|
||||
int minionIndex = 0;
|
||||
foreach (var proj in Main.ActiveProjectiles)
|
||||
{
|
||||
if ((proj.type != flarebatMinion.type && proj.type != ModContent.ProjectileType<FrostbatMinion>()) || proj.owner != flarebatMinion.owner)
|
||||
continue;
|
||||
|
||||
if (proj.type == flarebatMinion.type)
|
||||
proj.ModProjectile<FlarebatMinion>().MinionIndex = minionIndex;
|
||||
else
|
||||
proj.ModProjectile<FrostbatMinion>().MinionIndex = minionIndex;
|
||||
|
||||
minionIndex++;
|
||||
}
|
||||
|
||||
Projectile.NewProjectileDirect(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,22 +31,7 @@ namespace CalamityMod.Items.Weapons.Summon
|
||||
|
||||
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
|
||||
{
|
||||
Projectile frostbatMinion = Projectile.NewProjectileDirect(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI);
|
||||
|
||||
int minionIndex = 0;
|
||||
foreach (var proj in Main.ActiveProjectiles)
|
||||
{
|
||||
if ((proj.type != frostbatMinion.type && proj.type != ModContent.ProjectileType<FlarebatMinion>()) || proj.owner != frostbatMinion.owner)
|
||||
continue;
|
||||
|
||||
if (proj.type == frostbatMinion.type)
|
||||
proj.ModProjectile<FrostbatMinion>().MinionIndex = minionIndex;
|
||||
else
|
||||
proj.ModProjectile<FlarebatMinion>().MinionIndex = minionIndex;
|
||||
|
||||
minionIndex++;
|
||||
}
|
||||
|
||||
Projectile.NewProjectileDirect(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using CalamityMod.Items.Materials;
|
||||
using CalamityMod.Projectiles.Summon;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.ID;
|
||||
@@ -14,8 +15,8 @@ namespace CalamityMod.Items.Weapons.Summon
|
||||
public new string LocalizationCategory => "Items.Weapons.Summon";
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.width = 36;
|
||||
Item.height = 36;
|
||||
Item.width = 100;
|
||||
Item.height = 128;
|
||||
Item.damage = 57;
|
||||
Item.DamageType = DamageClass.Summon;
|
||||
Item.mana = 10;
|
||||
@@ -31,6 +32,11 @@ namespace CalamityMod.Items.Weapons.Summon
|
||||
Item.shootSpeed = 10f;
|
||||
}
|
||||
|
||||
public override void UseStyle(Player player, Rectangle heldItemFrame)
|
||||
{
|
||||
player.itemLocation += new Vector2(-20f * player.direction, 34f * player.gravDir).RotatedBy(player.itemRotation);
|
||||
}
|
||||
|
||||
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
|
||||
{
|
||||
if (player.altFunctionUse != 2)
|
||||
@@ -45,6 +51,8 @@ namespace CalamityMod.Items.Weapons.Summon
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) => Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request<Texture2D>("CalamityMod/Items/Weapons/Summon/LegionofCelestiaGlow").Value);
|
||||
|
||||
public override void AddRecipes()
|
||||
{
|
||||
CreateRecipe().
|
||||
|
||||
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 3.3 KiB |
|
After Width: | Height: | Size: 2.6 KiB |
@@ -1648,7 +1648,7 @@ StatisVoidSash: {
|
||||
Tooltip:
|
||||
'''
|
||||
32% increased jump speed, allows auto-jump, and negates fall damage
|
||||
Can climb walls, dash, and dodge attacks
|
||||
Can swim, climb walls, dash, and dodge attacks
|
||||
'''
|
||||
HoldShiftTooltip:
|
||||
'''
|
||||
|
||||
@@ -682,7 +682,13 @@ Kingsbane: {
|
||||
|
||||
Leviatitan: {
|
||||
DisplayName: Leviatitan
|
||||
Tooltip: Converts musket balls into toxic and normal water blasts
|
||||
Tooltip:
|
||||
'''
|
||||
Fires high velocity aqua blasts
|
||||
Releases homing aberrations that shred enemy defense every six shots
|
||||
<right> to vomit a meteor that explodes on hit
|
||||
'The L in LMG stands for Leviathan'
|
||||
'''
|
||||
}
|
||||
|
||||
LunarianBow: {
|
||||
|
||||
@@ -253,3 +253,7 @@ HellbornShell.DisplayName: Hell's Shell
|
||||
RubicoPrimeMag.DisplayName: Rubico Prime Mag
|
||||
MegalodonShot.DisplayName: Megalodon Shot
|
||||
SulphuricAcidCannonExplosion.DisplayName: Sulphuric Acid Cannon Explosion
|
||||
SulphuricAcidCannonExplosion.DisplayName: Sulphuric Acid Cannon Explosion
|
||||
LeviatitanAberration.DisplayName: Leviatitan Aberration
|
||||
LeviatitanMeteor.DisplayName: Leviatitan Meteor
|
||||
LeviatitanExplosion.DisplayName: Leviatitan Explosion
|
||||
@@ -48,7 +48,7 @@ ChaliceOfTheBloodGodUnequip: "{0} violated their pact with the Blood God."
|
||||
ChibiiDoggo: "{0} couldn't stand the sharp objects."
|
||||
CirrusSlap1: "{0} was slapped too hard."
|
||||
CirrusSlap2: "{0} forked around and found out."
|
||||
CorpusAvertor: "{0} became the blood god's sacrifice."
|
||||
CorpusAvertor: "{0} became the Blood God's sacrifice."
|
||||
CrushDepth1: "{0} was crushed by the pressure."
|
||||
CrushDepth2: "{0}'s lungs collapsed."
|
||||
CrushDepth3: "{0}'s bones crunched under the deep pressure."
|
||||
|
||||
@@ -6162,16 +6162,17 @@ PrepareToShoot:
|
||||
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
{
|
||||
if (npc.justHit || !Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height))
|
||||
npc.ai[0] = 0f;
|
||||
|
||||
if (npc.type == NPCID.Harpy)
|
||||
{
|
||||
float featherShootCutOffValue = CalamityWorld.revenge ? 90f : 60f;
|
||||
if (npc.justHit || !Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height))
|
||||
npc.ai[0] = featherShootCutOffValue + 1f;
|
||||
|
||||
if (npc.ai[0] >= HarpyFeatherGateValue)
|
||||
{
|
||||
npc.ai[0] = 0f;
|
||||
}
|
||||
else if (npc.ai[0] % 30f == 0f && npc.ai[0] <= (CalamityWorld.revenge ? 90f : 60f))
|
||||
else if (npc.ai[0] % 30f == 0f && npc.ai[0] <= featherShootCutOffValue)
|
||||
{
|
||||
npc.ai[0] += 1f;
|
||||
if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height))
|
||||
@@ -6195,11 +6196,15 @@ PrepareToShoot:
|
||||
|
||||
if (npc.type == NPCID.Demon || npc.type == NPCID.VoodooDemon)
|
||||
{
|
||||
float scytheShootCutOffValue = CalamityWorld.revenge ? 80f : 60f;
|
||||
if (npc.justHit || !Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height))
|
||||
npc.ai[0] = scytheShootCutOffValue + 1f;
|
||||
|
||||
if (npc.ai[0] >= DemonScytheGateValue)
|
||||
{
|
||||
npc.ai[0] = 0f;
|
||||
}
|
||||
else if (npc.ai[0] % 20f == 0f && npc.ai[0] <= (CalamityWorld.revenge ? 80f : 60f))
|
||||
else if (npc.ai[0] % 20f == 0f && npc.ai[0] <= scytheShootCutOffValue)
|
||||
{
|
||||
npc.ai[0] += 1f;
|
||||
if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height))
|
||||
@@ -6223,11 +6228,15 @@ PrepareToShoot:
|
||||
|
||||
if (npc.type == NPCID.RedDevil)
|
||||
{
|
||||
float tridentShootCutOffValue = 80f;
|
||||
if (npc.justHit || !Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height))
|
||||
npc.ai[0] = tridentShootCutOffValue + 1f;
|
||||
|
||||
if (npc.ai[0] >= RedDevilTridentGateValue)
|
||||
{
|
||||
npc.ai[0] = 0f;
|
||||
}
|
||||
else if (npc.ai[0] % 20f == 0f && npc.ai[0] <= 80f)
|
||||
else if (npc.ai[0] % 20f == 0f && npc.ai[0] <= tridentShootCutOffValue)
|
||||
{
|
||||
npc.ai[0] += 1f;
|
||||
if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height))
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Terraria;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
@@ -28,15 +29,9 @@ namespace CalamityMod.Projectiles.Magic
|
||||
public override void AI()
|
||||
{
|
||||
Projectile.rotation = Projectile.velocity.ToRotation();
|
||||
if (Projectile.frameCounter++ % 4 == 0)
|
||||
{
|
||||
Projectile.frame++;
|
||||
}
|
||||
if (Projectile.frame >= Main.projFrames[Projectile.type])
|
||||
{
|
||||
Projectile.frame = 0;
|
||||
}
|
||||
Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.25f / 255f, (255 - Projectile.alpha) * 0.2f / 255f, (255 - Projectile.alpha) * 0.01f / 255f);
|
||||
Projectile.frameCounter++;
|
||||
Projectile.frame = Projectile.frameCounter / 4 % Main.projFrames[Projectile.type];
|
||||
Lighting.AddLight(Projectile.Center, 0.25f, 0.2f, 0.01f);
|
||||
if (Projectile.wet && !Projectile.lavaWet)
|
||||
{
|
||||
Projectile.Kill();
|
||||
@@ -48,17 +43,18 @@ namespace CalamityMod.Projectiles.Magic
|
||||
}
|
||||
if (Main.rand.NextBool(4))
|
||||
{
|
||||
int forbid = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, Main.rand.NextBool(3) ? 16 : 174, 0f, 0f);
|
||||
Main.dust[forbid].noGravity = true;
|
||||
Main.dust[forbid].velocity *= 0f;
|
||||
Dust fire = Dust.NewDustDirect(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, Main.rand.NextBool(3) ? 16 : 174);
|
||||
fire.noGravity = true;
|
||||
fire.velocity *= 0f;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnKill(int timeLeft)
|
||||
{
|
||||
SoundEngine.PlaySound(SoundID.Item20, Projectile.Center);
|
||||
if (Projectile.owner == Main.myPlayer)
|
||||
{
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, 0f, 0f, ModContent.ProjectileType<ForbiddenSunburst>(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f);
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType<ForbiddenSunburst>(), Projectile.damage, Projectile.knockBack, Projectile.owner);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
using System;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
@@ -35,11 +33,6 @@ namespace CalamityMod.Projectiles.Magic
|
||||
{
|
||||
Projectile.Kill();
|
||||
}
|
||||
if (Projectile.localAI[0] == 0f)
|
||||
{
|
||||
SoundEngine.PlaySound(SoundID.Item20, Projectile.Center);
|
||||
Projectile.localAI[0] += 1f;
|
||||
}
|
||||
float projTimer = 25f;
|
||||
if (Projectile.ai[0] > 180f)
|
||||
{
|
||||
@@ -52,31 +45,24 @@ namespace CalamityMod.Projectiles.Magic
|
||||
}
|
||||
projTimer *= 0.7f;
|
||||
Projectile.ai[0] += 4f;
|
||||
int timerCounter = 0;
|
||||
while ((float)timerCounter < projTimer)
|
||||
float timerCounter = 0;
|
||||
while (timerCounter < projTimer)
|
||||
{
|
||||
float rando1 = (float)Main.rand.Next(-25, 26);
|
||||
float rando2 = (float)Main.rand.Next(-25, 26);
|
||||
float rando3 = (float)Main.rand.Next(9, 24);
|
||||
float randoAdjuster = (float)Math.Sqrt((double)(rando1 * rando1 + rando2 * rando2));
|
||||
randoAdjuster = rando3 / randoAdjuster;
|
||||
rando1 *= randoAdjuster;
|
||||
rando2 *= randoAdjuster;
|
||||
int orngDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Pixie, 0f, 0f, 100, default, 2.5f);
|
||||
Dust dust = Main.dust[orngDust];
|
||||
Dust dust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.Pixie, Alpha: 100, Scale: 2.5f);
|
||||
dust.noGravity = true;
|
||||
dust.position.X = Projectile.Center.X;
|
||||
dust.position.Y = Projectile.Center.Y;
|
||||
dust.position.X += (float)Main.rand.Next(-10, 11);
|
||||
dust.position.Y += (float)Main.rand.Next(-10, 11);
|
||||
dust.velocity.X = rando1;
|
||||
dust.velocity.Y = rando2;
|
||||
dust.position = Projectile.Center + Main.rand.NextVector2Circular(10f, 10f);
|
||||
dust.velocity = Main.rand.NextVector2Circular(25f, 25f);
|
||||
timerCounter++;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffID.OnFire3, 300);
|
||||
|
||||
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
|
||||
{
|
||||
modifiers.HitDirectionOverride = (Projectile.Center.X < target.Center.X).ToDirectionInt();
|
||||
}
|
||||
|
||||
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, ExplosionRadius, targetHitbox);
|
||||
}
|
||||
}
|
||||
@@ -60,6 +60,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
|
||||
public override void UseStyle()
|
||||
{
|
||||
AnimationProgress = Animation % useAnim;
|
||||
DrawUnconditionally = false;
|
||||
|
||||
if (CanHit || postSwing)
|
||||
|
||||
@@ -59,6 +59,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
|
||||
public override void UseStyle()
|
||||
{
|
||||
AnimationProgress = Animation % useAnim;
|
||||
DrawUnconditionally = false;
|
||||
|
||||
if (CanHit || postSwing)
|
||||
|
||||
@@ -61,6 +61,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
|
||||
public override void UseStyle()
|
||||
{
|
||||
AnimationProgress = Animation % useAnim;
|
||||
DrawUnconditionally = false;
|
||||
|
||||
float rate = Main.GlobalTimeWrappedHourly * 19;
|
||||
|
||||
@@ -63,6 +63,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
|
||||
public override void UseStyle()
|
||||
{
|
||||
AnimationProgress = Animation % useAnim;
|
||||
DrawUnconditionally = false;
|
||||
|
||||
if (CanHit || postSwing)
|
||||
|
||||
@@ -63,6 +63,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
|
||||
public override void UseStyle()
|
||||
{
|
||||
AnimationProgress = Animation % useAnim;
|
||||
DrawUnconditionally = false;
|
||||
|
||||
if (CanHit || postSwing)
|
||||
|
||||
@@ -58,6 +58,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
|
||||
public override void UseStyle()
|
||||
{
|
||||
AnimationProgress = Animation % useAnim;
|
||||
DrawUnconditionally = false;
|
||||
|
||||
if (CanHit || postSwing)
|
||||
|
||||
@@ -331,5 +331,10 @@ namespace CalamityMod.Projectiles.Melee
|
||||
}
|
||||
|
||||
public override void OnKill(int timeLeft) => Owner.fullRotation = 0f;
|
||||
|
||||
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
|
||||
{
|
||||
modifiers.HitDirectionOverride = (Owner.Center.X < target.Center.X).ToDirectionInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,7 @@ namespace CalamityMod.Projectiles.Melee.Shortswords
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.Size = new Vector2(22);
|
||||
Projectile.width = Projectile.height = 44;
|
||||
Projectile.friendly = true;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.tileCollide = false;
|
||||
@@ -39,15 +39,15 @@ namespace CalamityMod.Projectiles.Melee.Shortswords
|
||||
|
||||
public override void SetVisualOffsets()
|
||||
{
|
||||
const int HalfSpriteWidth = 44 / 2;
|
||||
const int HalfSpriteHeight = 44 / 2;
|
||||
const int HalfSpriteWidth = 37;
|
||||
const int HalfSpriteHeight = 47;
|
||||
|
||||
int HalfProjWidth = Projectile.width / 2;
|
||||
int HalfProjHeight = Projectile.height / 2;
|
||||
int QuarterProjHeight = Projectile.height / 4;
|
||||
|
||||
DrawOriginOffsetX = 0;
|
||||
DrawOffsetX = -(HalfSpriteWidth - HalfProjWidth);
|
||||
DrawOriginOffsetY = -(HalfSpriteHeight - HalfProjHeight);
|
||||
DrawOriginOffsetY = -(HalfSpriteHeight - QuarterProjHeight);
|
||||
}
|
||||
|
||||
public override void ExtraBehavior()
|
||||
|
||||
@@ -60,6 +60,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
|
||||
public override void UseStyle()
|
||||
{
|
||||
AnimationProgress = Animation % useAnim;
|
||||
DrawUnconditionally = false;
|
||||
|
||||
if (CanHit || postSwing)
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using System.Diagnostics.Contracts;
|
||||
using CalamityMod.Buffs.DamageOverTime;
|
||||
using CalamityMod.Buffs.StatDebuffs;
|
||||
using CalamityMod.Items.Weapons.Melee;
|
||||
using CalamityMod.Particles;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
@@ -8,21 +16,24 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
public class AquaBlast : ModProjectile, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Ranged";
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
Main.projFrames[Projectile.type] = 4;
|
||||
Main.projFrames[Projectile.type] = 20;
|
||||
}
|
||||
public int spreadDust = 0;
|
||||
public static int Lifetime = 600;
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 12;
|
||||
Projectile.height = 12;
|
||||
Projectile.width = 36;
|
||||
Projectile.height = 26;
|
||||
Projectile.friendly = true;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.penetrate = 1;
|
||||
Projectile.timeLeft = 600;
|
||||
Projectile.timeLeft = Lifetime;
|
||||
Projectile.extraUpdates = 2;
|
||||
Projectile.DamageType = DamageClass.Ranged;
|
||||
Projectile.extraUpdates = 1;
|
||||
Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration;
|
||||
}
|
||||
|
||||
@@ -30,37 +41,94 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
{
|
||||
//Animation
|
||||
Projectile.frameCounter++;
|
||||
if (Projectile.frameCounter > 5)
|
||||
if (Projectile.frameCounter > 21)
|
||||
{
|
||||
Projectile.frame++;
|
||||
Projectile.frameCounter = 0;
|
||||
}
|
||||
if (Projectile.frame > 3)
|
||||
if (Projectile.frame > 19)
|
||||
{
|
||||
Projectile.frame = 0;
|
||||
}
|
||||
Projectile.frame = Projectile.frameCounter / 4 % Main.projFrames[Projectile.type];
|
||||
|
||||
//Rotation
|
||||
Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt();
|
||||
Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi) + MathHelper.ToRadians(90) * Projectile.direction;
|
||||
|
||||
|
||||
Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0.75f / 255f);
|
||||
for (int i = 0; i < 2; i++)
|
||||
Lighting.AddLight(Projectile.Center, Color.AliceBlue.ToVector3() * 0.5f);
|
||||
//Trailing effects
|
||||
if (Projectile.timeLeft <= Lifetime - 7)
|
||||
{
|
||||
Vector2 dspeed = -Projectile.velocity * Main.rand.NextFloat(0.5f * 0.8f);
|
||||
int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Water, 0f, 0f, 100, default, 1f);
|
||||
Main.dust[dust].noGravity = true;
|
||||
Main.dust[dust].velocity = dspeed;
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
SparkParticle spark = new SparkParticle(Projectile.Center - Projectile.velocity / 0.18f, Projectile.velocity * 0.01f, false, 5, 1.9f, Color.SeaGreen, true);
|
||||
GeneralParticleHandler.SpawnParticle(spark);
|
||||
}
|
||||
}
|
||||
if (Main.rand.NextBool(2))
|
||||
{
|
||||
Gore bubble = Gore.NewGorePerfect(Projectile.GetSource_FromAI(), Projectile.position, Projectile.velocity * 0.2f + Main.rand.NextVector2Circular(1f, 1f), 411);
|
||||
bubble.timeLeft = 6 + Main.rand.Next(7);
|
||||
bubble.scale = Main.rand.NextFloat(0.6f, 0.8f);
|
||||
bubble.type = Main.rand.NextBool(3) ? 412 : 411;
|
||||
}
|
||||
if (Main.rand.NextBool())
|
||||
{
|
||||
Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(6 + spreadDust, 6 + spreadDust), !Main.rand.NextBool(5) ? 278 : 267, -Projectile.velocity * Main.rand.NextFloat(0.05f, 0.35f), 0, default, Main.rand.NextFloat(0.4f, 0.6f));
|
||||
dust.noGravity = true;
|
||||
dust.color = !Main.rand.NextBool(5) ? Color.Aquamarine : Color.Aqua;
|
||||
if (dust.type == 278)
|
||||
dust.scale *= 0.7f;
|
||||
}
|
||||
}
|
||||
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
|
||||
{
|
||||
target.AddBuff(ModContent.BuffType<RiptideDebuff>(), 60);
|
||||
}
|
||||
public override void OnHitPlayer(Player target, Player.HurtInfo info)
|
||||
{
|
||||
target.AddBuff(ModContent.BuffType<RiptideDebuff>(), 60);
|
||||
}
|
||||
public override void OnSpawn(IEntitySource source)
|
||||
{
|
||||
Vector2 smokeVel = Projectile.velocity.SafeNormalize(Vector2.UnitY) * 5;
|
||||
int smokeAmount = Main.rand.Next(8, 12 + 1);
|
||||
for (int i = 0; i < smokeAmount; i++)
|
||||
{
|
||||
Particle smoke = new HeavySmokeParticle(Projectile.Center, smokeVel.RotatedByRandom(0.4f) * Main.rand.NextFloat(1.2f, 2f), Color.White, Main.rand.Next(40, 60 + 1), Main.rand.NextFloat(0.2f, 0.4f), 0.3f, Main.rand.NextFloat(-0.2f, 0.2f), Main.rand.NextBool(), required: true);
|
||||
GeneralParticleHandler.SpawnParticle(smoke);
|
||||
|
||||
}
|
||||
}
|
||||
public override void OnKill(int timeLeft)
|
||||
{
|
||||
for (int lol = 0; lol < 10; lol++)
|
||||
SoundEngine.PlaySound(SoundID.ShimmerWeak1 with { Pitch = 0.35f }, Projectile.Center);
|
||||
for (int i = 0; i < 5; ++i)
|
||||
{
|
||||
Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Water, 0f, 0f, 100, default, 1f);
|
||||
int bloodLifetime = Main.rand.Next(22, 25);
|
||||
float bloodScale = Main.rand.NextFloat(0.6f, 0.8f);
|
||||
Color bloodColor = Color.Lerp(Color.SkyBlue, Color.Aquamarine, Main.rand.NextFloat());
|
||||
bloodColor = Color.Lerp(bloodColor, new Color(51, 22, 94), Main.rand.NextFloat(0.65f));
|
||||
|
||||
if (Main.rand.NextBool(20))
|
||||
bloodScale *= 2f;
|
||||
|
||||
float randomSpeedMultiplier = Main.rand.NextFloat(1.25f, 2.25f);
|
||||
Vector2 bloodVelocity = Main.rand.NextVector2Unit() * 2 * randomSpeedMultiplier;
|
||||
bloodVelocity.Y -= 5f;
|
||||
BloodParticle blood = new BloodParticle(Projectile.Center, bloodVelocity, bloodLifetime, bloodScale, bloodColor);
|
||||
GeneralParticleHandler.SpawnParticle(blood);
|
||||
}
|
||||
Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Aquamarine * 0.8f, "CalamityMod/Particles/FlameExplosion", Vector2.One, Main.rand.NextFloat(-10, 10), 0f, 0.05f, 22);
|
||||
GeneralParticleHandler.SpawnParticle(blastRing);
|
||||
Particle blastRing2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Aqua * 0.8f, "CalamityMod/Particles/FlameExplosion", Vector2.One, Main.rand.NextFloat(-10, 10), 0f, 0.04f, 22);
|
||||
GeneralParticleHandler.SpawnParticle(blastRing2);
|
||||
Particle blastRing3 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.DeepSkyBlue, "CalamityMod/Particles/DetailedExplosion", Vector2.One, Main.rand.NextFloat(-10, 10), 0f, 0.2f, 22);
|
||||
GeneralParticleHandler.SpawnParticle(blastRing3);
|
||||
Particle orb2 = new GenericBloom(Projectile.Center, Vector2.Zero, Color.SkyBlue, 0.6f, 11, false, true);
|
||||
GeneralParticleHandler.SpawnParticle(orb2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 19 KiB |
@@ -1,70 +0,0 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Ranged
|
||||
{
|
||||
public class AquaBlastToxic : ModProjectile, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Ranged";
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
Main.projFrames[Projectile.type] = 4;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 12;
|
||||
Projectile.height = 12;
|
||||
Projectile.friendly = true;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.penetrate = 1;
|
||||
Projectile.timeLeft = 600;
|
||||
Projectile.DamageType = DamageClass.Ranged;
|
||||
Projectile.extraUpdates = 1;
|
||||
Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
//Animation
|
||||
Projectile.frameCounter++;
|
||||
if (Projectile.frameCounter > 5)
|
||||
{
|
||||
Projectile.frame++;
|
||||
Projectile.frameCounter = 0;
|
||||
}
|
||||
if (Projectile.frame > 3)
|
||||
{
|
||||
Projectile.frame = 0;
|
||||
}
|
||||
|
||||
//Rotation
|
||||
Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt();
|
||||
Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi) + MathHelper.ToRadians(90) * Projectile.direction;
|
||||
|
||||
Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0.35f / 255f, (255 - Projectile.alpha) * 0.4f / 255f);
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
Vector2 dspeed = -Projectile.velocity * Main.rand.NextFloat(0.5f * 0.8f);
|
||||
int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GemEmerald, 0f, 0f, 100, default, 1f);
|
||||
Main.dust[dust].noGravity = true;
|
||||
Main.dust[dust].velocity = dspeed;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnKill(int timeLeft)
|
||||
{
|
||||
for (int lol = 0; lol < 10; lol++)
|
||||
{
|
||||
Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GemEmerald, 0f, 0f, 100, default, 1f);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
|
||||
{
|
||||
target.AddBuff(BuffID.Venom, 120);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 1.5 KiB |
@@ -13,9 +13,9 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
public class ChromaticEruptionHoldout : BaseGunHoldoutProjectile
|
||||
{
|
||||
public override int AssociatedItemID => ModContent.ItemType<ChromaticEruption>();
|
||||
public override float MaxOffsetLengthFromArm => 15f;
|
||||
public override float MaxOffsetLengthFromArm => 40f;
|
||||
public override float OffsetXUpwards => -10f;
|
||||
public override float BaseOffsetY => -5f;
|
||||
public override float BaseOffsetY => -12f;
|
||||
public override float OffsetYDownwards => 10f;
|
||||
|
||||
public ref float ShotCooldown => ref Projectile.ai[0];
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using CalamityMod.Buffs.StatDebuffs;
|
||||
using CalamityMod.Dusts;
|
||||
using CalamityMod.Particles;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Ranged
|
||||
{
|
||||
public class LeviatitanAberration : ModProjectile, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Ranged";
|
||||
public override string Texture => "CalamityMod/Projectiles/Summon/GastricBelcher";
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
Main.projFrames[Projectile.type] = 4;
|
||||
}
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 40;
|
||||
Projectile.height = 40;
|
||||
Projectile.aiStyle = ProjAIStyleID.Arrow;
|
||||
Projectile.friendly = true;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.DamageType = DamageClass.Ranged;
|
||||
Projectile.penetrate = 1;
|
||||
Projectile.timeLeft = 600;
|
||||
AIType = ProjectileID.Bullet;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
CalamityUtils.HomeInOnNPC(Projectile, true, 500f, 16f, 8f);
|
||||
|
||||
//Rotation
|
||||
Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt();
|
||||
Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi) + MathHelper.ToRadians(360) * Projectile.direction;
|
||||
|
||||
//Update frames
|
||||
if (Projectile.frameCounter++ % 6 == 0)
|
||||
{
|
||||
Projectile.frame++;
|
||||
}
|
||||
if (Projectile.frame >= Main.projFrames[Projectile.type])
|
||||
{
|
||||
Projectile.frame = 0;
|
||||
}
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
int bloodDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height / 2, DustID.Blood, 0f, 0f, 100, default, 1f);
|
||||
Main.dust[bloodDust].noGravity = true;
|
||||
Main.dust[bloodDust].velocity *= 0.5f;
|
||||
Main.dust[bloodDust].velocity += Projectile.velocity * 0.1f;
|
||||
}
|
||||
}
|
||||
public override void OnSpawn(IEntitySource source)
|
||||
{
|
||||
for (int i = 0; i < 36; i++)
|
||||
{
|
||||
Dust minion = Dust.NewDustPerfect(Projectile.Center, DustID.MoonBoulder);
|
||||
minion.velocity = (MathHelper.TwoPi * i / 36f).ToRotationVector2() * 9f;
|
||||
minion.scale = Main.rand.NextFloat(1.4f, 1.6f);
|
||||
minion.noGravity = true;
|
||||
}
|
||||
}
|
||||
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
|
||||
{
|
||||
target.AddBuff(ModContent.BuffType<ArmorCrunch>(), 120);
|
||||
SoundEngine.PlaySound(SoundID.NPCDeath1 with { Volume = SoundID.NPCDeath1.Volume * 0.5f }, Projectile.Center);
|
||||
}
|
||||
public override void OnKill(int timeLeft)
|
||||
{
|
||||
for (int d = 0; d < 15; ++d)
|
||||
{
|
||||
int idx = Dust.NewDust(Projectile.Center - Vector2.One * 10f, 50, 50, DustID.Blood, 0f, -2f, 0, default, 1f);
|
||||
Dust dust = Main.dust[idx];
|
||||
dust.velocity /= 2f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
namespace CalamityMod.Projectiles.Ranged
|
||||
{
|
||||
public class LeviatitanExplosion : ModProjectile, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Ranged";
|
||||
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
|
||||
public Player Owner => Main.player[Projectile.owner];
|
||||
private static float ExplosionRadius = 112f;
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
//These shouldn't matter because its circular
|
||||
Projectile.width = 112;
|
||||
Projectile.height = 112;
|
||||
Projectile.friendly = true;
|
||||
Projectile.DamageType = DamageClass.Ranged;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.timeLeft = 2;
|
||||
Projectile.usesLocalNPCImmunity = true;
|
||||
Projectile.localNPCHitCooldown = 10;
|
||||
}
|
||||
|
||||
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, ExplosionRadius, targetHitbox);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using CalamityMod.Particles;
|
||||
using Terraria.DataStructures;
|
||||
using System;
|
||||
|
||||
namespace CalamityMod.Projectiles.Ranged
|
||||
{
|
||||
public class LeviatitanMeteor : ModProjectile, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Ranged";
|
||||
public override string Texture => "CalamityMod/Projectiles/Melee/AftershockRock";
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5;
|
||||
ProjectileID.Sets.TrailingMode[Projectile.type] = 0;
|
||||
}
|
||||
public static int Lifetime = 600;
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 38;
|
||||
Projectile.height = 38;
|
||||
Projectile.friendly = true;
|
||||
Projectile.penetrate = 1;
|
||||
Projectile.timeLeft = Lifetime;
|
||||
Projectile.DamageType = DamageClass.Ranged;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
if (Projectile.velocity.Y < 25f)
|
||||
Projectile.velocity.Y += 0.12f;
|
||||
Projectile.rotation += Projectile.velocity.X * 0.05f;
|
||||
|
||||
if (Projectile.timeLeft <= Lifetime - 6)
|
||||
{
|
||||
if (Main.rand.NextBool(3))
|
||||
{
|
||||
MediumMistParticle SandCloud = new MediumMistParticle(Projectile.Center + new Vector2(25, 25).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 1.3f) * Projectile.scale, (-Projectile.velocity * 0.2f).RotatedByRandom(0.2f) + (new Vector2(3, 3).RotatedByRandom(100)), Color.Peru, Color.PeachPuff, Main.rand.NextFloat(0.4f, 1.3f), 120f, Main.rand.NextFloat(0.03f, -0.03f));
|
||||
GeneralParticleHandler.SpawnParticle(SandCloud);
|
||||
}
|
||||
int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.UnusedBrown, 0f, 0f, 100, default, Main.rand.NextFloat(0.75f, 1.2f));
|
||||
Main.dust[dust].velocity *= 0f;
|
||||
}
|
||||
}
|
||||
public override void OnSpawn(IEntitySource source)
|
||||
{
|
||||
Vector2 smokeVel = Projectile.velocity.SafeNormalize(Vector2.UnitY) * 5;
|
||||
int smokeAmount = Main.rand.Next(8, 12 + 1);
|
||||
for (int i = 0; i < smokeAmount; i++)
|
||||
{
|
||||
Particle smoke = new HeavySmokeParticle(Projectile.Center, smokeVel.RotatedByRandom(0.4f) * Main.rand.NextFloat(1.2f, 2f), Color.White, Main.rand.Next(40, 60 + 1), Main.rand.NextFloat(0.2f, 0.4f), 0.3f, Main.rand.NextFloat(-0.2f, 0.2f), Main.rand.NextBool(), required: true);
|
||||
GeneralParticleHandler.SpawnParticle(smoke);
|
||||
|
||||
}
|
||||
}
|
||||
public override void OnKill(int timeLeft)
|
||||
{
|
||||
if (Projectile.owner == Main.myPlayer)
|
||||
{
|
||||
SoundStyle explo = new("CalamityMod/Sounds/Item/MineralMortarExplode");
|
||||
SoundEngine.PlaySound(explo with { Volume = 0.9f }, Projectile.Center);
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, 0f, 0f, ModContent.ProjectileType<LeviatitanExplosion>(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f);
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
Vector2 randVel = new Vector2(12, 12).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 0.7f);
|
||||
Particle smoke = new HeavySmokeParticle(Projectile.Center + randVel, randVel, Color.Peru, Main.rand.Next(25, 35 + 1), Main.rand.NextFloat(0.9f, 2.3f), 0.4f);
|
||||
GeneralParticleHandler.SpawnParticle(smoke);
|
||||
MediumMistParticle SandCloud = new MediumMistParticle(Projectile.Center, randVel * 0.8f, Color.Peru, Color.PeachPuff, Main.rand.NextFloat(0.4f, 1.3f), 120f, Main.rand.NextFloat(0.03f, -0.03f));
|
||||
GeneralParticleHandler.SpawnParticle(SandCloud);
|
||||
}
|
||||
int debriAmount = Main.rand.Next(10, 15 + 1);
|
||||
for (int debriIndex = 0; debriIndex < debriAmount; debriIndex++)
|
||||
{
|
||||
float angle = MathHelper.TwoPi / debriAmount * debriIndex;
|
||||
Vector2 velocity = angle.ToRotationVector2() * Main.rand.NextFloat(2f, 8f);
|
||||
Particle debri = new StoneDebrisParticle(Projectile.Center, velocity, Color.Lerp(Color.White, Color.LightGray, Main.rand.NextFloat()), Main.rand.NextFloat(0.4f, 0.6f), Main.rand.Next(30, 45 + 1), Main.rand.NextFloat(MathHelper.Pi));
|
||||
GeneralParticleHandler.SpawnParticle(debri);
|
||||
}
|
||||
int mistAmount = Main.rand.Next(5, 8 + 1);
|
||||
for (int mistIndex = 0; mistIndex < mistAmount; mistIndex++)
|
||||
{
|
||||
float angle = MathHelper.TwoPi / mistAmount * mistIndex;
|
||||
Vector2 velocity = angle.ToRotationVector2() * Main.rand.NextFloat(5f, 15f);
|
||||
Particle boomMist = new MediumMistParticle(Projectile.Center, velocity, Color.SaddleBrown * 0.8f, Color.Transparent, Main.rand.NextFloat(.6f, 1.4f), Main.rand.NextFloat(200f, 400f));
|
||||
GeneralParticleHandler.SpawnParticle(boomMist);
|
||||
}
|
||||
Particle blastRing2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Red, "CalamityMod/Particles/ShatteredExplosion", Vector2.One, Main.rand.NextFloat(-10, 10), Projectile.width / 5000f, Projectile.width / 200f, 29, true, 0.7f);
|
||||
GeneralParticleHandler.SpawnParticle(blastRing2);
|
||||
Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, Color.SaddleBrown * 0.8f, "CalamityMod/Particles/FlameExplosion", Vector2.One, Main.rand.NextFloat(-10, 10), Projectile.width / 5000f, Projectile.width / 300f, 29);
|
||||
GeneralParticleHandler.SpawnParticle(blastRing);
|
||||
}
|
||||
}
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,12 @@
|
||||
using System;
|
||||
using CalamityMod.Particles;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using MonoMod.Core.Utils;
|
||||
using ReLogic.Content;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
@@ -12,9 +17,17 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
public new string LocalizationCategory => "Projectiles.Rogue";
|
||||
public override string Texture => "CalamityMod/Items/Weapons/Rogue/SamsaraSlicer";
|
||||
|
||||
private bool initialized = false;
|
||||
private int Lifetime = 180;
|
||||
private int ReboundTime = 45;
|
||||
public float ReboundVelocity => 20;
|
||||
public float StealthReboundVelocity => 30;
|
||||
public float StealthPauseTime => 55;
|
||||
public int ReboundTime => 20;
|
||||
|
||||
public int SmallDiskDamage => 8;
|
||||
public int SmallDiskStealthDamage => 17;
|
||||
|
||||
public bool initialized = false;
|
||||
|
||||
Vector2 oldVelocity;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
@@ -27,180 +40,240 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
Projectile.width = Projectile.height = 46;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.friendly = true;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.tileCollide = true;
|
||||
Projectile.usesLocalNPCImmunity = true;
|
||||
Projectile.localNPCHitCooldown = 10;
|
||||
Projectile.localNPCHitCooldown = 30;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.DamageType = RogueDamageClass.Instance;
|
||||
Projectile.aiStyle = -1;
|
||||
Projectile.ai[0] = -200;
|
||||
Projectile.ai[2] = -200;
|
||||
}
|
||||
|
||||
public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough, ref Vector2 hitboxCenterFrac)
|
||||
{
|
||||
width = 20;
|
||||
height = 20;
|
||||
|
||||
return base.TileCollideStyle(ref width, ref height, ref fallThrough, ref hitboxCenterFrac);
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Initialize();
|
||||
BoomerangAI();
|
||||
StealthStrikeAI();
|
||||
SpawnProjectilesNearEnemies();
|
||||
LightingandDust();
|
||||
}
|
||||
Lighting.AddLight(Projectile.Center, new Vector3(0.1f, 0.5f, 0.03f));
|
||||
|
||||
private void Initialize()
|
||||
{
|
||||
if (initialized)
|
||||
return;
|
||||
|
||||
Lifetime = Projectile.Calamity().stealthStrike ? 360 : 180;
|
||||
ReboundTime = Projectile.Calamity().stealthStrike ? 90 : 45;
|
||||
Projectile.timeLeft = Lifetime;
|
||||
initialized = true;
|
||||
}
|
||||
|
||||
private void BoomerangAI()
|
||||
{
|
||||
// Boomerang rotation
|
||||
Projectile.rotation += 0.4f * Projectile.direction;
|
||||
|
||||
// Boomerang sound
|
||||
if (Projectile.soundDelay == 0)
|
||||
if (!initialized)
|
||||
{
|
||||
Projectile.soundDelay = 8;
|
||||
SoundEngine.PlaySound(SoundID.Item7, Projectile.position);
|
||||
Projectile.ai[2] = -200;
|
||||
Projectile.ai[0] = -200;
|
||||
initialized = true;
|
||||
}
|
||||
|
||||
// Returns after some number of frames in the air
|
||||
if (Projectile.timeLeft < Lifetime - ReboundTime)
|
||||
Projectile.ai[0] = 1f;
|
||||
Player player = Main.player[Projectile.owner];
|
||||
|
||||
if (Projectile.ai[0] == 1f)
|
||||
// Main movement
|
||||
|
||||
if (Projectile.ai[0] < 0)
|
||||
{
|
||||
//Ignore tiles and fly faster
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.extraUpdates = 1;
|
||||
Projectile.ai[1]++;
|
||||
|
||||
Player player = Main.player[Projectile.owner];
|
||||
float returnSpeed = 16f;
|
||||
float acceleration = 1.4f;
|
||||
Vector2 playerVec = player.Center - Projectile.Center;
|
||||
float dist = playerVec.Length();
|
||||
|
||||
// Delete the projectile if it's excessively far away.
|
||||
if (dist > 3000f)
|
||||
Projectile.Kill();
|
||||
|
||||
playerVec.Normalize();
|
||||
playerVec *= returnSpeed;
|
||||
|
||||
// Home back in on the player.
|
||||
if (Projectile.velocity.X < playerVec.X)
|
||||
if (Projectile.ai[1] > ReboundTime)
|
||||
{
|
||||
Projectile.velocity.X += acceleration;
|
||||
if (Projectile.velocity.X < 0f && playerVec.X > 0f)
|
||||
Projectile.velocity.X += acceleration;
|
||||
}
|
||||
else if (Projectile.velocity.X > playerVec.X)
|
||||
{
|
||||
Projectile.velocity.X -= acceleration;
|
||||
if (Projectile.velocity.X > 0f && playerVec.X < 0f)
|
||||
Projectile.velocity.X -= acceleration;
|
||||
}
|
||||
if (Projectile.velocity.Y < playerVec.Y)
|
||||
{
|
||||
Projectile.velocity.Y += acceleration;
|
||||
if (Projectile.velocity.Y < 0f && playerVec.Y > 0f)
|
||||
Projectile.velocity.Y += acceleration;
|
||||
}
|
||||
else if (Projectile.velocity.Y > playerVec.Y)
|
||||
{
|
||||
Projectile.velocity.Y -= acceleration;
|
||||
if (Projectile.velocity.Y > 0f && playerVec.Y < 0f)
|
||||
Projectile.velocity.Y -= acceleration;
|
||||
}
|
||||
Projectile.tileCollide = false;
|
||||
|
||||
// Delete the projectile if it touches its owner.
|
||||
if (Main.myPlayer == Projectile.owner)
|
||||
if (Projectile.Hitbox.Intersects(player.Hitbox))
|
||||
Projectile.Kill();
|
||||
}
|
||||
}
|
||||
float lerp = (float)(Projectile.ai[1] - ReboundTime) * 0.01f;
|
||||
|
||||
private void StealthStrikeAI()
|
||||
{
|
||||
if (!Projectile.Calamity().stealthStrike)
|
||||
return;
|
||||
if (Projectile.Calamity().stealthStrike)
|
||||
lerp = (float)(Projectile.ai[1] - ReboundTime) * 0.005f;
|
||||
|
||||
if (Projectile.timeLeft % 8f == 0f && Main.myPlayer == Projectile.owner)
|
||||
{
|
||||
int disk = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType<SamsaraSlicerSmallDisk>(), Projectile.damage / 4, Projectile.knockBack / 4f, Projectile.owner, Projectile.identity, Main.rand.NextFloat(0.02f, 0.1f));
|
||||
Main.projectile[disk].timeLeft *= 2;
|
||||
Main.projectile[disk].aiStyle = -1;
|
||||
}
|
||||
}
|
||||
Projectile.velocity = Vector2.Lerp(Projectile.velocity, Projectile.DirectionTo(player.Center) * (Projectile.Calamity().stealthStrike ? StealthReboundVelocity : ReboundVelocity), lerp);
|
||||
|
||||
private void SpawnProjectilesNearEnemies()
|
||||
{
|
||||
if (!Projectile.friendly)
|
||||
return;
|
||||
|
||||
const float maxDistance = 300f;
|
||||
bool homeIn = false;
|
||||
|
||||
foreach (NPC npc in Main.ActiveNPCs)
|
||||
{
|
||||
if (npc.CanBeChasedBy(Projectile, false))
|
||||
{
|
||||
float extraDistance = npc.width / 2 + npc.height / 2;
|
||||
|
||||
bool canHit = true;
|
||||
if (extraDistance < maxDistance)
|
||||
canHit = Collision.CanHit(Projectile.Center, 1, 1, npc.Center, 1, 1);
|
||||
|
||||
if (Vector2.Distance(npc.Center, Projectile.Center) < maxDistance + extraDistance && canHit)
|
||||
if (Projectile.Distance(player.Center) < Projectile.velocity.Length() * 1.4f)
|
||||
{
|
||||
homeIn = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (homeIn)
|
||||
{
|
||||
if (Main.player[Projectile.owner].miscCounter % 50 == 0)
|
||||
{
|
||||
int splitProj = ModContent.ProjectileType<SamsaraSlicerSmallDisk>();
|
||||
if (Projectile.owner == Main.myPlayer)
|
||||
{
|
||||
float spread = 60f * 0.0174f;
|
||||
double startAngle = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spread / 2;
|
||||
double deltaAngle = spread / 6f;
|
||||
for (int i = 0; i < 6; i++)
|
||||
for (int i = 0; i < Main.projectile.Length; i++)
|
||||
{
|
||||
Vector2 velocity = ((MathHelper.TwoPi * i / 6f) - MathHelper.PiOver2).ToRotationVector2() * 6f;
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType<SamsaraSlicerSmallDisk>(), Projectile.damage / 2, Projectile.knockBack * 0.5f, Projectile.owner);
|
||||
Projectile proj = Main.projectile[i];
|
||||
|
||||
if (proj.type == ModContent.ProjectileType<SamsaraSlicerSmallDisk>())
|
||||
{
|
||||
if ((proj.ModProjectile as SamsaraSlicerSmallDisk).Parent == Projectile)
|
||||
{
|
||||
(Main.projectile[i].ModProjectile as SamsaraSlicerSmallDisk).Parent = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Projectile.Kill();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void LightingandDust()
|
||||
{
|
||||
Lighting.AddLight(Projectile.Center, 0f, 0.75f, 0f);
|
||||
if (!Main.rand.NextBool(5))
|
||||
return;
|
||||
Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.TerraBlade, Projectile.velocity.X, Projectile.velocity.Y);
|
||||
// Frame pause
|
||||
|
||||
if (Projectile.ai[0] > -150) Projectile.ai[0]--;
|
||||
|
||||
if (Projectile.ai[0] == 0)
|
||||
{
|
||||
Projectile.velocity = oldVelocity;
|
||||
|
||||
SoundEngine.PlaySound(SoundID.DD2_SkyDragonsFuryShot.WithPitchOffset(1f));
|
||||
|
||||
|
||||
if (Projectile.Calamity().stealthStrike)
|
||||
{
|
||||
SoundEngine.PlaySound(SoundID.Item122.WithPitchOffset(1f), Projectile.Center);
|
||||
|
||||
for (int i = 1; i <= 3; i++)
|
||||
{
|
||||
GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, oldVelocity * MathHelper.Lerp(2f, 1f, (float)i / 3f) / 4, Color.LimeGreen, "CalamityMod/Particles/SoftRoundExplosion", new Vector2(0.6f, 1f), oldVelocity.ToRotation(), 0.02f, 0.05f * i, 30));
|
||||
}
|
||||
|
||||
for (int i = -10; i <= 20; i++)
|
||||
{
|
||||
GeneralParticleHandler.SpawnParticle(new CustomSpark(Projectile.Center, new Vector2(i * 2, 0).RotatedBy(Projectile.velocity.ToRotation()), "CalamityMod/Particles/ThinEndedLine", false, 10, Main.rand.NextFloat(0.3f, 1f), Main.rand.NextBool() ? new Color(1f, 0.8f, 0.1f) : Color.LimeGreen, new Vector2(Main.rand.NextFloat(0.4f, 1f), 1f)));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 1; i <= 2; i++)
|
||||
GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, new Vector2(i == 1 ? 2 : 6, 0).RotatedBy(Projectile.velocity.ToRotation()), Color.LimeGreen, "CalamityMod/Particles/BloomRing", new Vector2(0.5f, 1f), Projectile.velocity.ToRotation(), 0.1f, 0.5f - (i * 0.1f), 20));
|
||||
}
|
||||
|
||||
for (int i = 0; i <= 5; i++)
|
||||
GeneralParticleHandler.SpawnParticle(new CustomSpark(Projectile.Center, new Vector2(Main.rand.NextFloat(-2f, 2f), Main.rand.NextFloat(-10f, 10f)).RotatedBy(Projectile.velocity.ToRotation()), "CalamityMod/Particles/ThinEndedLine", false, 10, Main.rand.NextFloat(0.3f, 1f), Main.rand.NextBool() ? new Color(1f, 0.8f, 0.1f) : Color.LimeGreen, new Vector2(Main.rand.NextFloat(0.4f, 1f), 1f)));
|
||||
}
|
||||
|
||||
if (Projectile.ai[0] <= 0 && Projectile.ai[0] > -4)
|
||||
{
|
||||
Projectile.extraUpdates = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
Projectile.extraUpdates = 0;
|
||||
}
|
||||
|
||||
Vector2 vel = Projectile.velocity;
|
||||
if (Projectile.ai[0] > 0)
|
||||
{
|
||||
vel = new Vector2(18);
|
||||
}
|
||||
|
||||
if (Projectile.ai[2] > -150)
|
||||
{
|
||||
Projectile.ai[2]--;
|
||||
}
|
||||
|
||||
if (Projectile.ai[2] > 0)
|
||||
{
|
||||
if (Projectile.ai[2] % (Projectile.Calamity().stealthStrike ? 3 : 5) == 0)
|
||||
{
|
||||
SoundEngine.PlaySound(SoundID.Item23.WithPitchOffset(MathHelper.Lerp(1f, 0f, Projectile.ai[2] / 30)).WithVolumeScale(0.8f));
|
||||
}
|
||||
|
||||
for (int i = 0; i <= 2; i++)
|
||||
GeneralParticleHandler.SpawnParticle(new CustomSpark(Projectile.Center + new Vector2(25, 0).RotatedBy(oldVelocity.ToRotation()), new Vector2(Main.rand.NextFloat(-2f, 2f), Main.rand.NextFloat(-10f, 10f)).RotatedBy(oldVelocity.ToRotation()), "CalamityMod/Particles/ThinEndedLine", false, 10, Main.rand.NextFloat(0.3f, 1f), Main.rand.NextBool() ? new Color(1f, 0.8f, 0.1f) : Color.LimeGreen, new Vector2(Main.rand.NextFloat(0.4f, 1f), 1f)));
|
||||
}
|
||||
|
||||
if (Projectile.ai[2] > -150)
|
||||
{
|
||||
if (Projectile.Calamity().stealthStrike)
|
||||
{
|
||||
float SpawnVel = 15;
|
||||
|
||||
float g = Main.rand.NextFloat(360f);
|
||||
|
||||
if (!Main.dedServ)
|
||||
{
|
||||
Projectile proj = Projectile.NewProjectileDirect(new EntitySource_Parent(Projectile), Projectile.Center, new Vector2(SpawnVel, 0).RotatedBy(MathHelper.ToRadians(g)),
|
||||
ModContent.ProjectileType<SamsaraSlicerSmallDisk>(), Projectile.Calamity().stealthStrike ? SmallDiskStealthDamage : SmallDiskDamage, 1f, Projectile.owner, Projectile.whoAmI);
|
||||
(proj.ModProjectile as SamsaraSlicerSmallDisk).Parent = Projectile;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Projectile.ai[2] == 0)
|
||||
{
|
||||
Projectile.localNPCHitCooldown = 30;
|
||||
}
|
||||
|
||||
Projectile.rotation += MathHelper.ToRadians(vel.Length() * 1.5f);
|
||||
}
|
||||
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2);
|
||||
Asset<Texture2D> tex = ModContent.Request<Texture2D>(Texture);
|
||||
|
||||
float rand = 0;
|
||||
if (Projectile.ai[2] > 0)
|
||||
{
|
||||
rand = 4;
|
||||
}
|
||||
|
||||
Vector2 randVec = new Vector2(Main.rand.NextFloat(-rand, rand), 0).RotatedBy(oldVelocity.ToRotation());
|
||||
|
||||
Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + randVec, tex.Frame(), Color.White, Projectile.rotation, tex.Frame().Center(), 1f, SpriteEffects.None);
|
||||
|
||||
if (Projectile.ai[2] < 0)
|
||||
{
|
||||
CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], new Color(0f, 0.6f, 0f, 0f), 2, ModContent.Request<Texture2D>("CalamityMod/Items/Weapons/Rogue/SamsaraSlicerGlow").Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
//Main.EntitySpriteDraw(ModContent.Request<Texture2D>("CalamityMod/Items/Weapons/Rogue/SamsaraSlicerGlow").Value, Projectile.Center - Main.screenPosition + randVec, tex.Frame(), new Color(0f, 1f, 0f, 0f), Projectile.rotation, tex.Frame().Center(), 1f, SpriteEffects.None);
|
||||
|
||||
Main.EntitySpriteDraw(ModContent.Request<Texture2D>("CalamityMod/Items/Weapons/Rogue/SamsaraSlicerGlow").Value, Projectile.Center - Main.screenPosition + randVec, tex.Frame(), new Color(0f, 1f, 0f, 0f), Projectile.rotation, tex.Frame().Center(), 1f, SpriteEffects.None);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
|
||||
{
|
||||
if (Projectile.velocity != Vector2.Zero)
|
||||
{
|
||||
if (Projectile.ai[0] <= -200)
|
||||
oldVelocity = Projectile.velocity * 1.5f;
|
||||
else
|
||||
oldVelocity = Projectile.velocity;
|
||||
}
|
||||
Projectile.ai[1] = ReboundTime - 10;
|
||||
Projectile.velocity = Vector2.Zero;
|
||||
Projectile.ai[0] = 5;
|
||||
|
||||
SoundEngine.PlaySound(SoundID.DD2_WitherBeastCrystalImpact);
|
||||
|
||||
if (Projectile.ai[2] == -200)
|
||||
{
|
||||
float lag = 20;
|
||||
if (Projectile.Calamity().stealthStrike) lag = StealthPauseTime;
|
||||
|
||||
Projectile.ai[0] = lag;
|
||||
Projectile.ai[2] = lag;
|
||||
|
||||
Projectile.localNPCHitCooldown = (int)lag;
|
||||
|
||||
float g = Main.rand.NextFloat(360f);
|
||||
|
||||
g -= 15f;
|
||||
|
||||
float SpawnVel = 15;
|
||||
if (Projectile.Calamity().stealthStrike)
|
||||
SpawnVel = 20;
|
||||
|
||||
if (!Main.dedServ)
|
||||
{
|
||||
for (float i = g; i < g + 360f; i += Projectile.Calamity().stealthStrike ? 45f : 90f)
|
||||
{
|
||||
Projectile proj = Projectile.NewProjectileDirect(new EntitySource_Parent(Projectile), Projectile.Center, new Vector2(SpawnVel, 0).RotatedBy(MathHelper.ToRadians(i)),
|
||||
ModContent.ProjectileType<SamsaraSlicerSmallDisk>(), Projectile.Calamity().stealthStrike ? SmallDiskStealthDamage : SmallDiskDamage, 1f, Projectile.owner, Projectile.whoAmI);
|
||||
(proj.ModProjectile as SamsaraSlicerSmallDisk).Parent = Projectile;
|
||||
proj.Calamity().stealthStrike = Projectile.Calamity().stealthStrike;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
|
||||
{
|
||||
// Return to the player after striking an enemy. Stealth strikes don't return immediately.
|
||||
if (!Projectile.Calamity().stealthStrike || Projectile.ai[1] > 3)
|
||||
Projectile.ai[0] = 1f;
|
||||
Projectile.ai[1]++;
|
||||
}
|
||||
|
||||
// Make it bounce on tiles.
|
||||
@@ -218,7 +291,7 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
{
|
||||
Projectile.velocity.Y = -oldVelocity.Y;
|
||||
}
|
||||
Projectile.ai[0] = 1f;
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
@@ -9,6 +10,7 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Rogue";
|
||||
private double rotation = 0;
|
||||
public Projectile Parent = null;
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10;
|
||||
@@ -19,78 +21,106 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
{
|
||||
Projectile.width = 40;
|
||||
Projectile.height = 40;
|
||||
Projectile.alpha = 75;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.friendly = true;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.aiStyle = ProjAIStyleID.Boomerang;
|
||||
Projectile.timeLeft = 60;
|
||||
AIType = ProjectileID.WoodenBoomerang;
|
||||
Projectile.aiStyle = -1;
|
||||
Projectile.DamageType = RogueDamageClass.Instance;
|
||||
Projectile.usesIDStaticNPCImmunity = true;
|
||||
Projectile.idStaticNPCHitCooldown = 6;
|
||||
Projectile.usesLocalNPCImmunity = true;
|
||||
Projectile.localNPCHitCooldown = 3;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
StealthStrikeAI();
|
||||
LightingandDust();
|
||||
}
|
||||
|
||||
private void StealthStrikeAI()
|
||||
{
|
||||
if (Projectile.aiStyle == 3)
|
||||
return;
|
||||
|
||||
Projectile.rotation += 0.4f * Projectile.direction;
|
||||
|
||||
Projectile parent = Main.projectile[0];
|
||||
bool active = false;
|
||||
foreach (Projectile p in Main.ActiveProjectiles)
|
||||
if (Parent != null)
|
||||
{
|
||||
if (p.identity == Projectile.ai[0] && p.type == ModContent.ProjectileType<SamsaraSlicerProjectile>())
|
||||
if (!Parent.active) Parent = null;
|
||||
}
|
||||
|
||||
Player player = Main.player[Projectile.owner];
|
||||
|
||||
if (Projectile.Calamity().stealthStrike)
|
||||
{
|
||||
Projectile.localNPCHitCooldown = 3;
|
||||
Projectile.usesLocalNPCImmunity = true;
|
||||
}
|
||||
|
||||
bool returning = false;
|
||||
|
||||
Projectile.ai[1]++;
|
||||
|
||||
Projectile.rotation += MathHelper.ToRadians(12f);
|
||||
|
||||
float Vel = 15;
|
||||
if (Projectile.Calamity().stealthStrike) Vel = 20;
|
||||
|
||||
float length = 10;
|
||||
if (Projectile.Calamity().stealthStrike) length = 15;
|
||||
|
||||
if (Projectile.ai[1] > length)
|
||||
{
|
||||
Vel += (Projectile.ai[1] - length);
|
||||
if (Parent != null)
|
||||
{
|
||||
parent = p;
|
||||
active = true;
|
||||
break;
|
||||
if (Parent.active)
|
||||
{
|
||||
Projectile.velocity = Vector2.Lerp(Projectile.velocity, Projectile.DirectionTo(Parent.Center) * Vel, Projectile.Calamity().stealthStrike ? 0.25f : 0.35f);
|
||||
|
||||
if ((Projectile.Center + Projectile.velocity).Distance(Parent.Center) < Projectile.velocity.Length())
|
||||
{
|
||||
Projectile.Kill();
|
||||
}
|
||||
}
|
||||
else returning = true;
|
||||
}
|
||||
else returning = true;
|
||||
}
|
||||
|
||||
if (active)
|
||||
if (Parent != null && Parent.active)
|
||||
{
|
||||
Vector2 vector = parent.Center - Projectile.Center;
|
||||
Projectile.Center = parent.Center + new Vector2(80, 0).RotatedBy(rotation);
|
||||
double rotateAmt = (double)Projectile.ai[1];
|
||||
rotation += rotateAmt;
|
||||
if (rotation >= 360)
|
||||
Projectile.velocity = Projectile.velocity.RotatedBy(MathHelper.ToRadians(8f));
|
||||
}
|
||||
|
||||
if (Parent != null && !returning)
|
||||
{
|
||||
Projectile.position += Parent.velocity;
|
||||
}
|
||||
|
||||
if (Parent == null)
|
||||
{
|
||||
Projectile.timeLeft = 5;
|
||||
Projectile.position += player.velocity;
|
||||
Projectile.velocity = Projectile.DirectionTo(player.Center) * 4f;
|
||||
Projectile.scale *= 0.9f;
|
||||
if (Projectile.Distance(player.Center) < Projectile.velocity.Length())
|
||||
{
|
||||
rotation = 0;
|
||||
Projectile.Kill();
|
||||
}
|
||||
Projectile.velocity.X = (vector.X > 0f) ? -0.000001f : 0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
Projectile.Kill();
|
||||
}
|
||||
|
||||
if (!parent.active)
|
||||
{
|
||||
Projectile.Kill();
|
||||
}
|
||||
}
|
||||
|
||||
private void LightingandDust()
|
||||
public override void OnSpawn(IEntitySource source)
|
||||
{
|
||||
Lighting.AddLight(Projectile.Center, 0f, 0.75f, 0f);
|
||||
if (!Main.rand.NextBool(5))
|
||||
return;
|
||||
Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.TerraBlade, Projectile.velocity.X, Projectile.velocity.Y);
|
||||
Parent = Main.projectile[(int)Projectile.ai[0]];
|
||||
}
|
||||
|
||||
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
|
||||
{
|
||||
target.immune[Projectile.owner] = 0;
|
||||
}
|
||||
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2);
|
||||
for (int i = 1; i < Projectile.oldPos.Length; i++)
|
||||
{
|
||||
Vector2 oldP1 = Projectile.oldPos[i];
|
||||
Vector2 oldP2 = Projectile.oldPos[i - 1];
|
||||
|
||||
Projectile.oldPos[i] = oldP2 + (oldP2.DirectionTo(oldP1) * MathHelper.Min(oldP2.Distance(oldP1), 5));
|
||||
}
|
||||
|
||||
CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], new Color(0.2f, 1f, 0f, 0f), 2);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,8 +21,8 @@ namespace CalamityMod.Projectiles.Summon
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 52;
|
||||
Projectile.height = 52;
|
||||
Projectile.width = 100;
|
||||
Projectile.height = 110;
|
||||
Projectile.netImportant = true;
|
||||
Projectile.friendly = true;
|
||||
Projectile.ignoreWater = true;
|
||||
@@ -33,6 +33,7 @@ namespace CalamityMod.Projectiles.Summon
|
||||
Projectile.minion = true;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.extraUpdates = 1;
|
||||
Projectile.scale = 0.75f;
|
||||
Projectile.usesLocalNPCImmunity = true;
|
||||
Projectile.localNPCHitCooldown = 30;
|
||||
Projectile.DamageType = DamageClass.Summon;
|
||||
@@ -68,11 +69,6 @@ namespace CalamityMod.Projectiles.Summon
|
||||
}
|
||||
}
|
||||
|
||||
public override Color? GetAlpha(Color lightColor)
|
||||
{
|
||||
return new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, Projectile.alpha);
|
||||
}
|
||||
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value;
|
||||
|
||||
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 2.4 KiB |
@@ -26,12 +26,6 @@ namespace CalamityMod.Projectiles.Summon
|
||||
|
||||
public override int AnimationFrames => 8;
|
||||
|
||||
private bool SyncedOnSpawn
|
||||
{
|
||||
get => Projectile.ai[0] == 1f;
|
||||
set => Projectile.ai[0] = value.ToInt();
|
||||
}
|
||||
|
||||
private Vector2 IdlePosition => Owner.MountedCenter +
|
||||
-Vector2.UnitY.RotatedBy(MathHelper.ToRadians(15f) * (Owner.ownedProjectileCounts[Type] + Owner.ownedProjectileCounts[ProjectileType<FrostbatMinion>()] - 1) - MathHelper.ToRadians(30f) * MinionIndex) * 80f;
|
||||
|
||||
@@ -60,12 +54,26 @@ namespace CalamityMod.Projectiles.Summon
|
||||
|
||||
public override void MinionAI()
|
||||
{
|
||||
if (!SyncedOnSpawn)
|
||||
if (Projectile.ai[0] == 0f)
|
||||
{
|
||||
CurrentBehavior = IdleBehavior;
|
||||
FramesUntilNextAnimationFrame = 3;
|
||||
SyncedOnSpawn = true;
|
||||
Projectile.netUpdate = true;
|
||||
|
||||
int minionIndex = 0;
|
||||
foreach (var proj in Main.ActiveProjectiles)
|
||||
{
|
||||
if ((proj.type != Type && proj.type != ProjectileType<FrostbatMinion>()) || proj.owner != Projectile.owner)
|
||||
continue;
|
||||
|
||||
if (proj.type == Type)
|
||||
MinionIndex = minionIndex;
|
||||
else
|
||||
proj.ModProjectile<FrostbatMinion>().MinionIndex = minionIndex;
|
||||
|
||||
minionIndex++;
|
||||
}
|
||||
|
||||
Projectile.ai[0]++;
|
||||
}
|
||||
|
||||
CurrentBehavior.Invoke();
|
||||
@@ -84,7 +92,6 @@ namespace CalamityMod.Projectiles.Summon
|
||||
|
||||
Lighting.AddLight(Projectile.Center, Color.OrangeRed.ToVector3() * 0.5f);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void IdleBehavior()
|
||||
|
||||
@@ -8,8 +8,8 @@ using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.GameContent;
|
||||
using Terraria.GameContent.Biomes;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using static Terraria.ModLoader.ModContent;
|
||||
|
||||
namespace CalamityMod.Projectiles.Summon
|
||||
@@ -26,12 +26,6 @@ namespace CalamityMod.Projectiles.Summon
|
||||
|
||||
public override int AnimationFrames => 8;
|
||||
|
||||
private bool SyncedOnSpawn
|
||||
{
|
||||
get => Projectile.ai[0] == 1f;
|
||||
set => Projectile.ai[0] = value.ToInt();
|
||||
}
|
||||
|
||||
private Vector2 IdlePosition => Owner.MountedCenter +
|
||||
-Vector2.UnitY.RotatedBy(MathHelper.ToRadians(15f) * (Owner.ownedProjectileCounts[Type] + Owner.ownedProjectileCounts[ProjectileType<FlarebatMinion>()] - 1) - MathHelper.ToRadians(30f) * MinionIndex) * 80f;
|
||||
|
||||
@@ -60,12 +54,26 @@ namespace CalamityMod.Projectiles.Summon
|
||||
|
||||
public override void MinionAI()
|
||||
{
|
||||
if (!SyncedOnSpawn)
|
||||
if (Projectile.ai[0] == 0f)
|
||||
{
|
||||
CurrentBehavior = IdleBehavior;
|
||||
FramesUntilNextAnimationFrame = 3;
|
||||
SyncedOnSpawn = true;
|
||||
Projectile.netUpdate = true;
|
||||
|
||||
int minionIndex = 0;
|
||||
foreach (var proj in Main.ActiveProjectiles)
|
||||
{
|
||||
if ((proj.type != Type && proj.type != ProjectileType<FlarebatMinion>()) || proj.owner != Projectile.owner)
|
||||
continue;
|
||||
|
||||
if (proj.type == Type)
|
||||
MinionIndex = minionIndex;
|
||||
else
|
||||
proj.ModProjectile<FlarebatMinion>().MinionIndex = minionIndex;
|
||||
|
||||
minionIndex++;
|
||||
}
|
||||
|
||||
Projectile.ai[0]++;
|
||||
}
|
||||
|
||||
CurrentBehavior.Invoke();
|
||||
|
||||
|
Before Width: | Height: | Size: 571 B After Width: | Height: | Size: 544 B |
|
Before Width: | Height: | Size: 327 B After Width: | Height: | Size: 330 B |
@@ -112,8 +112,8 @@ namespace CalamityMod.Systems
|
||||
private static Dictionary<string, Asset<Texture2D>> cachedBlendSheets = [];
|
||||
|
||||
#region Plant Stuff
|
||||
private static ushort[] PlantTypes = new ushort[]
|
||||
{
|
||||
private static ushort[] PlantTypes =
|
||||
[
|
||||
TileID.Plants,
|
||||
TileID.CorruptPlants,
|
||||
TileID.JunglePlants,
|
||||
@@ -132,8 +132,9 @@ namespace CalamityMod.Systems
|
||||
(ushort)ModContent.TileType<TenebrisRemnant>(),
|
||||
(ushort)ModContent.TileType<PhoviamareHalm>(),
|
||||
(ushort)ModContent.TileType<SmallCorals>(),
|
||||
};
|
||||
private static int[][] PlantCheckAgainst;
|
||||
];
|
||||
|
||||
private static int[][] PlantValidGrounds;
|
||||
private static Dictionary<ushort, ushort> VineToGrass;
|
||||
#endregion
|
||||
|
||||
@@ -142,24 +143,24 @@ namespace CalamityMod.Systems
|
||||
// All tiles from all mods are guaranteed to be loaded by the execution time of this hook.
|
||||
public override void PostAddRecipes()
|
||||
{
|
||||
PlantCheckAgainst = new int[TileLoader.TileCount][];
|
||||
PlantCheckAgainst[TileID.Plants] = new int[3] { TileID.Grass, TileID.PlanterBox, TileID.ClayPot };
|
||||
PlantCheckAgainst[TileID.CorruptPlants] = new int[1] { TileID.CorruptGrass };
|
||||
PlantCheckAgainst[TileID.JunglePlants] = new int[1] { TileID.JungleGrass };
|
||||
PlantCheckAgainst[TileID.MushroomPlants] = new int[1] { TileID.MushroomGrass };
|
||||
PlantCheckAgainst[TileID.Plants2] = new int[3] { TileID.Grass, TileID.PlanterBox, TileID.ClayPot };
|
||||
PlantCheckAgainst[TileID.JunglePlants2] = new int[1] { TileID.JungleGrass };
|
||||
PlantCheckAgainst[TileID.HallowedPlants] = new int[1] { TileID.HallowedGrass };
|
||||
PlantCheckAgainst[TileID.HallowedPlants2] = new int[1] { TileID.HallowedGrass };
|
||||
PlantCheckAgainst[TileID.CrimsonPlants] = new int[1] { TileID.CrimsonGrass };
|
||||
PlantCheckAgainst[ModContent.TileType<AstralShortPlants>()] = new int[1] { ModContent.TileType<AstralGrass>() };
|
||||
PlantCheckAgainst[ModContent.TileType<AstralTallPlants>()] = new int[1] { ModContent.TileType<AstralGrass>() };
|
||||
PlantCheckAgainst[ModContent.TileType<CinderBlossomTallPlants>()] = new int[1] { ModContent.TileType<ScorchedRemainsGrass>() };
|
||||
PlantCheckAgainst[ModContent.TileType<SulphurTentacleCorals>()] = new int[1] { ModContent.TileType<SulphurousShale>() };
|
||||
PlantCheckAgainst[ModContent.TileType<AbyssKelp>()] = new int[1] { ModContent.TileType<AbyssGravel>() };
|
||||
PlantCheckAgainst[ModContent.TileType<TenebrisRemnant>()] = new int[1] { ModContent.TileType<Voidstone>() };
|
||||
PlantCheckAgainst[ModContent.TileType<PhoviamareHalm>()] = new int[2] { ModContent.TileType<PyreMantle>(), ModContent.TileType<PyreMantleMolten>() };
|
||||
PlantCheckAgainst[ModContent.TileType<SmallCorals>()] = new int[1] { ModContent.TileType<EutrophicSand>() };
|
||||
PlantValidGrounds = new int[TileLoader.TileCount][];
|
||||
PlantValidGrounds[TileID.Plants] = new int[3] { TileID.Grass, TileID.PlanterBox, TileID.ClayPot };
|
||||
PlantValidGrounds[TileID.CorruptPlants] = new int[1] { TileID.CorruptGrass };
|
||||
PlantValidGrounds[TileID.JunglePlants] = new int[1] { TileID.JungleGrass };
|
||||
PlantValidGrounds[TileID.MushroomPlants] = new int[1] { TileID.MushroomGrass };
|
||||
PlantValidGrounds[TileID.Plants2] = new int[3] { TileID.Grass, TileID.PlanterBox, TileID.ClayPot };
|
||||
PlantValidGrounds[TileID.JunglePlants2] = new int[1] { TileID.JungleGrass };
|
||||
PlantValidGrounds[TileID.HallowedPlants] = new int[1] { TileID.HallowedGrass };
|
||||
PlantValidGrounds[TileID.HallowedPlants2] = new int[1] { TileID.HallowedGrass };
|
||||
PlantValidGrounds[TileID.CrimsonPlants] = new int[1] { TileID.CrimsonGrass };
|
||||
PlantValidGrounds[ModContent.TileType<AstralShortPlants>()] = new int[1] { ModContent.TileType<AstralGrass>() };
|
||||
PlantValidGrounds[ModContent.TileType<AstralTallPlants>()] = new int[1] { ModContent.TileType<AstralGrass>() };
|
||||
PlantValidGrounds[ModContent.TileType<CinderBlossomTallPlants>()] = new int[1] { ModContent.TileType<ScorchedRemainsGrass>() };
|
||||
PlantValidGrounds[ModContent.TileType<SulphurTentacleCorals>()] = new int[1] { ModContent.TileType<SulphurousShale>() };
|
||||
PlantValidGrounds[ModContent.TileType<AbyssKelp>()] = new int[1] { ModContent.TileType<AbyssGravel>() };
|
||||
PlantValidGrounds[ModContent.TileType<TenebrisRemnant>()] = new int[1] { ModContent.TileType<Voidstone>() };
|
||||
PlantValidGrounds[ModContent.TileType<PhoviamareHalm>()] = new int[2] { ModContent.TileType<PyreMantle>(), ModContent.TileType<PyreMantleMolten>() };
|
||||
PlantValidGrounds[ModContent.TileType<SmallCorals>()] = new int[1] { ModContent.TileType<EutrophicSand>() };
|
||||
|
||||
VineToGrass = new Dictionary<ushort, ushort>
|
||||
{
|
||||
@@ -199,7 +200,7 @@ namespace CalamityMod.Systems
|
||||
|
||||
public override void Unload()
|
||||
{
|
||||
PlantCheckAgainst = null;
|
||||
PlantValidGrounds = null;
|
||||
|
||||
VineToGrass?.Clear();
|
||||
VineToGrass = null;
|
||||
@@ -395,82 +396,73 @@ namespace CalamityMod.Systems
|
||||
{
|
||||
if (x < 0 || x >= Main.maxTilesX)
|
||||
return;
|
||||
|
||||
if (y < 0 || y >= Main.maxTilesY)
|
||||
return;
|
||||
|
||||
// If the tile below is off the bottom of the map, then assume it's invalid placement
|
||||
var tile = Main.tile[x, y];
|
||||
var checkType = -1;
|
||||
int plantType = tile.TileType;
|
||||
|
||||
// If the tile below is off the bottom of the map, then assume it's the same tile type.
|
||||
if (y + 1 >= Main.maxTilesY)
|
||||
checkType = plantType;
|
||||
else
|
||||
{
|
||||
var below = Main.tile[x, y + 1];
|
||||
if (below != null && below.HasUnactuatedTile && !below.IsHalfBlock && below.Slope == 0)
|
||||
checkType = below.TileType;
|
||||
WorldGen.KillTile(x, y);
|
||||
return;
|
||||
}
|
||||
|
||||
// Sub function to determine whether the plant needs an update
|
||||
static bool PlantNeedsUpdate(int plant, int check)
|
||||
// If tile below is not elligible for growing plants, we kill the tile immediately
|
||||
var below = Main.tile[x, y + 1];
|
||||
if (!below.HasTile || !below.HasUnactuatedTile || below.IsHalfBlock || below.Slope != SlopeType.Solid)
|
||||
{
|
||||
if (PlantCheckAgainst[plant] is null)
|
||||
return false;
|
||||
|
||||
for (var i = 0; i < PlantCheckAgainst[plant].Length; ++i)
|
||||
{
|
||||
if (PlantCheckAgainst[plant][i] == check)
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
WorldGen.KillTile(x, y);
|
||||
return;
|
||||
}
|
||||
|
||||
// If no valid below tile type could be determined, then don't do anything.
|
||||
// Additionally, don't do anything if the plant doesn't need a framing update.
|
||||
if (checkType == -1 || !PlantNeedsUpdate(plantType, checkType))
|
||||
// Check if tile below is valid for given grass type, If so we don't need to update this
|
||||
var belowTileType = (int)below.TileType;
|
||||
if (PlantValidGrounds[plantType] is not null && PlantValidGrounds[plantType].Contains(belowTileType))
|
||||
return;
|
||||
|
||||
if ((plantType == TileID.Plants || plantType == TileID.Plants2) && checkType != TileID.Grass && tile.TileFrameX >= 162)
|
||||
var newPlantType = plantType;
|
||||
|
||||
if ((plantType == TileID.Plants || plantType == TileID.Plants2) && belowTileType != TileID.Grass && tile.TileFrameX >= 162)
|
||||
{
|
||||
Main.tile[x, y].TileFrameX = 126;
|
||||
}
|
||||
if (plantType == TileID.JunglePlants2 && checkType != TileID.JungleGrass && tile.TileFrameX >= 162)
|
||||
if (plantType == TileID.JunglePlants2 && belowTileType != TileID.JungleGrass && tile.TileFrameX >= 162)
|
||||
{
|
||||
Main.tile[x, y].TileFrameX = 126;
|
||||
}
|
||||
|
||||
if (checkType == TileID.CorruptGrass)
|
||||
#region Biome Grass Replacements
|
||||
if (belowTileType == TileID.CorruptGrass)
|
||||
{
|
||||
plantType = TileID.CorruptPlants;
|
||||
newPlantType = TileID.CorruptPlants;
|
||||
if (tile.TileFrameX >= 162)
|
||||
{
|
||||
Main.tile[x, y].TileFrameX = 126;
|
||||
}
|
||||
}
|
||||
else if (checkType == TileID.Grass)
|
||||
else if (belowTileType == TileID.Grass)
|
||||
{
|
||||
plantType = plantType == TileID.HallowedPlants2 ? TileID.Plants2 : TileID.Plants;
|
||||
newPlantType = (plantType == TileID.HallowedPlants2 ? TileID.Plants2 : TileID.Plants);
|
||||
}
|
||||
else if (checkType == TileID.HallowedGrass)
|
||||
else if (belowTileType == TileID.HallowedGrass)
|
||||
{
|
||||
plantType = plantType == TileID.Plants2 ? TileID.HallowedPlants2 : TileID.HallowedPlants;
|
||||
newPlantType = (plantType == TileID.Plants2 ? TileID.HallowedPlants2 : TileID.HallowedPlants);
|
||||
}
|
||||
else if (checkType == TileID.CrimsonGrass)
|
||||
else if (belowTileType == TileID.CrimsonGrass)
|
||||
{
|
||||
plantType = TileID.CrimsonPlants;
|
||||
newPlantType = TileID.CrimsonPlants;
|
||||
}
|
||||
else if (checkType == TileID.MushroomGrass)
|
||||
else if (belowTileType == TileID.MushroomGrass)
|
||||
{
|
||||
plantType = TileID.MushroomPlants;
|
||||
newPlantType = TileID.MushroomPlants;
|
||||
while (Main.tile[x, y].TileFrameX > 72)
|
||||
{
|
||||
Main.tile[x, y].TileFrameX -= 72;
|
||||
}
|
||||
}
|
||||
|
||||
// Astral grass and plant behavior
|
||||
else if (checkType == ModContent.TileType<AstralGrass>())
|
||||
else if (belowTileType == ModContent.TileType<AstralGrass>())
|
||||
{
|
||||
var isShortPlant = plantType == TileID.Plants ||
|
||||
plantType == TileID.CorruptPlants ||
|
||||
@@ -478,14 +470,15 @@ namespace CalamityMod.Systems
|
||||
plantType == TileID.HallowedPlants ||
|
||||
plantType == TileID.MushroomPlants ||
|
||||
plantType == TileID.JunglePlants;
|
||||
plantType = isShortPlant ? ModContent.TileType<AstralShortPlants>() : ModContent.TileType<AstralTallPlants>();
|
||||
newPlantType = isShortPlant ? ModContent.TileType<AstralShortPlants>() : ModContent.TileType<AstralTallPlants>();
|
||||
}
|
||||
#endregion
|
||||
|
||||
// If the tile type is not the same as the plant type, then set it equal. Otherwise, destroy it.
|
||||
if (Main.tile[x, y].TileType != plantType)
|
||||
Main.tile[x, y].TileType = (ushort)plantType;
|
||||
else
|
||||
WorldGen.KillTile(x, y, false, false, false);
|
||||
if (plantType != newPlantType)
|
||||
{
|
||||
Main.tile[x, y].TileType = (ushort)newPlantType;
|
||||
}
|
||||
}
|
||||
|
||||
internal static void VineFrame(int x, int y)
|
||||
|
||||
@@ -22,6 +22,7 @@ namespace CalamityMod.Tiles.Astral
|
||||
Main.tileFrameImportant[Type] = true;
|
||||
TileID.Sets.ReplaceTileBreakUp[Type] = true;
|
||||
TileID.Sets.SwaysInWindBasic[Type] = true;
|
||||
TileID.Sets.IgnoredByGrowingSaplings[Type] = true;
|
||||
TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Plant"]);
|
||||
|
||||
DustType = ModContent.DustType<AstralBasic>();
|
||||
|
||||
@@ -23,6 +23,7 @@ namespace CalamityMod.Tiles.Astral
|
||||
Main.tileFrameImportant[Type] = true;
|
||||
TileID.Sets.ReplaceTileBreakUp[Type] = true;
|
||||
TileID.Sets.SwaysInWindBasic[Type] = true;
|
||||
TileID.Sets.IgnoredByGrowingSaplings[Type] = true;
|
||||
TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Plant"]);
|
||||
|
||||
TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2);
|
||||
|
||||
@@ -60,9 +60,9 @@ namespace CalamityMod.Tiles.Crags
|
||||
height = 48;
|
||||
}
|
||||
|
||||
public override void KillMultiTile(int i, int j, int frameX, int frameY)
|
||||
public override void KillTile(int i, int j, ref bool fail, ref bool effectOnly, ref bool noItem)
|
||||
{
|
||||
if (Main.rand.NextBool(20))
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient && Main.rand.NextBool(20))
|
||||
{
|
||||
Item.NewItem(new EntitySource_TileBreak(i, j), new Vector2(i, j) * 16f, ModContent.ItemType<Items.Placeables.CinderBlossomSeeds>());
|
||||
}
|
||||
|
||||