Merging in separate Dance of Light branch

This commit is contained in:
Ozzatron committed 2020-04-04 02:44:56 -04:00
commit 86d866c2c1
13 files changed
+245 -219

No files matched your search

+2
View File
@@ -846,6 +846,8 @@ namespace CalamityMod.Items
tt2.overrideColor = new Color(Main.DiscoR, 100, 255);
if (item.type == ModContent.ItemType<BlushieStaff>())
tt2.overrideColor = new Color(0, 0, 255);
if (item.type == ModContent.ItemType<TheDanceofLight>())
tt2.overrideColor = TheDanceofLight.GetSyncedLightColor();
if (item.type == ModContent.ItemType<NanoblackReaperMelee>() || item.type == ModContent.ItemType<NanoblackReaperRogue>())
tt2.overrideColor = new Color(0.34f, 0.34f + 0.66f * Main.DiscoG / 255f, 0.34f + 0.5f * Main.DiscoG / 255f);
if (item.type == ModContent.ItemType<ProfanedSoulCrystal>())
-101
View File
@@ -1,101 +0,0 @@
using CalamityMod.Items.Materials;
using CalamityMod.Projectiles.Magic;
using CalamityMod.Tiles.Furniture.CraftingStations;
using Microsoft.Xna.Framework;
using System;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Weapons.Magic
{
public class Judgement : ModItem
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("The Dance of Light");
Tooltip.SetDefault("Casts a swarm of white flames from the sky");
}
public override void SetDefaults()
{
item.damage = 700;
item.magic = true;
item.mana = 9;
item.width = 28;
item.height = 30;
item.useTime = 10;
item.useAnimation = 10;
item.useStyle = 5;
item.noMelee = true;
item.knockBack = 4f;
item.value = Item.buyPrice(5, 0, 0, 0);
item.rare = 10;
item.UseSound = SoundID.Item88;
item.autoReuse = true;
item.shoot = ModContent.ProjectileType<WhiteFlame>();
item.shootSpeed = 30f;
item.Calamity().customRarity = CalamityRarity.Developer;
}
public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ItemID.LunarFlareBook);
recipe.AddIngredient(ModContent.ItemType<WrathoftheAncients>());
recipe.AddIngredient(ModContent.ItemType<ShadowspecBar>(), 5);
recipe.AddTile(ModContent.TileType<DraedonsForge>());
recipe.SetResult(this);
recipe.AddRecipe();
}
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 num72 = item.shootSpeed;
Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true);
float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X;
float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y;
if (player.gravDir == -1f)
{
num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y;
}
float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79));
if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f))
{
num78 = (float)player.direction;
num79 = 0f;
num80 = num72;
}
else
{
num80 = num72 / num80;
}
int num107 = 3;
for (int num108 = 0; num108 < num107; num108++)
{
vector2 = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f);
vector2.X = (vector2.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201);
vector2.Y -= (float)(100 * num108);
num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X;
num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y;
if (num79 < 0f)
{
num79 *= -1f;
}
if (num79 < 20f)
{
num79 = 20f;
}
num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79));
num80 = num72 / num80;
num78 *= num80;
num79 *= num80;
float speedX4 = num78 + (float)Main.rand.Next(-20, 21) * 0.02f;
float speedY5 = num79 + (float)Main.rand.Next(-20, 21) * 0.02f;
Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, type, damage, knockBack, player.whoAmI, 0f, (float)Main.rand.Next(15));
}
return false;
}
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 570 B

