public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { if (target.boss == false && target.knockBackResist != 0) { if (projectile.velocity.LengthSquared() > 4f) { target.velocity = SpellbladeMod.ClampMagnitude(projectile.velocity, 1) * knockback; } else { target.velocity = SpellbladeMod.ClampMagnitude(projectile.position - target.position, 1) * knockback / 2; } } base.OnHitNPC(target, damage, 0, crit); }
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 dir = Vector2.Normalize(Main.MouseWorld - player.position); Vector2 pos = SpellbladeMod.RaycastToPosition(player.position, player.Size, player.position + dir * 16 * 64, player.Size); Main.PlaySound(castSound, player.position); player.direction = dir.X > 0 ? 1 : -1; player.position = pos; if (player.whoAmI == Main.myPlayer) { Main.SetCameraLerp(0.1f, 30); } int id = Projectile.NewProjectile(player.position, dir * -projectileSpeed, ProjectileID.DD2SquireSonicBoom, projectileDamage, projectileKockback, Main.myPlayer); return(false); }
public override void SetStaticDefaults() { DisplayName.SetDefault("Granite Spellblade"); Tooltip.SetDefault("Shoots a demonic scythe with <right>."); customGlowMask = SpellbladeMod.SetStaticDefaultsGlowMask(this); }