Relic of Convergence

This commit is contained in:
DominicKarma42 committed 2020-04-18 20:09:36 -05:00
1 parent b630efcdef
commit 90a7cbe37d
6 files changed
+186 -1

No files matched your search

+37
View File
@@ -0,0 +1,37 @@
using CalamityMod.Projectiles.Typeless;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items
{
public class RelicOfConvergence : ModItem
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Relic of Convergence");
Tooltip.SetDefault("Creates a profaned crystal that charges power\n" +
"Holding out the crystal slows the player down\n" +
"At the end of its life, the crystal heals the player");
}
public override void SetDefaults()
{
item.width = 32;
item.height = 46;
item.useTime = item.useAnimation = 25;
item.reuseDelay = 15;
item.useStyle = ItemUseStyleID.HoldingOut;
item.UseSound = SoundID.DD2_DarkMageCastHeal;
item.noMelee = true;
item.noUseGraphic = true;
item.channel = true;
item.rare = 10;
item.Calamity().customRarity = CalamityRarity.Turquoise;
item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice;
item.shoot = ModContent.ProjectileType<RelicOfConvergenceCrystal>();
}
public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0;
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 914 B

+2 -1
View File
@@ -1,5 +1,6 @@
using CalamityMod.Buffs.Summon;
using CalamityMod.Events;
using CalamityMod.Items;
using CalamityMod.Items.Accessories;
using CalamityMod.Items.Accessories.Wings;
using CalamityMod.Items.Armor.Vanity;
@@ -408,7 +409,7 @@ namespace CalamityMod
BossDifficulty.TryGetValue("ProfanedGuardians", out float order);
int type = NPCType<ProfanedGuardianBoss>();
int summon = ItemType<ProfanedShard>();
List<int> loot = new List<int>() { ItemType<RelicOfResilience>(), ItemType<ProfanedCore>(), ItemID.GreaterHealingPotion };
List<int> loot = new List<int>() { ItemType<RelicOfResilience>(), ItemType<RelicOfConvergence>(), ItemType<ProfanedCore>(), ItemID.GreaterHealingPotion };
List<int> collection = new List<int>() { ItemType<ProfanedGuardianTrophy>(), ItemType<ProfanedGuardianMask>(), ItemType<KnowledgeProfanedGuardians>() };
string instructions = $"Use a [i:{summon}] in the Hallow or Underworld Biomes";
string despawn = CalamityUtils.ColorMessage("The guardians must protect their goddess at all costs.", new Color(0xFF, 0xA5, 0x00));
@@ -1,6 +1,7 @@
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Buffs.StatDebuffs;
using CalamityMod.Dusts;
using CalamityMod.Items;
using CalamityMod.Projectiles.Boss;
using CalamityMod.World;
using Microsoft.Xna.Framework;
@@ -295,6 +296,11 @@ namespace CalamityMod.NPCs.ProfanedGuardians
return true;
}
public override void NPCLoot()
{
DropHelper.DropItemChance(npc, ModContent.ItemType<RelicOfConvergence>(), 4);
}
public override void BossLoot(ref string name, ref int potionType)
{
name = "A Profaned Guardian";
@@ -0,0 +1,141 @@
using CalamityMod.Dusts;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Typeless
{
public class RelicOfConvergenceCrystal : ModProjectile
{
public const int SoundInterval = 15;
public const int TotalCrystalsToDraw = 3;
public const int CrystalsDrawTime = 90;
public const float MaxCrystalOffsetRadius = 80f;
public const float MaxDustOffsetRadius = 70f;
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Relic of Convergence");
}
public override void SetDefaults()
{
projectile.width = 32;
projectile.height = 46;
projectile.penetrate = -1;
projectile.tileCollide = false;
projectile.ignoreWater = true;
projectile.timeLeft = 240;
}
public override void AI()
{
Player player = Main.player[projectile.owner];
if (!player.channel)
{
projectile.Kill();
return;
}
// Restrict player movement (as a penalty).
player.velocity.X = MathHelper.Clamp(player.velocity.X, -5f, 5f);
if (player.velocity.Y < 0f)
{
player.velocity.Y = MathHelper.Clamp(player.velocity.Y, -6f, 0f);
}
UpdatePlayerVisuals(player);
// Make a constant "magical" sound.
if (projectile.soundDelay <= 0)
{
Main.PlaySound(SoundID.Item4, projectile.Center);
projectile.soundDelay = SoundInterval;
}
projectile.ai[0]++;
// Make a sound when fully charged.
if (projectile.ai[0] == CrystalsDrawTime)
{
Main.PlaySound(SoundID.DD2_DarkMageHealImpact, projectile.Center);
}
// Create a circle of dust. The circle expands outward at first until it reaches its "destination" radius.
// Once the circle is at its maximum size, some of the dust moves inward.
if (projectile.ai[0] >= CrystalsDrawTime)
{
GeneratePassiveDust(player);
}
if (projectile.timeLeft == 1)
{
for (int i = 0; i < 45; i++)
{
Dust dust = Dust.NewDustPerfect(projectile.Center, (int)CalamityDusts.ProfanedFire);
dust.velocity = Utils.NextVector2Circular(Main.rand, 28f, 28f);
dust.fadeIn = Main.rand.NextFloat(3f, 4f);
dust.noGravity = true;
}
player.HealEffect(35, false);
player.statLife += 35;
if (player.statLife > player.statLifeMax2)
{
player.statLife = player.statLifeMax2;
}
Main.PlaySound(SoundID.DD2_DarkMageHealImpact, projectile.Center);
}
}
public void UpdatePlayerVisuals(Player player)
{
projectile.Center = player.Center + Vector2.UnitX * 15f * player.direction;
// The crystal is a holdout projectile, so change the player's variables to reflect that
player.heldProj = projectile.whoAmI;
player.itemTime = 2;
player.itemAnimation = 2;
}
public void GeneratePassiveDust(Player player)
{
float radius = 45f;
if (projectile.ai[0] < CrystalsDrawTime + 30f)
{
radius = MathHelper.Lerp(0f, 45f, (projectile.ai[0] - CrystalsDrawTime) / 30f);
}
for (float angle = 0f; angle <= MathHelper.TwoPi; angle += MathHelper.ToRadians(Main.rand.NextFloat(6f, 8f)))
{
Dust dust = Dust.NewDustPerfect(projectile.Center + angle.ToRotationVector2() * radius, (int)CalamityDusts.ProfanedFire);
dust.position = projectile.Center + angle.ToRotationVector2() * radius;
dust.scale = Main.rand.NextFloat(0.8f, 1.1f);
dust.noGravity = true;
dust.velocity = player.velocity;
if (Main.rand.NextBool(15) || projectile.timeLeft == 1)
{
dust.velocity = projectile.DirectionFrom(dust.position) * Main.rand.NextFloat(4f, 5f);
if (projectile.timeLeft == 1)
dust.velocity *= 1.7f;
}
}
}
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
{
if (projectile.ai[0] >= CrystalsDrawTime)
return true;
float opacity = projectile.ai[0] / CrystalsDrawTime;
Texture2D crystalTexture = ModContent.GetTexture(Texture);
for (int i = 0; i < TotalCrystalsToDraw; i++)
{
float angle = MathHelper.TwoPi / TotalCrystalsToDraw * i + projectile.ai[0] / 10f;
float radius = MathHelper.Lerp(MaxCrystalOffsetRadius, 0f, projectile.ai[0] / CrystalsDrawTime);
Vector2 drawPositionOffset = angle.ToRotationVector2() * radius;
Vector2 drawPosition = projectile.Center + drawPositionOffset;
spriteBatch.Draw(crystalTexture,
drawPosition - Main.screenPosition,
null,
Color.White * opacity,
projectile.rotation,
projectile.Size * 0.5f,
projectile.scale,
SpriteEffects.None,
0f);
}
return false;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 914 B