This commit is contained in:
mountaindrew10 committed 2023-01-27 23:50:27 -06:00
commit 62cd54eff8
13 files changed
+253 -154

No files matched your search

+27
View File
@@ -0,0 +1,27 @@
using CalamityMod.Projectiles.Pets;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Buffs.Pets
{
public class GoldieBuff : ModBuff
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Goldie");
Description.SetDefault("All that glitters is gold");
Main.buffNoTimeDisplay[Type] = true;
Main.lightPet[Type] = true;
}
public override void Update(Player player, ref int buffIndex)
{
player.buffTime[buffIndex] = 18000;
player.Calamity().thiefsDime = true;
bool PetProjectileNotSpawned = player.ownedProjectileCounts[ModContent.ProjectileType<GoldiePet>()] <= 0;
if (PetProjectileNotSpawned && player.whoAmI == Main.myPlayer)
Projectile.NewProjectile(player.GetSource_Buff(buffIndex), player.Center, Vector2.Zero, ModContent.ProjectileType<GoldiePet>(), 0, 0f, player.whoAmI, 50f, 0f);
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 637 B

-2
View File
@@ -912,7 +912,6 @@ namespace CalamityMod.CalPlayer
public int healCounter = 300;
public bool shellfish = false;
public bool hCrab = false;
public bool tDime = false;
public bool allWaifus = false;
public bool allWaifusVanity = false;
public bool sCrystal = false;
@@ -1975,7 +1974,6 @@ namespace CalamityMod.CalPlayer
daedalusCrystal = false;
shellfish = false;
hCrab = false;
tDime = false;
endoHydra = false;
powerfulRaven = false;
dragonFamily = false;
-46
View File
@@ -1,46 +0,0 @@
using CalamityMod.Projectiles.Rogue;
using Terraria;
using Terraria.ModLoader;
using Terraria.ID;
namespace CalamityMod.Items.Accessories
{
public class ThiefsDime : ModItem
{
public override void SetStaticDefaults()
{
SacrificeTotal = 1;
DisplayName.SetDefault("Thief's Dime");
Tooltip.SetDefault("Those scurvy dogs don’t know the first thing about making bank\n" +
"Summons a coin that revolves around you and steals money from enemies");
}
public override void SetDefaults()
{
Item.width = 20;
Item.height = 20;
Item.value = CalamityGlobalItem.Rarity5BuyPrice;
Item.rare = ItemRarityID.Pink;
Item.accessory = true;
}
public override bool CanEquipAccessory(Player player, int slot, bool modded)
{
return !player.Calamity().thiefsDime;
}
public override void UpdateAccessory(Player player, bool hideVisual)
{
player.Calamity().thiefsDime = true;
if (player.whoAmI == Main.myPlayer)
{
if (player.ownedProjectileCounts[ModContent.ProjectileType<ThiefsDimeProj>()] < 1)
{
var source = player.GetSource_Accessory(Item);
int damage = (int)player.GetTotalDamage<RogueDamageClass>().ApplyTo(100);
Projectile.NewProjectile(source, player.Center.X, player.Center.Y, 0f, 0f, ModContent.ProjectileType<ThiefsDimeProj>(), damage, 6f, Main.myPlayer, 0f, 0f);
}
}
}
}
}
+38
View File
@@ -0,0 +1,38 @@
using CalamityMod.Buffs.Pets;
using CalamityMod.Projectiles.Pets;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ModLoader;
using Terraria.ID;
namespace CalamityMod.Items.Pets
{
public class ThiefsDime : ModItem
{
public override void SetStaticDefaults()
{
SacrificeTotal = 1;
DisplayName.SetDefault("Thief's Dime");
Tooltip.SetDefault("Once worthless treasure, now a relic of a thief's companionship\n" +
"Summons Goldie the coin to light your way and collects nearby coins\n" +
"Provides a small amount of light in the abyss");
}
public override void SetDefaults()
{
Item.CloneDefaults(ItemID.WispinaBottle);
Item.UseSound = SoundID.CoinPickup;
Item.shoot = ModContent.ProjectileType<GoldiePet>();
Item.buffType = ModContent.BuffType<GoldieBuff>();
Item.value = Item.sellPrice(gold: 20); //Buy price of 1 Platinum
Item.rare = ItemRarityID.Pink;
}
public override void UseStyle(Player player, Rectangle heldItemFrame)
{
if (player.whoAmI == Main.myPlayer && player.itemTime == 0)
player.AddBuff(Item.buffType, 3600, true);
}
}
}
File renamed without changes.

Before

Width:  |  Height:  |  Size: 408 B

After

Width:  |  Height:  |  Size: 408 B

-1
View File
@@ -310,7 +310,6 @@ namespace CalamityMod.NPCs.TownNPCs
if (NPC.downedPirates)
{
shop.item[nextSlot].SetDefaults(ModContent.ItemType<ThiefsDime>());
shop.item[nextSlot].shopCustomPrice = Item.buyPrice(1, 0, 0, 0);
nextSlot++;
}
if (NPC.downedMechBoss1 && NPC.downedMechBoss2 && NPC.downedMechBoss3)
+162
View File
@@ -0,0 +1,162 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Pets
{
public class GoldiePet : ModProjectile
{
public Player Owner => Main.player[Projectile.owner];
public ref float MovementTimer => ref Projectile.ai[0];
public ref float ShineLevel => ref Projectile.ai[1];
public float MaxShineTime = 30f;
public static Color GoldColor = Color.Goldenrod;
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Goldie");
Main.projFrames[Projectile.type] = 5;
Main.projPet[Projectile.type] = true;
ProjectileID.Sets.LightPet[Projectile.type] = true;
}
public override void SetDefaults()
{
Projectile.width = 14;
Projectile.height = 16;
Projectile.tileCollide = false;
Projectile.ignoreWater = true;
Projectile.friendly = true;
Projectile.netImportant = true;
}
public override void AI()
{
if (OwnerCheck())
return;
Projectile.frameCounter++;
Projectile.frame = Projectile.frameCounter / 5 % Main.projFrames[Projectile.type];
Lighting.AddLight(Projectile.Center, GoldColor.ToVector3() * 0.9f);
if (ShineLevel < MaxShineTime)
ShineLevel++;
else if (ShineLevel > MaxShineTime)
ShineLevel--;
if (Main.rand.NextBool(6))
Dust.QuickDust(Projectile.Center, GoldColor);
//Find coins
Vector2 targetLocation = Projectile.position;
bool foundCoin = false;
float range = 800f; //50 block range
for (int itemIndex = 0; itemIndex < Main.maxItems; itemIndex++)
{
Item item = Main.item[itemIndex];
if (item.active && ItemID.Sets.CommonCoin[item.type] && item.noGrabDelay == 0 && item.playerIndexTheItemIsReservedFor == Projectile.owner &&
ItemLoader.CanPickup(item, Main.player[item.playerIndexTheItemIsReservedFor]) && Main.player[item.playerIndexTheItemIsReservedFor].ItemSpace(item).CanTakeItemToPersonalInventory)
{
float itemDist = Vector2.Distance(item.Center, Projectile.Center);
float distanceToPotential = Vector2.Distance(Projectile.Center, targetLocation);
//Pick it up
if (Projectile.owner == Main.myPlayer && Projectile.getRect().Intersects(new Rectangle((int)item.position.X, (int)item.position.Y, item.width, item.height)))
{
Main.item[itemIndex] = Owner.GetItem(Projectile.owner, item, new GetItemSettings());
if (Main.netMode == NetmodeID.MultiplayerClient)
{
NetMessage.SendData(MessageID.SyncItem, -1, -1, null, itemIndex, 0f, 0f, 0f, 0, 0, 0);
}
//Big shine boost on collect
ShineLevel += 30f;
}
//Otherwise, start chasing
if (distanceToPotential < itemDist && itemDist < range)
{
range = itemDist;
targetLocation = item.Center;
foundCoin = true;
}
}
}
//Chase after coins
if (foundCoin)
{
float itemDist = Vector2.Distance(targetLocation, Projectile.Center);
Vector2 destination = Projectile.SafeDirectionTo(targetLocation);
destination *= 12f;
Projectile.velocity = (Projectile.velocity * 40f + destination) / 41f;
Projectile.rotation = Projectile.velocity.X * 0.05f;
MovementTimer = -1f;
}
//Return to resting position
else if (MovementTimer == -1f)
{
Vector2 restingSpot = Owner.Center + Vector2.UnitY * -80f;
Projectile.velocity = (restingSpot - Projectile.Center) / 10f;
Projectile.rotation = Projectile.velocity.X * 0.05f;
//Start spinning again when rested
if (Vector2.Distance(restingSpot, Projectile.Center) <= 2f)
MovementTimer++;
}
//Rotate
else
{
Vector2 playerDist = Owner.Center - Projectile.Center;
Projectile.rotation = playerDist.ToRotation() - MathHelper.PiOver2;
Projectile.Center = Owner.Center + Vector2.UnitY.RotatedBy(MovementTimer) * -80f;
MovementTimer += MathHelper.ToRadians(4f);
}
}
public bool OwnerCheck()
{
// No logic should be run if the player is no longer active in the game.
if (!Owner.active)
{
Projectile.Kill();
return true;
}
if (Owner.dead)
Owner.Calamity().thiefsDime = false;
if (Owner.Calamity().thiefsDime)
Projectile.timeLeft = 2;
return false;
}
public override bool PreDraw(ref Color lightColor)
{
//Similar coin shining to Midas Prime coins. Thought it'd look pretty neat for a light pet.
Texture2D shineTex = ModContent.Request<Texture2D>("CalamityMod/Particles/Sparkle").Value;
Texture2D bloomTex = ModContent.Request<Texture2D>("CalamityMod/Particles/BloomCircle").Value;
float shinePercent = Math.Clamp(ShineLevel / MaxShineTime, 0f, 3f); //Max of 300% when collecting coins
Vector2 shineScale = new Vector2(1f, 3f - shinePercent * 2f);
Color shineColor = GoldColor;
if (shinePercent > 0f)
{
Main.spriteBatch.End();
Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
Main.EntitySpriteDraw(bloomTex, Projectile.Center - Main.screenPosition, null, shineColor * shinePercent * 0.15f, Projectile.rotation, bloomTex.Size() / 2f, shineScale * Projectile.scale * 0.6f, SpriteEffects.None, 0);
Main.EntitySpriteDraw(shineTex, Projectile.Center - Main.screenPosition, null, shineColor * shinePercent * 0.6f, Projectile.rotation, shineTex.Size() / 2f, shineScale * Projectile.scale, SpriteEffects.None, 0);
Main.spriteBatch.End();
Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
}
return true;
}
}
}
File renamed without changes.

