MERGE: Vast majority of Salesman content

This commit is contained in:
Cameron Ewell authored and GitHub committed 2026-04-26 19:13:44 -04:00
commit 14ab738ba4
89 files changed
+2545 -81

No files matched your search

+29
View File
@@ -0,0 +1,29 @@
using CalamityMod.DataStructures;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Buffs.Alcohol
{
public class BaconOilBuff : ModBuff
{
public static DebuffData debuffData = new DebuffData()
{
AlcoholLevel = 3
};
public override void SetStaticDefaults()
{
Main.debuff[Type] = true;
Main.pvpBuff[Type] = true;
Main.buffNoSave[Type] = false;
Main.persistentBuff[Type] = true;
BuffID.Sets.NurseCannotRemoveDebuff[Type] = true;
BuffDatasets.DebuffDataset[Type] = debuffData;
}
public override void Update(Player player, ref int buffIndex)
{
player.Calamity().baconOil = true;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

+6 -1
View File
@@ -1,10 +1,15 @@
using Terraria;
using CalamityMod.DataStructures;
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Buffs.Alcohol
{
public class BloodyMaryBuff : ModBuff
{
public static DebuffData debuffData = new DebuffData()
{
AlcoholLevel = 1
};
public override void SetStaticDefaults()
{
Main.debuff[Type] = true;
+6 -1
View File
@@ -1,10 +1,15 @@
using Terraria;
using CalamityMod.DataStructures;
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Buffs.Alcohol
{
public class CaribbeanRumBuff : ModBuff
{
public static DebuffData debuffData = new DebuffData()
{
AlcoholLevel = 1
};
public override void SetStaticDefaults()
{
Main.debuff[Type] = true;
+6 -1
View File
@@ -1,10 +1,15 @@
using Terraria;
using CalamityMod.DataStructures;
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Buffs.Alcohol
{
public class CinnamonRollBuff : ModBuff
{
public static DebuffData debuffData = new DebuffData()
{
AlcoholLevel = 1
};
public override void SetStaticDefaults()
{
Main.debuff[Type] = true;
+6 -1
View File
@@ -1,10 +1,15 @@
using Terraria;
using CalamityMod.DataStructures;
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Buffs.Alcohol
{
public class EverclearBuff : ModBuff
{
public static DebuffData debuffData = new DebuffData()
{
AlcoholLevel = 2
};
public override void SetStaticDefaults()
{
Main.debuff[Type] = true;
+6 -1
View File
@@ -1,4 +1,5 @@
using CalamityMod.Items.Potions.Alcohol;
using CalamityMod.DataStructures;
using CalamityMod.Items.Potions.Alcohol;
using Terraria;
using Terraria.ModLoader;
@@ -6,6 +7,10 @@ namespace CalamityMod.Buffs.Alcohol
{
public class EvergreenGinBuff : ModBuff
{
public static DebuffData debuffData = new DebuffData()
{
AlcoholLevel = 1
};
public override void SetStaticDefaults()
{
Main.debuff[Type] = true;
+6 -1
View File
@@ -1,4 +1,5 @@
using CalamityMod.Items.Potions.Alcohol;
using CalamityMod.DataStructures;
using CalamityMod.Items.Potions.Alcohol;
using Terraria;
using Terraria.ModLoader;
@@ -6,6 +7,10 @@ namespace CalamityMod.Buffs.Alcohol
{
public class FireballBuff : ModBuff
{
public static DebuffData debuffData = new DebuffData()
{
AlcoholLevel = 1
};
public override void SetStaticDefaults()
{
Main.debuff[Type] = true;
+6 -1
View File
@@ -1,4 +1,5 @@
using CalamityMod.Items.Potions.Alcohol;
using CalamityMod.DataStructures;
using CalamityMod.Items.Potions.Alcohol;
using Terraria;
using Terraria.ModLoader;
@@ -6,6 +7,10 @@ namespace CalamityMod.Buffs.Alcohol
{
public class GrapeBeerBuff : ModBuff
{
public static DebuffData debuffData = new DebuffData()
{
AlcoholLevel = 1
};
public override void SetStaticDefaults()
{
Main.debuff[Type] = true;
+6 -1
View File
@@ -1,4 +1,5 @@
using CalamityMod.Items.Potions.Alcohol;
using CalamityMod.DataStructures;
using CalamityMod.Items.Potions.Alcohol;
using Terraria;
using Terraria.ModLoader;
@@ -6,6 +7,10 @@ namespace CalamityMod.Buffs.Alcohol
{
public class ManhattanBuff : ModBuff
{
public static DebuffData debuffData = new DebuffData()
{
AlcoholLevel = 1
};
public override void SetStaticDefaults()
{
Main.debuff[Type] = true;
+6 -1
View File
@@ -1,4 +1,5 @@
using CalamityMod.Items.Potions.Alcohol;
using CalamityMod.DataStructures;
using CalamityMod.Items.Potions.Alcohol;
using Terraria;
using Terraria.ModLoader;
@@ -6,6 +7,10 @@ namespace CalamityMod.Buffs.Alcohol
{
public class MargaritaBuff : ModBuff
{
public static DebuffData debuffData = new DebuffData()
{
AlcoholLevel = 1
};
public override void SetStaticDefaults()
{
Main.debuff[Type] = true;
+6 -1
View File
@@ -1,10 +1,15 @@
using Terraria;
using CalamityMod.DataStructures;
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Buffs.Alcohol
{
public class MoonshineBuff : ModBuff
{
public static DebuffData debuffData = new DebuffData()
{
AlcoholLevel = 1
};
public override void SetStaticDefaults()
{
Main.debuff[Type] = true;
+6 -1
View File
@@ -1,10 +1,15 @@
using Terraria;
using CalamityMod.DataStructures;
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Buffs.Alcohol
{
public class MoscowMuleBuff : ModBuff
{
public static DebuffData debuffData = new DebuffData()
{
AlcoholLevel = 1
};
public override void SetStaticDefaults()
{
Main.debuff[Type] = true;
+6 -1
View File
@@ -1,10 +1,15 @@
using Terraria;
using CalamityMod.DataStructures;
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Buffs.Alcohol
{
public class OldFashionedBuff : ModBuff
{
public static DebuffData debuffData = new DebuffData()
{
AlcoholLevel = 1
};
public override void SetStaticDefaults()
{
Main.debuff[Type] = true;
+6 -1
View File
@@ -1,10 +1,15 @@
using Terraria;
using CalamityMod.DataStructures;
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Buffs.Alcohol
{
public class PurpleHazeBuff : ModBuff
{
public static DebuffData debuffData = new DebuffData()
{
AlcoholLevel = 1
};
public override void SetStaticDefaults()
{
Main.debuff[Type] = true;
+6 -1
View File
@@ -1,10 +1,15 @@
using Terraria;
using CalamityMod.DataStructures;
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Buffs.Alcohol
{
public class RedWineBuff : ModBuff
{
public static DebuffData debuffData = new DebuffData()
{
AlcoholLevel = 1
};
public override void SetStaticDefaults()
{
Main.debuff[Type] = true;
+6 -1
View File
@@ -1,10 +1,15 @@
using Terraria;
using CalamityMod.DataStructures;
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Buffs.Alcohol
{
public class RumBuff : ModBuff
{
public static DebuffData debuffData = new DebuffData()
{
AlcoholLevel = 1
};
public override void SetStaticDefaults()
{
Main.debuff[Type] = true;
+6 -1
View File
@@ -1,4 +1,5 @@
using CalamityMod.Items.Potions.Alcohol;
using CalamityMod.DataStructures;
using CalamityMod.Items.Potions.Alcohol;
using Terraria;
using Terraria.ModLoader;
@@ -6,6 +7,10 @@ namespace CalamityMod.Buffs.Alcohol
{
public class ScrewdriverBuff : ModBuff
{
public static DebuffData debuffData = new DebuffData()
{
AlcoholLevel = 1
};
public override void SetStaticDefaults()
{
Main.debuff[Type] = true;
+6 -1
View File
@@ -1,10 +1,15 @@
using Terraria;
using CalamityMod.DataStructures;
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Buffs.Alcohol
{
public class StarBeamRyeBuff : ModBuff
{
public static DebuffData debuffData = new DebuffData()
{
AlcoholLevel = 1
};
public override void SetStaticDefaults()
{
Main.debuff[Type] = true;
+6 -1
View File
@@ -1,4 +1,5 @@
using CalamityMod.Items.Potions.Alcohol;
using CalamityMod.DataStructures;
using CalamityMod.Items.Potions.Alcohol;
using Terraria;
using Terraria.ModLoader;
@@ -6,6 +7,10 @@ namespace CalamityMod.Buffs.Alcohol
{
public class TequilaBuff : ModBuff
{
public static DebuffData debuffData = new DebuffData()
{
AlcoholLevel = 1
};
public override void SetStaticDefaults()
{
Main.debuff[Type] = true;
+6 -1
View File
@@ -1,10 +1,15 @@
using Terraria;
using CalamityMod.DataStructures;
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Buffs.Alcohol
{
public class TequilaSunriseBuff : ModBuff
{
public static DebuffData debuffData = new DebuffData()
{
AlcoholLevel = 1
};
public override void SetStaticDefaults()
{
Main.debuff[Type] = true;
+6 -1
View File
@@ -1,4 +1,5 @@
using CalamityMod.Items.Potions.Alcohol;
using CalamityMod.DataStructures;
using CalamityMod.Items.Potions.Alcohol;
using Terraria;
using Terraria.ModLoader;
@@ -6,6 +7,10 @@ namespace CalamityMod.Buffs.Alcohol
{
public class VodkaBuff : ModBuff
{
public static DebuffData debuffData = new DebuffData()
{
AlcoholLevel = 1
};
public override void SetStaticDefaults()
{
Main.debuff[Type] = true;
+6 -1
View File
@@ -1,10 +1,15 @@
using Terraria;
using CalamityMod.DataStructures;
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Buffs.Alcohol
{
public class WhiskeyBuff : ModBuff
{
public static DebuffData debuffData = new DebuffData()
{
AlcoholLevel = 1
};
public override void SetStaticDefaults()
{
Main.debuff[Type] = true;
+6 -1
View File
@@ -1,10 +1,15 @@
using Terraria;
using CalamityMod.DataStructures;
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Buffs.Alcohol
{
public class WhiteWineBuff : ModBuff
{
public static DebuffData debuffData = new DebuffData()
{
AlcoholLevel = 1
};
public override void SetStaticDefaults()
{
Main.debuff[Type] = true;
+42
View File
@@ -0,0 +1,42 @@
using CalamityMod.DataStructures;
using CalamityMod.Items.Potions;
using CalamityMod.Particles;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.Audio;
using Terraria.DataStructures;
using Terraria.GameContent;
using Terraria.Graphics.Shaders;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Buffs.Potions
{
public class SwinesWrathBuff : ModBuff
{
public static readonly SoundStyle TimerSound = new("CalamityMod/Sounds/Custom/TickingTimer");
public override void SetStaticDefaults()
{
Main.debuff[Type] = true;
Main.pvpBuff[Type] = true;
Main.buffNoSave[Type] = false;
BuffID.Sets.NurseCannotRemoveDebuff[Type] = true;
}
public override void Update(Player player, ref int buffIndex)
{
TheConcoctionPlayer concoctionPlayer = player.GetModPlayer<TheConcoctionPlayer>();
if (concoctionPlayer.swinesWrathCounter < 2 && concoctionPlayer.swinesWrathCounter != -1)
{
player.KillMe(PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.SwinesWrath" + Main.rand.Next(1, 7 + 1)).ToNetworkText(player.name)), 1000, -1);
concoctionPlayer.swinesWrathCounter = -1;
}
else if (concoctionPlayer.swinesWrathCounter % 60 == 59)
SoundEngine.PlaySound(TimerSound with { Volume = ((600f - concoctionPlayer.swinesWrathCounter) / 600f) }, player.Center); // Gets louder as time progresses
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 522 B

+22
View File
@@ -0,0 +1,22 @@
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Buffs.StatDebuffs
{
public class Malnourished : ModBuff
{
public override void SetStaticDefaults()
{
Main.debuff[Type] = true;
Main.pvpBuff[Type] = true;
Main.buffNoSave[Type] = true;
BuffID.Sets.LongerExpertDebuff[Type] = true;
}
public override void Update(Player player, ref int buffIndex)
{
player.Calamity().malnourished = true;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 798 B

+128 -1
View File
@@ -43,6 +43,7 @@ using CalamityMod.Items.PermanentBoosters;
using CalamityMod.Items.Placeables.Furniture;
using CalamityMod.Items.Potions;
using CalamityMod.Items.Potions.Alcohol;
using CalamityMod.Items.Potions.Food;
using CalamityMod.Items.Tools;
using CalamityMod.Items.Tools.ClimateChange;
using CalamityMod.Items.TreasureBags.MiscGrabBags;
@@ -379,9 +380,12 @@ namespace CalamityMod.CalPlayer
public int hideOfDeusMeleeBoostTimer = 0;
/// <summary>
/// The player's alcohol level. Increased by 1 for each alcohol the player has drank, 2 for Everclear.<br/>
/// If this value is greater than 3, the player is inflicted with Alcohol Poisoning.
/// If this value is greater than the max (normally 3), the player is inflicted with Alcohol Poisoning.
/// </summary>
public int alcoholPoisonLevel = 0;
public static int alcoholPoisonMaxBase = 3;
/// <summary> The maximum alcohol level the player can reach before getting Alcohol Poisoning. </summary>
public int alcoholPoisonMax = alcoholPoisonMaxBase;
public int dashTimeMod;
/// <summary>
/// Timer variable which tracks how long the player has spent outside of Providence's border radius, in frames.<br/>
@@ -804,6 +808,7 @@ namespace CalamityMod.CalPlayer
#endregion
#region Accessory
public int friendlyMinions = 0;
public bool shieldOfTheHighRulerDashVelocityBoosted = false;
public bool yharimsGift = false;
public bool luxorsGift = false;
@@ -1395,6 +1400,7 @@ namespace CalamityMod.CalPlayer
public bool riptide = false;
public bool hadopelagicPressure = false;
public bool fishAlert = false;
public bool malnourished = false;
public bool clamity = false;
public bool NOU = false;
public bool absorberAffliction = false;
@@ -1486,6 +1492,8 @@ namespace CalamityMod.CalPlayer
public bool whiteWine = false;
public float whiteWineTimer = 0;
public bool evergreenGin = false;
public bool baconOil = false;
public int baconOilSoundCooldown = 0;
public bool tranquilityCandle = false;
public bool chaosCandle = false;
public bool blueCandle = false;
@@ -2162,6 +2170,7 @@ namespace CalamityMod.CalPlayer
externalAuricRejectionImmunity = false;
alcoholPoisonLevel = 0;
alcoholPoisonMax = alcoholPoisonMaxBase;
noLifeRegen = false;
//Stratus Starburst amount management
@@ -2251,6 +2260,7 @@ namespace CalamityMod.CalPlayer
if (!pSoulArtifact)
pSoulShieldDurability = 0;
}
friendlyMinions = 0;
pSoulShieldVisible = false;
roverDrive = false;
roverDriveShieldVisible = false;
@@ -2695,6 +2705,7 @@ namespace CalamityMod.CalPlayer
riptide = false;
hadopelagicPressure = false;
fishAlert = false;
malnourished = false;
clamity = false;
NOU = false;
enraged = false;
@@ -2782,6 +2793,7 @@ namespace CalamityMod.CalPlayer
moscowMule = false;
whiteWine = false;
evergreenGin = false;
baconOil = false;
tranquilityCandle = false;
chaosCandle = false;
@@ -3179,6 +3191,7 @@ namespace CalamityMod.CalPlayer
riptide = false;
hadopelagicPressure = false;
fishAlert = false;
malnourished = false;
clamity = false;
NOU = false;
snowmanNoseless = false;
@@ -3293,6 +3306,7 @@ namespace CalamityMod.CalPlayer
moscowMule = false;
whiteWine = false;
evergreenGin = false;
baconOil = false;
tranquilityCandle = false;
chaosCandle = false;
blueCandle = false;
@@ -4850,6 +4864,32 @@ namespace CalamityMod.CalPlayer
}
}
}
if (malnourished) // Has to be here because alcoholPoisonLevel isn't updated until now
{
alcoholPoisonMax += TheSandwich.alcoholCapBoost;
// Gives inverted buffs from well fed
Player.statDefense -= 2;
Player.GetCritChance<GenericDamageClass>() -= 2;
Player.minionKB -= 0.5f;
Player.moveSpeed -= 0.05f;
// damage nerf/boost happens in PostUpdate
Player.pickSpeed += 0.05f;
for (int l = 0; l < Player.MaxBuffs; ++l)
{
int buffID = Player.buffType[l];
if ((BuffDatasets.DebuffDataset[buffID] != null && BuffDatasets.DebuffDataset[buffID].AlcoholLevel > 0) || buffID == BuffID.Tipsy)
{
Player.buffTime[l]++;
}
}
if (Player.wellFed)
Player.ClearBuff(ModContent.BuffType<Malnourished>());
}
if (moonshine)
Player.statLifeMax2 = (int)(Player.statLifeMax2 * (1 + Moonshine.MaxLifePercentBoost));
ForceVariousEffects();
@@ -5133,6 +5173,9 @@ namespace CalamityMod.CalPlayer
}
}
if (malnourished) // Has to be here because alcoholPoisonLevel isn't updated until now
Player.GetDamage<GenericDamageClass>() += -0.05f + TheSandwich.statBoost * alcoholPoisonLevel;
// Relic of Convergence defense cut
if (Player.ownedProjectileCounts[ModContent.ProjectileType<RelicOfConvergenceCrystal>()] > 0 && Player.HeldItem.type == ModContent.ItemType<RelicOfConvergence>())
Player.statDefense *= RelicOfConvergence.DefenseMultiplier;
@@ -5264,6 +5307,90 @@ namespace CalamityMod.CalPlayer
}
#endregion
if (Player.Calamity().baconOil && !Player.mount.Active)
{
Player.noFallDmg = true;
float velX = Math.Abs(Player.velocity.X);
float velY = Math.Abs(Player.velocity.Y);
float speedMult = Player.GetBestClassDamage().ApplyTo(1);
float maxMoveSpeed = 10.5f * speedMult;
float minMoveSpeed = 3; // Minimum move speed to be at if the player can bounce
float hitboxSizeMult = 0.45f;
bool onPlatform = false;
if (Player.velocity.Y > 0 && !Player.controlDown)
{
for (int i = 4; i < 8; i++)
{
Point bottom = (Player.Bottom + Vector2.UnitY * i).ToTileCoordinates();
if (TileID.Sets.Platforms[CalamityUtils.ParanoidTileRetrieval(bottom.X, bottom.Y).TileType])
{
onPlatform = true;
}
}
}
bool hitDown = velY > minMoveSpeed && (Collision.SolidCollision(Player.Bottom + Vector2.UnitY * Player.velocity.Y, (int)(Player.width * hitboxSizeMult), 1) || onPlatform);
bool hitUp = velY > minMoveSpeed && Collision.SolidCollision(Player.Top + Vector2.UnitY * Player.velocity.Y, (int)(Player.width * hitboxSizeMult), 1);
bool hitSide = velX > minMoveSpeed && Collision.SolidCollision(Vector2.Lerp(Player.TopLeft, Player.Left, 0.15f) + Vector2.UnitX * Player.velocity.X, 1, (int)(Player.height * hitboxSizeMult)) || Collision.SolidCollision(Vector2.Lerp(Player.TopRight, Player.Right, 0.15f) + Vector2.UnitX * Player.velocity.X, 1, (int)(Player.height * hitboxSizeMult));
float acceleration = 0.05f;
float decceleration = -0.025f / speedMult;
float riseSpeed = 0.8f; // The speed the player rises when in water or rain
float slipPower = 0.85f; //How strong the slippery effect is
float bounceReduction = 0.9f;
bool makeSound = false;
if (hitSide)
{
Player.velocity.X = -Player.velocity.X * bounceReduction;
Player.oldVelocity.X = -Player.oldVelocity.X * bounceReduction;
makeSound = true;
}
if ((hitDown || hitUp))
{
if (Player.controlUp)
bounceReduction = 1.3f;
Player.velocity.Y = -Player.velocity.Y * bounceReduction;
Player.oldVelocity.Y = -Player.oldVelocity.Y * bounceReduction;
if (hitDown)
{
Player.RefreshMovementAbilities(true);
}
makeSound = true;
}
int soundCDMax = 150;
if (makeSound && baconOilSoundCooldown < soundCDMax)
{
if (baconOilSoundCooldown < soundCDMax)
baconOilSoundCooldown += 30;
float pitch = 0.55f * Utils.GetLerpValue(0, soundCDMax, baconOilSoundCooldown, true);
SoundStyle boyoyoing = new("CalamityMod/Sounds/Item/BaconOilBounce");
SoundEngine.PlaySound(boyoyoing with { Volume = 0.45f, Pitch = hitSide ? pitch - 0.3f : pitch, MaxInstances = 5 }, Player.Center);
}
bool playerMoving = Player.controlLeft || Player.controlRight;
bool playerMovingInDirection = (Player.controlLeft && Player.oldVelocity.X < 0) || (Player.controlRight && Player.oldVelocity.X > 0);
if (((Player.oldVelocity.X > 0 && Player.velocity.X > 0) || (Player.oldVelocity.X < 0 && Player.velocity.X < 0)))
Player.velocity.X = MathHelper.Clamp(Player.velocity.X + maxMoveSpeed * MathF.Sign(Player.oldVelocity.X) *
((playerMovingInDirection || !playerMoving) ? Player.dashDelay == -1 ? decceleration : // If dashing, deccelerate to prevent infinite dash
// If not moving or holding in move direction, accelerate to max speed, otherwise deccelerate
acceleration : decceleration), -maxMoveSpeed, maxMoveSpeed);
bool raining = Player.Center.Y < Main.worldSurface * 16.0 && Main.raining;
if ((Player.wet || raining) && Player.velocity.Y > -maxMoveSpeed)
{
Player.velocity.Y -= riseSpeed; // Cover yourself in oil (go up in liquid)
}
Vector2 lerpedVel = Vector2.Lerp(Player.velocity, Player.oldVelocity, slipPower);
Player.velocity = new Vector2(lerpedVel.X, Player.velocity.Y);
}
if (baconOilSoundCooldown > 0)
baconOilSoundCooldown = (int)MathHelper.Lerp(baconOilSoundCooldown, 0, 0.027f);
Player.oldVelocity = Player.velocity; // Apparently this value is not updated on its own, so we do it
}
#endregion
+5 -11
View File
@@ -1,6 +1,7 @@
using System;
using System.Linq;
using CalamityMod.Buffs.Alcohol;
using CalamityMod.Buffs.Potions;
using CalamityMod.Buffs.StatBuffs;
using CalamityMod.CalPlayer.Dashes;
using CalamityMod.DataStructures;
@@ -12,9 +13,7 @@ using CalamityMod.Items.Armor.Silva;
using CalamityMod.Items.Armor.Tarragon;
using CalamityMod.Items.Fishing.BrimstoneCragCatches;
using CalamityMod.Items.Placeables.Furniture;
using CalamityMod.Items.Potions;
using CalamityMod.Items.Potions.Alcohol;
using CalamityMod.Items.Potions.Food;
using CalamityMod.NPCs;
using CalamityMod.Projectiles.Typeless;
using CalamityMod.Systems;
@@ -194,8 +193,8 @@ namespace CalamityMod.CalPlayer
for (int l = 0; l < Player.MaxBuffs; l++)
{
int buff = Player.buffType[l];
if (CalamityBuffSets.AlcoholStrength.TryGetValue(buff, out int level))
alcoholPoisonLevel += level;
if (BuffDatasets.DebuffDataset[buff] is not null && BuffDatasets.DebuffDataset[buff].AlcoholLevel > 0)
alcoholPoisonLevel += BuffDatasets.DebuffDataset[buff].AlcoholLevel;
}
if (Player.Calamity().ivDrip) // +1 stack of poisoning while IV Drip is equipped
alcoholPoisonLevel++;
@@ -213,7 +212,7 @@ namespace CalamityMod.CalPlayer
Player.fishingSkill += 5;
}
if (alcoholPoisonLevel > 3)
if (alcoholPoisonLevel > alcoholPoisonMax)
{
// Independently of Calamity's nerfs to Nebula life regen, it is disabled entirely by alcohol poisoning.
Player.nebulaLevelLife = 0;
@@ -558,12 +557,7 @@ namespace CalamityMod.CalPlayer
if (community)
{
int regenBoost = 1 + (int)(TheCommunity.CalculatePower() * TheCommunity.RegenMultiplier);
bool lesserEffect = false;
for (int l = 0; l < Player.MaxBuffs; l++)
{
int hasBuff = Player.buffType[l];
lesserEffect = CalamityBuffSets.AlcoholStrength.TryGetValue(hasBuff, out var a);
}
bool lesserEffect = Player.buffType.Any(i => BuffDatasets.DebuffDataset[i] is not null && BuffDatasets.DebuffDataset[i].AlcoholLevel > 0);
if (Player.lifeRegen < 0)
Player.lifeRegen += lesserEffect ? 1 : regenBoost;
}
+10 -1
View File
@@ -1721,6 +1721,16 @@ namespace CalamityMod.CalPlayer
if (rOfResilienceCooldown > 0)
rOfResilienceCooldown--;
if (Player.Calamity().friendlyMinions > 0)
{
int numOfPigs = Player.ownedProjectileCounts[ModContent.ProjectileType<Pigion>()];
if (numOfPigs < Player.Calamity().friendlyMinions)
{
int pigDamage = 7;
Projectile.NewProjectileDirect(Player.GetSource_FromThis(), Player.Center, new Vector2(0, -16).RotatedByRandom(MathHelper.Pi), ModContent.ProjectileType<Pigion>(), pigDamage, 0f, Player.whoAmI, 0, numOfPigs + 1);
}
}
if (transformer && Player.Calamity().transformerCooldown == 0 && transformerDelay == 0) // The code for this acursed thing took much... MUCH, too long to make
{
float zoneSize = 150;
@@ -3347,7 +3357,6 @@ namespace CalamityMod.CalPlayer
#region Other Buff Effects
private void OtherBuffEffects()
{
if (gravityNormalizer)
{
Player.buffImmune[BuffID.VortexDebuff] = true;
+1 -2
View File
@@ -113,11 +113,10 @@ namespace CalamityMod.DataStructures
public bool GearCanModifyDebuff = true;
/// <summary>
/// UNIMPLEMENTED. WILL BE DONE IN A FUTURE PR
/// How much alcohol this counts as.
/// Default is 0, most alcohol is 1, and Everclear is 2
/// </summary>
public float AlcoholLevel = 0f;
public int AlcoholLevel = 0;
/// <summary>
/// UNIMPLEMENTED. WILL BE DONE IN A FUTURE PR
Binary file not shown.

After

Width:  |  Height:  |  Size: 155 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 203 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 163 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 152 B

+43
View File
@@ -0,0 +1,43 @@
using CalamityMod.NPCs;
using CalamityMod.Tiles.Furniture;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Placeables.Furniture
{
public class TheMonument : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Placeables";
public const float MonumentTaxIncrease = 0.5f;
public const float MonumentHappinessReduction = 0.15f;
public override void SetDefaults()
{
Item.DefaultToPlaceableTile(ModContent.TileType<TheMonumentTile>());
Item.width = 40;
Item.height = 50;
Item.rare = ItemRarityID.Pink;
Item.value = Item.buyPrice(gold: 5);
}
public override void Load()
{
On_Player.CollectTaxes += AddMonumentTaxes;
}
private static void AddMonumentTaxes(On_Player.orig_CollectTaxes orig, Player self)
{
orig(self);
foreach (NPC n in Main.ActiveNPCs)
{
if (!n.homeless && !NPCID.Sets.IsTownPet[n.type] && NPC.TypeToDefaultHeadIndex(n.type) > 0 && n.GetGlobalNPC<CalamityGlobalTownNPC>().AffectedByTheMonument)
self.taxMoney += (int)(CalamityGlobalTownNPC.TotalTaxesPerNPC * MonumentTaxIncrease);
}
if (self.taxMoney > CalamityGlobalTownNPC.TaxesToCollectLimit)
self.taxMoney = CalamityGlobalTownNPC.TaxesToCollectLimit;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

+32
View File
@@ -0,0 +1,32 @@
using CalamityMod.Buffs.Alcohol;
using CalamityMod.Items.Materials;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.Localization;
using Terraria.ModLoader;
namespace CalamityMod.Items.Potions.Alcohol
{
public class BaconOil : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Potions";
public override void SetStaticDefaults()
{
Item.ResearchUnlockCount = 20;
ItemID.Sets.DrinkParticleColors[Type] = new Color[3] {
new Color(204, 90, 73),
new Color(168, 37, 37),
new Color(120, 28, 28)
};
}
public override void SetDefaults()
{
Item.DefaultToFood(20, 32, ModContent.BuffType<BaconOilBuff>(), CalamityUtils.MinutesToFrames(6), true);
Item.value = Item.sellPrice(silver: 2);
Item.rare = ItemRarityID.Blue;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

+42
View File
@@ -0,0 +1,42 @@
using CalamityMod.Buffs.StatDebuffs;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.DataStructures;
using Terraria.ID;
using Terraria.Localization;
using Terraria.ModLoader;
namespace CalamityMod.Items.Potions.Food
{
public class TheSandwich : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Potions";
public static int alcoholCapBoost = 2;
public static float statBoost = 0.05f; // The player starts with negative stat boosts, so it is a bit less than you'd expect
public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(statBoost.ToPercent());
public override void SetStaticDefaults()
{
Item.ResearchUnlockCount = 5;
Main.RegisterItemAnimation(Type, new DrawAnimationVertical(int.MaxValue, 3));
ItemID.Sets.FoodParticleColors[Type] = new Color[3] {
new Color(132, 171, 87),
new Color(174, 91, 107),
new Color(218, 176, 133)
};
ItemID.Sets.IsFood[Type] = true;
}
public override void SetDefaults()
{
Item.DefaultToFood(70, 48, ModContent.BuffType<Malnourished>(), CalamityUtils.MinutesToFrames(10));
Item.value = Item.sellPrice(silver: 20);
Item.rare = ItemRarityID.Blue;
}
public override void UseAnimation(Player player)
{
player.ClearBuff(BuffID.WellFed);
player.ClearBuff(BuffID.WellFed2);
player.ClearBuff(BuffID.WellFed3);
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

+89
View File
@@ -0,0 +1,89 @@
using System.Collections.Generic;
using System.Linq;
using CalamityMod.Buffs.Potions;
using CalamityMod.Items.Materials;
using CalamityMod.Rarities;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Audio;
using Terraria.DataStructures;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Potions
{
public class TheConcoction : ModItem, ILocalizedModType
{
private static int hoverTimer = 0;
private static bool wasHovering = false;
public new string LocalizationCategory => "Items.Potions";
public override void SetStaticDefaults()
{
Item.ResearchUnlockCount = 30;
ItemID.Sets.DrinkParticleColors[Type] = new Color[3]
{
new Color(255, 190, 250),
new Color(255, 225, 183),
new Color(246, 34, 79)
};
}
public override void SetDefaults()
{
Item.DefaultToHealingPotion(50, 56, 500);
Item.value = Item.sellPrice(silver: 60);
Item.rare = ItemRarityID.Green;
}
public override void OnConsumeItem(Player player)
{
TheConcoctionPlayer cocPlayer = player.GetModPlayer<TheConcoctionPlayer>();
cocPlayer.swinesWrathCounter = 1200; // Creates a 10 second delay before the buff is visible (triggers at 600)
}
public override void UpdateInventory(Player player)
{
wasHovering = Main.HoverItem?.type == Type;
}
// Display different text for the first 10 frames of hovering over the item's tooltip.
public override void ModifyTooltips(List<TooltipLine> tooltips)
{
bool isHovering = Main.HoverItem?.type == Type;
if (isHovering && !wasHovering)
hoverTimer = 0;
if (isHovering)
hoverTimer++;
if (hoverTimer <= 10 && hoverTimer > 0)
{
TooltipLine healLine = tooltips.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "HealLife");
healLine?.Text = this.GetLocalization("EasterEggText").Value;
}
}
}
public class TheConcoctionPlayer : ModPlayer
{
public int swinesWrathCounter = -1;
public override void PostUpdate()
{
if (swinesWrathCounter > 0)
{
swinesWrathCounter--;
if (swinesWrathCounter <= 600 && !Player.HasBuff<SwinesWrathBuff>()) // When there is 10 seconds left
{
Player.AddBuff(ModContent.BuffType<SwinesWrathBuff>(), 600);
SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Item/SwinesWrathProc"), Player.Center);
}
}
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 543 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 489 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 510 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 541 B

+153
View File
@@ -0,0 +1,153 @@
using CalamityMod.Items.Placeables.Furniture;
using CalamityMod.NPCs;
using CalamityMod.Particles;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Audio;
using Terraria.GameContent;
using Terraria.ID;
using Terraria.Localization;
using Terraria.ModLoader;
namespace CalamityMod.Items.Tools
{
public class TheGift : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Tools";
public static readonly SoundStyle BadBuzzer = new SoundStyle("CalamityMod/Sounds/Custom/BadGiftBuzzer") with { Volume = 0.85f };
public override void SetDefaults()
{
Item.width = Item.height = 20;
Item.maxStack = Item.CommonMaxStack;
Item.useTime = Item.useAnimation = 10;
Item.useStyle = ItemUseStyleID.Swing;
Item.useTurn = true;
Item.noMelee = true;
Item.UseSound = SoundID.Item1;
Item.autoReuse = true;
Item.value = CalamityGlobalItem.RarityGreenBuyPrice;
Item.rare = ItemRarityID.Green;
}
public override void Load()
{
On_ShopHelper.ProcessMood += TheGiftHappiness;
}
public override void Update(ref float gravity, ref float maxFallSpeed)
{
// Controls actually applying the effect to an NPC
// None of this should work in Remix because Remix disables happiness
if (Item.noGrabDelay <= 0 && !Main.remixWorld)
{
foreach (NPC n in Main.ActiveNPCs)
{
// Don't run this code for NPCs that aren't affected by happiness
// Also don't run this if The Gift has already been used on this NPC; they all will hold grudges against you :)
if (!n.isLikeATownNPC || NPCID.Sets.NoTownNPCHappiness[n.type] || NPCID.Sets.IsTownPet[n.type] || n.GetGlobalNPC<CalamityGlobalTownNPC>().TheGiftStatus.HasValue)
continue;
if (Item.Hitbox.Intersects(n.Hitbox))
{
bool positive = Main.rand.NextBool();
Color c = positive ? Color.Green : Color.Red;
SoundEngine.PlaySound(positive ? SoundID.ResearchComplete : BadBuzzer, n.Center);
n.GetGlobalNPC<CalamityGlobalTownNPC>().TheGiftStatus = positive;
n.GetGlobalNPC<CalamityGlobalTownNPC>().TheGiftReset = 0.0;
// Visual effect to demonstrate that something happened
for (int i = 0; i < 6; i++)
{
Vector2 spawnPos = n.Center + Main.rand.NextVector2Circular(30f, 30f);
HealingPlus s = new(spawnPos, 0.5f, (spawnPos - n.Center).SafeNormalize(Vector2.Zero) * 0.65f, c, c * 0.2f, 25)
{
Rotation = positive ? 0f : MathHelper.PiOver4
};
GeneralParticleHandler.SpawnParticle(s);
}
for (int j = 0; j < 4; j++)
{
Vector2 spawnPos = n.Center + Main.rand.NextVector2Circular(50f, 50f);
Vector2 arrVel = -Vector2.UnitY * 0.6f * positive.ToDirectionInt();
StatChangeArrow arr = new(spawnPos, arrVel, -MathHelper.PiOver2 * positive.ToDirectionInt(), c, c * 0.1f, 0.7f, 40);
GeneralParticleHandler.SpawnParticle(arr);
}
Item.active = false;
Item.type = ItemID.None;
Item.stack = 0;
if (Main.dedServ)
NetMessage.SendData(MessageID.SyncItem, -1, -1, null, Item.whoAmI);
// Make sure it can't apply to multiple NPCs at once
break;
}
}
}
}
// Also contains logic for The Monument, so I can make sure these apply in the correct order
private static void TheGiftHappiness(On_ShopHelper.orig_ProcessMood orig, ShopHelper self, Player player, NPC npc)
{
orig(self, player, npc);
// Immediately exit early if it's Remix world, or if it's an NPC that should not be affected by happiness
if (Main.remixWorld || NPCID.Sets.NoTownNPCHappiness[npc.type] || NPCID.Sets.IsTownPet[npc.type])
return;
var gtnpc = npc.GetGlobalNPC<CalamityGlobalTownNPC>();
// The Monument lowers happiness by a fixed amount. This is not applied to the Tax Collector.
if (npc.type != NPCID.TaxCollector && gtnpc.SearchForTheMonument(npc))
{
float oldHappiness = self._currentPriceAdjustment;
self._currentPriceAdjustment += TheMonument.MonumentHappinessReduction;
self.LimitAndRoundMultiplier(self._currentPriceAdjustment);
string dialogueKey;
if (npc.type < NPCID.Count)
{
dialogueKey = $"Mods.CalamityMod.Vanilla.TownNPCMood.{NPCID.Search.GetName(npc.type)}.Monument";
// Zoologist has separate dialogue when transformed
if (npc.type == NPCID.BestiaryGirl && npc.ShouldBestiaryGirlBeLycantrope())
dialogueKey += "Transformed";
}
else
{
var modNPC = NPCLoader.GetNPC(npc.type);
dialogueKey = $"Mods.{modNPC.Mod.Name}.NPCs.{modNPC.Name}.TownNPCMood.Monument";
}
// If the NPC is content, it should override that text because they are no longer content
if (oldHappiness == 1f)
self._currentHappiness = Language.Exists(dialogueKey) ? Language.GetTextValue(dialogueKey) : CalamityUtils.GetTextValue("Vanilla.TownNPCMood.DefaultMonument") + " ";
else
self._currentHappiness += Language.Exists(dialogueKey) ? Language.GetTextValue(dialogueKey) : CalamityUtils.GetTextValue("Vanilla.TownNPCMood.DefaultMonument") + " ";
}
// The Gift sets happiness to a fixed either extremely high or extremely low value, depending on its random state.
bool? gift = gtnpc.TheGiftStatus;
if (gift.HasValue)
{
if (gift.Value)
self._currentPriceAdjustment = 0.5f;
else
self._currentPriceAdjustment = 1.75f;
string locKey = gift.Value ? "GiftPositive" : "GiftNegative";
string dialogueKey;
if (npc.type < NPCID.Count)
{
dialogueKey = $"Mods.CalamityMod.Vanilla.TownNPCMood.{NPCID.Search.GetName(npc.type)}.{locKey}";
// Zoologist has separate dialogue when transformed
if (npc.type == NPCID.BestiaryGirl && npc.ShouldBestiaryGirlBeLycantrope())
dialogueKey += "Transformed";
}
else
{
var modNPC = NPCLoader.GetNPC(npc.type);
dialogueKey = $"Mods.{modNPC.Mod.Name}.NPCs.{modNPC.Name}.TownNPCMood.{locKey}";
}
// Yes, it's intentional that this completely overrides all other happiness report dialogue
self._currentHappiness = Language.Exists(dialogueKey) ? Language.GetTextValue(dialogueKey) : CalamityUtils.GetTextValue($"Vanilla.TownNPCMood.Default{locKey}") + " ";
}
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 601 B

+395
View File
@@ -0,0 +1,395 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using CalamityMod.Dusts;
using CalamityMod.Items.Weapons.Melee;
using CalamityMod.Particles;
using CalamityMod.Prefixes;
using CalamityMod.Projectiles.Environment;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Tools
{
public static class VoucherReforgeSystem
{
public static int ForcedPrefix = -1;
public static bool RollWon = false;
}
public class VoucherGlobalItem : GlobalItem
{
public override void PreReforge(Item item)
{
Player player = Main.LocalPlayer;
bool isAccessory = item.accessory;
VoucherReforgeSystem.ForcedPrefix = -1;
for (int i = 0; i < player.inventory.Length; i++)
{
Item invItem = player.inventory[i];
if (invItem.ModItem is VoucherItem voucher)
{
if (voucher.IsUsableVoucher(player, item, isAccessory))
{
VoucherReforgeSystem.ForcedPrefix = voucher.GetPrefixForItem(player, item, isAccessory);
invItem.stack--;
if (invItem.stack <= 0)
invItem.TurnToAir();
if (Main.netMode != NetmodeID.Server)
{
if (VoucherReforgeSystem.RollWon)
{
for (int dustCount = 0; dustCount < 8; dustCount++)
{
// Light dust and sparks
Vector2 sparkVel = Main.rand.NextVector2CircularEdge(1f, 1f) * Main.rand.NextFloat(3f, 12f);
Vector2 dustVel = (sparkVel).SafeNormalize(Vector2.UnitY).RotatedBy(Main.rand.Next(100)) * Main.rand.NextFloat(1f, 15f);
Vector2 fxPos = player.Center + sparkVel;
Color fxColor = Color.Lerp(Color.MediumAquamarine, Color.MediumSeaGreen, Main.rand.NextFloat(1f));
Particle fx = new CustomSpark(fxPos, sparkVel, "CalamityMod/Particles/Sparkle", false, (int)(Main.rand.Next(30, 60)), Main.rand.NextFloat(1.3f, 1.8f), fxColor, new Vector2(0.5f, 1.1f), extraRotation: 0, shrinkSpeed: Main.rand.NextFloat(0.1f, 0.3f));
GeneralParticleHandler.SpawnParticle(fx);
Dust dust = Dust.NewDustPerfect(fxPos, ModContent.DustType<LightDust>(), dustVel, 0, default, Main.rand.NextFloat(0.8f, 1.6f));
dust.noGravity = true;
dust.color = fxColor;
// Crit sparkles
Vector2 velocity = Main.rand.NextVector2CircularEdge(1f, 1f) * Main.rand.NextFloat(1f, 25f);
Color color = Main.rand.NextBool() ? Color.LightBlue : Color.LightSkyBlue;
Particle sparkle = new CritSpark(player.MountedCenter, velocity, color, bloom: Color.Cyan, scale: 1f, lifeTime: Main.rand.Next(15, 60));
GeneralParticleHandler.SpawnParticle(sparkle);
}
SoundEngine.PlaySound(SoundID.Item4, player.position);
}
else
{
for (int d = 0; d < 10; d++)
{
for (int smokeCount = 0; smokeCount < 3; smokeCount++)
{
Vector2 velocity = Main.rand.NextVector2CircularEdge(1f, 1f) * Main.rand.NextFloat(3f, 12f);
Color smokeStart = Main.rand.NextBool() ? Color.Gray : Color.LightGray;
Color smokeEnd = Color.DimGray;
float smokeSize = Main.rand.NextFloat(0.9f, 2f);
Particle smoke = new SmallSmokeParticle(player.MountedCenter, velocity, smokeStart, smokeEnd, smokeSize, Main.rand.Next(90, 140));
GeneralParticleHandler.SpawnParticle(smoke);
}
Particle skull = new DesertProwlerSkullParticle(player.Center, new Vector2(2.5f, 2.5f).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1f), Main.rand.NextBool() ? Color.LightGray : Color.Silver, Color.Gray, Main.rand.NextFloat(0.15f, 0.5f), Main.rand.Next(100, 190));
GeneralParticleHandler.SpawnParticle(skull);
}
SoundEngine.PlaySound(SoundID.Item16, player.position);
}
}
break;
}
}
}
}
}
public abstract class VoucherItem : ModItem
{
#region CyclePrefixes
protected virtual int[] prefixChoices => Array.Empty<int>();
protected int chosenPrefix = 0;
public override void ModifyTooltips(List<TooltipLine> tooltips)
{
string selected = GetSelectedPrefixName();
string all = GetAllPrefixNames();
foreach (var line in tooltips)
{
if (line.Mod == "Terraria" && line.Name.StartsWith("Tooltip"))
{
line.Text = line.Text
.Replace("{0}", selected)
.Replace("{1}", all);
}
}
}
public string GetAllPrefixNames()
{
var pool = prefixChoices;
if (pool.Length == 0)
return null;
List<string> names = new();
foreach (int p in pool)
{
if (p >= 0 && p < Lang.prefix.Length && Lang.prefix[p] != null)
names.Add(Lang.prefix[p].Value);
}
return string.Join(", ", names);
}
public string GetSelectedPrefixName()
{
var pool = prefixChoices;
if (pool.Length == 0)
return null;
int p = pool[chosenPrefix];
if (p >= 0 && p < Lang.prefix.Length && Lang.prefix[p] != null)
return Lang.prefix[p].Value;
return null;
}
#endregion
public bool IsUsableVoucher(Player player, Item itemBeingReforged, bool isAccessory)
{
return Item.favorited && CanApply(player, itemBeingReforged, isAccessory);
}
public override bool CanRightClick() => Main.keyState.PressingShift();
public override void RightClick(Player player)
{
if (prefixChoices.Length == 0)
return;
chosenPrefix++;
if (chosenPrefix >= prefixChoices.Length)
chosenPrefix = 0;
Item.NetStateChanged();
}
public override bool ConsumeItem(Player player) => false;
public override void NetSend(BinaryWriter writer)
{
writer.Write(chosenPrefix);
}
public override void NetReceive(BinaryReader reader)
{
chosenPrefix = reader.ReadInt32();
}
public virtual bool CanApply(Player player, Item itemBeingReforged, bool isAccessory)
{
return true;
}
public virtual int GetPrefixForItem(Player player, Item itemBeingReforged, bool isAccessory)
{
if (prefixChoices.Length == 0)
return -1;
if (isAccessory)
{
if (Main.rand.NextBool())
{
VoucherReforgeSystem.RollWon = true;
return prefixChoices[chosenPrefix];
}
else
{
VoucherReforgeSystem.RollWon = false;
return ModContent.PrefixType<Friendly>();
}
}
VoucherReforgeSystem.RollWon = true;
return prefixChoices[chosenPrefix];
}
}
public class CombatVoucher : VoucherItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Tools";
public override void SetDefaults()
{
Item.width = 36;
Item.height = 20;
Item.rare = ItemRarityID.Green;
Item.value = CalamityGlobalItem.RarityGreenBuyPrice;
Item.maxStack = Item.CommonMaxStack;
}
public override bool CanApply(Player player, Item itemBeingReforged, bool isAccessory)
{
return !isAccessory;
}
public override int GetPrefixForItem(Player player, Item itemBeingReforged, bool isAccessory)
{
int prefix = -1;
var category = itemBeingReforged.GetPrefixCategories();
if (!category.Any())
return -1;
if ((itemBeingReforged).knockBack == 0f) // Weapons which do not apply knockback universally have demonic as their best reforge
prefix = PrefixID.Demonic;
else if (itemBeingReforged.CountsAsClass<MeleeDamageClass>() && itemBeingReforged.type != ModContent.ItemType<TheBurningSky>())
{
bool weirdMelee = !category.Contains(PrefixCategory.Melee); // Weapons which deal melee damage but cannot recieve melee prefixes because Item.noUseGraphic is true
if (weirdMelee || itemBeingReforged.CountsAsClass<MeleeNoSpeedDamageClass>())
prefix = PrefixID.Godly;
else
prefix = PrefixID.Legendary;
}
else if (itemBeingReforged.CountsAsClass<RangedDamageClass>() || itemBeingReforged.type == ModContent.ItemType<TheBurningSky>())
prefix = PrefixID.Unreal;
else if (itemBeingReforged.CountsAsClass<MagicDamageClass>())
prefix = PrefixID.Mythical;
else if (itemBeingReforged.CountsAsClass<RogueDamageClass>())
prefix = ModContent.PrefixType<Flawless>();
else if (itemBeingReforged.CountsAsClass<SummonDamageClass>())
prefix = itemBeingReforged.IsWhip() ? PrefixID.Legendary : PrefixID.Ruthless;
else // Fallback case
prefix = PrefixID.Godly;
if (Main.rand.NextBool())
{
VoucherReforgeSystem.RollWon = true;
return prefix;
}
else
{
VoucherReforgeSystem.RollWon = false;
return ModContent.PrefixType<Horrible>();
}
}
}
public class AggressiveVoucher : VoucherItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Tools";
protected override int[] prefixChoices => new int[]
{
PrefixID.Jagged,
PrefixID.Angry,
PrefixID.Spiked,
PrefixID.Menacing,
PrefixID.Precise,
PrefixID.Lucky
};
public override void SetDefaults()
{
Item.width = 36;
Item.height = 20;
Item.rare = ItemRarityID.Green;
Item.value = CalamityGlobalItem.RarityGreenBuyPrice;
Item.maxStack = Item.CommonMaxStack;
}
public override bool CanApply(Player player, Item itemBeingReforged, bool isAccessory)
{
return isAccessory;
}
}
public class UnbreakableVoucher : VoucherItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Tools";
protected override int[] prefixChoices => new int[]
{
PrefixID.Hard,
PrefixID.Armored,
PrefixID.Guarding,
PrefixID.Warding,
ModContent.PrefixType<Invigorating>(),
ModContent.PrefixType<Dauntless>()
};
public override void SetDefaults()
{
Item.width = 36;
Item.height = 20;
Item.rare = ItemRarityID.Green;
Item.value = CalamityGlobalItem.RarityGreenBuyPrice;
Item.maxStack = Item.CommonMaxStack;
}
public override bool CanApply(Player player, Item itemBeingReforged, bool isAccessory)
{
return isAccessory;
}
}
public class HurriedVoucher : VoucherItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Tools";
protected override int[] prefixChoices => new int[]
{
PrefixID.Brisk,
PrefixID.Fleeting,
PrefixID.Hasty,
PrefixID.Quick
};
public override void SetDefaults()
{
Item.width = 36;
Item.height = 20;
Item.rare = ItemRarityID.Green;
Item.value = CalamityGlobalItem.RarityGreenBuyPrice;
Item.maxStack = Item.CommonMaxStack;
}
public override bool CanApply(Player player, Item itemBeingReforged, bool isAccessory)
{
return isAccessory;
}
}
public class OddVoucher : VoucherItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Tools";
protected override int[] prefixChoices => new int[]
{
PrefixID.Arcane,
PrefixID.Wild,
PrefixID.Rash,
PrefixID.Intrepid,
PrefixID.Violent,
ModContent.PrefixType<Silent>()
};
public override void SetDefaults()
{
Item.width = 36;
Item.height = 20;
Item.rare = ItemRarityID.Green;
Item.value = CalamityGlobalItem.RarityGreenBuyPrice;
Item.maxStack = Item.CommonMaxStack;
}
public override bool CanApply(Player player, Item itemBeingReforged, bool isAccessory)
{
return isAccessory;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 548 B

+1 -1
View File
@@ -120,7 +120,7 @@ namespace CalamityMod.Items.Weapons.Melee
}
}
Particle swipe = new CustomSpark(player.Center - shootDir * 5, shootDir.RotatedBy(0.4f * (dir * (swingCount % 2 == 0 ? 1 : -1))) * 2.5f, "CalamityMod/Particles/VerticalSmearLarge", false, (int)(14 / player.GetAttackSpeed(DamageClass.Melee)), 0.8f, player.Calamity().lightRGB, new Vector2(1f, 1f), true, false, 0, false, false);
Particle swipe = new CustomSpark(player.Center - shootDir * 5 * Item.scale, shootDir.RotatedBy(0.4f * (dir * (swingCount % 2 == 0 ? 1 : -1))) * 2.5f, "CalamityMod/Particles/VerticalSmearLarge", false, (int)(14 / player.GetAttackSpeed(DamageClass.Melee)), 0.8f * Item.scale, player.Calamity().lightRGB, new Vector2(1f, 1f), true, false, 0, false, false);
GeneralParticleHandler.SpawnParticle(swipe);
SoundEngine.PlaySound(SoundID.Item60, player.Center);
+51
View File
@@ -0,0 +1,51 @@
using CalamityMod.Projectiles.Ranged;
using CalamityMod.Rarities;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.DataStructures;
using Terraria.ID;
using Terraria.Localization;
using Terraria.ModLoader;
namespace CalamityMod.Items.Weapons.Ranged
{
public class OmniGun : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Weapons.Ranged";
public static int AmmoSavedPercent = 66;
public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(AmmoSavedPercent);
public override void SetDefaults()
{
Item.width = 118;
Item.height = 32;
Item.damage = 72;
Item.DamageType = DamageClass.Ranged;
Item.useAnimation = Item.useTime = 6;
Item.useStyle = ItemUseStyleID.Shoot;
Item.noMelee = true;
Item.knockBack = 5f;
Item.UseSound = null;
Item.noUseGraphic = true;
Item.channel = true;
Item.autoReuse = true;
Item.shoot = ModContent.ProjectileType<OmniGunHoldout>();
Item.shootSpeed = 16f;
Item.useAmmo = AmmoID.Bullet;
Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice;
Item.rare = ModContent.RarityType<PureGreen>();
}
public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0;
public override bool CanConsumeAmmo(Item ammo, Player player) => player.ownedProjectileCounts[Item.shoot] > 0 && Main.rand.Next(100) >= AmmoSavedPercent;
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
{
Projectile holdout = Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, ModContent.ProjectileType<OmniGunHoldout>(), damage, knockback, player.whoAmI);
// 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction
// We set the rotation to the direction to the mouse so the first frame doesn't appear bugged out.
holdout.velocity = (player.Calamity().mouseWorld - player.MountedCenter).SafeNormalize(Vector2.Zero);
return false;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 962 B

@@ -8,6 +8,11 @@ AlcoholPoisoning: {
Description: You drank too much and you are now dying
}
BaconOilBuff: {
DisplayName: Bacon Oil
Description: Oh gosh you spilled it all over yourself!
}
BloodyMaryBuff: {
DisplayName: Bloody Mary
Description: Increased enemy spawn rates, reduced piercing weapon effectiveness
@@ -737,6 +742,11 @@ SulphurskinBuff: {
Description: The sulphuric waters have a lesser effect on you
}
SwinesWrathBuff: {
DisplayName: Swine's Wrath
Description: Divine essence is rejecting your body
}
WeaponImbueBrimstone: {
DisplayName: Weapon Imbue: Brimstone
Description: Melee, Whip, and Rogue attacks ignite enemies with brimstone flames
@@ -1758,6 +1768,15 @@ ForbiddenStealthSummonTagBuff: {
Description: If you're seeing this, something went horribly wrong
}
Malnourished: {
DisplayName: Malnourished
Description:
'''
Minor reductions to all stats
Your liver feels stronger!
'''
}
SeaKingsAssurance: {
DisplayName: Sea King's Assurance
Description: If you're seeing this, something assuredly went horribly wrong
@@ -995,6 +995,15 @@ ThaumaticChair: {
Tooltip: One of Chloe's finest creations
}
TheMonument: {
DisplayName: The Monument
Tooltip:
'''
A monument celebrating the accomplishments of capitalism
Funded by the taxes of nearby Town NPCs, though they may not be too happy about that
'''
}
ThermalTorch: {
DisplayName: Thermal Torch
Tooltip:
@@ -157,6 +157,12 @@ SupremeManaPotion: {
Tooltip: ""
}
TheConcoction: {
DisplayName: The Concoction
EasterEggText: Removes 500 life
Tooltip: ""
}
ZenPotion: {
DisplayName: Zen Potion
Tooltip: Vastly decreases enemy spawn rate
@@ -167,6 +173,16 @@ ZergPotion: {
Tooltip: Vastly increases enemy spawn rate
}
BaconOil: {
DisplayName: Bacon Oil
Tooltip:
'''
Provides "good" mobility that scales with your damage stat boosts
Counts as 3 alcohols for {$Buffs.AlcoholPoisoning.DisplayName}
{$Common.AlcoholWarning}
'''
}
BloodyMary: {
DisplayName: Bloody Mary
Tooltip:
@@ -448,3 +464,16 @@ ShroomBowl: {
'He has been grounded'
'''
}
TheSandwich: {
DisplayName: The Sandwich
Tooltip:
'''
A sandwich made of the finest bread, cheese, and fish in the land!
Minor reductions to all stats
{0}% increased damage for every alcohol you are affected by
Allows you to drink 2 more alcohols than normal
Alcohol effects will not expire while under the effects of The Sandwich
'Might actually taste good if it was the only thing you'd ever eaten...'
'''
}
@@ -13,6 +13,18 @@ AerialHamaxe: {
Tooltip: ""
}
AggressiveVoucher: {
DisplayName: Aggressive Voucher
Tooltip:
'''
Favorite this item in your inventory to increase the likelihood of obtaining a desirable reforge
This effect only applies when reforging accessories
Targeted Reforge: {0}
Selectable Reforges: {1}
[c/aaaaaa:Shift-<right> in your inventory to cycle between targeted reforges]
'''
}
AntiCystOintment: {
DisplayName: Anti-Cyst Ointment
Tooltip:
@@ -141,6 +153,15 @@ BrokenWaterFilter: {
'''
}
CombatVoucher: {
DisplayName: Combat Voucher
Tooltip:
'''
Favorite this item in your inventory to increase the likelihood of obtaining a desirable reforge
This effect only applies when reforging weapons
'''
}
Cosmolight: {
DisplayName: Cosmolight
Tooltip:
@@ -205,6 +226,18 @@ GreatbayPickaxe: {
Tooltip: Can mine Demonite, Crimtane, Meteorite, Sea Prisms and Sea Prism Crystals
}
HurriedVoucher: {
DisplayName: Hurried Voucher
Tooltip:
'''
Favorite this item in your inventory to increase the likelihood of obtaining a desirable reforge
This effect only applies when reforging accessories
Targeted Reforge: {0}
Selectable Reforges: {1}
[c/aaaaaa:Shift-<right> in your inventory to cycle between targeted reforges]
'''
}
InfernaCutter: {
DisplayName: Inferna Cutter
Tooltip:
@@ -268,6 +301,18 @@ NormalityRelocator: {
'''
}
OddVoucher: {
DisplayName: Odd Voucher
Tooltip:
'''
Favorite this item in your inventory to increase the likelihood of obtaining a desirable reforge
This effect only applies when reforging accessories
Targeted Reforge: {0}
Selectable Reforges: {1}
[c/aaaaaa:Shift-<right> in your inventory to cycle between targeted reforges]
'''
}
ReefclawHamaxe: {
DisplayName: Reefclaw Hamaxe
Tooltip: ""
@@ -358,6 +403,17 @@ TectonicTruncator: {
Tooltip: ""
}
TheGift: {
DisplayName: The Gift
Tooltip:
'''
Drop this fine gift on one of your Town NPCs as a token of appreciation
May make them either love you or hate you, you'll never know until they open it!
Effect will last for 24 hours
[c/F54278:'There's no return policy, better be responsible']
'''
}
TorrentialTear: {
DisplayName: Torrential Tear
Tooltip:
@@ -368,6 +424,18 @@ TorrentialTear: {
'''
}
UnbreakableVoucher: {
DisplayName: Unbreakable Voucher
Tooltip:
'''
Favorite this item in your inventory to increase the likelihood of obtaining a desirable reforge
This effect only applies when reforging accessories
Targeted Reforge: {0}
Selectable Reforges: {1}
[c/aaaaaa:Shift-<right> in your inventory to cycle between targeted reforges]
'''
}
VoodooDemonVoodooDoll: {
DisplayName: Voodoo Demon Voodoo Doll
Tooltip:
@@ -840,6 +840,20 @@ Onyxia: {
'''
}
OmniGun: {
DisplayName: The Omnigun
Tooltip:
'''
A multipurpose weapon with several modes which are used in sequence
The first shot is a sniper round which gains damage over time and always critically strikes
The second shot is a burst of 10 standard bullets
The third shot is a devastating point blank spread
The fourth shot is a dangerous but powerful grenade which destroys everything, including you
'What kind of gun is it?'
'Yes'
'''
}
OpalStriker: {
DisplayName: Opal Striker
Tooltip:
@@ -352,6 +352,9 @@ Archmage: {
DislikeNPC: I dislike {NPCName}'s blatant disregard of magic. I cannot blame his functions, but he is quite ignorant.
LikeNPC_Princess: "{NPCName} has some very quaint spells. I'm quite impressed, for someone of her age."
Princess_LovesNPC: "{NPCName} makes the best ice cream I've ever tasted, it's so good!"
Monument: What a hideous statue! I always advocated for artistic community projects, but this... you really should have better quality control over what gets into your town!
GiftPositive: '''"How culture shaped magic" by Medomaion of Stratia?! I thought this book was lost centuries ago! How did you find it, and how did you...?! Well, no matter! This is the perfect gift, thank you!'''
GiftNegative: Could you please explain what your last gift was? You made an attempt on my life by trying to freeze me!? You better have a good explanation about how a snowstorm made its way inside that box!
}
}
@@ -432,6 +435,9 @@ Bandit: {
DislikeNPC: What a goody two shoes, {NPCName} is! I dislike her out of principle! …And because she has almost no material goods.
LikeNPC_Princess: I couldn't bear to steal anything from {NPCName}, she's so cute!
Princess_LovesNPC: "{NPCName} gifts me with nice exact replicas of other's things, I wonder how they do it!"
Monument: Yo, if your pockets ever feel lighter, that's not me, alright? You brought this on yourself buddy.
GiftPositive: Heeeey, my man! How's it goin'? I really 'preciate your gift, I have no idea how you got your hands on that kind of lockpicker's kit, but you'd catch me dead before I asked any questions!
GiftNegative: Hey man, what the hell is up with that gift?! I'm the most wanted in seven different city-states, do you got any idea how much a warrant on my name messes up my work?! You better do something to clean that mess before they have me walking to the gallows!
}
}
@@ -475,6 +481,9 @@ BrimstoneWitch: {
DislikeNPC: Such a racket! All {NPCName} does is make noise, day in and day out! I can't stand her!
LikeNPC_Princess: What a strangely pleasant kid {NPCName} is to be around.
Princess_LovesNPC: "{NPCName} is always lonely, it's why I want to hang out with her, no one should be left alone like that!"
Monument: That monument is ugly as sin.
GiftPositive: Hey, uh... thanks for the gift, really. I never thought you'd ever give me anything, for obvious reasons. But... thanks, really. It's lovely.
GiftNegative: What the hell was that gift? You know what, I don't even want to think about it. Screw you.
}
}
@@ -558,6 +567,9 @@ SeaKing: {
HateNPC: "{NPCName} is just a child, but his attitude towards marine life is unacceptable! Absolutely unacceptable!"
LikeNPC_Princess: That child, {NPCName}. She is an innocent soul. Let us hope the horrors of war never reach her.
Princess_LovesNPC: "{NPCName} always smiles when I'm nearby, I like being around him just for that!"
Monument: Take that horrible statue out of my sight! It is a disgrace to art, and to so unabashedly extort your people...! I expected much more of you.
GiftPositive: It was quite the delight to see that you gifted me custom-made shoes. Few people seem to realize that "walking" tends to leave my tail quite sore. Thank you, sincerely!
GiftNegative: A dead fish?! You gifted me a dead fish?! You managed to cross every line with that "gift"! Leave, I don't want to see you any longer.
}
}
@@ -2,13 +2,16 @@ Accessory: {
Silent.DisplayName: Silent
Invigorating.DisplayName: Invigorating
Dauntless.DisplayName: Dauntless
Friendly.DisplayName: Friendly
// New modifier effects (this is only positive)
StealthGenTooltip: +{0}% stealth generation
LifeRegenTooltip: +{0} HP/s life regen
MaxLifeBoostTooltip: +{0} max life
FriendlyTooltip: +{0} Minion
}
Weapon: {
Horrible.DisplayName: Horrible
Atrocious.DisplayName: Atrocious
Blunt.DisplayName: Blunt
Feathered.DisplayName: Feathered
@@ -267,3 +267,6 @@ WaterSpout.DisplayName: Spout
WildfireBloomFire.DisplayName: Wildfire Fire
WildfireBloomFlare.DisplayName: Wildfire Flare
WulfrumScrapBullet.DisplayName: High Speed Scrap
OmniSniperShot.DisplayName: Omni Sniper Shot
OmniGrenade.DisplayName: Omni Grenade
OmniShotgunShot.DisplayName: Omni Shotgun Shot
@@ -107,6 +107,7 @@ PauldronDash.DisplayName: Pauldron Dash
PauldronExplosion.DisplayName: Pauldron Explosion
PearlAuraShard.DisplayName: Prism Shard
PlaguePulse.DisplayName: Plague Pulse
Pigion.DisplayName: Pigion
PinkPearlFalling.DisplayName: Pink Pearl
PoisonousSeawater.DisplayName: Seawater
PolypSandBallFalling.DisplayName: Polyp Sand Ball
@@ -107,6 +107,13 @@ SulphurMeter: "{0} bathed too long in acidic waters."
SulphuricPoisoning1: "{0} was melted by the toxic waste."
SulphuricPoisoning2: "{0} ingested too many caustic chemicals."
SulphuricPoisoning3: "{0} couldn't handle the industrial backwash."
SwinesWrath1: "{0} was not ready to bask in divinity."
SwinesWrath2: "{0} now resides in Pigatory."
SwinesWrath3: "{0} was ground into a fine dust—a fibrous powder, by the wrath of Swine."
SwinesWrath4: "{0} should be careful what they wish for."
SwinesWrath5: "{0} had the last of their health swinedled out from under their nose."
SwinesWrath6: "{0} did not read the label on The Concoction."
SwinesWrath7: "{0}'s life was hogged to the bone."
ThornBlossom: "{0} was violently pricked by a flower."
UltracosmicMaelstrom1: "{0} was sublimated by [ceffect/dog:Ultracosmic Maelstrom]."
UltracosmicMaelstrom2: "{0} got cut down to size by [ceffect/dog:Ultracosmic Maelstrom]."
@@ -409,3 +409,169 @@ WitchDoctorChat: {
}
WizardChat.Hardmode: Space just got way too close for comfort.
TownNPCMood: {
// Default dialogues if, for example, a modded NPC does not have a dialogue line registered
DefaultMonument: I hate The Monument.
DefaultGiftPositive: I love The Gift.
DefaultGiftNegative: I hate The Gift.
Angler: {
Monument: That monument is sooooooo ugly! I think it needs some chopped fish thrown allllll over it!
GiftPositive: Hey! I don't know how you got a hold of all that squishy gross stuff in that gift, but it might be the best prank material I've ever seen! He he he!
GiftNegative: Are you stupid?! I would NEVER fall for such a laaaaame gift prank like that! You better catch a lot of awesome fish to make up!
}
ArmsDealer: {
Monument: Was anyone really itchin' to have a big ol' statue in my firing ground? Because I wasn't!
GiftPositive: That new ammo belt was just the gift I've been lookin' for, buddy! Let's test it out together later!
GiftNegative: Do you know what you're doin' by pullin' a bomb in a box prank on me? I can kill you in over seven hundred ways, and that's just with my guns!
}
BestiaryGirl: {
Monument: This monument is like, totally giving me the creeps, bro!
MonumentTransformed: Rrr... BIG ROCK. BAD! NO!!
GiftPositive: Hey!! You're like, suuuper rad and all for gifting me that cute little bunny! Now umm... I need to think of a name for it!
GiftPositiveTransformed: LOVE. GOOD GIFT. CUTE!
GiftNegative: Eek!! Did you really, like, gift me a dead bunny? I really totally hate when people think that's funny!
GiftNegativeTransformed: Grahh!! HATE. CRUEL. GIFT. WATCH YOURSELF!!
}
Clothier: {
Monument: I think I am becoming too old to understand this... "modern art".
GiftPositive: There was a simple bell in that gift, but its ring was simply extraordinary. Perhaps this means I truly believe...
GiftNegative: Can we get serious now? No one warned me! No one said "You are about to receive the most wretched gift in history". No one could train for that!
}
Cyborg: {
Monument: Analysis of nearby monument: Provides zero positive qualities to all lifeforms nearby.
GiftPositive: Gift content scan revealed extremely pure silicon for use in upgraded processors. It appears I appreciate that.
GiftNegative: Gift content scan revealed attempt to trigger malfunction in my systems. Translation: I hate this.
}
DD2Bartender: {
Monument: Had a lot of customers lately complaining about that big monument outside. I gotta say, they're right.
GiftPositive: The pint in that gift of yours reminded me of what I serve back in Etheria! Ahh, I really miss it... but that was quite thoughtful of you.
GiftNegative: What vile concoction of a drink was that? One sip of it and I had to wipe down the bar again! Were you conspiring with the Kobolds?!
}
Demolitionist: {
Monument: You know, there is a use for that monument - it'll make for a good demolition test for my biggest dynamite yet!
GiftPositive: Hey, is that a shipment of ale? That's the only thing us dwarves love more than blowing things up! You're da' bomb!
GiftNegative: ARGH! You see yourself as a joker, giving me a water gun? That's an affront to my craft in two ways! Now I'm itching to turn you into a firework!
}
Dryad: {
Monument: I don't like that monument. I can sense its ugly stain on nature.
GiftPositive: I have no need for material goods as a nature spirit... but I can at least sense your gift was given out of genuine compassion.
GiftNegative: It would be unwise for you to tread near me after "gifting" me an oozing mass of corruption. I question whether you are committed to purifying the world...
}
DyeTrader: {
Monument: Oh no no, that dull monument cannot be. Its mere presence is sucking the color and vibrancy out of life itself!
GiftPositive: What an extraordinary batch of rare flowers there was in that gift, friend! I must thank you for your help, browse my colors at reduced coin in exchange!
GiftNegative: You think you can pull such a drab gift prank on me, I don't think so! I want no business of yours after that attack on my precious palettes!
}
GoblinTinkerer: {
Monument: You know, even the barbaric goblin camp I was once part of never considered the concept of a useless monument that just funnels funds.
GiftPositive: What a fascinating welding-cutting combo tool in that gift! I would love to reverse-engineer and tinker it for my own research.
GiftNegative: When I reached into your unassuming gift, my hands were lacerated by a handful of spiky balls! I'm afraid I will have to hike my prices to cover the medical costs.
}
Golfer: {
Monument: This must be mockery. I don't want a monument of greed erected so close to my home.
GiftPositive: I don't know where you found that wedge, but it's been a real lifesaver in the sand. Thanks for helping my game!
GiftNegative: Tell me something. Why did the shoddy driver in that gift splinter all over the place after one swing? Golf is a delicate sport, and this really hurts!
}
Guide: {
Monument: I quite dislike that monument you have over there. How could one have such little humbleness!
GiftPositive: A thoughtful gift in this world is always a welcome sight. I greatly appreciate it!
GiftNegative: Apologies, I'm currently in shock over your decision to gift me my own voodoo doll. If only I could curse you!
}
Mechanic: {
Monument: Any more money I have to fork over for this monument and I'm going to have to start charging an electric bill! I would hate to do that.
GiftPositive: Thanks to your gift of signal extenders, I can connect more of this world than ever! That extra burst of motivation is just what I need to finish wiring up this town!
GiftNegative: What compelled you to be so reckless as to gift me an EMP device? Everyone is yelling at me like it's MY fault! Well, now it will be YOUR problem to pay it off when you buy all your wire.
}
Merchant: {
Monument: That awful monument is driving away my business!
GiftPositive: What a lovely gift of exotic wares you gave me, friend! Please peruse my shop at clearance rates.
GiftNegative: Why offer a "gift" of rubbish Angel Statues? I tire of your jokes, so if you want business, it'll be extra.
}
Nurse: {
Monument: Eww, who would put such an ugly rock in this town?
GiftPositive: Hey! Thanks for that gift from earlier. You ever need face reconstruction, you know who to call.
GiftNegative: YOU, I hope you understand that gifting the ONLY DOCTOR HERE some snake oil is how to make me never want to treat you!
}
Painter: {
Monument: That statue certainly is thought provoking. I'm awestruck by how bleak, dull, and hopeless it makes its environs feel.
GiftPositive: How did ya know exactly the paint color I have been looking for? My newest mural greatly appreciates dat!
GiftNegative: You must be sick and cruel, because that water bomb prank of yours washed all over my latest work! Aye, you oughta be covered in red, and not paint!
}
PartyGirl: {
Monument: Yeeesh, we're gonna have an ugly statue of big money around? That like, totally kills the party mood around here.
GiftPositive: PARTY GIFTS? FOR ME? Oh just you wait, I'm gonna throw the BIGGEST party this town has ever seen, forever and always!
GiftNegative: I knew you were trouble when you walked in that suspicious looking box! It's too late now to say sorry!
}
Pirate: {
Monument: Arr, ye landlubbers have filthy tastes in decoration! That statue be askin' to be washed away!
GiftPositive: HAR HAR! Ye bring me the best bottle o' rum I ever taste in me life! Nothin' more for me to say, sea dog!
GiftNegative: Arr, ye scallywag! Ye be askin' to be sent to Davy Jones' locker with that foul concoction ye gave me earlier!
}
Princess: {
Monument: Um... my people have been frequently complaining about that monument. May I request it be taken down, please?
GiftPositive: I do appreciate your thoughtfulness with this gift, my loyal subject! It's always so wonderful to see the many fantastic things inside one!
GiftNegative: Um... may I ask what you were implying with the contents of that gift? Perhaps I shouldn't worry so, but I do find myself concerned...
}
SantaClaus: {
Monument: Is this what the holiday season means to people now? Naughty, you are!
GiftPositive: Ho ho ho! What an unusual feeling for someone to be gifting me something at this time of year! You'd be great taking up the mantle!
GiftNegative: What a horrible gift you thought you could give me. You will get no presents this year!
}
Steampunker: {
Monument: Oi, that bloody big rock you got outside is a monumental mistake! Decommission it this very instant!
GiftPositive: Ahh, what a deeply inspiring jetpack engine! The breakthroughs in steampunk technology from this will be exquisite! Consider this sale a return of generosity.
GiftNegative: When I opened your gift, a sudden blast of cold air condensed all of my steam! Were it not for my backup systems, my machines would be unusable! You bloody better watch yourself!
}
Stylist: {
Monument: That statue has been the talk of the town! ...As in, everyone cannot stand the gross thing.
GiftPositive: Thanks hun, that gift of new exotic hair dyes was just what I was missin' in my life! I know just who else could use some of this style too!
GiftNegative: What were you pullin' on me with a fireball in a gift box? That could've singed me bald, and I could never be a stylist without hair! NEVER!
}
TaxCollector: {
Monument: Bah! You shouldn't be seeing this message, plebian!
GiftPositive: What a steal, getting a gift full of the only thing worth a damn in this world -- money!
GiftNegative: Bah! You think you're a jester with that lump of coal? Get out of my sight!
}
Truffle: {
Monument: Your kind have very strange decorative tastes, such as that monument nearby.
GiftPositive: I love them, my new gifted shroomble companions. It's great to see more of our kind around here!
GiftNegative: A little pig jumped out of that gift you gave me earlier, and tried to eat my face! Perhaps I can't trust you either.
}
WitchDoctor: {
Monument: A vile disruption of nature, that monument is. My soul is wracked with contempt for this unsightly edifice.
GiftPositive: A kind offering to my people, this gift is. May you be blessed by kindred spirits in trying times.
GiftNegative: Sacrilegious defilement against my arts - I speak of your false gift. May your woes be many, and your days few.
}
Wizard: {
Monument: If I was your age, I would've blasted that loathsome monument with a giant fireball! Alas, I can't recall the spell.
GiftPositive: An authentic tome of wisdom from the Archmage himself? What a prized possession!! ...uh, who is the Archmage again?
GiftNegative: Do you take me for a fool to place a hex on that gift? How about I place a hex on your wallet, and all of your money disappears when you buy from me!!
}
}
+61
View File
@@ -22,6 +22,7 @@ using CalamityMod.Items.Weapons.Rogue;
using CalamityMod.NPCs.TownNPCs;
using CalamityMod.Projectiles.Rogue;
using CalamityMod.Systems.Collections;
using CalamityMod.Tiles.Furniture;
using CalamityMod.World;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
@@ -31,6 +32,7 @@ using Terraria.GameContent;
using Terraria.ID;
using Terraria.Localization;
using Terraria.ModLoader;
using Terraria.WorldBuilding;
using static Terraria.ModLoader.ModContent;
namespace CalamityMod.NPCs
@@ -70,6 +72,18 @@ namespace CalamityMod.NPCs
public int shopAlertAnimTimer = 0;
/// <summary> <inheritdoc cref="shopAlertAnimTimer"/> </summary>
public int shopAlertAnimFrame = 0;
/// <summary>
/// Controls how this Town NPC is being affected by The Gift.<br/>
/// If true, happiness is overriden with an extremely high value. If false, happiness is overriden with an extremely low value. If null, uses vanilla happiness.
/// </summary>
public bool? TheGiftStatus = null;
/// <summary>
/// Timer to track when to reset the effects of The Gift, which occurs after 24 hours.<br/>
/// When The Gift is applied, this is set to 0 then starts counting up.
/// </summary>
public double TheGiftReset = -1.0;
public bool AffectedByTheMonument = false;
public override bool InstancePerEntity => true;
@@ -85,6 +99,9 @@ namespace CalamityMod.NPCs
myClone.setNewName = setNewName;
myClone.shopAlertAnimTimer = shopAlertAnimTimer;
myClone.shopAlertAnimFrame = shopAlertAnimFrame;
myClone.TheGiftStatus = TheGiftStatus;
myClone.TheGiftReset = TheGiftReset;
myClone.AffectedByTheMonument = AffectedByTheMonument;
return myClone;
}
@@ -805,8 +822,52 @@ namespace CalamityMod.NPCs
public override bool PreAI(NPC npc)
{
SetPatreonTownNPCName(npc, Mod);
// Reset The Gift after 24 hours
if (TheGiftReset >= 0.0)
{
TheGiftReset += Main.dayRate;
if (TheGiftReset >= Main.dayLength + Main.nightLength)
{
TheGiftReset = -1.0;
TheGiftStatus = null;
}
}
// Search for The Monument, for the purposes of assigning higher taxes
AffectedByTheMonument = false;
SearchForTheMonument(npc);
return true;
}
public bool SearchForTheMonument(NPC npc)
{
Point tileCenter = npc.Center.ToTileCoordinates();
Rectangle searchArea = new((int)(tileCenter.X - Main.buffScanAreaWidth / 2), (int)(tileCenter.Y - Main.buffScanAreaHeight / 2), Main.buffScanAreaWidth, Main.buffScanAreaHeight);
searchArea = WorldUtils.ClampToWorld(searchArea);
for (int i = searchArea.Left; i < searchArea.Right; i++)
{
for (int j = searchArea.Top; j < searchArea.Bottom; j++)
{
if (!searchArea.Contains(i, j))
continue;
Tile tile = Main.tile[i, j];
if (tile == null)
continue;
if (!tile.HasTile)
continue;
if (tile.TileType == TileType<TheMonumentTile>())
{
AffectedByTheMonument = true;
return true;
}
}
}
return false;
}
#endregion
#region PreDraw
+2 -10
View File
@@ -12,11 +12,8 @@ namespace CalamityMod.Particles
public override bool UseCustomDraw => true;
public override bool SetLifetime => true;
public Player Owner;
public Color StartColor;
public Color EndColor;
public Vector2 OverridePosition;
public float Opacity;
public HealingPlus(Vector2 position, float scale, Vector2 velocity, Color colorStart, Color colorEnd, int lifetime)
{
@@ -34,20 +31,15 @@ namespace CalamityMod.Particles
{
Color = Color.Lerp(StartColor, EndColor, LifetimeCompletion);
Lighting.AddLight(Position, Color.ToVector3() * 0.2f);
Opacity -= 0.5f;
}
public override void CustomDraw(SpriteBatch spriteBatch)
{
Texture2D tex = ModContent.Request<Texture2D>(Texture).Value;
Vector2 Size = new Vector2(Scale);
Vector2 origin = new Vector2(tex.Width, tex.Height) * 0.5f;
Vector2 origin = new Vector2(tex.Width, tex.Height);
Vector2 PositionAdjust = new Vector2(-16, -40);
spriteBatch.Draw(tex, Position - Main.screenPosition - PositionAdjust, null, Color, Rotation, origin, Size, SpriteEffects.None, 0);
spriteBatch.Draw(tex, Position - Main.screenPosition, null, Color, Rotation, origin, Size, SpriteEffects.None, 0);
}
}
+29
View File
@@ -61,4 +61,33 @@ namespace CalamityMod.Prefixes
return 20;
}
}
public class Friendly : ModPrefix, ILocalizedModType
{
public new string LocalizationCategory => "Prefixes.Accessory";
public override PrefixCategory Category => PrefixCategory.Accessory;
public override void ApplyAccessoryEffects(Player player)
{
// give Minion
player.Calamity().friendlyMinions++;
}
public override void ModifyValue(ref float valueMult)
{
valueMult = 2.5f;
}
public override float RollChance(Item item) => 0; // Is manually applied by an item, can't be rerolled normally
public override bool CanRoll(Item item)
{
return true;
}
public LocalizedText FriendlyTooltip => CalamityUtils.GetText($"{LocalizationCategory}.FriendlyTooltip");
public override IEnumerable<TooltipLine> GetTooltipLines(Item item)
{
yield return new TooltipLine(Mod, "CalamityMod:PrefixFriendly", FriendlyTooltip.Format(1))
{
IsModifier = true
};
}
}
}
+40
View File
@@ -0,0 +1,40 @@
using System.Collections.Generic;
using CalamityMod.Items;
using Terraria;
using Terraria.Localization;
using Terraria.ModLoader;
namespace CalamityMod.Prefixes
{
public class Horrible : HorribleWeaponPrefix
{
public override float damageMult => 0.50f;
public override float sizeMult => 3f;
}
public abstract class HorribleWeaponPrefix : ModPrefix, ILocalizedModType
{
public new string LocalizationCategory => "Prefixes.Weapon";
// Stats
public virtual float damageMult => 1f;
public virtual float sizeMult => 1f;
public override PrefixCategory Category => PrefixCategory.AnyWeapon;
public override float RollChance(Item item) => 0; // Is manually applied by an item, can't be rerolled normally
public override bool CanRoll(Item item)
{
return item.DamageType != null && item.DamageType != DamageClass.Default;
}
// Applying normal weapon stats
public override void SetStats(ref float damageMult, ref float knockbackMult, ref float useTimeMult, ref float scaleMult, ref float shootSpeedMult, ref float manaMult, ref int critBonus)
{
damageMult = this.damageMult;
scaleMult = this.sizeMult;
}
public override void ModifyValue(ref float valueMult)
{
valueMult = 2.5f;
}
}
}
+9
View File
@@ -1,5 +1,6 @@
using System;
using System.Linq;
using CalamityMod.Items.Tools;
using CalamityMod.Items.Weapons.Melee;
using CalamityMod.NPCs.TownNPCs;
using CalamityMod.Packets;
@@ -29,6 +30,14 @@ namespace CalamityMod.Prefixes
public override int ChoosePrefix(Item item, UnifiedRandom rand)
{
// Voucher override
if (VoucherReforgeSystem.ForcedPrefix != -1)
{
int forced = VoucherReforgeSystem.ForcedPrefix;
VoucherReforgeSystem.ForcedPrefix = -1;
return forced;
}
if (storedPrefix == -1 && item.CountsAsClass<RogueDamageClass>() && (item.maxStack == 1 || item.AllowReforgeForStackableItem))
{
// Crafting (or first reforge of) a rogue weapon has a 75% chance for a random modifier, this check is done by vanilla
+107
View File
@@ -0,0 +1,107 @@
using System.Runtime.CompilerServices;
using CalamityMod.Dusts;
using CalamityMod.Items.Weapons.Ranged;
using CalamityMod.Particles;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Ranged
{
public class OmniGrenade : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Ranged";
public override void SetDefaults()
{
Projectile.width = 20;
Projectile.height = 20;
Projectile.friendly = true;
Projectile.hostile = true;
Projectile.DamageType = DamageClass.Ranged;
Projectile.timeLeft = 1800;
Projectile.ignoreWater = true;
Projectile.tileCollide = true;
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = -1;
}
public override void AI()
{
if (Projectile.velocity.Y < 25f)
Projectile.velocity.Y += 0.3f;
int fire = Dust.NewDust(Projectile.position, Projectile.width, (int)(Projectile.height * 0.1f), DustID.Torch, 0f, 0f, 100, default);
Main.dust[fire].velocity *= 3f;
if (Main.rand.NextBool())
{
Main.dust[fire].scale = 0.3f;
Main.dust[fire].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f;
}
Projectile.rotation = Projectile.velocity.ToRotation();
}
public override void OnKill(int timeLeft)
{
SoundEngine.PlaySound(SoundID.Item62 with { Volume = 7f }, Projectile.Center);
Projectile.ExpandHitboxBy(250);
Projectile.Damage();
Player Owner = Main.player[Projectile.owner];
Owner.SetScreenshake(3f);
for (int i = 0; i < 2; i++)
{
Particle center = new CustomSpark(Projectile.Center, Vector2.Zero, "CalamityMod/Particles/BloomCircle", false, 11, 0.95f, Color.OrangeRed * 0.8f, new Vector2(1f, 1f), true, true, glowOpacity: 0.9f);
GeneralParticleHandler.SpawnParticle(center);
}
Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, Color.OrangeRed * 0.8f, "CalamityMod/Particles/ShatteredExplosion", Vector2.One, Main.rand.NextFloat(-12, 12), 0f, 0.15f, 21, true);
GeneralParticleHandler.SpawnParticle(blastRing);
Particle blastRing2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.OrangeRed * 0.8f, "CalamityMod/Particles/PlasmaExplosion", Vector2.One, Main.rand.NextFloat(-10, 10), 0f, 0.07f, 21);
GeneralParticleHandler.SpawnParticle(blastRing2);
Particle blastRing3 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Red * 0.8f, "CalamityMod/Particles/ShatteredExplosion", Vector2.One, Main.rand.NextFloat(-12, 12), 0f, 0.1f, 21, true);
GeneralParticleHandler.SpawnParticle(blastRing3);
Particle pulse = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/RoarPulse", new Vector2(1f, 1f), 0, 0.01f, 0.4f, 15, true);
GeneralParticleHandler.SpawnParticle(pulse);
Particle pulse2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/SmallBloomRing", new Vector2(1f, 1f), 0, 0.01f, 4f, 15, true, 0.8f);
GeneralParticleHandler.SpawnParticle(pulse2);
for (int i = 0; i < 12; i++)
{
Vector2 sparkVelocity = Vector2.UnitX.RotatedByRandom(MathHelper.TwoPi) * MathHelper.Lerp(10, 30, Main.rand.NextFloat());
SparkParticle spark = new SparkParticle(Projectile.Center, sparkVelocity, false, Main.rand.Next(10, 15), Main.rand.NextFloat(1f, 1.2f), Main.rand.NextBool() ? Color.OrangeRed : Color.Red);
GeneralParticleHandler.SpawnParticle(spark);
}
for (int i = 1; i < 21; i++)
{
Vector2 velocity = Main.rand.NextVector2Unit() * Main.rand.NextFloat(9f, 14f);
Dust spark = Dust.NewDustPerfect(Projectile.Center, 278, velocity);
spark.color = Main.rand.NextBool() ? Color.OrangeRed : Color.Gold;
}
for (int j = 0; j < 25; j++)
{
int dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 3f);
Main.dust[dust2].noGravity = true;
Main.dust[dust2].velocity *= 5f;
dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 2f);
Main.dust[dust2].velocity *= 2f;
}
}
public override void ModifyHitPlayer(Player target, ref Player.HurtModifiers modifiers)
{
modifiers.SourceDamage *= 0f;
if (Main.masterMode) modifiers.SourceDamage.Flat += 200f;
else if (Main.expertMode) modifiers.SourceDamage.Flat += 150f;
else modifiers.SourceDamage.Flat += 100f;
}
public override bool PreDraw(ref Color lightColor)
{
Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value;
Vector2 position = Projectile.Center - Main.screenPosition;
Vector2 origin = texture.Size() * 0.5f;
Main.EntitySpriteDraw(texture, position, null, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, Projectile.scale, SpriteEffects.None);
return false;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 259 B

+230
View File
@@ -0,0 +1,230 @@
using CalamityMod.Items.Weapons.Ranged;
using CalamityMod.Particles;
using CalamityMod.Projectiles.BaseProjectiles;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Content;
using Terraria;
using Terraria.Audio;
using Terraria.GameContent;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Ranged
{
public class OmniGunHoldout : BaseGunHoldoutProjectile
{
public static Asset<Texture2D> MuzzleFlash;
public override int AssociatedItemID => ModContent.ItemType<OmniGun>();
public override float MaxOffsetLengthFromArm => 24f;
public override float OffsetXUpwards => -5f;
public override float BaseOffsetY => -1f;
public override float OffsetYDownwards => 5f;
public override Vector2 GunTipPosition => Projectile.Center + (Projectile.velocity * 51);
public override float RecoilResolveSpeed => CurrentRecoilResolveSpeed;
public float CurrentRecoilResolveSpeed = 0;
public int Time = 0;
public int shotCounter = 0;
public int framesBetweenShots = 0;
private float flashVariant;
public override void Load()
{
MuzzleFlash = ModContent.Request<Texture2D>("CalamityMod/Projectiles/Ranged/M1GarandMuzzleFlash", AssetRequestMode.ImmediateLoad);
}
public override void KillHoldoutLogic()
{
//If the player is dead, kill the holdout.
if (Owner.CantUseHoldout() || HeldItem.type != AssociatedItemID)
Projectile.Kill();
}
public override void HoldoutAI()
{
//Pause to give the effect of reloading
if (Time == 20)
{
Player Owner = Main.player[Projectile.owner];
SoundEngine.PlaySound(SoundID.Item149, Projectile.Center);
}
if (Time >= 70)
{
if (framesBetweenShots == 0)
{
//Here we detect which ammo the bullets will use
Owner.PickAmmo(Owner.HeldItem, out int bulletAMMO, out float SpeedNoUse, out int bulletDamage, out float kBackNoUse, out _);
#region Sniper Shot
if (shotCounter == 0)
{
Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * 19;
#region Visuals and Sounds
SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Item/GunShotBig") with { Volume = 1f, Pitch = -0.1f }, Projectile.Center);
SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Item/GunShotHeavy") with { Volume = 0.35f, Pitch = -0.15f }, Projectile.Center);
if (Main.netMode != NetmodeID.Server)
{
string goreType = "OmniSniperCasing";
Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.Center + (-Projectile.velocity * 6), -Projectile.velocity * 4f, Mod.Find<ModGore>(goreType).Type);
}
for (int i = 0; i <= 4; i++)
{
Dust dust = Dust.NewDustPerfect(GunTipPosition, Main.rand.NextBool(3) ? 303 : 244, (shootVelocity * Main.rand.NextFloat(0.2f, 1.1f)).RotatedByRandom(0.4f));
dust.noGravity = true;
dust.scale = Main.rand.NextFloat(0.8f, 1.4f);
}
// "Smoke" ring
Particle shootPulse = new DirectionalPulseRing(GunTipPosition, Projectile.velocity.SafeNormalize(Vector2.UnitY) * 4f, Color.Gray * 0.5f, new Vector2(0.5f, 1f), Projectile.velocity.ToRotation(), 0.1f, 0.475f, 18);
GeneralParticleHandler.SpawnParticle(shootPulse);
#endregion
OffsetLengthFromArm -= 20f;
CurrentRecoilResolveSpeed = 0.14f;
Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity.RotatedByRandom(MathHelper.ToRadians(1.5f)), ModContent.ProjectileType<OmniSniperShot>(), (int)(Projectile.damage * 6f), Projectile.knockBack, Projectile.owner);
shotCounter++;
framesBetweenShots = 40;
}
#endregion
#region AR Burst
if (shotCounter >= 1 && shotCounter <= 10 && framesBetweenShots == 0)
{
Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * 19;
#region Visuals and Sounds
SoundStyle fire = new("CalamityMod/Sounds/Item/GunShotSmallAlt");
SoundEngine.PlaySound(fire with { Volume = 0.7f, Pitch = 0.1f}, Projectile.Center);
if (Main.netMode != NetmodeID.Server)
{
string goreType = "OmniARCasing";
Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.Center + (-Projectile.velocity * 9), Projectile.velocity.RotatedBy(2f * -Owner.direction) * Main.rand.NextFloat(0.6f, 0.7f), Mod.Find<ModGore>(goreType).Type);
}
// Direct smoke
for (int i = 0; i < 2; i++)
{
Particle smoke = new HeavySmokeParticle(GunTipPosition, Projectile.velocity.SafeNormalize(Vector2.UnitY) * 7f * Main.rand.NextFloat(0.4f, 1.5f), Color.Gray, Main.rand.Next(30, 50), Main.rand.NextFloat(0.22f, 0.44f), 0.35f, Main.rand.NextFloat(-0.2f, 0.2f), Main.rand.NextBool(), required: true);
GeneralParticleHandler.SpawnParticle(smoke);
}
for (int i = 0; i <= 4; i++)
{
Dust dust = Dust.NewDustPerfect(GunTipPosition, Main.rand.NextBool(3) ? 303 : 244, (shootVelocity * Main.rand.NextFloat(0.2f, 1.1f)).RotatedByRandom(0.4f));
dust.noGravity = true;
dust.scale = Main.rand.NextFloat(0.8f, 1.4f);
}
#endregion
framesBetweenShots = 8;
OffsetLengthFromArm -= 3f;
CurrentRecoilResolveSpeed = 0.3f;
Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity.RotatedByRandom(MathHelper.ToRadians(4f)), bulletAMMO, Projectile.damage, Projectile.knockBack, Projectile.owner);
shotCounter++;
if (shotCounter > 10)
framesBetweenShots = 30;
}
#endregion
#region Shotgun Blast
if (shotCounter == 11 && framesBetweenShots == 0)
{
Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * 19;
#region Visuals and Sounds
SoundStyle FireSound = new("CalamityMod/Sounds/Item/Hydra");
SoundEngine.PlaySound(FireSound with { Volume = 0.7f }, Projectile.Center);
if (Main.netMode != NetmodeID.Server)
{
string goreType = "OmniShotgunShell";
Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.Center + (-Projectile.velocity * 9), Projectile.velocity.RotatedBy(2f * -Owner.direction) * Main.rand.NextFloat(0.6f, 0.7f), Mod.Find<ModGore>(goreType).Type);
}
for (int i = 0; i <= 4; i++)
{
Dust dust = Dust.NewDustPerfect(GunTipPosition, Main.rand.NextBool(3) ? 303 : 244, (shootVelocity * Main.rand.NextFloat(0.2f, 1.1f)).RotatedByRandom(0.4f));
dust.noGravity = true;
dust.scale = Main.rand.NextFloat(0.8f, 1.4f);
}
// Direct smoke
for (int i = 0; i < 16; i++)
{
Particle smoke = new HeavySmokeParticle(GunTipPosition, Projectile.velocity.SafeNormalize(Vector2.UnitY) * 7f * Main.rand.NextFloat(0.4f, 1.5f), Color.Gray, Main.rand.Next(30, 50), Main.rand.NextFloat(0.22f, 0.44f), 0.35f, Main.rand.NextFloat(-0.2f, 0.2f), Main.rand.NextBool(), required: true);
GeneralParticleHandler.SpawnParticle(smoke);
}
// "Smoke" ring
Particle shootPulse = new DirectionalPulseRing(GunTipPosition, Projectile.velocity.SafeNormalize(Vector2.UnitY) * 4f, Color.Gray * 0.5f, new Vector2(0.5f, 1f), Projectile.velocity.ToRotation(), 0.1f, 0.475f, 18);
GeneralParticleHandler.SpawnParticle(shootPulse);
#endregion
framesBetweenShots = 8;
OffsetLengthFromArm -= 20f;
CurrentRecoilResolveSpeed = 0.12f;
// Propel the owner backward
Owner.velocity += -Projectile.velocity * 7f;
for (int i = 0; i < 8; i++)
Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity.RotatedByRandom(MathHelper.ToRadians(15f)) * Main.rand.NextFloat(0.5f, 1.5f), ModContent.ProjectileType<OmniShotgunShot>(), (int)(Projectile.damage * 2.6f), Projectile.knockBack, Projectile.owner);
shotCounter++;
if (shotCounter > 11)
framesBetweenShots = 30;
}
#endregion
#region Grenade
if (shotCounter == 12 && framesBetweenShots == 0)
{
Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * 30;
#region Visuals and Sounds
SoundStyle fire = new("CalamityMod/Sounds/Item/LauncherHeavyShot");
SoundEngine.PlaySound(fire with { Volume = 0.8f, PitchVariance = 0.1f }, Projectile.Center);
if (Main.netMode != NetmodeID.Server)
{
string goreType = "OmniGrenadeShell";
Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.Center + (-Projectile.velocity * 6), -Projectile.velocity * 4f, Mod.Find<ModGore>(goreType).Type);
}
for (int i = 0; i <= 13; i++)
{
Dust dust = Dust.NewDustPerfect(GunTipPosition, 303, shootVelocity.RotatedByRandom(0.5f) * Main.rand.NextFloat(0.2f, 0.4f), 80, default, Main.rand.NextFloat(0.4f, 1.3f));
dust.noGravity = false;
dust.color = Color.White;
Dust dust2 = Dust.NewDustPerfect(GunTipPosition, 278, shootVelocity.RotatedByRandom(0.5f) * Main.rand.NextFloat(0.1f, 0.5f));
dust2.noGravity = true;
dust2.scale = Main.rand.NextFloat(0.52f, 0.72f);
dust2.color = Color.Lerp(Color.Orange, Color.Gold, Main.rand.NextFloat(0f, 1f));
}
;
#endregion
OffsetLengthFromArm -= 24f;
CurrentRecoilResolveSpeed = 0.15f;
Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity, ModContent.ProjectileType<OmniGrenade>(), (int)(Projectile.damage * 9f), Projectile.knockBack, Projectile.owner);
Time = 0;
shotCounter = 0;
}
#endregion
}
if (framesBetweenShots > 0)
framesBetweenShots--;
}
Time++;
}
public override bool PreDraw(ref Color lightColor)
{
if (Time < 2)
return false;
Texture2D texture = TextureAssets.Projectile[Type].Value;
Vector2 drawPosition = Projectile.Center - Main.screenPosition;
float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f);
float scale = Projectile.scale * Owner.gravDir;
Vector2 rotationPoint = texture.Size() * 0.5f;
SpriteEffects flipSprite = (Projectile.spriteDirection * Owner.gravDir == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None;
// Flash
if (Time == 70 || shotCounter == 11 && framesBetweenShots == 0)
{
Texture2D flashTex = MuzzleFlash.Value;
int flashFrameY = (int)flashVariant;
Vector2 flashPos = GunTipPosition + Vector2.UnitX.RotatedBy(Projectile.rotation) * MuzzleFlash.Width() * 0.4f - Main.screenPosition;
Rectangle flashFrame = flashTex.Frame(verticalFrames: 3, frameY: flashFrameY);
Main.EntitySpriteDraw(flashTex, flashPos, flashFrame, Color.White, drawRotation, flashFrame.Size() * 0.5f, scale * 0.8f, flipSprite);
}
Main.EntitySpriteDraw(texture, drawPosition, null, Projectile.GetAlpha(lightColor), drawRotation, rotationPoint, scale, flipSprite);
return false;
}
}
}
+63
View File
@@ -0,0 +1,63 @@
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Ranged
{
public class OmniShotgunShot : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Ranged";
public override void SetStaticDefaults()
{
ProjectileID.Sets.TrailCacheLength[Type] = 4;
ProjectileID.Sets.TrailingMode[Type] = 0;
}
public override void SetDefaults()
{
Projectile.width = 4;
Projectile.height = 4;
Projectile.light = 0.5f;
Projectile.alpha = 255;
Projectile.DamageType = DamageClass.Ranged;
Projectile.friendly = true;
Projectile.ignoreWater = true;
Projectile.aiStyle = ProjAIStyleID.Arrow;
AIType = ProjectileID.BulletHighVelocity;
Projectile.extraUpdates = 3;
Projectile.penetrate = 1;
Projectile.timeLeft = 15;
}
public override bool PreDraw(ref Color lightColor)
{
CalamityUtils.DrawAfterimagesFromEdge(Projectile, 0, lightColor);
return false;
}
public override void OnKill(int timeLeft)
{
SoundEngine.PlaySound(SoundID.Item14, Projectile.Center);
Projectile.ExpandHitboxBy(32);
for (int d = 0; d < 2; d++)
{
Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Smoke, 0f, 0f, 100, default, 1.5f);
}
for (int d = 0; d < 10; d++)
{
int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 0, default, 2.5f);
Main.dust[idx].noGravity = true;
Main.dust[idx].velocity *= 3f;
idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 1.5f);
Main.dust[idx].velocity *= 2f;
Main.dust[idx].noGravity = true;
}
Projectile.maxPenetrate = -1;
Projectile.penetrate = -1;
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = 10;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 140 B

+110
View File
@@ -0,0 +1,110 @@
using CalamityMod.Particles;
using CalamityMod.Sounds;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Ranged
{
public class OmniSniperShot : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Ranged";
public override void SetStaticDefaults()
{
ProjectileID.Sets.TrailCacheLength[Type] = 4;
ProjectileID.Sets.TrailingMode[Type] = 0;
}
public const int DoubleDamageTime = 90;
public static int Lifetime = 600;
public override void SetDefaults()
{
Projectile.width = 20;
Projectile.height = 6;
Projectile.light = 0.5f;
Projectile.alpha = 255;
Projectile.extraUpdates = 7;
Projectile.scale = 1.18f;
Projectile.friendly = true;
Projectile.DamageType = DamageClass.Ranged;
Projectile.ignoreWater = true;
Projectile.aiStyle = ProjAIStyleID.Arrow;
AIType = ProjectileID.BulletHighVelocity;
Projectile.penetrate = 5;
Projectile.timeLeft = Lifetime;
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = -1;
}
public override void AI()
{
Projectile.rotation = Projectile.velocity.ToRotation();
Projectile.damage += Projectile.originalDamage / DoubleDamageTime;
if (Projectile.timeLeft == Lifetime - 2)
{
for (int i = 0; i <= 4; i++) //Dragon's Breath shot particles my beloved
{
Vector2 sparkVelocity = Projectile.velocity * 0.5f;
float sparkScale1 = Main.rand.NextFloat(0.3f, 0.8f);
Vector2 sparkvelocity1 = sparkVelocity.RotatedByRandom(0.45f) * Main.rand.NextFloat(0.4f, 0.95f);
SparkParticle spark1 = new SparkParticle(Projectile.Center, sparkvelocity1, false, 6, sparkScale1, Main.rand.NextBool() ? Color.Goldenrod : Color.DarkGoldenrod);
GeneralParticleHandler.SpawnParticle(spark1);
float sparkScale2 = Main.rand.NextFloat(0.4f, 1f);
Vector2 sparkvelocity2 = sparkVelocity.RotatedByRandom(0.2f) * Main.rand.NextFloat(1.1f, 3.1f);
SparkParticle spark2 = new SparkParticle(Projectile.Center, sparkvelocity2, false, 6, sparkScale2, Main.rand.NextBool() ? Color.Goldenrod : Color.DarkGoldenrod);
GeneralParticleHandler.SpawnParticle(spark2);
}
}
if (Projectile.timeLeft < Lifetime - 3 && Projectile.timeLeft > Lifetime - 150)
{
SparkParticle spark = new SparkParticle(Projectile.Center, -Projectile.velocity * 0.05f, false, 9, 1.2f, Color.Coral * 0.3f);
GeneralParticleHandler.SpawnParticle(spark);
}
}
public override bool OnTileCollide(Vector2 oldVelocity)
{
Collision.HitTiles(Projectile.Center, Projectile.velocity, Projectile.width, Projectile.height);
SoundEngine.PlaySound(SoundID.Dig, Projectile.Center);
return true;
}
public override void OnKill(int timeLeft)
{
for (int i = 0; i <= 6; i++)
{
Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool() ? 158 : 55, new Vector2(5, 5).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1.5f), 0, default, Main.rand.NextFloat(1.6f, 2.2f));
dust.noGravity = true;
dust.fadeIn = 0.5f;
}
}
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
{
//Always critically strikes
modifiers.SetCrit();
for (int i = 0; i <= 2; i++)
{
LineParticle spark = new LineParticle(Projectile.Center, -Projectile.velocity.RotatedBy(Main.rand.NextFloat(0.18f, 0.44f)) * Main.rand.NextFloat(0.4f, 2.5f), false, 8, 0.9f, Main.rand.NextBool() ? Color.Goldenrod : Color.Gold);
GeneralParticleHandler.SpawnParticle(spark);
LineParticle spark2 = new LineParticle(Projectile.Center, -Projectile.velocity.RotatedBy(Main.rand.NextFloat(-0.18f, -0.44f)) * Main.rand.NextFloat(0.4f, 2.5f), false, 8, 0.9f, Main.rand.NextBool() ? Color.Goldenrod : Color.Gold);
GeneralParticleHandler.SpawnParticle(spark2);
}
for (int i = 0; i <= 3; i++)
{
Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool() ? 158 : 55, new Vector2(5, 5).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1.5f), 0, default, Main.rand.NextFloat(1.6f, 2.2f));
dust.noGravity = true;
dust.fadeIn = 0.5f;
}
}
public override bool PreDraw(ref Color lightColor)
{
CalamityUtils.DrawAfterimagesFromEdge(Projectile, 0, lightColor);
return false;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 153 B

+349
View File
@@ -0,0 +1,349 @@
using System;
using CalamityMod.CalPlayer;
using CalamityMod.Dusts;
using CalamityMod.Particles;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Typeless
{
public class Pigion : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Typeless";
public Player Owner => Main.player[Projectile.owner];
public CalamityPlayer moddedOwner => Owner.Calamity();
public Color cl1 = Color.Gold;
public Color cl2 = Color.Goldenrod;
public int hopTimer = 0;
public static int hopMax = 100;
public bool hitGround = false;
public bool hitWall = false;
public Vector2 lastUnmodVel;
public Vector2 mousePos;
public int thrownTimer = 0; // Timer set when grabbed, fades out faster at low velocity, allowing gravity to take effect sooner
public static int thrownTimerMax = 300;
public static int lowestSpeed = 4;
public static int highestSpeed = 20;
public bool deadPig = false; // if Pigion hit a wall at high enough speed to explode
public ref float time => ref Projectile.ai[0];
public ref float minionNumber => ref Projectile.ai[1];
public bool pigGrabbed => Projectile.ai[2] == 5;
public override void SetStaticDefaults()
{
Main.projFrames[Type] = 2;
}
public override void SetDefaults()
{
Projectile.width = 42;
Projectile.height = 28;
Projectile.friendly = true;
Projectile.DamageType = AverageDamageClass.Instance;
Projectile.ignoreWater = true;
Projectile.tileCollide = true;
Projectile.penetrate = -1;
Projectile.timeLeft = 600;
Projectile.extraUpdates = 1;
Projectile.usesLocalNPCImmunity = true;
}
public void Frames()
{
Projectile.frameCounter++;
if (Projectile.frameCounter > 6 * Projectile.MaxUpdates)
{
Projectile.frame++;
Projectile.frameCounter = 0;
}
if (Projectile.frame >= 2)
Projectile.frame = 0;
}
public override void AI()
{
mousePos = Owner.ClampedMouseWorld();
if (time == 0)
{
time = Main.rand.Next(1, 800 + 1);
Projectile.spriteDirection = Main.rand.NextBool() ? -1 : 1;
lastUnmodVel = Projectile.velocity;
}
Frames();
// Make an idle sound
if (Main.rand.NextBool(280) && Projectile.soundDelay == 0)
{
SoundStyle oink = new("CalamityMod/Sounds/Item/Swine", 2);
SoundEngine.PlaySound(oink with { Volume = 0.35f, Pitch = Main.rand.NextFloat(0.3f, 0.5f), MaxInstances = 5 }, Projectile.Center);
Projectile.soundDelay = 180;
}
// Teleport back to player if too far away
if (Projectile.Center.Distance(Owner.Center) > 1500)
{
Projectile.velocity = new Vector2(0, -16).RotatedByRandom(MathHelper.Pi / 2);
Projectile.Center = Owner.Center;
}
// Check if being clicked and no other Pigions are being clicked
if (Owner.controlUseItem && Projectile.Center.Distance(mousePos) <= 60 && !pigGrabbed && Projectile.ai[2] == 0)
SetGrab(true);
// Push away enemies it touches based on the Pigions velocity
Vector2 toNPC = Vector2.Zero;
NPC npc = Projectile.Center.ClosestNPCAt(300, false);
if (npc != null && !pigGrabbed && Projectile.Hitbox.Intersects(npc.Hitbox))
{
toNPC = Projectile.Center.DirectionTo(npc.Center);
npc.MoveNPC(Utils.DirectionTo(Projectile.Center, npc.Center), Utils.Remap(Projectile.velocity.Length(), lowestSpeed, highestSpeed * 1.5f, 4, 30), true);
}
float hitboxSizeMult = 0.45f;
bool touchingWall = Collision.SolidCollision(Vector2.Lerp(Projectile.TopLeft, Projectile.Left, 0.15f) + Vector2.UnitX * Projectile.velocity.X, 1, (int)(Projectile.height * hitboxSizeMult)) || Collision.SolidCollision(Vector2.Lerp(Projectile.TopRight, Projectile.Right, 0.15f) + Vector2.UnitX * Projectile.velocity.X, 1, (int)(Projectile.height * hitboxSizeMult));
if (touchingWall)
{
FlipDirection(-Projectile.spriteDirection);
Projectile.velocity.X += Projectile.spriteDirection;
}
if (!pigGrabbed) // Check if hitting tiles or enemies, and if so rebound the Pigion or kill them
Slam(touchingWall, hitboxSizeMult, toNPC);
else
thrownTimer = thrownTimerMax;
lastUnmodVel = Projectile.velocity;
Movement();
thrownTimer -= 1 + (int)(20 * (Utils.GetLerpValue(highestSpeed, lowestSpeed * 2, Projectile.velocity.Length(), true)));
if (thrownTimer < 0)
thrownTimer = 0;
hopTimer--;
time++;
Projectile.timeLeft++;
if (moddedOwner.friendlyMinions < minionNumber || Owner.dead || deadPig)
{
Projectile.Kill();
return;
}
}
public void Slam(bool touchingWall, float hitboxSizeMult, Vector2 touchNPCVel)
{
bool onPlatform = false;
float thrownMult = Utils.Remap(thrownTimer, 0, thrownTimerMax, 0.6f, 1f);
if (Projectile.velocity.Y > 0) // If moving down, check for platforms
{
for (int i = 4; i < 8; i++)
{
Point bottom = (Projectile.Bottom + Vector2.UnitY * i).ToTileCoordinates();
if (TileID.Sets.Platforms[CalamityUtils.ParanoidTileRetrieval(bottom.X, bottom.Y).TileType])
{
onPlatform = true;
}
}
}
float velX = MathF.Abs(lastUnmodVel.X);
float velY = MathF.Abs(lastUnmodVel.Y);
bool hitNPC = touchNPCVel != Vector2.Zero;
bool hitDownWall = (Collision.SolidCollision(Projectile.Bottom + Vector2.UnitY * Projectile.velocity.Y, (int)(Projectile.width * hitboxSizeMult), 1) || onPlatform);
bool hitUpWall = Collision.SolidCollision(Projectile.Top + Vector2.UnitY * Projectile.velocity.Y, (int)(Projectile.width * hitboxSizeMult), 1);
bool hitDown = velY > lowestSpeed && hitDownWall;
bool hitUp = velY > lowestSpeed && hitUpWall;
bool hitSide = velX > lowestSpeed && touchingWall;
bool hardHit = Projectile.velocity.Length() >= highestSpeed * 1.5f; // The velocity a Pigion must be going to explode on impact
float volumeMult = Utils.GetLerpValue(lowestSpeed - 2, highestSpeed, Projectile.velocity.Length(), true); // Sounds are quieter at low velocity
bool hitAnything = false;
if (hitDown || hitUp)
{
if (!hitGround)
{
hitAnything = true;
if (hardHit)
{
deadPig = true;
return;
}
Projectile.velocity.Y = -lastUnmodVel.Y * thrownMult;
MakeDustAndSound(volumeMult);
hitGround = true;
}
}
else
hitGround = false;
if (hitSide)
{
hitAnything = true;
if (!hitWall)
{
if (hardHit)
{
deadPig = true;
return;
}
Projectile.velocity.X = -lastUnmodVel.X * thrownMult;
MakeDustAndSound(volumeMult);
hitWall = true;
}
}
else
hitWall = false;
if (hitNPC && Projectile.velocity.Length() >= lowestSpeed)
{
hitAnything = true;
if (hardHit)
{
deadPig = true;
return;
}
Vector2 npcBounceVel = -lastUnmodVel * thrownMult;
Projectile.Center += npcBounceVel;
Projectile.velocity = npcBounceVel;
MakeDustAndSound(volumeMult);
}
if (hitAnything)
{
FlipDirection(MathF.Sign(Projectile.velocity.X));
}
}
public void MakeDustAndSound(float volumeMult)
{
SoundStyle splat = new("CalamityMod/Sounds/NPCHit/PerfSmallHit", 3);
SoundEngine.PlaySound(splat with { Volume = 0.8f * volumeMult, Pitch = Main.rand.NextFloat(0.3f, 0.4f) - volumeMult * 0.3f }, Projectile.Center);
Vector2 vel = Projectile.velocity.SafeNormalize(Vector2.UnitX);
float power = 0.2f + Utils.GetLerpValue(0, 40, Projectile.velocity.Length());
for (int i = 0; i < (int)(12 * power); i++)
{
float variance = Main.rand.NextFloat(-0.8f, 0.8f);
Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType<SquashDustPixelated>(),
vel.RotatedBy(variance).RotatedByRandom(MathF.Abs(variance) / 3) * Main.rand.NextFloat(15.0f, 18.0f) * MathF.Pow((1 - MathF.Abs(variance)), 2), 0, default, power * Main.rand.NextFloat(2.3f, 3.2f) - MathF.Abs(variance));
dust.noGravity = Main.rand.NextBool(2, 3);
dust.color = Main.rand.NextBool() ? cl1 : cl2;
dust.customData = new Vector2(0.8f, 1.1f);
dust.fadeIn = 3.5f * power;
}
}
public void FlipDirection(int newDirection)
{
Projectile.spriteDirection = newDirection;
time = 1;
}
public void SetGrab(bool isGrabbed) => Projectile.ai[2] = (isGrabbed ? 5 : 0);
public void Movement()
{
// Flip movement direction every once in a while
if (time % 900 == 0)
FlipDirection(-Projectile.spriteDirection);
// Slowing down over time
if (thrownTimer <= thrownTimerMax / 2)
Projectile.velocity.X *= 0.97f;
// Move Pigion to mouse if grabbed, otherwise ungrab them if player isn't holding M1 anymore
if (pigGrabbed)
{
FlipDirection(MathF.Sign(Projectile.Center.DirectionTo(mousePos).X));
Vector2 goalVel = (mousePos - Projectile.Center) / (18);
Projectile.velocity = goalVel;
}
if (!Owner.controlUseItem)
SetGrab(false);
// Falling
if (Projectile.velocity.Y < 14 && thrownTimer <= thrownTimerMax / 2)
Projectile.velocity.Y += 0.3f * Utils.GetLerpValue(100, 0, hopTimer, true);
int walkRate = 90; // Walk along slowly
if (!pigGrabbed && time % walkRate == 0)
{
Projectile.velocity.X += 1 * Projectile.spriteDirection;
}
// lil hops when near other Pigions
for (int x = 0; x < Main.maxProjectiles; x++)
{
Projectile projectile = Main.projectile[x];
bool validPig = projectile.active && projectile.type == Projectile.type && projectile != Projectile;
float distance = Vector2.Distance(Projectile.Center, projectile.Center);
if (validPig)
{
if (pigGrabbed)
projectile.ai[2] = 1; // set all other Pigions to be counted as not grabable
if (distance <= 80 && distance != 0 && hopTimer <= 0 && thrownTimer == 0)
{
int directionOfJump = -MathF.Sign(Projectile.Center.DirectionTo(projectile.Center).X);
Projectile.velocity += new Vector2(Main.rand.NextFloat(-2.5f, -4) * directionOfJump, -2);
FlipDirection(-directionOfJump);
hopTimer = 100;
}
}
}
// Rotate based on velocity and direction
float goalRot = Utils.AngleLerp(0, Projectile.velocity.ToRotation() + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0), Utils.GetLerpValue(lowestSpeed, highestSpeed, Projectile.velocity.Length(), true));
Projectile.rotation = goalRot;
}
public override void OnKill(int timeLeft)
{
if (deadPig) // Only spawn explosion if death is from collision
{
int pigNum = Owner.ownedProjectileCounts[Projectile.type];
int damage = (int)((pigNum * 2 + Projectile.damage) * MathF.Pow(Owner.GetBestClassDamage().ApplyTo(1), 0.4f + pigNum * 0.6f)); // Damage scales with number of pigions at 0.7 power
float blastSize = 100;
float minMultiplier = 0.1f;
int hitsToMinMult = 4;
Projectile blast = Projectile.NewProjectileDirect(Owner.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType<BasicBurst>(), (int)(damage), -15, Owner.whoAmI, blastSize, minMultiplier, hitsToMinMult);
blast.timeLeft = 5;
blast.DamageType = AverageDamageClass.Instance;
blast.CritChance = 100;
}
Owner.SetScreenshake(3);
SoundStyle die = new("CalamityMod/Sounds/Item/PigionSqueal");
SoundEngine.PlaySound(die with { Volume = 0.55f, Pitch = Main.rand.NextFloat(-0.2f, 0.4f), MaxInstances = 7 }, Projectile.Center);
SoundStyle die2 = new("CalamityMod/Sounds/NPCKilled/PerfMediumDeath");
SoundEngine.PlaySound(die2 with { Volume = 0.6f, Pitch = Main.rand.NextFloat(0.2f, 0.3f) }, Projectile.Center);
for (int i = 0; i < 24; i++)
{
Vector2 dustVel = (Vector2.One * 6).RotatedByRandom(100);
Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType<SquashDustPixelated>(), dustVel * Main.rand.NextFloat(0.1f, 0.8f));
dust.noGravity = Main.rand.NextBool(2, 3);
dust.scale = Main.rand.NextFloat(0.5f, 0.8f);
dust.color = Color.Red;
dust.noLightEmittence = true;
dust.fadeIn = -0.4f;
if (i % 2 == 0)
{
Particle pulse1 = new CustomSpark(Projectile.Center, Vector2.One.RotatedByRandom(MathHelper.TwoPi) * Main.rand.NextFloat(1, 6), "CalamityMod/Particles/BloomCircle", false, Main.rand.Next(20, 35 + 1), Main.rand.NextFloat(0.2f, 0.35f), Color.Red * 0.55f, new Vector2(1f, 1f), noShrink: true);
GeneralParticleHandler.SpawnParticle(pulse1);
pulse1.Pixelate = true;
}
}
}
public override bool OnTileCollide(Vector2 oldVelocity)
{
return false;
}
public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough, ref Vector2 hitboxCenterFrac)
{
fallThrough = pigGrabbed;
return true;
}
public override bool PreDraw(ref Color lightColor)
{
Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value;
Rectangle frame = texture.Frame(1, 2, 0, Projectile.frame);
Vector2 origin = frame.Size() * 0.5f;
Vector2 squash = new Vector2(Utils.Remap(Projectile.velocity.Length(), lowestSpeed, highestSpeed, 1, 2), Utils.Remap(Projectile.velocity.Length(), lowestSpeed, highestSpeed, 1, 0.5f));
Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, frame, lightColor, Projectile.rotation, origin, squash * Projectile.scale, Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0);
return false;
}
public override bool? CanDamage() => false;
public override bool? CanCutTiles() => false;
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+2 -32
View File
@@ -35,7 +35,7 @@ namespace CalamityMod.Systems.Collections
BuffID.Crate, BuffID.Warmth, BuffID.SugarRush, BuffType<AnechoicCoatingBuff>(), BuffType<AstralInjectionBuff>(), BuffType<BaguetteBuff>(), BuffType<BloodfinBoost>(),
BuffType<BoundingBuff>(), BuffType<CalciumBuff>(), BuffType<CeaselessHunger>(), BuffType<GravityNormalizerBuff>(), BuffType<Omniscience>(), BuffType<PhotosynthesisBuff>(),
BuffType<ShadowBuff>(), BuffType<Soaring>(), BuffType<SulphurskinBuff>(), BuffType<WeaponImbueBrimstone>(), BuffType<WeaponImbueCrumbling>(), BuffType<WeaponImbueHolyFlames>(),
BuffType<Zen>(), BuffType<Zerg>(), BuffType<BloodyMaryBuff>(), BuffType<CaribbeanRumBuff>(), BuffType<CinnamonRollBuff>(), BuffType<EverclearBuff>(), BuffType<EvergreenGinBuff>(),
BuffType<Zen>(), BuffType<Zerg>(), BuffType<BaconOilBuff>(), BuffType<BloodyMaryBuff>(), BuffType<CaribbeanRumBuff>(), BuffType<CinnamonRollBuff>(), BuffType<EverclearBuff>(), BuffType<EvergreenGinBuff>(),
BuffType<PurpleHazeBuff>(), BuffType<FireballBuff>(), BuffType<GrapeBeerBuff>(), BuffType<MargaritaBuff>(), BuffType<MoonshineBuff>(), BuffType<MoscowMuleBuff>(),
BuffType<RedWineBuff>(), BuffType<RumBuff>(), BuffType<ScrewdriverBuff>(), BuffType<StarBeamRyeBuff>(), BuffType<TequilaBuff>(), BuffType<TequilaSunriseBuff>(),
BuffType<Trippy>(), BuffType<VodkaBuff>(), BuffType<WhiskeyBuff>(), BuffType<WhiteWineBuff>());
@@ -47,7 +47,7 @@ namespace CalamityMod.Systems.Collections
/// </summary>
public static bool[] IsPersistentBuff = Factory.CreateBoolSet(BuffID.WeaponImbueVenom, BuffID.WeaponImbueCursedFlames, BuffID.WeaponImbueFire, BuffID.WeaponImbueGold,
BuffID.WeaponImbueIchor, BuffID.WeaponImbueNanites, BuffID.WeaponImbueConfetti, BuffID.WeaponImbuePoison, BuffType<WeaponImbueBrimstone>(),
BuffType<WeaponImbueCrumbling>(), BuffType<WeaponImbueHolyFlames>(), BuffType<BloodyMaryBuff>(), BuffType<CaribbeanRumBuff>(), BuffType<CinnamonRollBuff>(), BuffType<EverclearBuff>(),
BuffType<WeaponImbueCrumbling>(), BuffType<WeaponImbueHolyFlames>(), BuffType<BaconOilBuff>(), BuffType<BloodyMaryBuff>(), BuffType<CaribbeanRumBuff>(), BuffType<CinnamonRollBuff>(), BuffType<EverclearBuff>(),
BuffType<EvergreenGinBuff>(), BuffType<FireballBuff>(), BuffType<GrapeBeerBuff>(), BuffType<ManhattanBuff>(), BuffType<MargaritaBuff>(), BuffType<MoonshineBuff>(),
BuffType<MoscowMuleBuff>(), BuffType<OldFashionedBuff>(), BuffType<PurpleHazeBuff>(), BuffType<RedWineBuff>(), BuffType<RumBuff>(), BuffType<ScrewdriverBuff>(),
BuffType<StarBeamRyeBuff>(), BuffType<TequilaBuff>(), BuffType<TequilaSunriseBuff>(), BuffType<VodkaBuff>(), BuffType<WhiskeyBuff>(), BuffType<WhiteWineBuff>());
@@ -93,35 +93,5 @@ namespace CalamityMod.Systems.Collections
{ BuffID.ThornWhipNPCDebuff, SummonTag.Snapthorn },
{ BuffType<ProfanedCrystalWhipDebuff>(), ProfanedSoulCrystal.SummonTag }
};
/// <summary>
/// Associates a buff type with its alcohol poison level. Used for the Alcohol Poisoning mechanic.<br/>
/// If a buff type is not a key in this dictionary, then it does not increase alcohol poison level.
/// </summary>
public static Dictionary<int, int> AlcoholStrength = new Dictionary<int, int>
{
{ BuffID.Tipsy, 1 },
{ BuffType<BloodyMaryBuff>(), 1 },
{ BuffType<CaribbeanRumBuff>(), 1 },
{ BuffType<CinnamonRollBuff>(), 1 },
{ BuffType<EverclearBuff>(), 2 },
{ BuffType<EvergreenGinBuff>(), 1 },
{ BuffType<FireballBuff>(), 1 },
{ BuffType<GrapeBeerBuff>(), 1 },
{ BuffType<MargaritaBuff>(), 1 },
{ BuffType<MoonshineBuff>(), 1 },
{ BuffType<MoscowMuleBuff>(), 1 },
{ BuffType<OldFashionedBuff>(), 1 },
{ BuffType<PurpleHazeBuff>(), 1 },
{ BuffType<RedWineBuff>(), 1 },
{ BuffType<RumBuff>(), 1 },
{ BuffType<ScrewdriverBuff>(), 1 },
{ BuffType<StarBeamRyeBuff>(), 1 },
{ BuffType<TequilaBuff>(), 1 },
{ BuffType<TequilaSunriseBuff>(), 1 },
{ BuffType<VodkaBuff>(), 1 },
{ BuffType<WhiskeyBuff>(), 1 },
{ BuffType<WhiteWineBuff>(), 1 }
};
}
}
+37
View File
@@ -0,0 +1,37 @@
using CalamityMod.Items.Placeables.Furniture;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.DataStructures;
using Terraria.Enums;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.ObjectData;
namespace CalamityMod.Tiles.Furniture
{
public class TheMonumentTile : ModTile
{
public override void SetStaticDefaults()
{
Main.tileFrameImportant[Type] = true;
TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3);
TileObjectData.newTile.Width = 7;
TileObjectData.newTile.Height = 8;
TileObjectData.newTile.Origin = new Point16(3, 7);
TileObjectData.newTile.CoordinateHeights = new[] { 16, 16, 16, 16, 16, 16, 16, 16 };
TileObjectData.newTile.DrawYOffset = 2;
TileObjectData.newTile.LavaDeath = false;
TileObjectData.newTile.UsesCustomCanPlace = true;
TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop, TileObjectData.newTile.Width, 0);
TileObjectData.addTile(Type);
AddMapEntry(new Color(239, 205, 54), CalamityUtils.GetItemName<TheMonument>());
}
public override bool CreateDust(int i, int j, ref int type)
{
Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Gold);
return false;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

-1
View File
@@ -161,7 +161,6 @@ namespace CalamityMod
projectile.tileCollide = true;
}
}
public static void HomeInOnNPC(Projectile projectile, bool ignoreTiles, float distanceRequired, float homingVelocity, float inertia, bool respectIFrames = false)
{
if (!projectile.friendly)