Merge branch 'master' of https://github.com/UncleDanny/CalamityMod
No files matched your search
@@ -47,7 +47,7 @@ namespace CalamityMod.Items.Armor
|
||||
"Increased heart pickup range\n" +
|
||||
"Enemies have a chance to drop extra hearts on death\n" +
|
||||
"Ranged critical strikes will cause an explosion of leaves\n" +
|
||||
"Ranged projectiles have a chance to split into life energy on death";
|
||||
"Ranged projectiles have a chance to split into life energy on death by hitting an enemy";
|
||||
}
|
||||
|
||||
public override void UpdateEquip(Player player)
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
using CalamityMod.NPCs.SunkenSea;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Items.Critters
|
||||
{
|
||||
public class BabyGhostBellItem : ModItem
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Baby Ghost Bell");
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
item.useStyle = 1;
|
||||
item.autoReuse = true;
|
||||
item.useTurn = true;
|
||||
item.useAnimation = 15;
|
||||
item.useTime = 10;
|
||||
item.maxStack = 999;
|
||||
item.consumable = true;
|
||||
item.noUseGraphic = true;
|
||||
item.value = Item.buyPrice(0, 0, 30, 0);
|
||||
//item.CloneDefaults(2004); //Lightning Bug item
|
||||
item.width = 26;
|
||||
item.height = 24;
|
||||
item.makeNPC = (short)ModContent.NPCType<GhostBellSmall>();
|
||||
item.rare = 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 3.3 KiB |
@@ -0,0 +1,33 @@
|
||||
using CalamityMod.NPCs.NormalNPCs;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Items.Critters
|
||||
{
|
||||
public class PiggyItem : ModItem
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Piggy");
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
item.useStyle = 1;
|
||||
item.autoReuse = true;
|
||||
item.useTurn = true;
|
||||
item.useAnimation = 15;
|
||||
item.useTime = 10;
|
||||
item.maxStack = 999;
|
||||
item.consumable = true;
|
||||
item.noUseGraphic = true;
|
||||
item.value = Item.buyPrice(0, 50, 0, 0);
|
||||
//item.CloneDefaults(2004); //Lightning Bug item
|
||||
item.width = 26;
|
||||
item.height = 24;
|
||||
item.makeNPC = (short)ModContent.NPCType<Piggy>();
|
||||
item.rare = 1;
|
||||
item.Calamity().postMoonLordRarity = 21;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 3.1 KiB |
@@ -0,0 +1,33 @@
|
||||
using CalamityMod.NPCs.SunkenSea;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Items.Critters
|
||||
{
|
||||
public class SeaMinnowItem : ModItem
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Sea Minnow");
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
item.useStyle = 1;
|
||||
item.autoReuse = true;
|
||||
item.useTurn = true;
|
||||
item.useAnimation = 15;
|
||||
item.useTime = 10;
|
||||
item.maxStack = 999;
|
||||
item.consumable = true;
|
||||
item.noUseGraphic = true;
|
||||
item.value = Item.buyPrice(0, 0, 30, 0);
|
||||
//item.CloneDefaults(2004); //Lightning Bug item
|
||||
item.width = 26;
|
||||
item.height = 24;
|
||||
item.bait = 20;
|
||||
item.makeNPC = (short)ModContent.NPCType<SeaMinnow>();
|
||||
item.rare = 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 3.0 KiB |
@@ -2,7 +2,7 @@
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Items.Fishing.AstralCatches
|
||||
namespace CalamityMod.Items.Critters
|
||||
{
|
||||
public class TwinklerItem : ModItem
|
||||
{
|
||||
|
Before Width: | Height: | Size: 650 B After Width: | Height: | Size: 650 B |
@@ -1,4 +1,5 @@
|
||||
using CalamityMod.Items.Materials;
|
||||
using CalamityMod.Items.Critters;
|
||||
using CalamityMod.Items.Placeables;
|
||||
using CalamityMod.Items.Placeables.Ores;
|
||||
using CalamityMod.Items.Potions;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using CalamityMod.Items.Materials;
|
||||
using CalamityMod.Items.Critters;
|
||||
using CalamityMod.Items.Placeables;
|
||||
using CalamityMod.Items.Placeables.Ores;
|
||||
using CalamityMod.Items.Potions;
|
||||
@@ -69,6 +70,7 @@ namespace CalamityMod.Items.Fishing.SunkenSeaCatches
|
||||
//Bait
|
||||
DropHelper.DropItemChance(player, ItemID.MasterBait, 10, 1, 2);
|
||||
DropHelper.DropItemChance(player, ItemID.JourneymanBait, 5, 1, 3);
|
||||
DropHelper.DropItemChance(player, ModContent.ItemType<SeaMinnowItem>(), 5, 1, 3);
|
||||
DropHelper.DropItemChance(player, ItemID.ApprenticeBait, 3, 2, 3);
|
||||
|
||||
//Potions
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
using CalamityMod.Items.Materials;
|
||||
using CalamityMod.Projectiles.Melee;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Items.Weapons.Melee
|
||||
{
|
||||
public class DivineHatchet : ModItem
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Seeking Scorcher");
|
||||
Tooltip.SetDefault("May your enemies burn in hell for the sins they have committed\n" +
|
||||
"Throws a holy boomerang that seeks out up to three enemies before returning to the player");
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
item.width = 60;
|
||||
item.damage = 500;
|
||||
item.noMelee = true;
|
||||
item.noUseGraphic = true;
|
||||
item.autoReuse = true;
|
||||
item.useAnimation = 15;
|
||||
item.useStyle = 1;
|
||||
item.useTime = 15;
|
||||
item.knockBack = 8.5f;
|
||||
item.UseSound = SoundID.Item1;
|
||||
item.melee = true;
|
||||
item.height = 62;
|
||||
item.value = Item.buyPrice(1, 40, 0, 0);
|
||||
item.rare = 8;
|
||||
item.shoot = ModContent.ProjectileType<DivineHatchetBoomerang>();
|
||||
item.shootSpeed = 14f;
|
||||
item.Calamity().postMoonLordRarity = 13;
|
||||
}
|
||||
|
||||
public override void AddRecipes()
|
||||
{
|
||||
ModRecipe recipe = new ModRecipe(mod);
|
||||
recipe.AddIngredient(ItemID.PossessedHatchet);
|
||||
recipe.AddIngredient(ModContent.ItemType<DivineGeode>(), 5);
|
||||
recipe.AddIngredient(ModContent.ItemType<UeliaceBar>(), 9);
|
||||
recipe.AddTile(TileID.LunarCraftingStation);
|
||||
recipe.SetResult(this);
|
||||
recipe.AddRecipe();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 1.5 KiB |
@@ -13,7 +13,7 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Stream Gouge");
|
||||
Tooltip.SetDefault("Fires an essence flame beam\n" +
|
||||
Tooltip.SetDefault("Fires an essence spear clone\n" +
|
||||
"Ignores immunity frames");
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Ranged
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
item.damage = 999;
|
||||
item.damage = 1599;
|
||||
item.ranged = true;
|
||||
item.width = 48;
|
||||
item.height = 30;
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons.Rogue
|
||||
item.value = Item.buyPrice(1, 80, 0, 0);
|
||||
item.rare = 10;
|
||||
|
||||
item.damage = 549;
|
||||
item.damage = 469;
|
||||
item.useAnimation = 21;
|
||||
item.useTime = 3;
|
||||
item.crit = 16;
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace CalamityMod.Items.Weapons.Rogue
|
||||
item.useTime = 20;
|
||||
item.useAnimation = 20;
|
||||
item.useStyle = 1;
|
||||
item.knockBack = 10;
|
||||
item.knockBack = 5f;
|
||||
item.crit = 20;
|
||||
item.value = Item.buyPrice(0, 0, 0, 50);
|
||||
item.rare = 0;
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace CalamityMod.Items.Weapons.Summon
|
||||
position = Main.MouseWorld;
|
||||
speedX = 0;
|
||||
speedY = 0;
|
||||
Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI);
|
||||
Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 1f);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using CalamityMod.Dusts;
|
||||
using CalamityMod.Items.Fishing.AstralCatches;
|
||||
using CalamityMod.Items.Critters;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using CalamityMod.Items.Placeables.Banners;
|
||||
using CalamityMod.Items.Critters;
|
||||
using System;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
@@ -11,6 +12,7 @@ namespace CalamityMod.NPCs.NormalNPCs
|
||||
{
|
||||
DisplayName.SetDefault("Piggy");
|
||||
Main.npcFrameCount[npc.type] = 5;
|
||||
Main.npcCatchable[npc.type] = true;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
@@ -29,6 +31,7 @@ namespace CalamityMod.NPCs.NormalNPCs
|
||||
npc.DeathSound = SoundID.NPCDeath1;
|
||||
banner = npc.type;
|
||||
bannerItem = ModContent.ItemType<PiggyBanner>();
|
||||
npc.catchItem = (short)ModContent.ItemType<PiggyItem>();
|
||||
}
|
||||
|
||||
public override float SpawnChance(NPCSpawnInfo spawnInfo)
|
||||
@@ -79,7 +82,7 @@ namespace CalamityMod.NPCs.NormalNPCs
|
||||
|
||||
public override void NPCLoot()
|
||||
{
|
||||
Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Bacon);
|
||||
DropHelper.DropItem(npc, ItemID.Bacon, 1, 1);
|
||||
}
|
||||
|
||||
public override void HitEffect(int hitDirection, double damage)
|
||||
@@ -96,5 +99,15 @@ namespace CalamityMod.NPCs.NormalNPCs
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnCatchNPC(Player player, Item item)
|
||||
{
|
||||
try
|
||||
{
|
||||
} catch
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1076,11 +1076,12 @@ namespace CalamityMod.NPCs.Providence
|
||||
DropHelper.DropItemCondition(npc, ModContent.ItemType<KnowledgeProvidence>(), true, !CalamityWorld.downedProvidence);
|
||||
DropHelper.DropResidentEvilAmmo(npc, CalamityWorld.downedProvidence, 5, 2, 1);
|
||||
|
||||
DropHelper.DropItemCondition(npc, ModContent.ItemType<ElysianWings>(), biomeType != 2);
|
||||
DropHelper.DropItemCondition(npc, ModContent.ItemType<ElysianAegis>(), biomeType == 2);
|
||||
|
||||
DropHelper.DropItemCondition(npc, ModContent.ItemType<RuneofCos>(), true, !CalamityWorld.downedProvidence);
|
||||
|
||||
//Accessories clientside only in Expert
|
||||
DropHelper.DropItemCondition(npc, ModContent.ItemType<ElysianWings>(), true, biomeType != 2 && Main.expertMode);
|
||||
DropHelper.DropItemCondition(npc, ModContent.ItemType<ElysianAegis>(), true, biomeType == 2 && Main.expertMode);
|
||||
|
||||
// All other drops are contained in the bag, so they only drop directly on Normal
|
||||
if (!Main.expertMode)
|
||||
{
|
||||
@@ -1098,6 +1099,8 @@ namespace CalamityMod.NPCs.Providence
|
||||
|
||||
// Equipment
|
||||
DropHelper.DropItemChance(npc, ModContent.ItemType<SamuraiBadge>(), 40);
|
||||
DropHelper.DropItemCondition(npc, ModContent.ItemType<ElysianWings>(), biomeType != 2);
|
||||
DropHelper.DropItemCondition(npc, ModContent.ItemType<ElysianAegis>(), biomeType == 2);
|
||||
|
||||
// Vanity
|
||||
DropHelper.DropItemChance(npc, ModContent.ItemType<ProvidenceMask>(), 7);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using CalamityMod.Items.Placeables.Banners;
|
||||
using CalamityMod.Items.Critters;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System.IO;
|
||||
@@ -16,6 +17,7 @@ namespace CalamityMod.NPCs.SunkenSea
|
||||
{
|
||||
DisplayName.SetDefault("Baby Ghost Bell");
|
||||
Main.npcFrameCount[npc.type] = 4;
|
||||
Main.npcCatchable[npc.type] = true;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
@@ -36,6 +38,7 @@ namespace CalamityMod.NPCs.SunkenSea
|
||||
npc.DeathSound = SoundID.NPCDeath28;
|
||||
banner = npc.type;
|
||||
bannerItem = ModContent.ItemType<GhostBellSmallBanner>();
|
||||
npc.catchItem = (short)ModContent.ItemType<BabyGhostBellItem>();
|
||||
}
|
||||
|
||||
public override void SendExtraAI(BinaryWriter writer)
|
||||
@@ -54,7 +57,8 @@ namespace CalamityMod.NPCs.SunkenSea
|
||||
{
|
||||
if (npc.localAI[0] == 0f)
|
||||
{
|
||||
npc.catchItem = (Main.rand.NextBool(20)) ? (short)ModContent.ItemType<RustedJingleBell>() : ItemID.None;
|
||||
if (Main.rand.NextBool(20))
|
||||
npc.catchItem = (short)ModContent.ItemType<RustedJingleBell>();
|
||||
npc.localAI[0] = 1f;
|
||||
npc.velocity.Y = -3f;
|
||||
npc.netUpdate = true;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using CalamityMod.Items.Placeables.Banners;
|
||||
using CalamityMod.Items.Critters;
|
||||
using System;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
@@ -11,6 +12,7 @@ namespace CalamityMod.NPCs.SunkenSea
|
||||
{
|
||||
DisplayName.SetDefault("Sea Minnow");
|
||||
Main.npcFrameCount[npc.type] = 4;
|
||||
Main.npcCatchable[npc.type] = true;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
@@ -29,6 +31,7 @@ namespace CalamityMod.NPCs.SunkenSea
|
||||
banner = npc.type;
|
||||
bannerItem = ModContent.ItemType<SeaMinnowBanner>();
|
||||
npc.chaseable = false;
|
||||
npc.catchItem = (short)ModContent.ItemType<SeaMinnowItem>();
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
@@ -212,5 +215,15 @@ namespace CalamityMod.NPCs.SunkenSea
|
||||
Dust.NewDust(npc.position, npc.width, npc.height, 68, hitDirection, -1f, 0, default, 1f);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnCatchNPC(Player player, Item item)
|
||||
{
|
||||
try
|
||||
{
|
||||
} catch
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1630,6 +1630,30 @@ namespace CalamityMod.Projectiles
|
||||
Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, num8, num9, ModContent.ProjectileType<GodSlayerPhantom>(), (int)((double)num * 2.0), 0f, projectile.owner, 0f, ai1);
|
||||
}
|
||||
}
|
||||
|
||||
if (projectile.ranged)
|
||||
{
|
||||
if (Main.player[projectile.owner].Calamity().tarraRanged && Main.rand.Next(0, 100) >= 88 && Main.player[projectile.owner].ownedProjectileCounts[ModContent.ProjectileType<TarraEnergy>()] <= 20 && (projectile.timeLeft <= 2 || projectile.penetrate <= 1))
|
||||
{
|
||||
int num251 = Main.rand.Next(2, 4);
|
||||
for (int num252 = 0; num252 < num251; num252++)
|
||||
{
|
||||
Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101));
|
||||
while (value15.X == 0f && value15.Y == 0f)
|
||||
{
|
||||
value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101));
|
||||
}
|
||||
value15.Normalize();
|
||||
value15 *= (float)Main.rand.Next(70, 101) * 0.1f;
|
||||
int newDamage = (int)((double)projectile.damage * 0.33);
|
||||
if (newDamage > 65)
|
||||
{
|
||||
newDamage = 65;
|
||||
}
|
||||
Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, ModContent.ProjectileType<TarraEnergy>(), newDamage, 0f, projectile.owner, 0f, 0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
@@ -1798,30 +1822,6 @@ namespace CalamityMod.Projectiles
|
||||
}
|
||||
}
|
||||
|
||||
if (projectile.ranged)
|
||||
{
|
||||
if (Main.player[projectile.owner].Calamity().tarraRanged && Main.rand.Next(0, 100) >= 88)
|
||||
{
|
||||
int num251 = Main.rand.Next(2, 4);
|
||||
for (int num252 = 0; num252 < num251; num252++)
|
||||
{
|
||||
Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101));
|
||||
while (value15.X == 0f && value15.Y == 0f)
|
||||
{
|
||||
value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101));
|
||||
}
|
||||
value15.Normalize();
|
||||
value15 *= (float)Main.rand.Next(70, 101) * 0.1f;
|
||||
int newDamage = (int)((double)projectile.damage * 0.33);
|
||||
if (newDamage > 65)
|
||||
{
|
||||
newDamage = 65;
|
||||
}
|
||||
Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, ModContent.ProjectileType<TarraEnergy>(), newDamage, 0f, projectile.owner, 0f, 0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (rogue)
|
||||
{
|
||||
if (Main.player[projectile.owner].Calamity().etherealExtorter && Main.rand.Next(0, 100) >= 95)
|
||||
|
||||
@@ -0,0 +1,220 @@
|
||||
using CalamityMod.Buffs.DamageOverTime;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Melee
|
||||
{
|
||||
public class DivineHatchetBoomerang : ModProjectile
|
||||
{
|
||||
private bool hasHitEnemy = false;
|
||||
private static int Lifetime = 300;
|
||||
private static int ReboundTime = 100;
|
||||
private int targetNPC = -1;
|
||||
private List<int> previousNPCs = new List<int>() { -1 };
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Scorching Seeker");
|
||||
ProjectileID.Sets.TrailCacheLength[projectile.type] = 8;
|
||||
ProjectileID.Sets.TrailingMode[projectile.type] = 1;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
projectile.width = 60;
|
||||
projectile.height = 60;
|
||||
projectile.friendly = true;
|
||||
projectile.tileCollide = false;
|
||||
projectile.penetrate = 3;
|
||||
projectile.timeLeft = Lifetime;
|
||||
projectile.melee = true;
|
||||
projectile.extraUpdates = 1;
|
||||
projectile.usesLocalNPCImmunity = true;
|
||||
projectile.localNPCHitCooldown = 10;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
//holy dust
|
||||
if (Main.rand.NextBool(8))
|
||||
{
|
||||
Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 244, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f);
|
||||
}
|
||||
|
||||
// Boomerang rotation
|
||||
projectile.rotation += 0.4f * (float)projectile.direction;
|
||||
|
||||
// Boomerang sound
|
||||
if (projectile.soundDelay == 0)
|
||||
{
|
||||
projectile.soundDelay = 8;
|
||||
Main.PlaySound(SoundID.Item7, projectile.position);
|
||||
}
|
||||
|
||||
// Returns after some number of frames in the air
|
||||
if (projectile.timeLeft < Lifetime - ReboundTime)
|
||||
projectile.ai[0] = 1f;
|
||||
|
||||
if (projectile.ai[0] != 0f)
|
||||
{
|
||||
float returnSpeed = 26f;
|
||||
float acceleration = 1.4f;
|
||||
|
||||
Player owner = Main.player[projectile.owner];
|
||||
|
||||
// Delete the projectile if it's excessively far away.
|
||||
Vector2 playerCenter = owner.Center;
|
||||
float xDist = playerCenter.X - projectile.Center.X;
|
||||
float yDist = playerCenter.Y - projectile.Center.Y;
|
||||
float dist = (float)Math.Sqrt((double)(xDist * xDist + yDist * yDist));
|
||||
if (dist > 3000f)
|
||||
projectile.Kill();
|
||||
|
||||
dist = returnSpeed / dist;
|
||||
xDist *= dist;
|
||||
yDist *= dist;
|
||||
|
||||
// Home back in on the player.
|
||||
if (projectile.velocity.X < xDist)
|
||||
{
|
||||
projectile.velocity.X = projectile.velocity.X + acceleration;
|
||||
if (projectile.velocity.X < 0f && xDist > 0f)
|
||||
projectile.velocity.X += acceleration;
|
||||
}
|
||||
else if (projectile.velocity.X > xDist)
|
||||
{
|
||||
projectile.velocity.X = projectile.velocity.X - acceleration;
|
||||
if (projectile.velocity.X > 0f && xDist < 0f)
|
||||
projectile.velocity.X -= acceleration;
|
||||
}
|
||||
if (projectile.velocity.Y < yDist)
|
||||
{
|
||||
projectile.velocity.Y = projectile.velocity.Y + acceleration;
|
||||
if (projectile.velocity.Y < 0f && yDist > 0f)
|
||||
projectile.velocity.Y += acceleration;
|
||||
}
|
||||
else if (projectile.velocity.Y > yDist)
|
||||
{
|
||||
projectile.velocity.Y = projectile.velocity.Y - acceleration;
|
||||
if (projectile.velocity.Y > 0f && yDist < 0f)
|
||||
projectile.velocity.Y -= acceleration;
|
||||
}
|
||||
|
||||
// Delete the projectile if it touches its owner.
|
||||
if (Main.myPlayer == projectile.owner)
|
||||
if (projectile.Hitbox.Intersects(owner.Hitbox))
|
||||
projectile.Kill();
|
||||
|
||||
//home in on nearby NPCs if not returning to player
|
||||
if (projectile.penetrate != -1)
|
||||
{
|
||||
if (!hasHitEnemy)
|
||||
{
|
||||
float range = 999f;
|
||||
for (int a = 0; a < Main.npc.Length; a++)
|
||||
{
|
||||
if (Main.npc[a].CanBeChasedBy(projectile, false))
|
||||
{
|
||||
float var2 = Main.npc[a].position.X + (Main.npc[a].width / 2);
|
||||
float var3 = Main.npc[a].position.Y + (Main.npc[a].height / 2);
|
||||
float distance2npc = Math.Abs(projectile.position.X + (projectile.width / 2) - var2) + Math.Abs(projectile.position.Y + (projectile.height / 2) - var3);
|
||||
if (distance2npc < range)
|
||||
{
|
||||
Vector2 newVelocity = Main.npc[a].Center - projectile.Center;
|
||||
newVelocity.Normalize();
|
||||
newVelocity *= 15f;
|
||||
projectile.velocity = newVelocity;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (targetNPC >= 0)
|
||||
{
|
||||
Vector2 newVelocity = Main.npc[targetNPC].Center - projectile.Center;
|
||||
newVelocity.Normalize();
|
||||
newVelocity *= 15f;
|
||||
projectile.velocity = newVelocity;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
|
||||
{
|
||||
CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1);
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
|
||||
{
|
||||
//inflict Holy Flames for 6 seconds
|
||||
target.AddBuff(ModContent.BuffType<HolyFlames>(), 360);
|
||||
|
||||
if (projectile.penetrate != -1)
|
||||
{
|
||||
//find a nearby NPC to track
|
||||
float minDist = 999f;
|
||||
int index = 0;
|
||||
for (int i = 0; i < Main.npc.Length; i++)
|
||||
{
|
||||
bool hasHitNPC = false;
|
||||
for (int j = 0; j < previousNPCs.Count; j++)
|
||||
{
|
||||
if (previousNPCs[j] == i)
|
||||
{
|
||||
hasHitNPC = true;
|
||||
}
|
||||
}
|
||||
|
||||
NPC npc = Main.npc[i];
|
||||
if (npc == target)
|
||||
{
|
||||
previousNPCs.Add(i);
|
||||
}
|
||||
if (!npc.friendly && !npc.townNPC && npc.active && !npc.dontTakeDamage && npc.chaseable && npc != target && !hasHitNPC && npc.type != NPCID.TargetDummy)
|
||||
{
|
||||
float dist = (projectile.Center - npc.Center).Length();
|
||||
if (dist < minDist)
|
||||
{
|
||||
minDist = dist;
|
||||
index = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Vector2 velocityNew;
|
||||
if (minDist < 999f)
|
||||
{
|
||||
hasHitEnemy = true;
|
||||
targetNPC = index;
|
||||
velocityNew = Main.npc[index].Center - projectile.Center;
|
||||
velocityNew.Normalize();
|
||||
velocityNew *= 15f;
|
||||
projectile.velocity = velocityNew;
|
||||
}
|
||||
else
|
||||
{
|
||||
projectile.penetrate = -1;
|
||||
projectile.ai[0] = 1f;
|
||||
targetNPC = -1;
|
||||
}
|
||||
}
|
||||
|
||||
// After its last hit, starts returning instead of vanishing. Can pierce infinitely on the way back.
|
||||
if (projectile.penetrate == 1)
|
||||
{
|
||||
projectile.penetrate = -1;
|
||||
projectile.ai[0] = 1f;
|
||||
targetNPC = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 1.5 KiB |
@@ -122,7 +122,7 @@ namespace CalamityMod.Projectiles.Summon
|
||||
}
|
||||
if (!flag)
|
||||
{
|
||||
for (int index2 = 0; index2 < 200; ++index2)
|
||||
for (int index2 = 0; index2 < Main.npc.Length; ++index2)
|
||||
{
|
||||
NPC npc = Main.npc[index2];
|
||||
if (npc.CanBeChasedBy((object) this, false))
|
||||
|
||||
@@ -43,16 +43,18 @@ namespace CalamityMod.Projectiles.Typeless
|
||||
|
||||
public override bool PreAI()
|
||||
{
|
||||
for (int num136 = 0; num136 < 3; num136++)
|
||||
for (int num136 = 0; num136 < 2; num136++)
|
||||
{
|
||||
float x2 = projectile.position.X - projectile.velocity.X / 10f * (float)num136;
|
||||
float y2 = projectile.position.Y - projectile.velocity.Y / 10f * (float)num136;
|
||||
Vector2 dspeed = projectile.velocity * Main.rand.NextFloat(0.7f, 0.4f);
|
||||
int num137 = Dust.NewDust(new Vector2(x2, y2), 1, 1, 107, 0f, 0f, 0, default, 1f);
|
||||
Main.dust[num137].alpha = projectile.alpha;
|
||||
Main.dust[num137].position.X = x2;
|
||||
Main.dust[num137].position.Y = y2;
|
||||
Main.dust[num137].velocity *= 0f;
|
||||
Main.dust[num137].velocity = dspeed;
|
||||
Main.dust[num137].noGravity = true;
|
||||
Main.dust[num137].noLight = true;
|
||||
}
|
||||
float num138 = (float)Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y));
|
||||
float num139 = projectile.localAI[0];
|
||||
|
||||