Before

Width:  |  Height:  |  Size: 573 B

After

Width:  |  Height:  |  Size: 573 B

-99
View File
@@ -1,99 +0,0 @@
using CalamityMod.CalPlayer;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Rogue
{
public class ThiefsDimeProj : ModProjectile
{
private double rotation = 0;
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Thief's Dime");
Main.projFrames[Projectile.type] = 5;
ProjectileID.Sets.MinionSacrificable[Projectile.type] = true;
}
public override void SetDefaults()
{
Projectile.width = 20;
Projectile.height = 20;
Projectile.ignoreWater = true;
Projectile.minionSlots = 0f;
Projectile.DamageType = RogueDamageClass.Instance;
Projectile.timeLeft = 18000;
Projectile.tileCollide = false;
Projectile.friendly = true;
Projectile.timeLeft *= 5;
Projectile.penetrate = -1;
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = 10;
}
public override void AI()
{
Projectile.frameCounter++;
if (Projectile.frameCounter > 6)
{
Projectile.frame++;
Projectile.frameCounter = 0;
}
if (Projectile.frame > 4)
{
Projectile.frame = 0;
}
bool flag64 = Projectile.type == ModContent.ProjectileType<ThiefsDimeProj>();
Player player = Main.player[Projectile.owner];
CalamityPlayer modPlayer = player.Calamity();
if (!modPlayer.thiefsDime)
{
Projectile.active = false;
return;
}
if (flag64)
{
if (player.dead)
{
modPlayer.tDime = false;
}
if (modPlayer.tDime)
{
Projectile.timeLeft = 2;
}
}
Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.15f / 255f, (255 - Projectile.alpha) * 0.15f / 255f, (255 - Projectile.alpha) * 0.01f / 255f);
Vector2 vector = player.Center - Projectile.Center;
Projectile.rotation = vector.ToRotation() - 1.57f;
Projectile.Center = player.Center + new Vector2(80, 0).RotatedBy(rotation);
rotation += 0.03;
if (rotation >= 360)
{
rotation = 0;
}
Projectile.velocity.X = (vector.X > 0f) ? -0.000001f : 0f;
}
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
target.AddBuff(BuffID.Midas, 360);
Player player = Main.player[Projectile.owner];
if ((target.damage > 5 || target.boss) && player.whoAmI == Main.myPlayer && !target.SpawnedFromStatue)
{
if (Main.rand.NextBool(5))
{
Item.NewItem(Projectile.GetSource_FromThis(), (int)target.position.X, (int)target.position.Y, target.width, target.height, ItemID.SilverCoin, Main.rand.Next(10, 21));
}
if (Main.rand.NextBool(10))
{
Item.NewItem(Projectile.GetSource_FromThis(), (int)target.position.X, (int)target.position.Y, target.width, target.height, ItemID.GoldCoin);
}
}
else
{
return;
}
}
}
}
+2
View File
@@ -167,6 +167,8 @@ namespace CalamityMod
light += 1;
if (mp.sparks)
light += 1;
if (mp.thiefsDime)
light += 1;
if (mp.fathomSwarmerVisage)
light += 1;
if (mp.aquaticHeart)
+22 -4
View File
@@ -2,10 +2,14 @@
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.DataStructures;
using Terraria.GameContent.Generation;
using Terraria.WorldBuilding;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using System.Linq;
using System.Collections.Generic;
using CalamityMod.DataStructures;
namespace CalamityMod
{
@@ -38,7 +42,7 @@ namespace CalamityMod
}
//place a circular clump of tiles
public static void NaturalCircle(int i, int j, int size, int tileType)
public static void NaturalCircle(int i, int j, int size, int tileType, bool hasRandomness = false)
{
int BaseRadius = size;
int radius = BaseRadius;
@@ -57,7 +61,7 @@ namespace CalamityMod
}
}
radius = BaseRadius - WorldGen.genRand.Next(-1, 2);
radius = BaseRadius - (hasRandomness ? WorldGen.genRand.Next(-1, 2) : 0);
}
}
@@ -70,9 +74,23 @@ namespace CalamityMod
{
for (int y = 5; y < 300; y++)
{
if (WorldGen.genRand.Next(350) == 0 && Main.tile[x, y].TileType == TileID.Cloud)
if (WorldGen.genRand.Next(365) == 0 && Main.tile[x, y].TileType == TileID.Cloud)
{
NaturalCircle(x, y, WorldGen.genRand.Next(1, 4), ModContent.TileType<Tiles.Ores.AerialiteOre>());
ShapeData circle = new ShapeData();
GenAction blotchMod = new Modifiers.Blotches(2, 0.4);
int outerRadius = (int)(WorldGen.genRand.Next(3, 5) * WorldGen.genRand.NextFloat(0.74f, 0.82f));
WorldUtils.Gen(new Point(x, y), new Shapes.Circle(outerRadius), Actions.Chain(new GenAction[]
{
blotchMod.Output(circle)
}));
WorldUtils.Gen(new Point(x, y), new ModShapes.All(circle), Actions.Chain(new GenAction[]
{
new Actions.ClearTile(),
new Actions.PlaceTile((ushort)ModContent.TileType<Tiles.Ores.AerialiteOre>())
}));
}
}
}
+2 -2
View File
@@ -77,7 +77,7 @@ namespace CalamityMod.World
tileDown.TileType != ModContent.TileType<BrimstoneSlag>() || tileLeft.TileType != ModContent.TileType<BrimstoneSlag>() ||
tileRight.TileType != ModContent.TileType<BrimstoneSlag>()))
{
CalamityUtils.NaturalCircle(x, y, WorldGen.genRand.Next(5, 22), ModContent.TileType<BrimstoneSlag>());
CalamityUtils.NaturalCircle(x, y, WorldGen.genRand.Next(5, 22), ModContent.TileType<BrimstoneSlag>(), true);
}
}
}
@@ -98,7 +98,7 @@ namespace CalamityMod.World
{
if (WorldGen.genRand.Next(25) == 0)
{
CalamityUtils.NaturalCircle(x, y, WorldGen.genRand.Next(5, 15), ModContent.TileType<BrimstoneSlag>());
CalamityUtils.NaturalCircle(x, y, WorldGen.genRand.Next(5, 15), ModContent.TileType<BrimstoneSlag>(), true);
}
}
}