This commit is contained in:
mountaindrew10 committed 2022-02-13 06:52:15 -06:00
commit f237acaa20
14 files changed
+392 -15

No files matched your search

-1
View File
@@ -113,7 +113,6 @@ namespace CalamityMod.Items
if ((!NPC.downedMechBoss1 || !NPC.downedMechBoss2 || !NPC.downedMechBoss3) && CalamityConfig.Instance.EarlyHardmodeProgressionRework)
DropHelper.BlockDrops(ItemID.HallowedBar);
DropHelper.DropItemChance(player, ModContent.ItemType<SHPC>(), DropHelper.BagWeaponDropRateFloat);
break;
case ItemID.TwinsBossBag:
+57
View File
@@ -0,0 +1,57 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using CalamityMod.World;
using Terraria.Graphics.Shaders;
using System;
namespace CalamityMod.Items.Materials
{
public class PlasmaDriveCore : ModItem
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Prototype Plasma Drive Core");
Tooltip.SetDefault("Despite all the time it spent in storage, its furnace still burns strong");
}
public override void SetDefaults()
{
item.width = 30;
item.height = 30;
item.maxStack = 999;
item.value = Item.buyPrice(0, 0, 0, 0);
item.rare = ItemRarityID.Red;
item.Calamity().customRarity = CalamityRarity.DraedonRust;
}
public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale)
{
Texture2D tex = Main.itemTexture[item.type];
//Give it an outline. Make it look really important and shiny. The player must not confuse this for a random material
spriteBatch.End();
Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, null, null, null, null, Main.UIScaleMatrix);
Color outlineColor = Color.Lerp(Color.Cyan, Color.Orange, (float)Math.Sin(Main.GlobalTime * 2f) * 0.5f + 0.5f);
Vector3 outlineHSL = Main.rgbToHsl(outlineColor); //BasicTint uses the opposite hue i guess? or smth is fucked with the way shaders get their colors. anyways, we invert it
GameShaders.Misc["CalamityMod:BasicTint"].UseOpacity(1f);
GameShaders.Misc["CalamityMod:BasicTint"].UseColor(Main.hslToRgb(1 - outlineHSL.X, outlineHSL.Y, outlineHSL.Z));
GameShaders.Misc["CalamityMod:BasicTint"].Apply();
float outlineWidth = MathHelper.Lerp(2, 3, (float)Math.Sin(Main.GlobalTime * 2f) * 0.5f + 0.5f);
for (float i = 0; i < 1; i += 0.25f)
{
spriteBatch.Draw(tex, position + (i * MathHelper.TwoPi).ToRotationVector2() * outlineWidth * scale, frame, outlineColor, 0f, origin, scale, 0f, 0f);
}
spriteBatch.End();
spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, Main.UIScaleMatrix);
return true;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 707 B

