This commit is contained in:
Andrew Marheine committed 2020-06-04 17:18:34 -05:00
commit e1522a4e6d
153 files changed
+1804 -2528

No files matched your search

+17
View File
@@ -66,6 +66,7 @@ using CalamityMod.Projectiles.Melee;
using CalamityMod.Projectiles.Ranged;
using CalamityMod.Projectiles.Rogue;
using CalamityMod.Projectiles.Summon;
using CalamityMod.Tiles.LivingFire;
using CalamityMod.Skies;
using CalamityMod.UI;
using CalamityMod.World;
@@ -194,6 +195,7 @@ namespace CalamityMod
public static List<int> highTestFishList;
public static List<int> flamethrowerList;
public static List<int> forceItemList;
public static List<int> livingFireBlockList;
public static List<int> zombieList;
public static List<int> demonEyeList;
@@ -417,6 +419,7 @@ namespace CalamityMod
highTestFishList = null;
flamethrowerList = null;
forceItemList = null;
livingFireBlockList = null;
zombieList = null;
demonEyeList = null;
@@ -2346,6 +2349,19 @@ namespace CalamityMod
ItemID.SuperHealingPotion
};
livingFireBlockList = new List<int>()
{
ModContent.TileType<LivingGodSlayerFireBlockTile>(),
ModContent.TileType<LivingHolyFireBlockTile>(),
ModContent.TileType<LivingBrimstoneFireBlockTile>(),
TileID.LivingFire,
TileID.LivingCursedFire,
TileID.LivingDemonFire,
TileID.LivingFrostFire,
TileID.LivingIchor,
TileID.LivingUltrabrightFire
};
zombieList = new List<int>()
{
NPCID.Zombie,
@@ -3732,6 +3748,7 @@ namespace CalamityMod
case CalamityModMessageType.AcidRainSync:
CalamityWorld.rainingAcid = reader.ReadBoolean();
CalamityWorld.acidRainPoints = reader.ReadInt32();
CalamityWorld.timeSinceAcidRainKill = reader.ReadInt32();
break;
case CalamityModMessageType.AcidRainUIDrawFadeSync:
CalamityWorld.acidRainExtraDrawTime = reader.ReadInt32();
+7 -5
View File
@@ -34,6 +34,8 @@ namespace CalamityMod.Events
// A partially bright pale-ish cyan with a hint of yellow.
public static readonly Color TextColor = new Color(115, 194, 147);
public const int InvasionNoKillPersistTime = 14400; // How long the invasion persists, in frames, if nothing is killed.
public const float BloodwormSpawnRate = 0.1f;
// Not a readonly collection so that if anyone else wants to add stuff in here with their own mod, they can.
@@ -167,17 +169,16 @@ namespace CalamityMod.Events
Main.numClouds = Main.numCloudsTemp;
Main.windSpeedTemp = 0.72f;
Main.windSpeedSet = Main.windSpeedTemp;
Main.weatherCounter = 600;
Main.weatherCounter = 60 * 60 * 10; // 10 minutes of rain. Remember, once the rain goes away, so does the invasion.
Main.rainTime = Main.weatherCounter;
Main.maxRaining = 0.89f;
CalamityWorld.forcedDownpourWithTear = true;
CalamityMod.UpdateServerBoolean();
}
if (CalamityWorld.startAcidicDownpour)
{
Main.raining = true;
}
CalamityWorld.triedToSummonOldDuke = false;
CalamityWorld.timeSinceAcidRainKill = 0; // Reset the kill cooldown, just in case.
}
UpdateInvasion();
BroadcastEventText("Mods.CalamityMod.AcidRainStart"); // A toxic downpour falls over the wasteland seas!
}
@@ -222,6 +223,7 @@ namespace CalamityMod.Events
netMessage.Write((byte)CalamityModMessageType.AcidRainSync);
netMessage.Write(CalamityWorld.rainingAcid);
netMessage.Write(CalamityWorld.acidRainPoints);
netMessage.Write(CalamityWorld.timeSinceAcidRainKill);
netMessage.Send();
}
if (Main.netMode == NetmodeID.Server)
-1
View File
@@ -27,7 +27,6 @@ namespace CalamityMod.Items.Accessories
public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ModContent.ItemType<RustyLockpick>(), 1);
recipe.AddIngredient(ModContent.ItemType<SulfuricScale>(), 20);
recipe.AddRecipeGroup("IronBar", 10);
recipe.AddTile(TileID.Anvils);
-1
View File
@@ -31,7 +31,6 @@ namespace CalamityMod.Items.Accessories
public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ModContent.ItemType<RustyLockpick>(), 1);
recipe.AddIngredient(ModContent.ItemType<SulfuricScale>(), 20);
recipe.AddRecipeGroup("IronBar", 10);
recipe.AddTile(TileID.Anvils);
+1 -1
View File
@@ -67,7 +67,7 @@ namespace CalamityMod.Items.Accessories.Wings
{
if (player.controlJump && !player.jumpAgainCloud && player.jump == 0 && player.velocity.Y != 0f && !player.mount.Active && !player.mount.Cart)
{
int p = Projectile.NewProjectile(player.Center.X, player.Center.Y, player.velocity.X * 0f, 2f, ModContent.ProjectileType<FrostShardFriendly>(), (int)(25 * player.AverageDamage()), 3f, player.whoAmI);
int p = Projectile.NewProjectile(player.Center.X, player.Center.Y, player.velocity.X * 0f, 2f, ModContent.ProjectileType<FrostShardFriendly>(), (int)(25 * player.AverageDamage()), 3f, player.whoAmI, 1f);
Main.projectile[p].Calamity().forceTypeless = true;
Main.projectile[p].frame = Main.rand.Next(5);
modPlayer.icicleCooldown = 10;
+8 -2
View File
@@ -81,6 +81,12 @@ namespace CalamityMod.Items
myClone.StealthGenBonus = StealthGenBonus;
return myClone;
}
public override bool NewPreReforge(Item item)
{
StealthGenBonus = 1f;
return true;
}
#endregion
#region SetDefaults
@@ -129,7 +135,7 @@ namespace CalamityMod.Items
else if (item.type == ItemID.BlizzardStaff)
item.damage = (int)(item.damage * 0.7);
else if (item.type == ItemID.LaserMachinegun)
item.damage = (int)(item.damage * 0.6);
item.damage = (int)(item.damage * 0.65);
else if (item.type == ItemID.StardustDragonStaff)
item.damage = (int)(item.damage * 0.5);
@@ -2805,7 +2811,7 @@ Provides heat and cold protection in Death Mode";
DropHelper.DropItemChance(player, ModContent.ItemType<BlackHawkRemote>(), 3);
DropHelper.DropItemChance(player, ModContent.ItemType<BlastBarrel>(), 3);
DropHelper.DropItemChance(player, ModContent.ItemType<RogueEmblem>(), 4);
DropHelper.DropItemFromSetChance(player, 5, ItemID.CorruptionKey, ItemID.CrimsonKey);
DropHelper.DropItemFromSetChance(player, 0.2f, ItemID.CorruptionKey, ItemID.CrimsonKey);
DropHelper.DropItemCondition(player, ModContent.ItemType<MLGRune>(), !CalamityWorld.demonMode); // Demon Trophy
break;
+1 -1
View File
@@ -62,7 +62,7 @@ namespace CalamityMod.Items.Fishing.AstralCatches
}
// Weapons
DropHelper.DropItemFromSetCondition(player, CalamityWorld.downedAstrageldon,
DropHelper.DropItemFromSetCondition(player, CalamityWorld.downedAstrageldon, 0.2f,
ModContent.ItemType<StellarKnife>(),
ModContent.ItemType<AstralachneaStaff>(),
ModContent.ItemType<TitanArm>(),
@@ -20,12 +20,12 @@ namespace CalamityMod.Items.Fishing.AstralCatches
public override void SetDefaults()
{
item.damage = 55;
item.damage = 50;
item.ranged = true;
item.width = 38;
item.height = 34;
item.useTime = 20;
item.useAnimation = 20;
item.useTime = 21;
item.useAnimation = 21;
item.useStyle = ItemUseStyleID.HoldingOut;
item.noMelee = true;
item.knockBack = 2.25f;
@@ -47,7 +47,7 @@ namespace CalamityMod.Items.Fishing.AstralCatches
}
else if (modPlayer.polarisBoostTwo) //Splits on enemy or tile hits
{
Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType<PolarStar>(), (int)((double)damage * 1.25), knockBack, player.whoAmI, 0f, 1f);
Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType<PolarStar>(), (int)(damage * 1.25), knockBack, player.whoAmI, 0f, 1f);
return false;
}
return true;
+3 -3
View File
@@ -77,14 +77,14 @@ namespace CalamityMod.Items.Fishing.SulphurCatches
}
// Weapons
DropHelper.DropItemFromSetCondition(player, NPC.downedBoss3,
DropHelper.DropItemFromSetCondition(player, NPC.downedBoss3, 0.2f,
ModContent.ItemType<Archerfish>(),
ModContent.ItemType<BallOFugu>(),
ModContent.ItemType<HerringStaff>(),
ModContent.ItemType<Lionfish>(),
ModContent.ItemType<BlackAnurian>());
DropHelper.DropItemFromSetCondition(player, CalamityWorld.downedAquaticScourgeAcidRain,
DropHelper.DropItemFromSetCondition(player, CalamityWorld.downedAquaticScourgeAcidRain, 0.2f,
ModContent.ItemType<SkyfinBombers>(),
ModContent.ItemType<NuclearRod>(),
ModContent.ItemType<SulphurousGrabber>(),
@@ -94,7 +94,7 @@ namespace CalamityMod.Items.Fishing.SulphurCatches
ModContent.ItemType<BelchingSaxophone>());
// Equipment
DropHelper.DropItemFromSetCondition(player, NPC.downedBoss3,
DropHelper.DropItemFromSetCondition(player, NPC.downedBoss3, 0.4f,
ModContent.ItemType<StrangeOrb>(),
ModContent.ItemType<DepthCharm>(),
ModContent.ItemType<IronBoots>(),
@@ -55,7 +55,7 @@ namespace CalamityMod.Items.Fishing.SunkenSeaCatches
}
// Weapons
DropHelper.DropItemFromSetCondition(player, CalamityWorld.downedCLAM && Main.hardMode,
DropHelper.DropItemFromSetCondition(player, CalamityWorld.downedCLAM && Main.hardMode, 0.2f,
ModContent.ItemType<ShellfishStaff>(),
ModContent.ItemType<ClamCrusher>(),
ModContent.ItemType<Poseidon>(),
@@ -34,7 +34,6 @@ namespace CalamityMod.Items.Placeables.Furniture
public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ModContent.ItemType<RustyLockpick>(), 1);
recipe.AddIngredient(ModContent.ItemType<SulfuricScale>(), 20);
recipe.AddRecipeGroup("IronBar", 10);
recipe.AddTile(TileID.Anvils);
+1 -1
View File
@@ -22,7 +22,7 @@ namespace CalamityMod.Items.Placeables.Furniture
item.useStyle = ItemUseStyleID.SwingThrow;
item.consumable = true;
item.value = 500;
item.createTile = ModContent.TileType<RustyChestLocked>();
item.createTile = ModContent.TileType<RustyChestTile>();
}
public override void AddRecipes()
{
-30
View File
@@ -1,30 +0,0 @@
using CalamityMod.Items.Materials;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items
{
public class RustyLockpick : ModItem
{
public override void SetStaticDefaults()
{
Tooltip.SetDefault("Opens locked rusty chests");
}
public override void SetDefaults()
{
item.width = 14;
item.height = 28;
item.maxStack = 99;
item.rare = 1;
item.value = CalamityGlobalItem.Rarity1BuyPrice;
}
public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ModContent.ItemType<SulfuricScale>(), 15);
recipe.AddTile(TileID.Anvils);
recipe.SetResult(this);
recipe.AddRecipe();
}
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 383 B

+1 -13
View File
@@ -32,7 +32,7 @@ namespace CalamityMod.Items.Tools.ClimateChange
public override bool CanUseItem(Player player)
{
return !Main.slimeRain && (Main.rainTime > 3600 || !CalamityWorld.death || !Main.raining);
return !Main.slimeRain && (Main.rainTime > 3600 || !CalamityWorld.death || !Main.raining || CalamityWorld.rainingAcid);
}
public override bool UseItem(Player player)
@@ -48,22 +48,10 @@ namespace CalamityMod.Items.Tools.ClimateChange
Main.rainTime = 3600;
AdjustRainSeverity(true);
}
if (CalamityWorld.rainingAcid)
{
CalamityWorld.acidRainPoints = 0;
CalamityWorld.triedToSummonOldDuke = false;
AcidRainEvent.UpdateInvasion(false);
}
}
else
{
Main.raining = false;
if (CalamityWorld.rainingAcid)
{
CalamityWorld.acidRainPoints = 0;
CalamityWorld.triedToSummonOldDuke = false;
AcidRainEvent.UpdateInvasion(false);
}
}
CalamityMod.UpdateServerBoolean();
+5 -8
View File
@@ -17,14 +17,14 @@ namespace CalamityMod.Items.Weapons.Magic
public override void SetDefaults()
{
item.damage = 90;
item.damage = 75;
item.magic = true;
item.mana = 14;
item.rare = 8;
item.width = 48;
item.height = 54;
item.useTime = 20;
item.useAnimation = 20;
item.useTime = 22;
item.useAnimation = 22;
item.useStyle = ItemUseStyleID.HoldingOut;
item.noMelee = true;
item.knockBack = 3.75f;
@@ -35,17 +35,14 @@ namespace CalamityMod.Items.Weapons.Magic
item.shootSpeed = 10f;
}
public override Vector2? HoldoutOrigin()
{
return new Vector2(15, 15);
}
public override Vector2? HoldoutOrigin() => new Vector2(15, 15);
public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
{
position = Main.MouseWorld;
for (int x = 0; x < 10; x++)
{
Projectile.NewProjectile(position.X + (float)Main.rand.Next(-150, 150), position.Y + 600f, 0f, -10f, type, damage, knockBack, Main.myPlayer, 0f, 0f);
Projectile.NewProjectile(position.X + (float)Main.rand.Next(-150, 150), position.Y + 600f, 0f, -10f, type, damage, knockBack, player.whoAmI, 0f, 0f);
}
return false;
}
+35 -35
View File
@@ -10,7 +10,7 @@ namespace CalamityMod.Items.Weapons.Magic
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Parasitic Sceptor");
DisplayName.SetDefault("Parasitic Scepter");
Tooltip.SetDefault("Fires a spread of water leeches that latch onto enemies, dealing a stacking damage over time");
Item.staff[item.type] = true;
}
@@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Magic
item.width = item.height = 52;
item.UseSound = SoundID.Item46;
item.noMelee = true;
item.useStyle = 5;
item.useStyle = ItemUseStyleID.HoldingOut;
item.rare = 2;
item.value = CalamityGlobalItem.Rarity2BuyPrice;
}
@@ -38,28 +38,28 @@ namespace CalamityMod.Items.Weapons.Magic
public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
{
float speed = item.shootSpeed;
Vector2 playerPos = player.RotatedRelativePoint(player.MountedCenter, true);
float xDist = Main.mouseX + Main.screenPosition.X - playerPos.X;
float yDist = Main.mouseY + Main.screenPosition.Y - playerPos.Y;
if (player.gravDir == -1f)
{
yDist = Main.screenPosition.Y + Main.screenHeight - Main.mouseY - playerPos.Y;
}
float speed = item.shootSpeed;
Vector2 playerPos = player.RotatedRelativePoint(player.MountedCenter, true);
float xDist = Main.mouseX + Main.screenPosition.X - playerPos.X;
float yDist = Main.mouseY + Main.screenPosition.Y - playerPos.Y;
if (player.gravDir == -1f)
{
yDist = Main.screenPosition.Y + Main.screenHeight - Main.mouseY - playerPos.Y;
}
Vector2 vector = new Vector2(xDist, yDist);
float speedMult = vector.Length();
if ((float.IsNaN(xDist) && float.IsNaN(yDist)) || (xDist == 0f && yDist == 0f))
{
xDist = player.direction;
yDist = 0f;
speedMult = speed;
}
else
{
speedMult = speed / speedMult;
}
xDist *= speedMult;
yDist *= speedMult;
if ((float.IsNaN(xDist) && float.IsNaN(yDist)) || (xDist == 0f && yDist == 0f))
{
xDist = player.direction;
yDist = 0f;
speedMult = speed;
}
else
{
speedMult = speed / speedMult;
}
xDist *= speedMult;
yDist *= speedMult;
int leechAmt = 2;
if (Main.rand.NextBool(3))
{
@@ -73,21 +73,21 @@ namespace CalamityMod.Items.Weapons.Magic
{
leechAmt ++;
}
for (int i = 0; i < leechAmt; i++)
{
float xVec = xDist;
float yVec = yDist;
float spreadMult = 0.05f * i;
xVec += Main.rand.NextFloat(-25f, 25f) * spreadMult;
yVec += Main.rand.NextFloat(-25f, 25f) * spreadMult;
for (int i = 0; i < leechAmt; i++)
{
float xVec = xDist;
float yVec = yDist;
float spreadMult = 0.05f * i;
xVec += Main.rand.NextFloat(-25f, 25f) * spreadMult;
yVec += Main.rand.NextFloat(-25f, 25f) * spreadMult;
Vector2 directionToShoot = new Vector2(xVec, yVec);
speedMult = directionToShoot.Length();
speedMult = speed / speedMult;
xVec *= speedMult;
yVec *= speedMult;
directionToShoot = new Vector2(xVec, yVec);
Projectile.NewProjectile(playerPos, directionToShoot, type, damage, knockBack, player.whoAmI, 0f, 0f);
}
speedMult = speed / speedMult;
xVec *= speedMult;
yVec *= speedMult;
directionToShoot = new Vector2(xVec, yVec);
Projectile.NewProjectile(playerPos, directionToShoot, type, damage, knockBack, player.whoAmI, 0f, 0f);
}
return false;
}
}
+3 -4
View File
@@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Magic
public override void SetDefaults()
{
item.damage = 26;
item.damage = 20;
item.magic = true;
item.mana = 16;
item.width = 28;
@@ -37,12 +37,11 @@ namespace CalamityMod.Items.Weapons.Magic
public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
{
float spread = 22.5f * 0.0174f;
float spread = 22.5f * 0.01f * MathHelper.PiOver2;
double startAngle = Math.Atan2(speedX, speedY) - spread / 2;
double deltaAngle = spread / 8f;
double offsetAngle;
int i;
for (i = 0; i < 8; i++)
for (int i = 0; i < 8; i++)
{
offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i;
Projectile.NewProjectile(position.X, position.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), type, damage, knockBack, Main.myPlayer);
+1 -1
View File
@@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Magic
public override void SetDefaults()
{
item.damage = 18;
item.damage = 14;
item.magic = true;
item.mana = 8;
item.width = 42;
+16 -17
View File
@@ -50,29 +50,28 @@ namespace CalamityMod.Items.Weapons.Magic
public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
{
Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true);
float num72 = item.shootSpeed;
float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X;
float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y;
float f = Main.rand.NextFloat() * 6.28318548f;
float value12 = 20f;
float value13 = 60f;
Vector2 vector13 = vector2 + f.ToRotationVector2() * MathHelper.Lerp(value12, value13, Main.rand.NextFloat());
Vector2 playerPos = player.RotatedRelativePoint(player.MountedCenter, true);
float speed = item.shootSpeed;
float xPos = (float)Main.mouseX + Main.screenPosition.X - playerPos.X;
float yPos = (float)Main.mouseY + Main.screenPosition.Y - playerPos.Y;
float f = Main.rand.NextFloat() * MathHelper.TwoPi;
float sourceVariationLow = 20f;
float sourceVariationHigh = 60f;
Vector2 source = playerPos + f.ToRotationVector2() * MathHelper.Lerp(sourceVariationLow, sourceVariationHigh, Main.rand.NextFloat());
for (int num202 = 0; num202 < 50; num202++)
{
vector13 = vector2 + f.ToRotationVector2() * MathHelper.Lerp(value12, value13, Main.rand.NextFloat());
if (Collision.CanHit(vector2, 0, 0, vector13 + (vector13 - vector2).SafeNormalize(Vector2.UnitX) * 8f, 0, 0))
source = playerPos + f.ToRotationVector2() * MathHelper.Lerp(sourceVariationLow, sourceVariationHigh, Main.rand.NextFloat());
if (Collision.CanHit(playerPos, 0, 0, source + (source - playerPos).SafeNormalize(Vector2.UnitX) * 8f, 0, 0))
{
break;
}
f = Main.rand.NextFloat() * 6.28318548f;
f = Main.rand.NextFloat() * MathHelper.TwoPi;
}
Vector2 mouseWorld = Main.MouseWorld;
Vector2 vector14 = mouseWorld - vector13;
Vector2 vector15 = new Vector2(num78, num79).SafeNormalize(Vector2.UnitY) * num72;
vector14 = vector14.SafeNormalize(vector15) * num72;
vector14 = Vector2.Lerp(vector14, vector15, 0.25f);
Projectile.NewProjectile(vector13, vector14, type, damage, knockBack, player.whoAmI, 0f, Main.rand.Next(3));
Vector2 velocity = Main.MouseWorld - source;
Vector2 velocityVariation = new Vector2(xPos, yPos).SafeNormalize(Vector2.UnitY) * speed;
velocity = velocity.SafeNormalize(velocityVariation) * speed;
velocity = Vector2.Lerp(velocity, velocityVariation, 0.25f);
Projectile.NewProjectile(source, velocity, type, damage, knockBack, player.whoAmI, 0f, Main.rand.Next(3));
return false;
}
+1 -1
View File
@@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Magic
public override void SetDefaults()
{
item.damage = 20;
item.damage = 15;
item.magic = true;
item.mana = 4;
item.width = 30;
+2 -2
View File
@@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Melee
{
item.width = 56;
item.height = 60;
item.damage = 95;
item.damage = 120;
item.melee = true;
item.useTurn = true;
item.useAnimation = 20;
@@ -36,7 +36,7 @@ namespace CalamityMod.Items.Weapons.Melee
public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
{
Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, (int)(damage * 0.6), knockBack, player.whoAmI, 0f, 0f);
Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, (int)(damage * 0.6), knockBack, player.whoAmI, 0f, 0f);
return false;
}
-1
View File
@@ -6,7 +6,6 @@ using Terraria;
using Terraria.DataStructures;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.ID;
namespace CalamityMod.Items.Weapons.Melee
{
+46 -57
View File
@@ -7,65 +7,54 @@ using Terraria.ModLoader;
namespace CalamityMod.Items.Weapons.Ranged
{
public class Butcher : ModItem
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Butcher");
Tooltip.SetDefault("Fires faster and more accurately the longer you hold the trigger");
}
public class Butcher : ModItem
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Butcher");
Tooltip.SetDefault("Fires faster and more accurately the longer you hold the trigger");
}
public override void SetDefaults()
{
item.damage = 17;
item.width = 20;
item.height = 12;
item.useTime = 40;
item.useAnimation = 40;
item.useStyle = ItemUseStyleID.HoldingOut;
item.rare = 5;
item.knockBack = 1f;
item.value = Item.buyPrice(0, 36, 0, 0);
item.UseSound = SoundID.Item38;
item.noMelee = true;
item.noUseGraphic = true;
item.ranged = true;
item.channel = true;
item.autoReuse = true;
item.shoot = ModContent.ProjectileType<ButcherGun>();
item.shootSpeed = 12f;
item.useAmmo = 97;
}
public override void SetDefaults()
{
item.damage = 18;
item.width = 20;
item.height = 12;
item.useTime = 40;
item.useAnimation = 40;
item.useStyle = ItemUseStyleID.HoldingOut;
item.rare = 5;
item.knockBack = 1f;
item.value = Item.buyPrice(0, 36, 0, 0);
item.UseSound = SoundID.Item38;
item.noMelee = true;
item.noUseGraphic = true;
item.ranged = true;
item.channel = true;
item.autoReuse = true;
item.shoot = ModContent.ProjectileType<ButcherGun>();
item.shootSpeed = 12f;
item.useAmmo = AmmoID.Bullet;
}
public override bool CanUseItem(Player player)
{
for (int i = 0; i < Main.projectile.Length; i++)
{
Projectile p = Main.projectile[i];
if (p.active && p.type == ModContent.ProjectileType<ButcherGun>() && p.owner == player.whoAmI)
{
return false;
}
}
return true;
}
public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0;
public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
{
Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType<ButcherGun>(), damage, knockBack, player.whoAmI, 0.0f, 0.0f);
return false;
}
public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
{
Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType<ButcherGun>(), damage, knockBack, player.whoAmI, 0f, 0f);
return false;
}
public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ItemID.Shotgun);
recipe.AddIngredient(ModContent.ItemType<EssenceofChaos>(), 4);
recipe.AddIngredient(ModContent.ItemType<EssenceofEleum>(), 4);
recipe.AddIngredient(ItemID.IllegalGunParts);
recipe.AddTile(TileID.MythrilAnvil);
recipe.SetResult(this);
recipe.AddRecipe();
}
}
public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ItemID.Shotgun);
recipe.AddIngredient(ItemID.HallowedBar, 5);
recipe.AddIngredient(ModContent.ItemType<EssenceofChaos>(), 4);
recipe.AddIngredient(ItemID.IllegalGunParts);
recipe.AddTile(TileID.MythrilAnvil);
recipe.SetResult(this);
recipe.AddRecipe();
}
}
}
+34 -36
View File
@@ -1,48 +1,46 @@
using CalamityMod.Projectiles.Ranged;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.ID;
namespace CalamityMod.Items.Weapons.Ranged
{
public class ClamorRifle : ModItem
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Clamor Rifle");
Tooltip.SetDefault("Shoots homing energy bolts");
}
public class ClamorRifle : ModItem
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Clamor Rifle");
Tooltip.SetDefault("Shoots homing energy bolts");
}
public override void SetDefaults()
{
item.damage = 27;
item.ranged = true;
item.width = 64;
item.height = 30;
item.useTime = 13;
item.useAnimation = 13;
item.useStyle = ItemUseStyleID.HoldingOut;
item.noMelee = true;
item.knockBack = 2.5f;
item.value = Item.buyPrice(0, 36, 0, 0);
item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PlasmaBolt");
item.autoReuse = true;
item.rare = 5;
item.shoot = ModContent.ProjectileType<ClamorRifleProj>();
item.shootSpeed = 15f;
item.useAmmo = 97;
}
public override void SetDefaults()
{
item.damage = 23;
item.ranged = true;
item.width = 64;
item.height = 30;
item.useTime = 15;
item.useAnimation = 15;
item.useStyle = ItemUseStyleID.HoldingOut;
item.noMelee = true;
item.knockBack = 2.5f;
item.value = Item.buyPrice(0, 36, 0, 0);
item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PlasmaBolt");
item.autoReuse = true;
item.rare = 5;
item.shoot = ModContent.ProjectileType<ClamorRifleProj>();
item.shootSpeed = 15f;
item.useAmmo = AmmoID.Bullet;
}
public override Vector2? HoldoutOffset()
{
return new Vector2(-5, 0);
}
public override Vector2? HoldoutOffset() => new Vector2(-5, 0);
public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
{
Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType<ClamorRifleProj>(), damage, knockBack, player.whoAmI, 0.0f, 0.0f);
return false;
}
}
public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
{
Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType<ClamorRifleProj>(), damage, knockBack, player.whoAmI, 0f, 0f);
return false;
}
}
}
+1 -1
View File
@@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Ranged
{
item.width = 70;
item.height = 42;
item.damage = 450;
item.damage = 485;
item.crit += 16;
item.ranged = true;
item.useTime = 30;
+1 -1
View File
@@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Ranged
public override void SetDefaults()
{
item.damage = 77;
item.damage = 66;
item.ranged = true;
item.width = 104;
item.height = 42;
+1 -1
View File
@@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Ranged
public override void SetDefaults()
{
item.damage = 40;
item.damage = 56;
item.ranged = true;
item.width = 64;
item.height = 34;
+3 -11
View File
@@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Ranged
public override void SetDefaults()
{
item.damage = 1750;
item.damage = 1666;
item.crit += 20;
item.ranged = true;
item.width = 84;
@@ -41,17 +41,9 @@ namespace CalamityMod.Items.Weapons.Ranged
item.useAmmo = 23;
}
public override Vector2? HoldoutOffset()
{
return new Vector2(-15, 0);
}
public override Vector2? HoldoutOffset() => new Vector2(-15, 0);
public override bool ConsumeAmmo(Player player)
{
if (Main.rand.Next(0, 100) < 50)
return false;
return true;
}
public override bool ConsumeAmmo(Player player) => Main.rand.Next(100) >= 50;
public override void AddRecipes()
{
+46 -44
View File
@@ -6,51 +6,53 @@ using Terraria.ModLoader;
namespace CalamityMod.Items.Weapons.Ranged
{
public class OpalStriker : ModItem
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Opal Striker");
Tooltip.SetDefault("Fires a string of opal strikes");
}
public class OpalStriker : ModItem
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Opal Striker");
Tooltip.SetDefault("Fires a string of opal strikes");
}
public override void SetDefaults()
{
item.damage = 9;
item.ranged = true;
item.width = 64;
item.height = 16;
item.useTime = 5;
item.reuseDelay = 25;
item.useAnimation = 20;
item.useStyle = ItemUseStyleID.HoldingOut;
item.noMelee = true;
item.knockBack = 0f;
item.value = Item.buyPrice(0, 2, 0, 0);
item.rare = 2;
item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/OpalStrike");
item.autoReuse = true;
item.shoot = ModContent.ProjectileType<OpalStrike>();
item.shootSpeed = 6f;
item.useAmmo = 97;
}
public override void SetDefaults()
{
item.damage = 9;
item.ranged = true;
item.width = 64;
item.height = 16;
item.useTime = 5;
item.reuseDelay = 25;
item.useAnimation = 20;
item.useStyle = ItemUseStyleID.HoldingOut;
item.noMelee = true;
item.knockBack = 0f;
item.value = Item.buyPrice(0, 2, 0, 0);
item.rare = 2;
item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/OpalStrike");
item.autoReuse = true;
item.shoot = ModContent.ProjectileType<OpalStrike>();
item.shootSpeed = 6f;
item.useAmmo = 97;
}
public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
{
Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType<OpalStrike>(), damage, 0f, player.whoAmI, 0f, 0f);
return false;
}
public override Vector2? HoldoutOffset() => new Vector2(-10, 0);
public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ItemID.Marble, 20);
recipe.AddIngredient(ItemID.Amber, 5);
recipe.AddIngredient(ItemID.Diamond, 3);
recipe.AddIngredient(ItemID.FlintlockPistol);
recipe.AddTile(TileID.Anvils);
recipe.SetResult(this);
recipe.AddRecipe();
}
}
public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
{
Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType<OpalStrike>(), damage, knockBack, player.whoAmI);
return false;
}
public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ItemID.Marble, 20);
recipe.AddIngredient(ItemID.Amber, 5);
recipe.AddIngredient(ItemID.Diamond, 3);
recipe.AddIngredient(ItemID.FlintlockPistol);
recipe.AddTile(TileID.Anvils);
recipe.SetResult(this);
recipe.AddRecipe();
}
}
}
+5 -3
View File
@@ -11,6 +11,8 @@ namespace CalamityMod.Items.Weapons.Ranged
public class Photoviscerator : ModItem
{
public const int CooldownTime = 60 * 7; // 7 second cooldown.
public const double AltFireDamageMult = 3.0;
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Photoviscerator");
@@ -21,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Ranged
public override void SetDefaults()
{
item.damage = 230;
item.damage = 370;
item.ranged = true;
item.width = 84;
item.height = 30;
@@ -68,14 +70,14 @@ namespace CalamityMod.Items.Weapons.Ranged
{
Vector2 velocity = new Vector2(speedX, speedY);
position += velocity.ToRotation().ToRotationVector2() * 80f;
Projectile.NewProjectile(position, velocity.SafeNormalize(Vector2.Zero) * 17f, ModContent.ProjectileType<ExoLightBurst>(), damage * 3, knockBack, player.whoAmI);
Projectile.NewProjectile(position, velocity.SafeNormalize(Vector2.Zero) * 17f, ModContent.ProjectileType<ExoLightBurst>(), (int)(damage * AltFireDamageMult), knockBack, player.whoAmI);
}
else
{
for (int i = 0; i < 2; i++)
{
Vector2 velocity = new Vector2(speedX, speedY).RotatedByRandom(0.05f);
Projectile.NewProjectile(position, velocity, type, damage / 2, knockBack, player.whoAmI, 0f, 0f);
Projectile.NewProjectile(position, velocity, type, damage, knockBack, player.whoAmI, 0f, 0f);
}
if (Main.rand.NextBool(8))
{
+3 -3
View File
@@ -21,13 +21,13 @@ namespace CalamityMod.Items.Weapons.Rogue
public override void SafeSetDefaults()
{
item.damage = 108;
item.damage = 120;
item.shootSpeed = 15f;
item.shoot = ModContent.ProjectileType<ApoctolithProj>();
item.width = 66;
item.height = 64;
item.useTime = 25;
item.useAnimation = 25;
item.useTime = 24;
item.useAnimation = 24;
item.useStyle = 1;
item.knockBack = 10f;
item.crit = 20;
+1 -1
View File
@@ -47,7 +47,7 @@ namespace CalamityMod.Items.Weapons.Rogue
for (int i = -6; i <= 6; i += 4)
{
Vector2 perturbedSpeed = new Vector2(speedX, speedY).RotatedBy(MathHelper.ToRadians(i));
int dart = Projectile.NewProjectile(position, perturbedSpeed, ModContent.ProjectileType<SeethingDischargeBrimstoneBarrage>(), damage / 2, knockBack * 0.5f, player.whoAmI, 0f, 0f);
int dart = Projectile.NewProjectile(position, perturbedSpeed, ModContent.ProjectileType<SeethingDischargeBrimstoneBarrage>(), damage, knockBack * 0.5f, player.whoAmI, 0f, 0f);
Main.projectile[dart].Calamity().forceRogue = true;
}
return false;
+6
View File
@@ -52,6 +52,12 @@ namespace CalamityMod.Items.Weapons.Rogue
return mod.GetPrefix(newPrefix).Type;
}
public override bool NewPreReforge()
{
StealthStrikeDamage = 1f;
return true;
}
public sealed override void SetDefaults()
{
SafeSetDefaults();
+1 -1
View File
@@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Summon
public override void SetDefaults()
{
item.damage = 36;
item.damage = 32;
item.mana = 10;
item.width = 46;
item.height = 28;
+2 -2
View File
@@ -19,12 +19,12 @@ namespace CalamityMod.Items.Weapons.Summon
public override void SetDefaults()
{
item.damage = 70;
item.damage = 60;
item.mana = 10;
item.width = 66;
item.height = 70;
item.useTime = item.useAnimation = 20;
item.useStyle = 1;
item.useStyle = ItemUseStyleID.SwingThrow;
item.noMelee = true;
item.knockBack = 1f;
item.value = CalamityGlobalItem.Rarity7BuyPrice;
+1 -2
View File
@@ -44,8 +44,7 @@ namespace CalamityMod.Items.Weapons.Summon
}
public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ModContent.ItemType<RustyLockpick>(), 1);
ModRecipe recipe = new ModRecipe(mod);;
recipe.AddIngredient(ModContent.ItemType<SulfuricScale>(), 20);
recipe.AddRecipeGroup("IronBar", 10);
recipe.AddTile(TileID.Anvils);
+3 -3
View File
@@ -545,11 +545,11 @@ namespace CalamityMod.NPCs
}
}
npc.lifeRegen -= projectileCount * 350;
npc.lifeRegen -= projectileCount * 250;
if (damage < projectileCount * 70)
if (damage < projectileCount * 50)
{
damage = projectileCount * 70;
damage = projectileCount * 50;
}
}
+6 -3
View File
@@ -164,7 +164,7 @@ namespace CalamityMod.NPCs
DropHelper.DropItemCondition(npc, ModContent.ItemType<BlastBarrel>(), !Main.expertMode, 5, 1, 1);
DropHelper.DropItemCondition(npc, ModContent.ItemType<RogueEmblem>(), !Main.expertMode, 8, 1, 1);
DropHelper.DropItemChance(npc, ModContent.ItemType<IbarakiBox>(), !Main.hardMode, Main.hardMode ? 0.1f : 1f); // 100% chance on first kill, 10% chance afterwards
DropHelper.DropItemFromSetCondition(npc, !Main.expertMode, 5, ItemID.CorruptionKey, ItemID.CrimsonKey);
DropHelper.DropItemFromSetCondition(npc, !Main.expertMode, 0.2f, ItemID.CorruptionKey, ItemID.CrimsonKey);
DropHelper.DropItemCondition(npc, ModContent.ItemType<KnowledgeUnderworld>(), true, !Main.hardMode);
DropHelper.DropItemCondition(npc, ModContent.ItemType<KnowledgeWallofFlesh>(), true, !Main.hardMode);
@@ -1614,16 +1614,18 @@ namespace CalamityMod.NPCs
private void AcidRainProgression(NPC npc)
{
Dictionary<int, AcidRainSpawnData> possibleEnemies = AcidRainEvent.PossibleEnemiesPreHM;
if (CalamityWorld.downedAquaticScourge)
possibleEnemies = AcidRainEvent.PossibleEnemiesAS;
if (CalamityWorld.downedPolterghast)
possibleEnemies = AcidRainEvent.PossibleEnemiesPolter;
if (possibleEnemies.Select(enemy => enemy.Key).Contains(npc.type) && CalamityWorld.rainingAcid)
{
CalamityWorld.acidRainPoints -= possibleEnemies[npc.type].InvasionContributionPoints;
if (CalamityWorld.downedPolterghast)
{
CalamityWorld.acidRainPoints = (int)MathHelper.Max(2, CalamityWorld.acidRainPoints); // Cap at 2. The last points are for Old Duke.
CalamityWorld.acidRainPoints = (int)MathHelper.Max(1, CalamityWorld.acidRainPoints); // Cap at 1. The last point is for Old Duke.
}
}
Dictionary<int, AcidRainSpawnData> possibleMinibosses = CalamityWorld.downedPolterghast ? AcidRainEvent.PossibleMinibossesPolter : AcidRainEvent.PossibleMinibossesAS;
@@ -1632,7 +1634,7 @@ namespace CalamityMod.NPCs
CalamityWorld.acidRainPoints -= possibleMinibosses[npc.type].InvasionContributionPoints;
if (CalamityWorld.downedPolterghast)
{
CalamityWorld.acidRainPoints = (int)MathHelper.Max(2, CalamityWorld.acidRainPoints); // Cap at 2. The last points are for Old Duke.
CalamityWorld.acidRainPoints = (int)MathHelper.Max(1, CalamityWorld.acidRainPoints); // Cap at 1. The last point is for Old Duke.
}
}
@@ -1645,6 +1647,7 @@ namespace CalamityMod.NPCs
CalamityWorld.triedToSummonOldDuke = false;
CalamityWorld.acidRainPoints = 0;
}
CalamityWorld.timeSinceAcidRainKill = 0;
AcidRainEvent.UpdateInvasion();
}
#endregion
-402
View File
@@ -2102,408 +2102,6 @@ namespace CalamityMod.Projectiles
}
}
public static void HealingProjectile(Projectile projectile, int healing, int playerToHeal, float homingVelocity, float N, bool autoHomes = true, int timeCheck = 120)
{
int target = playerToHeal;
Player player = Main.player[target];
float homingSpeed = homingVelocity;
if (player.lifeMagnet)
homingSpeed *= 1.5f;
Vector2 projPos = new Vector2(projectile.Center.X, projectile.Center.Y);
float xDist = player.Center.X - projPos.X;
float yDist = player.Center.Y - projPos.Y;
Vector2 playerVector = new Vector2(xDist, yDist);
float playerDist = playerVector.Length();
if (playerDist < 50f && projectile.position.X < player.position.X + player.width && projectile.position.X + projectile.width > player.position.X && projectile.position.Y < player.position.Y + player.height && projectile.position.Y + projectile.height > player.position.Y)
{
if (projectile.owner == Main.myPlayer && !Main.player[Main.myPlayer].moonLeech)
{
int healAmt = healing;
player.HealEffect(healAmt, false);
player.statLife += healAmt;
if (player.statLife > player.statLifeMax2)
{
player.statLife = player.statLifeMax2;
}
NetMessage.SendData(MessageID.SpiritHeal, -1, -1, null, target, healAmt, 0f, 0f, 0, 0, 0);
}
projectile.Kill();
}
if (autoHomes)
{
playerDist = homingSpeed / playerDist;
playerVector.X *= playerDist;
playerVector.Y *= playerDist;
projectile.velocity.X = (projectile.velocity.X * N + playerVector.X) / (N + 1f);
projectile.velocity.Y = (projectile.velocity.Y * N + playerVector.Y) / (N + 1f);
}
else if (player.lifeMagnet && projectile.timeLeft < timeCheck)
{
playerDist = homingVelocity / playerDist;
playerVector.X *= playerDist;
playerVector.Y *= playerDist;
projectile.velocity.X = (projectile.velocity.X * N + playerVector.X) / (N + 1f);
projectile.velocity.Y = (projectile.velocity.Y * N + playerVector.Y) / (N + 1f);
}
}
public static void ChargingMinionAI(Projectile projectile, float range, float maxPlayerDist, float extraMaxPlayerDist, float safeDist, int initialUpdates, float chargeDelayTime, float goToSpeed, float goBackSpeed, float chargeCounterMax, float chargeSpeed, bool tileVision, bool ignoreTilesWhenCharging)
{
Player player = Main.player[projectile.owner];
CalamityPlayer modPlayer = player.Calamity();
//Anti sticky movement to prevent stacking
float antiStickMvt = 0.05f;
for (int projIndex = 0; projIndex < Main.maxProjectiles; projIndex++)
{
Projectile proj = Main.projectile[projIndex];
bool typeCheck = proj.type == projectile.type;
if (projIndex != projectile.whoAmI && proj.active && proj.owner == projectile.owner && typeCheck && Math.Abs(projectile.position.X - proj.position.X) + Math.Abs(projectile.position.Y - proj.position.Y) < projectile.width)
{
if (projectile.position.X < proj.position.X)
{
projectile.velocity.X -= antiStickMvt;
}
else
{
projectile.velocity.X += antiStickMvt;
}
if (projectile.position.Y < proj.position.Y)
{
projectile.velocity.Y -= antiStickMvt;
}
else
{
projectile.velocity.Y += antiStickMvt;
}
}
}
//Breather time between charges as like a reset
bool chargeDelay = false;
if (projectile.ai[0] == 2f)
{
projectile.ai[1] += 1f;
projectile.extraUpdates = initialUpdates + (projectile.type == ModContent.ProjectileType<CloudElementalMinion>() ? 2 : 1);
if (projectile.ai[1] > chargeDelayTime)
{
projectile.ai[1] = 1f;
projectile.ai[0] = 0f;
projectile.extraUpdates = initialUpdates;
projectile.numUpdates = 0;
projectile.netUpdate = true;
}
else
{
chargeDelay = true;
}
}
if (chargeDelay)
{
return;
}
//Find a target
float maxDist = range;
Vector2 targetVec = projectile.position;
bool foundTarget = false;
Vector2 half = new Vector2(0.5f);
//Prioritize the targeted enemy if possible
if (player.HasMinionAttackTargetNPC)
{
NPC npc = Main.npc[player.MinionAttackTargetNPC];
if (npc.CanBeChasedBy(projectile, false))
{
//Check the size of the target to make it easier to hit fat targets like Levi
Vector2 sizeCheck = npc.position + npc.Size * half;
float targetDist = Vector2.Distance(npc.Center, projectile.Center);
//Some minions will ignore tiles when choosing a target like Ice Claspers, others will not
bool canHit = true;
if (!tileVision)
canHit = Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height);
if (!foundTarget && targetDist < maxDist && canHit)
{
maxDist = targetDist;
targetVec = sizeCheck;
foundTarget = true;
}
}
}
//If no npc is specifically targetted, check through the entire array
else
{
for (int npcIndex = 0; npcIndex < Main.maxNPCs; npcIndex++)
{
NPC npc = Main.npc[npcIndex];
if (npc.CanBeChasedBy(projectile, false))
{
Vector2 sizeCheck = npc.position + npc.Size * half;
float targetDist = Vector2.Distance(npc.Center, projectile.Center);
bool canHit = true;
if (!tileVision)
canHit = Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height);
if (!foundTarget && targetDist < maxDist && canHit)
{
maxDist = targetDist;
targetVec = sizeCheck;
foundTarget = true;
}
}
}
}
//If the player is too far, return to the player. Range is increased while attacking something.
float distBeforeForcedReturn = maxPlayerDist;
if (foundTarget)
{
distBeforeForcedReturn = extraMaxPlayerDist;
}
if (Vector2.Distance(player.Center, projectile.Center) > distBeforeForcedReturn)
{
projectile.ai[0] = 1f;
projectile.netUpdate = true;
}
//Go to the target if you found one
if (foundTarget && projectile.ai[0] == 0f)
{
//Some minions don't ignore tiles while charging like brittle stars
projectile.tileCollide = !ignoreTilesWhenCharging;
Vector2 targetSpot = targetVec - projectile.Center;
float targetDist = targetSpot.Length();
targetSpot.Normalize();
//Tries to get the minion in the sweet spot of 200 pixels away but the minion also charges so idk what good it does
if (targetDist > 200f)
{
float speed = goToSpeed; //8
targetSpot *= speed;
projectile.velocity = (projectile.velocity * 40f + targetSpot) / 41f;
}
else
{
float speed = -goBackSpeed; //-4
targetSpot *= speed;
projectile.velocity = (projectile.velocity * 40f + targetSpot) / 41f; //41
}
}
//Movement for idle or returning to the player
else
{
//Ignore tiles so they don't get stuck everywhere like Optic Staff
projectile.tileCollide = false;
bool returningToPlayer = false;
if (!returningToPlayer)
{
returningToPlayer = projectile.ai[0] == 1f;
}
//Player distance calculations
Vector2 playerVec = player.Center - projectile.Center + new Vector2(0f, -60f);
float playerDist = playerVec.Length();
//If the minion is actively returning, move faster
float playerHomeSpeed = 6f;
if (returningToPlayer)
{
playerHomeSpeed = 15f;
}
//Move somewhat faster if the player is kinda far~ish
if (playerDist > 200f && playerHomeSpeed < 8f)
{
playerHomeSpeed = 8f;
}
//Return to normal if close enough to the player
if (playerDist < safeDist && returningToPlayer && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height))
{
projectile.ai[0] = 0f;
projectile.netUpdate = true;
}
//Teleport to the player if abnormally far
if (playerDist > 2000f)
{
projectile.position.X = player.Center.X - (float)(projectile.width / 2);
projectile.position.Y = player.Center.Y - (float)(projectile.height / 2);
projectile.netUpdate = true;
}
//If more than 70 pixels away, move toward the player
if (playerDist > 70f)
{
playerVec.Normalize();
playerVec *= playerHomeSpeed;
projectile.velocity = (projectile.velocity * 40f + playerVec) / 41f;
}
//Minions never stay still
else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f)
{
projectile.velocity.X = -0.15f;
projectile.velocity.Y = -0.05f;
}
}
//Increment attack counter randomly
if (projectile.ai[1] > 0f)
{
projectile.ai[1] += (float)Main.rand.Next(1, 4);
}
//If high enough, prepare to attack
if (projectile.ai[1] > chargeCounterMax)
{
projectile.ai[1] = 0f;
projectile.netUpdate = true;
}
//Charge at an enemy if not on cooldown
if (projectile.ai[0] == 0f)
{
if (projectile.ai[1] == 0f && foundTarget && maxDist < 500f)
{
projectile.ai[1] += 1f;
if (Main.myPlayer == projectile.owner)
{
projectile.ai[0] = 2f;
Vector2 targetPos = targetVec - projectile.Center;
targetPos.Normalize();
projectile.velocity = targetPos * chargeSpeed; //8
projectile.netUpdate = true;
}
}
}
}
public static void FloatingPetAI(Projectile projectile, bool faceRight, float tiltFloat, bool lightPet = false)
{
Player player = Main.player[projectile.owner];
//anti sticking movement as a failsafe
float SAImovement = 0.05f;
for (int index = 0; index < Main.projectile.Length; index++)
{
Projectile proj = Main.projectile[index];
bool flag23 = Main.projPet[proj.type];
if (index != projectile.whoAmI && proj.active && proj.owner == projectile.owner && flag23 && Math.Abs(projectile.position.X - proj.position.X) + Math.Abs(projectile.position.Y - proj.position.Y) < projectile.width)
{
if (projectile.position.X < proj.position.X)
{
projectile.velocity.X -= SAImovement;
}
else
{
projectile.velocity.X += SAImovement;
}
if (projectile.position.Y < proj.position.Y)
{
projectile.velocity.Y -= SAImovement;
}
else
{
projectile.velocity.Y += SAImovement;
}
}
}
float passiveMvtFloat = 0.5f;
projectile.tileCollide = false;
float range = 100f;
Vector2 projPos = new Vector2(projectile.Center.X, projectile.Center.Y);
float xDist = player.Center.X - projPos.X;
float yDist = player.Center.Y - projPos.Y;
yDist += Main.rand.NextFloat(-10, 20);
xDist += Main.rand.NextFloat(-10, 20);
//Light pets lead the player, normal pets trail the player
xDist += 60f * (lightPet ? (float)player.direction : -(float)player.direction);
yDist -= 60f;
Vector2 playerVector = new Vector2(xDist, yDist);
float playerDist = playerVector.Length();
float returnSpeed = 18f;
//If player is close enough, resume normal
if (playerDist < range && player.velocity.Y == 0f &&
projectile.position.Y + projectile.height <= player.position.Y + player.height &&
!Collision.SolidCollision(projectile.position, projectile.width, projectile.height))
{
if (projectile.velocity.Y < -6f)
{
projectile.velocity.Y = -6f;
}
}
//Teleport to player if too far
if (playerDist > 2000f)
{
projectile.position.X = player.Center.X - projectile.width / 2;
projectile.position.Y = player.Center.Y - projectile.height / 2;
projectile.netUpdate = true;
}
if (playerDist < 50f)
{
if (Math.Abs(projectile.velocity.X) > 2f || Math.Abs(projectile.velocity.Y) > 2f)
{
projectile.velocity *= 0.99f;
}
passiveMvtFloat = 0.01f;
}
else
{
if (playerDist < 100f)
{
passiveMvtFloat = 0.1f;
}
if (playerDist > 300f)
{
passiveMvtFloat = 1f;
}
playerDist = returnSpeed / playerDist;
playerVector.X *= playerDist;
playerVector.Y *= playerDist;
}
if (projectile.velocity.X < playerVector.X)
{
projectile.velocity.X += passiveMvtFloat;
if (passiveMvtFloat > 0.05f && projectile.velocity.X < 0f)
{
projectile.velocity.X += passiveMvtFloat;
}
}
if (projectile.velocity.X > playerVector.X)
{
projectile.velocity.X -= passiveMvtFloat;
if (passiveMvtFloat > 0.05f && projectile.velocity.X > 0f)
{
projectile.velocity.X -= passiveMvtFloat;
}
}
if (projectile.velocity.Y < playerVector.Y)
{
projectile.velocity.Y += passiveMvtFloat;
if (passiveMvtFloat > 0.05f && projectile.velocity.Y < 0f)
{
projectile.velocity.Y += passiveMvtFloat * 2f;
}
}
if (projectile.velocity.Y > playerVector.Y)
{
projectile.velocity.Y -= passiveMvtFloat;
if (passiveMvtFloat > 0.05f && projectile.velocity.Y > 0f)
{
projectile.velocity.Y -= passiveMvtFloat * 2f;
}
}
if (projectile.velocity.X >= 0.25f)
{
projectile.direction = faceRight ? 1 : -1;
}
else if (projectile.velocity.X < -0.25f)
{
projectile.direction = faceRight ? -1 : 1;
}
//Tilting and change directions
projectile.spriteDirection = projectile.direction;
projectile.rotation = projectile.velocity.X * tiltFloat;
}
public static void ExpandHitboxBy(Projectile projectile, int width, int height)
{
projectile.position = projectile.Center;
+1 -13
View File
@@ -128,19 +128,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal
if (!target.boss)
{
if (target.HitSound != SoundID.NPCHit1 && target.HitSound != SoundID.NPCHit6 && target.HitSound != SoundID.NPCHit7 &&
target.HitSound != SoundID.NPCHit8 && target.HitSound != SoundID.NPCHit9 && target.HitSound != SoundID.NPCHit12 &&
target.HitSound != SoundID.NPCHit13 && target.HitSound != SoundID.NPCHit14 && target.HitSound != SoundID.NPCHit18 &&
target.HitSound != SoundID.NPCHit19 && target.HitSound != SoundID.NPCHit20 && target.HitSound != SoundID.NPCHit21 &&
target.HitSound != SoundID.NPCHit22 && target.HitSound != SoundID.NPCHit23 && target.HitSound != SoundID.NPCHit24 &&
target.HitSound != SoundID.NPCHit25 && target.HitSound != SoundID.NPCHit26 && target.HitSound != SoundID.NPCHit27 &&
target.HitSound != SoundID.NPCHit28 && target.HitSound != SoundID.NPCHit29 && target.HitSound != SoundID.NPCHit31 &&
target.HitSound != SoundID.NPCHit32 && target.HitSound != SoundID.NPCHit33 && target.HitSound != SoundID.NPCHit35 &&
target.HitSound != SoundID.NPCHit37 && target.HitSound != SoundID.NPCHit38 && target.HitSound != SoundID.NPCHit40 &&
target.HitSound != SoundID.NPCHit43 && target.HitSound != SoundID.NPCHit44 && target.HitSound != SoundID.NPCHit45 &&
target.HitSound != SoundID.NPCHit46 && target.HitSound != SoundID.NPCHit47 && target.HitSound != SoundID.NPCHit48 &&
target.HitSound != SoundID.NPCHit50 && target.HitSound != SoundID.NPCHit51 && target.HitSound != SoundID.NPCHit55 &&
target.HitSound != SoundID.NPCHit56 && target.HitSound != SoundID.NPCHit57)
if (target.Inorganic())
{
damage += target.lifeMax / 250;
}
@@ -143,11 +143,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal
{
if (projectile.ai[1] >= 0f)
{
if (target.HitSound != SoundID.NPCHit4 && target.HitSound != SoundID.NPCHit41 && target.HitSound != SoundID.NPCHit2 &&
target.HitSound != SoundID.NPCHit5 && target.HitSound != SoundID.NPCHit11 && target.HitSound != SoundID.NPCHit30 &&
target.HitSound != SoundID.NPCHit34 && target.HitSound != SoundID.NPCHit36 && target.HitSound != SoundID.NPCHit42 &&
target.HitSound != SoundID.NPCHit49 && target.HitSound != SoundID.NPCHit52 && target.HitSound != SoundID.NPCHit53 &&
target.HitSound != SoundID.NPCHit54 && target.HitSound != null)
if (target.Organic())
{
target.velocity.X = 0f;
target.velocity.Y = 0f;
+1 -1
View File
@@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Healing
public override void AI()
{
CalamityGlobalProjectile.HealingProjectile(projectile, (int)projectile.ai[1], (int)projectile.ai[0], 5.5f, 15f);
projectile.HealingProjectile((int)projectile.ai[1], (int)projectile.ai[0], 5.5f, 15f);
int dusty = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 127, 0f, 0f, 100, default, 2f);
Dust dust = Main.dust[dusty];
dust.noGravity = true;
+1 -1
View File
@@ -41,7 +41,7 @@ namespace CalamityMod.Projectiles.Healing
}
}
CalamityGlobalProjectile.HealingProjectile(projectile, (int)projectile.ai[1], (int)projectile.ai[0], 6f, 15f);
projectile.HealingProjectile((int)projectile.ai[1], (int)projectile.ai[0], 6f, 15f);
return;
}
+1 -1
View File
@@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Healing
projectile.velocity.X *= 0.95f;
projectile.velocity.Y *= 0.95f;
CalamityGlobalProjectile.HealingProjectile(projectile, 3, (int)projectile.ai[0], 6f, 15f, false);
projectile.HealingProjectile(3, (int)projectile.ai[0], 6f, 15f, false);
int dusty = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 1f);
Dust dust = Main.dust[dusty];
dust.noGravity = true;
+1 -1
View File
@@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Healing
{
projectile.velocity.Y *= 0.98f;
CalamityGlobalProjectile.HealingProjectile(projectile, 25, projectile.owner, 12f, 15f);
projectile.HealingProjectile(25, projectile.owner, 12f, 15f);
int dusty = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(0, 200, 0), 1.5f);
Dust dust = Main.dust[dusty];
dust.noGravity = true;
+1 -1
View File
@@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Healing
public override void AI()
{
CalamityGlobalProjectile.HealingProjectile(projectile, (int)projectile.ai[1], (int)projectile.ai[0], 8f, 15f);
projectile.HealingProjectile((int)projectile.ai[1], (int)projectile.ai[0], 8f, 15f);
int dusty = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 74, 0f, 0f, 100, default, 1f);
Dust dust = Main.dust[dusty];
dust.noGravity = true;
+1 -1
View File
@@ -38,7 +38,7 @@ namespace CalamityMod.Projectiles.Healing
projectile.frame = 0;
}
CalamityGlobalProjectile.HealingProjectile(projectile, (int)projectile.ai[1], (int)projectile.ai[0], 3.5f, 15f);
projectile.HealingProjectile((int)projectile.ai[1], (int)projectile.ai[0], 3.5f, 15f);
return;
}
+1 -1
View File
@@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Healing
public override void AI()
{
CalamityGlobalProjectile.HealingProjectile(projectile, (int)projectile.ai[1], (int)projectile.ai[0], 8f, 15f);
projectile.HealingProjectile((int)projectile.ai[1], (int)projectile.ai[0], 8f, 15f);
int dusty = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1f);
Dust dust = Main.dust[dusty];
dust.noGravity = true;
+1 -1
View File
@@ -39,7 +39,7 @@ namespace CalamityMod.Projectiles.Healing
projectile.localAI[0] += 1f;
}
CalamityGlobalProjectile.HealingProjectile(projectile, (int)projectile.ai[1], (int)projectile.ai[0], 5f, 15f);
projectile.HealingProjectile((int)projectile.ai[1], (int)projectile.ai[0], 5f, 15f);
float num494 = projectile.velocity.X * 0.334f;
float num495 = -(projectile.velocity.Y * 0.334f);
int num496 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 56, 0f, 0f, 100, default, 0.5f);
+1 -1
View File
@@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Healing
public override void AI()
{
CalamityGlobalProjectile.HealingProjectile(projectile, (int)projectile.ai[1], (int)projectile.ai[0], 6.5f, 15f);
projectile.HealingProjectile((int)projectile.ai[1], (int)projectile.ai[0], 6.5f, 15f);
int dusty = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default, 2f);
Dust dust = Main.dust[dusty];
dust.noGravity = true;
+1 -1
View File
@@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Healing
public override void AI()
{
CalamityGlobalProjectile.HealingProjectile(projectile, (int)projectile.ai[1], (int)projectile.ai[0], 3f, 15f);
projectile.HealingProjectile((int)projectile.ai[1], (int)projectile.ai[0], 3f, 15f);
int dusty = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 175, 0f, 0f, 100, default, 1.3f);
Dust dust = Main.dust[dusty];
dust.noGravity = true;
+1 -1
View File
@@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Healing
{
projectile.velocity.X *= 0.95f;
projectile.velocity.Y *= 0.95f;
CalamityGlobalProjectile.HealingProjectile(projectile, 10, (int)projectile.ai[0], 6f, 15f, false, 360);
projectile.HealingProjectile(10, (int)projectile.ai[0], 6f, 15f, false, 360);
float num498 = projectile.velocity.X * 0.2f;
float num499 = -(projectile.velocity.Y * 0.2f);
int num500 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 1f);
+1 -1
View File
@@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Healing
{
projectile.velocity.X *= 0.985f;
projectile.velocity.Y *= 0.985f;
CalamityGlobalProjectile.HealingProjectile(projectile, 8, projectile.owner, 12f, 15f, false);
projectile.HealingProjectile(8, projectile.owner, 12f, 15f, false);
float num498 = projectile.velocity.X * 0.2f;
float num499 = -(projectile.velocity.Y * 0.2f);
+1 -1
View File
@@ -21,7 +21,7 @@ namespace CalamityMod.Projectiles.Healing
public override void AI()
{
CalamityGlobalProjectile.HealingProjectile(projectile, (int)projectile.ai[1], (int)projectile.ai[0], 5.5f, 15f);
projectile.HealingProjectile((int)projectile.ai[1], (int)projectile.ai[0], 5.5f, 15f);
for (int num493 = 0; num493 < 3; num493++)
{
float num494 = projectile.velocity.X * 0.334f * (float)num493;
+1 -1
View File
@@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Healing
public override void AI()
{
CalamityGlobalProjectile.HealingProjectile(projectile, (int)projectile.ai[1], projectile.owner, 6f, 15f);
projectile.HealingProjectile((int)projectile.ai[1], projectile.owner, 6f, 15f);
for (int num468 = 0; num468 < 3; num468++)
{
+1 -1
View File
@@ -41,7 +41,7 @@ namespace CalamityMod.Projectiles.Healing
}
}
CalamityGlobalProjectile.HealingProjectile(projectile, (int)projectile.ai[1], (int)projectile.ai[0], 6f, 15f);
projectile.HealingProjectile((int)projectile.ai[1], (int)projectile.ai[0], 6f, 15f);
return;
}
+1 -1
View File
@@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Healing
projectile.velocity.X *= 0.95f;
projectile.velocity.Y *= 0.95f;
CalamityGlobalProjectile.HealingProjectile(projectile, 9, (int)projectile.ai[0], 8f, 15f, false, 300);
projectile.HealingProjectile(9, (int)projectile.ai[0], 8f, 15f, false, 300);
float num498 = projectile.velocity.X * 0.2f;
float num499 = -(projectile.velocity.Y * 0.2f);
int num500 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 246, 0f, 0f, 100, default, 1f);
+1 -1
View File
@@ -21,7 +21,7 @@ namespace CalamityMod.Projectiles.Healing
public override void AI()
{
CalamityGlobalProjectile.HealingProjectile(projectile, (int)projectile.ai[1], (int)projectile.ai[0], 6.5f, 15f);
projectile.HealingProjectile((int)projectile.ai[1], (int)projectile.ai[0], 6.5f, 15f);
float num494 = projectile.velocity.X * 0.334f;
float num495 = -(projectile.velocity.Y * 0.334f);
int num496 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 183, 0f, 0f, 100, default, 0.7f);
+1 -1
View File
@@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Healing
public override void AI()
{
CalamityGlobalProjectile.HealingProjectile(projectile, (int)projectile.ai[1], (int)projectile.ai[0], 5.5f, 15f);
projectile.HealingProjectile((int)projectile.ai[1], (int)projectile.ai[0], 5.5f, 15f);
float num498 = projectile.velocity.X * 0.2f;
float num499 = -(projectile.velocity.Y * 0.2f);
int num500 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 58, 0f, 0f, 100, default, 2f);
-1
View File
@@ -3,7 +3,6 @@ using System;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.ID;
namespace CalamityMod.Projectiles.Magic
{
+2 -1
View File
@@ -23,6 +23,8 @@ namespace CalamityMod.Projectiles.Magic
projectile.alpha = 255;
projectile.penetrate = 9;
projectile.timeLeft = 300;
projectile.usesIDStaticNPCImmunity = true;
projectile.idStaticNPCHitCooldown = 5;
}
public override void AI()
@@ -80,7 +82,6 @@ namespace CalamityMod.Projectiles.Magic
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
target.AddBuff(ModContent.BuffType<Plague>(), 300);
target.immune[projectile.owner] = 2;
}
}
}
+15 -16
View File
@@ -113,28 +113,27 @@ namespace CalamityMod.Projectiles.Magic
{
if (projectile.ai[1] == 0f)
{
float x = projectile.position.X + (float)Main.rand.Next(-400, 400);
float y = projectile.position.Y - (float)Main.rand.Next(500, 800);
Vector2 vector = new Vector2(x, y);
float num15 = projectile.position.X + (float)(projectile.width / 2) - vector.X;
float num16 = projectile.position.Y + (float)(projectile.height / 2) - vector.Y;
num15 += (float)Main.rand.Next(-100, 101);
float num17 = 6f;
float num18 = (float)Math.Sqrt((double)(num15 * num15 + num16 * num16));
num18 = num17 / num18;
num15 *= num18;
num16 *= num18;
int num19 = Projectile.NewProjectile(x, y, num15, num16, ModContent.ProjectileType<VividClarityBeam>(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f);
float xStart = projectile.position.X + (float)Main.rand.Next(-400, 400);
float yStart = projectile.position.Y - (float)Main.rand.Next(500, 800);
Vector2 startPos = new Vector2(xStart, yStart);
Vector2 velocity = projectile.Center - startPos;
velocity.X += (float)Main.rand.Next(-100, 101);
float speed = 6f;
float targetDist = velocity.Length();
targetDist = speed / targetDist;
velocity.X *= targetDist;
velocity.Y *= targetDist;
int num19 = Projectile.NewProjectile(startPos, velocity, ModContent.ProjectileType<VividClarityBeam>(), (int)(projectile.damage * 0.7f), projectile.knockBack, projectile.owner, 0f, 0f);
Main.projectile[num19].ai[1] = projectile.position.Y;
}
if (projectile.ai[1] == 1f)
{
int boom = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType<SupernovaBoom>(), (int)((double)projectile.damage * 2f), projectile.knockBack, projectile.owner, 0f, 0f);
int boom = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType<SupernovaBoom>(), (int)(projectile.damage * 2f), projectile.knockBack, projectile.owner, 0f, 0f);
Main.projectile[boom].Calamity().forceMagic = true;
}
if (projectile.ai[1] == 2f)
{
float spread = 30f * 0.0174f;
float spread = 30f * 0.01f * MathHelper.PiOver2;
double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2;
double deltaAngle = spread / 8f;
double offsetAngle;
@@ -143,8 +142,8 @@ namespace CalamityMod.Projectiles.Magic
for (int i = 0; i < 4; i++)
{
offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i;
Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType<VividLaser2>(), (int)((double)projectile.damage * 0.2f), projectile.knockBack, projectile.owner, 0f, 0f);
Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType<VividLaser2>(), (int)((double)projectile.damage * 0.2f), projectile.knockBack, projectile.owner, 0f, 0f);
Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType<VividLaser2>(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f);
Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType<VividLaser2>(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f);
}
}
}
+3 -3
View File
@@ -78,15 +78,15 @@ namespace CalamityMod.Projectiles.Melee
int directionSign = Main.rand.NextBool(2).ToDirectionInt();
Vector2 spawnPos = new Vector2(target.Center.X + directionSign * 650, projectile.Center.Y + Main.rand.Next(-500, 501));
Vector2 velocity = Vector2.Normalize(target.Center - spawnPos) * 30f;
Projectile.NewProjectile(spawnPos.X, spawnPos.Y, velocity.X, velocity.Y, ModContent.ProjectileType<CosmicShivBlade>(), projectile.damage, 1.4f, projectile.owner);
Projectile.NewProjectile(spawnPos.X, spawnPos.Y, velocity.X, velocity.Y, ModContent.ProjectileType<CosmicShivBlade>(), projectile.damage, projectile.knockBack * 0.1f, projectile.owner);
}
int starMax = Main.rand.Next(4, 11); // 4 to 10 stars
int starMax = Main.rand.Next(6, 11); // 6 to 10 stars
for (int i = -starMax / 2; i < starMax / 2; i++)
{
int ySpawnAdditive = Main.rand.Next(-40, 41);
Vector2 toSpawn = target.Center - new Vector2(0f, 800f + ySpawnAdditive).RotatedBy(MathHelper.ToRadians(i * 11f / starMax));
Vector2 toTarget = Vector2.Normalize(target.Center - toSpawn) * 35f;
Projectile.NewProjectile(toSpawn, toTarget, ModContent.ProjectileType<GalaxyStar>(), projectile.damage, projectile.knockBack, projectile.owner);
Projectile.NewProjectile(toSpawn, toTarget, ModContent.ProjectileType<GalaxyStar>(), projectile.damage / 2, projectile.knockBack * 0.5f, projectile.owner);
}
target.AddBuff(ModContent.BuffType<BrimstoneFlames>(), 360);
target.AddBuff(ModContent.BuffType<GlacialState>(), 360);
+1 -1
View File
@@ -67,7 +67,7 @@ namespace CalamityMod.Projectiles.Melee
{
if (explosionCount < 3)
{
Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType<BrimlanceHellfireExplosion>(), (int)(projectile.damage * 0.5), knockback, projectile.owner);
Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType<BrimstoneSwordExplosion>(), (int)(projectile.damage * 0.5), knockback, projectile.owner);
explosionCount++;
}
}
+1 -1
View File
@@ -39,7 +39,7 @@ namespace CalamityMod.Projectiles.Pets
{
projectile.timeLeft = 2;
}
CalamityGlobalProjectile.FloatingPetAI(projectile, true, 0.02f);
projectile.FloatingPetAI(true, 0.02f);
projectile.frameCounter++;
if (projectile.frameCounter > 6)
{
+1 -1
View File
@@ -52,7 +52,7 @@ namespace CalamityMod.Projectiles.Pets
{
Lighting.AddLight(projectile.Center, 0.1f, 0.3f, 0.5f);
}
CalamityGlobalProjectile.FloatingPetAI(projectile, false, 0.05f, true);
projectile.FloatingPetAI(false, 0.05f, true);
projectile.frameCounter++;
if (projectile.frameCounter > 6)
{
+1 -1
View File
@@ -39,7 +39,7 @@ namespace CalamityMod.Projectiles.Pets
{
projectile.timeLeft = 2;
}
CalamityGlobalProjectile.FloatingPetAI(projectile, false, 0.05f);
projectile.FloatingPetAI(false, 0.05f);
projectile.frameCounter++;
if (projectile.frameCounter > 6)
{
+1 -1
View File
@@ -53,7 +53,7 @@ namespace CalamityMod.Projectiles.Pets
projectile.timeLeft = 2;
}
CalamityGlobalProjectile.FloatingPetAI(projectile, true, 0.1f);
projectile.FloatingPetAI(true, 0.1f);
//Dust
if (Main.rand.NextBool(50))
+1 -1
View File
@@ -39,7 +39,7 @@ namespace CalamityMod.Projectiles.Pets
{
projectile.timeLeft = 2;
}
CalamityGlobalProjectile.FloatingPetAI(projectile, false, 0.05f);
projectile.FloatingPetAI(false, 0.05f);
projectile.frameCounter++;
if (projectile.frameCounter > 6)
{
+1 -1
View File
@@ -73,7 +73,7 @@ namespace CalamityMod.Projectiles.Pets
dust += 1f;
}
CalamityGlobalProjectile.FloatingPetAI(projectile, true, 0.05f);
projectile.FloatingPetAI(true, 0.05f);
projectile.frameCounter++;
if (projectile.frameCounter > 6)
+1 -1
View File
@@ -39,7 +39,7 @@ namespace CalamityMod.Projectiles.Pets
{
projectile.timeLeft = 2;
}
CalamityGlobalProjectile.FloatingPetAI(projectile, false, 0.05f);
projectile.FloatingPetAI(false, 0.05f);
projectile.frameCounter++;
if (projectile.frameCounter > 6)
{
+1 -1
View File
@@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Pets
{
projectile.timeLeft = 2;
}
CalamityGlobalProjectile.FloatingPetAI(projectile, true, 0.1f);
projectile.FloatingPetAI(true, 0.1f);
//Animation
projectile.frameCounter++;
if (projectile.frameCounter > 6)
-1
View File
@@ -4,7 +4,6 @@ using System;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.ID;
namespace CalamityMod.Projectiles.Ranged
{
+10 -8
View File
@@ -30,40 +30,42 @@ namespace CalamityMod.Projectiles.Ranged
projectile.ai[0] += 1f;
int incrementAmt = 0;
float spreadMult = 0.15f;
if (projectile.ai[0] >= 90f)
if (projectile.ai[0] >= 80f)
{
incrementAmt++;
spreadMult = 0.13f;
}
if (projectile.ai[0] >= 180f)
if (projectile.ai[0] >= 160f)
{
incrementAmt++;
spreadMult = 0.11f;
}
if (projectile.ai[0] >= 270f)
if (projectile.ai[0] >= 240f)
{
incrementAmt++;
spreadMult = 0.09f;
}
if (projectile.ai[0] >= 360f)
if (projectile.ai[0] >= 320f)
{
incrementAmt++;
spreadMult = 0.07f;
}
if (projectile.ai[0] >= 450f)
if (projectile.ai[0] >= 400f)
{
incrementAmt++;
spreadMult = 0.05f;
}
if (projectile.ai[0] >= 540f)
if (projectile.ai[0] >= 480f)
{
incrementAmt++;
spreadMult = 0.04f;
}
if (projectile.ai[0] >= 630f)
if (projectile.ai[0] >= 560f)
{
incrementAmt++;
spreadMult = 0.03f;
}
if (projectile.ai[0] >= 720f) //8
if (projectile.ai[0] >= 640f) //8
{
incrementAmt++;
spreadMult = 0.02f;
+1 -1
View File
@@ -37,7 +37,7 @@ namespace CalamityMod.Projectiles.Ranged
projectile.ranged = true;
projectile.penetrate = -1;
projectile.usesLocalNPCImmunity = true;
projectile.localNPCHitCooldown = 5;
projectile.localNPCHitCooldown = 8;
projectile.timeLeft = 180;
}
public override void AI()
+1 -13
View File
@@ -51,19 +51,7 @@ namespace CalamityMod.Projectiles.Ranged
{
damageMult += 0.25;
}
if (target.HitSound != SoundID.NPCHit1 && target.HitSound != SoundID.NPCHit6 && target.HitSound != SoundID.NPCHit7 &&
target.HitSound != SoundID.NPCHit8 && target.HitSound != SoundID.NPCHit9 && target.HitSound != SoundID.NPCHit12 &&
target.HitSound != SoundID.NPCHit13 && target.HitSound != SoundID.NPCHit14 && target.HitSound != SoundID.NPCHit18 &&
target.HitSound != SoundID.NPCHit19 && target.HitSound != SoundID.NPCHit20 && target.HitSound != SoundID.NPCHit21 &&
target.HitSound != SoundID.NPCHit22 && target.HitSound != SoundID.NPCHit23 && target.HitSound != SoundID.NPCHit24 &&
target.HitSound != SoundID.NPCHit25 && target.HitSound != SoundID.NPCHit26 && target.HitSound != SoundID.NPCHit27 &&
target.HitSound != SoundID.NPCHit28 && target.HitSound != SoundID.NPCHit29 && target.HitSound != SoundID.NPCHit31 &&
target.HitSound != SoundID.NPCHit32 && target.HitSound != SoundID.NPCHit33 && target.HitSound != SoundID.NPCHit35 &&
target.HitSound != SoundID.NPCHit37 && target.HitSound != SoundID.NPCHit38 && target.HitSound != SoundID.NPCHit40 &&
target.HitSound != SoundID.NPCHit43 && target.HitSound != SoundID.NPCHit44 && target.HitSound != SoundID.NPCHit45 &&
target.HitSound != SoundID.NPCHit46 && target.HitSound != SoundID.NPCHit47 && target.HitSound != SoundID.NPCHit48 &&
target.HitSound != SoundID.NPCHit50 && target.HitSound != SoundID.NPCHit51 && target.HitSound != SoundID.NPCHit55 &&
target.HitSound != SoundID.NPCHit56 && target.HitSound != SoundID.NPCHit57)
if (target.Inorganic())
{
damageMult += 0.1;
}
+3
View File
@@ -33,6 +33,9 @@ namespace CalamityMod.Projectiles.Rogue
{
Player player = Main.player[projectile.owner];
if (player.dead || player is null || Main.myPlayer != projectile.owner)
projectile.Kill();
player.direction = projectile.direction;
player.heldProj = projectile.whoAmI;
@@ -29,6 +29,10 @@ namespace CalamityMod.Projectiles.Rogue
public override void AI()
{
Player player = Main.player[projectile.owner];
if (player.dead || player is null || Main.myPlayer != projectile.owner)
projectile.Kill();
projectile.Center = player.Center;
player.heldProj = projectile.whoAmI;
projectile.spriteDirection = (projectile.velocity.X > 0).ToDirectionInt();
+3
View File
@@ -30,6 +30,9 @@ namespace CalamityMod.Projectiles.Rogue
{
Player player = Main.player[projectile.owner];
if (player.dead || player is null || Main.myPlayer != projectile.owner)
projectile.Kill();
if (Main.myPlayer == player.whoAmI)
{
projectile.velocity = Main.MouseWorld - player.Center;
+5 -1
View File
@@ -33,12 +33,16 @@ namespace CalamityMod.Projectiles.Rogue
}
public override void AI()
{
Player player = Main.player[projectile.owner];
if (player.dead || player is null || Main.myPlayer != projectile.owner)
projectile.Kill();
if (projectile.localAI[0] == 0)
{
Main.PlaySound(SoundID.Item71, (int)projectile.position.X, (int)projectile.position.Y);
projectile.localAI[0] = 1;
}
Player player = Main.player[projectile.owner];
projectile.spriteDirection = (projectile.velocity.X > 0).ToDirectionInt();
projectile.rotation += 0.25f * projectile.direction;
+5 -1
View File
@@ -53,12 +53,16 @@ namespace CalamityMod.Projectiles.Rogue
}
public override void AI()
{
Player player = Main.player[projectile.owner];
if (player.dead || player is null || Main.myPlayer != projectile.owner)
projectile.Kill();
if (projectile.localAI[0] == 0)
{
Main.PlaySound(SoundID.Item71, projectile.position);
projectile.localAI[0] = 1;
}
Player player = Main.player[projectile.owner];
projectile.spriteDirection = projectile.velocity.X > 0 ? 1 : -1;
projectile.rotation += 0.25f * projectile.direction;
+2 -1
View File
@@ -67,7 +67,8 @@ namespace CalamityMod.Projectiles.Rogue
public override void Kill(int timeLeft)
{
Main.PlaySound(SoundID.Item27, projectile.position);
if (projectile.ai[0] != 1f || Main.rand.NextBool(20))
Main.PlaySound(SoundID.Item27, projectile.position);
for (int index1 = 0; index1 < 3; ++index1)
{
int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 76);
+1 -25
View File
@@ -94,31 +94,7 @@ namespace CalamityMod.Projectiles.Summon
projectile.timeLeft = 2;
}
}
float num637 = 0.05f;
for (int num638 = 0; num638 < Main.maxProjectiles; num638++)
{
bool flag23 = Main.projectile[num638].type == ModContent.ProjectileType<ApexShark>();
if (num638 != projectile.whoAmI && Main.projectile[num638].active && Main.projectile[num638].owner == projectile.owner &&
flag23 && Math.Abs(projectile.position.X - Main.projectile[num638].position.X) + Math.Abs(projectile.position.Y - Main.projectile[num638].position.Y) < (float)projectile.width)
{
if (projectile.position.X < Main.projectile[num638].position.X)
{
projectile.velocity.X = projectile.velocity.X - num637;
}
else
{
projectile.velocity.X = projectile.velocity.X + num637;
}
if (projectile.position.Y < Main.projectile[num638].position.Y)
{
projectile.velocity.Y = projectile.velocity.Y - num637;
}
else
{
projectile.velocity.Y = projectile.velocity.Y + num637;
}
}
}
projectile.MinionAntiClump();
bool flag24 = false;
if (projectile.ai[0] == 2f)
{
+1 -1
View File
@@ -64,7 +64,7 @@ namespace CalamityMod.Projectiles.Summon
}
projectile.rotation += projectile.velocity.X * 0.04f;
CalamityGlobalProjectile.ChargingMinionAI(projectile, 600f, 800f, 1200f, 150f, 0, 40f, 8f, -4f, 40f, 8f, false, false);
projectile.ChargingMinionAI(600f, 800f, 1200f, 150f, 0, 40f, 8f, -4f, 40f, 9.5f, false, false);
}
public override bool OnTileCollide(Vector2 oldVelocity) => false;
+1 -26
View File
@@ -70,32 +70,7 @@ namespace CalamityMod.Projectiles.Summon
}
//anti sticking movement
float SAImovement = 0.05f;
float width = (float) projectile.width;
for (int indexNPC = 0; indexNPC < Main.projectile.Length; indexNPC++)
{
Projectile proj = Main.projectile[indexNPC];
bool myType = proj.type == ModContent.ProjectileType<AureusBomber>();
if (indexNPC != projectile.whoAmI && proj.active && proj.owner == projectile.owner && myType && Math.Abs(projectile.position.X - proj.position.X) + Math.Abs(projectile.position.Y - proj.position.Y) < width)
{
if (projectile.position.X < proj.position.X)
{
projectile.velocity.X -= SAImovement;
}
else
{
projectile.velocity.X += SAImovement;
}
if (projectile.position.Y < proj.position.Y)
{
projectile.velocity.Y -= SAImovement;
}
else
{
projectile.velocity.Y += SAImovement;
}
}
}
projectile.MinionAntiClump();
//get in a line
Vector2 idlePosition = player.Center;
+4 -1
View File
@@ -51,7 +51,10 @@ namespace CalamityMod.Projectiles.Summon
for (int j = 0; j < Main.maxProjectiles; j++)
{
Projectile proj = Main.projectile[j];
if (proj.active && proj.owner == projectile.owner && proj.type == ModContent.ProjectileType<BabyBloodCrawler>() && proj.Calamity().lineColor == 0)
// Short circuits to make the loop as fast as possible
if (!proj.active || proj.owner != projectile.owner || !proj.minion || proj.Calamity().lineColor != 0)
continue;
if (proj.type == projectile.type)
{
spiderCount += (int)proj.minionSlots;
proj.Calamity().lineColor = 1;
+1 -26
View File
@@ -142,32 +142,7 @@ namespace CalamityMod.Projectiles.Summon
}
projectile.velocity.Y = (targetPosition.Y - projectile.Center.Y + potentialTarget.spriteDirection * 75f) / 90f;
}
float SAImovement = 0.05f;
for (int index = 0; index < Main.projectile.Length; index++)
{
Projectile proj = Main.projectile[index];
if (index != projectile.whoAmI &&
proj.active && proj.owner == projectile.owner &&
proj.type == projectile.type && Math.Abs(projectile.position.X - proj.position.X) + Math.Abs(projectile.position.Y - proj.position.Y) < projectile.width)
{
if (projectile.position.X < proj.position.X)
{
projectile.velocity.X -= SAImovement;
}
else
{
projectile.velocity.X += SAImovement;
}
if (projectile.position.Y < proj.position.Y)
{
projectile.velocity.Y -= SAImovement;
}
else
{
projectile.velocity.Y += SAImovement;
}
}
}
projectile.MinionAntiClump();
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 708 B

+148 -109
View File
@@ -1,6 +1,8 @@
using CalamityMod.Buffs.Summon;
using CalamityMod.CalPlayer;
using CalamityMod.Projectiles;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using Terraria;
using Terraria.ID;
@@ -9,8 +11,6 @@ namespace CalamityMod.Projectiles.Summon
{
public class BlackHawkSummon : ModProjectile
{
private const float PushawayForce = 0.05f;
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Black Hawk");
@@ -37,45 +37,52 @@ namespace CalamityMod.Projectiles.Summon
public override void AI()
{
//Set namespaces
Player player = Main.player[projectile.owner];
CalamityPlayer modPlayer = player.Calamity();
CalamityGlobalProjectile modProj = projectile.Calamity();
//On spawn effects
if (projectile.localAI[0] == 0f)
{
projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage();
projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage;
int num226 = 36;
for (int num227 = 0; num227 < num226; num227++)
//Set constants
modProj.spawnedPlayerMinionDamageValue = player.MinionDamage();
modProj.spawnedPlayerMinionProjectileDamageValue = projectile.damage;
//Spawn dust
int dustAmt = 36;
for (int dustIndex = 0; dustIndex < dustAmt; dustIndex++)
{
Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f;
vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center;
Vector2 vector7 = vector6 - projectile.Center;
int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 258, vector7.X * 1.75f, vector7.Y * 1.75f, 100, default, 1.1f);
Main.dust[num228].noGravity = true;
Main.dust[num228].velocity = vector7;
Vector2 direction = Vector2.Normalize(projectile.velocity) * new Vector2(projectile.width / 2f, projectile.height) * 0.75f;
direction = direction.RotatedBy((double)((dustIndex - (dustAmt / 2f - 1f)) * MathHelper.TwoPi / dustAmt), default) + projectile.Center;
Vector2 dustVel = direction - projectile.Center;
int fire = Dust.NewDust(direction + dustVel, 0, 0, 258, dustVel.X * 1.75f, dustVel.Y * 1.75f, 100, default, 1.1f);
Main.dust[fire].noGravity = true;
Main.dust[fire].velocity = dustVel;
}
projectile.localAI[0] += 1f;
}
if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue)
//Flexible minion damage update
if (player.MinionDamage() != modProj.spawnedPlayerMinionDamageValue)
{
int damage2 = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue /
projectile.Calamity().spawnedPlayerMinionDamageValue *
player.MinionDamage());
int damage2 = (int)((float)modProj.spawnedPlayerMinionProjectileDamageValue /
modProj.spawnedPlayerMinionDamageValue * player.MinionDamage());
projectile.damage = damage2;
}
//Update frames
projectile.frameCounter++;
if (projectile.frameCounter >= 4)
{
projectile.frame++;
projectile.frameCounter = 0;
}
if (projectile.frame >= 3)
if (projectile.frame >= Main.projFrames[projectile.type])
{
projectile.frame = 0;
}
float num633 = 700f;
float num634 = 1300f;
float num635 = 2600f;
float num636 = 600f;
//Set up buff and timeLeft
bool flag64 = projectile.type == ModContent.ProjectileType<BlackHawkSummon>();
player.AddBuff(ModContent.BuffType<BlackHawkBuff>(), 3600);
if (flag64)
@@ -89,171 +96,203 @@ namespace CalamityMod.Projectiles.Summon
projectile.timeLeft = 2;
}
}
for (int k = 0; k < Main.maxProjectiles; k++)
{
Projectile otherProj = Main.projectile[k];
// Short circuits to make the loop as fast as possible
if (!otherProj.active || otherProj.owner != projectile.owner || !otherProj.minion || k == projectile.whoAmI)
continue;
// If the other projectile is indeed a Black Hawk owned by the same player and they're too close, nudge them away.
bool isBlackHawk = otherProj.type == projectile.type;
float taxicabDist = Math.Abs(projectile.position.X - otherProj.position.X) + Math.Abs(projectile.position.Y - otherProj.position.Y);
if (isBlackHawk && taxicabDist < projectile.width)
{
if (projectile.position.X < otherProj.position.X)
projectile.velocity.X = projectile.velocity.X - PushawayForce;
else
projectile.velocity.X = projectile.velocity.X + PushawayForce;
//Anti sticky movement to prevent overlapping minions
projectile.MinionAntiClump();
if (projectile.position.Y < otherProj.position.Y)
projectile.velocity.Y = projectile.velocity.Y - PushawayForce;
else
projectile.velocity.Y = projectile.velocity.Y + PushawayForce;
}
}
Vector2 vector46 = projectile.position;
bool flag25 = false;
float maxDistance = 700f;
Vector2 targetVec = projectile.position;
Vector2 half = new Vector2(0.5f);
bool foundTarget = false;
//If targeting something, prioritize that enemy
if (player.HasMinionAttackTargetNPC)
{
NPC npc = Main.npc[player.MinionAttackTargetNPC];
if (npc.CanBeChasedBy(projectile, false))
{
float num646 = Vector2.Distance(npc.Center, projectile.Center);
if (!flag25 && num646 < num633)
//Adding a check on the NPC's size allows it to target big things like Providence
Vector2 sizeCheck = npc.position + npc.Size * half;
//Calculate distance between target and the projectile to know if it's too far or not
float targetDist = Vector2.Distance(npc.Center, projectile.Center);
if (!foundTarget && targetDist < maxDistance)
{
vector46 = npc.Center;
flag25 = true;
maxDistance = targetDist;
targetVec = sizeCheck;
foundTarget = true;
}
}
}
else
{
for (int num645 = 0; num645 < Main.maxNPCs; num645++)
for (int npcIndex = 0; npcIndex < Main.maxNPCs; npcIndex++)
{
NPC nPC2 = Main.npc[num645];
if (nPC2.CanBeChasedBy(projectile, false))
NPC npc = Main.npc[npcIndex];
if (npc.CanBeChasedBy(projectile, false))
{
float num646 = Vector2.Distance(nPC2.Center, projectile.Center);
if (!flag25 && num646 < num633)
Vector2 sizeCheck = npc.position + npc.Size * half;
float targetDist = Vector2.Distance(npc.Center, projectile.Center);
if (!foundTarget && targetDist < maxDistance)
{
num633 = num646;
vector46 = nPC2.Center;
flag25 = true;
maxDistance = targetDist;
targetVec = sizeCheck;
foundTarget = true;
}
}
}
}
float num647 = num634;
if (flag25)
//If too far, make the minion start returning to the player.
float separationAnxietyDist = 1300f;
if (foundTarget)
{
num647 = num635;
//Max travel distance increases if targeting something
separationAnxietyDist = 2600f;
}
if (Vector2.Distance(player.Center, projectile.Center) > num647)
if (Vector2.Distance(player.Center, projectile.Center) > separationAnxietyDist)
{
projectile.ai[0] = 1f;
projectile.netUpdate = true;
}
if (flag25 && projectile.ai[0] == 0f)
//If a target is found, move toward it
if (foundTarget && projectile.ai[0] == 0f)
{
Vector2 vector47 = vector46 - projectile.Center;
float num648 = vector47.Length();
vector47.Normalize();
if (num648 > 200f)
Vector2 vecToTarget = targetVec - projectile.Center;
float targetDist = vecToTarget.Length();
vecToTarget.Normalize();
//If farther than 200 pixels, move toward it
if (targetDist > 200f)
{
float scaleFactor2 = 18f; //12
vector47 *= scaleFactor2;
projectile.velocity = (projectile.velocity * 40f + vector47) / 41f;
float speedMult = 18f;
vecToTarget *= speedMult;
projectile.velocity = (projectile.velocity * 40f + vecToTarget) / 41f;
}
//Otherwise, back it up slowly
else
{
float num649 = 9f;
vector47 *= -num649;
projectile.velocity = (projectile.velocity * 40f + vector47) / 41f;
float speedMult = -9f;
vecToTarget *= speedMult;
projectile.velocity = (projectile.velocity * 40f + vecToTarget) / 41f;
}
}
//If not targeting something, act passively
else
{
bool flag26 = false;
if (!flag26)
bool returningToPlayer = false;
if (!returningToPlayer)
{
flag26 = projectile.ai[0] == 1f;
returningToPlayer = projectile.ai[0] == 1f;
}
float num650 = 12f;
if (flag26)
//Move faster if actively returning to the player
float speedMult = 12f;
if (returningToPlayer)
{
num650 = 30f;
speedMult = 30f;
}
Vector2 center2 = projectile.Center;
Vector2 vector48 = player.Center - center2 + new Vector2(0f, -120f);
float num651 = vector48.Length();
if (num651 > 200f && num650 < 16f)
Vector2 vecToPlayer = player.Center - projectile.Center + new Vector2(0f, -120f);
float playerDist = vecToPlayer.Length();
//Speed up if near the player
if (playerDist < 200f && speedMult < 16f)
{
num650 = 16f;
speedMult = 16f;
}
if (num651 < num636 && flag26)
//If close enough to the player, return to normal
if (playerDist < 600f && returningToPlayer)
{
projectile.ai[0] = 0f;
projectile.netUpdate = true;
}
if (num651 > 2000f)
//If abnormally far, teleport to the player
if (playerDist > 2000f)
{
projectile.position.X = player.Center.X - (float)(projectile.width / 2);
projectile.position.Y = player.Center.Y - (float)(projectile.height / 2);
projectile.netUpdate = true;
}
if (num651 > 70f)
//Move toward player if more than 70 pixels away
if (playerDist > 70f)
{
vector48.Normalize();
vector48 *= num650;
projectile.velocity = (projectile.velocity * 40f + vector48) / 41f;
vecToPlayer.Normalize();
vecToPlayer *= speedMult;
projectile.velocity = (projectile.velocity * 40f + vecToPlayer) / 41f;
}
//Move if still
else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f)
{
projectile.velocity.X = -0.15f;
projectile.velocity.Y = -0.05f;
}
}
if (flag25)
//Update rotation
if (foundTarget)
{
projectile.rotation = (vector46 - projectile.Center).ToRotation() + 3.14159274f;
projectile.rotation = projectile.rotation.AngleTowards(projectile.AngleTo(targetVec) + MathHelper.Pi, 0.1f);
}
else
{
projectile.rotation = projectile.velocity.ToRotation() + 3.14159274f;
projectile.rotation = projectile.velocity.ToRotation() + MathHelper.Pi;
}
//Increment attack cooldown
if (projectile.ai[1] > 0f)
{
projectile.ai[1] += (float)Main.rand.Next(1, 4);
projectile.ai[1] += Main.rand.Next(1, 4);
}
//Set the minion to be ready for attack
if (projectile.ai[1] > 90f)
{
projectile.ai[1] = 0f;
projectile.netUpdate = true;
}
if (projectile.ai[0] == 0f)
//Return if on attack cooldown, has no target, or returning to the player
if (projectile.ai[0] != 0f || !foundTarget || projectile.ai[1] != 0f)
return;
//Shoot a bullet
if (Main.myPlayer == projectile.owner)
{
float scaleFactor3 = 6f;
int num658 = ModContent.ProjectileType<BlackHawkBullet>();
if (flag25 && projectile.ai[1] == 0f)
{
Main.PlaySound(SoundID.Item20, projectile.Center);
projectile.ai[1] += 2f;
if (Main.myPlayer == projectile.owner)
{
Vector2 value19 = vector46 - projectile.Center;
value19.Normalize();
value19 *= scaleFactor3;
_ = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value19.X, value19.Y, num658, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f);
projectile.netUpdate = true;
}
}
float projSpeed = 6f;
int projType = ModContent.ProjectileType<BlackHawkBullet>();
Main.PlaySound(SoundID.Item20, projectile.Center);
projectile.ai[1] += 2f;
Vector2 velocity = targetVec - projectile.Center;
velocity.Normalize();
velocity *= projSpeed;
Projectile.NewProjectile(projectile.Center, velocity, projType, projectile.damage, projectile.knockBack, projectile.owner);
projectile.netUpdate = true;
}
}
public override bool CanDamage()
//Does no contact damage
public override bool CanDamage() => false;
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
{
Texture2D texture = Main.projectileTexture[projectile.type];
int frameHeight = texture.Height / Main.projFrames[projectile.type];
int y6 = frameHeight * projectile.frame;
SpriteEffects spriteEffects = SpriteEffects.None;
if (projectile.spriteDirection == -1)
spriteEffects = SpriteEffects.FlipHorizontally;
spriteBatch.Draw(texture, projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, frameHeight)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2(texture.Width / 2f, frameHeight / 2f), projectile.scale, spriteEffects, 0f);
return false;
}
//Pretty glowmask
public override void PostDraw(SpriteBatch spriteBatch, Color lightColor)
{
Texture2D texture = ModContent.GetTexture("CalamityMod/Projectiles/Summon/BlackHawkGlow");
int frameHeight = texture.Height / Main.projFrames[projectile.type];
int y6 = frameHeight * projectile.frame;
SpriteEffects spriteEffects = SpriteEffects.None;
if (projectile.spriteDirection == -1)
spriteEffects = SpriteEffects.FlipHorizontally;
spriteBatch.Draw(texture, projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, frameHeight)), Color.White, projectile.rotation, new Vector2(texture.Width / 2f, frameHeight / 2f), projectile.scale, spriteEffects, 0f);
}
}
}
+1 -24
View File
@@ -89,30 +89,7 @@ namespace CalamityMod.Projectiles.Summon
projectile.timeLeft = 2;
}
}
for (int num534 = 0; num534 < Main.maxProjectiles; num534++)
{
if (num534 != projectile.whoAmI && Main.projectile[num534].active && Main.projectile[num534].owner == projectile.owner &&
Main.projectile[num534].type == ModContent.ProjectileType<BloodClotMinion>() &&
Math.Abs(projectile.position.X - Main.projectile[num534].position.X) + Math.Abs(projectile.position.Y - Main.projectile[num534].position.Y) < (float)projectile.width)
{
if (projectile.position.X < Main.projectile[num534].position.X)
{
projectile.velocity.X = projectile.velocity.X - 0.05f;
}
else
{
projectile.velocity.X = projectile.velocity.X + 0.05f;
}
if (projectile.position.Y < Main.projectile[num534].position.Y)
{
projectile.velocity.Y = projectile.velocity.Y - 0.05f;
}
else
{
projectile.velocity.Y = projectile.velocity.Y + 0.05f;
}
}
}
projectile.MinionAntiClump();
float num535 = projectile.position.X;
float num536 = projectile.position.Y;
float num537 = 1300f;
+1 -24
View File
@@ -102,30 +102,7 @@ namespace CalamityMod.Projectiles.Summon
}
float num633 = 700f;
float num636 = 400f; //150
float num637 = 0.05f;
for (int num638 = 0; num638 < Main.maxProjectiles; num638++)
{
bool flag23 = Main.projectile[num638].type == ModContent.ProjectileType<BrimstoneElementalMinion>();
if (num638 != projectile.whoAmI && Main.projectile[num638].active && Main.projectile[num638].owner == projectile.owner && flag23 && Math.Abs(projectile.position.X - Main.projectile[num638].position.X) + Math.Abs(projectile.position.Y - Main.projectile[num638].position.Y) < (float)projectile.width)
{
if (projectile.position.X < Main.projectile[num638].position.X)
{
projectile.velocity.X = projectile.velocity.X - num637;
}
else
{
projectile.velocity.X = projectile.velocity.X + num637;
}
if (projectile.position.Y < Main.projectile[num638].position.Y)
{
projectile.velocity.Y = projectile.velocity.Y - num637;
}
else
{
projectile.velocity.Y = projectile.velocity.Y + num637;
}
}
}
projectile.MinionAntiClump();
Vector2 vector46 = projectile.position;
bool flag25 = false;
if (projectile.ai[0] != 1f)
+1 -1
View File
@@ -64,7 +64,7 @@ namespace CalamityMod.Projectiles.Summon
}
projectile.rotation += projectile.velocity.X * 0.04f;
CalamityGlobalProjectile.ChargingMinionAI(projectile, 600f, 800f, 1200f, 150f, 0, 40f, 8f, -4f, 40f, 8f, false, false);
projectile.ChargingMinionAI(600f, 800f, 1200f, 150f, 0, 40f, 8f, -4f, 40f, 9.5f, false, false);
}
public override bool OnTileCollide(Vector2 oldVelocity) => false;
+1 -26
View File
@@ -134,32 +134,7 @@ namespace CalamityMod.Projectiles.Summon
{
projectile.localAI[0] -= 1f;
}
int num3;
for (int num534 = 0; num534 < Main.maxProjectiles; num534 = num3 + 1)
{
if (num534 != projectile.whoAmI && Main.projectile[num534].active && Main.projectile[num534].owner == projectile.owner &&
Main.projectile[num534].type == ModContent.ProjectileType<CalamariMinion>() &&
Math.Abs(projectile.position.X - Main.projectile[num534].position.X) + Math.Abs(projectile.position.Y - Main.projectile[num534].position.Y) < (float)projectile.width)
{
if (projectile.position.X < Main.projectile[num534].position.X)
{
projectile.velocity.X = projectile.velocity.X - 0.05f;
}
else
{
projectile.velocity.X = projectile.velocity.X + 0.05f;
}
if (projectile.position.Y < Main.projectile[num534].position.Y)
{
projectile.velocity.Y = projectile.velocity.Y - 0.05f;
}
else
{
projectile.velocity.Y = projectile.velocity.Y + 0.05f;
}
}
num3 = num534;
}
projectile.MinionAntiClump();
Vector2 vector = projectile.position;
float num10 = 3000f; //300
bool flag = false;
+1 -24
View File
@@ -78,30 +78,7 @@ namespace CalamityMod.Projectiles.Summon
projectile.timeLeft = 2;
}
}
float num637 = 0.05f;
for (int num638 = 0; num638 < Main.maxProjectiles; num638++)
{
bool flag23 = Main.projectile[num638].type == ModContent.ProjectileType<Calamitamini>();
if (num638 != projectile.whoAmI && Main.projectile[num638].active && Main.projectile[num638].owner == projectile.owner && flag23 && Math.Abs(projectile.position.X - Main.projectile[num638].position.X) + Math.Abs(projectile.position.Y - Main.projectile[num638].position.Y) < (float)projectile.width)
{
if (projectile.position.X < Main.projectile[num638].position.X)
{
projectile.velocity.X = projectile.velocity.X - num637;
}
else
{
projectile.velocity.X = projectile.velocity.X + num637;
}
if (projectile.position.Y < Main.projectile[num638].position.Y)
{
projectile.velocity.Y = projectile.velocity.Y - num637;
}
else
{
projectile.velocity.Y = projectile.velocity.Y + num637;
}
}
}
projectile.MinionAntiClump();
bool flag24 = false;
if (flag24)
{
+1 -24
View File
@@ -77,30 +77,7 @@ namespace CalamityMod.Projectiles.Summon
projectile.timeLeft = 2;
}
}
float num637 = 0.05f;
for (int num638 = 0; num638 < Main.maxProjectiles; num638++)
{
bool flag23 = Main.projectile[num638].type == ModContent.ProjectileType<Cataclymini>();
if (num638 != projectile.whoAmI && Main.projectile[num638].active && Main.projectile[num638].owner == projectile.owner && flag23 && Math.Abs(projectile.position.X - Main.projectile[num638].position.X) + Math.Abs(projectile.position.Y - Main.projectile[num638].position.Y) < (float)projectile.width)
{
if (projectile.position.X < Main.projectile[num638].position.X)
{
projectile.velocity.X = projectile.velocity.X - num637;
}
else
{
projectile.velocity.X = projectile.velocity.X + num637;
}
if (projectile.position.Y < Main.projectile[num638].position.Y)
{
projectile.velocity.Y = projectile.velocity.Y - num637;
}
else
{
projectile.velocity.Y = projectile.velocity.Y + num637;
}
}
}
projectile.MinionAntiClump();
bool flag24 = false;
if (flag24)
{
+1 -1
View File
@@ -86,7 +86,7 @@ namespace CalamityMod.Projectiles.Summon
projectile.frame = 0;
}
CalamityGlobalProjectile.ChargingMinionAI(projectile, 700f, 1100f, 2400f, 150f, 0, 40f, 8f, -4f, 40f, 8f, false, true);
projectile.ChargingMinionAI(700f, 1100f, 2400f, 150f, 0, 40f, 8f, -4f, 40f, 8f, false, true);
}
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
+1 -16
View File
@@ -82,22 +82,7 @@ namespace CalamityMod.Projectiles.Summon
}
//Anti sticky movement to prevent minions from stacking
float antiStickyFloat = 0.05f;
for (int index = 0; index < Main.maxProjectiles; ++index)
{
Projectile proj = Main.projectile[index];
if (index != projectile.whoAmI && proj.active && (proj.owner == projectile.owner && proj.type == projectile.type) && (double) Math.Abs(projectile.position.X - proj.position.X) + Math.Abs(projectile.position.Y - proj.position.Y) < projectile.width)
{
if (projectile.position.X < proj.position.X)
projectile.velocity.X -= antiStickyFloat;
else
projectile.velocity.X += antiStickyFloat;
if (projectile.position.Y < proj.position.Y)
projectile.velocity.Y -= antiStickyFloat;
else
projectile.velocity.Y += antiStickyFloat;
}
}
projectile.MinionAntiClump();
//Set tile collision for only when trying to return to the player
projectile.tileCollide = projectile.ai[0] != 1f;
+1 -1
View File
@@ -101,7 +101,7 @@ namespace CalamityMod.Projectiles.Summon
projectile.frame = 0;
}
CalamityGlobalProjectile.ChargingMinionAI(projectile, 500f, 800f, 1200f, 400f, 0, 30f, 8f, -4f, 40f, 8f, false, true);
projectile.ChargingMinionAI(500f, 800f, 1200f, 400f, 0, 30f, 8f, -4f, 40f, 8f, false, true);
}
}
}
-24
View File
@@ -70,30 +70,6 @@ namespace CalamityMod.Projectiles.Summon
float num634 = 1600f; //800
float num635 = 2400f; //1200
float num636 = 800f;
float num637 = 0.05f;
for (int num638 = 0; num638 < Main.maxProjectiles; num638++)
{
bool flag23 = Main.projectile[num638].type == ModContent.ProjectileType<CosmicEnergySpiral>();
if (num638 != projectile.whoAmI && Main.projectile[num638].active && Main.projectile[num638].owner == projectile.owner && flag23 && Math.Abs(projectile.position.X - Main.projectile[num638].position.X) + Math.Abs(projectile.position.Y - Main.projectile[num638].position.Y) < (float)projectile.width)
{
if (projectile.position.X < Main.projectile[num638].position.X)
{
projectile.velocity.X = projectile.velocity.X - num637;
}
else
{
projectile.velocity.X = projectile.velocity.X + num637;
}
if (projectile.position.Y < Main.projectile[num638].position.Y)
{
projectile.velocity.Y = projectile.velocity.Y - num637;
}
else
{
projectile.velocity.Y = projectile.velocity.Y + num637;
}
}
}
projectile.rotation += projectile.velocity.X * 0.1f;
Vector2 vector46 = projectile.position;
bool flag25 = false;
Loaded 100 of 153 files, more files were not shown because too many files have changed in this diff. Show more