added terra disk (unobtainable)
This commit is contained in:
1 parent
704a0106b9
commit
113569841e
8 files changed
+307
No files matched your search
@@ -0,0 +1,74 @@
|
||||
using CalamityMod.Items.Materials;
|
||||
using CalamityMod.Projectiles.Typeless;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Items.Weapons.Melee
|
||||
{
|
||||
public class TerraDiskMelee : ModItem
|
||||
{
|
||||
public static int BaseDamage = 70;
|
||||
public static float Speed = 12f;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Terra Disk");
|
||||
Tooltip.SetDefault(@"Throws a disk that has a chance to generate several disks if enemies are near it
|
||||
A max of three disks can be active at a time");
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
item.width = 46;
|
||||
item.height = 46;
|
||||
item.damage = BaseDamage;
|
||||
item.knockBack = 4f;
|
||||
item.useAnimation = 16;
|
||||
item.useTime = 16;
|
||||
item.autoReuse = true;
|
||||
item.noMelee = true;
|
||||
item.noUseGraphic = true;
|
||||
|
||||
item.useStyle = 1;
|
||||
item.UseSound = SoundID.Item1;
|
||||
|
||||
item.value = Item.buyPrice(0, 80, 0, 0);
|
||||
item.rare = 8;
|
||||
|
||||
item.melee = true;
|
||||
item.shoot = ModContent.ProjectileType<TerraDiskProjectile>();
|
||||
item.shootSpeed = Speed;
|
||||
}
|
||||
|
||||
public override bool CanUseItem(Player player)
|
||||
{
|
||||
if (player.ownedProjectileCounts[item.shoot] >= 3)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
Main.projectile[proj].Calamity().forceMelee = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/*public override void AddRecipes()
|
||||
{
|
||||
ModRecipe recipe = new ModRecipe(mod);
|
||||
recipe.SetResult(this);
|
||||
recipe.AddIngredient(ModContent.ItemType<SeashellBoomerangMelee>());
|
||||
recipe.AddIngredient(ModContent.ItemType<LivingShard>(), 8);
|
||||
recipe.AddTile(TileID.MythrilAnvil);
|
||||
recipe.AddRecipe();
|
||||
}*/
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.0 KiB |
@@ -0,0 +1,74 @@
|
||||
using CalamityMod.Items.Materials;
|
||||
using CalamityMod.Projectiles.Typeless;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Items.Weapons.Rogue
|
||||
{
|
||||
public class TerraDisk : RogueWeapon
|
||||
{
|
||||
public static int BaseDamage = 70;
|
||||
public static float Speed = 12f;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Terra Disk");
|
||||
Tooltip.SetDefault(@"Throws a disk that has a chance to generate several disks if enemies are near it
|
||||
A max of three disks can be active at a time");
|
||||
}
|
||||
|
||||
public override void SafeSetDefaults()
|
||||
{
|
||||
item.width = 46;
|
||||
item.height = 46;
|
||||
item.damage = BaseDamage;
|
||||
item.knockBack = 4f;
|
||||
item.useAnimation = 16;
|
||||
item.useTime = 16;
|
||||
item.autoReuse = true;
|
||||
item.noMelee = true;
|
||||
item.noUseGraphic = true;
|
||||
|
||||
item.useStyle = 1;
|
||||
item.UseSound = SoundID.Item1;
|
||||
|
||||
item.value = Item.buyPrice(0, 80, 0, 0);
|
||||
item.rare = 8;
|
||||
|
||||
item.Calamity().rogue = true;
|
||||
item.shoot = ModContent.ProjectileType<TerraDiskProjectile>();
|
||||
item.shootSpeed = Speed;
|
||||
}
|
||||
|
||||
public override bool CanUseItem(Player player)
|
||||
{
|
||||
if (player.ownedProjectileCounts[item.shoot] >= 3)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
Main.projectile[proj].Calamity().forceRogue = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/*public override void AddRecipes()
|
||||
{
|
||||
ModRecipe recipe = new ModRecipe(mod);
|
||||
recipe.SetResult(this);
|
||||
recipe.AddIngredient(ModContent.ItemType<SeashellBoomerang>());
|
||||
recipe.AddIngredient(ModContent.ItemType<LivingShard>(), 8);
|
||||
recipe.AddTile(TileID.MythrilAnvil);
|
||||
recipe.AddRecipe();
|
||||
}*/
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.0 KiB |
@@ -0,0 +1,114 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Typeless
|
||||
{
|
||||
public class TerraDiskProjectile : ModProjectile
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Terra Disk");
|
||||
ProjectileID.Sets.TrailCacheLength[projectile.type] = 10;
|
||||
ProjectileID.Sets.TrailingMode[projectile.type] = 1;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
projectile.width = 46;
|
||||
projectile.height = 46;
|
||||
projectile.friendly = true;
|
||||
projectile.tileCollide = false;
|
||||
projectile.usesLocalNPCImmunity = true;
|
||||
projectile.localNPCHitCooldown = 10;
|
||||
projectile.penetrate = -1;
|
||||
projectile.aiStyle = 3;
|
||||
projectile.timeLeft = 180;
|
||||
aiType = 52;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Lighting.AddLight(projectile.Center, 0f, (255 - projectile.alpha) * 0.75f / 255f, 0f);
|
||||
if (Main.rand.NextBool(5))
|
||||
{
|
||||
Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 107, projectile.velocity.X, projectile.velocity.Y);
|
||||
}
|
||||
int[] array = new int[20];
|
||||
int num428 = 0;
|
||||
float num429 = 300f;
|
||||
bool flag14 = false;
|
||||
for (int num430 = 0; num430 < 200; num430++)
|
||||
{
|
||||
if (Main.npc[num430].CanBeChasedBy(projectile, false))
|
||||
{
|
||||
float num431 = Main.npc[num430].position.X + (float)(Main.npc[num430].width / 2);
|
||||
float num432 = Main.npc[num430].position.Y + (float)(Main.npc[num430].height / 2);
|
||||
float num433 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num431) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num432);
|
||||
if (num433 < num429 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1))
|
||||
{
|
||||
if (num428 < 20)
|
||||
{
|
||||
array[num428] = num430;
|
||||
num428++;
|
||||
}
|
||||
flag14 = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (flag14)
|
||||
{
|
||||
int num434 = Main.rand.Next(num428);
|
||||
num434 = array[num434];
|
||||
float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2);
|
||||
float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2);
|
||||
projectile.localAI[0] += 1f;
|
||||
if (projectile.localAI[0] > 8f)
|
||||
{
|
||||
projectile.localAI[0] = 0f;
|
||||
float num437 = 6f;
|
||||
Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f);
|
||||
value10 += projectile.velocity * 4f;
|
||||
float num438 = num435 - value10.X;
|
||||
float num439 = num436 - value10.Y;
|
||||
float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439));
|
||||
num440 = num437 / num440;
|
||||
if (Main.rand.NextBool(5))
|
||||
{
|
||||
if (projectile.owner == Main.myPlayer)
|
||||
{
|
||||
float spread = 60f * 0.0174f;
|
||||
double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2;
|
||||
double deltaAngle = spread / 6f;
|
||||
double offsetAngle;
|
||||
int i;
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i;
|
||||
int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType<TerraDiskProjectile2>(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f);
|
||||
if (projectile.melee)
|
||||
Main.projectile[proj].Calamity().forceMelee = true;
|
||||
else
|
||||
Main.projectile[proj].Calamity().forceRogue = true;
|
||||
int proj2 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType<TerraDiskProjectile2>(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f);
|
||||
if (projectile.melee)
|
||||
Main.projectile[proj2].Calamity().forceMelee = true;
|
||||
else
|
||||
Main.projectile[proj2].Calamity().forceRogue = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
|
||||
{
|
||||
CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.0 KiB |
@@ -0,0 +1,45 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Typeless
|
||||
{
|
||||
public class TerraDiskProjectile2 : ModProjectile
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Terra Disk");
|
||||
ProjectileID.Sets.TrailCacheLength[projectile.type] = 10;
|
||||
ProjectileID.Sets.TrailingMode[projectile.type] = 1;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
projectile.width = 40;
|
||||
projectile.height = 40;
|
||||
projectile.alpha = 75;
|
||||
projectile.friendly = true;
|
||||
projectile.tileCollide = false;
|
||||
projectile.penetrate = -1;
|
||||
projectile.aiStyle = 3;
|
||||
projectile.timeLeft = 60;
|
||||
aiType = 52;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Lighting.AddLight(projectile.Center, 0f, (255 - projectile.alpha) * 0.75f / 255f, 0f);
|
||||
if (Main.rand.NextBool(5))
|
||||
{
|
||||
Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 107, projectile.velocity.X, projectile.velocity.Y);
|
||||
}
|
||||
}
|
||||
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
|
||||
{
|
||||
CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 487 B |
Reference in new issue
Block a user