+46
View File
@@ -0,0 +1,46 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using CalamityMod.World;
namespace CalamityMod.Items.Materials
{
public class SuspiciousScrap : ModItem
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Suspicious Scrap");
Tooltip.SetDefault("Looks like it may be part of a greater whole...");
}
public override void SetDefaults()
{
item.width = 30;
item.height = 30;
item.maxStack = 999;
item.value = Item.buyPrice(0, 0, 0, 20);
item.rare = ItemRarityID.Red;
item.Calamity().customRarity = CalamityRarity.DraedonRust;
}
public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale)
{
Texture2D tex = Main.itemTexture[item.type];
Rectangle variant = new Rectangle(CalamityWorld.OreTypes[0] == TileID.Tin ? 0 : 32, CalamityWorld.OreTypes[1] == TileID.Lead ? 0 : 32, 30, 30);
spriteBatch.Draw(tex, position, variant, drawColor, 0f, origin, scale * 2f, 0f, 0f);
return false;
}
public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI)
{
Texture2D tex = Main.itemTexture[item.type];
Rectangle variant = new Rectangle(CalamityWorld.OreTypes[0] == TileID.Tin ? 0 : 32, CalamityWorld.OreTypes[1] == TileID.Lead ? 0 : 32, 30, 30);
Vector2 positionDisplace = new Vector2( 16 , 16 ) * scale;
spriteBatch.Draw(tex, item.position + positionDisplace - Main.screenPosition, variant, lightColor, rotation, variant.Size() / 2f, scale, 0f, 0f);
return false;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

+12
View File
@@ -1,3 +1,4 @@
using CalamityMod.Items.Materials;
using CalamityMod.Projectiles.Magic;
using Microsoft.Xna.Framework;
using Terraria;
@@ -94,5 +95,16 @@ namespace CalamityMod.Items.Weapons.Magic
return false;
}
}
public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ModContent.ItemType<PlasmaDriveCore>(), 1);
recipe.AddIngredient(ModContent.ItemType<SuspiciousScrap>(), 4);
recipe.AddRecipeGroup("AnyMythrilBar", 10);
recipe.AddTile(TileID.MythrilAnvil);
recipe.SetResult(this);
recipe.AddRecipe();
}
}
}
+13 -5
View File
@@ -17,7 +17,10 @@ namespace CalamityMod.Items.Weapons.Rogue
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Nanoblack Reaper");
Tooltip.SetDefault("Unleashes a storm of nanoblack energy blades\nBlades target bosses whenever possible\n'She smothered them in Her hatred'");
Tooltip.SetDefault("Unleashes a storm of nanoblack energy blades\n" +
"Blades target bosses whenever possible\n" +
"Stealth strikes cause the scythe to create a large amount of homing afterimages instead of energy blades\n" +
"'She smothered them in Her hatred'");
}
public override void SafeSetDefaults()
@@ -46,10 +49,15 @@ namespace CalamityMod.Items.Weapons.Rogue
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);
if (proj.WithinBounds(Main.maxProjectiles))
Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable();
return false;
if (player.Calamity().StealthStrikeAvailable())
{
damage = (int)(damage * 1.5);
int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI);
if (stealth.WithinBounds(Main.maxProjectiles))
Main.projectile[stealth].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable();
return false;
}
return true;
}
public override void AddRecipes()
+3 -1
View File
@@ -38,8 +38,10 @@ namespace CalamityMod.Items.Weapons.Rogue
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 javelin = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, -1f);
if (player.Calamity().StealthStrikeAvailable() && Main.projectile.IndexInRange(javelin))
if (player.Calamity().StealthStrikeAvailable() && Main.projectile.IndexInRange(javelin)) {
Main.projectile[javelin].Calamity().stealthStrike = true;
Main.projectile[javelin].damage = (int)(1.15 * Main.projectile[javelin].damage);
}
return false;
}
}
-1
View File
@@ -721,7 +721,6 @@ namespace CalamityMod
// The Destroyer
AddLoot(bossChecklist, "TheDestroyer",
new List<int>() { ItemType<SHPC>() },
new List<int>() { ItemType<KnowledgeDestroyer>(), ItemType<KnowledgeMechs>() }
);
-2
View File
@@ -248,8 +248,6 @@ namespace CalamityMod.NPCs
DropHelper.DropItemCondition(npc, ModContent.ItemType<MysteriousCircuitry>(), Main.expertMode, DraedonMayhem, 8, 16);
DropHelper.DropItemCondition(npc, ModContent.ItemType<DubiousPlating>(), Main.expertMode, DraedonMayhem, 8, 16);
DropHelper.DropItemCondition(npc, ModContent.ItemType<SHPC>(), !Main.expertMode, DropHelper.NormalWeaponDropRateFloat);
DropHelper.DropItemCondition(npc, ModContent.ItemType<KnowledgeDestroyer>(), true, !NPC.downedMechBoss1);
SetNewShopVariable(new int[] { NPCID.DD2Bartender, NPCID.Stylist, NPCID.Truffle, ModContent.NPCType<THIEF>() }, NPC.downedMechBossAny);
SetNewShopVariable(new int[] { NPCID.Stylist, ModContent.NPCType<DILF>(), ModContent.NPCType<FAP>(), ModContent.NPCType<THIEF>() }, NPC.downedMechBoss1 || !NPC.downedMechBoss2 || !NPC.downedMechBoss3);
+26 -5
View File
@@ -16,7 +16,8 @@ namespace CalamityMod.Projectiles.Rogue
private const int Lifetime = 240;
private const float ReboundTime = 50f;
private const int MinBladeTimer = 13;
private const int MaxBladeTimer = 18;
private const int MaxBladeTimer = 18;
public override void SetStaticDefaults()
{
@@ -48,7 +49,7 @@ namespace CalamityMod.Projectiles.Rogue
// Initialize the frame counter and random blade delay on the very first frame.
if (projectile.timeLeft == Lifetime)
projectile.ai[1] = GetBladeDelay();
projectile.ai[1] = projectile.Calamity().stealthStrike ? 4f : GetBladeDelay();
// Produces electricity and green firework sparks constantly while in flight.
if (Main.rand.NextBool(3))
@@ -121,11 +122,19 @@ namespace CalamityMod.Projectiles.Rogue
projectile.Kill();
}
// Create nanoblack energy blades at a somewhat-random rate while in flight.
// Create nanoblack energy blades at a somewhat-random rate while in flight. (or full-sized scythes afterimages if stealth strike)
if (projectile.ai[1] <= 0f)
{
SpawnEnergyBlade();
projectile.ai[1] = GetBladeDelay();
if (projectile.Calamity().stealthStrike)
{
SpawnScytheAfterimage();
projectile.ai[1] = 4f;
}
else
{
SpawnEnergyBlade();
projectile.ai[1] = GetBladeDelay();
}
}
// Rotate the scythe as it flies.
@@ -158,5 +167,17 @@ namespace CalamityMod.Projectiles.Rogue
if (projectile.owner == Main.myPlayer)
Projectile.NewProjectile(pos, Vector2.Zero, bladeID, bladeDamage, bladeKB, projectile.owner, 0f, spin);
}
private void SpawnScytheAfterimage()
{
int bladeID = ModContent.ProjectileType<NanoblackStealthSplit>();
int bladeDamage = projectile.damage / 2;
float bladeKB = 4f;
float spin = projectile.direction <= 0 ? -1f : 1f;
float d = 16f;
float velocityMult = 0.9f;
if (projectile.owner == Main.myPlayer)
Projectile.NewProjectile(projectile.Center, Vector2.Zero, bladeID, bladeDamage, bladeKB, projectile.owner, 0f, spin);
}
}
}
+208
View File
@@ -0,0 +1,208 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Rogue
{
public class NanoblackStealthSplit : ModProjectile
{
public override string Texture => "CalamityMod/Items/Weapons/Rogue/NanoblackReaperRogue";
private static int Lifetime = 300;
private static float MaxSpeed = 40f;
private static float MaxRotationSpeed = 0.25f;
private static float HomingStartRange = 4000f;
private static float HomingBreakRange = 6000f;
private static float HomingBonusRangeCap = 2000f;
private static float BaseHomingFactor = 2.6f;
private static float MaxHomingFactor = 8.6f;
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Nanoblack Afterimage");
ProjectileID.Sets.TrailCacheLength[projectile.type] = 7;
ProjectileID.Sets.TrailingMode[projectile.type] = 2;
}
public override void SetDefaults()
{
projectile.width = 56;
projectile.height = 56;
projectile.friendly = true;
projectile.ignoreWater = true;
projectile.tileCollide = false;
projectile.penetrate = 12;
projectile.extraUpdates = 1;
projectile.timeLeft = Lifetime;
projectile.usesLocalNPCImmunity = true;
projectile.localNPCHitCooldown = 8;
projectile.Calamity().rogue = true;
}
// ai[0] = Index of current NPC target. If 0 or negative, the projectile has no target
// ai[1] = Current spin speed. When it reaches 0, starts homing into enemies. Negative speeds are also allowed.
public override void AI()
{
// Produces electricity and green firework sparks constantly while in flight. (Like the main projectile)
if (Main.rand.NextBool(3))
{
int dustType = Main.rand.NextBool(5) ? 226 : 220;
float scale = 0.8f + Main.rand.NextFloat(0.3f);
float velocityMult = Main.rand.NextFloat(0.3f, 0.6f);
int idx = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType);
Main.dust[idx].noGravity = true;
Main.dust[idx].velocity = velocityMult * projectile.velocity;
Main.dust[idx].scale = scale;
}
// Spin in the specified starting direction and slow down spin over time
// Loses 1.66% of current speed every frame
// Also update current orientation to reflect current spin direction
if (projectile.timeLeft > 200)
{
float currentSpin = projectile.ai[1];
projectile.direction = currentSpin <= 0f ? -1 : 1;
projectile.spriteDirection = projectile.direction;
projectile.rotation += currentSpin * MaxRotationSpeed;
float spinReduction = 0.0166f * currentSpin;
projectile.ai[1] -= spinReduction;
}
// Search for and home in on nearby targets after the given time, and stops spinning
else
{
projectile.rotation = 0f;
HomingAI();
}
}
private void HomingAI()
{
// If we don't currently have a target, go try and get one!
int targetID = (int)projectile.ai[0] - 1;
if (targetID < 0)
targetID = AcquireTarget();
// Save the target, whether we have one or not.
projectile.ai[0] = targetID + 1f;
// If we don't have a target, then just slow down a bit.
if (targetID < 0)
{
projectile.velocity *= 0.94f;
return;
}
// Homing behavior depends on how far the blade is from its target.
NPC target = Main.npc[targetID];
float xDist = projectile.Center.X - target.Center.X;
float yDist = projectile.Center.Y - target.Center.Y;
float dist = (float)Math.Sqrt(xDist * xDist + yDist * yDist);
// If the target is too far away, stop homing in on it.
if (dist > HomingBreakRange)
{
projectile.ai[0] = 0f;
return;
}
// Adds a multiple of the towards-target vector to its velocity every frame.
float homingFactor = CalcHomingFactor(dist);
Vector2 posDiff = target.Center - projectile.Center;
posDiff = posDiff.SafeNormalize(Vector2.Zero);
posDiff *= homingFactor;
Vector2 newVelocity = projectile.velocity += posDiff;
// Caps speed to make sure it doesn't go too fast.
if (newVelocity.Length() >= MaxSpeed)
{
newVelocity = newVelocity.SafeNormalize(Vector2.Zero);
newVelocity *= MaxSpeed;
}
projectile.velocity = newVelocity;
//The afterimage's blade always tries to face its target
projectile.rotation = projectile.velocity.ToRotation() + MathHelper.ToRadians(45f);
}
// Returns the ID of the NPC to be targeted by this energy blade.
// It chooses the closest target which can be chased, ignoring invulnerable NPCs.
// Nanoblack Afterimages prefer to target bosses whenever possible.
private int AcquireTarget()
{
bool bossFound = false;
int target = -1;
float minDist = HomingStartRange;
for (int i = 0; i < 200; ++i)
{
NPC npc = Main.npc[i];
if (!npc.active || npc.type == NPCID.TargetDummy)
continue;
// If we've found a valid boss target, ignore ALL targets which aren't bosses.
if (bossFound && !npc.boss)
continue;
if (npc.CanBeChasedBy(projectile, false))
{
float xDist = projectile.Center.X - npc.Center.X;
float yDist = projectile.Center.Y - npc.Center.Y;
float distToNPC = (float)Math.Sqrt(xDist * xDist + yDist * yDist);
if (distToNPC < minDist)
{
// If this target within range is a boss, set the boss found flag.
if (npc.boss)
bossFound = true;
minDist = distToNPC;
target = i;
}
}
}
return target;
}
// Afterimages home even more aggressively if they are very close to their target.
private float CalcHomingFactor(float dist)
{
float baseFactor = BaseHomingFactor;
float bonus = (MaxHomingFactor - BaseHomingFactor) * (1f - dist / HomingBonusRangeCap);
if (bonus < 0f)
bonus = 0f;
return baseFactor + bonus;
}
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
{
CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1);
return false;
}
// Spawns a tiny bit of dust when the afterimage vanishes.
public override void Kill(int timeLeft)
{
SpawnDust();
}
// Spawns a small bit of Luminite themed dust.
private void SpawnDust()
{
int dustCount = Main.rand.Next(3, 6);
Vector2 corner = projectile.position;
for (int i = 0; i < dustCount; ++i)
{
int dustType = 229;
float scale = 0.6f + Main.rand.NextFloat(0.4f);
int idx = Dust.NewDust(corner, projectile.width, projectile.height, dustType);
Main.dust[idx].noGravity = true;
Main.dust[idx].velocity *= 3f;
Main.dust[idx].scale = scale;
}
}
}
}
+17
View File
@@ -36,6 +36,7 @@ namespace CalamityMod.World
public static int MoneyStolenByBandit = 0;
public static int Reforges;
public static bool IsWorldAfterDraedonUpdate = false;
public static ushort[] OreTypes = new ushort[4];
// Boss Rush
public static int bossRushHostileProjKillCounter = 0;
@@ -506,6 +507,11 @@ namespace CalamityMod.World
downed.Add("HasGeneratedLuminitePlanetoids");
downed.AddWithCondition("IsWorldAfterDraedonUpdate", IsWorldAfterDraedonUpdate);
downed.AddWithCondition("TinOreWorld", OreTypes[0] == TileID.Tin);
downed.AddWithCondition("LeadOreWorld", OreTypes[1] == TileID.Lead);
downed.AddWithCondition("TungstenOreWorld", OreTypes[2] == TileID.Tungsten);
downed.AddWithCondition("PlatinumOreWorld", OreTypes[3] == TileID.Platinum);
RecipeUnlockHandler.Save(downed);
return new TagCompound
@@ -615,6 +621,11 @@ namespace CalamityMod.World
HasGeneratedLuminitePlanetoids = downed.Contains("HasGeneratedLuminitePlanetoids");
IsWorldAfterDraedonUpdate = downed.Contains("IsWorldAfterDraedonUpdate");
OreTypes[0] = downed.Contains("TinOreWorld") ? TileID.Tin : TileID.Copper;
OreTypes[1] = downed.Contains("LeadOreWorld") ? TileID.Lead : TileID.Iron;
OreTypes[2] = downed.Contains("TungstenOreWorld") ? TileID.Tungsten : TileID.Silver;
OreTypes[3] = downed.Contains("PlatinumOreWorld") ? TileID.Platinum : TileID.Gold;
RecipeUnlockHandler.Load(downed);
abyssChasmBottom = tag.GetInt("abyssChasmBottom");
@@ -1295,6 +1306,12 @@ namespace CalamityMod.World
}
}
}
// Save the set of ores that got generated
OreTypes[0] = WorldGen.CopperTierOre;
OreTypes[1] = WorldGen.IronTierOre;
OreTypes[2] = WorldGen.SilverTierOre;
OreTypes[3] = WorldGen.GoldTierOre;
}
#endregion
}
+10
View File
@@ -94,6 +94,12 @@ namespace CalamityMod.World
new ChestItem(ItemID.Bomb, WorldGen.genRand.Next(6, 7 + 1)),
new ChestItem(potionType, WorldGen.genRand.Next(3, 5 + 1)),
};
//Add suspicious scrap into the chest rarely. Chance depends on the world size
int probability = Main.maxTilesX <= 4200f ? 0 : Main.maxTilesX >= 8400f ? 2 : 1;
if (Main.rand.Next(probability) == 0f)
contents.Insert(2, new ChestItem(ModContent.ItemType<SuspiciousScrap>(), 1));
for (int i = 0; i < contents.Count; i++)
{
chest.item[i].SetDefaults(contents[i].Type);
@@ -153,12 +159,14 @@ namespace CalamityMod.World
{
new ChestItem(ModContent.ItemType<DubiousPlating>(), WorldGen.genRand.Next(10, 17 + 1)),
new ChestItem(ModContent.ItemType<MysteriousCircuitry>(), WorldGen.genRand.Next(10, 15 + 1)),
new ChestItem(ModContent.ItemType<SuspiciousScrap>(), 1),
new ChestItem(ItemID.Torch, WorldGen.genRand.Next(20, 40 + 1)),
new ChestItem(ItemID.GoldCoin, WorldGen.genRand.Next(8, 16 + 1)),
new ChestItem(ItemID.HealingPotion, WorldGen.genRand.Next(7, 10 + 1)),
new ChestItem(ItemID.Dynamite, WorldGen.genRand.Next(4, 6 + 1)),
new ChestItem(potionType, WorldGen.genRand.Next(4, 7 + 1)),
};
for (int i = 0; i < contents.Count; i++)
{
chest.item[i].SetDefaults(contents[i].Type);
@@ -551,7 +559,9 @@ namespace CalamityMod.World
{
contents.Insert(0, new ChestItem(ModContent.ItemType<DraedonsLogPlanetoid>(), 1));
contents.Insert(1, new ChestItem(ModContent.ItemType<EncryptedSchematicPlanetoid>(), 1));
contents.Insert(2, new ChestItem(ModContent.ItemType<PlasmaDriveCore>(), 1));
}
for (int i = 0; i < contents.Count; i++)
{
chest.item[i].SetDefaults(contents[i].Type);