added parasitic sceptor and izuna the dryad
This commit is contained in:
1 parent
dc246ef6a7
commit
b1af4fc818
9 files changed
+242
-6
No files matched your search
@@ -0,0 +1,95 @@
|
||||
using CalamityMod.Projectiles.Magic;
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Items.Weapons.Magic
|
||||
{
|
||||
public class ParasiticSceptor : ModItem
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Parasitic Sceptor");
|
||||
Tooltip.SetDefault("Fires a spread of water leeches that latch onto enemies, dealing a stacking damage over time");
|
||||
Item.staff[item.type] = true;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
item.damage = 12;
|
||||
item.knockBack = 3f;
|
||||
item.mana = 10;
|
||||
item.useTime = item.useAnimation = 25;
|
||||
item.autoReuse = true;
|
||||
item.magic = true;
|
||||
item.shootSpeed = 10f;
|
||||
item.shoot = ModContent.ProjectileType<WaterLeechProj>();
|
||||
|
||||
item.width = item.height = 52;
|
||||
item.UseSound = SoundID.Item46;
|
||||
item.noMelee = true;
|
||||
item.useStyle = 5;
|
||||
item.rare = 2;
|
||||
item.value = CalamityGlobalItem.Rarity2BuyPrice;
|
||||
}
|
||||
|
||||
public override Vector2? HoldoutOrigin() => new Vector2(15, 15);
|
||||
|
||||
public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
|
||||
{
|
||||
float speed = item.shootSpeed;
|
||||
Vector2 playerPos = player.RotatedRelativePoint(player.MountedCenter, true);
|
||||
float xDist = Main.mouseX + Main.screenPosition.X - playerPos.X;
|
||||
float yDist = Main.mouseY + Main.screenPosition.Y - playerPos.Y;
|
||||
if (player.gravDir == -1f)
|
||||
{
|
||||
yDist = Main.screenPosition.Y + Main.screenHeight - Main.mouseY - playerPos.Y;
|
||||
}
|
||||
Vector2 vector = new Vector2(xDist, yDist);
|
||||
float speedMult = vector.Length();
|
||||
if ((float.IsNaN(xDist) && float.IsNaN(yDist)) || (xDist == 0f && yDist == 0f))
|
||||
{
|
||||
xDist = player.direction;
|
||||
yDist = 0f;
|
||||
speedMult = speed;
|
||||
}
|
||||
else
|
||||
{
|
||||
speedMult = speed / speedMult;
|
||||
}
|
||||
xDist *= speedMult;
|
||||
yDist *= speedMult;
|
||||
int leechAmt = 2;
|
||||
if (Main.rand.NextBool(3))
|
||||
{
|
||||
leechAmt++;
|
||||
}
|
||||
if (Main.rand.NextBool(4))
|
||||
{
|
||||
leechAmt++;
|
||||
}
|
||||
if (Main.rand.NextBool(5))
|
||||
{
|
||||
leechAmt ++;
|
||||
}
|
||||
for (int i = 0; i < leechAmt; i++)
|
||||
{
|
||||
float xVec = xDist;
|
||||
float yVec = yDist;
|
||||
float spreadMult = 0.05f * i;
|
||||
xVec += Main.rand.NextFloat(-25f, 25f) * spreadMult;
|
||||
yVec += Main.rand.NextFloat(-25f, 25f) * spreadMult;
|
||||
Vector2 directionToShoot = new Vector2(xVec, yVec);
|
||||
speedMult = directionToShoot.Length();
|
||||
speedMult = speed / speedMult;
|
||||
xVec *= speedMult;
|
||||
yVec *= speedMult;
|
||||
directionToShoot = new Vector2(xVec, yVec);
|
||||
Projectile.NewProjectile(playerPos, directionToShoot, type, damage, knockBack, player.whoAmI, 0f, 0f);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.0 KiB |
@@ -1,5 +1,6 @@
|
||||
using CalamityMod.Dusts;
|
||||
using CalamityMod.Items.Placeables.Banners;
|
||||
using CalamityMod.Items.Weapons.Magic;
|
||||
using CalamityMod.World;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
@@ -174,5 +175,11 @@ namespace CalamityMod.NPCs.AcidRain
|
||||
{
|
||||
target.AddBuff(ModContent.BuffType<Irradiated>(), 120);
|
||||
}
|
||||
|
||||
public override void NPCLoot()
|
||||
{
|
||||
float dropChance = CalamityWorld.downedAquaticScourge ? 0.01f : 0.05f;
|
||||
DropHelper.DropItemChance(npc, ModContent.ItemType<ParasiticSceptor>(), dropChance);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -585,6 +585,28 @@ namespace CalamityMod.NPCs
|
||||
}
|
||||
}
|
||||
|
||||
if (irradiated > 0)
|
||||
{
|
||||
int projectileCount = 0;
|
||||
for (int j = 0; j < Main.maxProjectiles; j++)
|
||||
{
|
||||
if (Main.projectile[j].active && Main.projectile[j].type == ProjectileType<WaterLeechProj>() &&
|
||||
Main.projectile[j].ai[0] == 1f && Main.projectile[j].ai[1] == npc.whoAmI)
|
||||
{
|
||||
projectileCount++;
|
||||
}
|
||||
}
|
||||
|
||||
if (projectileCount > 0)
|
||||
{
|
||||
ApplyDPSDebuff(irradiated, projectileCount * 20, projectileCount * 4, ref npc.lifeRegen, ref damage);
|
||||
}
|
||||
else
|
||||
{
|
||||
ApplyDPSDebuff(irradiated, 20, 4, ref npc.lifeRegen, ref damage);
|
||||
}
|
||||
}
|
||||
|
||||
// Exo Freeze, Glacial State and Temporal Sadness don't work on bosses or other specific enemies.
|
||||
if (!npc.boss && !CalamityMod.movementImpairImmuneList.Contains(npc.type))
|
||||
{
|
||||
@@ -623,7 +645,6 @@ namespace CalamityMod.NPCs
|
||||
}
|
||||
|
||||
ApplyDPSDebuff(vaporfied, 30, 6, ref npc.lifeRegen, ref damage);
|
||||
ApplyDPSDebuff(irradiated, 20, 4, ref npc.lifeRegen, ref damage);
|
||||
ApplyDPSDebuff(bFlames, 40, 8, ref npc.lifeRegen, ref damage);
|
||||
ApplyDPSDebuff(hFlames, 50, 10, ref npc.lifeRegen, ref damage);
|
||||
ApplyDPSDebuff(pFlames, 100, 20, ref npc.lifeRegen, ref damage);
|
||||
@@ -2523,12 +2544,16 @@ namespace CalamityMod.NPCs
|
||||
break;
|
||||
|
||||
case NPCID.Dryad:
|
||||
switch (Main.rand.Next(22)) // 21 Dryad names
|
||||
switch (Main.rand.Next(23)) // 21 Dryad names
|
||||
{
|
||||
case 0:
|
||||
npc.GivenName = "Rythmi";
|
||||
break;
|
||||
|
||||
case 1:
|
||||
npc.GivenName = "Izuna";
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace CalamityMod.Projectiles.Boss
|
||||
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
|
||||
{
|
||||
Texture2D texture = Main.projectileTexture[projectile.type];
|
||||
int height = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type];
|
||||
int height = texture.Height / Main.projFrames[projectile.type];
|
||||
int drawStart = height * projectile.frame;
|
||||
Vector2 origin = projectile.Size / 2;
|
||||
SpriteEffects spriteEffects = SpriteEffects.None;
|
||||
@@ -62,7 +62,7 @@ namespace CalamityMod.Projectiles.Boss
|
||||
public override void PostDraw(SpriteBatch spriteBatch, Color lightColor)
|
||||
{
|
||||
Texture2D texture = Main.projectileTexture[projectile.type];
|
||||
int height = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type];
|
||||
int height = texture.Height / Main.projFrames[projectile.type];
|
||||
int drawStart = height * projectile.frame;
|
||||
Vector2 origin = projectile.Size / 2;
|
||||
SpriteEffects spriteEffects = SpriteEffects.None;
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace CalamityMod.Projectiles.Boss
|
||||
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
|
||||
{
|
||||
Texture2D texture = Main.projectileTexture[projectile.type];
|
||||
int height = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type];
|
||||
int height = texture.Height / Main.projFrames[projectile.type];
|
||||
int drawStart = height * projectile.frame;
|
||||
Vector2 origin = projectile.Size / 2;
|
||||
SpriteEffects spriteEffects = SpriteEffects.None;
|
||||
@@ -68,7 +68,7 @@ namespace CalamityMod.Projectiles.Boss
|
||||
public override void PostDraw(SpriteBatch spriteBatch, Color lightColor)
|
||||
{
|
||||
Texture2D texture = Main.projectileTexture[projectile.type];
|
||||
int height = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type];
|
||||
int height = texture.Height / Main.projFrames[projectile.type];
|
||||
int drawStart = height * projectile.frame;
|
||||
Vector2 origin = projectile.Size / 2;
|
||||
SpriteEffects spriteEffects = SpriteEffects.None;
|
||||
|
||||
@@ -0,0 +1,109 @@
|
||||
using CalamityMod.Buffs.StatDebuffs;
|
||||
using CalamityMod.Dusts;
|
||||
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 WaterLeechProj : ModProjectile
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Leech");
|
||||
Main.projFrames[projectile.type] = 4;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
projectile.width = projectile.height = 18;
|
||||
projectile.friendly = true;
|
||||
projectile.penetrate = -1;
|
||||
projectile.timeLeft = 540;
|
||||
projectile.magic = true;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
projectile.frameCounter++;
|
||||
if (projectile.frameCounter > 4)
|
||||
{
|
||||
projectile.frame++;
|
||||
projectile.frameCounter = 0;
|
||||
}
|
||||
if (projectile.frame >= Main.projFrames[projectile.type])
|
||||
{
|
||||
projectile.frame = 0;
|
||||
}
|
||||
|
||||
if (projectile.ai[0] == 0f)
|
||||
{
|
||||
projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + MathHelper.Pi;
|
||||
}
|
||||
//Sticky Behaviour
|
||||
CalamityUtils.StickyProjAI(projectile, 5);
|
||||
}
|
||||
|
||||
public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection)
|
||||
{
|
||||
CalamityUtils.ModifyHitNPCSticky(projectile, 4, false);
|
||||
}
|
||||
|
||||
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
|
||||
{
|
||||
target.AddBuff(ModContent.BuffType<Irradiated>(), 180);
|
||||
}
|
||||
|
||||
public override void OnHitPvp(Player target, int damage, bool crit)
|
||||
{
|
||||
target.AddBuff(ModContent.BuffType<Irradiated>(), 180);
|
||||
}
|
||||
|
||||
public override bool OnTileCollide(Vector2 oldVelocity)
|
||||
{
|
||||
Collision.HitTiles(projectile.position + projectile.velocity, projectile.velocity, projectile.width, projectile.height);
|
||||
projectile.Kill();
|
||||
return false;
|
||||
}
|
||||
|
||||
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
|
||||
{
|
||||
Texture2D texture = Main.projectileTexture[projectile.type];
|
||||
int height = texture.Height / Main.projFrames[projectile.type];
|
||||
int drawStart = height * projectile.frame;
|
||||
Vector2 origin = projectile.Size / 2;
|
||||
SpriteEffects spriteEffects = SpriteEffects.None;
|
||||
if (projectile.spriteDirection == -1)
|
||||
spriteEffects = SpriteEffects.FlipHorizontally;
|
||||
|
||||
spriteBatch.Draw(texture, projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, drawStart, texture.Width, height)), Color.White, projectile.rotation, origin, projectile.scale, spriteEffects, 0f);
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void PostDraw(SpriteBatch spriteBatch, Color lightColor)
|
||||
{
|
||||
Texture2D texture = Main.projectileTexture[projectile.type];
|
||||
int height = texture.Height / Main.projFrames[projectile.type];
|
||||
int drawStart = height * projectile.frame;
|
||||
Vector2 origin = projectile.Size / 2;
|
||||
SpriteEffects spriteEffects = SpriteEffects.None;
|
||||
if (projectile.spriteDirection == -1)
|
||||
spriteEffects = SpriteEffects.FlipHorizontally;
|
||||
|
||||
spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Projectiles/Magic/WaterLeechProjGlow"), projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, drawStart, texture.Width, height)), Color.White, projectile.rotation, origin, projectile.scale, spriteEffects, 0f);
|
||||
}
|
||||
|
||||
public override void Kill(int timeLeft)
|
||||
{
|
||||
Main.PlaySound(4, (int)projectile.position.X, (int)projectile.position.Y, 1, 0.5f, 0f);
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
int dust = Dust.NewDust(projectile.Center, 1, 1, (int)CalamityDusts.SulfurousSeaAcid, 0, 0, 0, default, 1.5f);
|
||||
Main.dust[dust].noGravity = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 610 B |
Binary file not shown.
|
After Width: | Height: | Size: 366 B |
Reference in new issue
Block a user