+93
View File
@@ -0,0 +1,93 @@
using CalamityMod.Items.Materials;
using CalamityMod.Projectiles.Magic;
using CalamityMod.Tiles.Furniture.CraftingStations;
using Microsoft.Xna.Framework;
using System;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Weapons.Magic
{
public class TheDanceofLight : ModItem
{
private static float SpawnAngleSpread = 0.4f * MathHelper.Pi;
private static float SpeedRandomness = 0.08f;
private static float Inaccuracy = 0.04f;
private static float MinSpawnDist = 40;
private static float MaxSpawnDist = 140;
public static Color GetLightColor(float deviation) => new Color(1f, 0.5f + 0.35f * MathHelper.Clamp(deviation, 0f, 1f), 1f);
public static Color GetSyncedLightColor() => GetLightColor(Main.DiscoG / 255f);
public static Color GetRandomLightColor() => GetLightColor(Main.rand.NextFloat());
public override void SetStaticDefaults()
{
DisplayName.SetDefault("The Dance of Light");
Tooltip.SetDefault("Barrages enemies with a hailstorm of Light Blades\nShow them the wrath of a Lightbearer");
}
public override void SetDefaults()
{
item.width = 40;
item.height = 42;
item.damage = 1800;
item.crit += 20;
item.knockBack = 4f;
item.magic = true;
item.mana = 6;
item.useStyle = ItemUseStyleID.HoldingOut;
item.useTime = 2;
item.useAnimation = 8;
item.reuseDelay = 5;
item.UseSound = SoundID.Item105;
item.autoReuse = true;
item.noMelee = true;
item.shoot = ModContent.ProjectileType<LightBlade>();
item.shootSpeed = 14f;
item.value = Item.buyPrice(platinum: 5);
item.rare = 10;
item.Calamity().customRarity = CalamityRarity.ItemSpecific;
}
public override Vector2? HoldoutOffset()
{
return Vector2.Zero;
}
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 numProjs = 2;
for(int i = 0; i < numProjs; ++i)
{
// Pick a random direction somewhere behind the player
float shootAngle = (float)Math.Atan2(speedY, speedX);
Vector2 offset = Main.rand.NextVector2Unit(MathHelper.Pi - SpawnAngleSpread, 2f * SpawnAngleSpread).RotatedBy(shootAngle);
// Set how far away this sword is spawning
offset *= Main.rand.NextFloat(MinSpawnDist, MaxSpawnDist);
Vector2 spawnPos = position + offset;
float randSpeed = Main.rand.NextFloat(1f - SpeedRandomness, 1f + SpeedRandomness);
float randAngle = Main.rand.NextFloat(-Inaccuracy, Inaccuracy);
Vector2 velocity = randSpeed * new Vector2(speedX, speedY).RotatedBy(randAngle);
Projectile.NewProjectileDirect(spawnPos, velocity, type, damage, knockBack, player.whoAmI);
}
return false;
}
public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ItemID.SkyFracture);
recipe.AddIngredient(ItemID.LunarFlareBook);
recipe.AddIngredient(ModContent.ItemType<WrathoftheAncients>());
recipe.AddIngredient(ModContent.ItemType<ShadowspecBar>(), 5);
recipe.AddTile(ModContent.TileType<DraedonsForge>());
recipe.SetResult(this);
recipe.AddRecipe();
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 876 B

