merge resolve

This commit is contained in:
doze-zoze committed 2026-04-15 22:16:45 -05:00
commit 62dbf719d1
53 files changed
+1091 -314

No files matched your search

+17
View File
@@ -0,0 +1,17 @@
using CalamityMod.Projectiles.Pets;
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Buffs.Pets
{
public class StarSwallowerPetBuff : ModBuff
{
public override void SetStaticDefaults()
{
Main.buffNoTimeDisplay[Type] = true;
Main.vanityPet[Type] = true;
}
public override void Update(Player player, ref int buffIndex) => player.BuffHandle_SpawnPetIfNeededAndSetTime(buffIndex, ref player.Calamity().starSwallowerPetFroge, ModContent.ProjectileType<StarSwallowerPet>());
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 662 B

+2
View File
@@ -589,6 +589,7 @@ namespace CalamityMod.CalPlayer
public bool lordePet = false;
public bool frostyBat = false;
public bool toastyBat = false;
public bool starSwallowerPetFroge = false;
#endregion
#region Rage
@@ -2287,6 +2288,7 @@ namespace CalamityMod.CalPlayer
lordePet = false;
frostyBat = false;
toastyBat = false;
starSwallowerPetFroge = false;
onyxExcavator = false;
rimehound = false;
-1
View File
@@ -2360,7 +2360,6 @@ namespace CalamityMod.CalPlayer
}
}
}
fleshTotemManaStorage = 0;
}
+3 -3
View File
@@ -886,7 +886,7 @@ namespace CalamityMod.CalPlayer
{
if (Player.ownedProjectileCounts[ProjectileType<PhantomicDagger>()] < 3 && Main.rand.NextBool(4))
{
int damage = (int)Player.GetTotalDamage<SummonDamageClass>().ApplyTo(100);
int damage = (int)Player.GetTotalDamage<SummonDamageClass>().ApplyTo(PhantomicArtifact.DaggerDamage);
Projectile.NewProjectile(source, Player.Center, new Vector2(Player.velocity.X,Player.velocity.Y-10).RotatedByRandom(0.3f), ProjectileType<PhantomicDagger>(), damage, 1f, Player.whoAmI);
}
}
@@ -1086,12 +1086,12 @@ namespace CalamityMod.CalPlayer
if (npcCheck)
{
// Umbraphile cannot trigger off of itself. It is guaranteed on stealth strikes and 20% chance otherwise.
if (umbraphileSet && ((modProj.stealthStrike && modProj.stealthStrikeHitCount < 3) || Main.rand.NextBool(5)))
if (umbraphileSet && ((modProj.stealthStrike && modProj.stealthStrikeHitCount < 3) || Main.rand.NextBool(5)) && !modProj.CannotProc)
{
int umbraBlastDamage = CalamityUtils.DamageSoftCap(proj.damage * UmbraphileHood.ExplosionDamageRatio, UmbraphileHood.ExplosionDamageSoftcap);
Projectile.NewProjectile(spawnSource, proj.Center, Vector2.Zero, ProjectileType<UmbraphileBoom>(), umbraBlastDamage, 0f, Player.whoAmI);
}
if (electricianGlove && modProj.stealthStrike && modProj.stealthStrikeHitCount < 3)
if (electricianGlove && modProj.stealthStrike && modProj.stealthStrikeHitCount < 3 && !modProj.CannotProc)
{
for (int s = 0; s < 3; s++)
{
+2
View File
@@ -13,6 +13,8 @@ namespace CalamityMod.Items.Accessories
public static int manaStorageMax = 600;
public const int lostSoulDamage = 200;
public static int MinDelay => 60;
public static int MaxDelay => 240;
public override void SetDefaults()
{
+4 -3
View File
@@ -17,9 +17,10 @@ namespace CalamityMod.Items.Accessories
{
public new string LocalizationCategory => "Items.Accessories";
public static int RegenBoost = 2;
public static int DefenseBoost = 8;
public static float SummonDamageBoost = 0.1f;
public static int RegenBoost => 2;
public static int DefenseBoost => 8;
public static float SummonDamageBoost => 0.1f;
public static float DaggerDamage => 300;
public LocalizedText TooltipExtensionText => this.GetLocalization("HoldShiftTooltip").WithFormatArgs(SummonDamageBoost.ToPercent(), DefenseBoost, RegenBoost.ToRegenPerSecond());
public override void SetStaticDefaults()
{
+2 -1
View File
@@ -1,6 +1,7 @@
using System;
using System.IO;
using CalamityMod.Balancing;
using CalamityMod.Buffs.Potions;
using CalamityMod.Buffs.StatBuffs;
using CalamityMod.Buffs.StatDebuffs;
using CalamityMod.CalPlayer;
@@ -613,7 +614,7 @@ namespace CalamityMod.Items
}
//Mana Potion interactions
if (item.healMana > 0)
if (item.healMana > 0 || player.HasBuff(ModContent.BuffType<AstralInjectionBuff>()))
{
//If mana potion used, kill all active Crown projectiles
if ((modPlayer.moonCrown || modPlayer.featherCrown) && modPlayer.mageCrownCount > 0)
+41
View File
@@ -0,0 +1,41 @@
using CalamityMod.Buffs.Pets;
using CalamityMod.Items.Materials;
using CalamityMod.Projectiles.Pets;
using CalamityMod.Rarities;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Pets
{
public class StarSwallowerUnit : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Pets";
public override void SetDefaults()
{
Item.DefaultToVanitypet(ModContent.ProjectileType<StarSwallowerPet>(), ModContent.BuffType<StarSwallowerPetBuff>());
Item.value = Item.sellPrice(gold: 1);
Item.rare = ModContent.RarityType<DarkOrange>();
Item.useStyle = ItemUseStyleID.HoldUp;
}
public override void UseStyle(Player player, Rectangle heldItemFrame)
{
if (player.whoAmI == Main.myPlayer && player.itemTime == 0)
{
player.AddBuff(Item.buffType, 15, true);
}
}
public override void AddRecipes()
{
CreateRecipe().
AddIngredient(ItemID.Frog).
AddIngredient<MysteriousCircuitry>(8).
AddIngredient<DubiousPlating>(4).
AddTile(TileID.Anvils).
Register();
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 796 B

@@ -51,6 +51,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Paintings
{
"Altixal",
"apotofkoolaid",
"ArchonSystem",
"Atalya",
"Ben-TK",
"Big E",
@@ -64,11 +65,9 @@ namespace CalamityMod.Items.Placeables.Furniture.Paintings
"Dia",
"Done",
"dozezoze",
"ENNWAY",
"Flowaria",
"Fluffy",
"fryzahh",
"HaguriHat",
"jasper",
"LordMetarex",
"math2",
@@ -84,7 +83,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Paintings
"_tofu",
"Tomat",
"Triangle",
"TYESKI (Universe)",
"TYESKI",
"Xyk",
"YuH",
// Former devs
@@ -120,6 +119,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Paintings
"Ein",
"enamoured",
"Enreden",
"ENNWAY",
"Epsilon",
"Fargowilta",
"Frous",
-14
View File
@@ -24,7 +24,6 @@ namespace CalamityMod.Items.Potions
{
// Eating animation but gulp sound? Sure
Item.DefaultToFood(22, 38, BuffID.MagicPower, CalamityUtils.MinutesToFrames(8));
Item.healMana = 200;
Item.UseSound = SoundID.Item3;
Item.value = Item.sellPrice(silver: 50); // Based on material cost rather than potion cost
Item.rare = ItemRarityID.Lime;
@@ -32,19 +31,6 @@ namespace CalamityMod.Items.Potions
public override void OnConsumeItem(Player player)
{
if (PlayerInput.Triggers.JustPressed.QuickBuff)
{
player.statMana += Item.healMana;
if (player.statMana > player.statManaMax2)
{
player.statMana = player.statManaMax2;
}
player.AddBuff(BuffID.ManaSickness, Player.manaSickTime, true);
if (Main.myPlayer == player.whoAmI)
{
player.ManaEffect(Item.healMana);
}
}
player.AddBuff(BuffID.MagicPower, Item.buffTime);
player.AddBuff(BuffID.ManaRegeneration, Item.buffTime);
}
+8 -1
View File
@@ -1,6 +1,7 @@
using CalamityMod.Items.Materials;
using CalamityMod.Projectiles.Magic;
using CalamityMod.Rarities;
using CalamityMod.Systems.Collections;
using CalamityMod.Tiles.Furniture.CraftingStations;
using Microsoft.Xna.Framework;
using Terraria;
@@ -23,12 +24,18 @@ namespace CalamityMod.Items.Weapons.Magic
public static int AftershotCooldownFrames = 17;
public static int FullChargeFrames = 88;
public override void SetStaticDefaults()
{
base.SetStaticDefaults();
CalamityItemSets.ShowScalingCritDamageTooltip[Type] = true;
}
public override void SetDefaults()
{
Item.width = 112;
Item.height = 112;
Item.DamageType = DamageClass.Magic;
Item.damage = 5100;
Item.damage = 2700;
Item.knockBack = 9.5f;
Item.mana = 80;
Item.useAnimation = Item.useTime = AftershotCooldownFrames;
+2 -28
View File
@@ -14,11 +14,6 @@ namespace CalamityMod.Items.Weapons.Ranged
public new string LocalizationCategory => "Items.Weapons.Ranged";
public static int MaxLoadedArrows = 9;
public override void SetStaticDefaults()
{
ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true;
}
public override void SetDefaults()
{
Item.width = 130;
@@ -40,26 +35,15 @@ namespace CalamityMod.Items.Weapons.Ranged
public override Vector2? HoldoutOffset() => new Vector2(-50f, 0f);
public override bool AltFunctionUse(Player player) => true;
public override void HoldItem(Player player)
{
var calPlayer = player.Calamity();
if (Main.myPlayer == player.whoAmI)
{
calPlayer.rightClickListener = true;
calPlayer.mouseRotationListener = true;
}
if (calPlayer.mouseRight && player.ownedProjectileCounts[ModContent.ProjectileType<CondemnationHoldout>()] <= 0)
{
Item.noUseGraphic = false;
}
else
{
Item.noUseGraphic = true;
}
Item.noUseGraphic = true;
}
public override bool CanUseItem(Player player) => player.ownedProjectileCounts[ModContent.ProjectileType<CondemnationHoldout>()] <= 0;
@@ -71,17 +55,7 @@ namespace CalamityMod.Items.Weapons.Ranged
{
Vector2 shootVelocity = velocity;
Vector2 shootDirection = shootVelocity.SafeNormalize(Vector2.UnitX * player.direction);
// Single arrow firing.
if (player.Calamity().mouseRight)
{
Vector2 tipPosition = position + shootDirection * 110f;
Projectile.NewProjectile(source, tipPosition, shootVelocity, Item.shoot, damage, knockback, player.whoAmI);
}
// Charge-up. Done via a holdout projectile.
else
Projectile.NewProjectile(source, position, shootDirection, ModContent.ProjectileType<CondemnationHoldout>(), 0, 0f, player.whoAmI);
Projectile.NewProjectile(source, position, shootDirection, ModContent.ProjectileType<CondemnationHoldout>(), 0, 0f, player.whoAmI);
return false;
}
}
+7 -108
View File
@@ -25,13 +25,6 @@ namespace CalamityMod.Items.Weapons.Ranged
public static readonly SoundStyle JackpotGFB = new("CalamityMod/Sounds/Item/SevensStrikerJackpotGFB");
public static readonly SoundStyle CoinSound = new("CalamityMod/Sounds/Item/SevensStrikerCoinShot") { MaxInstances = 0, PitchVariance = 0.5f };
public static int ShotCoin = 0; // projectile ID to use for right click, affects damage multiplier
public static readonly float RightClickCopperMultiplier = 0.04f;
public static readonly float RightClickSilverMultiplier = 0.08f;
public static readonly float RightClickGoldMultiplier = 0.16f;
public static int RightClickAmmoSavedPercent = 80;
public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(RightClickAmmoSavedPercent);
public static readonly float DoublesMultiplier = 1f; // Unfortunately doubles can't be doubles. Balancing!
public static readonly float TriplesCherryMultiplier = 1f;
public static readonly float TriplesCherrySplitMultiplier = 0.333f;
@@ -39,11 +32,6 @@ namespace CalamityMod.Items.Weapons.Ranged
public static readonly float JackpotMultiplier = 0.5f; // Jackpot fires 49 shots total and thus needs to be reduced somehow...
public static readonly float JackpotMultiplierGFB = 7f; // ...Unless you simply cannot stop winning
public override void SetStaticDefaults()
{
ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true;
}
public override void SetDefaults()
{
Item.width = 170;
@@ -57,114 +45,25 @@ namespace CalamityMod.Items.Weapons.Ranged
Item.channel = true;
Item.useTurn = true;
Item.autoReuse = true;
Item.UseSound = null;
Item.noUseGraphic = true;
Item.useStyle = ItemUseStyleID.Shoot;
Item.useAmmo = AmmoID.Coin;
Item.shoot = ModContent.ProjectileType<SevensStrikerHoldout>();
Item.shootSpeed = 24f;
Item.shoot = ProjectileID.PlatinumCoin;
Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice;
Item.rare = ModContent.RarityType<Turquoise>();
Item.Calamity().donorItem = true;
}
public override bool AltFunctionUse(Player player) => true;
public override bool? UseItem(Player player)
{
// Right click has a chance to save money
if (player.altFunctionUse == 2)
{
bool consumeCoin = Main.rand.Next(100) >= RightClickAmmoSavedPercent;
long coinCount = Utils.CoinsCount(out bool overflow, player.inventory);
int price;
if (overflow || coinCount > 10000)
{
price = 10000;
ShotCoin = ProjectileID.GoldCoin;
}
else if (coinCount > 100)
{
price = 100;
ShotCoin = ProjectileID.SilverCoin;
}
else
{
price = 1;
ShotCoin = ProjectileID.CopperCoin;
}
if (consumeCoin)
player.BuyItem(price);
}
// Left click does nothing, it just spawns the holdout
else
Item.shoot = ModContent.ProjectileType<SevensStrikerHoldout>();
return base.UseItem(player);
}
public override Vector2? HoldoutOffset() => new Vector2(-30, -11);
// Left click spawns a holdout, so the item must not appear normally.
// Right click uses the item like a standard gun, so draw it normally.
public override void UseAnimation(Player player)
{
if (player.altFunctionUse == 2)
{
Item.UseSound = CoinSound;
Item.noUseGraphic = false;
}
else
{
Item.UseSound = null;
Item.noUseGraphic = true;
}
}
// Right click fires coins extremely rapidly (3 use time)
public override float UseTimeMultiplier(Player player) => player.altFunctionUse == 2 ? 0.1f : 1f;
// Right click consumes coins manually instead of using Terraria's ammo system
// (otherwise it could shoot Platinum Coins)
public override bool CanConsumeAmmo(Item ammo, Player player) => player.altFunctionUse == 2 ? false : true;
public override bool CanUseItem(Player player)
{
if (player.ownedProjectileCounts[ModContent.ProjectileType<SevensStrikerHoldout>()] <= 0)
return true;
if (player.altFunctionUse == 2)
{
Utils.CoinsCount(out bool overflow, player.inventory);
return overflow;
}
return true;
}
public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0;
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
{
// Right click damage multiplier varies by coin type
if (player.altFunctionUse == 2)
{
Vector2 shootDirection = velocity.SafeNormalize(Vector2.UnitX * player.direction);
Vector2 gunTip = position + shootDirection * Item.scale * 90f;
gunTip.Y -= 20f;
Projectile holdout = Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, ModContent.ProjectileType<SevensStrikerHoldout>(), damage, knockback, player.whoAmI);
// spread copied from Onyxia, angular conic spread instead of Terraria's square spread
float randAngle = Main.rand.NextFloat(-0.05f, 0.05f);
float randVelMultiplier = Main.rand.NextFloat(0.92f, 1.08f);
Vector2 finalVelocity = velocity.RotatedBy(randAngle) * randVelMultiplier;
float damageMult = ShotCoin == ProjectileID.GoldCoin
? RightClickGoldMultiplier : ShotCoin == ProjectileID.SilverCoin
? RightClickSilverMultiplier : RightClickCopperMultiplier;
int finalDamage = (int)(damage * damageMult);
Projectile.NewProjectile(source, gunTip, finalVelocity, ShotCoin, finalDamage, knockback, player.whoAmI);
}
// Left click just spawns the holdout
else
Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType<SevensStrikerHoldout>(), damage, knockback, player.whoAmI, type, 0f);
// 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;
}
@@ -601,6 +601,11 @@ SparksBuff: {
Description: Eats butterflies
}
StarSwallowerPetBuff: {
DisplayName: Star Swallower
Description: Mmmm myes
}
ThirdSageBuff: {
DisplayName: Third Sage
Description: Eh? No way it's an oni
@@ -798,7 +798,7 @@ FleshTotem: {
5% increased magic critical strike chance
+30 max mana
Summons an effigy above your head that stores mana as you use it, up to 600 mana
The effigy occasionally pulses, restoring 20 mana
The effigy occasionally pulses, restoring 25 mana
Pulses appear more frequently the more mana is stored
Upon being struck, the effigy unleashes all stored up mana as vengeful souls that chase your enemies
'''
@@ -165,6 +165,11 @@ RottingEyeball: {
Tooltip: Summons a corrupted conglomeration
}
StarSwallowerUnit: {
DisplayName: Star Swallower Unit
Tooltip: Summons a biomechanical frog
}
StrangeOrb: {
DisplayName: Strange Orb
Tooltip:
@@ -66,7 +66,6 @@ HolofibreImmolator: {
Holding <left> quickly charges the bow, firing a high-speed plasma arrow
Plasma arrows will detonate after impact, creating stronger explosions if stuck into tiles
Holding <right> will repeatedly fire uncharged shots
Holding <right> and <left> will automatically fire charged arrows at a slightly slower rate
[c/1FFBFF:'The elegance of holofibre is unmatched.]
[c/1FFBFF:However, mechanical tension may have produced more consistent results.']
'''
@@ -906,7 +906,7 @@ Nadir: {
DisplayName: Nadir
Tooltip:
'''
Fires void essences which flay nearby enemies with [cbuff:CalamityMod/Nightwither] tentacles
Fires void essences which flay nearby enemies with [cbuff:CalamityMod/Voidfrost] tentacles
'The abyss has stared back at you long enough. It now speaks, and it does not speak softly'
'''
}
@@ -286,7 +286,6 @@ Condemnation: {
'''
Fires powerful scarlet bolts suffused with hateful magics
Hold <left> to load up to nine bolts for powerful burst fire
Hold <right> to use the repeater full auto
'''
}
@@ -426,7 +425,6 @@ FetidEmesis: {
Fires an accelerating stream of bullets until the barrel overheats
When the barrel overheats, a spread of fetid chunks is vomited out
After firing, the gun must cool back down before it can be used again
Pressing <right> while firing will instantly launch the chunks
{$CommonItemTooltip.PercentChanceToSaveAmmo}
'''
}
@@ -1389,8 +1387,6 @@ TheSevensStriker: {
'''
Press <left> to consume 1 coin and play a slot machine
The quality of the outcome depends on the coin used
Press <right> to rapidly fire a barrage of coins
The coin barrage has an {0}% chance to save ammo and will not fire platinum coins
'A gun given to a great gunslinger
Forged by the arms of a man given no name'
'''
@@ -87,6 +87,7 @@ HellfireExplosion.DisplayName: Brimstone Hellfire Explosion
HiveBombGoliath.DisplayName: Hive Bomb
HolyAura.DisplayName: Holy Aura
HolyBlast.DisplayName: Holy Blast
HolyBlastFrags.DisplayName: Holy Blast Fragment
HolyBomb.DisplayName: Holy Bomb
HolyBurnOrb.DisplayName: Holy Orb
HolyExplosionBoom.DisplayName: Holy Explosion
@@ -28,6 +28,7 @@ RadiatorPet.DisplayName: Radiator
RotomPet.DisplayName: Rotom
SCalPet.DisplayName: Supreme Calamitas
Sparks.DisplayName: Sparks
StarSwallowerPet.DisplayName: G30RG3 II
ThirdSage.DisplayName: Third Sage
ToastyBatPet.DisplayName: Toasty Bat Friend
YharonSonPet.DisplayName: Son of Yharon
+37 -9
View File
@@ -32,6 +32,7 @@ using CalamityMod.Systems.Graphic;
using CalamityMod.Tiles.Ores;
using CalamityMod.Utilities;
using CalamityMod.Utilities.Daybreak;
using CalamityMod.Utilities.Daybreak.Buffers;
using CalamityMod.World;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
@@ -98,6 +99,9 @@ namespace CalamityMod.NPCs.Providence
public bool Dying = false;
public int DeathAnimationTimer;
public static float borderRadius = 3000f;
int spearDir = 1;
int starDir = 1;
public Vector2? borderPosition = null;
// Sounds
public static readonly SoundStyle SpawnSound = new("CalamityMod/Sounds/Custom/Providence/ProvidenceSpawn") { Volume = 1.2f };
@@ -324,6 +328,7 @@ namespace CalamityMod.NPCs.Providence
writer.Write((Half)SoundWarningLevel);
writer.Write(DeathAnimationTimer);
writer.Write(borderRadius);
writer.WriteVector2(borderPosition ?? Vector2.Zero);
for (int i = 0; i < 4; i++)
writer.Write(NPC.Calamity().newAI[i]);
}
@@ -353,6 +358,9 @@ namespace CalamityMod.NPCs.Providence
SoundWarningLevel = (float)reader.ReadHalf();
DeathAnimationTimer = reader.ReadInt32();
borderRadius = reader.ReadSingle();
borderPosition = reader.ReadVector2();
if (borderPosition == Vector2.Zero)
borderPosition = null;
for (int i = 0; i < 4; i++)
NPC.Calamity().newAI[i] = reader.ReadSingle();
@@ -364,6 +372,10 @@ namespace CalamityMod.NPCs.Providence
public override void AI()
{
//ensure projectiles all despawn when she does
if (NPC.timeLeft == 1)
DespawnSpecificProjectiles(true);
// Set the border drawing to true if it isn't set to true
// Can happen when another mod sets to false for a difficulty and that difficulty is then toggled off.
shouldDrawInfernoBorder = true;
@@ -1246,6 +1258,8 @@ namespace CalamityMod.NPCs.Providence
case (int)Phase.FlameCocoon:
borderPosition ??= NPC.Center;
borderPosition = Vector2.Lerp(borderPosition.Value, NPC.Center, 0.02f);
Vector2 fireSparklesFrom = fireFrom + new Vector2(0, -30);
if (!targetDead && !getFuckedAI)
{
@@ -1279,7 +1293,7 @@ namespace CalamityMod.NPCs.Providence
Vector2 spinningPoint = normalSpread ? new Vector2(0f, -cocoonProjVelocity) : new Vector2(-velocityX, -cocoonProjVelocity);
for (int i = 0; i < chains; i++)
{
Vector2 vector2 = spinningPoint.RotatedBy(radians * i + MathHelper.ToRadians(NPC.ai[2]));
Vector2 vector2 = spinningPoint.RotatedBy(radians * i + MathHelper.ToRadians(NPC.ai[2]) * starDir);
if (Main.rand.NextBool(healingStarChance) && !death)
{
@@ -1419,6 +1433,7 @@ namespace CalamityMod.NPCs.Providence
}
text = false;
starDir *= -1;
AIState = (int)Phase.PhaseChange;
NPC.localAI[2] = attackDelayAfterCocoon;
NPC.TargetClosest();
@@ -1515,6 +1530,10 @@ namespace CalamityMod.NPCs.Providence
case (int)Phase.SpearCocoon:
borderPosition ??= NPC.Center;
borderPosition = Vector2.Lerp(borderPosition.Value, NPC.Center, 0.02f);
if (!targetDead && !getFuckedAI)
{
if (NPC.velocity.Length() <= 2f)
@@ -1570,7 +1589,7 @@ namespace CalamityMod.NPCs.Providence
spearRateIncrease = 1f;
float radialOffset = MathHelper.Lerp(0.2f, 0.4f, spearRateIncrease);
calamityGlobalNPC.newAI[1] += radialOffset;
calamityGlobalNPC.newAI[1] += radialOffset * spearDir;
}
calamityGlobalNPC.newAI[2] += 1f;
@@ -1596,7 +1615,9 @@ namespace CalamityMod.NPCs.Providence
NPC.ai[3] += 1f;
if (NPC.ai[3] >= phaseTime)
{
AIState = (int)Phase.PhaseChange;
spearDir *= -1;
NPC.localAI[2] = attackDelayAfterCocoon;
NPC.TargetClosest();
}
@@ -1875,7 +1896,7 @@ namespace CalamityMod.NPCs.Providence
public float CalculateBurnIntensity(float attackDelayAfterCocoon = 1f)
{
float distanceToTarget = Vector2.Distance(Main.player[NPC.target].Center, NPC.Center);
float distanceToTarget = Vector2.Distance(Main.player[NPC.target].Center, borderPosition ?? NPC.Center);
float aiTimer = NPC.ai[3];
// This bool is only relevant for non-Zenith enraged AI
@@ -1884,7 +1905,7 @@ namespace CalamityMod.NPCs.Providence
float baseDistance = 2800f;
float shorterFlameCocoonDistance = (CalamityWorld.death || fullPower) ? 600f : CalamityWorld.revenge ? 400f : Main.expertMode ? 200f : 0f;
float shorterSpearCocoonDistance = (CalamityWorld.death || fullPower) ? 1000f : CalamityWorld.revenge ? 650f : Main.expertMode ? 300f : 0f;
float shorterDistance = AIState == (int)Phase.FlameCocoon ? shorterFlameCocoonDistance : shorterSpearCocoonDistance;
float shorterDistance = baseDistance - (AIState == (int)Phase.FlameCocoon ? shorterFlameCocoonDistance : shorterSpearCocoonDistance);
bool guardianAlive = false;
if (CalamityGlobalNPC.holyBossAttacker != -1 && Main.npc[CalamityGlobalNPC.holyBossAttacker].active)
@@ -1907,11 +1928,10 @@ namespace CalamityMod.NPCs.Providence
// Distance does not get shorter if in GFB / Guardians are alive
if (!guardianAlive && NPC.localAI[1] < (float)BossMode.Rainbow)
{
maxDistance = baseDistance;
if (AIState == (int)Phase.FlameCocoon || AIState == (int)Phase.SpearCocoon)
maxDistance -= shorterDistance * shorterDistanceFade;
maxDistance = MathHelper.Lerp(baseDistance, shorterDistance, shorterDistanceFade);
else if (attackDelayAfterCocoon > 1f)
maxDistance -= shorterDistance * (NPC.localAI[2] / attackDelayAfterCocoon);
maxDistance = MathHelper.Lerp(baseDistance, shorterDistance, (NPC.localAI[2] / attackDelayAfterCocoon));
}
float drawFireDistanceStart = maxDistance - 800f;
@@ -2566,10 +2586,10 @@ namespace CalamityMod.NPCs.Providence
shader.Parameters["colorMult"].SetValue(prov.hasBeenGivenFullPower ? 7.65f : 7.35f); //I want you to know it took considerable restraint to deliberately misspell colour.
shader.Parameters["time"].SetValue(Main.GlobalTimeWrappedHourly);
shader.Parameters["radius"].SetValue(borderDistance);
shader.Parameters["anchorPoint"].SetValue(npc.Center);
shader.Parameters["anchorPoint"].SetValue(prov.borderPosition ?? npc.Center);
shader.Parameters["screenPosition"].SetValue(Main.screenPosition);
shader.Parameters["screenSize"].SetValue(Main.ScreenSize.ToVector2());
shader.Parameters["burnIntensity"].SetValue(holyInfernoIntensity);
shader.Parameters["burnIntensity"].SetValue(holyInfernoIntensity*0.5f + 0.5f);
shader.Parameters["playerPosition"].SetValue(target.Center);
shader.Parameters["maxOpacity"].SetValue(maxOpacity);
shader.Parameters["day"].SetValue(!prov.hasBeenGivenFullPower);
@@ -2866,6 +2886,14 @@ namespace CalamityMod.NPCs.Providence
// These will be used for almost every single one of her projectiles, so it's useful to have.
public static class ProvUtils
{
/// <summary>
/// This lease should be used to draw all of a projectile's effects onto directly, then be drawn onto the screen as one. This is for opacity reasons
/// </summary>
public static RenderTargetLease PrimaryLease { get => field ??= ScreenspaceTargetPool.Shared.Rent(Main.instance.GraphicsDevice); set; }
/// <summary>
/// This should be used for secondary effects like trails, then drawn to PrimaryLease. This is for opacity reasons.
/// </summary>
public static RenderTargetLease SecondaryLease { get => field ??= ScreenspaceTargetPool.Shared.Rent(Main.instance.GraphicsDevice); set; }
public static bool StandardAI() => (CalamityGlobalNPC.holyBoss == -1 || !Main.npc[CalamityGlobalNPC.holyBoss].Calamity().CurrentlyEnraged) && !Main.zenithWorld;
public static int CalculateProvidenceDamage(this int damage)
+4 -1
View File
@@ -41,6 +41,7 @@ namespace CalamityMod.Projectiles.Boss
Projectile.penetrate = 1;
Projectile.timeLeft = TimeLeft;
CooldownSlot = ImmunityCooldownID.Bosses;
Projectile.scale = 0;
}
public override void OnSpawn(IEntitySource source)
@@ -66,6 +67,8 @@ namespace CalamityMod.Projectiles.Boss
public override void AI()
{
if (Projectile.scale < 1)
Projectile.scale += 0.05f;
ProvUtils.ApplyGFBDamage(Projectile, 180, 20);
Lighting.AddLight(Projectile.Center, 0.9f, 0.7f, 0f);
@@ -162,7 +165,7 @@ namespace CalamityMod.Projectiles.Boss
totalProjectiles *= 2;
float radians = MathHelper.TwoPi / totalProjectiles;
int type = ModContent.ProjectileType<HolyFire2>();
int type = ModContent.ProjectileType<HolyBlastFrags>();
float velocity = 5f;
Vector2 spinningPoint = new Vector2(0f, -velocity);
Vector2 additionalVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitX) * 2.5f;
+187
View File
@@ -0,0 +1,187 @@
using System;
using System.Linq;
using CalamityMod.Graphics.Primitives;
using CalamityMod.NPCs.Providence;
using CalamityMod.Particles;
using CalamityMod.Utilities.Daybreak;
using CalamityMod.Utilities.Daybreak.Buffers;
using CalamityMod.World;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.Audio;
using Terraria.Graphics.Shaders;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Boss
{
public class HolyBlastFrags : ModProjectile, ILocalizedModType
{
public override string Texture => "CalamityMod/Projectiles/Boss/HolyFire2";
public new string LocalizationCategory => "Projectiles.Boss";
public override void SetStaticDefaults()
{
ProjectileID.Sets.TrailCacheLength[Type] = 15;
ProjectileID.Sets.TrailingMode[Type] = 2;
Main.projFrames[Type] = 4;
}
public override void SetDefaults()
{
Projectile.width = 26;
Projectile.height = 26;
Projectile.hostile = true;
Projectile.ignoreWater = true;
Projectile.penetrate = -1;
Projectile.tileCollide = false;
Projectile.timeLeft = 600;
CooldownSlot = ImmunityCooldownID.Bosses;
}
public override void AI()
{
ProvUtils.ApplyGFBDamage(Projectile, 120, 10);
Lighting.AddLight(Projectile.Center, 0.3f, 0.225f, 0f);
Projectile.frameCounter++;
if (Projectile.frameCounter > 6)
{
Projectile.frame++;
Projectile.frameCounter = 0;
}
if (Projectile.frame > 3)
Projectile.frame = 0;
float maxVelocity = Projectile.ai[0] == 0f ? 7f : CalamityWorld.death ? 11f : CalamityWorld.revenge ? 10f : Main.expertMode ? 9f : 7f;
if (Math.Abs(Projectile.velocity.X) < maxVelocity)
Projectile.velocity.X *= 1.05f;
int playerTracker = Player.FindClosest(Projectile.Center, 1, 1);
Projectile.ai[1] += 1f;
if (Projectile.ai[1] < 180f && Projectile.ai[1] > 60f)
{
float projVelocityMult = Projectile.velocity.Length();
Vector2 playerDirection = Main.player[playerTracker].Center - Projectile.Center;
playerDirection.Normalize();
playerDirection *= projVelocityMult;
float inertia = !ProvUtils.StandardAI() ? 20f : 25f;
Projectile.velocity = (Projectile.velocity * (inertia - 1f) + playerDirection) / inertia;
Projectile.velocity.Normalize();
Projectile.velocity *= projVelocityMult;
}
float vel = Math.Clamp(((Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) / 2), 0f, 1f);
if (Projectile.timeLeft % 3 == 0)
GeneralParticleHandler.SpawnParticle(new GlowOrbParticle(Projectile.Center + new Vector2(Main.rand.NextFloat(15), 0).RotatedByRandom(MathHelper.TwoPi), Projectile.velocity.RotatedBy(Math.PI) * 0.2f, false, 10, Main.rand.NextFloat(0.8f, 1.2f), ProvUtils.GetProjectileColor(255)));
if (Main.rand.NextBool())
GeneralParticleHandler.SpawnParticle(new MediumMistParticle(Projectile.Center, Vector2.Zero, Color.LightSlateGray, Color.DarkSlateGray, Main.rand.NextFloat(vel), 150, MathHelper.ToRadians(Main.rand.NextFloat(-1f, 1f))));
Projectile.rotation = MathHelper.Lerp(0f, MathHelper.WrapAngle(Vector2.Zero.AngleTo(Projectile.velocity) + MathHelper.ToRadians(-90f)), Math.Clamp(vel, 0f, 1f));
}
public override Color? GetAlpha(Color lightColor) => ProvUtils.GetProjectileColor(lightColor);
public override bool PreDraw(ref Color lightColor)
{
Main.spriteBatch.End(out var ss);
var device = Main.instance.GraphicsDevice;
using var lease = RenderTargetPool.Shared.Rent(
device,
Main.screenWidth / 2,
Main.screenHeight / 2,
RenderTargetDescriptor.Default
);
using (lease.Scope(clearColor: Color.Transparent))
{
var list = Projectile.oldPos.Take(12).ToList();
list.Insert(0, Projectile.position + (Projectile.rotation+MathHelper.PiOver2 * Projectile.spriteDirection).ToRotationVector2() * 16f);
GameShaders.Misc["CalamityMod:ImpFlameTrail"].SetShaderTexture(ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/Trails/ScarletDevilStreak"));
PrimitiveRenderer.RenderTrail(list.ToArray(), new(FireWidthFunction, FireColorFunction, (_, _) => Projectile.Size * 0.5f, smoothen: true, pixelate: false, shader: GameShaders.Misc["CalamityMod:ImpFlameTrail"], useUnscaledMatrices: true), Projectile.oldPos.Length + 32);
}
Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Main.Transform);
Main.spriteBatch.Draw(lease.Target, Vector2.Zero, null, Color.White, 0f, Vector2.Zero, 2f, SpriteEffects.None, 0f);
Main.spriteBatch.End();
Main.spriteBatch.Begin(ss);
Texture2D texture = ProvUtils.StandardAI() ? Terraria.GameContent.TextureAssets.Projectile[Type].Value : ModContent.Request<Texture2D>("CalamityMod/Projectiles/Boss/HolyFire2Night").Value;
int framing = texture.Height / Main.projFrames[Type];
int y6 = framing * Projectile.frame;
Projectile.DrawBackglow(ProvUtils.GetProjectileColor(lightColor, true), 4f, texture);
Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, framing)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, framing / 2f), Projectile.scale, SpriteEffects.None, 0);
return false;
}
public float FireWidthFunction(float completion, Vector2 pos)
{
float width;
float maxBodyWidth = 38f * Projectile.scale;
float curveRatio = 0.2f;
var positions = Projectile.oldPos.ToList();
positions.RemoveAll(x => x == Vector2.Zero);
// Crop the tip of the trail into a conic shape.
if (completion < curveRatio)
width = MathF.Pow(completion / curveRatio, 0.5f) * maxBodyWidth;
else
width = Utils.Remap(completion, curveRatio, 1f, maxBodyWidth, 0f);
// Pulse inwards and outwards over time.
float pulseInterpolant = MathF.Cos(MathHelper.Pi * completion - Main.GlobalTimeWrappedHourly * 20f) * 0.5f + 0.5f;
float additionalPulseWidth = MathHelper.Lerp(0f, 12f, pulseInterpolant);
return (width + additionalPulseWidth) * positions.Count() / (float)ProjectileID.Sets.TrailCacheLength[Type];
}
public Color FireColorFunction(float completion, Vector2 pos)
{
Color mainColor = ProvUtils.GetProjectileColor(255);
Color endColor = Color.Lerp(mainColor, Color.Transparent, Utils.GetLerpValue(0.8f, 1f, completion, true));
return Color.Lerp(mainColor, endColor, completion) * Projectile.Opacity;
}
public override void OnKill(int timeLeft)
{
SoundEngine.PlaySound(SoundID.Item20, Projectile.Center);
Projectile.position.X = Projectile.position.X + (Projectile.width / 2);
Projectile.position.Y = Projectile.position.Y + (Projectile.height / 2);
Projectile.width = 40;
Projectile.height = 40;
Projectile.position.X = Projectile.position.X - (Projectile.width / 2);
Projectile.position.Y = Projectile.position.Y - (Projectile.height / 2);
int dustType = ProvUtils.GetDustID();
for (int i = 0; i < 5; i++)
{
int holyDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f);
Main.dust[holyDust].noGravity = true;
if (Main.rand.NextBool())
{
Main.dust[holyDust].scale = 0.5f;
Main.dust[holyDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f;
}
}
for (int j = 0; j < 10; j++)
{
int holyDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 3f);
Main.dust[holyDust2].noGravity = true;
holyDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f);
Main.dust[holyDust2].noGravity = true;
}
}
public override void OnHitPlayer(Player target, Player.HurtInfo info)
{
// If the player is dodging, don't apply debuffs
if (info.Damage <= 0 || target.creativeGodMode)
return;
ProvUtils.ApplyDebuffs(target, 120);
}
}
}
+3
View File
@@ -32,6 +32,7 @@ namespace CalamityMod.Projectiles.Boss
Projectile.penetrate = -1;
Projectile.tileCollide = false;
CooldownSlot = ImmunityCooldownID.Bosses;
Projectile.scale = 0;
}
public override void OnSpawn(IEntitySource source)
@@ -46,6 +47,8 @@ namespace CalamityMod.Projectiles.Boss
}
public override void AI()
{
if (Projectile.scale < 1)
Projectile.scale += 0.1f;
ProvUtils.ApplyGFBDamage(Projectile, 120, 20);
Lighting.AddLight(Projectile.Center, 0.45f, 0.35f, 0f);
+159 -55
View File
@@ -1,11 +1,16 @@
using System;
using System.Linq;
using CalamityMod.Dusts;
using CalamityMod.Graphics.Primitives;
using CalamityMod.NPCs.Providence;
using CalamityMod.Particles;
using CalamityMod.Utilities.Daybreak;
using CalamityMod.Utilities.Daybreak.Buffers;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.Audio;
using Terraria.Graphics.Shaders;
using Terraria.ID;
using Terraria.ModLoader;
@@ -17,6 +22,11 @@ namespace CalamityMod.Projectiles.Boss
public new string LocalizationCategory => "Projectiles.Boss";
public override string Texture => "CalamityMod/Projectiles/StarProj";
public override void SetStaticDefaults()
{
ProjectileID.Sets.TrailCacheLength[Type] = 32;
ProjectileID.Sets.TrailingMode[Type] = 2;
}
public override void SetDefaults()
{
Projectile.localAI[1] = Main.rand.NextFloat(30f);
@@ -24,11 +34,11 @@ namespace CalamityMod.Projectiles.Boss
Projectile.hostile = true;
Projectile.ignoreWater = true;
Projectile.tileCollide = false;
Projectile.alpha = 255;
CooldownSlot = ImmunityCooldownID.Bosses;
Projectile.penetrate = 1;
Projectile.timeLeft = 200;
Projectile.Calamity().DealsDefenseDamage = true;
Projectile.MaxUpdates = 4;
}
public override void AI()
@@ -44,74 +54,168 @@ namespace CalamityMod.Projectiles.Boss
started = true;
}
if (Projectile.ai[0] < 240f)
if (Projectile.FinalExtraUpdate())
{
Projectile.ai[0] += 1f;
if (Projectile.ai[0] < 240f)
{
Projectile.ai[0] += 1f;
if (Projectile.timeLeft < 160)
Projectile.timeLeft = 160;
if (Projectile.timeLeft < 160)
Projectile.timeLeft = 160;
}
if (Main.getGoodWorld)
{
if (Projectile.velocity.Length() < 12f && Projectile.ai[1] == 0f)
{
Projectile.velocity *= 1.02f;
}
else
{
Projectile.ai[1] += 0.05f;
Projectile.velocity *= MathHelper.Lerp(0.95f, 1.05f, (float)Math.Abs(Math.Sin(Projectile.ai[1])));
}
}
else if (Projectile.velocity.Length() < 16f)
Projectile.velocity *= 1.01f;
Projectile.localAI[1] += (Projectile.velocity.Length() / 20);
}
if (Main.getGoodWorld)
{
if (Projectile.velocity.Length() < 12f && Projectile.ai[1] == 0f)
{
Projectile.velocity *= 1.02f;
}
else
{
Projectile.ai[1] += 0.05f;
Projectile.velocity *= MathHelper.Lerp(0.95f, 1.05f, (float)Math.Abs(Math.Sin(Projectile.ai[1])));
}
}
else if (Projectile.velocity.Length() < 16f)
Projectile.velocity *= 1.01f;
Projectile.localAI[1] += (Projectile.velocity.Length() / 20);
Color col = ProvUtils.GetProjectileColor(255);
float vel = MathHelper.Clamp(Projectile.velocity.Length() / 5, 0, 1.5f);
GlowOrbParticle p = new GlowOrbParticle(Projectile.Center, Projectile.velocity + new Vector2(Main.rand.NextFloat(vel * 2), 0).RotatedByRandom(MathHelper.TwoPi), false, 4, 1f, col);
GeneralParticleHandler.SpawnParticle(p);
//Trail for visibilty
GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center + Projectile.velocity, Vector2.Zero, col, "CalamityMod/Particles/BlastCone", new Vector2(3f, 2f), Vector2.Zero.AngleFrom(Projectile.velocity), 1f, 0f, 3));
Projectile.position -= (Projectile.velocity / Projectile.MaxUpdates) * (Projectile.MaxUpdates - 1);
}
public override bool PreDraw(ref Color lightColor)
{
float lerpMult = MathHelper.Lerp(0.5f, 1.5f, Math.Abs(MathF.Sin(Projectile.localAI[1] / 10f)));
Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value;
Vector2 drawPos = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY);
Color baseColor = ProvUtils.GetProjectileColor(255, true) * 4;
Color baseColor2 = ProvUtils.GetProjectileColor(255);
baseColor.A = 0;
baseColor *= lerpMult;
baseColor2 *= lerpMult;
Vector2 origin = texture.Size() / 2f;
Vector2 scale = new Vector2(0.5f, 1f) * ((lerpMult-1)*0.5f + 1f);
Main.spriteBatch.End(out var ss);
var device = Main.instance.GraphicsDevice;
SpriteEffects spriteEffects = SpriteEffects.None;
if (Projectile.spriteDirection == -1)
spriteEffects = SpriteEffects.FlipHorizontally;
using (Main.spriteBatch.Scope())
{
using (ProvUtils.SecondaryLease.Scope(clearColor: Color.Transparent))
{
Projectile.rotation += MathHelper.ToRadians(lerpMult * 2f);
Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Matrix.Identity);
var tex = GeneralParticleHandler.GetTexture(GeneralParticleHandler.particleIDsByTypes[typeof(BloomParticle)]);
var len = Math.Min(Projectile.oldPos.Length, 32);
for (var i = 0; i < len; i++)
{
Vector2 drawPos = Projectile.oldPos[i] + Projectile.Size*0.5f - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY);
Color color = FireColorFunction(i / (float)len, Projectile.oldPos[i]);
var color2 = ProvUtils.GetProjectileColor(255,true);
float width = FireWidthFunction(i / (float)len, Projectile.oldPos[i]);
Main.spriteBatch.Draw(tex, drawPos, null, (color2 with { A = 0 }) * (1 - i / (float)len), 0f, tex.Size() * 0.5f, new Vector2(width) / tex.Width, SpriteEffects.None, 0f);
Main.spriteBatch.Draw(tex, drawPos, null, (color with { A = 0}) * (1- i / (float)len), 0f, tex.Size() * 0.5f, new Vector2(width) /tex.Width * 0.25f, SpriteEffects.None, 0f);
}
Main.spriteBatch.End();
}
}
float upRight = MathHelper.PiOver4;
float up = MathHelper.PiOver2;
float upLeft = 3f * MathHelper.PiOver4;
float left = MathHelper.Pi;
Main.EntitySpriteDraw(texture, drawPos, null, baseColor, upLeft + Projectile.rotation, origin, scale, spriteEffects, 0);
Main.EntitySpriteDraw(texture, drawPos, null, baseColor, upRight - Projectile.rotation, origin, scale, spriteEffects, 0);
Main.EntitySpriteDraw(texture, drawPos, null, baseColor2, upLeft + Projectile.rotation, origin, scale * 0.6f, spriteEffects, 0);
Main.EntitySpriteDraw(texture, drawPos, null, baseColor2, upRight - Projectile.rotation, origin, scale * 0.6f, spriteEffects, 0);
Main.EntitySpriteDraw(texture, drawPos, null, baseColor, up + Projectile.rotation, origin, scale * 0.6f, spriteEffects, 0);
Main.EntitySpriteDraw(texture, drawPos, null, baseColor, left - Projectile.rotation, origin, scale * 0.6f, spriteEffects, 0);
Main.EntitySpriteDraw(texture, drawPos, null, baseColor2, up + Projectile.rotation, origin, scale * 0.36f, spriteEffects, 0);
Main.EntitySpriteDraw(texture, drawPos, null, baseColor2, left - Projectile.rotation, origin, scale * 0.36f, spriteEffects, 0);
using (ProvUtils.PrimaryLease.Scope(clearColor: Color.Transparent))
{
Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Matrix.Identity);
Main.spriteBatch.Draw(ProvUtils.SecondaryLease.Target, Vector2.Zero, null, Color.White * 0.75f, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
float lerpMult = MathHelper.Lerp(0.5f, 1.5f, Math.Abs(MathF.Sin(Projectile.localAI[1] / 10f)));
Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value;
Vector2 drawPos = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY);
Color baseColor = ProvUtils.GetProjectileColor(255, true) * 4;
Color baseColor2 = ProvUtils.GetProjectileColor(255);
baseColor.A = 0;
baseColor *= lerpMult;
baseColor2 *= lerpMult;
Vector2 origin = texture.Size() / 2f;
Vector2 scale = new Vector2(0.5f, 1f) * ((lerpMult - 1) * 0.5f + 1f);
SpriteEffects spriteEffects = SpriteEffects.None;
if (Projectile.spriteDirection == -1)
spriteEffects = SpriteEffects.FlipHorizontally;
Projectile.rotation += MathHelper.ToRadians(lerpMult * 2f);
float upRight = MathHelper.PiOver4;
float up = MathHelper.PiOver2;
float upLeft = 3f * MathHelper.PiOver4;
float left = MathHelper.Pi;
Main.EntitySpriteDraw(texture, drawPos, null, baseColor, upLeft + Projectile.rotation, origin, scale, spriteEffects, 0);
Main.EntitySpriteDraw(texture, drawPos, null, baseColor, upRight - Projectile.rotation, origin, scale, spriteEffects, 0);
Main.EntitySpriteDraw(texture, drawPos, null, baseColor2, upLeft + Projectile.rotation, origin, scale * 0.6f, spriteEffects, 0);
Main.EntitySpriteDraw(texture, drawPos, null, baseColor2, upRight - Projectile.rotation, origin, scale * 0.6f, spriteEffects, 0);
Main.EntitySpriteDraw(texture, drawPos, null, baseColor, up + Projectile.rotation, origin, scale * 0.6f, spriteEffects, 0);
Main.EntitySpriteDraw(texture, drawPos, null, baseColor, left - Projectile.rotation, origin, scale * 0.6f, spriteEffects, 0);
Main.EntitySpriteDraw(texture, drawPos, null, baseColor2, up + Projectile.rotation, origin, scale * 0.36f, spriteEffects, 0);
Main.EntitySpriteDraw(texture, drawPos, null, baseColor2, left - Projectile.rotation, origin, scale * 0.36f, spriteEffects, 0);
scale = new Vector2(1f, 1f);
texture = ModContent.Request<Texture2D>("CalamityMod/Particles/GlowOrbParticle").Value;
using (Main.spriteBatch.Scope())
{
Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Additive, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Matrix.Identity);
Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition, null, baseColor2, 0, texture.Size() * 0.5f, 1f, 0, 0f);
Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition, null, Color.White, 0, texture.Size() * 0.5f, 0.5f, 0, 0f);
Main.spriteBatch.End();
}
Main.spriteBatch.End();
}
Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Main.Transform);
Main.spriteBatch.Draw(ProvUtils.PrimaryLease.Target, Vector2.Zero, null, Color.White * Projectile.Opacity, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
Main.spriteBatch.End();
Main.spriteBatch.Begin(ss);
return false;
}
public float FireWidthFunction(float completion, Vector2 pos)
{
float width;
float maxBodyWidth = 32f * Projectile.scale;
float curveRatio = 0.2f;
var positions = Projectile.oldPos.ToList();
positions.RemoveAll(x => x == Vector2.Zero);
// Crop the tip of the trail into a conic shape.
if (completion < curveRatio)
width = MathF.Pow(completion / curveRatio, 0.5f) * maxBodyWidth;
else
width = Utils.Remap(completion, curveRatio, 1f, maxBodyWidth, 0f);
// Pulse inwards and outwards over time.
float pulseInterpolant = MathF.Cos(MathHelper.Pi * completion - Main.GlobalTimeWrappedHourly * 20f) * 0.5f + 0.5f;
float additionalPulseWidth = MathHelper.Lerp(0f, 12f, pulseInterpolant);
return (width + additionalPulseWidth) * positions.Count() / (float)ProjectileID.Sets.TrailCacheLength[Type];
}
public Color FireColorFunction(float completion, Vector2 pos)
{
Color mainColor = ProvUtils.GetProjectileColor(255) * 1.3f;
Color endColor = Color.Lerp(mainColor, Color.Transparent, Utils.GetLerpValue(0.8f, 1f, completion, true));
return Color.Lerp(mainColor, endColor, completion) * Projectile.Opacity;
}
public float FireCoreWidthFunction(float completion, Vector2 pos)
{
float width;
float maxBodyWidth = Projectile.scale * 24;
float curveRatio = 0.25f;
var positions = Projectile.oldPos.ToList();
positions.RemoveAll(x => x == Vector2.Zero);
if (completion < curveRatio)
width = MathF.Sin(completion / curveRatio * MathHelper.PiOver2) * maxBodyWidth + curveRatio;
else
width = Utils.Remap(completion, curveRatio, 1f, maxBodyWidth, 0f);
return width * positions.Count() / (float)ProjectileID.Sets.TrailCacheLength[Type];
}
public Color FireCoreColorFunction(float completion, Vector2 pos)
{
Color mainColor = ProvUtils.GetProjectileColor(255);
Color tipColor = Color.Lerp(mainColor, Color.Transparent, Utils.GetLerpValue(0.8f, 1f, completion, true));
Color fullBodyColor = Color.Lerp(mainColor, tipColor, completion);
return Color.Lerp(fullBodyColor, Color.White, 0.175f) * Projectile.Opacity;
}
public override void OnKill(int timeLeft)
{
+62 -1
View File
@@ -1,11 +1,16 @@
using System;
using System.Linq;
using CalamityMod.Graphics.Primitives;
using CalamityMod.NPCs.Providence;
using CalamityMod.Particles;
using CalamityMod.Utilities.Daybreak;
using CalamityMod.Utilities.Daybreak.Buffers;
using CalamityMod.World;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.Audio;
using Terraria.Graphics.Shaders;
using Terraria.ID;
using Terraria.ModLoader;
@@ -30,10 +35,16 @@ namespace CalamityMod.Projectiles.Boss
Projectile.tileCollide = false;
Projectile.timeLeft = 600;
CooldownSlot = ImmunityCooldownID.Bosses;
ProjectileID.Sets.TrailCacheLength[Type] = 15;
ProjectileID.Sets.TrailingMode[Type] = 2;
}
public override void AI()
{
ProjectileID.Sets.TrailCacheLength[Type] = 15;
ProjectileID.Sets.TrailingMode[Type] = 2;
ProvUtils.ApplyGFBDamage(Projectile, 120, 10);
Lighting.AddLight(Projectile.Center, 0.3f, 0.225f, 0f);
@@ -68,7 +79,8 @@ namespace CalamityMod.Projectiles.Boss
float vel = Math.Clamp(((Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) / 2), 0f, 1f);
GeneralParticleHandler.SpawnParticle(new GlowOrbParticle(Projectile.Center + new Vector2(Main.rand.NextFloat(15), 0).RotatedByRandom(MathHelper.TwoPi), Projectile.velocity.RotatedBy(Math.PI) * 0.2f, false, 10, Main.rand.NextFloat(0.8f, 1.2f), ProvUtils.GetProjectileColor(255)));
if (Projectile.timeLeft % 3 == 0)
GeneralParticleHandler.SpawnParticle(new GlowOrbParticle(Projectile.Center + new Vector2(Main.rand.NextFloat(15), 0).RotatedByRandom(MathHelper.TwoPi), Projectile.velocity.RotatedBy(Math.PI) * 0.2f, false, 10, Main.rand.NextFloat(0.8f, 1.2f), ProvUtils.GetProjectileColor(255)));
if (Main.rand.NextBool())
GeneralParticleHandler.SpawnParticle(new MediumMistParticle(Projectile.Center, Vector2.Zero, Color.LightSlateGray, Color.DarkSlateGray, Main.rand.NextFloat(vel), 150, MathHelper.ToRadians(Main.rand.NextFloat(-1f, 1f))));
@@ -80,6 +92,30 @@ namespace CalamityMod.Projectiles.Boss
public override bool PreDraw(ref Color lightColor)
{
Main.spriteBatch.End(out var ss);
var device = Main.instance.GraphicsDevice;
using var lease = RenderTargetPool.Shared.Rent(
device,
Main.screenWidth / 2,
Main.screenHeight / 2,
RenderTargetDescriptor.Default
);
using (lease.Scope(clearColor: Color.Transparent))
{
var list = Projectile.oldPos.Take(8).ToList();
list.Insert(0, Projectile.position + (Projectile.rotation + MathHelper.PiOver2 * Projectile.spriteDirection).ToRotationVector2() * 16f);
GameShaders.Misc["CalamityMod:ImpFlameTrail"].SetShaderTexture(ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/Trails/ScarletDevilStreak"));
PrimitiveRenderer.RenderTrail(list.ToArray(), new(FireWidthFunction, FireColorFunction, (_, _) => Projectile.Size * 0.5f, smoothen: true, pixelate: false, shader: GameShaders.Misc["CalamityMod:ImpFlameTrail"], useUnscaledMatrices: true), Projectile.oldPos.Length + 32);
}
Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Main.Transform);
Main.spriteBatch.Draw(lease.Target, Vector2.Zero, null, Color.White * 0.75f, 0f, Vector2.Zero, 2f, SpriteEffects.None, 0f);
Main.spriteBatch.End();
Main.spriteBatch.Begin(ss);
Texture2D texture = ProvUtils.StandardAI() ? Terraria.GameContent.TextureAssets.Projectile[Type].Value : ModContent.Request<Texture2D>("CalamityMod/Projectiles/Boss/HolyFire2Night").Value;
int framing = texture.Height / Main.projFrames[Type];
int y6 = framing * Projectile.frame;
@@ -87,6 +123,31 @@ namespace CalamityMod.Projectiles.Boss
Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, framing)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, framing / 2f), Projectile.scale, SpriteEffects.None, 0);
return false;
}
public float FireWidthFunction(float completion, Vector2 pos)
{
float width;
float maxBodyWidth = 16f * Projectile.scale;
float curveRatio = 0.2f;
var positions = Projectile.oldPos.ToList();
positions.RemoveAll(x => x == Vector2.Zero);
// Crop the tip of the trail into a conic shape.
if (completion < curveRatio)
width = MathF.Pow(completion / curveRatio, 0.5f) * maxBodyWidth;
else
width = Utils.Remap(completion, curveRatio, 1f, maxBodyWidth, 0f);
// Pulse inwards and outwards over time.
float pulseInterpolant = MathF.Cos(MathHelper.Pi * completion - Main.GlobalTimeWrappedHourly * 20f) * 0.5f + 0.5f;
float additionalPulseWidth = MathHelper.Lerp(0f, 12f, pulseInterpolant);
return (width + additionalPulseWidth) * positions.Count() / (float)ProjectileID.Sets.TrailCacheLength[Type];
}
public Color FireColorFunction(float completion, Vector2 pos)
{
Color mainColor = ProvUtils.GetProjectileColor(255);
Color endColor = Color.Lerp(mainColor, Color.Transparent, Utils.GetLerpValue(0.8f, 1f, completion, true));
return Color.Lerp(mainColor, endColor, completion) * Projectile.Opacity;
}
public override void OnKill(int timeLeft)
{
+138 -39
View File
@@ -1,7 +1,11 @@
using System;
using System.Linq;
using CalamityMod.Dusts;
using CalamityMod.Enums;
using CalamityMod.NPCs.Providence;
using CalamityMod.Particles;
using CalamityMod.Utilities.Daybreak;
using CalamityMod.Utilities.Daybreak.Buffers;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
@@ -16,7 +20,11 @@ namespace CalamityMod.Projectiles.Boss
{
public new string LocalizationCategory => "Projectiles.Boss";
public override string Texture => "CalamityMod/Projectiles/StarProj";
public override void SetStaticDefaults()
{
ProjectileID.Sets.TrailCacheLength[Type] = 32;
ProjectileID.Sets.TrailingMode[Type] = 2;
}
public override void SetDefaults()
{
Projectile.localAI[1] = Main.rand.NextFloat(30f);
@@ -25,9 +33,9 @@ namespace CalamityMod.Projectiles.Boss
Projectile.hostile = true;
Projectile.ignoreWater = true;
Projectile.tileCollide = false;
Projectile.alpha = 255;
Projectile.penetrate = 1;
Projectile.timeLeft = 200;
Projectile.MaxUpdates = 4;
}
public override void OnSpawn(IEntitySource source)
@@ -46,17 +54,21 @@ namespace CalamityMod.Projectiles.Boss
public override void AI()
{
Lighting.AddLight(Projectile.Center, 0f, 0.6f, 0f);
if (Projectile.ai[0] < 240f)
if (Projectile.FinalExtraUpdate())
{
Projectile.ai[0] += 1f;
if (Projectile.ai[0] < 240f)
{
Projectile.ai[0] += 1f;
if (Projectile.timeLeft < 160)
Projectile.timeLeft = 160;
if (Projectile.timeLeft < 160)
Projectile.timeLeft = 160;
}
if (Projectile.velocity.Length() < 16f)
Projectile.velocity *= 1.01f;
}
if (Projectile.velocity.Length() < 16f)
Projectile.velocity *= 1.01f;
Projectile.position -= (Projectile.velocity / Projectile.MaxUpdates) * (Projectile.MaxUpdates - 1);
int index = Player.FindClosest(Projectile.position, Projectile.width, Projectile.height);
Player player = Main.player[index];
@@ -71,54 +83,141 @@ namespace CalamityMod.Projectiles.Boss
NetMessage.SendData(MessageID.SpiritHeal, -1, -1, null, index, healAmt);
Projectile.Kill();
}
Color col = new Color(54, 209, 54);
Particle spark = new GlowSparkParticle(Projectile.Center, -Projectile.velocity * 0.8f, false, 5, 0.06f, col * 0.85f, new Vector2(1, 0.3f), true, false, 1.5f);
GeneralParticleHandler.SpawnParticle(spark);
}
public override bool PreDraw(ref Color lightColor)
{
float vel = Projectile.velocity.Length() / 8;
Projectile.localAI[1] += vel;
Main.spriteBatch.End(out var ss);
var device = Main.instance.GraphicsDevice;
Texture2D drawTexture = Terraria.GameContent.TextureAssets.Projectile[Type].Value;
Color brightGreen = new Color(54, 209, 54, 0);
Vector2 projDirection = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY);
Vector2 halfTextureSize = drawTexture.Size() / 2f;
Color halfBrightGreen = brightGreen * 0.5f;
float timeLeftColorScale = MathHelper.Lerp(0.5f, 1.5f, Math.Abs(MathF.Sin(Projectile.localAI[1] / 10f)));
Projectile.rotation += MathHelper.ToRadians(timeLeftColorScale * 2f);
Vector2 timeLeftDrawEffect = new Vector2(0.5f, 1f) * timeLeftColorScale;
Vector2 timeLeftDrawEffect2 = new Vector2(0.5f, 1f) * timeLeftColorScale;
brightGreen *= timeLeftColorScale;
halfBrightGreen *= timeLeftColorScale;
using (ProvUtils.SecondaryLease.Scope(clearColor: Color.Transparent))
{
Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Matrix.Identity);
var tex = GeneralParticleHandler.GetTexture(GeneralParticleHandler.particleIDsByTypes[typeof(BloomParticle)]);
var len = Math.Min(Projectile.oldPos.Length, 32);
for (var i = 0; i < len; i++)
{
Vector2 drawPos = Projectile.oldPos[i] + Projectile.Size * 0.5f - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY);
Color color = FireCoreColorFunction(i / (float)len, Projectile.oldPos[i]);
var color2 = new Color(0, 25, 0);
float width = FireWidthFunction(i / (float)len, Projectile.oldPos[i]);
Main.spriteBatch.Draw(tex, drawPos, null, (color2 with { A = 0 }) * (1 - i / (float)len), 0f, tex.Size() * 0.5f, new Vector2(width) / tex.Width, SpriteEffects.None, 0f);
Main.spriteBatch.Draw(tex, drawPos, null, (color with { A = 0 }) * (1 - i / (float)len), 0f, tex.Size() * 0.5f, new Vector2(width) / tex.Width * 0.25f, SpriteEffects.None, 0f);
}
Main.spriteBatch.End();
}
Vector2 position3 = projDirection + Projectile.velocity.SafeNormalize(Vector2.Zero) * Utils.GetLerpValue(0.5f, 1f, Projectile.localAI[0] / 60f, clamped: true) * 0;
using (ProvUtils.PrimaryLease.Scope(clearColor: Color.Transparent))
{
SpriteEffects spriteEffects = SpriteEffects.None;
if (Projectile.spriteDirection == -1)
spriteEffects = SpriteEffects.FlipHorizontally;
Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Matrix.Identity);
Main.spriteBatch.Draw(ProvUtils.SecondaryLease.Target, Vector2.Zero, null, Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
Main.EntitySpriteDraw(drawTexture, position3, null, brightGreen, MathHelper.PiOver2 - Projectile.rotation, halfTextureSize, timeLeftDrawEffect, spriteEffects, 0);
Main.EntitySpriteDraw(drawTexture, position3, null, brightGreen, 0f - Projectile.rotation, halfTextureSize, timeLeftDrawEffect2, spriteEffects, 0);
Main.EntitySpriteDraw(drawTexture, position3, null, halfBrightGreen, MathHelper.PiOver2 - Projectile.rotation, halfTextureSize, timeLeftDrawEffect * 0.6f, spriteEffects, 0);
Main.EntitySpriteDraw(drawTexture, position3, null, halfBrightGreen, 0f - Projectile.rotation, halfTextureSize, timeLeftDrawEffect2 * 0.6f, spriteEffects, 0);
Main.EntitySpriteDraw(drawTexture, position3, null, brightGreen, MathHelper.PiOver4 + Projectile.rotation, halfTextureSize, timeLeftDrawEffect * 0.6f, spriteEffects, 0);
Main.EntitySpriteDraw(drawTexture, position3, null, brightGreen, MathHelper.PiOver4 * 3f + Projectile.rotation, halfTextureSize, timeLeftDrawEffect2 * 0.6f, spriteEffects, 0);
Main.EntitySpriteDraw(drawTexture, position3, null, halfBrightGreen, MathHelper.PiOver4 + Projectile.rotation, halfTextureSize, timeLeftDrawEffect * 0.36f, spriteEffects, 0);
Main.EntitySpriteDraw(drawTexture, position3, null, halfBrightGreen, MathHelper.PiOver4 * 3f + Projectile.rotation, halfTextureSize, timeLeftDrawEffect2 * 0.36f, spriteEffects, 0);
float vel = Projectile.velocity.Length() / 8;
Projectile.localAI[1] += vel;
Texture2D drawTexture = Terraria.GameContent.TextureAssets.Projectile[Type].Value;
Color brightGreen = new Color(54, 209, 54, 0);
Vector2 projDirection = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY);
Vector2 halfTextureSize = drawTexture.Size() / 2f;
Color halfBrightGreen = brightGreen * 0.5f;
float timeLeftColorScale = MathHelper.Lerp(0.5f, 1.5f, Math.Abs(MathF.Sin(Projectile.localAI[1] / 10f)));
Projectile.rotation += MathHelper.ToRadians(timeLeftColorScale * 2f);
Vector2 timeLeftDrawEffect = new Vector2(0.5f, 1f) * timeLeftColorScale;
Vector2 timeLeftDrawEffect2 = new Vector2(0.5f, 1f) * timeLeftColorScale;
brightGreen *= timeLeftColorScale;
halfBrightGreen *= timeLeftColorScale;
Vector2 position3 = projDirection + Projectile.velocity.SafeNormalize(Vector2.Zero) * Utils.GetLerpValue(0.5f, 1f, Projectile.localAI[0] / 60f, clamped: true) * 0;
SpriteEffects spriteEffects = SpriteEffects.None;
if (Projectile.spriteDirection == -1)
spriteEffects = SpriteEffects.FlipHorizontally;
Main.EntitySpriteDraw(drawTexture, position3, null, brightGreen, MathHelper.PiOver2 - Projectile.rotation, halfTextureSize, timeLeftDrawEffect, spriteEffects, 0);
Main.EntitySpriteDraw(drawTexture, position3, null, brightGreen, 0f - Projectile.rotation, halfTextureSize, timeLeftDrawEffect2, spriteEffects, 0);
Main.EntitySpriteDraw(drawTexture, position3, null, halfBrightGreen, MathHelper.PiOver2 - Projectile.rotation, halfTextureSize, timeLeftDrawEffect * 0.6f, spriteEffects, 0);
Main.EntitySpriteDraw(drawTexture, position3, null, halfBrightGreen, 0f - Projectile.rotation, halfTextureSize, timeLeftDrawEffect2 * 0.6f, spriteEffects, 0);
Main.EntitySpriteDraw(drawTexture, position3, null, brightGreen, MathHelper.PiOver4 + Projectile.rotation, halfTextureSize, timeLeftDrawEffect * 0.6f, spriteEffects, 0);
Main.EntitySpriteDraw(drawTexture, position3, null, brightGreen, MathHelper.PiOver4 * 3f + Projectile.rotation, halfTextureSize, timeLeftDrawEffect2 * 0.6f, spriteEffects, 0);
Main.EntitySpriteDraw(drawTexture, position3, null, halfBrightGreen, MathHelper.PiOver4 + Projectile.rotation, halfTextureSize, timeLeftDrawEffect * 0.36f, spriteEffects, 0);
Main.EntitySpriteDraw(drawTexture, position3, null, halfBrightGreen, MathHelper.PiOver4 * 3f + Projectile.rotation, halfTextureSize, timeLeftDrawEffect2 * 0.36f, spriteEffects, 0);
var scale = new Vector2(1f, 1f);
var texture = ModContent.Request<Texture2D>("CalamityMod/Particles/GlowOrbParticle").Value;
using (Main.spriteBatch.Scope())
{
Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Additive, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Matrix.Identity);
Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition, null, new Color(54, 209, 54), 0, texture.Size() * 0.5f, 1f, 0, 0f);
Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition, null, Color.White, 0, texture.Size() * 0.5f, 0.5f, 0, 0f);
Main.spriteBatch.End();
}
Main.spriteBatch.End();
}
Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Main.Transform);
Main.spriteBatch.Draw(ProvUtils.PrimaryLease.Target, Vector2.Zero, null, Color.White * Projectile.Opacity, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
Main.spriteBatch.End();
Main.spriteBatch.Begin(ss);
return false;
}
public float FireWidthFunction(float completion, Vector2 pos)
{
float width;
float maxBodyWidth = 32f * Projectile.scale;
float curveRatio = 0.2f;
var positions = Projectile.oldPos.ToList();
positions.RemoveAll(x => x == Vector2.Zero);
// Crop the tip of the trail into a conic shape.
if (completion < curveRatio)
width = MathF.Pow(completion / curveRatio, 0.5f) * maxBodyWidth;
else
width = Utils.Remap(completion, curveRatio, 1f, maxBodyWidth, 0f);
// Pulse inwards and outwards over time.
float pulseInterpolant = MathF.Cos(MathHelper.Pi * completion - Main.GlobalTimeWrappedHourly * 20f) * 0.5f + 0.5f;
float additionalPulseWidth = MathHelper.Lerp(0f, 12f, pulseInterpolant);
return (width + additionalPulseWidth) * positions.Count() / (float)ProjectileID.Sets.TrailCacheLength[Type];
}
public Color FireColorFunction(float completion, Vector2 pos)
{
Color mainColor = new Color(54, 209, 54) * 1.3f;
Color endColor = Color.Lerp(mainColor, Color.Transparent, Utils.GetLerpValue(0.8f, 1f, completion, true));
return Color.Lerp(mainColor, endColor, completion) * Projectile.Opacity;
}
public float FireCoreWidthFunction(float completion, Vector2 pos)
{
float width;
float maxBodyWidth = Projectile.scale * 24;
float curveRatio = 0.25f;
var positions = Projectile.oldPos.ToList();
positions.RemoveAll(x => x == Vector2.Zero);
if (completion < curveRatio)
width = MathF.Sin(completion / curveRatio * MathHelper.PiOver2) * maxBodyWidth + curveRatio;
else
width = Utils.Remap(completion, curveRatio, 1f, maxBodyWidth, 0f);
return width * positions.Count() / (float)ProjectileID.Sets.TrailCacheLength[Type];
}
public Color FireCoreColorFunction(float completion, Vector2 pos)
{
Color mainColor = new Color(54, 209, 54);
Color tipColor = Color.Lerp(mainColor, Color.Transparent, Utils.GetLerpValue(0.8f, 1f, completion, true));
Color fullBodyColor = Color.Lerp(mainColor, tipColor, completion);
return Color.Lerp(fullBodyColor, Color.White, 0.175f) * Projectile.Opacity;
}
public override void OnKill(int timeLeft)
{
SoundEngine.PlaySound(SoundID.Item14 with { Pitch = -0.3f, Volume = 0.7f }, Projectile.Center);
SoundStyle fireHeal = new("CalamityMod/Sounds/Custom/PlantyMushMine", 3);
SoundEngine.PlaySound(fireHeal with { Volume = 0.5f, Pitch = 0.3f }, Projectile.Center);
Color particleColor = new Color(54, 209, 54);
Color particleColor = new Color(54, 209, 54);
Color smokeColor = Color.Lerp(particleColor, Color.DarkSlateGray, 0.5f);
Particle pulse = new CustomPulse(Projectile.Center, Vector2.Zero, smokeColor, "CalamityMod/Particles/SoftRoundExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0f, 0.06f, 18);
GeneralParticleHandler.SpawnParticle(pulse);
+2 -1
View File
@@ -161,10 +161,11 @@ namespace CalamityMod.Projectiles.Boss
int blobAmt = !ProvUtils.StandardAI() ? 9 : 6;
if (Projectile.owner == Main.myPlayer)
{
Vector2 additionalBlobVelocity = new Vector2(Projectile.velocity.X * 0.1f, Projectile.velocity.Y);
Vector2 additionalBlobVelocity = new Vector2(Projectile.velocity.X, Projectile.velocity.Y);
for (int b = 0; b < blobAmt; b++)
{
Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f) + additionalBlobVelocity;
velocity.Y = -Math.Abs(velocity.Y);
if (Main.getGoodWorld)
velocity *= 2f;
+1 -4
View File
@@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Boss
Projectile.height = 12;
Projectile.hostile = true;
Projectile.penetrate = -1;
Projectile.timeLeft = 900;
Projectile.timeLeft = 120;
Projectile.scale = 1.5f;
CooldownSlot = ImmunityCooldownID.Bosses;
}
@@ -65,9 +65,6 @@ namespace CalamityMod.Projectiles.Boss
{
if (!inLava)
{
if (Projectile.velocity.Y < 0f)
Projectile.velocity.Y = 0f;
Projectile.velocity.Y += 0.15f;
}
}
+2 -2
View File
@@ -4748,7 +4748,7 @@ namespace CalamityMod.Projectiles
}
// Scuttler's Jewel projectiles can spawn either on-hit or on-kill, but only spawn once per projectile.
if (projectile.owner == Main.myPlayer && !projectile.npcProj && !projectile.trap && projectile.CountsAsClass<RogueDamageClass>())
if (projectile.owner == Main.myPlayer && !projectile.npcProj && !projectile.trap && projectile.CountsAsClass<RogueDamageClass>() && !CannotProc)
{
if (modPlayer.scuttlersJewel && stealthStrike && !JewelSpikeSpawned)
{
@@ -5262,7 +5262,7 @@ namespace CalamityMod.Projectiles
}
// Make sure the spike doesn't spawn again if it's already been spawned by on-hit.
if (modPlayer.scuttlersJewel && stealthStrike && !JewelSpikeSpawned)
if (modPlayer.scuttlersJewel && stealthStrike && !JewelSpikeSpawned && !CannotProc)
{
int damage = (int)player.GetTotalDamage<RogueDamageClass>().ApplyTo(16);
@@ -62,8 +62,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal
spamDelay--;
// Fire if the owner stops channeling or otherwise cannot use the weapon.
bool autoSpam = (Owner.Calamity().mouseRight && !Main.mouseLeft);
bool chargeSpam = (Owner.Calamity().mouseRight && Main.mouseLeft && ChargeLV1 && spamDelay == 0);
if ((!Main.mouseLeft || autoSpam || chargeSpam) && downtime == 0 && time >= 1)
if ((!Main.mouseLeft || autoSpam) && downtime == 0 && time >= 1)
{
KeepRefreshingLifetime = false;
@@ -33,6 +33,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = -1;
Projectile.ArmorPenetration = 15;
Projectile.Calamity().CannotProc = true;
}
public override bool ShouldUpdatePosition() => (time < 120);
public override void AI()
+4 -5
View File
@@ -76,15 +76,14 @@ namespace CalamityMod.Projectiles.Magic
{
Projectile.rotation = 0f;
}
//Pulses happen every 6 seconds, divided by how much mana the totem has stored
int pulseMax = 360;
pulseMax = 360 - (modPlayer.fleshTotemManaStorage / 2);
//Pulses happen every 4 seconds, divided by how much mana the totem has stored
float pulseMax = Utils.Remap(modPlayer.fleshTotemManaStorage, 0, FleshTotem.manaStorageMax, FleshTotem.MaxDelay, FleshTotem.MinDelay);
//Ensure the pulse timer can never go below 1 second
if (pulseMax < 60)
{
pulseMax = 60;
}
//When the timer reaches max, pulse and restore 20 mana
//When the timer reaches max, pulse and restore 25 mana
if (pulseTimer >= pulseMax)
{
if (visuals)
@@ -114,7 +113,7 @@ namespace CalamityMod.Projectiles.Magic
}
}
}
int manaGained = 20;
int manaGained = 25;
player.statMana += manaGained;
if (Main.myPlayer == player.whoAmI)
player.ManaEffect(manaGained);
+2
View File
@@ -1,4 +1,5 @@
using CalamityMod.Particles;
using CalamityMod.Utilities;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Audio;
@@ -130,6 +131,7 @@ namespace CalamityMod.Projectiles.Magic
}
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
{
modifiers.ApplyScalingForcedCrit(Projectile);
if (Projectile.numHits > 0)
Projectile.damage = (int)(Projectile.damage * 0.85f);
if (Projectile.damage < 1)
+6
View File
@@ -1,5 +1,6 @@
using CalamityMod.Items.Weapons.Magic;
using CalamityMod.Particles;
using CalamityMod.Utilities;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
@@ -109,6 +110,11 @@ namespace CalamityMod.Projectiles.Magic
target.AddBuff(BuffID.Daybreak, 180);
}
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
{
modifiers.ApplyScalingForcedCrit(Projectile);
}
public override void OnKill(int timeLeft)
{
if (Projectile.owner != Main.myPlayer)
+4 -8
View File
@@ -1,18 +1,12 @@
using System;
using System.Collections.Generic;
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Buffs.StatBuffs;
using CalamityMod.Items.Weapons.Melee;
using CalamityMod.Particles;
using CalamityMod.Projectiles.BaseProjectiles;
using CalamityMod.Sounds;
using Humanizer;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.Audio;
using Terraria.DataStructures;
using Terraria.GameContent;
using Terraria.ID;
using Terraria.ModLoader;
@@ -76,8 +70,10 @@ namespace CalamityMod.Projectiles.Melee
{
Projectile.timeLeft++;
timer--;
if (!playedChargeSound) {
SoundEngine.PlaySound(SoundID.Item178,Projectile.Center);
if (!playedChargeSound)
{
SoundEngine.PlaySound(SoundID.DeerclopsStep with { Volume = 2f, Pitch = 0.5f }, Projectile.Center);
SoundEngine.PlaySound(Murasama.InorganicHit with { Pitch = -0.5f }, Projectile.Center);
playedChargeSound = true;
for (int i = 0; i < 5; i++)
{
+1 -1
View File
@@ -71,6 +71,6 @@ namespace CalamityMod.Projectiles.Melee.Spears
Main.dust[idx].velocity = Vector2.Zero;
}
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType<Nightwither>(), 180);
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType<Voidfrost>(), 180);
}
}
+1 -1
View File
@@ -154,7 +154,7 @@ namespace CalamityMod.Projectiles.Melee
Main.dust[idx].scale = scale;
}
target.AddBuff(ModContent.BuffType<Nightwither>(), 30);
target.AddBuff(ModContent.BuffType<Voidfrost>(), 30);
}
public override void OnKill(int timeLeft)
+359
View File
@@ -0,0 +1,359 @@
using CalamityMod.CalPlayer;
using CalamityMod.Particles;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using Terraria;
using Terraria.GameContent;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Pets
{
public class StarSwallowerPet : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Pets";
private int playerStill = 0;
private bool idleAnimation = false;
private bool fly = false;
public override void SetStaticDefaults()
{
Main.projFrames[Projectile.type] = 14;
Main.projPet[Projectile.type] = true;
ProjectileID.Sets.CharacterPreviewAnimations[Projectile.type] = ProjectileID.Sets.SimpleLoop(1, 8, 6)
.WithOffset(-18f, 0f).WithSpriteDirection(1).WhenNotSelected(0, 0);
}
public override void SetDefaults()
{
Projectile.netImportant = true;
Projectile.width = 54;
Projectile.height = 48;
Projectile.friendly = true;
Projectile.penetrate = -1;
Projectile.timeLeft *= 5;
Projectile.tileCollide = true;
Projectile.ignoreWater = true;
}
public override bool PreDraw(ref Color lightColor)
{
Texture2D texture = TextureAssets.Projectile[Type].Value;
Vector2 scale = Vector2.One;
if (fly)
{
float animRate = Main.GlobalTimeWrappedHourly * 20;
float scaleMod = 0.2f;
scale += new Vector2(MathF.Cos(animRate), MathF.Sin(animRate)) * scaleMod;
}
SpriteEffects fx = fly ? (SpriteEffects.FlipVertically | (Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None)) : Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None;
Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, texture.Height / 2 / Main.projFrames[Type]), Projectile.scale * scale, fx, 0);
return false;
}
public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough, ref Vector2 hitboxCenterFrac)
{
Player player = Main.player[Projectile.owner];
float heightDif = player.Center.Y - Projectile.Center.Y;
fallThrough = fly || heightDif >= 160f;
return true;
}
public override void AI()
{
Player player = Main.player[Projectile.owner];
if (!player.active)
{
Projectile.active = false;
return;
}
CalamityPlayer modPlayer = player.Calamity();
if (player.dead)
{
modPlayer.starSwallowerPetFroge = false;
}
if (modPlayer.starSwallowerPetFroge)
{
Projectile.timeLeft = 2;
}
Vector2 projPos = Projectile.position;
Vector2 mouthPos = Projectile.Center + new Vector2(-20 * Projectile.spriteDirection, -6f).RotatedBy(Projectile.rotation);
if (!fly)
{
Projectile.rotation = 0;
Vector2 projCenter = Projectile.Center;
Vector2 playerDirection = player.Center - projCenter;
float playerDistance = playerDirection.Length();
if (Projectile.velocity.Y == 0 && ((HoleBelow() && playerDistance > 150f) || (playerDistance > 150f && Projectile.position.X == Projectile.oldPosition.X)))
{
Projectile.velocity.Y = -8f;
}
Projectile.velocity.Y += 0.35f;
if (Projectile.velocity.Y > 15f)
{
Projectile.velocity.Y = 15f;
}
if (playerDistance > 480f)
{
fly = true;
Projectile.velocity.X = 0f;
Projectile.velocity.Y = 0f;
}
if (playerDistance > 100f)
{
if (player.position.X - Projectile.position.X > 0f)
{
Projectile.velocity.X += 0.125f;
if (Projectile.velocity.X > 6.75f)
{
Projectile.velocity.X = 6.75f;
}
}
else
{
Projectile.velocity.X -= 0.125f;
if (Projectile.velocity.X < -6.75f)
{
Projectile.velocity.X = -6.75f;
}
}
}
if (playerDistance < 100f)
{
if (Projectile.velocity.X != 0f)
{
if (Projectile.velocity.X > 0.8f)
{
Projectile.velocity.X -= 0.25f;
}
else if (Projectile.velocity.X < -0.8f)
{
Projectile.velocity.X += 0.25f;
}
else if (Projectile.velocity.X < 0.8f && Projectile.velocity.X > -0.8f)
{
Projectile.velocity.X = 0f;
}
}
}
if (playerDistance < 70f)
{
Projectile.velocity.X *= 0.5f;
}
//set frames when idle
if (Projectile.position.X == Projectile.oldPosition.X && Projectile.position.Y == Projectile.oldPosition.Y && Projectile.velocity.X == 0)
{
// Idle animation where it opens its mouth and lets out some plasma mist
if (Main.rand.NextBool(600) && !idleAnimation)
{
idleAnimation = true;
Projectile.frame = 8;
Projectile.frameCounter = 0;
}
if (idleAnimation)
{
Projectile.frameCounter++;
if (Projectile.frameCounter > 8)
{
Projectile.frame += (Projectile.ai[0] != -1).ToDirectionInt();
Projectile.frameCounter = 0;
}
if (Projectile.ai[0] != -1)
{
if (Projectile.frame >= 12)
{
Projectile.ai[0] = -1;
Projectile.frame = 11;
}
}
else
{
if (Projectile.frame <= 7)
{
Projectile.ai[0] = 0;
Projectile.frame = 0;
idleAnimation = false;
}
}
if (Projectile.frame > 8)
{
GeneralParticleHandler.SpawnParticle(new MediumMistParticle(mouthPos, (Vector2.UnitX * -Projectile.spriteDirection).RotatedByRandom(MathHelper.ToRadians(10)) * Main.rand.NextFloat(4, 8), new Color(201, 234, 71), new Color(115, 192, 58), Main.rand.NextFloat(0.8f, 1.1f), 170f, Main.rand.NextFloat(0.1f, 0.2f) * Main.rand.NextFloatDirection()));
}
}
else
{
Projectile.frame = 0;
Projectile.frameCounter = 0;
}
}
//falling frame
else if (Projectile.velocity.Y > 0.3f && Projectile.position.Y != Projectile.oldPosition.Y)
{
Projectile.frame = 7;
Projectile.frameCounter = 0;
}
else if (Projectile.velocity.X != 0)
{
//moving animation
Projectile.frameCounter++;
if (Projectile.frameCounter >= 6)
{
Projectile.frame++;
Projectile.frameCounter = 0;
}
if (Projectile.frame > 7)
{
Projectile.frame = 0;
}
}
if (Projectile.velocity.X > 0.8f)
{
Projectile.spriteDirection = -1;
}
else if (Projectile.velocity.X < -0.8f)
{
Projectile.spriteDirection = 1;
}
}
else if (fly)
{
idleAnimation = false;
Projectile.ai[0] = 0;
float flySpeed = 0.5f;
Projectile.tileCollide = false;
Vector2 flyDirection = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f);
float horiPos = Main.player[Projectile.owner].position.X + (float)(Main.player[Projectile.owner].width / 2) - flyDirection.X;
float vertiPos = Main.player[Projectile.owner].position.Y + (float)(Main.player[Projectile.owner].height / 2) - flyDirection.Y;
vertiPos += (float)Main.rand.Next(-10, 21);
horiPos += (float)Main.rand.Next(-10, 21);
horiPos += (float)(60 * -(float)player.direction);
vertiPos -= 60f;
float playerDistance = (float)Math.Sqrt((double)(horiPos * horiPos + vertiPos * vertiPos));
if (playerDistance > 1200f)
{
Projectile.position.X = player.Center.X - (float)(Projectile.width / 2);
Projectile.position.Y = player.Center.Y - (float)(Projectile.height / 2);
Projectile.netUpdate = true;
}
if (playerDistance < 100f)
{
flySpeed = 0.5f;
if (player.velocity.Y == 0f)
{
++playerStill;
}
else
{
playerStill = 0;
}
if (playerStill > 10 && Projectile.Center.Y <= player.Center.Y && !Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height))
{
fly = false;
Projectile.velocity *= 0.2f;
Projectile.tileCollide = true;
}
}
if (playerDistance < 50f)
{
if (Math.Abs(Projectile.velocity.X) > 2f || Math.Abs(Projectile.velocity.Y) > 2f)
{
Projectile.velocity *= 0.90f;
}
flySpeed = 0.02f;
}
else
{
if (playerDistance < 100f)
{
flySpeed = 0.35f;
}
if (playerDistance > 300f)
{
flySpeed = 1f;
}
playerDistance = 18f / playerDistance;
horiPos *= playerDistance;
vertiPos *= playerDistance;
}
if (Projectile.velocity.X <= horiPos)
{
Projectile.velocity.X = Projectile.velocity.X + flySpeed;
if (flySpeed > 0.05f && Projectile.velocity.X < 0f)
{
Projectile.velocity.X = Projectile.velocity.X + flySpeed;
}
}
if (Projectile.velocity.X > horiPos)
{
Projectile.velocity.X = Projectile.velocity.X - flySpeed;
if (flySpeed > 0.05f && Projectile.velocity.X > 0f)
{
Projectile.velocity.X = Projectile.velocity.X - flySpeed;
}
}
if (Projectile.velocity.Y <= vertiPos)
{
Projectile.velocity.Y = Projectile.velocity.Y + flySpeed;
if (flySpeed > 0.05f && Projectile.velocity.Y < 0f)
{
Projectile.velocity.Y = Projectile.velocity.Y + flySpeed * 2f;
}
}
if (Projectile.velocity.Y > vertiPos)
{
Projectile.velocity.Y = Projectile.velocity.Y - flySpeed;
if (flySpeed > 0.05f && Projectile.velocity.Y > 0f)
{
Projectile.velocity.Y = Projectile.velocity.Y - flySpeed * 2f;
}
}
Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0);
if (Projectile.Center.X < Main.player[Projectile.owner].Center.X)
{
Projectile.spriteDirection = -1;
}
else if (Projectile.Center.X > Main.player[Projectile.owner].Center.X)
{
Projectile.spriteDirection = 1;
}
Projectile.frame = 12;
// fly anim particles
GeneralParticleHandler.SpawnParticle(new MediumMistParticle(mouthPos, mouthPos.DirectionTo(Projectile.oldPosition).RotatedByRandom(MathHelper.ToRadians(20)).RotatedBy(MathHelper.ToRadians(10 * Projectile.spriteDirection)) * Main.rand.NextFloat(4, 8), new Color(201, 234, 71), new Color(115, 192, 58), Main.rand.NextFloat(0.7f, 1f), 200f, Main.rand.NextFloat(0.1f, 0.2f) * Main.rand.NextFloatDirection()));
}
}
private bool HoleBelow()
{
int tileWidth = 4;
int tileX = (int)(Projectile.Center.X / 16f) - tileWidth;
if (Projectile.velocity.X > 0)
{
tileX += tileWidth;
}
int tileY = (int)((Projectile.position.Y + Projectile.height) / 16f);
for (int y = tileY; y < tileY + 2; y++)
{
for (int x = tileX; x < tileX + tileWidth; x++)
{
if (Main.tile[x, y].HasTile && (Main.tile[x - 1, y].HasTile || Main.tile[x + 1, y].HasTile))
{
return false;
}
}
}
return true;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

+2 -3
View File
@@ -336,7 +336,7 @@ namespace CalamityMod.Projectiles.Ranged
blast.ArmorPenetration = Projectile.ArmorPenetration;
}
if (damageMult >= 0.75f)
Owner.SetScreenshake(6f * damageMult);
Owner.SetScreenshake(3f * damageMult);
}
}
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
@@ -351,7 +351,6 @@ namespace CalamityMod.Projectiles.Ranged
}
if (damageMult >= 0.75f)
{
Owner.SetScreenshake(4f * damageMult);
float angle = Main.rand.NextFloat(0, MathHelper.TwoPi);
for (int i = -6; i <= 6; i++) // 12
{
@@ -380,7 +379,7 @@ namespace CalamityMod.Projectiles.Ranged
modifiers.SourceDamage *= damageMult;
}
public override bool? CanHitNPC(NPC target) => time > 1 && Projectile.numHits == 0;
public override bool? CanHitNPC(NPC target) => ((time > 1) ? null : false && Projectile.numHits == 0);
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox)
{
float hitboxSize = 20 * Projectile.scale * damageMult;
+1 -1
View File
@@ -90,7 +90,7 @@ namespace CalamityMod.Projectiles.Ranged
revFrames++;
shineScale *= 0.77f;
if ((revFrames >= maxFrames && !isTired || (Owner.Calamity().mouseRight && revFrames > 2 )) && Owner.whoAmI == Main.myPlayer)
if (revFrames >= maxFrames && !isTired && Owner.whoAmI == Main.myPlayer)
{
Owner.SetScreenshake(6.5f);
OffsetLengthFromArm -= 35f;
+5 -1
View File
@@ -1,4 +1,6 @@
using Microsoft.Xna.Framework;
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Buffs.StatDebuffs;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Rogue
@@ -32,5 +34,7 @@ namespace CalamityMod.Projectiles.Rogue
Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0.5f / 255f);
CalamityUtils.HomeInOnNPC(Projectile, true, 300f, 12f, 20f);
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType<WhisperingDeath>(), 60);
public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType<WhisperingDeath>(), 60);
}
}
+2 -2
View File
@@ -73,13 +73,13 @@ namespace CalamityMod.Projectiles.Rogue
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
target.AddBuff(ModContent.BuffType<Nightwither>(), 300);
target.AddBuff(ModContent.BuffType<Voidfrost>(), 300);
target.AddBuff(BuffID.Frozen, 150);
}
public override void OnHitPlayer(Player target, Player.HurtInfo info)
{
target.AddBuff(ModContent.BuffType<Nightwither>(), 300);
target.AddBuff(ModContent.BuffType<Voidfrost>(), 300);
}
public override bool PreDraw(ref Color lightColor)
-2
View File
@@ -59,8 +59,6 @@ namespace CalamityMod.Projectiles.Rogue
return false;
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType<Nightwither>(), 120);
public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType<Nightwither>(), 120);
public override void OnKill(int timeLeft)
{
for (int k = 0; k < 3; k++)
@@ -29,6 +29,7 @@ namespace CalamityMod.Projectiles.Rogue
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = 5;
Projectile.ArmorPenetration = 20;
Projectile.Calamity().CannotProc = true;
}
public override void AI()
-2
View File
@@ -105,8 +105,6 @@ namespace CalamityMod.Projectiles.Summon
return MathHelper.Lerp(0f, maxWidth, expansionCompletion);
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType<Nightwither>(), 240);
public override bool PreDraw(ref Color lightColor)
{
Projectile.localAI[0] = 0f;
-4
View File
@@ -46,9 +46,5 @@ namespace CalamityMod.Projectiles.Summon
}
}
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
target.AddBuff(ModContent.BuffType<Voidfrost>(), 180);
}
}
}
@@ -29,6 +29,7 @@ namespace CalamityMod.Projectiles.Typeless
Projectile.alpha = 255;
Projectile.timeLeft = 360;
Projectile.penetrate = 1;
Projectile.Calamity().CannotProc = true;
}
public override void AI()
-1
View File
@@ -32,7 +32,6 @@ namespace CalamityMod.Tiles.SunkenSea
TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Sand"]);
TileID.Sets.Suffocate[Type] = true;
TileID.Sets.CanBeDugByShovel[Type] = true;
TileID.Sets.Conversion.Sand[Type] = true;
TileID.Sets.ForAdvancedCollision.ForSandshark[Type] = true;
TileID.Sets.Falling[Type] = true;
TileID.Sets.FallingBlockProjectile[Type] = new TileID.Sets.FallingBlockProjectileInfo(ModContent.ProjectileType<EutrophicSandBallFalling>(), 5);