Merge branch 'master' of https://github.com/CalamityTeam/CalamityMod
This commit is contained in:
commit
ec9ef756a0
43 files changed
+897
-749
No files matched your search
@@ -10919,7 +10919,7 @@ namespace CalamityMod.CalPlayer
|
||||
public override void OnConsumeMana(Item item, int manaConsumed)
|
||||
{
|
||||
CalamityPlayer modPlayer = player.Calamity();
|
||||
if (Main.rand.NextBool(4) && modPlayer.lifeManaEnchant)
|
||||
if (Main.rand.NextBool(2) && modPlayer.lifeManaEnchant)
|
||||
{
|
||||
if (Main.myPlayer == player.whoAmI)
|
||||
{
|
||||
|
||||
@@ -3426,18 +3426,8 @@ namespace CalamityMod.CalPlayer
|
||||
player.maxMinions += 2;
|
||||
}
|
||||
|
||||
if (modPlayer.gArtifact)
|
||||
{
|
||||
player.maxMinions += 10;
|
||||
if (player.whoAmI == Main.myPlayer)
|
||||
{
|
||||
if (player.FindBuffIndex(ModContent.BuffType<YharonKindleBuff>()) == -1)
|
||||
player.AddBuff(ModContent.BuffType<YharonKindleBuff>(), 3600, true);
|
||||
|
||||
if (player.ownedProjectileCounts[ModContent.ProjectileType<SonOfYharon>()] < 2)
|
||||
Projectile.NewProjectile(player.Center, Vector2.Zero, ModContent.ProjectileType<SonOfYharon>(), (int)(AngryChickenStaff.Damage * player.MinionDamage()), 2f, Main.myPlayer, 0f, 0f);
|
||||
}
|
||||
}
|
||||
if (modPlayer.gArtifact && player.FindBuffIndex(ModContent.BuffType<YharonKindleBuff>()) != -1)
|
||||
player.maxMinions += player.ownedProjectileCounts[ModContent.ProjectileType<SonOfYharon>()];
|
||||
|
||||
if (modPlayer.pArtifact)
|
||||
{
|
||||
|
||||
@@ -86,8 +86,8 @@ namespace CalamityMod.CalPlayer
|
||||
if (modPlayer.ataxiaGeyser && player.ownedProjectileCounts[ProjectileType<ChaosGeyser>()] < 3)
|
||||
{
|
||||
// Ataxia True Melee Geysers: 15%, softcap starts at 300 base damage
|
||||
int cappedDamage = CalamityUtils.DamageSoftCap(damage * 0.15, 45);
|
||||
Projectile.NewProjectile(position, Vector2.Zero, ProjectileType<ChaosGeyser>(), cappedDamage, 2f, player.whoAmI, 0f, 0f);
|
||||
int geyserDamage = CalamityUtils.DamageSoftCap(damage * 0.15, 45);
|
||||
Projectile.NewProjectile(position, Vector2.Zero, ProjectileType<ChaosGeyser>(), geyserDamage, 2f, player.whoAmI, 0f, 0f);
|
||||
}
|
||||
if (modPlayer.soaring)
|
||||
{
|
||||
@@ -211,8 +211,8 @@ namespace CalamityMod.CalPlayer
|
||||
if (modPlayer.ataxiaGeyser && player.ownedProjectileCounts[ProjectileType<ChaosGeyser>()] < 3)
|
||||
{
|
||||
// Ataxia Melee Geysers: 15%, softcap starts at 240 base damage
|
||||
int cappedDamage = CalamityUtils.DamageSoftCap(proj.damage * 0.15, 36);
|
||||
Projectile.NewProjectile(proj.Center, Vector2.Zero, ProjectileType<ChaosGeyser>(), cappedDamage, 0f, player.whoAmI, 0f, 0f);
|
||||
int geyserDamage = CalamityUtils.DamageSoftCap(proj.damage * 0.15, 36);
|
||||
Projectile.NewProjectile(proj.Center, Vector2.Zero, ProjectileType<ChaosGeyser>(), geyserDamage, 0f, player.whoAmI, 0f, 0f);
|
||||
}
|
||||
if (modPlayer.bloodflareMelee && modProj.trueMelee)
|
||||
{
|
||||
@@ -294,8 +294,8 @@ namespace CalamityMod.CalPlayer
|
||||
{
|
||||
Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f);
|
||||
// Bloodflare Mage Fireballs: 3 x 50%, softcap starts at 500 base damage to not overly punish slow weapons
|
||||
int cappedDamage = CalamityUtils.DamageSoftCap(proj.damage * 0.5, 250);
|
||||
int fire = Projectile.NewProjectile(position, velocity, ProjectileID.BallofFire, cappedDamage, 0f, player.whoAmI);
|
||||
int bloodflareFireballDamage = CalamityUtils.DamageSoftCap(proj.damage * 0.5, 250);
|
||||
int fire = Projectile.NewProjectile(position, velocity, ProjectileID.BallofFire, bloodflareFireballDamage, 0f, player.whoAmI);
|
||||
if (fire.WithinBounds(Main.maxProjectiles))
|
||||
{
|
||||
Main.projectile[fire].Calamity().forceTypeless = true;
|
||||
@@ -308,26 +308,9 @@ namespace CalamityMod.CalPlayer
|
||||
{
|
||||
modPlayer.silvaMageCooldown = 300;
|
||||
Main.PlaySound(SoundID.Zombie, (int)proj.position.X, (int)proj.position.Y, 103);
|
||||
CalamityGlobalProjectile.ExpandHitboxBy(proj, 96);
|
||||
for (int d = 0; d < 3; d++)
|
||||
{
|
||||
Dust.NewDust(proj.position, proj.width, proj.height, 157, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.5f);
|
||||
}
|
||||
for (int d = 0; d < 30; d++)
|
||||
{
|
||||
int explode = Dust.NewDust(proj.position, proj.width, proj.height, 157, 0f, 0f, 0, new Color(Main.DiscoR, 203, 103), 2.5f);
|
||||
Main.dust[explode].noGravity = true;
|
||||
Main.dust[explode].velocity *= 3f;
|
||||
explode = Dust.NewDust(proj.position, proj.width, proj.height, 157, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.5f);
|
||||
Main.dust[explode].velocity *= 2f;
|
||||
Main.dust[explode].noGravity = true;
|
||||
}
|
||||
// Silva Mage Blasts: 300%
|
||||
proj.damage *= 3;
|
||||
proj.localNPCHitCooldown = 10;
|
||||
proj.usesLocalNPCImmunity = true;
|
||||
proj.Damage();
|
||||
proj.Kill();
|
||||
// Silva Mage Blasts: 800 + 60%, softcap on the whole combined thing starts at 1400
|
||||
int silvaBurstDamage = CalamityUtils.DamageSoftCap(800.0 + 0.6 * proj.damage, 1400);
|
||||
Projectile.NewProjectile(proj.Center, Vector2.Zero, ProjectileType<SilvaBurst>(), silvaBurstDamage, 8f, player.whoAmI);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
@@ -713,8 +696,8 @@ namespace CalamityMod.CalPlayer
|
||||
if (modPlayer.umbraphileSet && ((modProj.stealthStrike && modProj.stealthStrikeHitCount < 5) || Main.rand.NextBool(4)))
|
||||
{
|
||||
// Umbraphile Rogue Blasts: 25%, softcap starts at 200 base damage
|
||||
int blastDamage = CalamityUtils.DamageSoftCap(proj.damage * 0.25, 50);
|
||||
Projectile.NewProjectile(proj.Center, Vector2.Zero, ProjectileType<UmbraphileBoom>(), blastDamage, 0f, player.whoAmI);
|
||||
int umbraBlastDamage = CalamityUtils.DamageSoftCap(proj.damage * 0.25, 50);
|
||||
Projectile.NewProjectile(proj.Center, Vector2.Zero, ProjectileType<UmbraphileBoom>(), umbraBlastDamage, 0f, player.whoAmI);
|
||||
}
|
||||
|
||||
if (modPlayer.raiderTalisman && modPlayer.raiderStack < 150 && crit && modPlayer.raiderCooldown <= 0)
|
||||
|
||||
+4
-3
@@ -576,8 +576,8 @@ namespace CalamityMod
|
||||
ProjectileType<NorfleetCannon>(),
|
||||
ProjectileType<FlurrystormCannonShooting>(),
|
||||
|
||||
ProjectileType<PurgeProj>(),
|
||||
ProjectileType<T1000Proj>(),
|
||||
ProjectileType<NanoPurgeHoldout>(),
|
||||
ProjectileType<AetherfluxCannonHoldout>(),
|
||||
ProjectileType<YharimsCrystalPrism>(),
|
||||
ProjectileType<DarkSparkPrism>(),
|
||||
ProjectileType<YharimsCrystalBeam>(),
|
||||
@@ -2775,7 +2775,8 @@ namespace CalamityMod
|
||||
ProjectileType<SnapClamStealth>(),
|
||||
ProjectileType<StickyBol>(),
|
||||
ProjectileType<UrchinStingerProj>(),
|
||||
ProjectileType<EyeOfNightCell>()
|
||||
ProjectileType<EyeOfNightCell>(),
|
||||
ProjectileType<ViolenceThrownProjectile>(),
|
||||
};
|
||||
|
||||
bossTypes = new SortedDictionary<int, int>()
|
||||
|
||||
@@ -14,18 +14,18 @@ namespace CalamityMod.Items.Accessories
|
||||
{
|
||||
DisplayName.SetDefault("Godly Soul Artifact");
|
||||
Tooltip.SetDefault("Loyalty\n" +
|
||||
"Summons two Sons of Yharon to fight for you");
|
||||
"For each Son of Yharon you have summoned, you gain 1 minion slot");
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
item.width = 28;
|
||||
item.height = 28;
|
||||
item.accessory = true;
|
||||
item.rare = ItemRarityID.Red;
|
||||
item.Calamity().customRarity = CalamityRarity.Violet;
|
||||
item.value = CalamityGlobalItem.Rarity15BuyPrice;
|
||||
}
|
||||
item.accessory = true;
|
||||
item.rare = ItemRarityID.Red;
|
||||
item.Calamity().customRarity = CalamityRarity.Violet;
|
||||
item.value = CalamityGlobalItem.Rarity15BuyPrice;
|
||||
}
|
||||
|
||||
public override void UpdateAccessory(Player player, bool hideVisual)
|
||||
{
|
||||
@@ -36,10 +36,10 @@ namespace CalamityMod.Items.Accessories
|
||||
public override void AddRecipes()
|
||||
{
|
||||
ModRecipe recipe = new ModRecipe(mod);
|
||||
recipe.AddIngredient(ModContent.ItemType<ExodiumClusterOre>(), 25);
|
||||
recipe.AddIngredient(ModContent.ItemType<PlagueContainmentCells>(), 25);
|
||||
recipe.AddIngredient(ModContent.ItemType<HellcasterFragment>(), 5);
|
||||
recipe.AddTile(TileID.DemonAltar);
|
||||
recipe.AddIngredient(ModContent.ItemType<ExodiumClusterOre>(), 25);
|
||||
recipe.AddIngredient(ModContent.ItemType<PlagueContainmentCells>(), 25);
|
||||
recipe.AddIngredient(ModContent.ItemType<HellcasterFragment>(), 5);
|
||||
recipe.AddTile(TileID.DemonAltar);
|
||||
recipe.SetResult(this);
|
||||
recipe.AddRecipe();
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace CalamityMod.Items.Armor
|
||||
"Max run speed and acceleration boosted by 5%\n" +
|
||||
"If you are reduced to 1 HP you will not die from any further damage for 8 seconds\n" +
|
||||
"This effect only triggers once per life\n" +
|
||||
"Magic projectiles have a 10% chance to cause a massive explosion on enemy hits";
|
||||
"Magic projectiles which cannot pierce will occasionally set off potent blasts of nature energy";
|
||||
}
|
||||
|
||||
public override void UpdateEquip(Player player)
|
||||
|
||||
@@ -684,10 +684,6 @@ namespace CalamityMod.Items
|
||||
item.mana = 7;
|
||||
break;
|
||||
|
||||
case ItemID.LaserMachinegun:
|
||||
item.damage = 39;
|
||||
break;
|
||||
|
||||
case ItemID.StardustDragonStaff:
|
||||
item.damage = 20;
|
||||
item.useTime = 19;
|
||||
|
||||
@@ -2,7 +2,6 @@ using CalamityMod.Items.Materials;
|
||||
using CalamityMod.Projectiles.Magic;
|
||||
using CalamityMod.Tiles.Furniture.CraftingStations;
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
@@ -11,16 +10,18 @@ namespace CalamityMod.Items.Weapons.Magic
|
||||
{
|
||||
public class Climax : ModItem
|
||||
{
|
||||
public const int OrbFireRate = 10;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Voltaic Climax");
|
||||
Tooltip.SetDefault("Fires a circular spread of magnetic orbs around the mouse cursor");
|
||||
Tooltip.SetDefault("Conjures an octagon of supercharged magnet spheres around the cursor");
|
||||
Item.staff[item.type] = true;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
item.damage = 105;
|
||||
item.damage = 140;
|
||||
item.magic = true;
|
||||
item.mana = 30;
|
||||
item.width = 78;
|
||||
@@ -46,34 +47,17 @@ 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 num72 = item.shootSpeed;
|
||||
Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true);
|
||||
float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X;
|
||||
float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y;
|
||||
if (player.gravDir == -1f)
|
||||
int numOrbs = 8;
|
||||
Vector2 clickPos = Main.MouseWorld;
|
||||
float orbSpeed = 14f;
|
||||
Vector2 vel = Main.rand.NextVector2CircularEdge(orbSpeed, orbSpeed);
|
||||
for (int i = 0; i < numOrbs; i++)
|
||||
{
|
||||
num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y;
|
||||
}
|
||||
float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79));
|
||||
if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f))
|
||||
{
|
||||
num78 = (float)player.direction;
|
||||
num79 = 0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
num80 = num72 / num80;
|
||||
}
|
||||
vector2 += new Vector2(num78, num79);
|
||||
float spread = 45f * 0.0174f;
|
||||
double startAngle = Math.Atan2(speedX, speedY) - spread / 2;
|
||||
double deltaAngle = spread / 8f;
|
||||
double offsetAngle;
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i;
|
||||
Projectile.NewProjectile(vector2.X, vector2.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), type, damage, knockBack, player.whoAmI, 1f, 0f);
|
||||
Projectile.NewProjectile(vector2.X, vector2.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), type, damage, knockBack, player.whoAmI, 0f, 0f);
|
||||
// Choose random firing stagger values for each orb to create a desynchronized barrage of lasers
|
||||
float timingStagger = Main.rand.Next(OrbFireRate);
|
||||
Projectile.NewProjectile(clickPos, vel, type, damage, knockBack, player.whoAmI, ai0: timingStagger);
|
||||
|
||||
vel = vel.RotatedBy(MathHelper.TwoPi / numOrbs);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace CalamityMod.Items.Weapons.Magic
|
||||
item.width = 112;
|
||||
item.height = 112;
|
||||
item.magic = true;
|
||||
item.damage = 3875;
|
||||
item.damage = 3474;
|
||||
item.knockBack = 9.5f;
|
||||
item.mana = 26;
|
||||
item.useAnimation = 37;
|
||||
|
||||
@@ -8,6 +8,8 @@ namespace CalamityMod.Items.Weapons.Magic
|
||||
{
|
||||
public class Purge : ModItem
|
||||
{
|
||||
public const int UseTime = 20;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Nano Purge");
|
||||
@@ -16,23 +18,22 @@ namespace CalamityMod.Items.Weapons.Magic
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
item.damage = 50;
|
||||
item.damage = 66;
|
||||
item.magic = true;
|
||||
item.mana = 6;
|
||||
item.width = 20;
|
||||
item.height = 12;
|
||||
item.useTime = 20;
|
||||
item.useAnimation = 20;
|
||||
item.width = 62;
|
||||
item.height = 34;
|
||||
item.useTime = item.useAnimation = UseTime;
|
||||
item.useStyle = ItemUseStyleID.HoldingOut;
|
||||
item.noMelee = true;
|
||||
item.noUseGraphic = true;
|
||||
item.channel = true;
|
||||
item.knockBack = 3f;
|
||||
item.value = Item.buyPrice(0, 95, 0, 0);
|
||||
item.rare = ItemRarityID.Cyan;
|
||||
item.value = CalamityGlobalItem.Rarity9BuyPrice;
|
||||
item.autoReuse = true;
|
||||
item.shoot = ModContent.ProjectileType<PurgeProj>();
|
||||
item.shootSpeed = 24f;
|
||||
item.shoot = ModContent.ProjectileType<NanoPurgeHoldout>();
|
||||
item.shootSpeed = 16f;
|
||||
}
|
||||
|
||||
public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0;
|
||||
@@ -40,8 +41,8 @@ namespace CalamityMod.Items.Weapons.Magic
|
||||
public override void AddRecipes()
|
||||
{
|
||||
ModRecipe recipe = new ModRecipe(mod);
|
||||
recipe.AddIngredient(ItemID.FragmentVortex, 20);
|
||||
recipe.AddIngredient(ItemID.LaserMachinegun);
|
||||
recipe.AddIngredient(ItemID.FragmentVortex, 20);
|
||||
recipe.AddIngredient(ItemID.Nanites, 100);
|
||||
recipe.AddTile(TileID.LunarCraftingStation);
|
||||
recipe.SetResult(this);
|
||||
@@ -50,7 +51,9 @@ 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)
|
||||
{
|
||||
Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType<PurgeProj>(), damage, knockBack, player.whoAmI, 0f, 0f);
|
||||
Vector2 shootVelocity = new Vector2(speedX, speedY);
|
||||
Vector2 shootDirection = shootVelocity.SafeNormalize(Vector2.UnitX * player.direction);
|
||||
Projectile.NewProjectile(position, shootDirection, type, damage, knockBack, player.whoAmI);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,32 +10,34 @@ namespace CalamityMod.Items.Weapons.Magic
|
||||
{
|
||||
public class T1000 : ModItem
|
||||
{
|
||||
public const int UseTime = 36;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("T1000");
|
||||
Tooltip.SetDefault("Fires a spread of rainbow lasers");
|
||||
DisplayName.SetDefault("Aetherflux Cannon");
|
||||
Tooltip.SetDefault("Fires a barrage of phased god rays that pass through terrain");
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
item.damage = 250;
|
||||
item.damage = 171;
|
||||
item.magic = true;
|
||||
item.mana = 10;
|
||||
item.width = 20;
|
||||
item.height = 12;
|
||||
item.useTime = 12;
|
||||
item.useAnimation = 12;
|
||||
item.mana = 8;
|
||||
item.width = 94;
|
||||
item.height = 54;
|
||||
item.useTime = item.useAnimation = UseTime;
|
||||
item.useStyle = ItemUseStyleID.HoldingOut;
|
||||
item.noMelee = true;
|
||||
item.noUseGraphic = true;
|
||||
item.channel = true;
|
||||
item.knockBack = 4f;
|
||||
item.value = CalamityGlobalItem.Rarity15BuyPrice;
|
||||
item.rare = ItemRarityID.Purple;
|
||||
item.autoReuse = true;
|
||||
item.shoot = ModContent.ProjectileType<T1000Proj>();
|
||||
item.shoot = ModContent.ProjectileType<AetherfluxCannonHoldout>();
|
||||
item.shootSpeed = 24f;
|
||||
|
||||
item.rare = ItemRarityID.Purple;
|
||||
item.Calamity().customRarity = CalamityRarity.Violet;
|
||||
item.value = CalamityGlobalItem.Rarity15BuyPrice;
|
||||
}
|
||||
|
||||
public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0;
|
||||
@@ -44,7 +46,10 @@ namespace CalamityMod.Items.Weapons.Magic
|
||||
{
|
||||
ModRecipe recipe = new ModRecipe(mod);
|
||||
recipe.AddIngredient(ModContent.ItemType<Purge>());
|
||||
recipe.AddIngredient(ModContent.ItemType<PurgeGuzzler>());
|
||||
recipe.AddIngredient(ModContent.ItemType<AuricBar>(), 5);
|
||||
recipe.AddIngredient(ModContent.ItemType<UeliaceBar>(), 12);
|
||||
recipe.AddIngredient(ModContent.ItemType<DivineGeode>(), 8);
|
||||
recipe.AddTile(ModContent.TileType<CosmicAnvil>());
|
||||
recipe.SetResult(this);
|
||||
recipe.AddRecipe();
|
||||
@@ -52,7 +57,9 @@ 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)
|
||||
{
|
||||
Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType<T1000Proj>(), damage, knockBack, player.whoAmI, 0.0f, 0.0f);
|
||||
Vector2 shootVelocity = new Vector2(speedX, speedY);
|
||||
Vector2 shootDirection = shootVelocity.SafeNormalize(Vector2.UnitX * player.direction);
|
||||
Projectile.NewProjectile(position, shootDirection, type, damage, knockBack, player.whoAmI);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,46 +6,49 @@ using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Items.Weapons.Magic
|
||||
{
|
||||
public class Vehemenc : ModItem
|
||||
public class Vehemenc : ModItem
|
||||
{
|
||||
public const int VehemenceSkullDamage = 1250;
|
||||
public const int BaseDamage = 5185;
|
||||
public const float SkullRatio = 0.08f;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Vehemence");
|
||||
Tooltip.SetDefault("Casts an intense energy blast\n" +
|
||||
"Does far more damage the more HP an enemy has left\n" +
|
||||
"Max damage is capped at 200,000\n" +
|
||||
"If an enemy has full HP it will inflict Demon Flames for an extremely long time");
|
||||
Tooltip.SetDefault("Casts intense bolts of hellish power that explode into skulls\n" +
|
||||
"Direct hits inflict Demon Flames for an extended period of time");
|
||||
Item.staff[item.type] = true;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
item.damage = 3;
|
||||
item.damage = BaseDamage;
|
||||
item.magic = true;
|
||||
item.mana = 590;
|
||||
item.mana = 41;
|
||||
item.width = 44;
|
||||
item.height = 44;
|
||||
item.useTime = item.useAnimation = 50;
|
||||
item.useTime = item.useAnimation = 43;
|
||||
item.noUseGraphic = true;
|
||||
item.channel = true;
|
||||
item.useStyle = ItemUseStyleID.HoldingOut;
|
||||
item.noMelee = true;
|
||||
item.knockBack = 5.75f;
|
||||
item.value = Item.buyPrice(1, 0, 0, 0);
|
||||
item.rare = ItemRarityID.Red;
|
||||
item.UseSound = SoundID.Item73;
|
||||
item.autoReuse = true;
|
||||
item.shoot = ModContent.ProjectileType<VehemenceHoldout>();
|
||||
item.shootSpeed = 16f;
|
||||
|
||||
item.rare = ItemRarityID.Red;
|
||||
item.Calamity().customRarity = CalamityRarity.Violet;
|
||||
item.value = CalamityGlobalItem.Rarity15BuyPrice;
|
||||
}
|
||||
|
||||
public override Vector2? HoldoutOrigin() => new Vector2(25, 25);
|
||||
|
||||
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, Vector2.Zero, type, damage, knockBack, player.whoAmI);
|
||||
player.AddBuff(BuffID.ManaSickness, 600, true);
|
||||
Item v = player.ActiveItem();
|
||||
int chargeTime = 2 * v.useAnimation;
|
||||
Projectile.NewProjectile(position, Vector2.Zero, type, damage, knockBack, player.whoAmI, 0f, chargeTime);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using CalamityMod.Projectiles.Magic;
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
@@ -9,16 +8,18 @@ namespace CalamityMod.Items.Weapons.Magic
|
||||
{
|
||||
public class VoidVortex : ModItem
|
||||
{
|
||||
public const int OrbFireRate = 16;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Void Vortex");
|
||||
Tooltip.SetDefault("Fires a circular spread of magnetic orbs around the mouse cursor");
|
||||
Tooltip.SetDefault("Conjures a swirling vortex of supercharged magnet spheres around the cursor");
|
||||
Item.staff[item.type] = true;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
item.damage = 88;
|
||||
item.damage = 140;
|
||||
item.magic = true;
|
||||
item.mana = 60;
|
||||
item.width = 130;
|
||||
@@ -45,37 +46,22 @@ 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 num72 = item.shootSpeed;
|
||||
Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true);
|
||||
float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X;
|
||||
float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y;
|
||||
if (player.gravDir == -1f)
|
||||
int numOrbs = 12;
|
||||
Vector2 clickPos = Main.MouseWorld;
|
||||
float orbDistance = 48f;
|
||||
float orbSpeed = 5f;
|
||||
|
||||
float spinCoinflip = Main.rand.NextBool() ? -1f : 1f;
|
||||
Vector2 dir = Main.rand.NextVector2Unit();
|
||||
for (int i = 0; i < numOrbs; i++)
|
||||
{
|
||||
num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y;
|
||||
}
|
||||
float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79));
|
||||
if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f))
|
||||
{
|
||||
num78 = (float)player.direction;
|
||||
num79 = 0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
num80 = num72 / num80;
|
||||
}
|
||||
vector2 += new Vector2(num78, num79);
|
||||
float spread = 45f * 0.0174f;
|
||||
double startAngle = Math.Atan2(speedX, speedY) - spread / 2;
|
||||
double deltaAngle = spread / 8f;
|
||||
double offsetAngle;
|
||||
int i;
|
||||
float passedVar = 1f;
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i;
|
||||
Projectile.NewProjectile(vector2.X, vector2.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), type, damage, knockBack, player.whoAmI, passedVar, 0f);
|
||||
Projectile.NewProjectile(vector2.X, vector2.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), type, damage, knockBack, player.whoAmI, -passedVar, 0f);
|
||||
passedVar += 1f;
|
||||
Vector2 orbPos = clickPos + dir * orbDistance;
|
||||
Vector2 vel = dir.RotatedBy(spinCoinflip * MathHelper.PiOver2) * orbSpeed;
|
||||
|
||||
// Choose random firing stagger values for each orb to create a desynchronized barrage of lasers
|
||||
float timingStagger = Main.rand.Next(OrbFireRate);
|
||||
Projectile.NewProjectile(orbPos, vel, type, damage, knockBack, player.whoAmI, timingStagger, spinCoinflip);
|
||||
dir = dir.RotatedBy(MathHelper.TwoPi / numOrbs);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -12,29 +12,30 @@ namespace CalamityMod.Items.Weapons.Rogue
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Sacrifice");
|
||||
Tooltip.SetDefault("Releases a dagger that sticks to enemies\n" +
|
||||
"Right clicking causes all stuck daggers to fly back at you and give you life\n" +
|
||||
Tooltip.SetDefault("Throws sacrificial daggers that lodge themselves in enemies\n" +
|
||||
"Right click causes all stuck daggers to fly back at you and give you life\n" +
|
||||
"Daggers stuck to enemies release bloodsplosions over time\n" +
|
||||
"Stealth strikes provide much more life when returning to you");
|
||||
}
|
||||
|
||||
public override void SafeSetDefaults()
|
||||
{
|
||||
item.damage = 266;
|
||||
item.damage = 215;
|
||||
item.width = item.height = 68;
|
||||
item.useAnimation = item.useTime = 6;
|
||||
item.useAnimation = item.useTime = 9;
|
||||
item.noMelee = true;
|
||||
item.noUseGraphic = true;
|
||||
item.useStyle = ItemUseStyleID.SwingThrow;
|
||||
item.knockBack = 4f;
|
||||
item.rare = ItemRarityID.Purple;
|
||||
item.Calamity().customRarity = CalamityRarity.Violet;
|
||||
item.UseSound = SoundID.Item1;
|
||||
item.autoReuse = true;
|
||||
item.value = CalamityGlobalItem.RarityVioletBuyPrice;
|
||||
item.shoot = ModContent.ProjectileType<SacrificeProjectile>();
|
||||
item.shootSpeed = 12f;
|
||||
item.Calamity().rogue = true;
|
||||
|
||||
item.rare = ItemRarityID.Purple;
|
||||
item.Calamity().customRarity = CalamityRarity.Violet;
|
||||
item.value = CalamityGlobalItem.RarityVioletBuyPrice;
|
||||
}
|
||||
|
||||
public override bool AltFunctionUse(Player player) => player.ownedProjectileCounts[item.shoot] > 0;
|
||||
|
||||
@@ -506,8 +506,8 @@ namespace CalamityMod
|
||||
BossDifficulty.TryGetValue("StormWeaver", out float order);
|
||||
List<int> segments = new List<int>() { NPCType<StormWeaverHead>(), NPCType<StormWeaverBody>(), NPCType<StormWeaverTail>() };
|
||||
int summon = ItemType<RuneofCos>();
|
||||
List<int> loot = new List<int>() { ItemType<StormWeaverBag>(), ItemType<ArmoredShell>(), ItemType<TheStorm>(), ItemType<StormDragoon>(), ItemType<LittleLight>(), ItemType<SupremeHealingPotion>() };
|
||||
List<int> collection = new List<int>() { ItemType<WeaverTrophy>(), ItemType<StormWeaverMask>(), ItemType<GodSlayerHornedHelm>(), ItemType<GodSlayerVisage>(), ItemType<AncientGodSlayerHelm>(), ItemType<AncientGodSlayerChestplate>(), ItemType<AncientGodSlayerLeggings>(), ItemType<KnowledgeSentinels>() };
|
||||
List<int> loot = new List<int>() { ItemType<StormWeaverBag>(), ItemType<ArmoredShell>(), ItemType<TheStorm>(), ItemType<StormDragoon>(), ItemType<SupremeHealingPotion>() };
|
||||
List<int> collection = new List<int>() { ItemType<WeaverTrophy>(), ItemType<StormWeaverMask>(), ItemType<GodSlayerHornedHelm>(), ItemType<GodSlayerVisage>(), ItemType<AncientGodSlayerHelm>(), ItemType<AncientGodSlayerChestplate>(), ItemType<AncientGodSlayerLeggings>(), ItemType<KnowledgeSentinels>(), ItemType<LittleLight>() };
|
||||
string instructions = $"Use a [i:{summon}] in Space";
|
||||
string despawn = CalamityUtils.ColorMessage("Storm Weaver hid itself once again within the stormfront.", new Color(0xEE, 0x82, 0xEE));
|
||||
string bossLogTex = "CalamityMod/NPCs/StormWeaver/StormWeaver_BossChecklist";
|
||||
@@ -556,7 +556,7 @@ namespace CalamityMod
|
||||
int type = NPCType<DevourerofGodsHead>();
|
||||
int summon = ItemType<CosmicWorm>();
|
||||
List<int> loot = new List<int>() { ItemType<DevourerofGodsBag>(), ItemType<CosmiliteBar>(), ItemType<CosmiliteBrick>(), ItemType<Excelsus>(), ItemType<TheObliterator>(), ItemType<Deathwind>(), ItemType<DeathhailStaff>(), ItemType<StaffoftheMechworm>(), ItemType<Eradicator>(), ItemType<Skullmasher>(), ItemType<Norfleet>(), ItemType<CosmicDischarge>(), ItemType<NebulousCore>(), ItemType<Fabsol>(), ItemType<OmegaHealingPotion>() };
|
||||
List<int> collection = new List<int>() { ItemType<DevourerofGodsTrophy>(), ItemType<DevourerofGodsMask>(), ItemType<SilvaHornedHelm>(), ItemType<SilvaMask>(), ItemType<KnowledgeDevourerofGods>() };
|
||||
List<int> collection = new List<int>() { ItemType<DevourerofGodsTrophy>(), ItemType<DevourerofGodsMask>(), ItemType<SilvaHelm>(), ItemType<SilvaHornedHelm>(), ItemType<SilvaMask>(), ItemType<KnowledgeDevourerofGods>() };
|
||||
string instructions = $"Use a [i:{summon}]";
|
||||
string despawn = CalamityUtils.ColorMessage("The Devourer of Gods has slain everyone and feasted on their essence.", new Color(0x00, 0xFF, 0xFF));
|
||||
string bossLogTex = "CalamityMod/NPCs/DevourerofGods/DevourerofGods_BossChecklist";
|
||||
|
||||
+12
-12
@@ -3512,28 +3512,28 @@ namespace CalamityMod.NPCs
|
||||
}
|
||||
else if (ThanatosIDs.Contains(npc.type))
|
||||
{
|
||||
// 75% resist to Celestus.
|
||||
if (projectile.type == ProjectileType<CelestusBoomerang>() || projectile.type == ProjectileType<Celestus2>())
|
||||
// 75% resist to Celestus and Chicken Cannon.
|
||||
if (projectile.type == ProjectileType<CelestusBoomerang>() || projectile.type == ProjectileType<Celestus2>() || projectile.type == ProjectileType<ChickenExplosion>())
|
||||
damage = (int)(damage * 0.25);
|
||||
|
||||
// 65% resist to true melee and Hadopelagic Echo.
|
||||
else if (projectile.Calamity().trueMelee || projectile.type == ProjectileType<HadopelagicEchoSoundwave>())
|
||||
else if (projectile.Calamity().trueMelee || projectile.type == ProjectileType<HadopelagicEchoSoundwave>() || projectile.type == ProjectileType<HadopelagicEcho2>())
|
||||
damage = (int)(damage * 0.35);
|
||||
|
||||
// 50% resist to Chicken Cannon.
|
||||
if (projectile.type == ProjectileType<ChickenExplosion>())
|
||||
// 50% resist to Vehemence skulls.
|
||||
else if (projectile.type == ProjectileType<VehemenceSkull>())
|
||||
damage = (int)(damage * 0.5);
|
||||
|
||||
// 40% resist to Wrathwing stealth strike.
|
||||
else if (projectile.type == ProjectileType<WrathwingCinder>())
|
||||
// 40% resist to Wrathwing stealth strike, Rancor, and Yharim's Crystal.
|
||||
else if (projectile.type == ProjectileType<WrathwingCinder>() || projectile.type == ProjectileType<RancorLaserbeam>() || projectile.type == ProjectileType<YharimsCrystalBeam>())
|
||||
damage = (int)(damage * 0.6);
|
||||
|
||||
// 25% resist to Eradicator beams.
|
||||
else if (projectile.type == ProjectileType<NebulaShot>())
|
||||
damage = (int)(damage * 0.75);
|
||||
// 20% resist to Eradicator beams and Voltaic Climax / Void Vortex hitscan.
|
||||
else if (projectile.type == ProjectileType<NebulaShot>() || projectile.type == ProjectileType<ClimaxBeam>())
|
||||
damage = (int)(damage * 0.8);
|
||||
|
||||
// 15% resist to God Slayer Slugs and Luminite Bullets.
|
||||
else if (projectile.type == ProjectileID.MoonlordBullet || projectile.type == ProjectileType<GodSlayerSlugProj>())
|
||||
// 15% resist to God Slayer Slugs, Luminite Bullets, and Gruesome Eminence.
|
||||
else if (projectile.type == ProjectileID.MoonlordBullet || projectile.type == ProjectileType<GodSlayerSlugProj>() || projectile.type == ProjectileType<SpiritCongregation>())
|
||||
damage = (int)(damage * 0.85);
|
||||
|
||||
}
|
||||
|
||||
@@ -36,7 +36,6 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath
|
||||
npc.knockBackResist = BossRushEvent.BossRushActive ? 0f : 0.9f;
|
||||
animationType = NPCID.Bee;
|
||||
npc.HitSound = SoundID.NPCHit4;
|
||||
npc.DeathSound = SoundID.NPCDeath14;
|
||||
npc.noGravity = true;
|
||||
npc.noTileCollide = true;
|
||||
npc.canGhostHeal = false;
|
||||
@@ -264,6 +263,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath
|
||||
}
|
||||
if (npc.life <= 0)
|
||||
{
|
||||
Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/PlagueSounds/PlagueBoom" + Main.rand.Next(1, 5)), npc.Center);
|
||||
for (int k = 0; k < 10; k++)
|
||||
{
|
||||
Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Plague, hitDirection, -1f, 0, default, 1f);
|
||||
|
||||
@@ -34,7 +34,6 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath
|
||||
aiType = -1;
|
||||
npc.knockBackResist = BossRushEvent.BossRushActive ? 0f : 0.95f;
|
||||
npc.HitSound = SoundID.NPCHit4;
|
||||
npc.DeathSound = SoundID.NPCDeath14;
|
||||
npc.noGravity = true;
|
||||
npc.noTileCollide = true;
|
||||
npc.canGhostHeal = false;
|
||||
@@ -157,6 +156,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath
|
||||
}
|
||||
if (npc.life <= 0)
|
||||
{
|
||||
Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/PlagueSounds/PlagueBoom" + Main.rand.Next(1, 5)), npc.Center);
|
||||
for (int k = 0; k < 10; k++)
|
||||
{
|
||||
Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Plague, hitDirection, -1f, 0, default, 1f);
|
||||
|
||||
@@ -2584,87 +2584,92 @@ namespace CalamityMod.Projectiles
|
||||
|
||||
public static void MagnetSphereHitscan(Projectile projectile, float distanceRequired, float homingVelocity, float projectileTimer, int maxTargets, int spawnedProjectile, double damageMult = 1D, bool attackMultiple = false)
|
||||
{
|
||||
float maxDistance = distanceRequired;
|
||||
bool homeIn = false;
|
||||
int[] targetArray = new int[maxTargets];
|
||||
int targetArrayIndex = 0;
|
||||
// Only shoot once every N frames.
|
||||
projectile.localAI[0] += 1f;
|
||||
if (projectile.localAI[0] > projectileTimer)
|
||||
{
|
||||
projectile.localAI[0] = 0f;
|
||||
|
||||
for (int i = 0; i < Main.maxNPCs; i++)
|
||||
{
|
||||
if (Main.npc[i].CanBeChasedBy(projectile, false))
|
||||
{
|
||||
float extraDistance = (Main.npc[i].width / 2) + (Main.npc[i].height / 2);
|
||||
// Only search for targets if projectiles could be fired.
|
||||
float maxDistance = distanceRequired;
|
||||
bool homeIn = false;
|
||||
int[] targetArray = new int[maxTargets];
|
||||
int targetArrayIndex = 0;
|
||||
|
||||
bool canHit = true;
|
||||
if (extraDistance < maxDistance)
|
||||
canHit = Collision.CanHit(projectile.Center, 1, 1, Main.npc[i].Center, 1, 1);
|
||||
for (int i = 0; i < Main.maxNPCs; i++)
|
||||
{
|
||||
if (Main.npc[i].CanBeChasedBy(projectile, false))
|
||||
{
|
||||
float extraDistance = (Main.npc[i].width / 2) + (Main.npc[i].height / 2);
|
||||
|
||||
if (projectile.WithinRange(Main.npc[i].Center, maxDistance + extraDistance) && canHit)
|
||||
{
|
||||
if (targetArrayIndex < maxTargets)
|
||||
{
|
||||
targetArray[targetArrayIndex] = i;
|
||||
targetArrayIndex++;
|
||||
homeIn = true;
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
bool canHit = true;
|
||||
if (extraDistance < maxDistance)
|
||||
canHit = Collision.CanHit(projectile.Center, 1, 1, Main.npc[i].Center, 1, 1);
|
||||
|
||||
if (homeIn)
|
||||
{
|
||||
int randomTarget = Main.rand.Next(targetArrayIndex);
|
||||
randomTarget = targetArray[randomTarget];
|
||||
if (projectile.WithinRange(Main.npc[i].Center, maxDistance + extraDistance) && canHit)
|
||||
{
|
||||
if (targetArrayIndex < maxTargets)
|
||||
{
|
||||
targetArray[targetArrayIndex] = i;
|
||||
targetArrayIndex++;
|
||||
homeIn = true;
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
projectile.localAI[0] += 1f;
|
||||
if (projectile.localAI[0] > projectileTimer)
|
||||
{
|
||||
projectile.localAI[0] = 0f;
|
||||
Vector2 spawnPos = projectile.Center + projectile.velocity * 4f;
|
||||
Vector2 velocity = Vector2.Normalize(Main.npc[randomTarget].Center - spawnPos) * homingVelocity;
|
||||
// If there is anything to actually shoot at, pick targets at random and fire.
|
||||
if (homeIn)
|
||||
{
|
||||
int randomTarget = Main.rand.Next(targetArrayIndex);
|
||||
randomTarget = targetArray[randomTarget];
|
||||
|
||||
if (attackMultiple)
|
||||
{
|
||||
for (int i = 0; i < targetArrayIndex; i++)
|
||||
{
|
||||
velocity = Vector2.Normalize(Main.npc[targetArray[i]].Center - spawnPos) * homingVelocity;
|
||||
projectile.localAI[0] = 0f;
|
||||
Vector2 spawnPos = projectile.Center + projectile.velocity * 4f;
|
||||
Vector2 velocity = Vector2.Normalize(Main.npc[randomTarget].Center - spawnPos) * homingVelocity;
|
||||
|
||||
if (projectile.owner == Main.myPlayer)
|
||||
{
|
||||
int projectile2 = Projectile.NewProjectile(spawnPos, velocity, spawnedProjectile, (int)(projectile.damage * damageMult), projectile.knockBack, projectile.owner, 0f, 0f);
|
||||
if (attackMultiple)
|
||||
{
|
||||
for (int i = 0; i < targetArrayIndex; i++)
|
||||
{
|
||||
velocity = Vector2.Normalize(Main.npc[targetArray[i]].Center - spawnPos) * homingVelocity;
|
||||
|
||||
if (projectile.type == ProjectileType<EradicatorProjectile>())
|
||||
if (projectile.owner == Main.myPlayer)
|
||||
{
|
||||
int projectile2 = Projectile.NewProjectile(spawnPos, velocity, spawnedProjectile, (int)(projectile.damage * damageMult), projectile.knockBack, projectile.owner, 0f, 0f);
|
||||
|
||||
if (projectile.type == ProjectileType<EradicatorProjectile>())
|
||||
if (projectile2.WithinBounds(Main.maxProjectiles))
|
||||
Main.projectile[projectile2].Calamity().forceRogue = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (projectile.type == ProjectileType<GodsGambitYoyo>())
|
||||
{
|
||||
velocity.Y += Main.rand.Next(-30, 31) * 0.05f;
|
||||
velocity.X += Main.rand.Next(-30, 31) * 0.05f;
|
||||
}
|
||||
if (projectile.type == ProjectileType<GodsGambitYoyo>())
|
||||
{
|
||||
velocity.Y += Main.rand.Next(-30, 31) * 0.05f;
|
||||
velocity.X += Main.rand.Next(-30, 31) * 0.05f;
|
||||
}
|
||||
|
||||
if (projectile.owner == Main.myPlayer)
|
||||
{
|
||||
int projectile2 = Projectile.NewProjectile(spawnPos, velocity, spawnedProjectile, (int)(projectile.damage * damageMult), projectile.knockBack, projectile.owner, 0f, 0f);
|
||||
if (projectile.owner == Main.myPlayer)
|
||||
{
|
||||
int projectile2 = Projectile.NewProjectile(spawnPos, velocity, spawnedProjectile, (int)(projectile.damage * damageMult), projectile.knockBack, projectile.owner, 0f, 0f);
|
||||
|
||||
if (projectile.type == ProjectileType<CnidarianYoyo>() || projectile.type == ProjectileType<GodsGambitYoyo>() ||
|
||||
projectile.type == ProjectileType<ShimmersparkYoyo>() || projectile.type == ProjectileType<VerdantYoyo>())
|
||||
if (projectile.type == ProjectileType<CnidarianYoyo>() || projectile.type == ProjectileType<GodsGambitYoyo>() ||
|
||||
projectile.type == ProjectileType<ShimmersparkYoyo>() || projectile.type == ProjectileType<VerdantYoyo>())
|
||||
if (projectile2.WithinBounds(Main.maxProjectiles))
|
||||
Main.projectile[projectile2].Calamity().forceMelee = true;
|
||||
|
||||
if (projectile.type == ProjectileType<SeashellBoomerangProjectile>())
|
||||
if (projectile2.WithinBounds(Main.maxProjectiles))
|
||||
Main.projectile[projectile2].Calamity().forceRogue = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void ExpandHitboxBy(Projectile projectile, int width, int height)
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 153 B After Width: | Height: | Size: 154 B |
@@ -0,0 +1,183 @@
|
||||
using CalamityMod.Items.Weapons.Magic;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Magic
|
||||
{
|
||||
public class AetherfluxCannonHoldout : ModProjectile
|
||||
{
|
||||
private const int FramesPerFireRateIncrease = 36;
|
||||
|
||||
private Player Owner => Main.player[projectile.owner];
|
||||
private bool OwnerCanShoot => Owner.channel && Owner.HasAmmo(Owner.ActiveItem(), true) && !Owner.noItems && !Owner.CCed;
|
||||
|
||||
private ref float DeployedFrames => ref projectile.ai[0];
|
||||
private ref float AnimationRate => ref projectile.ai[1];
|
||||
private ref float LastShootAttemptTime => ref projectile.localAI[0];
|
||||
private ref float LastAnimationTime => ref projectile.localAI[1];
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Aetherflux Cannon");
|
||||
Main.projFrames[projectile.type] = 8;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
projectile.width = 58;
|
||||
projectile.height = 94;
|
||||
projectile.friendly = true;
|
||||
projectile.penetrate = -1;
|
||||
projectile.tileCollide = false;
|
||||
projectile.ignoreWater = true;
|
||||
projectile.magic = true;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Vector2 armPosition = Owner.RotatedRelativePoint(Owner.MountedCenter, true);
|
||||
Vector2 gunBarrelPos = armPosition + projectile.velocity * projectile.height * 0.4f;
|
||||
|
||||
// If the player is unable to continue using the holdout, delete it.
|
||||
if (!OwnerCanShoot)
|
||||
{
|
||||
projectile.Kill();
|
||||
return;
|
||||
}
|
||||
|
||||
// Play a sound frame 1.
|
||||
if (DeployedFrames <= 0f)
|
||||
{
|
||||
var sound = Main.PlaySound(SoundID.DD2_DarkMageCastHeal, projectile.Center);
|
||||
if (sound != null)
|
||||
sound.Volume *= 1.5f;
|
||||
}
|
||||
|
||||
// Update damage based on curent magic damage stat (so Mana Sickness affects it)
|
||||
Item weaponItem = Owner.ActiveItem();
|
||||
projectile.damage = (int)((weaponItem?.damage ?? 0) * Owner.MagicDamage());
|
||||
|
||||
// Get the original weapon's use time.
|
||||
int itemUseTime = weaponItem?.useAnimation ?? T1000.UseTime;
|
||||
// 36, base use time, will result in 5. Speed increasing reforges push it to 4.
|
||||
int framesPerShot = itemUseTime / 7;
|
||||
|
||||
// Update time.
|
||||
DeployedFrames += 1f;
|
||||
|
||||
// Determine animation rate. If the gun is spinning up, it increases linearly. Otherwise it's maxed.
|
||||
AnimationRate = DeployedFrames >= itemUseTime ? 2f : MathHelper.Lerp(7f, 2f, DeployedFrames / itemUseTime);
|
||||
|
||||
// Update the animation. This occurs even when firing is not occurring.
|
||||
if (DeployedFrames - LastAnimationTime >= AnimationRate)
|
||||
{
|
||||
LastAnimationTime = DeployedFrames;
|
||||
projectile.frame = (projectile.frame + 1) % Main.projFrames[projectile.type];
|
||||
}
|
||||
|
||||
// Once past the initial spin-up time, fire constantly as long as mana is available.
|
||||
// Before the spin-up is done, sparks are produced but no lasers come out (and no mana is consumed).
|
||||
if (DeployedFrames - LastShootAttemptTime >= framesPerShot)
|
||||
{
|
||||
LastShootAttemptTime = DeployedFrames;
|
||||
bool actuallyShoot = DeployedFrames >= itemUseTime;
|
||||
bool manaOK = !actuallyShoot || Owner.CheckMana(Owner.ActiveItem(), -1, true, false);
|
||||
if (manaOK)
|
||||
{
|
||||
if (actuallyShoot)
|
||||
Main.PlaySound(SoundID.Item91, projectile.Center);
|
||||
|
||||
int projID = ModContent.ProjectileType<PhasedGodRay>();
|
||||
float shootSpeed = weaponItem.shootSpeed;
|
||||
Vector2 shootDirection = projectile.velocity.SafeNormalize(Vector2.UnitY);
|
||||
Vector2 shootVelocity = shootDirection * shootSpeed;
|
||||
|
||||
// Waving beams need to start offset so they cross each other neatly.
|
||||
float waveSideOffset = Main.rand.NextFloat(18f, 28f);
|
||||
Vector2 perp = shootDirection.RotatedBy(-MathHelper.PiOver2) * waveSideOffset;
|
||||
|
||||
// Dust chaotically sheds off the crystal while charging or firing.
|
||||
float dustInaccuracy = 0.045f;
|
||||
|
||||
for (int i = -1; i <= 1 ; i += 2)
|
||||
{
|
||||
Vector2 laserStartPos = gunBarrelPos + i * perp + Main.rand.NextVector2CircularEdge(6f, 6f);
|
||||
Vector2 dustOnlySpread = Main.rand.NextVector2Circular(shootSpeed, shootSpeed);
|
||||
Vector2 dustVelocity = shootVelocity + dustInaccuracy * dustOnlySpread;
|
||||
if (actuallyShoot)
|
||||
{
|
||||
Projectile godRay = Projectile.NewProjectileDirect(laserStartPos, shootVelocity, projID, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f);
|
||||
// Tell this Phased God Ray exactly which way it should be waving.
|
||||
godRay.localAI[1] = i * 0.5f;
|
||||
}
|
||||
SpawnFiringDust(gunBarrelPos, dustVelocity);
|
||||
}
|
||||
}
|
||||
|
||||
// Delete the laser gun if a mana cost cannot be paid.
|
||||
else
|
||||
{
|
||||
projectile.Kill();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
UpdateProjectileHeldVariables(armPosition);
|
||||
ManipulatePlayerVariables();
|
||||
}
|
||||
|
||||
private void UpdateProjectileHeldVariables(Vector2 armPosition)
|
||||
{
|
||||
if (Main.myPlayer == projectile.owner)
|
||||
{
|
||||
float interpolant = Utils.InverseLerp(5f, 25f, projectile.Distance(Main.MouseWorld), true);
|
||||
Vector2 oldVelocity = projectile.velocity;
|
||||
projectile.velocity = Vector2.Lerp(projectile.velocity, projectile.SafeDirectionTo(Main.MouseWorld), interpolant);
|
||||
if (projectile.velocity != oldVelocity)
|
||||
{
|
||||
projectile.netSpam = 0;
|
||||
projectile.netUpdate = true;
|
||||
}
|
||||
}
|
||||
|
||||
projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2;
|
||||
projectile.Center = armPosition + projectile.velocity.SafeNormalize(Vector2.UnitX * Owner.direction) * 8f;
|
||||
projectile.spriteDirection = projectile.direction;
|
||||
projectile.timeLeft = 2;
|
||||
}
|
||||
|
||||
private void ManipulatePlayerVariables()
|
||||
{
|
||||
Owner.ChangeDir(projectile.direction);
|
||||
Owner.heldProj = projectile.whoAmI;
|
||||
Owner.itemTime = 2;
|
||||
Owner.itemAnimation = 2;
|
||||
Owner.itemRotation = (projectile.velocity * projectile.direction).ToRotation();
|
||||
}
|
||||
|
||||
private void SpawnFiringDust(Vector2 gunBarrelPos, Vector2 laserVelocity)
|
||||
{
|
||||
int dustID = 133;
|
||||
int dustRadius = 12;
|
||||
float dustRandomness = 11f;
|
||||
int dustDiameter = 2 * dustRadius;
|
||||
Vector2 dustCorner = gunBarrelPos - Vector2.One * dustRadius;
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
Vector2 dustVel = laserVelocity + Main.rand.NextVector2Circular(dustRandomness, dustRandomness);
|
||||
Dust d = Dust.NewDustDirect(dustCorner, dustDiameter, dustDiameter, dustID, dustVel.X, dustVel.Y);
|
||||
d.velocity *= 0.18f;
|
||||
d.noGravity = true;
|
||||
d.scale = 0.6f;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool CanDamage() => false;
|
||||
|
||||
// prevents the item from appearing backwards frame 1
|
||||
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => FramesPerFireRateIncrease > 0f;
|
||||
}
|
||||
}
|
||||
File renamed without changes.
|
Before Width: | Height: | Size: 6.8 KiB After Width: | Height: | Size: 6.8 KiB |
@@ -20,18 +20,18 @@ namespace CalamityMod.Projectiles.Magic
|
||||
projectile.friendly = true;
|
||||
projectile.timeLeft = 90;
|
||||
projectile.magic = true;
|
||||
projectile.ignoreWater = true;
|
||||
projectile.ignoreWater = true;
|
||||
projectile.tileCollide = false;
|
||||
}
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Vector2 vector33 = projectile.position;
|
||||
vector33 -= projectile.velocity * 0.25f;
|
||||
int num448 = Dust.NewDust(vector33, 1, 1, 206, 0f, 0f, 0, default, 1.25f);
|
||||
Main.dust[num448].position = vector33;
|
||||
Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f;
|
||||
Main.dust[num448].velocity *= 0.1f;
|
||||
}
|
||||
public override void AI()
|
||||
{
|
||||
Vector2 vector33 = projectile.position;
|
||||
vector33 -= projectile.velocity * 0.25f;
|
||||
int num448 = Dust.NewDust(vector33, 1, 1, 206, 0f, 0f, 0, default, 1.25f);
|
||||
Main.dust[num448].position = vector33;
|
||||
Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f;
|
||||
Main.dust[num448].velocity *= 0.1f;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,9 @@
|
||||
using CalamityMod.Items.Weapons.Magic;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Magic
|
||||
{
|
||||
public class ClimaxProj : ModProjectile
|
||||
@@ -18,27 +19,25 @@ namespace CalamityMod.Projectiles.Magic
|
||||
projectile.width = 38;
|
||||
projectile.height = 38;
|
||||
projectile.friendly = true;
|
||||
projectile.light = 0.5f;
|
||||
projectile.tileCollide = false;
|
||||
projectile.penetrate = -1;
|
||||
projectile.timeLeft = 96;
|
||||
projectile.timeLeft = 48;
|
||||
projectile.magic = true;
|
||||
projectile.ignoreWater = true;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
projectile.velocity *= 0.96f;
|
||||
// Rapidly screech to a halt once spawned.
|
||||
projectile.velocity *= 0.86f;
|
||||
|
||||
if (projectile.velocity.X > 0f)
|
||||
{
|
||||
projectile.rotation += (Math.Abs(projectile.velocity.Y) + Math.Abs(projectile.velocity.X)) * 0.001f;
|
||||
}
|
||||
else
|
||||
{
|
||||
projectile.rotation -= (Math.Abs(projectile.velocity.Y) + Math.Abs(projectile.velocity.X)) * 0.001f;
|
||||
}
|
||||
// Spin chaotically given a pre-defined spin direction. Choose one initially at random.
|
||||
float spinTheta = 0.11f;
|
||||
if (projectile.localAI[1] == 0f)
|
||||
projectile.localAI[1] = Main.rand.NextBool() ? -spinTheta : spinTheta;
|
||||
projectile.rotation += projectile.localAI[1];
|
||||
|
||||
// Animate the lightning orb.
|
||||
projectile.frameCounter++;
|
||||
if (projectile.frameCounter > 6)
|
||||
{
|
||||
@@ -50,8 +49,11 @@ namespace CalamityMod.Projectiles.Magic
|
||||
}
|
||||
}
|
||||
|
||||
if (projectile.timeLeft % 4 == projectile.ai[0])
|
||||
CalamityGlobalProjectile.MagnetSphereHitscan(projectile, 300f, 8f, 4f, 2, ModContent.ProjectileType<ClimaxBeam>(), 1D, true);
|
||||
// Initial stagger in frames needs to be skipped over before it starts shooting,
|
||||
// but once it's past that then it can fire constantly
|
||||
--projectile.ai[0];
|
||||
if (projectile.ai[0] < 0f)
|
||||
CalamityGlobalProjectile.MagnetSphereHitscan(projectile, 400f, 8f, Climax.OrbFireRate, 2, ModContent.ProjectileType<ClimaxBeam>(), 1D, true);
|
||||
}
|
||||
|
||||
public override Color? GetAlpha(Color lightColor)
|
||||
|
||||
@@ -31,19 +31,19 @@ namespace CalamityMod.Projectiles.Magic
|
||||
projectile.usesLocalNPCImmunity = true;
|
||||
projectile.localNPCHitCooldown = -1;
|
||||
projectile.timeLeft = 30;
|
||||
projectile.extraUpdates = 1;
|
||||
projectile.tileCollide = false;
|
||||
projectile.extraUpdates = 1;
|
||||
projectile.tileCollide = false;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
projectile.width = (int)(36f * projectile.scale);
|
||||
projectile.height = (int)(36f * projectile.scale);
|
||||
projectile.height = (int)(36f * projectile.scale);
|
||||
|
||||
if (projectile.alpha > 100)
|
||||
projectile.alpha -= 25;
|
||||
if (projectile.alpha < 100)
|
||||
projectile.alpha = 100;
|
||||
if (projectile.alpha < 100)
|
||||
projectile.alpha = 100;
|
||||
|
||||
projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X);
|
||||
}
|
||||
|
||||
@@ -11,9 +11,9 @@ namespace CalamityMod.Projectiles.Magic
|
||||
{
|
||||
public override string Texture => "CalamityMod/Projectiles/Magic/EidolicWailSoundwave";
|
||||
|
||||
private int echoCooldown = 0;
|
||||
private bool playedSound = false;
|
||||
private static int penetrationAmt = 50;
|
||||
private int echoCooldown = 0;
|
||||
private bool playedSound = false;
|
||||
private static int penetrationAmt = 50;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
@@ -35,20 +35,20 @@ namespace CalamityMod.Projectiles.Magic
|
||||
projectile.usesLocalNPCImmunity = true;
|
||||
projectile.localNPCHitCooldown = 8;
|
||||
projectile.timeLeft = 450;
|
||||
projectile.Calamity().PierceResistHarshness = 0.06f;
|
||||
projectile.Calamity().PierceResistCap = 0.4f;
|
||||
}
|
||||
projectile.Calamity().PierceResistHarshness = 0.06f;
|
||||
projectile.Calamity().PierceResistCap = 0.4f;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
if (projectile.ai[0] == 0f || projectile.ai[0] == 4f)
|
||||
{
|
||||
if (!playedSound)
|
||||
{
|
||||
Main.PlaySound(Main.rand.NextBool(100) ? mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/Sunskater") : mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/WyrmScream"), (int)projectile.Center.X, (int)projectile.Center.Y);
|
||||
playedSound = true;
|
||||
}
|
||||
}
|
||||
if (projectile.ai[0] == 0f || projectile.ai[0] == 4f)
|
||||
{
|
||||
if (!playedSound)
|
||||
{
|
||||
Main.PlaySound(Main.rand.NextBool(100) ? mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/Sunskater") : mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/WyrmScream"), (int)projectile.Center.X, (int)projectile.Center.Y);
|
||||
playedSound = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (projectile.localAI[0] < 1f)
|
||||
{
|
||||
@@ -63,8 +63,8 @@ namespace CalamityMod.Projectiles.Magic
|
||||
projectile.height = 36;
|
||||
}
|
||||
|
||||
if (echoCooldown > 0)
|
||||
echoCooldown--;
|
||||
if (echoCooldown > 0)
|
||||
echoCooldown--;
|
||||
|
||||
projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X);
|
||||
}
|
||||
@@ -97,28 +97,28 @@ namespace CalamityMod.Projectiles.Magic
|
||||
target.AddBuff(BuffID.Electrified, 600);
|
||||
projectile.velocity *= 0.85f;
|
||||
|
||||
if (echoCooldown <= 0)
|
||||
{
|
||||
echoCooldown = 60;
|
||||
int echoID = ModContent.ProjectileType<HadopelagicEcho2>();
|
||||
int echoDamage = (int)(0.2f * projectile.damage);
|
||||
float echoKB = projectile.knockBack / 3;
|
||||
int echos = 5;
|
||||
for (int i = 0; i < echos; ++i)
|
||||
{
|
||||
float startDist = Main.rand.NextFloat(260f, 270f);
|
||||
Vector2 startDir = Main.rand.NextVector2Unit();
|
||||
Vector2 startPoint = target.Center + (startDir * startDist);
|
||||
if (echoCooldown <= 0)
|
||||
{
|
||||
echoCooldown = 60;
|
||||
int echoID = ModContent.ProjectileType<HadopelagicEcho2>();
|
||||
int echoDamage = (int)(0.2f * projectile.damage);
|
||||
float echoKB = projectile.knockBack / 3;
|
||||
int echos = 5;
|
||||
for (int i = 0; i < echos; ++i)
|
||||
{
|
||||
float startDist = Main.rand.NextFloat(260f, 270f);
|
||||
Vector2 startDir = Main.rand.NextVector2Unit();
|
||||
Vector2 startPoint = target.Center + (startDir * startDist);
|
||||
|
||||
float echoSpeed = Main.rand.NextFloat(15f, 18f);
|
||||
Vector2 velocity = startDir * (-echoSpeed);
|
||||
float echoSpeed = Main.rand.NextFloat(15f, 18f);
|
||||
Vector2 velocity = startDir * (-echoSpeed);
|
||||
|
||||
if (projectile.owner == Main.myPlayer)
|
||||
{
|
||||
Projectile.NewProjectile(startPoint, velocity, echoID, echoDamage, echoKB, projectile.owner);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (projectile.owner == Main.myPlayer)
|
||||
{
|
||||
Projectile.NewProjectile(startPoint, velocity, echoID, echoDamage, echoKB, projectile.owner);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override Color? GetAlpha(Color lightColor)
|
||||
|
||||
@@ -0,0 +1,157 @@
|
||||
using CalamityMod.Items.Weapons.Magic;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Magic
|
||||
{
|
||||
public class NanoPurgeHoldout : ModProjectile
|
||||
{
|
||||
private const int FramesPerFireRateIncrease = 36;
|
||||
private static int[] LaserOffsetByAnimationFrame = { 4, 3, 0, 3 };
|
||||
|
||||
private Player Owner => Main.player[projectile.owner];
|
||||
private bool OwnerCanShoot => Owner.channel && Owner.HasAmmo(Owner.ActiveItem(), true) && !Owner.noItems && !Owner.CCed;
|
||||
private ref float DeployedFrames => ref projectile.ai[0];
|
||||
private ref float ChargeTowardsNextShot => ref projectile.ai[1];
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Nano Purge");
|
||||
Main.projFrames[projectile.type] = 4;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
projectile.width = 34;
|
||||
projectile.height = 62;
|
||||
projectile.friendly = true;
|
||||
projectile.penetrate = -1;
|
||||
projectile.tileCollide = false;
|
||||
projectile.ignoreWater = true;
|
||||
projectile.magic = true;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Vector2 armPosition = Owner.RotatedRelativePoint(Owner.MountedCenter, true);
|
||||
Vector2 gunBarrelPos = armPosition + projectile.velocity * projectile.height * 0.5f;
|
||||
|
||||
// If the player is unable to continue using the holdout, delete it.
|
||||
if (!OwnerCanShoot)
|
||||
{
|
||||
projectile.Kill();
|
||||
return;
|
||||
}
|
||||
|
||||
// Update damage based on curent magic damage stat (so Mana Sickness affects it)
|
||||
Item nanoPurge = Owner.ActiveItem();
|
||||
projectile.damage = (int)((nanoPurge?.damage ?? 0) * Owner.MagicDamage());
|
||||
|
||||
// Get the original weapon's use time.
|
||||
int itemUseTime = nanoPurge?.useAnimation ?? Purge.UseTime;
|
||||
|
||||
// Update time.
|
||||
DeployedFrames += 1f;
|
||||
|
||||
// Choose fire rate multiplier (1x, 2x, 3x, 4x) based on current time spent firing.
|
||||
int fireRate = (int)MathHelper.Clamp(DeployedFrames / FramesPerFireRateIncrease, 1f, 4f);
|
||||
|
||||
// Increment counter towards the item's use time by an amount equal to the current fire rate.
|
||||
ChargeTowardsNextShot += fireRate;
|
||||
|
||||
// If enough charging progress is made, perform a shoot event if enough mana is available.
|
||||
if (ChargeTowardsNextShot >= itemUseTime)
|
||||
{
|
||||
ChargeTowardsNextShot -= itemUseTime;
|
||||
|
||||
// Update the animation.
|
||||
projectile.frame = (projectile.frame + 1) % Main.projFrames[projectile.type];
|
||||
|
||||
bool manaCostPaid = Owner.CheckMana(Owner.ActiveItem(), -1, true, false);
|
||||
if (manaCostPaid)
|
||||
{
|
||||
Main.PlaySound(SoundID.Item91, projectile.Center);
|
||||
|
||||
int projID = ModContent.ProjectileType<NanoPurgeLaser>();
|
||||
float shootSpeed = nanoPurge.shootSpeed;
|
||||
float inaccuracyRatio = 0.045f;
|
||||
Vector2 shootDirection = projectile.velocity.SafeNormalize(Vector2.UnitY);
|
||||
Vector2 perp = shootDirection.RotatedBy(MathHelper.PiOver2);
|
||||
|
||||
// Fire a pair of lasers, one with a negative offset, one with a positive offset.
|
||||
for (int i = -1; i <= 1; i += 2)
|
||||
{
|
||||
Vector2 spread = Main.rand.NextVector2CircularEdge(shootSpeed, shootSpeed);
|
||||
Vector2 shootVelocity = shootDirection * shootSpeed + inaccuracyRatio * spread;
|
||||
Vector2 splitBarrelPos = gunBarrelPos + i * LaserOffsetByAnimationFrame[projectile.frame] * perp;
|
||||
Projectile.NewProjectile(splitBarrelPos, shootVelocity, projID, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f);
|
||||
SpawnFiringDust(splitBarrelPos, shootVelocity);
|
||||
}
|
||||
}
|
||||
|
||||
// Delete the laser gun if a mana cost cannot be paid.
|
||||
else
|
||||
{
|
||||
projectile.Kill();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
UpdateProjectileHeldVariables(armPosition);
|
||||
ManipulatePlayerVariables();
|
||||
}
|
||||
|
||||
private void UpdateProjectileHeldVariables(Vector2 armPosition)
|
||||
{
|
||||
if (Main.myPlayer == projectile.owner)
|
||||
{
|
||||
float interpolant = Utils.InverseLerp(5f, 25f, projectile.Distance(Main.MouseWorld), true);
|
||||
Vector2 oldVelocity = projectile.velocity;
|
||||
projectile.velocity = Vector2.Lerp(projectile.velocity, projectile.SafeDirectionTo(Main.MouseWorld), interpolant);
|
||||
if (projectile.velocity != oldVelocity)
|
||||
{
|
||||
projectile.netSpam = 0;
|
||||
projectile.netUpdate = true;
|
||||
}
|
||||
}
|
||||
|
||||
projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2;
|
||||
projectile.Center = armPosition + projectile.velocity.SafeNormalize(Vector2.UnitX * Owner.direction) * 8f;
|
||||
projectile.spriteDirection = projectile.direction;
|
||||
projectile.timeLeft = 2;
|
||||
}
|
||||
|
||||
private void ManipulatePlayerVariables()
|
||||
{
|
||||
Owner.ChangeDir(projectile.direction);
|
||||
Owner.heldProj = projectile.whoAmI;
|
||||
Owner.itemTime = 2;
|
||||
Owner.itemAnimation = 2;
|
||||
Owner.itemRotation = (projectile.velocity * projectile.direction).ToRotation();
|
||||
}
|
||||
|
||||
private void SpawnFiringDust(Vector2 gunBarrelPos, Vector2 laserVelocity)
|
||||
{
|
||||
int dustID = 107;
|
||||
int dustRadius = 5;
|
||||
int dustDiameter = 2 * dustRadius;
|
||||
Vector2 dustCorner = gunBarrelPos - Vector2.One * dustRadius;
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
Vector2 dustVel = laserVelocity + Main.rand.NextVector2Circular(7f, 7f);
|
||||
Dust d = Dust.NewDustDirect(dustCorner, dustDiameter, dustDiameter, dustID, dustVel.X, dustVel.Y);
|
||||
d.velocity *= 0.125f;
|
||||
d.noGravity = true;
|
||||
d.scale = 1.4f;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool CanDamage() => false;
|
||||
|
||||
// prevents the item from appearing backwards frame 1
|
||||
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => DeployedFrames > 0f;
|
||||
}
|
||||
}
|
||||
File renamed without changes.
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
@@ -4,13 +4,16 @@ using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
namespace CalamityMod.Projectiles.Magic
|
||||
{
|
||||
public class PurgeLaser : ModProjectile
|
||||
public class NanoPurgeLaser : ModProjectile
|
||||
{
|
||||
private const float LaserLength = 40f;
|
||||
private const float LaserLengthChangeRate = 1.5f;
|
||||
|
||||
public override string Texture => "CalamityMod/Projectiles/LaserProj";
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Laser");
|
||||
DisplayName.SetDefault("Nano Beam");
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
@@ -27,47 +30,48 @@ namespace CalamityMod.Projectiles.Magic
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
// Very rapidly fade into existence.
|
||||
if (projectile.alpha > 0)
|
||||
{
|
||||
projectile.alpha -= 25;
|
||||
}
|
||||
if (projectile.alpha < 0)
|
||||
{
|
||||
projectile.alpha = 0;
|
||||
}
|
||||
Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, 0f, 0.7f, 0.1f);
|
||||
float num55 = 100f;
|
||||
float num56 = 3f;
|
||||
|
||||
// Emit light.
|
||||
Lighting.AddLight(projectile.Center, 0f, 0.7f, 0.1f);
|
||||
|
||||
// Laser length shenanigans. If the laser is still growing, increase localAI 0 to indicate it is getting longer.
|
||||
if (projectile.ai[1] == 0f)
|
||||
{
|
||||
projectile.localAI[0] += num56;
|
||||
if (projectile.localAI[0] > num55)
|
||||
{
|
||||
projectile.localAI[0] = num55;
|
||||
}
|
||||
projectile.localAI[0] += LaserLengthChangeRate;
|
||||
|
||||
// Cap it at max length.
|
||||
if (projectile.localAI[0] > LaserLength)
|
||||
projectile.localAI[0] = LaserLength;
|
||||
}
|
||||
|
||||
// Otherwise it's shrinking. Once it reaches zero length it dies for good.
|
||||
else
|
||||
{
|
||||
projectile.localAI[0] -= num56;
|
||||
projectile.localAI[0] -= LaserLengthChangeRate;
|
||||
if (projectile.localAI[0] <= 0f)
|
||||
{
|
||||
projectile.Kill();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override Color? GetAlpha(Color lightColor) => new Color(100, 255, 100, 0);
|
||||
public override Color? GetAlpha(Color lightColor) => new Color(96, 255, 96, 0);
|
||||
|
||||
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => projectile.DrawBeam(100f, 3f, lightColor);
|
||||
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => projectile.DrawBeam(LaserLength, 2f, lightColor);
|
||||
|
||||
public override void Kill(int timeLeft)
|
||||
{
|
||||
int dustID = 107;
|
||||
int dustAmt = Main.rand.Next(3, 7);
|
||||
for (int d = 0; d < dustAmt; d++)
|
||||
Vector2 dustPos = projectile.Center - projectile.velocity / 2f;
|
||||
for (int i = 0; i < dustAmt; ++i)
|
||||
{
|
||||
int nano = Dust.NewDust(projectile.Center - projectile.velocity / 2f, 0, 0, 107, 0f, 0f, 100, default, 2.1f);
|
||||
Main.dust[nano].velocity *= 2f;
|
||||
Main.dust[nano].noGravity = true;
|
||||
Dust d = Dust.NewDustDirect(dustPos, 0, 0, dustID, 0f, 0f, Scale: 0.8f);
|
||||
d.velocity *= 1.15f;
|
||||
d.noGravity = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,127 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Magic
|
||||
{
|
||||
public class PhasedGodRay : ModProjectile
|
||||
{
|
||||
private const float LaserLength = 80f;
|
||||
private const float LaserLengthChangeRate = 2f;
|
||||
|
||||
// Do not change these unless you are absolutely sure you know how to fix the wave math.
|
||||
// They are extremely carefully chosen and barely work as is!
|
||||
private const float WaveTheta = 0.09f;
|
||||
private const int WaveTwistFrames = 9;
|
||||
private ref float WaveFrameState => ref projectile.localAI[1];
|
||||
|
||||
public override string Texture => "CalamityMod/Projectiles/LaserProj";
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Phased God Ray");
|
||||
ProjectileID.Sets.TrailCacheLength[projectile.type] = 10;
|
||||
ProjectileID.Sets.TrailingMode[projectile.type] = 2;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
projectile.width = 5;
|
||||
projectile.height = 5;
|
||||
projectile.friendly = true;
|
||||
projectile.alpha = 255;
|
||||
projectile.penetrate = 2;
|
||||
projectile.usesLocalNPCImmunity = true;
|
||||
projectile.localNPCHitCooldown = 12;
|
||||
projectile.MaxUpdates = 3;
|
||||
projectile.timeLeft = 280;
|
||||
projectile.magic = true;
|
||||
projectile.tileCollide = false;
|
||||
projectile.ignoreWater = true;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
// Very rapidly fade into existence.
|
||||
if (projectile.alpha > 0)
|
||||
projectile.alpha -= 25;
|
||||
if (projectile.alpha < 0)
|
||||
projectile.alpha = 0;
|
||||
|
||||
float waveSign = WaveFrameState < 0f ? -1f : 1f;
|
||||
|
||||
// Initialize waving. Setting localAI[1] to a number between -1 and 1 tells it which way to wave.
|
||||
// Exactly 0 is a coinflip.
|
||||
if (Math.Abs(WaveFrameState) < 1f)
|
||||
{
|
||||
float dirToUse = WaveFrameState == 0f ? (Main.rand.NextBool() ? -1f : 1f) : waveSign;
|
||||
waveSign = -dirToUse;
|
||||
WaveFrameState = dirToUse * WaveTwistFrames * 0.5f;
|
||||
|
||||
// Backfill old rotations to prevent visual glitches.
|
||||
float iterRotation = projectile.velocity.ToRotation();
|
||||
for (int i = 0; i < projectile.oldRot.Length; ++i)
|
||||
{
|
||||
projectile.oldRot[i] = iterRotation;
|
||||
iterRotation += waveSign * WaveTheta;
|
||||
}
|
||||
}
|
||||
// Switch waving directions as necessary.
|
||||
else if (Math.Abs(WaveFrameState) > WaveTwistFrames)
|
||||
WaveFrameState = -waveSign;
|
||||
else
|
||||
WaveFrameState += waveSign;
|
||||
|
||||
// Apply a constant, rapid wave to the laser's motion.
|
||||
projectile.velocity = projectile.velocity.RotatedBy(waveSign * WaveTheta);
|
||||
projectile.rotation = projectile.velocity.ToRotation();
|
||||
|
||||
// Emit light.
|
||||
Lighting.AddLight(projectile.Center, 0.87f, 0.65f, 0.1725f);
|
||||
|
||||
// Laser length shenanigans. If the laser is still growing, increase localAI 0 to indicate it is getting longer.
|
||||
if (projectile.ai[1] == 0f)
|
||||
{
|
||||
projectile.localAI[0] += 10f; // LaserLengthChangeRate;
|
||||
|
||||
// Cap it at max length.
|
||||
if (projectile.localAI[0] > LaserLength)
|
||||
projectile.localAI[0] = LaserLength;
|
||||
}
|
||||
|
||||
// Otherwise it's shrinking. Once it reaches zero length it dies for good.
|
||||
else
|
||||
{
|
||||
projectile.localAI[0] -= LaserLengthChangeRate;
|
||||
if (projectile.localAI[0] <= 0f)
|
||||
projectile.Kill();
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
|
||||
{
|
||||
}
|
||||
|
||||
public override Color? GetAlpha(Color lightColor) => new Color(222, 166, 44, 0);
|
||||
|
||||
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => projectile.DrawBeam(LaserLength, 2f, lightColor, curve: true);
|
||||
|
||||
public override void Kill(int timeLeft)
|
||||
{
|
||||
int dustID = 269;
|
||||
int dustAmt = 4;
|
||||
Vector2 dustPos = projectile.Center - projectile.velocity / 2f;
|
||||
Vector2 dustVel = projectile.velocity / 4f;
|
||||
for (int i = 0; i < dustAmt; ++i)
|
||||
{
|
||||
Dust d = Dust.NewDustDirect(dustPos, 0, 0, dustID, 0f, 0f, Scale: 2.5f);
|
||||
d.velocity += dustVel;
|
||||
d.velocity *= Main.rand.NextFloat(0.4f, 1f);
|
||||
d.noGravity = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,139 +0,0 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
namespace CalamityMod.Projectiles.Magic
|
||||
{
|
||||
public class PurgeProj : ModProjectile
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Purge");
|
||||
Main.projFrames[projectile.type] = 4;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
projectile.width = 64;
|
||||
projectile.height = 34;
|
||||
projectile.friendly = true;
|
||||
projectile.penetrate = -1;
|
||||
projectile.tileCollide = false;
|
||||
projectile.ignoreWater = true;
|
||||
projectile.magic = true;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Player player = Main.player[projectile.owner];
|
||||
Vector2 playerPos = player.RotatedRelativePoint(player.MountedCenter, true);
|
||||
if (projectile.type == ModContent.ProjectileType<PurgeProj>())
|
||||
{
|
||||
projectile.ai[0] += 1f;
|
||||
int num2 = 0;
|
||||
if (projectile.ai[0] >= 20f)
|
||||
{
|
||||
num2++;
|
||||
}
|
||||
if (projectile.ai[0] >= 40f)
|
||||
{
|
||||
num2++;
|
||||
}
|
||||
if (projectile.ai[0] >= 60f)
|
||||
{
|
||||
num2++;
|
||||
}
|
||||
int num3 = 24;
|
||||
int num4 = 6;
|
||||
projectile.ai[1] += 1f;
|
||||
bool flag = false;
|
||||
if (projectile.ai[1] >= (float)(num3 - num4 * num2))
|
||||
{
|
||||
projectile.ai[1] = 0f;
|
||||
flag = true;
|
||||
}
|
||||
if (projectile.soundDelay <= 0)
|
||||
{
|
||||
projectile.soundDelay = num3 - num4 * num2;
|
||||
if (projectile.ai[0] != 1f)
|
||||
{
|
||||
Main.PlaySound(SoundID.Item91, projectile.position);
|
||||
}
|
||||
projectile.frame = (projectile.frame + 1) % Main.projFrames[projectile.type];
|
||||
}
|
||||
if (projectile.ai[1] == 1f && projectile.ai[0] != 1f)
|
||||
{
|
||||
Vector2 vector2 = Vector2.UnitX * 24f;
|
||||
vector2 = vector2.RotatedBy((double)(projectile.rotation - MathHelper.PiOver2), default);
|
||||
Vector2 value = projectile.Center + vector2;
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
int num5 = Dust.NewDust(value - Vector2.One * 8f, 16, 16, 107, projectile.velocity.X / 2f, projectile.velocity.Y / 2f, 100, default, 1f);
|
||||
Main.dust[num5].velocity *= 0.66f;
|
||||
Main.dust[num5].noGravity = true;
|
||||
Main.dust[num5].scale = 1.4f;
|
||||
}
|
||||
}
|
||||
if (flag && Main.myPlayer == projectile.owner)
|
||||
{
|
||||
int weaponDamage2 = player.GetWeaponDamage(player.ActiveItem());
|
||||
bool flag2 = player.channel && player.CheckMana(player.ActiveItem(), -1, true, false) && !player.noItems && !player.CCed;
|
||||
if (flag2)
|
||||
{
|
||||
float speed = player.ActiveItem().shootSpeed * projectile.scale;
|
||||
Vector2 spawnPos = playerPos;
|
||||
Vector2 direction = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - spawnPos;
|
||||
if (player.gravDir == -1f)
|
||||
{
|
||||
direction.Y = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - spawnPos.Y;
|
||||
}
|
||||
Vector2 velocity = Vector2.Normalize(direction);
|
||||
if (float.IsNaN(velocity.X) || float.IsNaN(velocity.Y))
|
||||
{
|
||||
velocity = -Vector2.UnitY;
|
||||
}
|
||||
velocity *= speed;
|
||||
if (velocity.X != projectile.velocity.X || velocity.Y != projectile.velocity.Y)
|
||||
{
|
||||
projectile.netUpdate = true;
|
||||
}
|
||||
projectile.velocity = velocity;
|
||||
int projType = ModContent.ProjectileType<PurgeLaser>();
|
||||
float velocityMult = 14f;
|
||||
float randNum = 7f;
|
||||
for (int j = 0; j < 3; j++)
|
||||
{
|
||||
spawnPos += new Vector2(Main.rand.NextFloat(-randNum, randNum), Main.rand.NextFloat(-randNum, randNum));
|
||||
Vector2 spinningpoint = Vector2.Normalize(projectile.velocity) * velocityMult;
|
||||
spinningpoint = spinningpoint.RotatedBy(Main.rand.NextDouble() * 0.2 - 0.1, default);
|
||||
if (float.IsNaN(spinningpoint.X) || float.IsNaN(spinningpoint.Y))
|
||||
{
|
||||
spinningpoint = -Vector2.UnitY;
|
||||
}
|
||||
Projectile.NewProjectile(spawnPos, spinningpoint, projType, weaponDamage2, projectile.knockBack, projectile.owner, 0f, 0f);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
projectile.Kill();
|
||||
}
|
||||
}
|
||||
}
|
||||
projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2;
|
||||
projectile.Center = player.RotatedRelativePoint(player.MountedCenter, true) + Vector2.UnitX * 8f;
|
||||
projectile.spriteDirection = projectile.direction;
|
||||
projectile.timeLeft = 2;
|
||||
player.ChangeDir(projectile.direction);
|
||||
player.heldProj = projectile.whoAmI;
|
||||
player.itemTime = 2;
|
||||
player.itemAnimation = 2;
|
||||
player.itemRotation = (float)Math.Atan2((double)(projectile.velocity.Y * (float)projectile.direction), (double)(projectile.velocity.X * (float)projectile.direction));
|
||||
}
|
||||
|
||||
public override bool CanDamage() => false;
|
||||
|
||||
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => projectile.ai[0] > 0f;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Magic
|
||||
{
|
||||
public class SilvaBurst : ModProjectile
|
||||
{
|
||||
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Silva Burst");
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
projectile.width = 96;
|
||||
projectile.height = 96;
|
||||
projectile.friendly = true;
|
||||
projectile.penetrate = -1;
|
||||
projectile.usesLocalNPCImmunity = true;
|
||||
projectile.localNPCHitCooldown = -1;
|
||||
projectile.ignoreWater = true;
|
||||
projectile.tileCollide = false;
|
||||
projectile.magic = true;
|
||||
projectile.alpha = 255;
|
||||
projectile.timeLeft = 2;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
// Create a bright burst of Silva light.
|
||||
float brightness = 1.6f;
|
||||
Lighting.AddLight(projectile.Center, 0.27f * brightness, 0.82f * brightness, 0.157f * brightness);
|
||||
|
||||
// Produce a bunch of dust.
|
||||
int dustID = 157;
|
||||
for (int d = 0; d < 3; d++)
|
||||
Dust.NewDust(projectile.position, projectile.width, projectile.height, dustID, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.5f);
|
||||
|
||||
for (int d = 0; d < 30; d++)
|
||||
{
|
||||
int explode = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustID, 0f, 0f, 0, new Color(Main.DiscoR, 203, 103), 2.5f);
|
||||
Main.dust[explode].noGravity = true;
|
||||
Main.dust[explode].velocity *= 3f;
|
||||
explode = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustID, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.5f);
|
||||
Main.dust[explode].velocity *= 2f;
|
||||
Main.dust[explode].noGravity = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,74 +0,0 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
namespace CalamityMod.Projectiles.Magic
|
||||
{
|
||||
public class T1000Laser : ModProjectile
|
||||
{
|
||||
public override string Texture => "CalamityMod/Projectiles/LaserProj";
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Laser");
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
projectile.width = 5;
|
||||
projectile.height = 5;
|
||||
projectile.friendly = true;
|
||||
projectile.alpha = 255;
|
||||
projectile.penetrate = 1;
|
||||
projectile.extraUpdates = 2;
|
||||
projectile.timeLeft = 600;
|
||||
projectile.magic = true;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
if (projectile.alpha > 0)
|
||||
{
|
||||
projectile.alpha -= 25;
|
||||
}
|
||||
if (projectile.alpha < 0)
|
||||
{
|
||||
projectile.alpha = 0;
|
||||
}
|
||||
Lighting.AddLight((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16, 0f, 0.7f, 0.1f);
|
||||
float num55 = 100f;
|
||||
float num56 = 3f;
|
||||
if (projectile.ai[1] == 0f)
|
||||
{
|
||||
projectile.localAI[0] += num56;
|
||||
if (projectile.localAI[0] > num55)
|
||||
{
|
||||
projectile.localAI[0] = num55;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
projectile.localAI[0] -= num56;
|
||||
if (projectile.localAI[0] <= 0f)
|
||||
{
|
||||
projectile.Kill();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override Color? GetAlpha(Color lightColor) => new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, 0);
|
||||
|
||||
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => projectile.DrawBeam(100f, 3f, lightColor);
|
||||
|
||||
public override void Kill(int timeLeft)
|
||||
{
|
||||
int dustAmt = Main.rand.Next(3, 7);
|
||||
for (int d = 0; d < dustAmt; d++)
|
||||
{
|
||||
int rainbow = Dust.NewDust(projectile.Center - projectile.velocity / 2f, 0, 0, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 2.1f);
|
||||
Main.dust[rainbow].velocity *= 2f;
|
||||
Main.dust[rainbow].noGravity = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,131 +0,0 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
namespace CalamityMod.Projectiles.Magic
|
||||
{
|
||||
public class T1000Proj : ModProjectile
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("T1000");
|
||||
Main.projFrames[projectile.type] = 8;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
projectile.width = 58;
|
||||
projectile.height = 94;
|
||||
projectile.friendly = true;
|
||||
projectile.penetrate = -1;
|
||||
projectile.tileCollide = false;
|
||||
projectile.ignoreWater = true;
|
||||
projectile.magic = true;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Player player = Main.player[projectile.owner];
|
||||
Vector2 playerPos = player.RotatedRelativePoint(player.MountedCenter, true);
|
||||
if (projectile.type == ModContent.ProjectileType<T1000Proj>())
|
||||
{
|
||||
projectile.ai[0] += 1f;
|
||||
int num2 = 0;
|
||||
if (projectile.ai[0] >= 20f)
|
||||
{
|
||||
num2++;
|
||||
}
|
||||
if (projectile.ai[0] >= 40f)
|
||||
{
|
||||
num2++;
|
||||
}
|
||||
if (projectile.ai[0] >= 60f)
|
||||
{
|
||||
num2++;
|
||||
}
|
||||
int num3 = 24;
|
||||
int num4 = 6;
|
||||
projectile.ai[1] += 1f;
|
||||
bool flag = false;
|
||||
if (projectile.ai[1] >= (float)(num3 - num4 * num2))
|
||||
{
|
||||
projectile.ai[1] = 0f;
|
||||
flag = true;
|
||||
}
|
||||
if (projectile.soundDelay <= 0)
|
||||
{
|
||||
projectile.soundDelay = num3 - num4 * num2;
|
||||
if (projectile.ai[0] != 1f)
|
||||
{
|
||||
Main.PlaySound(SoundID.Item91, projectile.position);
|
||||
}
|
||||
projectile.frame = (projectile.frame + 1) % Main.projFrames[projectile.type];
|
||||
}
|
||||
if (projectile.ai[1] == 1f && projectile.ai[0] != 1f)
|
||||
{
|
||||
Vector2 vector2 = Vector2.UnitX * 24f;
|
||||
vector2 = vector2.RotatedBy((double)(projectile.rotation - MathHelper.PiOver2), default);
|
||||
Vector2 value = projectile.Center + vector2;
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
int num5 = Dust.NewDust(value - Vector2.One * 8f, 16, 16, 66, projectile.velocity.X / 2f, projectile.velocity.Y / 2f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f);
|
||||
Main.dust[num5].velocity *= 0.66f;
|
||||
Main.dust[num5].noGravity = true;
|
||||
Main.dust[num5].scale = 1.4f;
|
||||
}
|
||||
}
|
||||
if (flag && Main.myPlayer == projectile.owner)
|
||||
{
|
||||
int weaponDamage2 = player.GetWeaponDamage(player.ActiveItem());
|
||||
bool flag2 = player.channel && player.CheckMana(player.ActiveItem(), -1, true, false) && !player.noItems && !player.CCed;
|
||||
if (flag2)
|
||||
{
|
||||
float speed = player.ActiveItem().shootSpeed * projectile.scale;
|
||||
Vector2 spawnPos = playerPos + projectile.velocity * 0.75f;
|
||||
Vector2 velocity = (Main.MouseWorld - projectile.Center).SafeNormalize(-Vector2.UnitY) * speed;
|
||||
if (projectile.WithinRange(Main.MouseWorld, 50f))
|
||||
velocity = projectile.velocity;
|
||||
if (velocity.X != projectile.velocity.X || velocity.Y != projectile.velocity.Y)
|
||||
projectile.netUpdate = true;
|
||||
|
||||
projectile.velocity = velocity;
|
||||
int projType = ModContent.ProjectileType<T1000Laser>();
|
||||
float velocityMult = 21f;
|
||||
float randNum = 4f;
|
||||
for (int j = 0; j < 4; j++)
|
||||
{
|
||||
spawnPos += new Vector2(Main.rand.NextFloat(-randNum, randNum), Main.rand.NextFloat(-randNum, randNum));
|
||||
Vector2 spinningpoint = Vector2.Normalize(projectile.velocity) * velocityMult;
|
||||
spinningpoint = spinningpoint.RotatedBy(Main.rand.NextDouble() * 0.2 - 0.1, default);
|
||||
if (float.IsNaN(spinningpoint.X) || float.IsNaN(spinningpoint.Y))
|
||||
{
|
||||
spinningpoint = -Vector2.UnitY;
|
||||
}
|
||||
Projectile.NewProjectile(spawnPos, spinningpoint, projType, weaponDamage2, projectile.knockBack, projectile.owner, 0f, 0f);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
projectile.Kill();
|
||||
}
|
||||
}
|
||||
}
|
||||
projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2;
|
||||
projectile.Center = player.RotatedRelativePoint(player.MountedCenter, true) + projectile.velocity.SafeNormalize(Vector2.UnitX * player.direction) * 8f;
|
||||
projectile.position.Y -= 8f;
|
||||
projectile.spriteDirection = projectile.direction;
|
||||
projectile.timeLeft = 2;
|
||||
player.ChangeDir(projectile.direction);
|
||||
player.heldProj = projectile.whoAmI;
|
||||
player.itemTime = 2;
|
||||
player.itemAnimation = 2;
|
||||
player.itemRotation = (projectile.velocity * projectile.direction).ToRotation();
|
||||
}
|
||||
|
||||
public override bool CanDamage() => false;
|
||||
|
||||
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => projectile.ai[0] > 0f;
|
||||
}
|
||||
}
|
||||
@@ -16,7 +16,7 @@ namespace CalamityMod.Projectiles.Magic
|
||||
public Player Owner => Main.player[projectile.owner];
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Vehemence");
|
||||
DisplayName.SetDefault("Blast of Vehemence");
|
||||
ProjectileID.Sets.TrailCacheLength[projectile.type] = 10;
|
||||
ProjectileID.Sets.TrailingMode[projectile.type] = 1;
|
||||
}
|
||||
@@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Magic
|
||||
projectile.friendly = true;
|
||||
projectile.ignoreWater = true;
|
||||
projectile.penetrate = 1;
|
||||
projectile.extraUpdates = 1;
|
||||
projectile.extraUpdates = 2;
|
||||
projectile.timeLeft = 300;
|
||||
projectile.magic = true;
|
||||
}
|
||||
@@ -84,9 +84,10 @@ namespace CalamityMod.Projectiles.Magic
|
||||
Main.PlaySound(SoundID.Item74, projectile.position);
|
||||
if (Main.myPlayer == projectile.owner)
|
||||
{
|
||||
int damage = (int)(Vehemenc.VehemenceSkullDamage * Owner.MagicDamage());
|
||||
int skullID = ModContent.ProjectileType<VehemenceSkull>();
|
||||
int damage = (int)(projectile.damage * Vehemenc.SkullRatio);
|
||||
for (int i = 0; i < 18; i++)
|
||||
Projectile.NewProjectile(projectile.Center, Main.rand.NextVector2Circular(12f, 12f), ModContent.ProjectileType<VehemenceSkull>(), damage, projectile.knockBack, projectile.owner);
|
||||
Projectile.NewProjectile(projectile.Center, Main.rand.NextVector2Circular(12f, 12f), skullID, damage, projectile.knockBack, projectile.owner);
|
||||
}
|
||||
|
||||
if (!Main.dedServ)
|
||||
@@ -113,20 +114,9 @@ namespace CalamityMod.Projectiles.Magic
|
||||
}
|
||||
}
|
||||
|
||||
public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection)
|
||||
{
|
||||
double lifeAmount = target.life;
|
||||
double lifeMax = target.lifeMax;
|
||||
double damageExponent = lifeAmount / lifeMax * 7;
|
||||
damage = (int)Math.Pow(damage, damageExponent);
|
||||
if (damage > 200000)
|
||||
damage = 200000;
|
||||
}
|
||||
|
||||
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
|
||||
{
|
||||
if (target.life == target.lifeMax)
|
||||
target.AddBuff(ModContent.BuffType<DemonFlames>(), 18000);
|
||||
target.AddBuff(ModContent.BuffType<DemonFlames>(), 1800);
|
||||
}
|
||||
|
||||
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
|
||||
|
||||
@@ -10,8 +10,8 @@ namespace CalamityMod.Projectiles.Magic
|
||||
{
|
||||
public Player Owner => Main.player[projectile.owner];
|
||||
public ref float Time => ref projectile.ai[0];
|
||||
public ref float ChargeTime => ref projectile.ai[1];
|
||||
|
||||
public const int ChargeTime = 90;
|
||||
public override string Texture => "CalamityMod/Items/Weapons/Magic/Vehemenc";
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
@@ -25,12 +25,14 @@ namespace CalamityMod.Projectiles.Magic
|
||||
projectile.magic = false;
|
||||
projectile.tileCollide = false;
|
||||
projectile.ignoreWater = true;
|
||||
projectile.timeLeft = ChargeTime + 1;
|
||||
projectile.timeLeft = 91;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
UpdatePlayerVisuals();
|
||||
if (projectile.timeLeft > ChargeTime + 5)
|
||||
projectile.timeLeft = (int)ChargeTime + 5;
|
||||
if (Time == ChargeTime)
|
||||
ShootBolt();
|
||||
else if (Time < ChargeTime)
|
||||
@@ -38,6 +40,7 @@ namespace CalamityMod.Projectiles.Magic
|
||||
|
||||
Time++;
|
||||
|
||||
// If the player aborts the charge by releasing LMB, it cancels.
|
||||
if (Main.mouseLeftRelease && Time >= 5f && Time < ChargeTime)
|
||||
projectile.Kill();
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using CalamityMod.Buffs.DamageOverTime;
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
@@ -10,7 +11,7 @@ namespace CalamityMod.Projectiles.Magic
|
||||
public ref float Time => ref projectile.ai[0];
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Brimstone Skull");
|
||||
DisplayName.SetDefault("Vehement Skull");
|
||||
Main.projFrames[projectile.type] = 10;
|
||||
}
|
||||
|
||||
@@ -22,8 +23,8 @@ namespace CalamityMod.Projectiles.Magic
|
||||
projectile.alpha = 255;
|
||||
projectile.tileCollide = false;
|
||||
projectile.ignoreWater = true;
|
||||
projectile.usesLocalNPCImmunity = true;
|
||||
projectile.localNPCHitCooldown = 10;
|
||||
projectile.usesIDStaticNPCImmunity = true;
|
||||
projectile.idStaticNPCHitCooldown = 9;
|
||||
projectile.magic = true;
|
||||
}
|
||||
|
||||
@@ -37,16 +38,18 @@ namespace CalamityMod.Projectiles.Magic
|
||||
projectile.frameCounter = 0;
|
||||
}
|
||||
|
||||
if (projectile.ai[0] < 125) // 155 - frameCounter tick * number of disippation frames.
|
||||
{
|
||||
if (projectile.frame >= 4)
|
||||
projectile.frame = 0;
|
||||
}
|
||||
if (projectile.ai[0] < 125) // 155 - frameCounter tick * number of disippation frames.
|
||||
{
|
||||
if (projectile.frame >= 4)
|
||||
projectile.frame = 0;
|
||||
}
|
||||
else if (projectile.owner == Main.myPlayer && projectile.frame >= Main.projFrames[projectile.type])
|
||||
projectile.Kill();
|
||||
|
||||
else if (projectile.owner == Main.myPlayer && projectile.frame >= Main.projFrames[projectile.type])
|
||||
projectile.Kill();
|
||||
// Produce some light.
|
||||
Lighting.AddLight(projectile.Center, 0.36f, 0.09f, 0.09f);
|
||||
|
||||
projectile.velocity *= 0.98f;
|
||||
projectile.velocity *= 0.972f;
|
||||
if (projectile.alpha > 110)
|
||||
{
|
||||
projectile.alpha -= 30;
|
||||
@@ -58,6 +61,8 @@ namespace CalamityMod.Projectiles.Magic
|
||||
projectile.spriteDirection = -projectile.direction;
|
||||
}
|
||||
|
||||
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.AddBuff(ModContent.BuffType<DemonFlames>(), 240);
|
||||
public override Color? GetAlpha(Color lightColor) => new Color(191, 63, 54, 100);
|
||||
|
||||
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.AddBuff(ModContent.BuffType<DemonFlames>(), 120);
|
||||
}
|
||||
}
|
||||
@@ -1,16 +1,13 @@
|
||||
using CalamityMod.Items.Weapons.Magic;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Magic
|
||||
{
|
||||
public class VoidVortexProj : ModProjectile
|
||||
{
|
||||
private double timeElapsed = 0.0;
|
||||
private double circleSize = 1.0;
|
||||
private double circleGrowth = 0.02;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Void Vortex");
|
||||
@@ -23,29 +20,21 @@ namespace CalamityMod.Projectiles.Magic
|
||||
projectile.height = 38;
|
||||
projectile.friendly = true;
|
||||
projectile.ignoreWater = true;
|
||||
projectile.light = 0.5f;
|
||||
projectile.tileCollide = false;
|
||||
projectile.penetrate = -1;
|
||||
projectile.timeLeft = 420;
|
||||
projectile.timeLeft = 180;
|
||||
projectile.magic = true;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
timeElapsed += 0.02;
|
||||
projectile.velocity.X = (float)(Math.Sin(timeElapsed * (0.5f * projectile.ai[0])) * circleSize);
|
||||
projectile.velocity.Y = (float)(Math.Cos(timeElapsed * (0.5f * projectile.ai[0])) * circleSize);
|
||||
circleSize += circleGrowth;
|
||||
|
||||
if (projectile.velocity.X > 0f)
|
||||
{
|
||||
projectile.rotation += (Math.Abs(projectile.velocity.Y) + Math.Abs(projectile.velocity.X)) * 0.001f;
|
||||
}
|
||||
else
|
||||
{
|
||||
projectile.rotation -= (Math.Abs(projectile.velocity.Y) + Math.Abs(projectile.velocity.X)) * 0.001f;
|
||||
}
|
||||
// Spin chaotically given a pre-defined spin direction. Choose one initially at random.
|
||||
float spinTheta = 0.11f;
|
||||
if (projectile.localAI[1] == 0f)
|
||||
projectile.localAI[1] = Main.rand.NextBool() ? -spinTheta : spinTheta;
|
||||
projectile.rotation += projectile.localAI[1];
|
||||
|
||||
// Animate the lightning orb.
|
||||
projectile.frameCounter++;
|
||||
if (projectile.frameCounter > 6)
|
||||
{
|
||||
@@ -57,7 +46,15 @@ namespace CalamityMod.Projectiles.Magic
|
||||
}
|
||||
}
|
||||
|
||||
CalamityGlobalProjectile.MagnetSphereHitscan(projectile, 300f, 8f, 8f, 2, ModContent.ProjectileType<ClimaxBeam>(), 1D, true);
|
||||
// Spiral outwards in an increasingly chaotic fashion.
|
||||
float revolutionTheta = 0.12f * projectile.ai[1];
|
||||
projectile.velocity = projectile.velocity.RotatedBy(revolutionTheta) * 1.0092f;
|
||||
|
||||
// Initial stagger in frames needs to be skipped over before it starts shooting,
|
||||
// but once it's past that then it can fire constantly
|
||||
--projectile.ai[0];
|
||||
if (projectile.ai[0] < 0f)
|
||||
CalamityGlobalProjectile.MagnetSphereHitscan(projectile, 400f, 8f, VoidVortex.OrbFireRate, 2, ModContent.ProjectileType<ClimaxBeam>(), 1D, true);
|
||||
}
|
||||
|
||||
public override Color? GetAlpha(Color lightColor)
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
projectile.extraUpdates = 1;
|
||||
projectile.usesLocalNPCImmunity = true;
|
||||
projectile.localNPCHitCooldown = 6;
|
||||
projectile.tileCollide = false;
|
||||
projectile.tileCollide = false;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
|
||||
@@ -8,11 +8,11 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
{
|
||||
public class CondemnationHoldout : ModProjectile
|
||||
{
|
||||
public Player Owner => Main.player[projectile.owner];
|
||||
public bool OwnerCanShoot => Owner.channel && Owner.HasAmmo(Owner.ActiveItem(), true) && !Owner.noItems && !Owner.CCed;
|
||||
public ref float CurrentChargingFrames => ref projectile.ai[0];
|
||||
public ref float ArrowsLoaded => ref projectile.ai[1];
|
||||
public ref float FramesToLoadNextArrow => ref projectile.localAI[0];
|
||||
private Player Owner => Main.player[projectile.owner];
|
||||
private bool OwnerCanShoot => Owner.channel && Owner.HasAmmo(Owner.ActiveItem(), true) && !Owner.noItems && !Owner.CCed;
|
||||
private ref float CurrentChargingFrames => ref projectile.ai[0];
|
||||
private ref float ArrowsLoaded => ref projectile.ai[1];
|
||||
private ref float FramesToLoadNextArrow => ref projectile.localAI[0];
|
||||
|
||||
public override string Texture => "CalamityMod/Items/Weapons/Ranged/Condemnation";
|
||||
public override void SetStaticDefaults() => DisplayName.SetDefault("Condemnation");
|
||||
@@ -44,7 +44,7 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
}
|
||||
|
||||
// Fire one charged arrow every frame until you're out of arrows.
|
||||
ShootProjectiles(tipPosition, 1f);
|
||||
ShootProjectiles(tipPosition);
|
||||
--ArrowsLoaded;
|
||||
Main.PlaySound(SoundID.DD2_BallistaTowerShot);
|
||||
}
|
||||
@@ -116,7 +116,7 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
}
|
||||
}
|
||||
|
||||
public void ShootProjectiles(Vector2 tipPosition, float speedFactor)
|
||||
public void ShootProjectiles(Vector2 tipPosition)
|
||||
{
|
||||
if (Main.myPlayer != projectile.owner)
|
||||
return;
|
||||
@@ -124,7 +124,7 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
Item heldItem = Owner.ActiveItem();
|
||||
// calculate damage at the instant this arrow is fired
|
||||
int arrowDamage = (int)(heldItem.damage * Owner.RangedDamage());
|
||||
float shootSpeed = heldItem.shootSpeed * speedFactor * 1.5f;
|
||||
float shootSpeed = heldItem.shootSpeed * 1.5f; // Loaded arrows move faster than normal.
|
||||
float knockback = heldItem.knockBack;
|
||||
|
||||
bool uselessFuckYou = OwnerCanShoot;
|
||||
@@ -138,7 +138,7 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
Projectile.NewProjectile(tipPosition, shootVelocity, projectileType, arrowDamage, knockback, projectile.owner, 0f, 0f);
|
||||
}
|
||||
|
||||
public void UpdateProjectileHeldVariables(Vector2 armPosition)
|
||||
private void UpdateProjectileHeldVariables(Vector2 armPosition)
|
||||
{
|
||||
if (Main.myPlayer == projectile.owner)
|
||||
{
|
||||
@@ -160,7 +160,7 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
projectile.timeLeft = 2;
|
||||
}
|
||||
|
||||
public void ManipulatePlayerVariables()
|
||||
private void ManipulatePlayerVariables()
|
||||
{
|
||||
Owner.ChangeDir(projectile.direction);
|
||||
Owner.heldProj = projectile.whoAmI;
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
public override string Texture => "CalamityMod/Items/Weapons/Rogue/Sacrifice";
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Sacrifice");
|
||||
DisplayName.SetDefault("Sacrificial Dagger");
|
||||
ProjectileID.Sets.TrailingMode[projectile.type] = 1;
|
||||
ProjectileID.Sets.TrailCacheLength[projectile.type] = 8;
|
||||
}
|
||||
@@ -31,7 +31,7 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
projectile.timeLeft = 600;
|
||||
projectile.Calamity().rogue = true;
|
||||
projectile.usesLocalNPCImmunity = true;
|
||||
projectile.localNPCHitCooldown = 9;
|
||||
projectile.localNPCHitCooldown = 20;
|
||||
}
|
||||
|
||||
public override void SendExtraAI(BinaryWriter writer) => writer.Write(AbleToHealOwner);
|
||||
|
||||
@@ -19,16 +19,16 @@ namespace CalamityMod.Projectiles.Typeless
|
||||
projectile.friendly = true;
|
||||
projectile.penetrate = 1;
|
||||
projectile.extraUpdates = 0;
|
||||
projectile.tileCollide = false;
|
||||
projectile.ignoreWater = true;
|
||||
projectile.alpha = 255;
|
||||
projectile.timeLeft = 2;
|
||||
}
|
||||
|
||||
// If the AI parameter isn't a valid NPC slot, it can hit anything. Otherwise it can only hit one NPC.
|
||||
// TODO -- this might actually not work in multiplayer if the DirectStrike gets synced...
|
||||
public override bool? CanHitNPC(NPC target)
|
||||
{
|
||||
if (projectile.ai[0] < 0f || projectile.ai[0] > 199f || projectile.ai[0] == target.whoAmI)
|
||||
if (projectile.ai[0] < 0f || projectile.ai[0] > 199f || projectile.ai[0] == target.whoAmI)
|
||||
return null;
|
||||
return (bool?)false;
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ namespace CalamityMod
|
||||
{
|
||||
// If the incoming damage is less than the cap, don't do anything.
|
||||
if (dmgInput < cap)
|
||||
return (int)(dmgInput);
|
||||
return (int)dmgInput;
|
||||
|
||||
// Ratio of how far over the cap you are.
|
||||
// This is a value from 1.0 upwards to theoretically infinity.
|
||||
@@ -192,7 +192,7 @@ namespace CalamityMod
|
||||
}
|
||||
}
|
||||
|
||||
public static bool DrawBeam(this Projectile projectile, float length, float width, Color lightColor, Texture2D texture = null)
|
||||
public static bool DrawBeam(this Projectile projectile, float length, float spacer, Color lightColor, Texture2D texture = null, bool curve = false)
|
||||
{
|
||||
if (texture is null)
|
||||
texture = Main.projectileTexture[projectile.type];
|
||||
@@ -211,18 +211,30 @@ namespace CalamityMod
|
||||
Vector2 drawPos = projectile.position - Main.screenPosition + origin;
|
||||
drawPos.Y += projectile.gfxOffY;
|
||||
float maxTrailPoints = length;
|
||||
float wide = width;
|
||||
|
||||
if (projectile.ai[1] == 1f)
|
||||
{
|
||||
maxTrailPoints = (int)projectile.localAI[0];
|
||||
}
|
||||
|
||||
Vector2 cumulativeOffset = Vector2.Zero;
|
||||
for (int i = 1; i <= (int)projectile.localAI[0]; i++)
|
||||
{
|
||||
Vector2 offset = Vector2.Normalize(projectile.velocity) * (float)i * wide;
|
||||
Vector2 velToUseThisIter = projectile.velocity;
|
||||
if (curve)
|
||||
{
|
||||
float oldVelRatio = i / projectile.localAI[0];
|
||||
int oldVelIndex = (int)(oldVelRatio * projectile.oldRot.Length);
|
||||
if (oldVelIndex > 0)
|
||||
{
|
||||
float angleChange = projectile.oldRot[oldVelIndex - 1] - projectile.rotation;
|
||||
velToUseThisIter = projectile.velocity.RotatedBy(angleChange);
|
||||
}
|
||||
}
|
||||
cumulativeOffset += Vector2.Normalize(velToUseThisIter) * spacer;
|
||||
Color color = projectile.GetAlpha(lightColor);
|
||||
color *= (maxTrailPoints - (float)i) / maxTrailPoints;
|
||||
color.A = 0;
|
||||
Main.spriteBatch.Draw(texture, drawPos - offset, null, color, projectile.rotation, origin, projectile.scale, spriteEffects, 0f);
|
||||
float fixedRotation = projectile.rotation + MathHelper.PiOver2;
|
||||
Main.spriteBatch.Draw(texture, drawPos - cumulativeOffset, null, color, fixedRotation, origin, projectile.scale, spriteEffects, 0f);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
||||
Reference in new issue
Block a user