+1 -1
View File
@@ -534,7 +534,7 @@ namespace CalamityMod
BossDifficulty.TryGetValue("SupremeCalamitas", out float order);
int type = NPCType<SupremeCalamitas>();
int summon = ItemType<EyeofExtinction>();
List<int> loot = new List<int>() { ItemType<CalamitousEssence>(), ItemType<Animus>(), ItemType<Azathoth>(), ItemType<Contagion>(), ItemType<CrystylCrusher>(), ItemType<DraconicDestruction>(), ItemType<Earth>(), ItemType<Fabstaff>(), ItemType<RoyalKnivesMelee>(), ItemType<RoyalKnives>(), ItemType<NanoblackReaperMelee>(), ItemType<NanoblackReaperRogue>(), ItemType<RedSun>(), ItemType<ScarletDevil>(), ItemType<SomaPrime>(), ItemType<BlushieStaff>(), ItemType<Svantechnical>(), ItemType<Judgement>(), ItemType<TriactisTruePaladinianMageHammerofMightMelee>(), ItemType<TriactisTruePaladinianMageHammerofMight>(), ItemType<Megafleet>(), ItemType<Endogenesis>(), ItemType<Vehemenc>(), ItemType<OmegaHealingPotion>() };
List<int> loot = new List<int>() { ItemType<CalamitousEssence>(), ItemType<Animus>(), ItemType<Azathoth>(), ItemType<Contagion>(), ItemType<CrystylCrusher>(), ItemType<DraconicDestruction>(), ItemType<Earth>(), ItemType<Fabstaff>(), ItemType<RoyalKnivesMelee>(), ItemType<RoyalKnives>(), ItemType<NanoblackReaperMelee>(), ItemType<NanoblackReaperRogue>(), ItemType<RedSun>(), ItemType<ScarletDevil>(), ItemType<SomaPrime>(), ItemType<BlushieStaff>(), ItemType<Svantechnical>(), ItemType<TheDanceofLight>(), ItemType<TriactisTruePaladinianMageHammerofMightMelee>(), ItemType<TriactisTruePaladinianMageHammerofMight>(), ItemType<Megafleet>(), ItemType<Endogenesis>(), ItemType<Vehemenc>(), ItemType<OmegaHealingPotion>() };
List<int> collection = new List<int>() { ItemType<KnowledgeCalamitas>(), ItemType<BrimstoneJewel>(), ItemType<Levi>() };
string instructions = $"Use an [i:{summon}]";
string despawn = CalamityUtils.ColorMessage("Please don't waste my time.", new Color(0xFF, 0xA5, 0x00));
+1 -1
View File
@@ -2165,7 +2165,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas
ModContent.ItemType<SomaPrime>(), ModContent.ItemType<SomaPrime>(),
ModContent.ItemType<BlushieStaff>(), ModContent.ItemType<BlushieStaff>(), // Staff of Blushie
ModContent.ItemType<Svantechnical>(), ModContent.ItemType<Svantechnical>(),
ModContent.ItemType<Judgement>(), ModContent.ItemType<Judgement>(), // The Dance of Light
ModContent.ItemType<TheDanceofLight>(), ModContent.ItemType<TheDanceofLight>(),
ModContent.ItemType<TriactisTruePaladinianMageHammerofMightMelee>(), ModContent.ItemType<TriactisTruePaladinianMageHammerofMight>(),
ModContent.ItemType<Megafleet>(), ModContent.ItemType<Megafleet>(), // Voidragon
ModContent.ItemType<Endogenesis>(), ModContent.ItemType<Endogenesis>(),
+148
View File
@@ -0,0 +1,148 @@
using CalamityMod.Items.Weapons.Magic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Magic
{
public class LightBlade : ModProjectile
{
private const int Lifetime = 180;
private const int NumAfterimages = 8;
private const float LightBrightness = 0.7f;
private const int DustID = 175;
private Color lightColor = Color.White;
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Light Blade");
ProjectileID.Sets.TrailCacheLength[projectile.type] = NumAfterimages;
ProjectileID.Sets.TrailingMode[projectile.type] = 2;
}
public override void SetDefaults()
{
projectile.width = 10;
projectile.height = 10;
projectile.scale = 1.5f;
projectile.friendly = true;
projectile.magic = true;
projectile.ignoreWater = true;
projectile.tileCollide = false;
projectile.alpha = 255;
projectile.penetrate = 3;
projectile.extraUpdates = 2;
projectile.timeLeft = Lifetime;
projectile.usesLocalNPCImmunity = true;
projectile.localNPCHitCooldown = -1;
}
public override void AI()
{
// The sprite is diagonal, so rotate by pi/4
projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver4;
// These effects only occur on the first frame. Alpha is set to 0 immediately on frame 1.
if (projectile.alpha > 0)
{
projectile.alpha = 0;
FirstFrameEffects();
// Store original velocity for homing calculations
projectile.ai[0] = projectile.velocity.Length();
}
// Every other frame, add less light.
else
Lighting.AddLight(projectile.Center, lightColor.ToVector3() * LightBrightness);
// The projectile never slows down, even as it tries to curve towards enemies
CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 1000f, projectile.ai[0], 80f);
float currentSpeed = projectile.velocity.Length();
projectile.velocity *= projectile.ai[0] / currentSpeed;
}
private void FirstFrameEffects()
{
// Pick a random sword sprite and a random color to use.
projectile.frame = Main.rand.Next(14);
lightColor = TheDanceofLight.GetRandomLightColor();
// Spawn starting dust.
Vector2 baseOffsetVec = new Vector2(1f, 4f);
int numDust = 16;
for(int i = 0; i < numDust; ++i)
{
Vector2 dustOffset = Vector2.UnitY.RotatedBy(i * MathHelper.TwoPi / numDust) * baseOffsetVec;
dustOffset = dustOffset.RotatedBy(projectile.velocity.ToRotation());
Dust d = Dust.NewDustDirect(projectile.Center, 0, 0, DustID, 0f, 0f);
d.position = projectile.Center + dustOffset;
d.velocity = dustOffset.SafeNormalize(Vector2.Zero);
d.velocity *= 1.4f;
d.scale = 1.5f;
d.noGravity = true;
}
// Each blade appears in a huge flash of light.
float startingBrightness = LightBrightness * 3f;
Lighting.AddLight(projectile.Center, lightColor.ToVector3() * startingBrightness);
}
public override void Kill(int timeLeft)
{
Main.PlaySound(3, (int)projectile.position.X, (int)projectile.position.Y, 3);
int numDust = Main.rand.Next(4, 10);
for (int i = 0; i < numDust; i++)
{
Dust d = Dust.NewDustDirect(projectile.Center, 0, 0, DustID, 0f, 0f, 100);
d.velocity *= 1.6f;
d.velocity += projectile.velocity * Main.rand.NextFloat(-0.5f, 0.5f);
d.velocity.Y += -1f;
d.noGravity = true;
d.scale = 2f;
d.fadeIn = 0.5f;
}
}
public override Color? GetAlpha(Color lightColor) => lightColor;
// Uses bizarre drawcode because it has a horizontal sprite sheet
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
{
Point projTile = projectile.Center.ToTileCoordinates();
Color localLight = Lighting.GetColor(projTile.X, projTile.Y);
Texture2D tex = Main.projectileTexture[projectile.type];
Rectangle rect = new Rectangle(38 * projectile.frame, 0, 38, 38);
Vector2 halfSpriteSize = rect.Size() / 2f;
// Draw the projectile itself
Color mainSwordColor = projectile.GetAlpha(localLight);
mainSwordColor.A = 160;
SpriteEffects sfx = projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None;
Vector2 drawPos = projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY);
spriteBatch.Draw(tex, drawPos, new Rectangle?(rect), mainSwordColor, projectile.rotation, halfSpriteSize, projectile.scale, sfx, 0f);
// Draw the projectile's afterimages
for (int i = 0; i < NumAfterimages; ++i)
{
Color afterimageLight = projectile.GetAlpha(localLight);
afterimageLight.A = 40;
float posLerp = 1f;
Vector2 afterimagePos = (1f - posLerp) * projectile.position + posLerp * projectile.oldPos[i];
float rotation = projectile.oldRot[i];
SpriteEffects afterimageSfx = projectile.oldSpriteDirection[i] == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None;
float afterimageScale = MathHelper.Lerp(1.2f * projectile.scale, 0.4f * projectile.scale, i / (NumAfterimages - 1f));
Vector2 imageDrawPos = afterimagePos + projectile.Size / 2f - Main.screenPosition + new Vector2(0f, projectile.gfxOffY);
spriteBatch.Draw(tex, imageDrawPos, new Rectangle?(rect), afterimageLight, rotation, halfSpriteSize, afterimageScale, afterimageSfx, 0f);
}
return false;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

