pwnagehammer rework
This commit is contained in:
1 parent
869a1040e1
commit
4c11c79b60
11 files changed
+422
-44
No files matched your search
@@ -1,4 +1,5 @@
|
||||
using CalamityMod.Projectiles.Hybrid;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
@@ -10,19 +11,22 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Pwnagehammer");
|
||||
Tooltip.SetDefault("Throws an extremely fast hammer");
|
||||
Tooltip.SetDefault("Throws a heavy, gravity-affected hammer that creates a loud blast of hallowed energy when it hits something\n" +
|
||||
"There is a 20 percent chance for the hammer to home in on a target\n" +
|
||||
"Homing hammers summon an additional spectral hammer on hit and are guaranteed to land a critical hit");
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
item.width = 68;
|
||||
item.damage = 90;
|
||||
item.damage = 210;
|
||||
item.crit = 10;
|
||||
item.noMelee = true;
|
||||
item.noUseGraphic = true;
|
||||
item.autoReuse = true;
|
||||
item.useAnimation = 15;
|
||||
item.useAnimation = item.useTime = 31;
|
||||
item.reuseDelay = 17;
|
||||
item.useStyle = ItemUseStyleID.SwingThrow;
|
||||
item.useTime = 15;
|
||||
item.knockBack = 10f;
|
||||
item.UseSound = SoundID.Item1;
|
||||
item.melee = true;
|
||||
@@ -30,7 +34,19 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
item.value = Item.buyPrice(0, 48, 0, 0);
|
||||
item.rare = 6;
|
||||
item.shoot = ModContent.ProjectileType<PwnagehammerProj>();
|
||||
item.shootSpeed = 12f;
|
||||
item.shootSpeed = 24.4f;
|
||||
}
|
||||
|
||||
public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
|
||||
{
|
||||
Vector2 speed = new Vector2(speedX, speedY);
|
||||
Vector2 yeetOffset = Vector2.Normalize(speed) * 40f;
|
||||
if (Collision.CanHit(position, 0, 0, position + yeetOffset, 0, 0))
|
||||
{
|
||||
position += yeetOffset;
|
||||
}
|
||||
Projectile.NewProjectile(position, speed, type, damage, knockBack, player.whoAmI, Main.rand.NextBool(5) ? 1f : 0f);
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void AddRecipes()
|
||||
|
||||
@@ -11,32 +11,41 @@ namespace CalamityMod.Items.Weapons.Rogue
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Pwnagehammer");
|
||||
Tooltip.SetDefault("Throws an extremely fast hammer");
|
||||
Tooltip.SetDefault("Throws a heavy, gravity-affected hammer that creates a loud blast of hallowed energy when it hits something\n" +
|
||||
"There is a 20 percent chance for the hammer to home in on a target\n" +
|
||||
"Homing hammers summon an additional spectral hammer on hit and are guaranteed to land a critical hit");
|
||||
}
|
||||
|
||||
public override void SafeSetDefaults()
|
||||
{
|
||||
item.width = 68;
|
||||
item.damage = 90;
|
||||
item.damage = 210;
|
||||
item.crit = 10;
|
||||
item.noMelee = true;
|
||||
item.noUseGraphic = true;
|
||||
item.autoReuse = true;
|
||||
item.useAnimation = 15;
|
||||
item.useAnimation = item.useTime = 31;
|
||||
item.reuseDelay = 17;
|
||||
item.useStyle = ItemUseStyleID.SwingThrow;
|
||||
item.useTime = 15;
|
||||
item.knockBack = 10f;
|
||||
item.UseSound = SoundID.Item1;
|
||||
item.Calamity().rogue = true;
|
||||
item.height = 68;
|
||||
item.value = Item.buyPrice(0, 48, 0, 0);
|
||||
item.rare = 6;
|
||||
item.shoot = ModContent.ProjectileType<PwnagehammerProj>();
|
||||
item.shootSpeed = 12f;
|
||||
item.Calamity().rogue = true;
|
||||
item.shootSpeed = 24.4f;
|
||||
}
|
||||
|
||||
public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
|
||||
{
|
||||
int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI);
|
||||
Vector2 speed = new Vector2(speedX, speedY);
|
||||
Vector2 yeetOffset = Vector2.Normalize(speed) * 40f;
|
||||
if (Collision.CanHit(position, 0, 0, position + yeetOffset, 0, 0))
|
||||
{
|
||||
position += yeetOffset;
|
||||
}
|
||||
int proj = Projectile.NewProjectile(position, speed, type, damage, knockBack, player.whoAmI, Main.rand.NextBool(5) ? 1f : 0f);
|
||||
Main.projectile[proj].Calamity().forceRogue = true;
|
||||
Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable();
|
||||
return false;
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas
|
||||
{
|
||||
if (projectile.type == ModContent.ProjectileType<Celestus2>())
|
||||
{
|
||||
damage = (int)((double)damage * 0.66);
|
||||
damage = (int)(damage * 0.66);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1067,6 +1067,10 @@ namespace CalamityMod.Projectiles
|
||||
crit = Main.rand.NextBool(6);
|
||||
}
|
||||
|
||||
//Needs to be done in here. If done in the projectile file, it's overridden by the thing above
|
||||
if (projectile.type == ProjectileType<PwnagehammerProj>() && projectile.ai[0] == 1f)
|
||||
crit = true;
|
||||
|
||||
if (rogue && stealthStrike && modPlayer.stealthStrikeAlwaysCrits)
|
||||
crit = true;
|
||||
}
|
||||
|
||||
@@ -1,41 +1,211 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
namespace CalamityMod.Projectiles.Hybrid
|
||||
{
|
||||
public class PwnagehammerProj : ModProjectile
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Hammer");
|
||||
ProjectileID.Sets.TrailCacheLength[projectile.type] = 10;
|
||||
ProjectileID.Sets.TrailingMode[projectile.type] = 0;
|
||||
}
|
||||
public class PwnagehammerProj : ModProjectile
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Hammer");
|
||||
ProjectileID.Sets.TrailCacheLength[projectile.type] = 10;
|
||||
ProjectileID.Sets.TrailingMode[projectile.type] = 0;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
projectile.width = 30;
|
||||
projectile.height = 30;
|
||||
projectile.friendly = true;
|
||||
projectile.penetrate = -1;
|
||||
projectile.aiStyle = 3;
|
||||
projectile.timeLeft = 120;
|
||||
projectile.extraUpdates = 3;
|
||||
aiType = ProjectileID.PaladinsHammerFriendly;
|
||||
projectile.melee = true;
|
||||
}
|
||||
public override void SetDefaults()
|
||||
{
|
||||
projectile.width = projectile.height = 40;
|
||||
projectile.friendly = true;
|
||||
projectile.timeLeft = 3600;
|
||||
projectile.melee = true;
|
||||
projectile.usesLocalNPCImmunity = true;
|
||||
projectile.localNPCHitCooldown = 10;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
projectile.velocity.X *= 1.06f;
|
||||
projectile.velocity.Y *= 1.06f;
|
||||
}
|
||||
public override void AI()
|
||||
{
|
||||
projectile.direction = projectile.spriteDirection = (projectile.velocity.X > 0f) ? 1 : -1;
|
||||
projectile.rotation += MathHelper.ToRadians(22.5f) * projectile.direction;
|
||||
|
||||
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
|
||||
{
|
||||
CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (projectile.ai[0] == 1f)
|
||||
{
|
||||
float distance = 400f;
|
||||
if (projectile.ai[1] == -1)
|
||||
{
|
||||
// used for finding a target
|
||||
for (int i = 0; i < Main.maxNPCs; i++)
|
||||
{
|
||||
NPC npc = Main.npc[i];
|
||||
if (npc.CanBeChasedBy(projectile, false))
|
||||
{
|
||||
Vector2 vec = npc.Center - projectile.Center;
|
||||
float distanceTo = vec.Length();
|
||||
distanceTo -= (float)Math.Sqrt(npc.width * npc.width + npc.height * npc.height) * 0.75f;
|
||||
if (distanceTo < distance && Collision.CanHit(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height))
|
||||
{
|
||||
projectile.ai[1] = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int index = (int)projectile.ai[1];
|
||||
float speed = 34f;
|
||||
float inertia = 15f;
|
||||
|
||||
if (!Main.npc[index].CanBeChasedBy(projectile, false))
|
||||
projectile.ai[1] = -1;
|
||||
|
||||
Vector2 direction = Main.npc[index].Center - projectile.Center;
|
||||
direction.Normalize();
|
||||
direction *= speed;
|
||||
projectile.velocity = (projectile.velocity * (inertia - 1) + direction) / inertia;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
projectile.velocity.X *= 0.9711f;
|
||||
projectile.velocity.Y += 0.426f;
|
||||
}
|
||||
|
||||
if (Main.rand.NextBool(2))
|
||||
{
|
||||
Vector2 offset = new Vector2(12, 0).RotatedByRandom(MathHelper.ToRadians(360f));
|
||||
Vector2 velOffset = new Vector2(4, 0).RotatedBy(offset.ToRotation());
|
||||
Dust dust = Dust.NewDustPerfect(new Vector2(projectile.Center.X, projectile.Center.Y) + offset, DustID.GoldFlame, new Vector2((projectile.velocity.X * 0.2f) + velOffset.X, (projectile.velocity.Y * 0.2f) + velOffset.Y), 100, new Color(255, 245, 198), 2f);
|
||||
dust.noGravity = true;
|
||||
}
|
||||
|
||||
if (Main.rand.NextBool(6))
|
||||
{
|
||||
Vector2 offset = new Vector2(12, 0).RotatedByRandom(MathHelper.ToRadians(360f));
|
||||
Vector2 velOffset = new Vector2(4, 0).RotatedBy(offset.ToRotation());
|
||||
Dust dust = Dust.NewDustPerfect(new Vector2(projectile.Center.X, projectile.Center.Y) + offset, DustID.GoldFlame, new Vector2((projectile.velocity.X * 0.2f) + velOffset.X, (projectile.velocity.Y * 0.2f) + velOffset.Y), 100, new Color(255, 245, 198), 2f);
|
||||
dust.noGravity = true;
|
||||
}
|
||||
}
|
||||
|
||||
public override void Kill(int timeLeft)
|
||||
{
|
||||
Player player = Main.player[projectile.owner];
|
||||
if (projectile.ai[0] == 1f)
|
||||
{
|
||||
float numberOfDusts = 40f;
|
||||
float rotFactor = 360f / numberOfDusts;
|
||||
for (int i = 0; i < numberOfDusts; i++)
|
||||
{
|
||||
float rot = MathHelper.ToRadians(i * rotFactor);
|
||||
Vector2 offset = new Vector2(15f, 0).RotatedBy(rot);
|
||||
Vector2 velOffset = new Vector2(10f, 0).RotatedBy(rot);
|
||||
Dust dust = Dust.NewDustPerfect(projectile.position + offset, 269, new Vector2(velOffset.X, velOffset.Y));
|
||||
dust.noGravity = true;
|
||||
dust.velocity = velOffset;
|
||||
dust.scale = 2.5f;
|
||||
if ((i % 2) == 0)
|
||||
{
|
||||
dust = Dust.NewDustPerfect(projectile.position + offset, 269, new Vector2(velOffset.X, velOffset.Y));
|
||||
dust.noGravity = true;
|
||||
dust.velocity = velOffset * 2f;
|
||||
dust.scale = 2.5f;
|
||||
}
|
||||
if ((i % 4) == 0)
|
||||
{
|
||||
dust = Dust.NewDustPerfect(projectile.position + offset, 269, new Vector2(velOffset.X, velOffset.Y));
|
||||
dust.noGravity = true;
|
||||
dust.velocity = velOffset / 2f;
|
||||
dust.scale = 2.5f;
|
||||
}
|
||||
}
|
||||
|
||||
float distance = 240f;
|
||||
|
||||
for (int k = 0; k < Main.maxNPCs; k++)
|
||||
{
|
||||
NPC npc = Main.npc[k];
|
||||
Vector2 vec = npc.Center - projectile.Center;
|
||||
float distanceTo = (float)Math.Sqrt(vec.X * vec.X + vec.Y * vec.Y);
|
||||
distanceTo -= (float)Math.Sqrt(npc.width * npc.width + npc.height * npc.height) * 0.75f;
|
||||
if (distanceTo < distance && npc.CanBeChasedBy(projectile, false) && k != projectile.localAI[0])
|
||||
{
|
||||
float alldamage = projectile.damage * 1.25f;
|
||||
double damage = npc.StrikeNPC((int)alldamage, projectile.knockBack, (projectile.velocity.X > 0f) ? 1 : -1);
|
||||
player.addDPS((int)damage);
|
||||
}
|
||||
}
|
||||
Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PwnagehammerHoming").WithVolume(1f), projectile.Center);
|
||||
Main.PlaySound(SoundID.Item14.WithVolume(.75f), projectile.position);
|
||||
}
|
||||
else
|
||||
{
|
||||
float numberOfDusts = 32f;
|
||||
float rotFactor = 360f / numberOfDusts;
|
||||
for (int i = 0; i < numberOfDusts; i++)
|
||||
{
|
||||
float rot = MathHelper.ToRadians(i * rotFactor);
|
||||
Vector2 offset = new Vector2(15f, 0).RotatedBy(rot);
|
||||
Vector2 velOffset = new Vector2(12.5f, 0).RotatedBy(rot);
|
||||
Dust dust = Dust.NewDustPerfect(projectile.position + offset, 269, new Vector2(velOffset.X, velOffset.Y));
|
||||
dust.noGravity = true;
|
||||
dust.velocity = velOffset;
|
||||
dust.scale = 2.5f;
|
||||
}
|
||||
|
||||
float distance = 168f;
|
||||
|
||||
for (int k = 0; k < Main.maxNPCs; k++)
|
||||
{
|
||||
NPC npc = Main.npc[k];
|
||||
Vector2 vec = npc.Center - projectile.Center;
|
||||
float distanceTo = (float)Math.Sqrt(vec.X * vec.X + vec.Y * vec.Y);
|
||||
distanceTo -= (float)Math.Sqrt(npc.width * npc.width + npc.height * npc.height) * 0.75f;
|
||||
if (distanceTo < distance && npc.CanBeChasedBy(projectile, false) && k != projectile.localAI[0])
|
||||
{
|
||||
float alldamage = projectile.damage * 0.75f;
|
||||
double damage = npc.StrikeNPC((int)alldamage, projectile.knockBack, (projectile.velocity.X > 0f) ? 1 : -1);
|
||||
player.addDPS((int)damage);
|
||||
}
|
||||
}
|
||||
|
||||
Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PwnagehammerSound").WithVolume(1f).WithPitchVariance(.08f), projectile.Center);
|
||||
Main.PlaySound(SoundID.Item14.WithVolume(.60f), projectile.position);
|
||||
}
|
||||
}
|
||||
|
||||
public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection)
|
||||
{
|
||||
if (projectile.ai[0] == 1f && Main.myPlayer == projectile.owner)
|
||||
{
|
||||
int hammer = Projectile.NewProjectile(projectile.Center, new Vector2(0, -15f), ModContent.ProjectileType<PwnagehammerProjStealthStrike>(), projectile.damage * 2, projectile.knockBack, projectile.owner, 0f, projectile.ai[1]);
|
||||
Main.projectile[hammer].localAI[0] = Math.Sign(projectile.velocity.X);
|
||||
Main.projectile[hammer].melee = projectile.melee;
|
||||
Main.projectile[hammer].Calamity().rogue = projectile.Calamity().rogue;
|
||||
}
|
||||
}
|
||||
|
||||
public override void ModifyHitPvp(Player target, ref int damage, ref bool crit)
|
||||
{
|
||||
if (projectile.ai[0] == 1f && Main.myPlayer == projectile.owner)
|
||||
{
|
||||
int hammer = Projectile.NewProjectile(projectile.Center, new Vector2(0, -15f), ModContent.ProjectileType<PwnagehammerProjStealthStrike>(), projectile.damage * 2, projectile.knockBack, projectile.owner, 0f, projectile.ai[1]);
|
||||
Main.projectile[hammer].localAI[0] = Math.Sign(projectile.velocity.X);
|
||||
Main.projectile[hammer].melee = projectile.melee;
|
||||
Main.projectile[hammer].Calamity().rogue = projectile.Calamity().rogue;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
|
||||
{
|
||||
projectile.localAI[0] = target.whoAmI;
|
||||
}
|
||||
|
||||
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
|
||||
{
|
||||
CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,143 @@
|
||||
using System;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Hybrid
|
||||
{
|
||||
public class PwnagehammerProjStealthStrike : ModProjectile
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Spectral Hammer");
|
||||
ProjectileID.Sets.TrailCacheLength[projectile.type] = 7;
|
||||
ProjectileID.Sets.TrailingMode[projectile.type] = 0;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
projectile.width = 40;
|
||||
projectile.height = 40;
|
||||
projectile.aiStyle = 0;
|
||||
projectile.friendly = true;
|
||||
projectile.penetrate = 1;
|
||||
projectile.tileCollide = false;
|
||||
projectile.ignoreWater = true;
|
||||
projectile.usesLocalNPCImmunity = true;
|
||||
}
|
||||
|
||||
public override Color? GetAlpha(Color lightColor)
|
||||
{
|
||||
return new Color(255, 248, 124, 255);
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
projectile.ai[0] += 1f;
|
||||
if (projectile.ai[0] < 42f)
|
||||
{
|
||||
projectile.velocity.Y *= 0.9575f;
|
||||
projectile.rotation += MathHelper.ToRadians(projectile.ai[0] * 0.5f) * projectile.localAI[0];
|
||||
}
|
||||
else if (projectile.ai[0] < 44f)
|
||||
{
|
||||
NPC target = Main.npc[(int)projectile.ai[1]];
|
||||
float velConst = 3f;
|
||||
projectile.velocity = new Vector2((target.Center.X - projectile.Center.X) / velConst, (target.Center.Y - projectile.Center.Y) / velConst);
|
||||
projectile.rotation += MathHelper.ToRadians(48f) * projectile.localAI[0];
|
||||
}
|
||||
|
||||
if (Main.rand.NextBool(2))
|
||||
{
|
||||
Vector2 offset = new Vector2(7, 0).RotatedByRandom(MathHelper.ToRadians(360f));
|
||||
Vector2 velOffset = new Vector2(3, 0).RotatedBy(offset.ToRotation());
|
||||
Dust dust = Dust.NewDustPerfect(new Vector2(projectile.position.X, projectile.position.Y) + offset, DustID.GoldFlame, new Vector2((projectile.velocity.X * 0.2f) + velOffset.X, (projectile.velocity.Y * 0.2f) + velOffset.Y), 100, new Color(255, 245, 198), 2f);
|
||||
dust.noGravity = true;
|
||||
}
|
||||
|
||||
if (Main.rand.NextBool(6))
|
||||
{
|
||||
Vector2 offset = new Vector2(7, 0).RotatedByRandom(MathHelper.ToRadians(360f));
|
||||
Vector2 velOffset = new Vector2(3, 0).RotatedBy(offset.ToRotation());
|
||||
Dust dust = Dust.NewDustPerfect(new Vector2(projectile.position.X, projectile.position.Y) + offset, DustID.GoldFlame, new Vector2((projectile.velocity.X * 0.2f) + velOffset.X, (projectile.velocity.Y * 0.2f) + velOffset.Y), 100, new Color(255, 245, 198), 2f);
|
||||
dust.noGravity = true;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool? CanHitNPC(NPC target)
|
||||
{
|
||||
if (projectile.ai[0] <= 42f)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public override bool CanHitPvp(Player target)
|
||||
{
|
||||
return projectile.ai[0] > 42f;
|
||||
}
|
||||
|
||||
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
|
||||
{
|
||||
projectile.localAI[0] = target.whoAmI;
|
||||
}
|
||||
|
||||
public override bool PreKill(int timeLeft)
|
||||
{
|
||||
Player player = Main.player[projectile.owner];
|
||||
|
||||
float numberOfDusts = 32f;
|
||||
float rotFactor = 360f / numberOfDusts;
|
||||
for (int i = 0; i < numberOfDusts; i++)
|
||||
{
|
||||
float rot = MathHelper.ToRadians(i * rotFactor);
|
||||
Vector2 offset = new Vector2(15f, 0).RotatedBy(rot);
|
||||
Vector2 velOffset = new Vector2(12.5f, 0).RotatedBy(rot);
|
||||
int dust = Dust.NewDust(projectile.position + offset, projectile.width, projectile.height, 269, velOffset.X, velOffset.Y);
|
||||
Main.dust[dust].noGravity = true;
|
||||
Main.dust[dust].velocity = velOffset;
|
||||
Main.dust[dust].scale = 2.5f;
|
||||
}
|
||||
|
||||
float distance = 168f;
|
||||
|
||||
for (int k = 0; k < Main.maxNPCs; k++)
|
||||
{
|
||||
NPC npc = Main.npc[k];
|
||||
Vector2 vec = npc.Center - projectile.Center;
|
||||
float distanceTo = (float)Math.Sqrt(vec.X * vec.X + vec.Y * vec.Y);
|
||||
if (distanceTo < distance && npc.CanBeChasedBy(projectile, false) && k != projectile.localAI[0])
|
||||
{
|
||||
float alldamage = projectile.damage * 0.5f;
|
||||
double damage = npc.StrikeNPC((int)alldamage, projectile.knockBack, projectile.velocity.X > 0f ? 1 : -1, true);
|
||||
player.addDPS((int)damage);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
|
||||
{
|
||||
SpriteEffects spriteEffects = SpriteEffects.None;
|
||||
if (projectile.spriteDirection == -1)
|
||||
{
|
||||
spriteEffects = SpriteEffects.FlipHorizontally;
|
||||
}
|
||||
Texture2D texture = Main.projectileTexture[projectile.type];
|
||||
Rectangle sourceRectangle = new Rectangle(0, 0, texture.Width, texture.Height);
|
||||
Vector2 origin = sourceRectangle.Size() / 2f;
|
||||
|
||||
for (int i = 0; i < projectile.oldPos.Length; i++)
|
||||
{
|
||||
float rot = MathHelper.ToRadians(22.5f) * Math.Sign(projectile.velocity.X);
|
||||
Vector2 drawPos = projectile.oldPos[i] - Main.screenPosition + origin + new Vector2(0f, projectile.gfxOffY);
|
||||
Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - i) / (float)projectile.oldPos.Length);
|
||||
spriteBatch.Draw(texture, drawPos, new Rectangle?(), color, projectile.rotation - (i * rot), origin, projectile.scale, spriteEffects, 0f);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 748 B |
@@ -0,0 +1,18 @@
|
||||
using Microsoft.Xna.Framework.Audio;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Sounds.Item
|
||||
{
|
||||
public class PwnagehammerHoming : ModSound
|
||||
{
|
||||
public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type)
|
||||
{
|
||||
soundInstance = sound.CreateInstance();
|
||||
soundInstance.Volume = volume * 1f;
|
||||
soundInstance.Pan = pan;
|
||||
Main.PlaySoundInstance(soundInstance);
|
||||
return soundInstance;
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,18 @@
|
||||
using Microsoft.Xna.Framework.Audio;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Sounds.Item
|
||||
{
|
||||
public class PwnagehammerSound : ModSound
|
||||
{
|
||||
public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type)
|
||||
{
|
||||
soundInstance = sound.CreateInstance();
|
||||
soundInstance.Volume = volume * 1f;
|
||||
soundInstance.Pan = pan;
|
||||
Main.PlaySoundInstance(soundInstance);
|
||||
return soundInstance;
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Reference in new issue
Block a user