Added Void Concentration Staff
i'm committing because github desktop stashed my changes to a completely diff branch and that was spooky
This commit is contained in:
1 parent
eb2e3054fc
commit
46d1e9fe00
14 files changed
+557
-4
No files matched your search
@@ -0,0 +1,36 @@
|
||||
using CalamityMod.CalPlayer;
|
||||
using CalamityMod.Projectiles.Summon;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Buffs.Summon
|
||||
{
|
||||
class VoidConcentrationBuff : ModBuff
|
||||
{
|
||||
public override void SetDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Concentrated Void");
|
||||
Description.SetDefault("The infinite void yearns for more...");
|
||||
Main.buffNoTimeDisplay[Type] = true;
|
||||
Main.buffNoSave[Type] = true;
|
||||
//Main.persistentBuff[Type] = true;
|
||||
}
|
||||
|
||||
public override void Update(Player player, ref int buffIndex)
|
||||
{
|
||||
CalamityPlayer mp = player.Calamity();
|
||||
int count = player.ownedProjectileCounts[ModContent.ProjectileType<VoidConcentrationAura>()];
|
||||
player.minionDamage += 0.05f; //5%
|
||||
player.armorPenetration += 10;
|
||||
if (!mp.voidAuraDamage && count == 0)
|
||||
{
|
||||
player.DelBuff(buffIndex);
|
||||
buffIndex--;
|
||||
}
|
||||
else
|
||||
{
|
||||
player.buffTime[buffIndex] = 18000;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 551 B |
@@ -571,6 +571,8 @@ namespace CalamityMod.CalPlayer
|
||||
public int roverDriveTimer = 0;
|
||||
public int roverFrameCounter = 0;
|
||||
public int roverFrame = 0;
|
||||
public int voidFrameCounter = 0;
|
||||
public int voidFrame = 0;
|
||||
#endregion
|
||||
|
||||
#region Armor Set
|
||||
@@ -898,6 +900,8 @@ namespace CalamityMod.CalPlayer
|
||||
public bool plaguebringerMK2 = false;
|
||||
public bool igneousExaltation = false;
|
||||
public bool coldDivinity = false;
|
||||
public bool voidAura = false;
|
||||
public bool voidAuraDamage = false;
|
||||
public bool youngDuke = false;
|
||||
public bool virili = false;
|
||||
public bool frostBlossom = false;
|
||||
@@ -1926,6 +1930,8 @@ namespace CalamityMod.CalPlayer
|
||||
plaguebringerMK2 = false;
|
||||
igneousExaltation = false;
|
||||
coldDivinity = false;
|
||||
voidAura = false;
|
||||
voidAuraDamage = false;
|
||||
radiantResolution = false;
|
||||
virili = false;
|
||||
frostBlossom = false;
|
||||
@@ -3682,6 +3688,14 @@ namespace CalamityMod.CalPlayer
|
||||
}
|
||||
roverFrameCounter++;
|
||||
|
||||
int frames = 4;
|
||||
if (voidFrameCounter >= 6)
|
||||
{
|
||||
voidFrameCounter = 0;
|
||||
voidFrame = voidFrame == frames - 1 ? 0 : voidFrame + 1;
|
||||
}
|
||||
voidFrameCounter++;
|
||||
|
||||
for (int i = 0; i < player.dye.Length; i++)
|
||||
{
|
||||
if (player.dye[i].type == ModContent.ItemType<ProfanedMoonlightDye>())
|
||||
|
||||
@@ -404,6 +404,25 @@ namespace CalamityMod.CalPlayer
|
||||
}
|
||||
});
|
||||
|
||||
public static readonly PlayerLayer ConcentratedVoidAura = new PlayerLayer("CalamityMod", "VoidAura", PlayerLayer.Skin, drawInfo =>
|
||||
{
|
||||
Player drawPlayer = drawInfo.drawPlayer;
|
||||
CalamityPlayer modPlayer = drawPlayer.Calamity();
|
||||
if (modPlayer.voidAura || modPlayer.voidAuraDamage)
|
||||
{
|
||||
Texture2D tex = ModContent.GetTexture("CalamityMod/ExtraTextures/VoidConcentrationAura");
|
||||
Vector2 drawPos = drawPlayer.Center - Main.screenPosition + new Vector2(0f, drawPlayer.gfxOffY);
|
||||
drawPos.Y -= 9;
|
||||
SpriteEffects spriteEffects = drawPlayer.direction != -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; //intentionally inverse due to giving more space for the player model without faffing about with the specific positioning
|
||||
Rectangle frame = tex.Frame(1, 4, 0, modPlayer.voidFrame);
|
||||
Vector2 origin = new Vector2(tex.Width / 2f, tex.Height / 2f / 4f);
|
||||
float scale = 1.75f;
|
||||
|
||||
DrawData data = new DrawData(tex, drawPos, frame, Color.White * 0.4f, 0f, origin, scale, spriteEffects, 0);
|
||||
Main.playerDrawData.Add(data);
|
||||
}
|
||||
});
|
||||
|
||||
public static readonly PlayerLayer RoverDriveShield = new PlayerLayer("CalamityMod", "RoverDrive", PlayerLayer.Skin, drawInfo =>
|
||||
{
|
||||
Player drawPlayer = drawInfo.drawPlayer;
|
||||
@@ -682,6 +701,7 @@ namespace CalamityMod.CalPlayer
|
||||
list.Insert(drawTheStupidSign, ForbiddenCircletSign);
|
||||
}
|
||||
list.Add(ColdDivinityOverlay);
|
||||
list.Add(ConcentratedVoidAura);
|
||||
list.Add(RoverDriveShield);
|
||||
list.Add(StratusSphereDrawing);
|
||||
list.Add(ProfanedMoonlightDyeEffects);
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
@@ -851,6 +851,21 @@ namespace CalamityMod.Items
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (player.ActiveItem().type == ModContent.ItemType<VoidConcentrationStaff>() && player.ownedProjectileCounts[ModContent.ProjectileType<VoidConcentrationBlackhole>()] == 0)
|
||||
{
|
||||
for (int i = 0; i < Main.projectile.Length; i++)
|
||||
{
|
||||
if (Main.projectile[i].modProjectile is VoidConcentrationAura)
|
||||
{
|
||||
if (Main.projectile[i].active && Main.projectile[i].owner == player.whoAmI)
|
||||
{
|
||||
(Main.projectile[i].modProjectile as VoidConcentrationAura).HandleRightClick();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (player.ActiveItem().type == ModContent.ItemType<ColdDivinity>())
|
||||
{
|
||||
bool canContinue = true;
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
using CalamityMod.Buffs.Summon;
|
||||
using CalamityMod.Items.Materials;
|
||||
using CalamityMod.Projectiles.Summon;
|
||||
using Microsoft.Xna.Framework;
|
||||
using System.Linq;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Items.Weapons.Summon
|
||||
{
|
||||
class VoidConcentrationStaff : ModItem
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Void Concentration Staff");
|
||||
Tooltip.SetDefault("Summons a foreboding aura\n" + //If you have flavour text ideas, feel free to implement, my brain is still like nonexistant as per usual yeah.
|
||||
"Requires three minion slots to use\n" +
|
||||
"Only one may exist\n" +
|
||||
"Right click to launch a black hole that grows in size");
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
item.width = 52;
|
||||
item.height = 72;
|
||||
item.useStyle = ItemUseStyleID.SwingThrow;
|
||||
item.noMelee = true;
|
||||
item.UseSound = SoundID.DD2_EtherianPortalOpen;
|
||||
item.summon = true;
|
||||
|
||||
item.mana = 100;
|
||||
item.damage = 150;
|
||||
item.knockBack = 4f;
|
||||
item.useTime = item.useAnimation = 10;
|
||||
item.shoot = ModContent.ProjectileType<VoidConcentrationAura>();
|
||||
item.shootSpeed = 10f;
|
||||
|
||||
item.value = CalamityGlobalItem.RarityPureGreenBuyPrice;
|
||||
item.rare = ItemRarityID.Purple;
|
||||
item.Calamity().customRarity = CalamityRarity.PureGreen;
|
||||
}
|
||||
|
||||
public override bool CanUseItem(Player player)
|
||||
{
|
||||
if (player.altFunctionUse != 2)
|
||||
return player.ownedProjectileCounts[ModContent.ProjectileType<VoidConcentrationAura>()] == 0;
|
||||
return base.CanUseItem(player);
|
||||
}
|
||||
|
||||
public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
|
||||
{
|
||||
if (player.altFunctionUse != 2)
|
||||
{
|
||||
Projectile.NewProjectile(player.Center, Vector2.Zero, type, damage, knockBack, player.whoAmI, 0f);
|
||||
player.AddBuff(ModContent.BuffType<VoidConcentrationBuff>(), 120);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public override bool AltFunctionUse(Player player)
|
||||
{
|
||||
return base.AltFunctionUse(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
@@ -7,6 +7,7 @@ using CalamityMod.Items.Placeables.Furniture.Trophies;
|
||||
using CalamityMod.Items.Potions;
|
||||
using CalamityMod.Items.TreasureBags;
|
||||
using CalamityMod.Items.Weapons.Melee;
|
||||
using CalamityMod.Items.Weapons.Summon;
|
||||
using CalamityMod.World;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
@@ -147,11 +148,13 @@ namespace CalamityMod.NPCs.CeaselessVoid
|
||||
// Materials
|
||||
DropHelper.DropItem(npc, ModContent.ItemType<DarkPlasma>(), true, 2, 3);
|
||||
|
||||
// Weapons
|
||||
DropHelper.DropItemChance(npc, ModContent.ItemType<MirrorBlade>(), 4);
|
||||
// Weapons
|
||||
float dropChance = DropHelper.NormalWeaponDropRateFloat;
|
||||
DropHelper.DropItemChance(npc, ModContent.ItemType<MirrorBlade>(), dropChance);
|
||||
DropHelper.DropItemChance(npc, ModContent.ItemType<VoidConcentrationStaff>(), dropChance);
|
||||
|
||||
// Equipment
|
||||
DropHelper.DropItemChance(npc, ModContent.ItemType<ArcanumoftheVoid>(), 2);
|
||||
// Equipment
|
||||
DropHelper.DropItemChance(npc, ModContent.ItemType<ArcanumoftheVoid>(), 2);
|
||||
|
||||
// Vanity
|
||||
DropHelper.DropItemChance(npc, ModContent.ItemType<CeaselessVoidMask>(), 7);
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
using CalamityMod.Buffs.Summon;
|
||||
using CalamityMod.CalPlayer;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Steamworks;
|
||||
using System.IO;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Summon
|
||||
{
|
||||
class VoidConcentrationAura : ModProjectile
|
||||
{
|
||||
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
|
||||
public int timer = 0;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Concentrated Void Aura");
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
projectile.width = 46;
|
||||
projectile.height = 80;
|
||||
projectile.netImportant = true;
|
||||
projectile.friendly = true;
|
||||
projectile.ignoreWater = true;
|
||||
projectile.minionSlots = 3f;
|
||||
projectile.timeLeft = 18000;
|
||||
projectile.penetrate = -1;
|
||||
|
||||
projectile.tileCollide = false;
|
||||
projectile.timeLeft *= 5;
|
||||
projectile.minion = true;
|
||||
}
|
||||
|
||||
public override void SendExtraAI(BinaryWriter writer)
|
||||
{
|
||||
writer.Write(timer);
|
||||
}
|
||||
|
||||
public override void ReceiveExtraAI(BinaryReader reader)
|
||||
{
|
||||
timer = reader.ReadInt32();
|
||||
}
|
||||
|
||||
public override bool? CanCutTiles()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public void HandleRightClick()
|
||||
{
|
||||
Vector2 velocity = Main.MouseWorld - Main.player[projectile.owner].Center;
|
||||
velocity.Normalize();
|
||||
velocity *= 2f;
|
||||
Projectile.NewProjectile(Main.player[projectile.owner].Center, velocity, ModContent.ProjectileType<VoidConcentrationBlackhole>(), (int)(projectile.damage * 5f), 0f, projectile.owner);
|
||||
projectile.Kill();
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Player owner = Main.player[projectile.owner];
|
||||
CalamityPlayer mp = owner.Calamity();
|
||||
projectile.Center = owner.Center;
|
||||
mp.voidAuraDamage = true;
|
||||
if (owner.dead)
|
||||
mp.voidAuraDamage = false;
|
||||
if (!mp.voidAuraDamage)
|
||||
{
|
||||
mp.voidAura = false;
|
||||
projectile.Kill();
|
||||
}
|
||||
if (owner.whoAmI == Main.myPlayer && owner.ownedProjectileCounts[projectile.type] <= 25 && timer > 0 && timer % 4 == 0)
|
||||
{
|
||||
NPC target = CalamityUtils.MinionHoming(projectile.Center, 1800f, owner);
|
||||
if (target != null)
|
||||
{
|
||||
Vector2 correctedVelocity = target.Center - owner.Center;
|
||||
correctedVelocity.Normalize();
|
||||
correctedVelocity *= 3f;
|
||||
int perturbificator9000 = Main.rand.Next(-1, 2);
|
||||
Vector2 perturbedspeed = new Vector2(correctedVelocity.X + perturbificator9000, correctedVelocity.Y + perturbificator9000).RotatedBy(MathHelper.ToRadians(Main.rand.Next(1, 3)));
|
||||
Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedspeed.X, perturbedspeed.Y, ModContent.ProjectileType<VoidConcentrationOrb>(), (int)(projectile.damage * 0.75f), 0f, owner.whoAmI);
|
||||
}
|
||||
timer = -1;
|
||||
}
|
||||
if (timer > 50 && timer % 4 == 0)
|
||||
return;
|
||||
timer++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,190 @@
|
||||
using CalamityMod.NPCs;
|
||||
using CalamityMod.Projectiles.Melee;
|
||||
using CalamityMod.Projectiles.Typeless;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Summon
|
||||
{
|
||||
class VoidConcentrationBlackhole : ModProjectile
|
||||
{
|
||||
private int damage = 0;
|
||||
|
||||
public override void SendExtraAI(BinaryWriter writer)
|
||||
{
|
||||
writer.Write(damage);
|
||||
}
|
||||
|
||||
public override void ReceiveExtraAI(BinaryReader reader)
|
||||
{
|
||||
damage = reader.ReadInt32();
|
||||
}
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Black Hole");
|
||||
Main.projFrames[projectile.type] = 4;
|
||||
ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
projectile.width = 80; //32 base, 2.5x the normal (for hitbox purposes)
|
||||
projectile.height = 85; //34 base, 2.5x the normal (for hitbox purposes)
|
||||
projectile.netImportant = true;
|
||||
projectile.friendly = true;
|
||||
projectile.ignoreWater = true;
|
||||
projectile.minionSlots = 0f;
|
||||
projectile.timeLeft = 1800;
|
||||
projectile.penetrate = -1;
|
||||
|
||||
projectile.tileCollide = false;
|
||||
projectile.minion = true;
|
||||
projectile.scale = 0.01f;
|
||||
}
|
||||
|
||||
private void ApplySucc(NPC npc)
|
||||
{
|
||||
float succStrength = 4f / projectile.scale;
|
||||
succStrength *= projectile.scale;
|
||||
Vector2 velocity = projectile.Center - npc.Center;
|
||||
velocity *= 2f;
|
||||
velocity.SafeNormalize(Vector2.Zero);
|
||||
float num550 = 5f * projectile.scale;
|
||||
Vector2 vector43 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f);
|
||||
float num551 = projectile.Center.X - vector43.X;
|
||||
float num552 = projectile.Center.Y - vector43.Y;
|
||||
float num553 = (float)Math.Sqrt((double)(num551 * num551 + num552 * num552));
|
||||
if (num553 < 100f)
|
||||
{
|
||||
num550 = 28f; //14
|
||||
}
|
||||
num553 = num550 / num553;
|
||||
num551 *= num553;
|
||||
num552 *= num553;
|
||||
npc.velocity.X = (velocity.X * 15f + num551) / 16f;
|
||||
npc.velocity.Y = (velocity.Y * 15f + num552) / 16f;
|
||||
npc.velocity = (velocity / succStrength);
|
||||
}
|
||||
|
||||
private void Death()
|
||||
{
|
||||
if (projectile.scale >= 2.5f) //it's boom o' clock
|
||||
{
|
||||
projectile.height *= 2;
|
||||
projectile.width *= 2;
|
||||
projectile.maxPenetrate = -1;
|
||||
projectile.penetrate = -1;
|
||||
projectile.usesLocalNPCImmunity = true;
|
||||
projectile.localNPCHitCooldown = 10;
|
||||
projectile.damage = damage;
|
||||
projectile.Damage();
|
||||
projectile.friendly = false;
|
||||
projectile.Damage();
|
||||
Main.PlaySound(SoundID.Item, (int)projectile.Center.X, (int)projectile.Center.Y, 14);
|
||||
projectile.Kill();
|
||||
}
|
||||
}
|
||||
|
||||
public override void Kill(int timeLeft)
|
||||
{
|
||||
for (int d = 0; d < 6; d++)
|
||||
{
|
||||
int shadow = Dust.NewDust(projectile.position, projectile.width, projectile.height, 27, 0f, 0f, 100, new Color(0, 0, 0), 4f);
|
||||
Main.dust[shadow].velocity *= 3f;
|
||||
if (Main.rand.NextBool(2))
|
||||
{
|
||||
Main.dust[shadow].scale = 0.5f;
|
||||
Main.dust[shadow].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f;
|
||||
}
|
||||
}
|
||||
for (int d = 0; d < 18; d++)
|
||||
{
|
||||
int shadow = Dust.NewDust(projectile.position, projectile.width, projectile.height, 27, 0f, 0f, 100, new Color(0, 0, 0), 4f);
|
||||
Main.dust[shadow].noGravity = true;
|
||||
Main.dust[shadow].velocity *= 5f;
|
||||
shadow = Dust.NewDust(projectile.position, projectile.width, projectile.height, 27, 0f, 0f, 100, new Color(0, 0, 0), 3f);
|
||||
Main.dust[shadow].velocity *= 2f;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool PreAI()
|
||||
{
|
||||
if (damage == 0)
|
||||
{
|
||||
damage = projectile.damage;
|
||||
projectile.damage = 0;
|
||||
projectile.position = Main.player[projectile.owner].position;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
|
||||
{
|
||||
Texture2D texture = Main.projectileTexture[projectile.type];
|
||||
Vector2 drawPos = projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY);
|
||||
int height = texture.Height / Main.projFrames[projectile.type];
|
||||
int frameHeight = height * projectile.frame;
|
||||
Rectangle rectangle = new Rectangle(0, frameHeight, texture.Width, height);
|
||||
Vector2 origin = new Vector2(texture.Width / 2f, height / 2f);
|
||||
SpriteEffects spriteEffects = SpriteEffects.None;
|
||||
if (projectile.spriteDirection == -1)
|
||||
spriteEffects = SpriteEffects.FlipHorizontally;
|
||||
spriteBatch.Draw(texture, drawPos, new Microsoft.Xna.Framework.Rectangle?(rectangle), lightColor, projectile.rotation, origin, projectile.scale, spriteEffects, 0f);
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
|
||||
projectile.scale += 0.01f;
|
||||
if (projectile.scale % 0.02f == 0)
|
||||
{
|
||||
projectile.scale += 0.01f; //speeds up the projectile's growth to prevent it being too long
|
||||
}
|
||||
int radius = (int)(projectile.scale * 100f); //0.01f; to a max of 2.5f; so radius of 1 to 250 by default
|
||||
if (projectile.scale >= 2f)
|
||||
radius *= 2;
|
||||
|
||||
int baseWidth = 32;
|
||||
int baseHeight = 34;
|
||||
int newWidth = (int)(baseWidth * projectile.scale);
|
||||
int newHeight = (int)(baseHeight * projectile.scale);
|
||||
CalamityGlobalProjectile.ExpandHitboxBy(projectile, newWidth, newHeight);
|
||||
|
||||
|
||||
|
||||
if (projectile.frameCounter > 6)
|
||||
{
|
||||
projectile.frame++;
|
||||
projectile.frameCounter = 0;
|
||||
}
|
||||
if (projectile.frame >= Main.projFrames[projectile.type] - 1)
|
||||
{
|
||||
projectile.frame = 0;
|
||||
}
|
||||
projectile.frameCounter++;
|
||||
|
||||
for (int i = 0; i < Main.npc.Length; i++)
|
||||
{
|
||||
if (Main.npc[i].active && !Main.npc[i].friendly /*&& CalamityGlobalNPC.ShouldAffectNPC(Main.npc[i])*/) //TODO - REMOVE COMMENT BEFORE MERGE
|
||||
{
|
||||
if (Vector2.Distance(projectile.Center, Main.npc[i].Center) <= radius)
|
||||
ApplySucc(Main.npc[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (projectile.scale >= 2.5f) //it's boom o' clock
|
||||
{
|
||||
Death();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
@@ -0,0 +1,115 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Summon
|
||||
{
|
||||
class VoidConcentrationOrb : ModProjectile
|
||||
{
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Void Orb");
|
||||
Main.projFrames[projectile.type] = 4;
|
||||
ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
projectile.width = 54;
|
||||
projectile.height = 50;
|
||||
projectile.netImportant = true;
|
||||
projectile.friendly = true;
|
||||
projectile.ignoreWater = true;
|
||||
projectile.minionSlots = 0f;
|
||||
projectile.timeLeft = 300;
|
||||
projectile.penetrate = 1;
|
||||
|
||||
projectile.tileCollide = false;
|
||||
projectile.minion = true;
|
||||
projectile.scale = 0.01f;
|
||||
}
|
||||
|
||||
public override bool? CanHitNPC(NPC target)
|
||||
{
|
||||
if (projectile.scale < 1f)
|
||||
return false;
|
||||
return null;
|
||||
}
|
||||
|
||||
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
|
||||
{
|
||||
for (int d = 0; d < 6; d++)
|
||||
{
|
||||
int shadow = Dust.NewDust(projectile.position, projectile.width, projectile.height, 27, 0f, 0f, 100, new Color(0, 0, 0), 2f);
|
||||
Main.dust[shadow].velocity *= 3f;
|
||||
if (Main.rand.NextBool(2))
|
||||
{
|
||||
Main.dust[shadow].scale = 0.5f;
|
||||
Main.dust[shadow].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f;
|
||||
}
|
||||
}
|
||||
for (int d = 0; d < 10; d++)
|
||||
{
|
||||
int shadow = Dust.NewDust(projectile.position, projectile.width, projectile.height, 27, 0f, 0f, 100, new Color(0, 0, 0), 3f);
|
||||
Main.dust[shadow].noGravity = true;
|
||||
Main.dust[shadow].velocity *= 5f;
|
||||
shadow = Dust.NewDust(projectile.position, projectile.width, projectile.height, 27, 0f, 0f, 100, new Color(0, 0, 0), 2f);
|
||||
Main.dust[shadow].velocity *= 2f;
|
||||
}
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Player owner = Main.player[projectile.owner];
|
||||
NPC target = CalamityUtils.MinionHoming(projectile.Center, 1800f, owner);
|
||||
|
||||
if (projectile.scale >= 1f)
|
||||
{
|
||||
if (target != null)
|
||||
{
|
||||
float num550 = 40f;
|
||||
Vector2 vector43 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f);
|
||||
float num551 = target.Center.X - vector43.X;
|
||||
float num552 = target.Center.Y - vector43.Y;
|
||||
float num553 = (float)Math.Sqrt((double)(num551 * num551 + num552 * num552));
|
||||
if (num553 < 100f)
|
||||
{
|
||||
num550 = 28f; //14
|
||||
}
|
||||
num553 = num550 / num553;
|
||||
num551 *= num553;
|
||||
num552 *= num553;
|
||||
projectile.velocity.X = (projectile.velocity.X * 25f + num551) / 26f;
|
||||
projectile.velocity.Y = (projectile.velocity.Y * 25f + num552) / 26f;
|
||||
if (Main.rand.NextBool(5))
|
||||
projectile.velocity *= 1.1f;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
projectile.scale += 0.025f;
|
||||
projectile.velocity *= 1.03f;
|
||||
}
|
||||
|
||||
if (projectile.frameCounter > 6)
|
||||
{
|
||||
projectile.frame++;
|
||||
projectile.frameCounter = 0;
|
||||
}
|
||||
if (projectile.frame >= Main.projFrames[projectile.type] - 1)
|
||||
{
|
||||
projectile.frame = 0;
|
||||
}
|
||||
projectile.frameCounter++;
|
||||
|
||||
if (projectile.timeLeft <= 60)
|
||||
{
|
||||
projectile.alpha += 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.6 KiB |
Reference in new issue
Block a user