-65
View File
@@ -1,65 +0,0 @@
using CalamityMod.Buffs.DamageOverTime;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Magic
{
public class WhiteFlame : ModProjectile
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Flame");
}
public override void SetDefaults()
{
projectile.width = 12;
projectile.height = 12;
projectile.friendly = true;
projectile.ignoreWater = true;
projectile.penetrate = 1;
projectile.timeLeft = 120;
projectile.magic = true;
projectile.extraUpdates = 3;
}
public override void AI()
{
if (projectile.timeLeft % 6f == 0f)
{
for (int num457 = 0; num457 < Main.rand.Next(3,6); num457++)
{
int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 91, 0f, 0f, 100, default, 1f);
Main.dust[num458].noGravity = true;
Main.dust[num458].velocity *= 0.5f;
Main.dust[num458].velocity += projectile.velocity * 0.1f;
}
}
}
public override void Kill(int timeLeft)
{
Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 122);
int num251 = 4;
if (projectile.owner == Main.myPlayer)
{
for (int num252 = 0; num252 < num251; num252++)
{
Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101));
while (value15.X == 0f && value15.Y == 0f)
{
value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101));
}
value15.Normalize();
value15 *= (float)Main.rand.Next(70, 101) * 0.1f;
Projectile.NewProjectile(projectile.oldPosition.X + (float)(projectile.width / 2), projectile.oldPosition.Y + (float)(projectile.height / 2), value15.X, value15.Y, ModContent.ProjectileType<WhiteFlame2>(), projectile.damage, 0f, projectile.owner, 0f, 0f);
}
}
}
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
target.AddBuff(ModContent.BuffType<HolyFlames>(), 360);
}
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 139 B

-51
View File
@@ -1,51 +0,0 @@
using CalamityMod.Buffs.DamageOverTime;
using Microsoft.Xna.Framework;
using System;
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Magic
{
public class WhiteFlame2 : ModProjectile
{
float homeTimer = 100;
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Flame");
}
public override void SetDefaults()
{
projectile.width = 6;
projectile.height = 6;
projectile.friendly = true;
projectile.ignoreWater = true;
projectile.tileCollide = false;
projectile.penetrate = 3;
projectile.usesLocalNPCImmunity = true;
projectile.localNPCHitCooldown = 1;
projectile.timeLeft = 120;
projectile.magic = true;
}
public override void AI()
{
if (projectile.timeLeft % 2f == 0f)
{
for (int num457 = 0; num457 < Main.rand.Next(3,6); num457++)
{
int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 91, 0f, 0f, 100, default, 0.5f);
Main.dust[num458].noGravity = true;
}
}
homeTimer += 5f;
CalamityGlobalProjectile.HomeInOnNPC(projectile, false, homeTimer, 25f, 20f);
}
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
target.AddBuff(ModContent.BuffType<HolyFlames>(), 360);
}
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 136 B