Merge branch '1.4.4' into dialogue-pearls
No files matched your search
@@ -957,6 +957,8 @@ namespace CalamityMod.CalPlayer
|
||||
public bool XykVisualsBlue = false;
|
||||
public bool XykVisualsOrange = false;
|
||||
public Color XykFXColor = Color.Black;
|
||||
public int XykWingTimer = 0;
|
||||
public Color lightRGB = Color.Black;
|
||||
public bool manaOverloader = false;
|
||||
/// <summary> Used for allowing Calamity slimes to be affected by Royal Gel. </summary>
|
||||
public bool royalGel = false;
|
||||
|
||||
@@ -885,7 +885,7 @@ namespace CalamityMod.CalPlayer
|
||||
contactDamageReduction *= (double)Crumbling.MultiplicativeDamageReductionPlayer;
|
||||
|
||||
// Contact damage reduction is reduced by DR Damage, which itself is proportional to defense damage
|
||||
// In GFB, as defense damage is uncapped, DR damage is also uncapped.
|
||||
// In FTW, as defense damage is uncapped, DR damage is also uncapped.
|
||||
int currentDefense = Player.GetCurrentDefense(false);
|
||||
if (totalDefenseDamage > 0 && currentDefense > 0)
|
||||
{
|
||||
|
||||
@@ -254,12 +254,21 @@ namespace CalamityMod.CalPlayer
|
||||
foreach (Projectile p in Main.ActiveProjectiles)
|
||||
if (p.type == ModContent.ProjectileType<XykWings>() && p.owner == Player.whoAmI && p.ai[1] == 0)
|
||||
numOfActiveWings++;
|
||||
bool spawnWings = numOfActiveWings < maxWingPieces && !Player.dead && Player.wingsLogic > 0 && !(Player.wingTime == Player.wingTimeMax && Player.velocity.Y == 0) && Player.wingTime > 0;
|
||||
bool spawnWings = numOfActiveWings < maxWingPieces && !Player.dead && Player.wingsLogic > 0 && ((!(Player.wingTime == Player.wingTimeMax && Player.velocity.Y == 0) && Player.wingTime > 0) || XykWingTimer >= 3);
|
||||
if (spawnWings)
|
||||
{
|
||||
int wingCount = numOfActiveWings;
|
||||
Projectile wings = Projectile.NewProjectileDirect(Player.GetSource_FromThis(), Player.Center, Vector2.Zero, ModContent.ProjectileType<XykWings>(), 0, 0f, Player.whoAmI, wingCount);
|
||||
if (XykWingTimer >= 3)
|
||||
{
|
||||
int wingCount = numOfActiveWings;
|
||||
Projectile wings = Projectile.NewProjectileDirect(Player.GetSource_FromThis(), Player.Center, Vector2.Zero, ModContent.ProjectileType<XykWings>(), 0, 0f, Player.whoAmI, wingCount);
|
||||
if (numOfActiveWings + 1 == maxWingPieces)
|
||||
XykWingTimer = 0;
|
||||
}
|
||||
else
|
||||
XykWingTimer++;
|
||||
}
|
||||
else
|
||||
XykWingTimer = 0;
|
||||
}
|
||||
|
||||
// First Frame dash effects
|
||||
@@ -568,6 +577,22 @@ namespace CalamityMod.CalPlayer
|
||||
if (heldGaelsLastFrame)
|
||||
rageDiff += rageMax * GaelsGreatsword.RagePerSecond / 60f;
|
||||
|
||||
float rate = Main.GlobalTimeWrappedHourly * 29;
|
||||
List<Color> eColors = new List<Color>()
|
||||
{
|
||||
Color.PaleVioletRed,
|
||||
Color.Coral,
|
||||
Color.Khaki,
|
||||
Color.PaleGreen,
|
||||
Color.Turquoise,
|
||||
Color.Violet
|
||||
};
|
||||
|
||||
int colorIndex = (int)(rate / 2 % eColors.Count);
|
||||
Color currentColor = eColors[colorIndex];
|
||||
Color nextColor = eColors[(colorIndex + 1) % eColors.Count];
|
||||
lightRGB = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f);
|
||||
|
||||
// Calculate and grant proximity rage.
|
||||
// Regular enemies can give up to 1x proximity rage. Bosses can give up to 3x. Multiple regular enemies don't stack.
|
||||
// Proximity rage is maxed out when within 10 blocks (160 pixels) of the enemy's hitbox.
|
||||
@@ -3092,7 +3117,7 @@ namespace CalamityMod.CalPlayer
|
||||
abyssDeath = false;
|
||||
|
||||
// Signus headcrab darkness
|
||||
if (CalamityWorld.LegendaryMode && CalamityWorld.revenge)
|
||||
if (CalamityWorld.LegendaryMode)
|
||||
{
|
||||
if (CalamityGlobalNPC.signus != -1)
|
||||
{
|
||||
@@ -3804,11 +3829,15 @@ namespace CalamityMod.CalPlayer
|
||||
{
|
||||
Player.GetDamage<GenericDamageClass>() += PrimordialEarth.BuffDamageBoost;
|
||||
Player.statDefense += PrimordialEarth.BuffDefenseBoost;
|
||||
Player.manaRegenDelayBonus += 1;
|
||||
Player.manaRegenBonus += 50 + (int)(400 * (float)Math.Pow((1 - ((float)Player.statMana / (float)Player.statManaMax2)), 2));
|
||||
}
|
||||
if (aeolianEarthBuff)
|
||||
{
|
||||
Player.GetDamage<GenericDamageClass>() += PrimordialAncient.BuffDamageBoost;
|
||||
Player.endurance += PrimordialAncient.BuffDamageReductionBoost;
|
||||
Player.manaRegenDelayBonus += 1;
|
||||
Player.manaRegenBonus += 75 + (int)(600 * (float)Math.Pow((1 - ((float)Player.statMana / (float)Player.statManaMax2)), 2));
|
||||
}
|
||||
|
||||
if (frostFlare)
|
||||
|
||||
@@ -35,6 +35,8 @@ namespace CalamityMod.CalPlayer.DrawLayers
|
||||
if (itemType < ItemID.Count)
|
||||
return;
|
||||
|
||||
Color color = new Color(250, 250, 250, heldItem.alpha);
|
||||
|
||||
// This is ugly and I don't give a fuck.
|
||||
// If you want it to look better, do it yourself.
|
||||
Texture2D glowMask = default;
|
||||
@@ -62,8 +64,6 @@ namespace CalamityMod.CalPlayer.DrawLayers
|
||||
glowMask = ModContent.Request<Texture2D>("CalamityMod/Items/Weapons/Summon/EtherealSubjugatorGlow").Value;
|
||||
else if (itemType == ModContent.ItemType<Excelsus>())
|
||||
glowMask = ModContent.Request<Texture2D>("CalamityMod/Items/Weapons/Melee/ExcelsusGlow").Value;
|
||||
else if (itemType == ModContent.ItemType<IridescentExcalibur>())
|
||||
glowMask = ModContent.Request<Texture2D>("CalamityMod/Items/Weapons/Melee/IridescentExcaliburGlow").Value;
|
||||
else if (itemType == ModContent.ItemType<FatesReveal>())
|
||||
glowMask = ModContent.Request<Texture2D>("CalamityMod/Items/Weapons/Magic/FatesRevealGlow").Value;
|
||||
else if (itemType == ModContent.ItemType<GreatswordofJudgement>())
|
||||
@@ -75,7 +75,10 @@ namespace CalamityMod.CalPlayer.DrawLayers
|
||||
else if (itemType == ModContent.ItemType<NecroplasmicBeacon>())
|
||||
glowMask = ModContent.Request<Texture2D>("CalamityMod/Items/SummonItems/NecroplasmicBeaconGlow").Value;
|
||||
else if (itemType == ModContent.ItemType<Orderbringer>())
|
||||
{
|
||||
color = Color.Lerp(Color.White, drawPlayer.Calamity().lightRGB, 0.75f) with { A = 0 };
|
||||
glowMask = ModContent.Request<Texture2D>("CalamityMod/Items/Weapons/Melee/OrderbringerGlow").Value;
|
||||
}
|
||||
else if (itemType == ModContent.ItemType<Photosynthesis>())
|
||||
glowMask = ModContent.Request<Texture2D>("CalamityMod/Items/Weapons/Magic/PhotosynthesisGlow").Value;
|
||||
else if (itemType == ModContent.ItemType<PlantationStaff>())
|
||||
@@ -140,7 +143,6 @@ namespace CalamityMod.CalPlayer.DrawLayers
|
||||
if (drawInfo.shadow != 0f || drawPlayer.frozen || !(inUse || visuallyHeld) || itemType <= 0 || drawPlayer.dead || heldItem.noUseGraphic || (drawPlayer.wet && heldItem.noWet) || (drawPlayer.happyFunTorchTime && drawPlayer.inventory[drawPlayer.selectedItem].createTile == TileID.Torches && drawPlayer.itemAnimation == 0))
|
||||
return;
|
||||
|
||||
Color color = new Color(250, 250, 250, heldItem.alpha);
|
||||
Vector2 originOffset = Vector2.Zero;
|
||||
|
||||
// Use to adjust glow mask draw offset and color.
|
||||
|
||||
@@ -261,7 +261,7 @@ namespace CalamityMod
|
||||
|
||||
{ ModContent.NPCType<ProfanedGuardianCommander>(), 0.8 },
|
||||
|
||||
{ ModContent.NPCType<Bumblefuck>(), 0.8 },
|
||||
{ ModContent.NPCType<Dragonfolly>(), 0.8 },
|
||||
|
||||
{ ModContent.NPCType<StormWeaverBody>(), 0.8 },
|
||||
{ ModContent.NPCType<StormWeaverTail>(), 0.8 },
|
||||
@@ -510,8 +510,8 @@ namespace CalamityMod
|
||||
{ ModContent.NPCType<ProfanedGuardianHealer>(), new int[] { 100, 200, 220, 240, 300 } },
|
||||
{ ModContent.NPCType<ProfanedRocks>(), new int[] { 100, 200, 220, 232, 300 } },
|
||||
|
||||
{ ModContent.NPCType<Bumblefuck>(), new int[] { 170, 256, 288, 320, 504 } },
|
||||
{ ModContent.NPCType<Bumblefuck2>(), new int[] { 145, 220, 242, 264, 435 } },
|
||||
{ ModContent.NPCType<Dragonfolly>(), new int[] { 170, 256, 288, 320, 504 } },
|
||||
{ ModContent.NPCType<DraconicSwarmer>(), new int[] { 145, 220, 242, 264, 435 } },
|
||||
|
||||
{ ModContent.NPCType<CeaselessVoid>(), new int[] { 240, 360, 396, 432, 720 } },
|
||||
{ ModContent.NPCType<DarkEnergy>(), new int[] { 175, 260, 288, 316, 525 } },
|
||||
@@ -769,8 +769,8 @@ namespace CalamityMod
|
||||
{ new Tuple<int, int>(ModContent.NPCType<ProfanedGuardianHealer>(), ModContent.ProjectileType<HolyBurnOrb>()), new int[] { 120, 192, 220, 248, 360 } },
|
||||
{ new Tuple<int, int>(ModContent.NPCType<ProfanedGuardianHealer>(), ModContent.ProjectileType<HolyLight>()), new int[] { 35, 50, 50, 0, 0 } },
|
||||
|
||||
{ new Tuple<int, int>(ModContent.NPCType<Bumblefuck>(), ModContent.ProjectileType<RedLightningFeather>()), new int[] { 140, 220, 244, 268, 420 } },
|
||||
{ new Tuple<int, int>(ModContent.NPCType<Bumblefuck>(), ModContent.ProjectileType<BirbAuraFlare>()), new int[] { 200, 300, 332, 364, 600 } },
|
||||
{ new Tuple<int, int>(ModContent.NPCType<Dragonfolly>(), ModContent.ProjectileType<RedLightningFeather>()), new int[] { 140, 220, 244, 268, 420 } },
|
||||
{ new Tuple<int, int>(ModContent.NPCType<Dragonfolly>(), ModContent.ProjectileType<BirbAuraFlare>()), new int[] { 200, 300, 332, 364, 600 } },
|
||||
|
||||
{ new Tuple<int, int>(ModContent.NPCType<Providence>(), ModContent.ProjectileType<HolyBlast>()), new int[] { 150, 264, 288, 312, 450 } }, // Split holy fire does: 113, 198, 216, 234, 338
|
||||
{ new Tuple<int, int>(ModContent.NPCType<Providence>(), ModContent.ProjectileType<HolyFire>()), new int[] { 120, 192, 220, 248, 360 } },
|
||||
|
||||
@@ -309,7 +309,7 @@ namespace CalamityMod.Events
|
||||
NPC.SpawnOnPlayer(ClosestPlayerToWorldCenter, type);
|
||||
}, permittedNPCs: new int[] { ModContent.NPCType<ProfanedGuardianDefender>(), ModContent.NPCType<ProfanedGuardianHealer>(), ModContent.NPCType<ProfanedRocks>() }),
|
||||
|
||||
new Boss(ModContent.NPCType<Bumblefuck>(), permittedNPCs: new int[] { ModContent.NPCType<Bumblefuck2>() }),
|
||||
new Boss(ModContent.NPCType<Dragonfolly>(), permittedNPCs: new int[] { ModContent.NPCType<DraconicSwarmer>() }),
|
||||
|
||||
new Boss(ModContent.NPCType<Providence>(), TimeChangeContext.Day, type =>
|
||||
{
|
||||
|
||||
@@ -19,7 +19,6 @@ namespace CalamityMod.ExtraTextures
|
||||
public static Asset<Texture2D> DestroyerHeadGlowmask;
|
||||
public static Asset<Texture2D> DestroyerBodyGlowmask;
|
||||
public static Asset<Texture2D> DestroyerTailGlowmask;
|
||||
public static Asset<Texture2D> ProbeGlowmask;
|
||||
|
||||
// Master Rev+ Skeletron Prime
|
||||
public static Asset<Texture2D> ChadPrime;
|
||||
@@ -62,8 +61,6 @@ namespace CalamityMod.ExtraTextures
|
||||
DestroyerBodyGlowmask = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/VanillaBossGlowmasks/DestroyerBodyGlow", AssetRequestMode.AsyncLoad);
|
||||
DestroyerTailGlowmask = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/VanillaBossGlowmasks/DestroyerTailGlow", AssetRequestMode.AsyncLoad);
|
||||
|
||||
ProbeGlowmask = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/VanillaBossGlowmasks/ProbeGlow", AssetRequestMode.AsyncLoad);
|
||||
|
||||
ChadPrime = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/ChadPrime", AssetRequestMode.AsyncLoad);
|
||||
ChadPrimeEyeGlowmask = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/ChadPrimeHeadGlow", AssetRequestMode.AsyncLoad);
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 594 B |
@@ -192,6 +192,7 @@ namespace CalamityMod.ILEditing
|
||||
|
||||
// Removal of vanilla stupidity
|
||||
IL_Player.StatusFromNPC += RemoveExpertBrainRandomDebuffs;
|
||||
IL_NPC.StrikeNPC_HitInfo_bool_bool += LetDetonatingBubblesTakeDamage;
|
||||
IL_Player.ItemCheck_EmitUseVisuals += MakeMagmaStoneFireGauntletDustToggleable;
|
||||
IL_Projectile.EmitEnchantmentVisualsAt += MakeMagmaStoneFireGauntletProjectileDustToggleable;
|
||||
IL_Sandstorm.HasSufficientWind += DecreaseSandstormWindSpeedRequirement;
|
||||
|
||||
@@ -9,6 +9,7 @@ using CalamityMod.NPCs.AcidRain;
|
||||
using CalamityMod.NPCs.NormalNPCs;
|
||||
using CalamityMod.NPCs.TownNPCs;
|
||||
using CalamityMod.Walls;
|
||||
using CalamityMod.World;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Mono.Cecil.Cil;
|
||||
using MonoMod.Cil;
|
||||
@@ -174,12 +175,47 @@ namespace CalamityMod.ILEditing
|
||||
}
|
||||
|
||||
// Remove the Expert Mode check, and in its place put a check for the Zenith seed (Get fixed boi).
|
||||
// Note from CIT: I originally removed these entirely;
|
||||
cursor.Emit(OpCodes.Pop);
|
||||
cursor.Emit(OpCodes.Ldsfld, typeof(Main).GetField("zenithWorld"));
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Disable Detonating Bubble StrikeNPC Hardcoded Override
|
||||
private static void LetDetonatingBubblesTakeDamage(ILContext il)
|
||||
{
|
||||
// In vanilla's StrikeNPC function, Detonating Bubbles have a hardcoded type check which sets the damage of the strike to 0.
|
||||
// This IL edit disables that type check in Death Mode.
|
||||
var cursor = new ILCursor(il);
|
||||
|
||||
// Go to the point after the check for the Detonating Bubble NPC ID.
|
||||
if (!cursor.TryGotoNext(MoveType.AfterLabel, i => i.MatchLdcR8(0.0)))
|
||||
{
|
||||
LogFailure("Let Detonating Bubbles Take Damage in Death", "Could not move after the NPC type check.");
|
||||
return;
|
||||
}
|
||||
|
||||
// Define the label.
|
||||
var label = il.DefineLabel();
|
||||
|
||||
// Add a branch if it is Death Mode.
|
||||
cursor.Emit(OpCodes.Ldsfld, typeof(CalamityWorld).GetField("death"));
|
||||
cursor.Emit(OpCodes.Brtrue, label);
|
||||
|
||||
// Move to the point after Detonating Bubble changes are implemented to place the branch label.
|
||||
if (!cursor.TryGotoNext(MoveType.After, i => i.MatchStfld<NPC>("dontTakeDamage")))
|
||||
{
|
||||
LogFailure("Let Detonating Bubbles Take Damage in Death", "Could not move to after the Detonating Bubble logic.");
|
||||
return;
|
||||
}
|
||||
if (!cursor.TryGotoNext(MoveType.AfterLabel, i => i.MatchLdarg0()))
|
||||
{
|
||||
LogFailure("Let Detonating Bubbles Take Damage in Death", "Could not move to after the Detonating Bubble logic.");
|
||||
return;
|
||||
}
|
||||
cursor.MarkLabel(label);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Make Meteorite Explodable
|
||||
private static void MakeMeteoriteExplodable(ILContext il)
|
||||
{
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Items.Accessories.Vanity
|
||||
{
|
||||
[AutoloadEquip(EquipType.Face)]
|
||||
public class LucisSight : ModItem, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Items.Accessories";
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
if (!Main.dedServ)
|
||||
{
|
||||
int equipSlot = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Face);
|
||||
ArmorIDs.Face.Sets.DrawInFaceUnderHairLayer[equipSlot] = true;
|
||||
}
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.width = 28;
|
||||
Item.height = 18;
|
||||
Item.value = Item.buyPrice(gold: 10); // Sold by Steampunker
|
||||
Item.rare = ItemRarityID.Pink;
|
||||
Item.accessory = true;
|
||||
Item.vanity = true;
|
||||
Item.Calamity().donorItem = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 318 B |
|
After Width: | Height: | Size: 2.2 KiB |
@@ -22,7 +22,6 @@ namespace CalamityMod.Items.Accessories.Vanity
|
||||
EquipLoader.AddEquipTexture(Mod, "CalamityMod/Projectiles/InvisibleProj", EquipType.Wings, this);
|
||||
}
|
||||
}
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
if (Main.dedServ)
|
||||
@@ -44,17 +43,15 @@ namespace CalamityMod.Items.Accessories.Vanity
|
||||
Item.width = 36;
|
||||
Item.height = 34;
|
||||
Item.accessory = true;
|
||||
Item.consumable = true;
|
||||
Item.vanity = true;
|
||||
Item.rare = ModContent.RarityType<Turquoise>();
|
||||
Item.value = CalamityGlobalItem.RarityBlueBuyPrice;
|
||||
Item.Calamity().devItem = true;
|
||||
}
|
||||
public override bool CanRightClick() => true;
|
||||
|
||||
public override void ModifyItemLoot(ItemLoot itemLoot)
|
||||
public override void RightClick(Player player)
|
||||
{
|
||||
itemLoot.Add(ModContent.ItemType<XyksBlessingOrange>());
|
||||
player.PutItemInInventoryFromItemUsage(ModContent.ItemType<XyksBlessingOrange>(), 1);
|
||||
}
|
||||
public override void UpdateVanity(Player player)
|
||||
{
|
||||
|
||||
@@ -44,17 +44,15 @@ namespace CalamityMod.Items.Accessories.Vanity
|
||||
Item.width = 36;
|
||||
Item.height = 34;
|
||||
Item.accessory = true;
|
||||
Item.consumable = true;
|
||||
Item.vanity = true;
|
||||
Item.rare = ModContent.RarityType<DarkOrange>();
|
||||
Item.value = CalamityGlobalItem.RarityBlueBuyPrice;
|
||||
Item.Calamity().devItem = true;
|
||||
}
|
||||
public override bool CanRightClick() => true;
|
||||
|
||||
public override void ModifyItemLoot(ItemLoot itemLoot)
|
||||
public override void RightClick(Player player)
|
||||
{
|
||||
itemLoot.Add(ModContent.ItemType<XyksBlessingBlue>());
|
||||
player.PutItemInInventoryFromItemUsage(ModContent.ItemType<XyksBlessingBlue>(), 1);
|
||||
}
|
||||
public override void UpdateVanity(Player player)
|
||||
{
|
||||
|
||||
@@ -7,7 +7,8 @@ using Terraria.ModLoader;
|
||||
namespace CalamityMod.Items.Armor.Aerospec
|
||||
{
|
||||
[AutoloadEquip(EquipType.Head)]
|
||||
public class AerospecHat : ModItem, ILocalizedModType
|
||||
[LegacyName("AerospecHat")]
|
||||
public class AerospecHeadMagic : ModItem, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Items.Armor.PreHardmode";
|
||||
public override void SetDefaults()
|
||||
|
Before Width: | Height: | Size: 373 B After Width: | Height: | Size: 373 B |
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.3 KiB |
@@ -7,7 +7,8 @@ using Terraria.ModLoader;
|
||||
namespace CalamityMod.Items.Armor.Aerospec
|
||||
{
|
||||
[AutoloadEquip(EquipType.Head)]
|
||||
public class AerospecHelm : ModItem, ILocalizedModType
|
||||
[LegacyName("AerospecHelm")]
|
||||
public class AerospecHeadMelee : ModItem, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Items.Armor.PreHardmode";
|
||||
public override void SetDefaults()
|
||||
@@ -52,7 +53,7 @@ namespace CalamityMod.Items.Armor.Aerospec
|
||||
AddIngredient(ItemID.SunplateBlock, 3).
|
||||
AddIngredient(ItemID.Feather).
|
||||
AddTile(TileID.Anvils).
|
||||
SortBeforeFirstRecipesOf(ModContent.ItemType<AerospecHat>()).
|
||||
SortBeforeFirstRecipesOf(ModContent.ItemType<AerospecHeadMagic>()).
|
||||
Register();
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 343 B After Width: | Height: | Size: 343 B |
|
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.4 KiB |
@@ -7,7 +7,8 @@ using Terraria.ModLoader;
|
||||
namespace CalamityMod.Items.Armor.Aerospec
|
||||
{
|
||||
[AutoloadEquip(EquipType.Head)]
|
||||
public class AerospecHood : ModItem, ILocalizedModType
|
||||
[LegacyName("AerospecHood")]
|
||||
public class AerospecHeadRanged : ModItem, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Items.Armor.PreHardmode";
|
||||
public override void SetDefaults()
|
||||
@@ -51,7 +52,7 @@ namespace CalamityMod.Items.Armor.Aerospec
|
||||
AddIngredient(ItemID.SunplateBlock, 3).
|
||||
AddIngredient(ItemID.Feather).
|
||||
AddTile(TileID.Anvils).
|
||||
SortAfterFirstRecipesOf(ModContent.ItemType<AerospecHelm>()).
|
||||
SortAfterFirstRecipesOf(ModContent.ItemType<AerospecHeadMagic>()).
|
||||
Register();
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 312 B After Width: | Height: | Size: 312 B |
|
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 3.2 KiB |
@@ -7,7 +7,8 @@ using Terraria.ModLoader;
|
||||
namespace CalamityMod.Items.Armor.Aerospec
|
||||
{
|
||||
[AutoloadEquip(EquipType.Head)]
|
||||
public class AerospecHeadgear : ModItem, ILocalizedModType
|
||||
[LegacyName("AerospecHeadgear")]
|
||||
public class AerospecHeadRogue : ModItem, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Items.Armor.PreHardmode";
|
||||
public override void SetStaticDefaults()
|
||||
@@ -60,7 +61,7 @@ namespace CalamityMod.Items.Armor.Aerospec
|
||||
AddIngredient(ItemID.SunplateBlock, 3).
|
||||
AddIngredient(ItemID.Feather).
|
||||
AddTile(TileID.Anvils).
|
||||
SortAfterFirstRecipesOf(ModContent.ItemType<AerospecHat>()).
|
||||
SortAfterFirstRecipesOf(ModContent.ItemType<AerospecBreastplate>()).
|
||||
Register();
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 217 B After Width: | Height: | Size: 217 B |
|
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.7 KiB |
@@ -10,7 +10,8 @@ using Terraria.ModLoader;
|
||||
namespace CalamityMod.Items.Armor.Aerospec
|
||||
{
|
||||
[AutoloadEquip(EquipType.Head)]
|
||||
public class AerospecHelmet : ModItem, ILocalizedModType
|
||||
[LegacyName("AerospecHelmet")]
|
||||
public class AerospecHeadSummon : ModItem, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Items.Armor.PreHardmode";
|
||||
public static int ValkyrieDamage = 20;
|
||||
@@ -74,7 +75,7 @@ namespace CalamityMod.Items.Armor.Aerospec
|
||||
AddIngredient(ItemID.SunplateBlock, 3).
|
||||
AddIngredient(ItemID.Feather).
|
||||
AddTile(TileID.Anvils).
|
||||
SortBeforeFirstRecipesOf(ModContent.ItemType<AerospecHeadgear>()).
|
||||
SortBeforeFirstRecipesOf(ModContent.ItemType<AerospecHeadRogue>()).
|
||||
Register();
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 354 B After Width: | Height: | Size: 354 B |
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.9 KiB |
@@ -12,7 +12,8 @@ using Terraria.ModLoader;
|
||||
namespace CalamityMod.Items.Armor.Auric
|
||||
{
|
||||
[AutoloadEquip(EquipType.Head)]
|
||||
public class AuricTeslaWireHemmedVisage : ModItem, ILocalizedModType
|
||||
[LegacyName("AuricTeslaWireHemmedVisage")]
|
||||
public class AuricTeslaHeadMagic : ModItem, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Items.Armor.PostMoonLord";
|
||||
public override void SetDefaults()
|
||||
@@ -95,7 +96,7 @@ namespace CalamityMod.Items.Armor.Auric
|
||||
AddIngredient<TarragonHeadMagic>().
|
||||
AddIngredient<AuricBar>(12).
|
||||
AddTile<CosmicAnvil>().
|
||||
SortBeforeFirstRecipesOf(ModContent.ItemType<AuricTeslaSpaceHelmet>()).
|
||||
SortBeforeFirstRecipesOf(ModContent.ItemType<AuricTeslaBodyArmor>()).
|
||||
Register();
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 684 B After Width: | Height: | Size: 684 B |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
@@ -15,7 +15,8 @@ namespace CalamityMod.Items.Armor.Auric
|
||||
{
|
||||
[AutoloadEquip(EquipType.Head)]
|
||||
[LegacyName("AuricTeslaHelm")]
|
||||
public class AuricTeslaRoyalHelm : ModItem, ILocalizedModType
|
||||
[LegacyName("AuricTeslaRoyalHelm")]
|
||||
public class AuricTeslaHeadMelee : ModItem, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Items.Armor.PostMoonLord";
|
||||
public override void SetDefaults()
|
||||
@@ -103,7 +104,7 @@ namespace CalamityMod.Items.Armor.Auric
|
||||
AddIngredient<TarragonHeadMelee>().
|
||||
AddIngredient<AuricBar>(12).
|
||||
AddTile<CosmicAnvil>().
|
||||
SortBeforeFirstRecipesOf(ModContent.ItemType<AuricTeslaHoodedFacemask>()).
|
||||
SortBeforeFirstRecipesOf(ModContent.ItemType<AuricTeslaHeadMagic>()).
|
||||
Register();
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 676 B After Width: | Height: | Size: 676 B |
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.9 KiB |
@@ -13,7 +13,8 @@ using Terraria.ModLoader;
|
||||
namespace CalamityMod.Items.Armor.Auric
|
||||
{
|
||||
[AutoloadEquip(EquipType.Head)]
|
||||
public class AuricTeslaHoodedFacemask : ModItem, ILocalizedModType
|
||||
[LegacyName("AuricTeslaHoodedFacemask")]
|
||||
public class AuricTeslaHeadRanged : ModItem, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Items.Armor.PostMoonLord";
|
||||
public override void SetDefaults()
|
||||
@@ -98,7 +99,7 @@ namespace CalamityMod.Items.Armor.Auric
|
||||
AddIngredient<TarragonHeadRanged>().
|
||||
AddIngredient<AuricBar>(12).
|
||||
AddTile<CosmicAnvil>().
|
||||
SortBeforeFirstRecipesOf(ModContent.ItemType<AuricTeslaBodyArmor>()).
|
||||
SortBeforeFirstRecipesOf(ModContent.ItemType<AuricTeslaHeadMagic>()).
|
||||
Register();
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 627 B After Width: | Height: | Size: 627 B |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
@@ -13,7 +13,8 @@ using Terraria.ModLoader;
|
||||
namespace CalamityMod.Items.Armor.Auric
|
||||
{
|
||||
[AutoloadEquip(EquipType.Head)]
|
||||
public class AuricTeslaPlumedHelm : ModItem, ILocalizedModType
|
||||
[LegacyName("AuricTeslaPlumedHelm")]
|
||||
public class AuricTeslaHeadRogue : ModItem, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Items.Armor.PostMoonLord";
|
||||
public override void SetDefaults()
|
||||
|
Before Width: | Height: | Size: 553 B After Width: | Height: | Size: 553 B |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
@@ -12,7 +12,8 @@ using Terraria.ModLoader;
|
||||
namespace CalamityMod.Items.Armor.Auric
|
||||
{
|
||||
[AutoloadEquip(EquipType.Head)]
|
||||
public class AuricTeslaSpaceHelmet : ModItem, ILocalizedModType
|
||||
[LegacyName("AuricTeslaSpaceHelmet")]
|
||||
public class AuricTeslaHeadSummon : ModItem, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Items.Armor.PostMoonLord";
|
||||
public override void SetDefaults()
|
||||
@@ -95,7 +96,7 @@ namespace CalamityMod.Items.Armor.Auric
|
||||
AddIngredient<TarragonHeadSummon>().
|
||||
AddIngredient<AuricBar>(12).
|
||||
AddTile<CosmicAnvil>().
|
||||
SortBeforeFirstRecipesOf(ModContent.ItemType<AuricTeslaPlumedHelm>()).
|
||||
SortBeforeFirstRecipesOf(ModContent.ItemType<AuricTeslaHeadRogue>()).
|
||||
Register();
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 562 B After Width: | Height: | Size: 562 B |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
@@ -0,0 +1,22 @@
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Items.Armor.Vanity
|
||||
{
|
||||
[AutoloadEquip(EquipType.Legs)]
|
||||
public class LucisBoots : ModItem, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Items.Armor.Vanity";
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.width = 28;
|
||||
Item.height = 20;
|
||||
Item.value = Item.buyPrice(gold: 10); // Sold by Steampunker
|
||||
Item.rare = ItemRarityID.Pink;
|
||||
Item.vanity = true;
|
||||
Item.Calamity().donorItem = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 279 B |
|
After Width: | Height: | Size: 3.7 KiB |
@@ -0,0 +1,22 @@
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Items.Armor.Vanity
|
||||
{
|
||||
[AutoloadEquip(EquipType.Head)]
|
||||
public class LucisHairstyle : ModItem, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Items.Armor.Vanity";
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.width = 28;
|
||||
Item.height = 20;
|
||||
Item.value = Item.buyPrice(gold: 10); // Sold by Steampunker
|
||||
Item.rare = ItemRarityID.Pink;
|
||||
Item.vanity = true;
|
||||
Item.Calamity().donorItem = true; // Donor: xAqult (Sprites made by Gote)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 576 B |
|
After Width: | Height: | Size: 5.0 KiB |
@@ -0,0 +1,22 @@
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Items.Armor.Vanity
|
||||
{
|
||||
[AutoloadEquip(EquipType.Body)]
|
||||
public class LucisMilitaryUniform : ModItem, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Items.Armor.Vanity";
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.width = 26;
|
||||
Item.height = 20;
|
||||
Item.value = Item.buyPrice(gold: 10); // Sold by Steampunker
|
||||
Item.rare = ItemRarityID.Pink;
|
||||
Item.vanity = true;
|
||||
Item.Calamity().donorItem = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 540 B |
|
After Width: | Height: | Size: 5.7 KiB |
@@ -6,6 +6,7 @@ using CalamityMod.Balancing;
|
||||
using CalamityMod.CustomRecipes;
|
||||
using CalamityMod.DataStructures;
|
||||
using CalamityMod.Items.Accessories;
|
||||
using CalamityMod.Items.Accessories.Vanity;
|
||||
using CalamityMod.Items.Armor.Demonshade;
|
||||
using CalamityMod.Items.PermanentBoosters;
|
||||
using CalamityMod.Items.Tools;
|
||||
@@ -289,7 +290,7 @@ namespace CalamityMod.Items
|
||||
#region Rarity Coloration
|
||||
private static void ApplyRarityColor(Item item, TooltipLine nameLine)
|
||||
{
|
||||
if (item.type == ModContent.ItemType<HeartoftheElements>() || item.type == ModContent.ItemType<TheCommunity>() || item.type == ModContent.ItemType<IridescentExcalibur>())
|
||||
if (item.type == ModContent.ItemType<HeartoftheElements>() || item.type == ModContent.ItemType<TheCommunity>())
|
||||
nameLine.OverrideColor = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB);
|
||||
|
||||
// Developer items
|
||||
@@ -1633,6 +1634,128 @@ namespace CalamityMod.Items
|
||||
#region Enchanted Rarity Text Drawing
|
||||
public override bool PreDrawTooltipLine(Item item, DrawableTooltipLine line, ref int yOffset)
|
||||
{
|
||||
if (line.Name == "ItemName" && line.Mod == "Terraria" && item.type == ModContent.ItemType<XyksBlessingBlue>())
|
||||
{
|
||||
Color rarityColor = Color.White;
|
||||
Vector2 basePosition = new Vector2(line.X, line.Y);
|
||||
|
||||
float rate = Main.GlobalTimeWrappedHourly * 6;
|
||||
List<Color> eColors = new List<Color>()
|
||||
{
|
||||
Color.DodgerBlue,
|
||||
Color.Cyan,
|
||||
Color.RoyalBlue
|
||||
};
|
||||
int colorIndex = (int)(rate / 2 % eColors.Count);
|
||||
Color currentColor = eColors[colorIndex];
|
||||
Color nextColor = eColors[(colorIndex + 1) % eColors.Count];
|
||||
Color usedColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f);
|
||||
|
||||
Vector2 backScale = line.BaseScale;
|
||||
Color backColor = usedColor;
|
||||
|
||||
Main.spriteBatch.End();
|
||||
Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, null, null, null, null, Main.UIScaleMatrix);
|
||||
|
||||
int draws = 20;
|
||||
for (int i = 0; i < draws; i++)
|
||||
{
|
||||
Vector2 backPosition = basePosition + (MathHelper.TwoPi * i / 20f).ToRotationVector2() * (3.5f);
|
||||
ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, line.Font, line.Text, backPosition, backColor, line.Rotation, line.Origin, backScale, line.MaxWidth, line.Spread);
|
||||
}
|
||||
Texture2D texture = ModContent.Request<Texture2D>("CalamityMod/Particles/BloomCircle").Value;
|
||||
Texture2D square = ModContent.Request<Texture2D>("CalamityMod/Particles/BloomRing").Value;
|
||||
|
||||
Vector2 drawPosition = basePosition;
|
||||
Color drawColor = backColor;
|
||||
Vector2 rotationPoint = texture.Size() * 0.5f;
|
||||
int length = line.Text.Length;
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
Main.EntitySpriteDraw(texture, basePosition + Vector2.UnitX * length * 4 + Vector2.UnitY * 23 + Vector2.UnitX * (i % 2 == 0 ? -10 * i : 10 * i), null, drawColor, (MathHelper.PiOver2), rotationPoint, new Vector2(0.3f - 0.02f * i, 1 + 0.35f * i) * 0.3f * Main.rand.NextFloat(0.9f, 1f), SpriteEffects.None);
|
||||
}
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
float sine = (float)Math.Sin(Main.GlobalTimeWrappedHourly * (0 + i * 0.8f) / MathHelper.Pi);
|
||||
float sine2 = (float)Math.Sin(Main.GlobalTimeWrappedHourly * (5) / MathHelper.Pi);
|
||||
float squareSine = (float)Math.Sin(i * 2.5f / MathHelper.Pi);
|
||||
float clockSine = (float)Math.Sin((float)Math.Pow(Utils.GetLerpValue(0, 110, ((int)(Main.GlobalTimeWrappedHourly * (60 + i * 2)) % 120)), 5));
|
||||
Vector2 weirdPos = Vector2.UnitX * 53 * i * (Utils.GetLerpValue(20, 0, i, true)) + Vector2.UnitY * -23 * squareSine * sine2 + new Vector2(5, 10);
|
||||
for (int t = 0; t < 3; t++)
|
||||
Main.EntitySpriteDraw(square, basePosition + weirdPos, null, drawColor * (1 - 0.03f * i), 0, square.Size() * 0.5f, (1.2f - 0.07f * t) * new Vector2(1, 1) * (0.25f * ((float)Math.Pow(Utils.GetLerpValue(11, 0, i, true), 3) + 0.2f)), SpriteEffects.None);
|
||||
for (int t = 0; t < 3; t++)
|
||||
Main.EntitySpriteDraw(texture, basePosition + weirdPos, null, drawColor * (1 - 0.03f * i), 0, texture.Size() * 0.5f, (0.65f - 0.07f * t) * new Vector2(1, 1) * (0.25f * ((float)Math.Pow(Utils.GetLerpValue(11, 0, i, true), 3) + 0.2f)), SpriteEffects.None);
|
||||
}
|
||||
|
||||
Main.spriteBatch.End();
|
||||
Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, null, null, null, Main.UIScaleMatrix);
|
||||
|
||||
// Draw the front text as usual.
|
||||
ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, line.Font, line.Text, basePosition, rarityColor, line.Rotation, line.Origin, line.BaseScale, line.MaxWidth, line.Spread);
|
||||
|
||||
return false;
|
||||
}
|
||||
if (line.Name == "ItemName" && line.Mod == "Terraria" && item.type == ModContent.ItemType<XyksBlessingOrange>())
|
||||
{
|
||||
Color rarityColor = Color.White;
|
||||
Vector2 basePosition = new Vector2(line.X, line.Y);
|
||||
|
||||
float rate = Main.GlobalTimeWrappedHourly * 6;
|
||||
List<Color> eColors = new List<Color>()
|
||||
{
|
||||
new Color(248, 117, 52),
|
||||
Color.Gold,
|
||||
Color.Orange
|
||||
};
|
||||
int colorIndex = (int)(rate / 2 % eColors.Count);
|
||||
Color currentColor = eColors[colorIndex];
|
||||
Color nextColor = eColors[(colorIndex + 1) % eColors.Count];
|
||||
Color usedColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f);
|
||||
|
||||
Vector2 backScale = line.BaseScale;
|
||||
Color backColor = usedColor;
|
||||
|
||||
Main.spriteBatch.End();
|
||||
Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, null, null, null, null, Main.UIScaleMatrix);
|
||||
|
||||
int draws = 20;
|
||||
for (int i = 0; i < draws; i++)
|
||||
{
|
||||
Vector2 backPosition = basePosition + (MathHelper.TwoPi * i / 20f).ToRotationVector2() * (3.5f);
|
||||
ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, line.Font, line.Text, backPosition, backColor, line.Rotation, line.Origin, backScale, line.MaxWidth, line.Spread);
|
||||
}
|
||||
Texture2D texture = ModContent.Request<Texture2D>("CalamityMod/Particles/BloomCircle").Value;
|
||||
Texture2D texture2 = ModContent.Request<Texture2D>("CalamityMod/Particles/SquareRotated").Value;
|
||||
Texture2D square = ModContent.Request<Texture2D>("CalamityMod/Particles/GlowSquareParticleThick").Value;
|
||||
|
||||
Vector2 drawPosition = basePosition;
|
||||
Color drawColor = backColor;
|
||||
Vector2 rotationPoint = texture.Size() * 0.5f;
|
||||
int length = line.Text.Length;
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
Main.EntitySpriteDraw(texture, basePosition + Vector2.UnitX * length * 4 + Vector2.UnitY * 23 + Vector2.UnitX * (i % 2 == 0 ? -10 * i : 10 * i), null, drawColor, (MathHelper.PiOver2), rotationPoint, new Vector2(0.3f - 0.02f * i, 1 + 0.35f * i) * 0.3f * Main.rand.NextFloat(0.9f, 1f), SpriteEffects.None);
|
||||
}
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
float sine = (float)Math.Sin(Main.GlobalTimeWrappedHourly * (0 + i * 0.8f) / MathHelper.Pi);
|
||||
float squareSine = (float)Math.Sin(i * 2.5f / MathHelper.Pi);
|
||||
float clockSine = (float)Math.Sin((float)Math.Pow(Utils.GetLerpValue(0, 110, ((int)(Main.GlobalTimeWrappedHourly * (60 + i * 2)) % 120)), 5));
|
||||
Vector2 weirdPos = Vector2.UnitX * 53 * i * (Utils.GetLerpValue(20, 0, i, true)) + Vector2.UnitY * 23 * squareSine + Vector2.UnitY * 5.5f * sine + new Vector2(5, 10);
|
||||
for (int t = 0; t < 3; t++)
|
||||
Main.EntitySpriteDraw(square, basePosition + weirdPos, null, drawColor * (1 - 0.03f * i), clockSine * MathHelper.PiOver2 + MathHelper.PiOver4, square.Size() * 0.5f, (1 - 0.07f * t) * new Vector2(1, 1) * (0.25f * ((float)Math.Pow(Utils.GetLerpValue(11, 0, i, true), 3) + 0.2f)), SpriteEffects.None);
|
||||
for (int t = 0; t < 3; t++)
|
||||
Main.EntitySpriteDraw(texture2, basePosition + weirdPos, null, drawColor * (1 - 0.03f * i), clockSine * MathHelper.PiOver2, texture2.Size() * 0.5f, (0.6f - 0.07f * t) * new Vector2(1, 1) * (0.25f * ((float)Math.Pow(Utils.GetLerpValue(11, 0, i, true), 3) + 0.2f)), SpriteEffects.None);
|
||||
}
|
||||
|
||||
Main.spriteBatch.End();
|
||||
Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, null, null, null, Main.UIScaleMatrix);
|
||||
|
||||
// Draw the front text as usual.
|
||||
ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, line.Font, line.Text, basePosition, rarityColor, line.Rotation, line.Origin, line.BaseScale, line.MaxWidth, line.Spread);
|
||||
|
||||
return false;
|
||||
}
|
||||
// Special enchantment line color.
|
||||
if (line.Name == "ItemName" && line.Mod == "Terraria" && item.IsEnchanted())
|
||||
{
|
||||
@@ -1659,6 +1782,64 @@ namespace CalamityMod.Items
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if (line.Name == "ItemName" && line.Mod == "Terraria" && item.type == ModContent.ItemType<Orderbringer>())
|
||||
{
|
||||
Color rarityColor = Color.White;
|
||||
Vector2 basePosition = new Vector2(line.X, line.Y);
|
||||
|
||||
float rate = Main.GlobalTimeWrappedHourly * 29;
|
||||
List<Color> eColors = new List<Color>()
|
||||
{
|
||||
Color.PaleVioletRed,
|
||||
Color.Coral,
|
||||
Color.Khaki,
|
||||
Color.PaleGreen,
|
||||
Color.Turquoise,
|
||||
Color.Violet
|
||||
};
|
||||
|
||||
int colorIndex = (int)(rate / 2 % eColors.Count);
|
||||
Color currentColor = eColors[colorIndex];
|
||||
Color nextColor = eColors[(colorIndex + 1) % eColors.Count];
|
||||
Color usedColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f);
|
||||
|
||||
|
||||
float sine = (float)Math.Sin(Main.GlobalTimeWrappedHourly * 3 / MathHelper.Pi);
|
||||
sine = (float)Math.Pow(MathHelper.Lerp(sine, 0, 0.35f), 5);
|
||||
Vector2 backScale = line.BaseScale;
|
||||
Color backColor = usedColor;
|
||||
Vector2 shake = Main.rand.NextVector2Circular(15, 15) * sine;
|
||||
|
||||
Main.spriteBatch.End();
|
||||
Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, null, null, null, null, Main.UIScaleMatrix);
|
||||
|
||||
int draws = 20;
|
||||
for (int i = 0; i < draws; i++)
|
||||
{
|
||||
shake = Main.rand.NextVector2Circular(15, 15) * sine;
|
||||
Vector2 backPosition = basePosition + (MathHelper.TwoPi * i / 20f).ToRotationVector2() * (5 + 0.5f * sine);
|
||||
ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, line.Font, line.Text, shake * 4 + backPosition, backColor, line.Rotation, line.Origin, backScale, line.MaxWidth, line.Spread);
|
||||
}
|
||||
Texture2D texture = ModContent.Request<Texture2D>("CalamityMod/Particles/BloomCircle").Value;
|
||||
|
||||
Vector2 drawPosition = basePosition;
|
||||
Color drawColor = backColor;
|
||||
Vector2 rotationPoint = texture.Size() * 0.5f;
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
int length = line.Text.Length;
|
||||
Main.EntitySpriteDraw(texture, basePosition + Vector2.UnitX * length * 4 + Vector2.UnitY * 10 + Vector2.UnitX * (i % 2 == 0 ? -7 * i : 7 * i), null, drawColor, (MathHelper.PiOver2), rotationPoint, new Vector2(1 - 0.05f * i * (1 + 0.2f * -sine), 1 + 0.75f * i * (1 + 0.2f * sine) * 1f) * 0.3f * Main.rand.NextFloat(0.9f, 1f), SpriteEffects.None);
|
||||
}
|
||||
|
||||
Main.spriteBatch.End();
|
||||
Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, null, null, null, Main.UIScaleMatrix);
|
||||
|
||||
// Draw the front text as usual.
|
||||
ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, line.Font, line.Text, shake + basePosition, rarityColor, line.Rotation, line.Origin, line.BaseScale, line.MaxWidth, line.Spread);
|
||||
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
using CalamityMod.CalPlayer;
|
||||
using CalamityMod.Items.PermanentBoosters;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Items
|
||||
{
|
||||
public class DisgustingMeat : ModItem, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Items.Misc";
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.DefaultToFood(32, 30, 0, 0);
|
||||
Item.value = 0;
|
||||
Item.UseSound = SoundID.NPCDeath13;
|
||||
Item.maxStack = 1;
|
||||
Item.consumable = false;
|
||||
}
|
||||
|
||||
public override bool AltFunctionUse(Player player) => true;
|
||||
public override bool? UseItem(Player player)
|
||||
{
|
||||
var calPlayer = player.Calamity();
|
||||
if (player.altFunctionUse == 2)
|
||||
{
|
||||
TryDropBoosterItem(player, ref calPlayer.rageBoostOne, ModContent.ItemType<MushroomPlasmaRoot>());
|
||||
TryDropBoosterItem(player, ref calPlayer.rageBoostTwo, ModContent.ItemType<InfernalBlood>());
|
||||
TryDropBoosterItem(player, ref calPlayer.rageBoostThree, ModContent.ItemType<RedLightningContainer>());
|
||||
TryDropBoosterItem(player, ref calPlayer.adrenalineBoostOne, ModContent.ItemType<ElectrolyteGelPack>());
|
||||
TryDropBoosterItem(player, ref calPlayer.adrenalineBoostTwo, ModContent.ItemType<StarlightFuelCell>());
|
||||
TryDropBoosterItem(player, ref calPlayer.adrenalineBoostThree, ModContent.ItemType<Ectoheart>());
|
||||
TryDropBoosterItem(player, ref calPlayer.nimbleBounderBoost, ModContent.ItemType<NimbleBounder>());
|
||||
}
|
||||
else
|
||||
{
|
||||
TryDropBoosterItem(player, ref calPlayer.sTangerine, ModContent.ItemType<SanguineTangerine>());
|
||||
TryDropBoosterItem(player, ref calPlayer.mFruit, ModContent.ItemType<MiracleFruit>());
|
||||
TryDropBoosterItem(player, ref calPlayer.tCloudberry, ModContent.ItemType<TaintedCloudberry>());
|
||||
TryDropBoosterItem(player, ref calPlayer.sStrawberry, ModContent.ItemType<SacredStrawberry>());
|
||||
TryDropBoosterItem(player, ref calPlayer.cShard, ModContent.ItemType<CometShard>());
|
||||
TryDropBoosterItem(player, ref calPlayer.eCore, ModContent.ItemType<EtherealCore>());
|
||||
TryDropBoosterItem(player, ref calPlayer.pHeart, ModContent.ItemType<PhantomHeart>());
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private static void TryDropBoosterItem(Player player, ref bool condition, int itemType)
|
||||
{
|
||||
if (condition)
|
||||
{
|
||||
condition = false;
|
||||
int drop = Item.NewItem(player.GetSource_DropAsItem(), player.Hitbox, itemType);
|
||||
Main.item[drop].noGrabDelay = 100;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 3.1 KiB |
@@ -60,7 +60,7 @@ namespace CalamityMod.Items.Materials
|
||||
return true;
|
||||
else
|
||||
{
|
||||
spriteBatch.Draw(altTexture.Value, position, null, drawColor, 0, origin, altTexture.Size() / 2, SpriteEffects.None, 0);
|
||||
spriteBatch.Draw(altTexture.Value, position, null, drawColor, 0, altTexture.Size() / 2, scale, SpriteEffects.None, 0);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,6 +91,7 @@ namespace CalamityMod.Items.Placeables.Furniture.DevPaintings
|
||||
"Spider Prov",
|
||||
"StipulateVenus",
|
||||
"Tobias",
|
||||
"Tomat",
|
||||
"Triangle",
|
||||
"TYESKI (Universe)",
|
||||
"Uncle Danny",
|
||||
@@ -189,7 +190,6 @@ namespace CalamityMod.Items.Placeables.Furniture.DevPaintings
|
||||
"ThousandFields",
|
||||
"TikiWiki",
|
||||
"Tinymanx",
|
||||
"Tomat",
|
||||
"Trivaxy",
|
||||
"Uberransy",
|
||||
"Vaikyia",
|
||||
|
||||
@@ -34,12 +34,12 @@ namespace CalamityMod.Items.SummonItems
|
||||
|
||||
public override bool CanUseItem(Player player)
|
||||
{
|
||||
return player.ZoneJungle && !NPC.AnyNPCs(ModContent.NPCType<Bumblefuck>()) && !BossRushEvent.BossRushActive;
|
||||
return player.ZoneJungle && !NPC.AnyNPCs(ModContent.NPCType<Dragonfolly>()) && !BossRushEvent.BossRushActive;
|
||||
}
|
||||
|
||||
public override bool? UseItem(Player player)
|
||||
{
|
||||
CalamityUtils.SpawnBossUsingItem<Bumblefuck>(player, SoundID.Roar);
|
||||
CalamityUtils.SpawnBossUsingItem<Dragonfolly>(player, SoundID.Roar);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace CalamityMod.Items.TreasureBags
|
||||
public override void ModifyItemLoot(ItemLoot itemLoot)
|
||||
{
|
||||
// Money
|
||||
itemLoot.Add(ItemDropRule.CoinsBasedOnNPCValue(ModContent.NPCType<Bumblefuck>()));
|
||||
itemLoot.Add(ItemDropRule.CoinsBasedOnNPCValue(ModContent.NPCType<Dragonfolly>()));
|
||||
|
||||
// Materials
|
||||
itemLoot.Add(ModContent.ItemType<EffulgentFeather>(), 1, 30, 35);
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Magic
|
||||
Item.height = 40;
|
||||
Item.damage = 159;
|
||||
Item.DamageType = DamageClass.Magic;
|
||||
Item.mana = 38;
|
||||
Item.mana = 45;
|
||||
Item.useTime = 50;
|
||||
Item.useAnimation = 50;
|
||||
Item.useStyle = ItemUseStyleID.Shoot;
|
||||
@@ -33,6 +33,8 @@ namespace CalamityMod.Items.Weapons.Magic
|
||||
}
|
||||
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
|
||||
{
|
||||
if (player.velocity.Length() <= 12)
|
||||
player.velocity += -velocity.SafeNormalize(Vector2.UnitX) * 5f;
|
||||
bool MaxMana = player.statMana >= (player.statManaMax2 - ((int)(Item.mana * player.manaCost))) && !player.HasBuff(BuffID.ManaSickness);
|
||||
Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, 0f, MaxMana ? 1f : 0f);
|
||||
|
||||
|
||||
@@ -24,9 +24,9 @@ namespace CalamityMod.Items.Weapons.Magic
|
||||
{
|
||||
Item.width = 40;
|
||||
Item.height = 56;
|
||||
Item.damage = 3900;
|
||||
Item.damage = 5000;
|
||||
Item.DamageType = DamageClass.Magic;
|
||||
Item.mana = 85;
|
||||
Item.mana = 95;
|
||||
Item.useTime = 78;
|
||||
Item.useAnimation = 78;
|
||||
Item.useStyle = ItemUseStyleID.Shoot;
|
||||
@@ -41,6 +41,9 @@ namespace CalamityMod.Items.Weapons.Magic
|
||||
}
|
||||
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
|
||||
{
|
||||
if (player.velocity.Length() <= 16)
|
||||
player.velocity += -velocity.SafeNormalize(Vector2.UnitX) * 7.5f;
|
||||
|
||||
bool MaxMana = player.statMana >= (player.statManaMax2 - ((int)(Item.mana * player.manaCost))) && !player.HasBuff(BuffID.ManaSickness);
|
||||
for (int i = -2; i <= 2; i++)
|
||||
{
|
||||
|
||||
@@ -38,10 +38,14 @@ namespace CalamityMod.Items.Weapons.Magic
|
||||
}
|
||||
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
|
||||
{
|
||||
if (player.velocity.Length() <= 14)
|
||||
player.velocity += -velocity.SafeNormalize(Vector2.UnitX) * 6f;
|
||||
|
||||
Vector2 staticSpeed = Utils.DirectionTo(player.Center, player.Calamity().mouseWorld) * Utils.Distance(player.Center, player.ClampedMouseWorld()) * 0.008f;
|
||||
bool MaxMana = player.statMana >= (player.statManaMax2 - ((int)(Item.mana * player.manaCost))) && !player.HasBuff(BuffID.ManaSickness);
|
||||
float rotation = 0.4f;
|
||||
Projectile.NewProjectile(source, position, velocity.RotatedBy(-rotation), type, damage / 2, knockback, player.whoAmI, 0f, 1f, MaxMana ? 1f : 0f);
|
||||
Projectile.NewProjectile(source, position, velocity.RotatedBy(rotation), type, damage / 2, knockback, player.whoAmI, 0f, 0f, MaxMana ? 1f : 0f);
|
||||
Projectile.NewProjectile(source, position, staticSpeed.RotatedBy(-rotation), type, damage / 2, knockback, player.whoAmI, 0f, 1f, MaxMana ? 1f : 0f);
|
||||
Projectile.NewProjectile(source, position, staticSpeed.RotatedBy(rotation), type, damage / 2, knockback, player.whoAmI, 0f, 0f, MaxMana ? 1f : 0f);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1,85 +1,144 @@
|
||||
using CalamityMod.Dusts;
|
||||
using System;
|
||||
using CalamityMod.Items.Materials;
|
||||
using CalamityMod.Particles;
|
||||
using CalamityMod.Projectiles.Melee;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Items.Weapons.Melee
|
||||
{
|
||||
public class GreatswordofJudgement : ModItem, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Items.Weapons.Melee";
|
||||
private float swingRoatation = 0;
|
||||
private int time = 0;
|
||||
private Color mainColor;
|
||||
private int swordDirection;
|
||||
private int useTime = 20;
|
||||
private int opacityAdjust = 0;
|
||||
private float smearOpacity = 0;
|
||||
public int time = 0;
|
||||
public Vector2 bladeHitboxPos;
|
||||
public float bladeRotation = 0;
|
||||
public int bladeDirection = 0;
|
||||
public float completion = 0;
|
||||
public bool canHit => (completion >= 0.35f && completion <= 0.8f);
|
||||
public int swingCount = 0;
|
||||
public bool spawnProj = true;
|
||||
public bool playSound = true;
|
||||
|
||||
public Color clr = Color.MediumOrchid;
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.width = 78;
|
||||
Item.height = 78;
|
||||
Item.damage = 155;
|
||||
Item.damage = 240;
|
||||
Item.DamageType = DamageClass.Melee;
|
||||
Item.useStyle = ItemUseStyleID.Swing;
|
||||
Item.useAnimation = Item.useTime = useTime;
|
||||
Item.useAnimation = Item.useTime = 20;
|
||||
Item.useTurn = true;
|
||||
Item.knockBack = 7f;
|
||||
Item.UseSound = SoundID.Item60;
|
||||
Item.autoReuse = true;
|
||||
Item.value = CalamityGlobalItem.RarityPurpleBuyPrice;
|
||||
Item.rare = ItemRarityID.Purple;
|
||||
Item.shoot = ModContent.ProjectileType<JudgementProj>();
|
||||
Item.shootSpeed = 5f;
|
||||
Item.shootSpeed = 5.5f;
|
||||
}
|
||||
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
public override void UseItemHitbox(Player player, ref Rectangle hitbox, ref bool noHitbox)
|
||||
{
|
||||
float scale = 1.1f;
|
||||
// Basically just insures the enemy is always able to be hit if they're in range, the actual collision check is done in CanHitNPC
|
||||
float scale = 8f;
|
||||
Vector2 newSize = new Point(hitbox.Width, hitbox.Height).ToVector2() * scale;
|
||||
hitbox = new Rectangle(hitbox.X - (int)((newSize.X - hitbox.Width) / 2f), hitbox.Y - (int)((newSize.Y - hitbox.Height) / 2f), (int)newSize.X, (int)newSize.Y);
|
||||
hitbox = new Rectangle((int)(bladeHitboxPos.X - newSize.X / 2f), (int)(bladeHitboxPos.Y - newSize.Y / 2f), (int)newSize.X, (int)newSize.Y);
|
||||
}
|
||||
public override bool? CanHitNPC(Player player, NPC target)
|
||||
{
|
||||
Vector2 mPos = player.Calamity().mouseWorld;
|
||||
Vector2 shootDir = player.Center.DirectionTo(mPos);
|
||||
float _ = float.NaN;
|
||||
bool hitCheck = Collision.CheckAABBvLineCollision(target.Hitbox.TopLeft(), target.Hitbox.Size(), player.Center - shootDir * 30, player.Center + shootDir * 145, Item.width * 3f, ref _);
|
||||
return ((canHit && hitCheck) ? null : false);
|
||||
}
|
||||
public override void UseAnimation(Player player)
|
||||
{
|
||||
swordDirection = player.direction;
|
||||
swingCount++;
|
||||
time = 0;
|
||||
swingRoatation = 0;
|
||||
mainColor = Main.rand.NextBool() ? Color.MediumPurple : Color.MediumOrchid;
|
||||
opacityAdjust = 0;
|
||||
smearOpacity = 0;
|
||||
bladeDirection = player.direction;
|
||||
bladeHitboxPos = player.Center;
|
||||
bladeRotation = 0;
|
||||
spawnProj = true;
|
||||
playSound = true;
|
||||
int dir = -Math.Sign(player.Center.X - player.Calamity().mouseWorld.X);
|
||||
float startRot = MathHelper.ToRadians(-90) * dir * (swingCount % 2 == 0 ? 1 : -1);
|
||||
|
||||
clr = Main.rand.NextBool() ? Color.MediumPurple : Color.MediumOrchid;
|
||||
}
|
||||
public override void MeleeEffects(Player player, Rectangle hitbox)
|
||||
{
|
||||
opacityAdjust++;
|
||||
if (opacityAdjust >= 5 && opacityAdjust <= 15 && smearOpacity < 0.9f)
|
||||
smearOpacity += 0.1f;
|
||||
else if (smearOpacity > 0)
|
||||
smearOpacity -= 0.2f;
|
||||
Vector2 mPos = player.Calamity().mouseWorld;
|
||||
completion = (float)((float)time / ((float)(Item.useAnimation / player.GetAttackSpeed(DamageClass.Melee))));
|
||||
int dir = -Math.Sign(player.Center.X - mPos.X);
|
||||
|
||||
float startRot = MathHelper.ToRadians(-110) * dir * (swingCount % 2 == 0 ? 1 : -1);
|
||||
float endRot = MathHelper.ToRadians(-110) * dir * (swingCount % 2 == 0 ? -1 : 1);
|
||||
float minRot = MathHelper.ToRadians(-150) * dir * (swingCount % 2 == 0 ? 1 : -1);
|
||||
float cutoff = 0.2f;
|
||||
float cutoff2 = 0.95f;
|
||||
|
||||
Vector2 shootDir = player.Center.DirectionTo(mPos) * Item.shootSpeed;
|
||||
|
||||
if (completion <= cutoff)
|
||||
{
|
||||
float lerp = Utils.GetLerpValue(0, cutoff, completion, true);
|
||||
player.itemRotation = player.Center.DirectionTo(mPos).ToRotation() + MathHelper.Lerp(startRot, minRot, CalamityUtils.EaseInOutExp(lerp, 4f, 4f));
|
||||
player.itemRotation += (MathHelper.Pi) * (dir == 1 ? 0 : 1) + MathHelper.PiOver4 * dir;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (playSound)
|
||||
{
|
||||
SoundStyle swing = new("CalamityMod/Sounds/Item/SwooshMid");
|
||||
SoundEngine.PlaySound(swing with { Pitch = Main.rand.NextFloat(0.1f, 0.3f), Volume = 1f }, player.Center);
|
||||
playSound = false;
|
||||
}
|
||||
if (completion >= 0.65f && spawnProj)
|
||||
{
|
||||
Projectile.NewProjectile(player.GetSource_FromThis(), player.Center, shootDir, Item.shoot, Item.damage, Item.knockBack, player.whoAmI, 0f);
|
||||
|
||||
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.6f, clr, new Vector2(1f, 1f), true, false, 0, false, false);
|
||||
GeneralParticleHandler.SpawnParticle(swipe);
|
||||
|
||||
SoundEngine.PlaySound(SoundID.Item60, player.Center);
|
||||
spawnProj = false;
|
||||
}
|
||||
float lerp = Utils.GetLerpValue(cutoff, cutoff2, completion, true);
|
||||
player.itemRotation = player.Center.DirectionTo(mPos).ToRotation() + MathHelper.Lerp(minRot, endRot, CalamityUtils.EaseInOutExp(lerp, 6f, 2f));
|
||||
player.itemRotation += (MathHelper.Pi) * (dir == 1 ? 0 : 1) + MathHelper.PiOver4 * dir;
|
||||
}
|
||||
|
||||
float extraRot = (dir == 1 ? -MathHelper.PiOver4 : MathHelper.ToRadians(225));
|
||||
bladeHitboxPos = player.Center + (player.itemRotation + extraRot).ToRotationVector2() * 180;
|
||||
|
||||
player.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, player.itemRotation + MathHelper.ToRadians(-130) * dir);
|
||||
player.SetCompositeArmBack(true, Player.CompositeArmStretchAmount.Full, player.itemRotation + MathHelper.ToRadians(-130) * dir);
|
||||
|
||||
player.itemLocation = player.Center;
|
||||
player.direction = dir;
|
||||
|
||||
time++;
|
||||
swingRoatation += swordDirection == 1 ? 0.13f : -0.13f;
|
||||
|
||||
float Rot = (swordDirection == -1 ? 1.8f : -1.8f) + swingRoatation;
|
||||
if (swordDirection != player.direction)
|
||||
}
|
||||
public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone)
|
||||
{
|
||||
int beamDamage = player.CalcIntDamage<MeleeDamageClass>(Item.damage * 0.4f);
|
||||
Vector2 mouseClamped = player.ClampedMouseWorld();
|
||||
SoundEngine.PlaySound(SoundID.Item84 with { Volume = 1f, Pitch = Main.rand.NextFloat(0.5f, 0.7f) }, player.Center);
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
swingRoatation *= -1;
|
||||
swordDirection = player.direction;
|
||||
}
|
||||
Particle Smear = new SemiCircularSmearFade(player.Center, Vector2.Zero, mainColor * smearOpacity, Rot, Main.rand.NextFloat(1.95f, 2.2f), new Vector2(1, 1), 2, true, false, true, player.direction);
|
||||
GeneralParticleHandler.SpawnParticle(Smear);
|
||||
|
||||
if (Main.rand.NextBool(3))
|
||||
{
|
||||
Vector2 dustVel = new Vector2(5 * swordDirection, -5).RotatedByRandom(1.55f) * Main.rand.NextFloat(0.7f, 1.3f);
|
||||
Dust dust = Dust.NewDustPerfect(player.Center + dustVel * 9, 278);
|
||||
dust.scale = Main.rand.NextFloat(0.4f, 0.55f);
|
||||
dust.velocity = dustVel * 0.55f;
|
||||
dust.color = Main.rand.NextBool() ? Color.MediumPurple : Color.MediumOrchid;
|
||||
dust.noGravity = true;
|
||||
Vector2 vel = player.Center.DirectionFrom(target.Center).RotatedByRandom(0.7f) * Main.rand.NextFloat(18, 20);
|
||||
Projectile.NewProjectile(player.GetSource_ItemUse(Item), player.Center, vel, ModContent.ProjectileType<StarofJudgement>(), beamDamage, 0, player.whoAmI, 0, (i == 0 ? -1 : 1), 1);
|
||||
}
|
||||
}
|
||||
public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI)
|
||||
@@ -90,6 +149,8 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
{
|
||||
CreateRecipe().
|
||||
AddIngredient(ItemID.LunarBar, 7).
|
||||
AddIngredient<CoreofCalamity>().
|
||||
AddIngredient<GalacticaSingularity>(5).
|
||||
AddTile(TileID.LunarCraftingStation).
|
||||
Register();
|
||||
}
|
||||
|
||||
@@ -1,193 +0,0 @@
|
||||
using System;
|
||||
using CalamityMod.Buffs.DamageOverTime;
|
||||
using CalamityMod.Buffs.StatDebuffs;
|
||||
using CalamityMod.Items.Materials;
|
||||
using CalamityMod.Projectiles.Melee;
|
||||
using CalamityMod.Rarities;
|
||||
using CalamityMod.Tiles.Furniture.CraftingStations;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Items.Weapons.Melee
|
||||
{
|
||||
[LegacyName("ElementalExcalibur")]
|
||||
public class IridescentExcalibur : ModItem, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Items.Weapons.Melee";
|
||||
|
||||
private int MaxBeamTypes = 12;
|
||||
|
||||
private int BeamType = 0;
|
||||
|
||||
private const int Alpha = 100;
|
||||
|
||||
private const float ShootSpeed = 16f;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.width = 112;
|
||||
Item.height = 112;
|
||||
Item.damage = 3000;
|
||||
Item.useAnimation = Item.useTime = 15;
|
||||
Item.useStyle = ItemUseStyleID.Swing;
|
||||
Item.useTurn = true;
|
||||
Item.DamageType = DamageClass.Melee;
|
||||
Item.knockBack = 8f;
|
||||
Item.UseSound = SoundID.Item1;
|
||||
Item.autoReuse = true;
|
||||
Item.value = CalamityGlobalItem.RarityHotPinkBuyPrice;
|
||||
Item.shoot = ModContent.ProjectileType<GayBeam>();
|
||||
Item.shootSpeed = ShootSpeed;
|
||||
Item.rare = ModContent.RarityType<HotPink>();
|
||||
Item.shootsEveryUse = true;
|
||||
}
|
||||
|
||||
public override void UseStyle(Player player, Rectangle heldItemFrame)
|
||||
{
|
||||
player.itemLocation += new Vector2(-12f * player.direction, 2f * player.gravDir).RotatedBy(player.itemRotation);
|
||||
}
|
||||
|
||||
public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI)
|
||||
{
|
||||
Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request<Texture2D>("CalamityMod/Items/Weapons/Melee/IridescentExcaliburGlow").Value);
|
||||
}
|
||||
|
||||
// Terraria seems to really dislike high crit values in SetDefaults
|
||||
public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 10;
|
||||
|
||||
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
|
||||
{
|
||||
if (player.altFunctionUse == 2)
|
||||
{
|
||||
float adjustedItemScale = player.GetAdjustedItemScale(Item);
|
||||
Projectile.NewProjectile(source, player.MountedCenter, new Vector2(player.direction, 0f), ModContent.ProjectileType<IridescentExcaliburSlash>(), damage, knockback, player.whoAmI, (float)player.direction * player.gravDir, player.itemAnimationMax, adjustedItemScale);
|
||||
Projectile.NewProjectile(source, player.MountedCenter, new Vector2(player.direction, 0f), ModContent.ProjectileType<IridescentExcaliburSlash2>(), 0, knockback, player.whoAmI, (float)player.direction * player.gravDir, player.itemAnimationMax, adjustedItemScale);
|
||||
Projectile.NewProjectile(source, player.MountedCenter, new Vector2(player.direction, 0f), ModContent.ProjectileType<IridescentExcaliburSlash3>(), 0, knockback, player.whoAmI, (float)player.direction * player.gravDir, player.itemAnimationMax, adjustedItemScale);
|
||||
NetMessage.SendData(MessageID.PlayerControls, -1, -1, null, player.whoAmI);
|
||||
}
|
||||
else
|
||||
{
|
||||
int proj = Projectile.NewProjectile(source, position, velocity, type, (int)Math.Round(damage * 0.5), knockback * 0.5f, player.whoAmI, (float)BeamType);
|
||||
if (BeamType == 7)
|
||||
Main.projectile[proj].penetrate = 3;
|
||||
|
||||
BeamType++;
|
||||
if (BeamType >= MaxBeamTypes)
|
||||
BeamType = 0;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override bool AltFunctionUse(Player player) => true;
|
||||
|
||||
public override bool? UseItem(Player player)
|
||||
{
|
||||
Item.noMelee = player.altFunctionUse == 2;
|
||||
return base.UseItem(player);
|
||||
}
|
||||
|
||||
public override void ModifyHitNPC(Player player, NPC target, ref NPC.HitModifiers modifiers)
|
||||
{
|
||||
if (player.altFunctionUse == 2)
|
||||
modifiers.SourceDamage *= 2;
|
||||
}
|
||||
|
||||
public override void ModifyHitPvp(Player player, Player target, ref Player.HurtModifiers modifiers)
|
||||
{
|
||||
if (player.altFunctionUse == 2)
|
||||
modifiers.SourceDamage *= 2;
|
||||
}
|
||||
|
||||
public override void MeleeEffects(Player player, Rectangle hitbox)
|
||||
{
|
||||
if (Main.rand.NextBool())
|
||||
{
|
||||
Color rainbowColor = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, Alpha);
|
||||
Color color = Color.White;
|
||||
int dustChoice = player.altFunctionUse == 2 ? Main.rand.Next(12) : BeamType;
|
||||
switch (dustChoice)
|
||||
{
|
||||
case 0: // Red
|
||||
color = new Color(255, 0, 0, Alpha);
|
||||
break;
|
||||
case 1: // Orange
|
||||
color = new Color(255, 128, 0, Alpha);
|
||||
break;
|
||||
case 2: // Yellow
|
||||
color = new Color(255, 255, 0, Alpha);
|
||||
break;
|
||||
case 3: // Lime
|
||||
color = new Color(128, 255, 0, Alpha);
|
||||
break;
|
||||
case 4: // Green
|
||||
color = new Color(0, 255, 0, Alpha);
|
||||
break;
|
||||
case 5: // Turquoise
|
||||
color = new Color(0, 255, 128, Alpha);
|
||||
break;
|
||||
case 6: // Cyan
|
||||
color = new Color(0, 255, 255, Alpha);
|
||||
break;
|
||||
case 7: // Light Blue
|
||||
color = new Color(0, 128, 255, Alpha);
|
||||
break;
|
||||
case 8: // Blue
|
||||
color = new Color(0, 0, 255, Alpha);
|
||||
break;
|
||||
case 9: // Purple
|
||||
color = new Color(128, 0, 255, Alpha);
|
||||
break;
|
||||
case 10: // Fuschia
|
||||
color = new Color(255, 0, 255, Alpha);
|
||||
break;
|
||||
case 11: // Hot Pink
|
||||
color = new Color(255, 0, 128, Alpha);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
Dust rainbow = Main.dust[Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, DustID.RainbowMk2)];
|
||||
rainbow.velocity *= 0f;
|
||||
rainbow.color = Color.Lerp(rainbowColor, color, (float)Math.Sqrt((MathF.Cos(Main.GlobalTimeWrappedHourly / 60f) + 1f) * 0.5f));
|
||||
rainbow.color.A = 100;
|
||||
rainbow.scale = Main.rand.NextFloat(1.2f, 1.6f);
|
||||
rainbow.fadeIn = Main.rand.NextFloat(0.4f, 1f);
|
||||
rainbow.noGravity = true;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone)
|
||||
{
|
||||
target.AddBuff(ModContent.BuffType<MiracleBlight>(), 600);
|
||||
target.AddBuff(ModContent.BuffType<GlacialState>(), 60);
|
||||
}
|
||||
|
||||
public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo)
|
||||
{
|
||||
target.AddBuff(ModContent.BuffType<MiracleBlight>(), 600);
|
||||
target.AddBuff(ModContent.BuffType<GlacialState>(), 60);
|
||||
}
|
||||
|
||||
public override void AddRecipes()
|
||||
{
|
||||
CreateRecipe().
|
||||
AddIngredient(ItemID.TrueExcalibur).
|
||||
AddIngredient<Orderbringer>().
|
||||
AddIngredient<MiracleMatter>(3).
|
||||
AddIngredient<AshesofAnnihilation>(15).
|
||||
AddTile<DraedonsForge>().
|
||||
Register();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 666 B |
@@ -1,42 +1,44 @@
|
||||
using CalamityMod.Items.Materials;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using CalamityMod.Items.Materials;
|
||||
using CalamityMod.Particles;
|
||||
using CalamityMod.Projectiles.Melee;
|
||||
using CalamityMod.Rarities;
|
||||
using CalamityMod.Tiles.Furniture.CraftingStations;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ID;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria.ModLoader;
|
||||
using CalamityMod.Particles;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.DataStructures;
|
||||
using Basic.Reference.Assemblies;
|
||||
using System;
|
||||
using Mono.Cecil;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Items.Weapons.Melee
|
||||
{
|
||||
[LegacyName("GreatswordofBlah")]
|
||||
[LegacyName("IridescentExcalibur")]
|
||||
public class Orderbringer : ModItem, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Items.Weapons.Melee";
|
||||
private float swingRoatation = 0;
|
||||
private int time = 0;
|
||||
private Color mainColor;
|
||||
private int swordDirection;
|
||||
private int useTime = 18;
|
||||
private int opacityAdjust = 0;
|
||||
private float smearOpacity = 0;
|
||||
public int time = 0;
|
||||
public Vector2 bladeHitboxPos;
|
||||
public float bladeRotation = 0;
|
||||
public int bladeDirection = 0;
|
||||
public float completion = 0;
|
||||
public bool canHit => (completion >= 0.35f && completion <= 0.8f);
|
||||
public int swingCount = 0;
|
||||
public bool spawnProj = true;
|
||||
public bool playSound = true;
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.width = Item.height = 108;
|
||||
Item.damage = 445;
|
||||
Item.width = Item.height = 112;
|
||||
Item.damage = 840;
|
||||
Item.DamageType = DamageClass.Melee;
|
||||
Item.useAnimation = Item.useTime = useTime;
|
||||
Item.useAnimation = Item.useTime = 16;
|
||||
Item.useStyle = ItemUseStyleID.Swing;
|
||||
Item.useTurn = true;
|
||||
Item.knockBack = 8f;
|
||||
Item.UseSound = SoundID.Item60;
|
||||
Item.autoReuse = true;
|
||||
Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice;
|
||||
Item.rare = ModContent.RarityType<CosmicPurple>();
|
||||
@@ -45,87 +47,149 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
}
|
||||
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
|
||||
{
|
||||
Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f);
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
Vector2 vel = (velocity * 2.5f).RotatedByRandom(0.6f);
|
||||
Projectile.NewProjectile(source, player.ClampedMouseWorld() - (velocity * 40) + Main.rand.NextVector2Circular(130, 130), vel * Main.rand.NextFloat(0.8f, 1.2f), ModContent.ProjectileType<StarofJudgement>(), (int)(damage * 0.1f), knockback * 0.2f, player.whoAmI, 0, 0, 1);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public override void UseItemHitbox(Player player, ref Rectangle hitbox, ref bool noHitbox)
|
||||
{
|
||||
float scale = 1.2f;
|
||||
// Basically just insures the enemy is always able to be hit if they're in range, the actual collision check is done in CanHitNPC
|
||||
float scale = 8f;
|
||||
Vector2 newSize = new Point(hitbox.Width, hitbox.Height).ToVector2() * scale;
|
||||
hitbox = new Rectangle(hitbox.X - (int)((newSize.X - hitbox.Width) / 2f), hitbox.Y - (int)((newSize.Y - hitbox.Height) / 2f), (int)newSize.X, (int)newSize.Y);
|
||||
hitbox = new Rectangle((int)(bladeHitboxPos.X - newSize.X / 2f), (int)(bladeHitboxPos.Y - newSize.Y / 2f), (int)newSize.X, (int)newSize.Y);
|
||||
}
|
||||
public override bool? CanHitNPC(Player player, NPC target)
|
||||
{
|
||||
Vector2 mPos = player.Calamity().mouseWorld;
|
||||
Vector2 shootDir = player.Center.DirectionTo(mPos);
|
||||
float _ = float.NaN;
|
||||
bool hitCheck = Collision.CheckAABBvLineCollision(target.Hitbox.TopLeft(), target.Hitbox.Size(), player.Center - shootDir * 30, player.Center + shootDir * 245, Item.width * 3f, ref _);
|
||||
return ((canHit && hitCheck) ? null : false);
|
||||
}
|
||||
public override void UseAnimation(Player player)
|
||||
{
|
||||
swordDirection = player.direction;
|
||||
swingCount++;
|
||||
time = 0;
|
||||
swingRoatation = 0;
|
||||
mainColor = Main.rand.NextBool() ? Color.MediumPurple : Color.MediumOrchid;
|
||||
opacityAdjust = 0;
|
||||
smearOpacity = 0;
|
||||
bladeDirection = player.direction;
|
||||
bladeHitboxPos = player.Center;
|
||||
bladeRotation = 0;
|
||||
spawnProj = true;
|
||||
playSound = true;
|
||||
int dir = -Math.Sign(player.Center.X - player.Calamity().mouseWorld.X);
|
||||
float startRot = MathHelper.ToRadians(-90) * dir * (swingCount % 2 == 0 ? 1 : -1);
|
||||
}
|
||||
public override void MeleeEffects(Player player, Rectangle hitbox)
|
||||
{
|
||||
opacityAdjust++;
|
||||
if (opacityAdjust >= 5 && opacityAdjust <= 15 && smearOpacity < 0.9f)
|
||||
smearOpacity += 0.1f;
|
||||
else if (smearOpacity > 0)
|
||||
smearOpacity -= 0.2f;
|
||||
Vector2 mPos = player.Calamity().mouseWorld;
|
||||
completion = (float)((float)time / ((float)(Item.useAnimation / player.GetAttackSpeed(DamageClass.Melee))));
|
||||
int dir = -Math.Sign(player.Center.X - mPos.X);
|
||||
|
||||
float startRot = MathHelper.ToRadians(-110) * dir * (swingCount % 2 == 0 ? 1 : -1);
|
||||
float endRot = MathHelper.ToRadians(-110) * dir * (swingCount % 2 == 0 ? -1 : 1);
|
||||
float minRot = MathHelper.ToRadians(-150) * dir * (swingCount % 2 == 0 ? 1 : -1);
|
||||
float cutoff = 0.2f;
|
||||
float cutoff2 = 0.95f;
|
||||
|
||||
Vector2 shootDir = player.Center.DirectionTo(mPos) * Item.shootSpeed;
|
||||
|
||||
if (completion <= cutoff)
|
||||
{
|
||||
float lerp = Utils.GetLerpValue(0, cutoff, completion, true);
|
||||
player.itemRotation = player.Center.DirectionTo(mPos).ToRotation() + MathHelper.Lerp(startRot, minRot, CalamityUtils.EaseInOutExp(lerp, 4f, 4f));
|
||||
player.itemRotation += (MathHelper.Pi) * (dir == 1 ? 0 : 1) + MathHelper.PiOver4 * dir;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (playSound)
|
||||
{
|
||||
SoundStyle swing = new("CalamityMod/Sounds/Item/SwooshMid");
|
||||
SoundEngine.PlaySound(swing with { Pitch = Main.rand.NextFloat(0.1f, 0.3f), Volume = 1f }, player.Center);
|
||||
playSound = false;
|
||||
}
|
||||
if (completion >= 0.65f && spawnProj)
|
||||
{
|
||||
Projectile.NewProjectile(player.GetSource_FromThis(), player.Center, shootDir, Item.shoot, Item.damage, Item.knockBack, player.whoAmI, 0f);
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
float rot = Main.rand.NextFloat(0.5f, 0.65f) * (Main.rand.NextBool() ? 1 : -1);
|
||||
Vector2 vel = (shootDir * 2.5f).RotatedByRandom(0.6f);
|
||||
Projectile.NewProjectile(player.GetSource_FromThis(), player.ClampedMouseWorld() - (shootDir * 40) + Main.rand.NextVector2Circular(130, 130), vel.RotatedBy(rot) * Main.rand.NextFloat(0.9f, 1.2f), ModContent.ProjectileType<StarofOrder>(), (int)(Item.damage * 0.12f), (int)(Item.knockBack * 0.2f), player.whoAmI, 0, rot, 1);
|
||||
}
|
||||
|
||||
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);
|
||||
GeneralParticleHandler.SpawnParticle(swipe);
|
||||
|
||||
SoundEngine.PlaySound(SoundID.Item60, player.Center);
|
||||
spawnProj = false;
|
||||
}
|
||||
float lerp = Utils.GetLerpValue(cutoff, cutoff2, completion, true);
|
||||
player.itemRotation = player.Center.DirectionTo(mPos).ToRotation() + MathHelper.Lerp(minRot, endRot, CalamityUtils.EaseInOutExp(lerp, 6f, 2f));
|
||||
player.itemRotation += (MathHelper.Pi) * (dir == 1 ? 0 : 1) + MathHelper.PiOver4 * dir;
|
||||
}
|
||||
|
||||
float extraRot = (dir == 1 ? -MathHelper.PiOver4 : MathHelper.ToRadians(225));
|
||||
bladeHitboxPos = player.Center + (player.itemRotation + extraRot).ToRotationVector2() * 240;
|
||||
Vector2 tipPos = player.Center + (player.itemRotation + extraRot).ToRotationVector2() * 180;
|
||||
|
||||
player.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, player.itemRotation + MathHelper.ToRadians(-130) * dir);
|
||||
player.SetCompositeArmBack(true, Player.CompositeArmStretchAmount.Full, player.itemRotation + MathHelper.ToRadians(-130) * dir);
|
||||
|
||||
player.itemLocation = player.Center;
|
||||
player.direction = dir;
|
||||
|
||||
time++;
|
||||
swingRoatation += swordDirection == 1 ? 0.17f : -0.17f;
|
||||
|
||||
float Rot = (swordDirection == -1 ? 1.8f : -1.8f) + swingRoatation;
|
||||
if (swordDirection != player.direction)
|
||||
{
|
||||
swingRoatation *= -1;
|
||||
swordDirection = player.direction;
|
||||
}
|
||||
Particle Smear = new SemiCircularSmearFade(player.Center, Vector2.Zero, mainColor * smearOpacity, Rot, Main.rand.NextFloat(2.8f, 3.2f), new Vector2(1, 1), 2, true, false, true, player.direction);
|
||||
GeneralParticleHandler.SpawnParticle(Smear);
|
||||
|
||||
if (Main.rand.NextBool())
|
||||
{
|
||||
Vector2 dustVel = new Vector2(5 * swordDirection, -5).RotatedByRandom(1.55f) * Main.rand.NextFloat(0.7f, 1.3f) * 2;
|
||||
Dust dust = Dust.NewDustPerfect(player.Center + dustVel * 9, 278);
|
||||
dust.scale = Main.rand.NextFloat(0.5f, 0.75f);
|
||||
dust.velocity = dustVel * 0.55f;
|
||||
dust.color = Main.rand.NextBool() ? Color.MediumPurple : Color.MediumOrchid;
|
||||
dust.noGravity = true;
|
||||
}
|
||||
}
|
||||
public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone)
|
||||
{
|
||||
int beamDamage = player.CalcIntDamage<MeleeDamageClass>(Item.damage * 0.5f);
|
||||
int beamDamage = player.CalcIntDamage<MeleeDamageClass>(Item.damage * 0.4f);
|
||||
Vector2 mouseClamped = player.ClampedMouseWorld();
|
||||
SoundEngine.PlaySound(SoundID.Item84 with { Volume = 1f, Pitch = Main.rand.NextFloat(0.5f, 0.7f)}, player.Center);
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
Vector2 targetPos = Main.MouseWorld;
|
||||
NPC target2 = Main.MouseWorld.ClosestNPCAt(650);
|
||||
if (target2 != null)
|
||||
targetPos = target2.Center + target2.velocity * 14;
|
||||
targetPos = target2.Center;
|
||||
|
||||
Vector2 spawnPos = mouseClamped + new Vector2(Main.rand.NextFloat(-300, 300), -900);
|
||||
Vector2 vel = (targetPos - spawnPos).SafeNormalize(Vector2.UnitY) * 10;
|
||||
Projectile.NewProjectile(player.GetSource_ItemUse(Item), spawnPos, vel, ModContent.ProjectileType<OrderbringerBeam>(), beamDamage, 0, player.whoAmI);
|
||||
}
|
||||
}
|
||||
public override void ModifyTooltips(List<TooltipLine> list)
|
||||
{
|
||||
Player Owner = Main.LocalPlayer;
|
||||
if (Owner is null)
|
||||
return;
|
||||
|
||||
float rate = Main.GlobalTimeWrappedHourly * 7;
|
||||
List<Color> eColors = new List<Color>()
|
||||
{
|
||||
Color.PaleVioletRed,
|
||||
Color.Coral,
|
||||
Color.Khaki,
|
||||
Color.PaleGreen,
|
||||
Color.Turquoise,
|
||||
Color.Violet
|
||||
};
|
||||
|
||||
int colorIndex = (int)(rate / 2 % eColors.Count);
|
||||
Color currentColor = eColors[colorIndex];
|
||||
Color nextColor = eColors[(colorIndex + 1) % eColors.Count];
|
||||
Color finalColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f);
|
||||
TooltipLine line = list.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Tooltip2");
|
||||
if (line != null)
|
||||
line.OverrideColor = Color.Lerp(finalColor, Color.White, 0.3f);
|
||||
}
|
||||
public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI)
|
||||
{
|
||||
Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request<Texture2D>("CalamityMod/Items/Weapons/Melee/OrderbringerGlow").Value);
|
||||
}
|
||||
|
||||
public override void AddRecipes()
|
||||
{
|
||||
CreateRecipe().
|
||||
AddIngredient<GreatswordofJudgement>().
|
||||
AddIngredient<CosmiliteBar>(8).
|
||||
AddIngredient<EndothermicEnergy>(20).
|
||||
AddIngredient<AuricBar>(5).
|
||||
AddIngredient<LifeAlloy>(5).
|
||||
AddTile<CosmicAnvil>().
|
||||
Register();
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 666 B |
@@ -36,51 +36,34 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone)
|
||||
{
|
||||
target.AddBuff(BuffID.OnFire3, 360);
|
||||
SoundEngine.PlaySound(SoundID.Item14, target.Center);
|
||||
int onHitDamage = player.CalcIntDamage<MeleeDamageClass>(Item.damage);
|
||||
Projectile blast = Projectile.NewProjectileDirect(Item.GetSource_FromThis(), target.Center, Vector2.Zero, ModContent.ProjectileType<DirectStrike>(), onHitDamage, 0f, player.whoAmI, target.whoAmI);
|
||||
blast.DamageType = Item.DamageType;
|
||||
float firstDustScale = 1.7f;
|
||||
float secondDustScale = 0.8f;
|
||||
float thirdDustScale = 2f;
|
||||
Vector2 dustRotation = (target.rotation - 1.57079637f).ToRotationVector2();
|
||||
|
||||
Vector2 dustRotation = (target.rotation - MathHelper.PiOver2).ToRotationVector2();
|
||||
Vector2 dustVelocity = dustRotation * target.velocity.Length();
|
||||
SoundEngine.PlaySound(SoundID.Item14, target.Center);
|
||||
int increment;
|
||||
for (int i = 0; i < 40; i = increment + 1)
|
||||
for (int i = 0; i < 40; i++)
|
||||
{
|
||||
int swingDust = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, DustID.InfernoFork, 0f, 0f, 200, default, firstDustScale);
|
||||
Dust dust = Main.dust[swingDust];
|
||||
dust.position = target.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)target.width / 2f;
|
||||
dust.noGravity = true;
|
||||
dust.velocity.Y -= 6f;
|
||||
dust.velocity *= 3f;
|
||||
dust.velocity += dustVelocity * Main.rand.NextFloat();
|
||||
swingDust = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, DustID.InfernoFork, 0f, 0f, 100, default, secondDustScale);
|
||||
dust.position = target.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)target.width / 2f;
|
||||
dust.velocity.Y -= 6f;
|
||||
dust.velocity *= 2f;
|
||||
dust.noGravity = true;
|
||||
dust.fadeIn = 1f;
|
||||
dust.color = Color.Crimson * 0.5f;
|
||||
dust.velocity += dustVelocity * Main.rand.NextFloat();
|
||||
increment = i;
|
||||
Vector2 mainDustPos = target.Center + Main.rand.NextVector2Circular(target.width / 2, target.width / 2);
|
||||
Dust swingDust = Dust.NewDustPerfect(mainDustPos, DustID.InfernoFork, dustVelocity * Main.rand.NextFloat() - Vector2.UnitY * 18f, 200, Scale: 1.7f);
|
||||
swingDust.noGravity = true;
|
||||
|
||||
Dust swingDust2 = Dust.NewDustPerfect(mainDustPos, DustID.InfernoFork, dustVelocity * Main.rand.NextFloat() - Vector2.UnitY * 12f, 100, Color.Crimson * 0.5f, 0.8f);
|
||||
swingDust2.noGravity = true;
|
||||
swingDust2.fadeIn = 1f;
|
||||
}
|
||||
for (int j = 0; j < 20; j = increment + 1)
|
||||
for (int j = 0; j < 20; j++)
|
||||
{
|
||||
int swingDust2 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, DustID.InfernoFork, 0f, 0f, 0, default, thirdDustScale);
|
||||
Dust dust = Main.dust[swingDust2];
|
||||
dust.position = target.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)target.velocity.ToRotation(), default) * (float)target.width / 3f;
|
||||
dust.noGravity = true;
|
||||
dust.velocity.Y -= 6f;
|
||||
dust.velocity *= 0.5f;
|
||||
dust.velocity += dustVelocity * (0.6f + 0.6f * Main.rand.NextFloat());
|
||||
increment = j;
|
||||
Vector2 dustPos = target.Center + Vector2.UnitX.RotatedByRandom(MathHelper.Pi).RotatedBy(target.velocity.ToRotation()) * (target.width / 3f);
|
||||
Dust moreDust = Dust.NewDustPerfect(dustPos, DustID.InfernoFork, dustVelocity * (0.6f + 0.6f * Main.rand.NextFloat()) - Vector2.UnitY * 3f, Scale: 2f);
|
||||
moreDust.noGravity = true;
|
||||
}
|
||||
}
|
||||
|
||||
public override void MeleeEffects(Player player, Rectangle hitbox)
|
||||
{
|
||||
if (player.whoAmI == Main.myPlayer)
|
||||
if (player.whoAmI == Main.myPlayer && !player.Calamity().bladeArmEnchant)
|
||||
{
|
||||
if (player.itemAnimation == (int)(player.itemAnimationMax * 0.1) ||
|
||||
player.itemAnimation == (int)(player.itemAnimationMax * 0.3) ||
|
||||
@@ -88,65 +71,48 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
player.itemAnimation == (int)(player.itemAnimationMax * 0.7) ||
|
||||
player.itemAnimation == (int)(player.itemAnimationMax * 0.9))
|
||||
{
|
||||
float sparkYVel = 0f;
|
||||
float sparkXVel = 0f;
|
||||
float sparkYSpawn = 0f;
|
||||
float sparkYVel = 0f;
|
||||
float sparkXSpawn = 0f;
|
||||
float sparkYSpawn = 0f;
|
||||
|
||||
if (player.itemAnimation == (int)(player.itemAnimationMax * 0.9))
|
||||
{
|
||||
sparkYVel = -7f;
|
||||
sparkYVel = -10.5f;
|
||||
if (player.direction == -1)
|
||||
sparkXSpawn = -8f;
|
||||
}
|
||||
if (player.itemAnimation == (int)(player.itemAnimationMax * 0.7))
|
||||
{
|
||||
sparkYVel = -6f;
|
||||
sparkXVel = 2f;
|
||||
sparkYVel = -9f;
|
||||
sparkXVel = 3f;
|
||||
sparkXSpawn = player.direction == -1 ? 20f : 26f;
|
||||
}
|
||||
if (player.itemAnimation == (int)(player.itemAnimationMax * 0.5))
|
||||
{
|
||||
sparkYVel = -4f;
|
||||
sparkXVel = 4f;
|
||||
}
|
||||
if (player.itemAnimation == (int)(player.itemAnimationMax * 0.3))
|
||||
{
|
||||
sparkYVel = -2f;
|
||||
sparkYVel = -6f;
|
||||
sparkXVel = 6f;
|
||||
}
|
||||
if (player.itemAnimation == (int)(player.itemAnimationMax * 0.1))
|
||||
{
|
||||
sparkXVel = 7f;
|
||||
}
|
||||
if (player.itemAnimation == (int)(player.itemAnimationMax * 0.7))
|
||||
{
|
||||
sparkXSpawn = 26f;
|
||||
}
|
||||
if (player.itemAnimation == (int)(player.itemAnimationMax * 0.3))
|
||||
{
|
||||
sparkXSpawn -= 4f;
|
||||
sparkYSpawn -= 20f;
|
||||
sparkXVel = 9f;
|
||||
sparkYVel = -3f;
|
||||
sparkXSpawn = -4f;
|
||||
sparkYSpawn = -20f;
|
||||
}
|
||||
if (player.itemAnimation == (int)(player.itemAnimationMax * 0.1))
|
||||
{
|
||||
sparkYSpawn += 6f;
|
||||
sparkXVel = 10.5f;
|
||||
sparkYSpawn = 6f;
|
||||
}
|
||||
if (player.direction == -1)
|
||||
{
|
||||
if (player.itemAnimation == (int)(player.itemAnimationMax * 0.9))
|
||||
{
|
||||
sparkXSpawn -= 8f;
|
||||
}
|
||||
if (player.itemAnimation == (int)(player.itemAnimationMax * 0.7))
|
||||
{
|
||||
sparkXSpawn -= 6f;
|
||||
}
|
||||
}
|
||||
sparkYVel *= 1.5f;
|
||||
sparkXVel *= 1.5f;
|
||||
sparkXSpawn *= (float)player.direction;
|
||||
|
||||
sparkXVel *= player.direction;
|
||||
sparkYVel *= player.gravDir;
|
||||
sparkXSpawn *= player.direction;
|
||||
sparkYSpawn *= player.gravDir;
|
||||
var source = player.GetSource_ItemUse(Item);
|
||||
int damage = (int)player.GetTotalDamage<MeleeDamageClass>().ApplyTo(Item.damage * 0.1f);
|
||||
Projectile.NewProjectile(source, (float)(hitbox.X + hitbox.Width / 2) + sparkXSpawn, (float)(hitbox.Y + hitbox.Height / 2) + sparkYSpawn,
|
||||
(float)player.direction * sparkXVel, sparkYVel * player.gravDir, ModContent.ProjectileType<UltimusCleaverDust>(), damage, 0f, player.whoAmI, 0f, 0f);
|
||||
Projectile.NewProjectile(source, hitbox.X + hitbox.Width / 2 + sparkXSpawn, hitbox.Y + hitbox.Height / 2 + sparkYSpawn, sparkXVel, sparkYVel, ModContent.ProjectileType<UltimusCleaverDust>(), damage, 0f, player.whoAmI);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,8 +64,8 @@ namespace CalamityMod.Items.Weapons.Ranged
|
||||
{
|
||||
Vector2 helixVel1 = (velocity * Main.rand.NextFloat(0.9f, 1.1f)).RotatedBy(MathHelper.ToRadians(sine));
|
||||
Vector2 helixVel2 = (velocity * Main.rand.NextFloat(0.9f, 1.1f)).RotatedBy(MathHelper.ToRadians(-sine));
|
||||
int shot1 = Projectile.NewProjectile(source, position.X, position.Y, helixVel1.X, helixVel1.Y, shotType, damage, knockback, player.whoAmI, 0f, 0, 1f);
|
||||
int shot2 = Projectile.NewProjectile(source, position.X, position.Y, helixVel2.X, helixVel2.Y, shotType, damage, knockback, player.whoAmI, 0f, 0, 1f);
|
||||
int shot1 = Projectile.NewProjectile(source, position.X, position.Y, helixVel1.X, helixVel1.Y, shotType, damage, knockback, player.whoAmI, 0f, 0, player.altFunctionUse != 2 ? 1 : 0);
|
||||
int shot2 = Projectile.NewProjectile(source, position.X, position.Y, helixVel2.X, helixVel2.Y, shotType, damage, knockback, player.whoAmI, 0f, 0, player.altFunctionUse != 2 ? 1 : 0);
|
||||
}
|
||||
else if (player.altFunctionUse != 2)
|
||||
{
|
||||
|
||||
@@ -65,9 +65,9 @@ namespace CalamityMod.Items.Weapons.Ranged
|
||||
Vector2 helixVel1 = (velocity * Main.rand.NextFloat(0.9f, 1.1f)).RotatedBy(MathHelper.ToRadians(sine));
|
||||
Vector2 helixVel2 = (velocity * Main.rand.NextFloat(0.9f, 1.1f)).RotatedBy(MathHelper.ToRadians(-sine));
|
||||
Vector2 helixVel3 = (velocity * Main.rand.NextFloat(0.9f, 1.1f)).RotatedBy(MathHelper.ToRadians(sine2));
|
||||
int shot1 = Projectile.NewProjectile(source, position.X, position.Y, helixVel1.X, helixVel1.Y, shotType, damage, knockback, player.whoAmI, 0f, 0, 2f);
|
||||
int shot2 = Projectile.NewProjectile(source, position.X, position.Y, helixVel2.X, helixVel2.Y, shotType, damage, knockback, player.whoAmI, 0f, 0, 4f);
|
||||
int shot3 = Projectile.NewProjectile(source, position.X, position.Y, helixVel3.X, helixVel3.Y, shotType, damage, knockback, player.whoAmI, 0f, 0, 3f);
|
||||
int shot1 = Projectile.NewProjectile(source, position.X, position.Y, helixVel1.X, helixVel1.Y, shotType, damage, knockback, player.whoAmI, 0f, 0, player.altFunctionUse != 2 ? 2f : 0);
|
||||
int shot2 = Projectile.NewProjectile(source, position.X, position.Y, helixVel2.X, helixVel2.Y, shotType, damage, knockback, player.whoAmI, 0f, 0, player.altFunctionUse != 2 ? 4f : 0);
|
||||
int shot3 = Projectile.NewProjectile(source, position.X, position.Y, helixVel3.X, helixVel3.Y, shotType, damage, knockback, player.whoAmI, 0f, 0, player.altFunctionUse != 2 ? 3f : 0);
|
||||
}
|
||||
else if (player.altFunctionUse != 2)
|
||||
{
|
||||
|
||||
@@ -675,7 +675,7 @@ AeolianEarthBuff: {
|
||||
Description:
|
||||
'''
|
||||
You are strengthened by primordial powers
|
||||
Damage reduction increased by {0}%, damage increased by {1}%
|
||||
Damage reduction increased by {0}%, damage increased by {1}%, and massively buffed mana regen
|
||||
'''
|
||||
}
|
||||
|
||||
@@ -885,7 +885,7 @@ SandsWindBuff: {
|
||||
Description:
|
||||
'''
|
||||
You are strengthened by the powers of sand
|
||||
Defense increased by {0}, damage increased by {1}%
|
||||
Defense increased by {0}, damage increased by {1}%, and greatly buffed mana regen
|
||||
'''
|
||||
}
|
||||
|
||||
|
||||
@@ -2161,6 +2161,11 @@ HapuFruit: {
|
||||
Tooltip: "'A fruit that calms your nerves (may have unintended side effects)'"
|
||||
}
|
||||
|
||||
LucisSight: {
|
||||
DisplayName: Luci's Sight
|
||||
Tooltip: "'Fashionable glasses? In Earthia's current economy?!'"
|
||||
}
|
||||
|
||||
OracleHeadphones: {
|
||||
DisplayName: Oracle Headphones
|
||||
Tooltip: "'Hey game's over!'"
|
||||
@@ -2203,7 +2208,7 @@ XyksBlessingBlue: {
|
||||
DisplayName: Xyk's Blessing (Blue)
|
||||
Tooltip:
|
||||
'''
|
||||
Applies visual effects to your dashes and deaths
|
||||
Applies visual effects to your dashes, wings, and deaths
|
||||
<right> to transform
|
||||
'It's simply too much to turn back now; passion and time have long since stained it.
|
||||
[c/5f8ae1:Have I always been so selfish?']
|
||||
@@ -2214,7 +2219,7 @@ XyksBlessingOrange: {
|
||||
DisplayName: Xyk's Blessing (Orange)
|
||||
Tooltip:
|
||||
'''
|
||||
Applies visual effects to your dashes and deaths
|
||||
Applies visual effects to your dashes, wings, and deaths
|
||||
<right> to transform
|
||||
'Even so, the march of time waits for none. Recall that feeling of fulfillment, and show it to the world.
|
||||
[c/E1B65F:Prove that it was never a waste.']
|
||||
|
||||
@@ -17,7 +17,7 @@ AuricTeslaCuisses: {
|
||||
'''
|
||||
}
|
||||
|
||||
AuricTeslaHoodedFacemask: {
|
||||
AuricTeslaHeadRanged: {
|
||||
DisplayName: Auric Tesla Hooded Facemask
|
||||
Tooltip: 30% increased ranged damage and critical strike chance
|
||||
SetBonus:
|
||||
@@ -45,7 +45,7 @@ AuricTeslaHoodedFacemask: {
|
||||
'''
|
||||
}
|
||||
|
||||
AuricTeslaPlumedHelm: {
|
||||
AuricTeslaHeadRogue: {
|
||||
DisplayName: Auric Tesla Plumed Helm
|
||||
Tooltip:
|
||||
'''
|
||||
@@ -78,7 +78,7 @@ AuricTeslaPlumedHelm: {
|
||||
'''
|
||||
}
|
||||
|
||||
AuricTeslaRoyalHelm: {
|
||||
AuricTeslaHeadMelee: {
|
||||
DisplayName: Auric Tesla Royal Helm
|
||||
Tooltip:
|
||||
'''
|
||||
@@ -112,7 +112,7 @@ AuricTeslaRoyalHelm: {
|
||||
'''
|
||||
}
|
||||
|
||||
AuricTeslaSpaceHelmet: {
|
||||
AuricTeslaHeadSummon: {
|
||||
DisplayName: Auric Tesla Space Helmet
|
||||
Tooltip: 15% increased summon damage
|
||||
SetBonus:
|
||||
@@ -142,7 +142,7 @@ AuricTeslaSpaceHelmet: {
|
||||
'''
|
||||
}
|
||||
|
||||
AuricTeslaWireHemmedVisage: {
|
||||
AuricTeslaHeadMagic: {
|
||||
DisplayName: Auric Tesla Wire-Hemmed Visage
|
||||
Tooltip: 30% increased magic damage, 20% increased magic critical strike chance, +100 max mana and 20% reduced mana usage
|
||||
SetBonus:
|
||||
|
||||
@@ -8,7 +8,7 @@ AerospecBreastplate: {
|
||||
'''
|
||||
}
|
||||
|
||||
AerospecHat: {
|
||||
AerospecHeadMagic: {
|
||||
DisplayName: Aerospec Hat
|
||||
Tooltip: 10% increased magic damage and +30 max mana
|
||||
SetBonus:
|
||||
@@ -18,7 +18,7 @@ AerospecHat: {
|
||||
'''
|
||||
}
|
||||
|
||||
AerospecHeadgear: {
|
||||
AerospecHeadRogue: {
|
||||
DisplayName: Aerospec Headgear
|
||||
Tooltip: 10% increased rogue damage and 5% increased movement speed
|
||||
SetBonus:
|
||||
@@ -28,7 +28,7 @@ AerospecHeadgear: {
|
||||
'''
|
||||
}
|
||||
|
||||
AerospecHelm: {
|
||||
AerospecHeadMelee: {
|
||||
DisplayName: Aerospec Helm
|
||||
Tooltip: 10% increased melee damage
|
||||
SetBonus:
|
||||
@@ -38,7 +38,7 @@ AerospecHelm: {
|
||||
'''
|
||||
}
|
||||
|
||||
AerospecHelmet: {
|
||||
AerospecHeadSummon: {
|
||||
DisplayName: Aerospec Helmet
|
||||
Tooltip: 10% increased summon damage and 5% increased movement speed
|
||||
SetBonus:
|
||||
@@ -48,7 +48,7 @@ AerospecHelmet: {
|
||||
'''
|
||||
}
|
||||
|
||||
AerospecHood: {
|
||||
AerospecHeadRanged: {
|
||||
DisplayName: Aerospec Hood
|
||||
Tooltip: 10% increased ranged damage
|
||||
SetBonus: 5% increased movement speed and ranged critical strike chance
|
||||
|
||||
@@ -128,6 +128,21 @@ LeviathanMask: {
|
||||
Tooltip: ""
|
||||
}
|
||||
|
||||
LucisBoots: {
|
||||
DisplayName: Luci's Boots
|
||||
Tooltip: "'One small step a time, you can do this.'"
|
||||
}
|
||||
|
||||
LucisHairstyle: {
|
||||
DisplayName: Luci's Hairstyle
|
||||
Tooltip: "'Hero of Light, Luci Skyshot.'"
|
||||
}
|
||||
|
||||
LucisMilitaryUniform: {
|
||||
DisplayName: Luci's Military Uniform
|
||||
Tooltip: "'Bearing the iconic Liberation Army insignia of freedom.'"
|
||||
}
|
||||
|
||||
OldDukeMask: {
|
||||
DisplayName: Old Duke Mask
|
||||
Tooltip: ""
|
||||
|
||||
@@ -415,6 +415,17 @@ ColdheartIcicle: {
|
||||
Tooltip: "'N(ice) work'"
|
||||
}
|
||||
|
||||
DisgustingMeat: {
|
||||
DisplayName: Disgusting Meat
|
||||
Tooltip:
|
||||
'''
|
||||
Debug item, spawn and use to remove permanent upgrades
|
||||
<left> will remove health and mana upgrades
|
||||
<right> will remove rage and adrenaline upgrades, plus other miscellaneous boosters
|
||||
Removed boosters will be vomited out of you as items
|
||||
'''
|
||||
}
|
||||
|
||||
MomentumCapacitor: {
|
||||
DisplayName: Momentum Capacitor
|
||||
GFBName: Burden Breaker
|
||||
|
||||
@@ -246,7 +246,7 @@ DeathValleyDuster: {
|
||||
'''
|
||||
Casts an enchanted blast of sand that passes through enemies and tiles
|
||||
Casting this spell at max mana while without mana sickness will cause it to give you and any player it hits the Sand's Wind Buff
|
||||
The Sand's Wind Buff increases your defense by 10 and damage by 12%
|
||||
The Sand's Wind Buff increases your defense by 10, damage by 12%, and greatly buffs mana regen
|
||||
'''
|
||||
}
|
||||
|
||||
@@ -654,7 +654,7 @@ PrimordialAncient: {
|
||||
'''
|
||||
Casts five primordial sand blasts that converge at your cursor after a moment and create a giant explosion
|
||||
Casting this spell at max mana while without mana sickness will cause it to give you and any player it hits the {$Buffs.AeolianEarthBuff.DisplayName} buff
|
||||
The {$Buffs.AeolianEarthBuff.DisplayName} buff increases your damage reduction by {0}% and damage by {1}%
|
||||
The {$Buffs.AeolianEarthBuff.DisplayName} buff increases your damage reduction by {0}%, damage by {1}%, and massively buffs mana regen
|
||||
'''
|
||||
}
|
||||
|
||||
@@ -664,7 +664,7 @@ PrimordialEarth: {
|
||||
'''
|
||||
Casts two enchanted blasts of sand that coverge with each other and explode
|
||||
Casting this spell at max mana while without mana sickness will cause it to give you and any player it hits the {$Buffs.SandsWindBuff.DisplayName} buff
|
||||
The {$Buffs.SandsWindBuff.DisplayName} buff increases your defense by {0} and damage by {1}%
|
||||
The {$Buffs.SandsWindBuff.DisplayName} buff increases your defense by {0}, damage by {1}%, and greatly buffs mana regen
|
||||
'''
|
||||
}
|
||||
|
||||
|
||||
@@ -695,7 +695,11 @@ GrandGuardian: {
|
||||
|
||||
GreatswordofJudgement: {
|
||||
DisplayName: Greatsword of Judgement
|
||||
Tooltip: Fires a piercing energy wave that releases homing stars as it flies
|
||||
Tooltip:
|
||||
'''
|
||||
Fires a piercing energy wave that releases homing stars as it flies
|
||||
Hits with the blade summon two stronger stars from behind you
|
||||
'''
|
||||
}
|
||||
|
||||
Greentide: {
|
||||
@@ -768,16 +772,6 @@ InsidiousImpaler: {
|
||||
'''
|
||||
}
|
||||
|
||||
IridescentExcalibur: {
|
||||
DisplayName: Iridescent Excalibur
|
||||
Tooltip:
|
||||
'''
|
||||
True melee strikes freeze enemies
|
||||
Fires rainbow beams that change their behavior based on their color
|
||||
Press <right> for true melee
|
||||
'''
|
||||
}
|
||||
|
||||
Lacerator: {
|
||||
DisplayName: Lacerator
|
||||
Tooltip:
|
||||
@@ -958,7 +952,6 @@ Orderbringer: {
|
||||
Tooltip:
|
||||
'''
|
||||
Fires piercing energy waves and summons four homing stars near your cursor
|
||||
Energy waves deal more damage with each consecutive hit
|
||||
Hits with the blade summon two beams from the sky
|
||||
'No matter where you may be you are never alone'
|
||||
'''
|
||||
|
||||
@@ -189,12 +189,7 @@ Rotdog.DisplayName: Rotdog
|
||||
ScornEater.DisplayName: Scorn Eater
|
||||
ShockstormShuttle.DisplayName: Shockstorm Shuttle
|
||||
Shroomble.DisplayName: Shroomble
|
||||
SkeletronOmega.DisplayName: Skeletron Omega
|
||||
OmegaSaw.DisplayName: Omega Saw
|
||||
OmegaLaser.DisplayName: Omega Laser
|
||||
SkeletronPrime2.DisplayName: Skeletron Alpha
|
||||
AlphaVice.DisplayName: Alpha Vice
|
||||
AlphaCannon.DisplayName: Alpha Cannon
|
||||
SkeletronPrime2.DisplayName: Skeletron Prime
|
||||
Stormlion.DisplayName: Stormlion
|
||||
StormlionSentry.DisplayName: Stormlion Sentry
|
||||
Sunskater.DisplayName: Sunskater
|
||||
@@ -568,3 +563,7 @@ SeaKing: {
|
||||
Princess_LovesNPC: "{NPCName} always smiles when I'm nearby, I like being around him just for that!"
|
||||
}
|
||||
}
|
||||
|
||||
WildBumblebirb.DisplayName: Wild Bumblebirb
|
||||
DraconicSwarmer.DisplayName: Draconic Swarmer
|
||||
Dragonfolly.DisplayName: Dragonfolly
|
||||
@@ -10,7 +10,6 @@ FungalHeal.DisplayName: Heal
|
||||
GladiatorHealOrb.DisplayName: Heal
|
||||
GreenJellyAura.DisplayName: Green Jelly Aura
|
||||
HydrothermicHealOrb.DisplayName: Hydrothermic Rejuvenation
|
||||
IridescentExcaliburHeal.DisplayName: Iridescent Excalibur Heal
|
||||
ManaPolarizerHealOrb.DisplayName: Mana Polarizer Heal Orb
|
||||
PhantomicHeart.DisplayName: Phantomic Heart
|
||||
PinkJellyAura.DisplayName: Pink Jelly Aura
|
||||
|
||||
@@ -214,8 +214,8 @@ SpiritDust.DisplayName: Spirit Dust
|
||||
Starblast.DisplayName: Star
|
||||
StardustElementalBeam.DisplayName: Stardust Beam
|
||||
StickyFeather.DisplayName: Feather
|
||||
SylveBolt.DisplayName: Sylv Bolt
|
||||
SylveRay.DisplayName: Sylv Ray
|
||||
SylvBolt.DisplayName: Sylv Bolt
|
||||
SylvRay.DisplayName: Sylv Ray
|
||||
TacticiansElectricBoom.DisplayName: Electric Explosion
|
||||
TacticiansTrumpCardProj.DisplayName: Trump Beam
|
||||
TearsofHeavenProjectile.DisplayName: Tears of Heaven
|
||||
@@ -261,5 +261,3 @@ WyvernFeatherPurple.DisplayName: Feather
|
||||
WyvernProjectile.DisplayName: Wyvern
|
||||
YharimsCrystalBeam.DisplayName: Yharim's Beam
|
||||
YharimsCrystalPrism.DisplayName: Yermes Christal
|
||||
SylvBolt.DisplayName: Sylv Bolt
|
||||
SylvRay.DisplayName: Sylv Ray
|
||||
@@ -154,9 +154,6 @@ HolyColliderHolyFire.DisplayName: Holy Collider Fire
|
||||
IceBombFriendly.DisplayName: Ice Bomb
|
||||
IllustriousKnife.DisplayName: Illustrious Knife
|
||||
InsidiousHarpoon.DisplayName: Insidious Harpoon
|
||||
IridescentExcaliburSlash.DisplayName: Iridescent Excalibur Slash
|
||||
IridescentExcaliburSlash2.DisplayName: Iridescent Excalibur Slash
|
||||
IridescentExcaliburSlash3.DisplayName: Iridescent Excalibur Slash
|
||||
JudgementProj.DisplayName: JUDGEMENT
|
||||
LamentationsOfTheChained.DisplayName: Lamentations of the Chained
|
||||
LaserFountain.DisplayName: Laser Fountain
|
||||
@@ -237,6 +234,7 @@ StarburstBeam.DisplayName: Star Shiv
|
||||
StarburstSHIV.DisplayName: SHIV
|
||||
StarnightBeam.DisplayName: Starnight Beam
|
||||
StarofJudgement.DisplayName: Star of Judgement
|
||||
StarofOrder.DisplayName: Star of Order
|
||||
StellarContemptBlast.DisplayName: Stellar Blast
|
||||
StellarContemptEcho.DisplayName: Echoes of Contempt
|
||||
StellarContemptHammer.DisplayName: Stellar Contempt
|
||||
|
||||
@@ -339,7 +339,6 @@ DemolitionistChat: {
|
||||
DryadChat: {
|
||||
DarksunEclipse: There's a dark solar energy emanating from the moths that appear during this time. What's up with moths getting stronger as you do too?
|
||||
Hardmode: That starborne illness sits upon this land like a blister. Do even more vile forces of corruption exist in worlds beyond?
|
||||
DrunkPrincessShroom: "{0} put me up to this."
|
||||
Mushroom: I'm not here for any reason! Just picking up mushrooms for uh, later use.
|
||||
SulphurSea: My Goddess is resting deep below this sea. If you may excuse me, I wish to pay my respects to her alone.
|
||||
}
|
||||
@@ -377,7 +376,6 @@ MechanicChat: {
|
||||
MoonLordDefeated: What do you mean your traps aren't making the cut? Don't look at me!
|
||||
Eclipse: Um... should my nightlight be on?
|
||||
AcidRain: Maybe I should've waterproofed my gadgets... They're starting to corrode.
|
||||
DrunkPrincess: Well, I like {0}, but I, ah... I have my eyes on someone else.
|
||||
}
|
||||
|
||||
MerchantChat: {
|
||||
@@ -407,7 +405,6 @@ PainterChat: {
|
||||
}
|
||||
|
||||
PartyGirlChat: {
|
||||
DrunkPrincess: I have a feeling we're going to have absolutely fantastic parties with {0} around!
|
||||
Eclipse1: I think my light display is turning into an accidental bug zapper. At least the monsters are enjoying it.
|
||||
Eclipse2: Ooh! I love parties where everyone wears a scary costume!
|
||||
}
|
||||
@@ -415,7 +412,6 @@ PartyGirlChat: {
|
||||
PirateChat: {
|
||||
PreLeviathan: Aye, I've heard of a mythical creature in the oceans, singing with an alluring voice. Careful when yer fishin out there.
|
||||
WetScourgeDefeated: I have to thank ye again for takin' care of that sea serpent. Or was that another one...
|
||||
DrunkPrincess: Twenty-nine bottles of beer on the wall...
|
||||
SeaKing: I remember legends about that {0}. He ain't quite how the stories make him out to be though.
|
||||
Ocean: Now this is a scene that I can admire any time! I feel like something is watching me though.
|
||||
SulphurSea1: It ain't much of a sight, but there's still life living in these waters.
|
||||
@@ -442,18 +438,12 @@ SteampunkerChat: {
|
||||
|
||||
StylistChat: {
|
||||
Hardmode: Please don't catch space lice. Or {0} lice. Or just lice in general.
|
||||
DrunkPrincess1: "{0} is always trying to brighten my mood... even though, deep down, I know she's sad..."
|
||||
DrunkPrincess2: Sometimes I catch {0} sneaking up from behind me.
|
||||
DrunkPrincess3: "{0} has been smiling more often lately, even without alcohol. I think I can thank you for that, at least somewhat."
|
||||
ProfanedSoulCrystal1: They look so cute and yet, I can feel their immense power just by being near them. What are you?
|
||||
ProfanedSoulCrystal2: I hate to break it to you, but you don't have hair to cut or style, hun.
|
||||
ProfanedDonuts: Aww, they're so cute, do they have names?
|
||||
}
|
||||
|
||||
TavernkeepChat: {
|
||||
FullMoon: Care for a little Moonshine?
|
||||
DrunkPrincess: Sheesh, {0} is a little cruel, isn't she? I never claimed to be an expert on anything but ale!
|
||||
}
|
||||
TavernkeepChat.FullMoon: Care for a little Moonshine?
|
||||
|
||||
TaxCollectorChat: {
|
||||
DoGDefeated: Devourer of what, you said? Devourer of Funds, if its payroll is anything to go by!
|
||||
@@ -463,12 +453,7 @@ TaxCollectorChat: {
|
||||
Has100Plat: BAH! Doesn't seem like I'll ever be able to quarrel with the debts of the town again!
|
||||
}
|
||||
|
||||
TravellingMerchantChat.DrunkPrincessMerchant: Tell {0} I'll take up her offer and meet with her at the back of {1}'s house.
|
||||
|
||||
TruffleChat: {
|
||||
Normal: I don't feel very safe; I think there's pigs following me around and it frightens me.
|
||||
DrunkPrincess: Sometimes, {0} just looks at me funny and I'm not sure how I feel about that.
|
||||
}
|
||||
TruffleChat.Normal: I don't feel very safe; I think there's pigs following me around and it frightens me.
|
||||
|
||||
WitchDoctorChat: {
|
||||
BloodMoon: This is as good a time as any to pick up the best ingredients for potions.
|
||||
|
||||
@@ -741,7 +741,7 @@ namespace CalamityMod
|
||||
{
|
||||
string entryName = "Dragonfolly";
|
||||
BossChecklistProgressionValues.TryGetValue(entryName, out float order);
|
||||
int type = NPCType<Bumblefuck>();
|
||||
int type = NPCType<Dragonfolly>();
|
||||
List<int> collection = new List<int>() { ItemType<DragonfollyRelic>(), ItemType<DragonfollyTrophy>(), ItemType<BumblefuckMask>(), ItemType<LoreDragonfolly>(), ItemType<ThankYouPainting>() };
|
||||
AddBoss(bossChecklist, calamity, entryName, order, DownedDragonfolly, type, new Dictionary<string, object>()
|
||||
{
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
using CalamityMod.BiomeManagers;
|
||||
using CalamityMod.Items.Materials;
|
||||
using CalamityMod.Items.Placeables.Banners;
|
||||
using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs;
|
||||
using CalamityMod.NPCs.NormalNPCs;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using ReLogic.Content;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
using CalamityMod.BiomeManagers;
|
||||
using CalamityMod.Items.Placeables.Banners;
|
||||
using CalamityMod.Items.Weapons.Melee;
|
||||
using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs;
|
||||
using CalamityMod.NPCs.NormalNPCs;
|
||||
using Terraria;
|
||||
using Terraria.GameContent.Bestiary;
|
||||
using Terraria.GameContent.ItemDropRules;
|
||||
|
||||
@@ -3,7 +3,7 @@ using System.IO;
|
||||
using CalamityMod.BiomeManagers;
|
||||
using CalamityMod.Items.Materials;
|
||||
using CalamityMod.Items.Placeables.Banners;
|
||||
using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs;
|
||||
using CalamityMod.NPCs.NormalNPCs;
|
||||
using CalamityMod.Projectiles.Enemy;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
|
||||
@@ -4,7 +4,7 @@ using CalamityMod.Buffs.DamageOverTime;
|
||||
using CalamityMod.Items.Materials;
|
||||
using CalamityMod.Items.Placeables.Banners;
|
||||
using CalamityMod.Items.Weapons.Melee;
|
||||
using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs;
|
||||
using CalamityMod.NPCs.NormalNPCs;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using ReLogic.Content;
|
||||
|
||||
@@ -1,15 +1,19 @@
|
||||
using System.IO;
|
||||
using CalamityMod.Buffs.DamageOverTime;
|
||||
using CalamityMod.Buffs.StatDebuffs;
|
||||
using CalamityMod.Events;
|
||||
using CalamityMod.NPCs.CalamityAIs.CalamityBossAIs;
|
||||
using CalamityMod.Projectiles.Boss;
|
||||
using CalamityMod.World;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.GameContent;
|
||||
using Terraria.ID;
|
||||
using Terraria.Localization;
|
||||
using Terraria.ModLoader;
|
||||
using CalamityMod.Systems.Collections;
|
||||
|
||||
namespace CalamityMod.NPCs.AquaticScourge
|
||||
{
|
||||
@@ -36,7 +40,7 @@ namespace CalamityMod.NPCs.AquaticScourge
|
||||
NPC.knockBackResist = 0f;
|
||||
NPC.alpha = 255;
|
||||
NPC.LifeMaxNERB(80000, 96000, 1000000);
|
||||
if (CalamityWorld.LegendaryMode && CalamityWorld.revenge)
|
||||
if (CalamityWorld.LegendaryMode)
|
||||
NPC.lifeMax *= 2;
|
||||
NPC.behindTiles = true;
|
||||
NPC.noGravity = true;
|
||||
@@ -56,7 +60,7 @@ namespace CalamityMod.NPCs.AquaticScourge
|
||||
else if (Main.expertMode)
|
||||
NPC.scale *= 1.1f;
|
||||
|
||||
if (Main.getGoodWorld)
|
||||
if (CalamityWorld.LegendaryMode)
|
||||
NPC.scale *= 1.25f;
|
||||
|
||||
NPC.Calamity().VulnerableToHeat = false;
|
||||
@@ -89,7 +93,248 @@ namespace CalamityMod.NPCs.AquaticScourge
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
AquaticScourgeAI.VanillaAquaticScourgeAI(NPC, Mod, false);
|
||||
CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity();
|
||||
bool bossRush = BossRushEvent.BossRushActive;
|
||||
bool expertMode = Main.expertMode || bossRush;
|
||||
bool revenge = CalamityWorld.revenge || bossRush;
|
||||
bool death = CalamityWorld.death || bossRush;
|
||||
|
||||
bool getFuckedAI = Main.zenithWorld;
|
||||
|
||||
// Adjust hostility and stats
|
||||
bool nonHostile = calamityGlobalNPC.newAI[0] == 0f;
|
||||
if (NPC.justHit || NPC.life <= NPC.lifeMax * 0.999 || bossRush || CalamityWorld.LegendaryMode)
|
||||
{
|
||||
if (nonHostile)
|
||||
{
|
||||
// Kiss my motherfucking ass you piece of shit game
|
||||
NPC.timeLeft *= 20;
|
||||
NPC.npcSlots = 16f;
|
||||
CalamityGlobalNPC.BossKillTimes.TryGetValue(NPC.type, out int revKillTime);
|
||||
calamityGlobalNPC.KillTime = revKillTime;
|
||||
calamityGlobalNPC.newAI[0] = 1f;
|
||||
nonHostile = false;
|
||||
NPC.chaseable = true;
|
||||
NPC.netUpdate = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
NPC.damage = 0;
|
||||
|
||||
// Percent life remaining
|
||||
float lifeRatio = NPC.life / (float)NPC.lifeMax;
|
||||
|
||||
// Phases
|
||||
bool phase2 = lifeRatio < 0.75f;
|
||||
bool phase3 = lifeRatio < 0.5f;
|
||||
bool phase4 = lifeRatio < 0.25f;
|
||||
|
||||
// Set worm variable
|
||||
if (NPC.ai[2] > 0f)
|
||||
NPC.realLife = (int)NPC.ai[2];
|
||||
if (NPC.life > Main.npc[(int)NPC.ai[1]].life)
|
||||
NPC.life = Main.npc[(int)NPC.ai[1]].life;
|
||||
|
||||
// Get a target
|
||||
if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active)
|
||||
NPC.TargetClosest();
|
||||
|
||||
Player player = Main.player[NPC.target];
|
||||
|
||||
bool notOcean = player.position.Y < 300f ||
|
||||
player.position.Y > Main.worldSurface * 16.0 ||
|
||||
(player.position.X > 7680f && player.position.X < (Main.maxTilesX * 16 - 7680));
|
||||
|
||||
// Check for the flipped Abyss
|
||||
if (Main.remixWorld)
|
||||
{
|
||||
notOcean = player.position.Y < Main.UnderworldLayer * 0.8f || player.position.Y > Main.UnderworldLayer ||
|
||||
(player.position.X > 7680f && player.position.X < (Main.maxTilesX * 16 - 7680));
|
||||
}
|
||||
|
||||
bool biomeEnraged = NPC.localAI[2] <= 0f || bossRush;
|
||||
float enrageScale = bossRush ? 1f : 0f;
|
||||
if (biomeEnraged)
|
||||
{
|
||||
NPC.Calamity().CurrentlyEnraged = !bossRush;
|
||||
enrageScale += 2f;
|
||||
}
|
||||
|
||||
// Adjust slowing debuff immunity
|
||||
bool immuneToSlowingDebuffs = getFuckedAI;
|
||||
NPC.buffImmune[ModContent.BuffType<GlacialState>()] = immuneToSlowingDebuffs;
|
||||
NPC.buffImmune[ModContent.BuffType<TemporalSadness>()] = immuneToSlowingDebuffs;
|
||||
NPC.buffImmune[ModContent.BuffType<Eutrophication>()] = immuneToSlowingDebuffs;
|
||||
NPC.buffImmune[ModContent.BuffType<TimeDistortion>()] = immuneToSlowingDebuffs;
|
||||
NPC.buffImmune[ModContent.BuffType<GalvanicCorrosion>()] = immuneToSlowingDebuffs;
|
||||
NPC.buffImmune[ModContent.BuffType<Vaporfied>()] = immuneToSlowingDebuffs;
|
||||
NPC.buffImmune[BuffID.Slow] = immuneToSlowingDebuffs;
|
||||
NPC.buffImmune[BuffID.Webbed] = immuneToSlowingDebuffs;
|
||||
|
||||
// Fire teeth
|
||||
if (calamityGlobalNPC.newAI[0] == 1f && (!phase3 || phase4))
|
||||
{
|
||||
NPC.localAI[0] += 1f;
|
||||
float shootProjectile = 300;
|
||||
float timer = NPC.ai[0] + 15f;
|
||||
float divisor = timer + shootProjectile;
|
||||
|
||||
if (NPC.localAI[0] % divisor == 0f && (NPC.ai[0] % 3f == 0f || getFuckedAI || !death))
|
||||
{
|
||||
NPC.TargetClosest();
|
||||
if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height))
|
||||
{
|
||||
SoundEngine.PlaySound(SoundID.Item17, NPC.Center);
|
||||
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
{
|
||||
float toothVelocity = death ? 9f : 8f;
|
||||
Vector2 projectileVelocity = (player.Center - NPC.Center).SafeNormalize(Vector2.UnitY);
|
||||
int type = ModContent.ProjectileType<SandTooth>();
|
||||
int damage = NPC.GetProjectileDamage(type);
|
||||
float accelerate = phase4 ? 1f : 0f;
|
||||
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + projectileVelocity * 5f, projectileVelocity * toothVelocity, type, damage, 0f, Main.myPlayer, accelerate, 0f);
|
||||
}
|
||||
|
||||
NPC.netUpdate = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Kill body and tail
|
||||
bool shouldDespawn = true;
|
||||
for (int i = 0; i < Main.maxNPCs; i++)
|
||||
{
|
||||
if (Main.npc[i].active && Main.npc[i].type == ModContent.NPCType<AquaticScourgeHead>())
|
||||
{
|
||||
shouldDespawn = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!shouldDespawn)
|
||||
{
|
||||
if (NPC.ai[1] <= 0f)
|
||||
shouldDespawn = true;
|
||||
else if (Main.npc[(int)NPC.ai[1]].life <= 0)
|
||||
shouldDespawn = true;
|
||||
}
|
||||
if (shouldDespawn)
|
||||
{
|
||||
NPC.life = 0;
|
||||
NPC.HitEffect(0, 10.0);
|
||||
NPC.checkDead();
|
||||
NPC.active = false;
|
||||
}
|
||||
|
||||
float maxDistance = calamityGlobalNPC.newAI[0] == 1f ? 12800f : 6400f;
|
||||
if (player.dead || Vector2.Distance(NPC.Center, player.Center) > maxDistance || (nonHostile && biomeEnraged))
|
||||
{
|
||||
calamityGlobalNPC.newAI[1] = 1f;
|
||||
NPC.TargetClosest(false);
|
||||
NPC.velocity.Y += 2f;
|
||||
|
||||
if (NPC.position.Y > Main.worldSurface * 16D)
|
||||
NPC.velocity.Y += 2f;
|
||||
|
||||
if (NPC.position.Y > Main.worldSurface * 16D)
|
||||
{
|
||||
for (int a = 0; a < Main.npc.Length; a++)
|
||||
{
|
||||
int type = Main.npc[a].type;
|
||||
if (AquaticScourgeIDList.Includes(type))
|
||||
Main.npc[a].active = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
calamityGlobalNPC.newAI[1] = 0f;
|
||||
|
||||
// Change direction
|
||||
if (NPC.velocity.X < 0f)
|
||||
NPC.spriteDirection = -1;
|
||||
else if (NPC.velocity.X > 0f)
|
||||
NPC.spriteDirection = 1;
|
||||
|
||||
// Alpha changes
|
||||
if (Main.npc[(int)NPC.ai[1]].alpha < 128)
|
||||
{
|
||||
NPC.alpha -= 42;
|
||||
if (NPC.alpha < 0)
|
||||
NPC.alpha = 0;
|
||||
}
|
||||
|
||||
Vector2 scourgePosition = NPC.Center;
|
||||
Vector2 predictionVector = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? Main.player[NPC.target].velocity * 20f : Vector2.Zero;
|
||||
float scourgeTargetX = player.Center.X + predictionVector.X;
|
||||
float scourgeTargetY = player.Center.Y + predictionVector.Y;
|
||||
|
||||
// Velocity and movement
|
||||
float scourgeMaxSpeed = 5f;
|
||||
if (calamityGlobalNPC.newAI[0] == 1f)
|
||||
{
|
||||
scourgeMaxSpeed = revenge ? 14.4f : 12f;
|
||||
if (expertMode)
|
||||
scourgeMaxSpeed += 2.4f * (1f - lifeRatio);
|
||||
scourgeMaxSpeed += 3f * enrageScale;
|
||||
if (death || getFuckedAI)
|
||||
{
|
||||
scourgeMaxSpeed += 5f;
|
||||
scourgeMaxSpeed += Vector2.Distance(player.Center, NPC.Center) * 0.001f;
|
||||
}
|
||||
|
||||
if (CalamityWorld.LegendaryMode)
|
||||
scourgeMaxSpeed *= 1.15f;
|
||||
}
|
||||
|
||||
scourgeTargetX = (int)(scourgeTargetX / 16f) * 16;
|
||||
scourgeTargetY = (int)(scourgeTargetY / 16f) * 16;
|
||||
scourgePosition.X = (int)(scourgePosition.X / 16f) * 16;
|
||||
scourgePosition.Y = (int)(scourgePosition.Y / 16f) * 16;
|
||||
scourgeTargetX -= scourgePosition.X;
|
||||
scourgeTargetY -= scourgePosition.Y;
|
||||
|
||||
if (NPC.ai[1] > 0f && NPC.ai[1] < Main.npc.Length)
|
||||
{
|
||||
try
|
||||
{
|
||||
scourgePosition = NPC.Center;
|
||||
scourgeTargetX = Main.npc[(int)NPC.ai[1]].Center.X - scourgePosition.X;
|
||||
scourgeTargetY = Main.npc[(int)NPC.ai[1]].Center.Y - scourgePosition.Y;
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
|
||||
NPC.rotation = (float)Math.Atan2(scourgeTargetY, scourgeTargetX) + MathHelper.PiOver2;
|
||||
float scourgeTargetDist = (float)Math.Sqrt(scourgeTargetX * scourgeTargetX + scourgeTargetY * scourgeTargetY);
|
||||
int scourgeWidth = NPC.width;
|
||||
scourgeTargetDist = (scourgeTargetDist - scourgeWidth) / scourgeTargetDist;
|
||||
scourgeTargetX *= scourgeTargetDist;
|
||||
scourgeTargetY *= scourgeTargetDist;
|
||||
NPC.velocity = Vector2.Zero;
|
||||
NPC.position.X = NPC.position.X + scourgeTargetX;
|
||||
NPC.position.Y = NPC.position.Y + scourgeTargetY;
|
||||
|
||||
if (scourgeTargetX < 0f)
|
||||
NPC.spriteDirection = -1;
|
||||
else if (scourgeTargetX > 0f)
|
||||
NPC.spriteDirection = 1;
|
||||
}
|
||||
|
||||
// Calculate contact damage based on velocity
|
||||
if (!nonHostile)
|
||||
{
|
||||
float minimalContactDamageVelocity = scourgeMaxSpeed * 0.25f;
|
||||
float minimalDamageVelocity = scourgeMaxSpeed * 0.5f;
|
||||
float bodyAndTailVelocity = (NPC.position - NPC.oldPosition).Length();
|
||||
if (bodyAndTailVelocity <= minimalContactDamageVelocity)
|
||||
NPC.damage = 0;
|
||||
else
|
||||
{
|
||||
float velocityDamageScalar = MathHelper.Clamp((bodyAndTailVelocity - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f);
|
||||
NPC.damage = (int)MathHelper.Lerp(0f, NPC.defDamage, velocityDamageScalar);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor)
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
using System.IO;
|
||||
using System;
|
||||
using System.IO;
|
||||
using CalamityMod.Buffs.DamageOverTime;
|
||||
using CalamityMod.Buffs.StatDebuffs;
|
||||
using CalamityMod.Events;
|
||||
using CalamityMod.NPCs.CalamityAIs.CalamityBossAIs;
|
||||
using CalamityMod.Projectiles.Boss;
|
||||
using CalamityMod.Systems.Collections;
|
||||
using CalamityMod.World;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.GameContent;
|
||||
using Terraria.ID;
|
||||
using Terraria.Localization;
|
||||
@@ -35,7 +39,7 @@ namespace CalamityMod.NPCs.AquaticScourge
|
||||
NPC.knockBackResist = 0f;
|
||||
NPC.alpha = 255;
|
||||
NPC.LifeMaxNERB(80000, 96000, 1000000);
|
||||
if (CalamityWorld.LegendaryMode && CalamityWorld.revenge)
|
||||
if (CalamityWorld.LegendaryMode)
|
||||
NPC.lifeMax *= 2;
|
||||
NPC.behindTiles = true;
|
||||
NPC.noGravity = true;
|
||||
@@ -55,7 +59,7 @@ namespace CalamityMod.NPCs.AquaticScourge
|
||||
else if (Main.expertMode)
|
||||
NPC.scale *= 1.1f;
|
||||
|
||||
if (Main.getGoodWorld)
|
||||
if (CalamityWorld.LegendaryMode)
|
||||
NPC.scale *= 1.25f;
|
||||
|
||||
NPC.Calamity().VulnerableToHeat = false;
|
||||
@@ -88,7 +92,218 @@ namespace CalamityMod.NPCs.AquaticScourge
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
AquaticScourgeAI.VanillaAquaticScourgeAI(NPC, Mod, false);
|
||||
CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity();
|
||||
bool bossRush = BossRushEvent.BossRushActive;
|
||||
bool expertMode = Main.expertMode || bossRush;
|
||||
bool revenge = CalamityWorld.revenge || bossRush;
|
||||
bool death = CalamityWorld.death || bossRush;
|
||||
|
||||
bool getFuckedAI = Main.zenithWorld;
|
||||
|
||||
// Adjust hostility and stats
|
||||
bool nonHostile = calamityGlobalNPC.newAI[0] == 0f;
|
||||
if (NPC.justHit || NPC.life <= NPC.lifeMax * 0.999 || bossRush || CalamityWorld.LegendaryMode)
|
||||
{
|
||||
if (nonHostile)
|
||||
{
|
||||
// Kiss my motherfucking ass you piece of shit game
|
||||
NPC.timeLeft *= 20;
|
||||
NPC.npcSlots = 16f;
|
||||
CalamityGlobalNPC.BossKillTimes.TryGetValue(NPC.type, out int revKillTime);
|
||||
calamityGlobalNPC.KillTime = revKillTime;
|
||||
calamityGlobalNPC.newAI[0] = 1f;
|
||||
nonHostile = false;
|
||||
NPC.chaseable = true;
|
||||
NPC.netUpdate = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
NPC.damage = 0;
|
||||
|
||||
// Percent life remaining
|
||||
float lifeRatio = NPC.life / (float)NPC.lifeMax;
|
||||
|
||||
// Phases
|
||||
bool phase2 = lifeRatio < 0.75f;
|
||||
bool phase3 = lifeRatio < 0.5f;
|
||||
bool phase4 = lifeRatio < 0.25f;
|
||||
|
||||
// Set worm variable
|
||||
if (NPC.ai[2] > 0f)
|
||||
NPC.realLife = (int)NPC.ai[2];
|
||||
if (NPC.life > Main.npc[(int)NPC.ai[1]].life)
|
||||
NPC.life = Main.npc[(int)NPC.ai[1]].life;
|
||||
|
||||
// Get a target
|
||||
if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active)
|
||||
NPC.TargetClosest();
|
||||
|
||||
Player player = Main.player[NPC.target];
|
||||
|
||||
bool notOcean = player.position.Y < 300f ||
|
||||
player.position.Y > Main.worldSurface * 16.0 ||
|
||||
(player.position.X > 7680f && player.position.X < (Main.maxTilesX * 16 - 7680));
|
||||
|
||||
// Check for the flipped Abyss
|
||||
if (Main.remixWorld)
|
||||
{
|
||||
notOcean = player.position.Y < Main.UnderworldLayer * 0.8f || player.position.Y > Main.UnderworldLayer ||
|
||||
(player.position.X > 7680f && player.position.X < (Main.maxTilesX * 16 - 7680));
|
||||
}
|
||||
|
||||
bool biomeEnraged = NPC.localAI[2] <= 0f || bossRush;
|
||||
float enrageScale = bossRush ? 1f : 0f;
|
||||
if (biomeEnraged)
|
||||
{
|
||||
NPC.Calamity().CurrentlyEnraged = !bossRush;
|
||||
enrageScale += 2f;
|
||||
}
|
||||
|
||||
// Adjust slowing debuff immunity
|
||||
bool immuneToSlowingDebuffs = getFuckedAI;
|
||||
NPC.buffImmune[ModContent.BuffType<GlacialState>()] = immuneToSlowingDebuffs;
|
||||
NPC.buffImmune[ModContent.BuffType<TemporalSadness>()] = immuneToSlowingDebuffs;
|
||||
NPC.buffImmune[ModContent.BuffType<Eutrophication>()] = immuneToSlowingDebuffs;
|
||||
NPC.buffImmune[ModContent.BuffType<TimeDistortion>()] = immuneToSlowingDebuffs;
|
||||
NPC.buffImmune[ModContent.BuffType<GalvanicCorrosion>()] = immuneToSlowingDebuffs;
|
||||
NPC.buffImmune[ModContent.BuffType<Vaporfied>()] = immuneToSlowingDebuffs;
|
||||
NPC.buffImmune[BuffID.Slow] = immuneToSlowingDebuffs;
|
||||
NPC.buffImmune[BuffID.Webbed] = immuneToSlowingDebuffs;
|
||||
|
||||
// Kill body and tail
|
||||
bool shouldDespawn = true;
|
||||
for (int i = 0; i < Main.maxNPCs; i++)
|
||||
{
|
||||
if (Main.npc[i].active && Main.npc[i].type == ModContent.NPCType<AquaticScourgeHead>())
|
||||
{
|
||||
shouldDespawn = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!shouldDespawn)
|
||||
{
|
||||
if (NPC.ai[1] <= 0f)
|
||||
shouldDespawn = true;
|
||||
else if (Main.npc[(int)NPC.ai[1]].life <= 0)
|
||||
shouldDespawn = true;
|
||||
}
|
||||
if (shouldDespawn)
|
||||
{
|
||||
NPC.life = 0;
|
||||
NPC.HitEffect(0, 10.0);
|
||||
NPC.checkDead();
|
||||
NPC.active = false;
|
||||
}
|
||||
|
||||
float maxDistance = calamityGlobalNPC.newAI[0] == 1f ? 12800f : 6400f;
|
||||
if (player.dead || Vector2.Distance(NPC.Center, player.Center) > maxDistance || (nonHostile && biomeEnraged))
|
||||
{
|
||||
calamityGlobalNPC.newAI[1] = 1f;
|
||||
NPC.TargetClosest(false);
|
||||
NPC.velocity.Y += 2f;
|
||||
|
||||
if (NPC.position.Y > Main.worldSurface * 16D)
|
||||
NPC.velocity.Y += 2f;
|
||||
|
||||
if (NPC.position.Y > Main.worldSurface * 16D)
|
||||
{
|
||||
for (int a = 0; a < Main.npc.Length; a++)
|
||||
{
|
||||
int type = Main.npc[a].type;
|
||||
if (AquaticScourgeIDList.Includes(type))
|
||||
Main.npc[a].active = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
calamityGlobalNPC.newAI[1] = 0f;
|
||||
|
||||
// Change direction
|
||||
if (NPC.velocity.X < 0f)
|
||||
NPC.spriteDirection = -1;
|
||||
else if (NPC.velocity.X > 0f)
|
||||
NPC.spriteDirection = 1;
|
||||
|
||||
// Alpha changes
|
||||
if (Main.npc[(int)NPC.ai[1]].alpha < 128)
|
||||
{
|
||||
NPC.alpha -= 42;
|
||||
if (NPC.alpha < 0)
|
||||
NPC.alpha = 0;
|
||||
}
|
||||
|
||||
Vector2 scourgePosition = NPC.Center;
|
||||
Vector2 predictionVector = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? Main.player[NPC.target].velocity * 20f : Vector2.Zero;
|
||||
float scourgeTargetX = player.Center.X + predictionVector.X;
|
||||
float scourgeTargetY = player.Center.Y + predictionVector.Y;
|
||||
|
||||
// Velocity and movement
|
||||
float scourgeMaxSpeed = 5f;
|
||||
if (calamityGlobalNPC.newAI[0] == 1f)
|
||||
{
|
||||
scourgeMaxSpeed = revenge ? 14.4f : 12f;
|
||||
if (expertMode)
|
||||
scourgeMaxSpeed += 2.4f * (1f - lifeRatio);
|
||||
scourgeMaxSpeed += 3f * enrageScale;
|
||||
if (death || getFuckedAI)
|
||||
{
|
||||
scourgeMaxSpeed += 5f;
|
||||
scourgeMaxSpeed += Vector2.Distance(player.Center, NPC.Center) * 0.001f;
|
||||
}
|
||||
|
||||
if (CalamityWorld.LegendaryMode)
|
||||
scourgeMaxSpeed *= 1.15f;
|
||||
}
|
||||
|
||||
scourgeTargetX = (int)(scourgeTargetX / 16f) * 16;
|
||||
scourgeTargetY = (int)(scourgeTargetY / 16f) * 16;
|
||||
scourgePosition.X = (int)(scourgePosition.X / 16f) * 16;
|
||||
scourgePosition.Y = (int)(scourgePosition.Y / 16f) * 16;
|
||||
scourgeTargetX -= scourgePosition.X;
|
||||
scourgeTargetY -= scourgePosition.Y;
|
||||
|
||||
if (NPC.ai[1] > 0f && NPC.ai[1] < Main.npc.Length)
|
||||
{
|
||||
try
|
||||
{
|
||||
scourgePosition = NPC.Center;
|
||||
scourgeTargetX = Main.npc[(int)NPC.ai[1]].Center.X - scourgePosition.X;
|
||||
scourgeTargetY = Main.npc[(int)NPC.ai[1]].Center.Y - scourgePosition.Y;
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
|
||||
NPC.rotation = (float)Math.Atan2(scourgeTargetY, scourgeTargetX) + MathHelper.PiOver2;
|
||||
float scourgeTargetDist = (float)Math.Sqrt(scourgeTargetX * scourgeTargetX + scourgeTargetY * scourgeTargetY);
|
||||
int scourgeWidth = NPC.width;
|
||||
scourgeTargetDist = (scourgeTargetDist - scourgeWidth) / scourgeTargetDist;
|
||||
scourgeTargetX *= scourgeTargetDist;
|
||||
scourgeTargetY *= scourgeTargetDist;
|
||||
NPC.velocity = Vector2.Zero;
|
||||
NPC.position.X = NPC.position.X + scourgeTargetX;
|
||||
NPC.position.Y = NPC.position.Y + scourgeTargetY;
|
||||
|
||||
if (scourgeTargetX < 0f)
|
||||
NPC.spriteDirection = -1;
|
||||
else if (scourgeTargetX > 0f)
|
||||
NPC.spriteDirection = 1;
|
||||
}
|
||||
|
||||
// Calculate contact damage based on velocity
|
||||
if (!nonHostile)
|
||||
{
|
||||
float minimalContactDamageVelocity = scourgeMaxSpeed * 0.25f;
|
||||
float minimalDamageVelocity = scourgeMaxSpeed * 0.5f;
|
||||
float bodyAndTailVelocity = (NPC.position - NPC.oldPosition).Length();
|
||||
if (bodyAndTailVelocity <= minimalContactDamageVelocity)
|
||||
NPC.damage = 0;
|
||||
else
|
||||
{
|
||||
float velocityDamageScalar = MathHelper.Clamp((bodyAndTailVelocity - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f);
|
||||
NPC.damage = (int)MathHelper.Lerp(0f, NPC.defDamage, velocityDamageScalar);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System.IO;
|
||||
using CalamityMod.BiomeManagers;
|
||||
using CalamityMod.Buffs.DamageOverTime;
|
||||
using CalamityMod.Buffs.StatDebuffs;
|
||||
using CalamityMod.Events;
|
||||
using CalamityMod.Items.Accessories;
|
||||
@@ -16,13 +17,13 @@ using CalamityMod.Items.Weapons.Melee;
|
||||
using CalamityMod.Items.Weapons.Ranged;
|
||||
using CalamityMod.Items.Weapons.Rogue;
|
||||
using CalamityMod.Items.Weapons.Summon;
|
||||
using CalamityMod.NPCs.Abyss;
|
||||
using CalamityMod.NPCs.AcidRain;
|
||||
using CalamityMod.NPCs.CalamityAIs.CalamityBossAIs;
|
||||
using CalamityMod.NPCs.TownNPCs;
|
||||
using CalamityMod.Projectiles.Boss;
|
||||
using CalamityMod.Projectiles.Enemy;
|
||||
using CalamityMod.World;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.GameContent;
|
||||
@@ -30,6 +31,7 @@ using Terraria.GameContent.Bestiary;
|
||||
using Terraria.GameContent.ItemDropRules;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using CalamityMod.Systems.Collections;
|
||||
|
||||
namespace CalamityMod.NPCs.AquaticScourge
|
||||
{
|
||||
@@ -63,7 +65,7 @@ namespace CalamityMod.NPCs.AquaticScourge
|
||||
NPC.aiStyle = -1;
|
||||
AIType = -1;
|
||||
NPC.LifeMaxNERB(80000, 96000, 1000000);
|
||||
if (CalamityWorld.LegendaryMode && CalamityWorld.revenge)
|
||||
if (CalamityWorld.LegendaryMode)
|
||||
NPC.lifeMax *= 2;
|
||||
NPC.knockBackResist = 0f;
|
||||
NPC.value = Item.buyPrice(0, 16, 0, 0);
|
||||
@@ -84,7 +86,7 @@ namespace CalamityMod.NPCs.AquaticScourge
|
||||
else if (Main.expertMode)
|
||||
NPC.scale *= 1.1f;
|
||||
|
||||
if (Main.getGoodWorld)
|
||||
if (CalamityWorld.LegendaryMode)
|
||||
NPC.scale *= 1.25f;
|
||||
|
||||
NPC.Calamity().VulnerableToHeat = false;
|
||||
@@ -131,7 +133,465 @@ namespace CalamityMod.NPCs.AquaticScourge
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
AquaticScourgeAI.VanillaAquaticScourgeAI(NPC, Mod, true);
|
||||
CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity();
|
||||
bool bossRush = BossRushEvent.BossRushActive;
|
||||
bool expertMode = Main.expertMode || bossRush;
|
||||
bool revenge = CalamityWorld.revenge || bossRush;
|
||||
bool death = CalamityWorld.death || bossRush;
|
||||
|
||||
bool getFuckedAI = Main.zenithWorld;
|
||||
CalamityGlobalNPC.aquaticScourge = NPC.whoAmI;
|
||||
|
||||
// Adjust hostility and stats
|
||||
bool nonHostile = calamityGlobalNPC.newAI[0] == 0f;
|
||||
if (NPC.justHit || NPC.life <= NPC.lifeMax * 0.999 || bossRush || CalamityWorld.LegendaryMode)
|
||||
{
|
||||
if (nonHostile)
|
||||
{
|
||||
// Kiss my motherfucking ass you piece of shit game
|
||||
NPC.timeLeft *= 20;
|
||||
NPC.npcSlots = 16f;
|
||||
CalamityGlobalNPC.BossKillTimes.TryGetValue(NPC.type, out int revKillTime);
|
||||
calamityGlobalNPC.KillTime = revKillTime;
|
||||
calamityGlobalNPC.newAI[0] = 1f;
|
||||
nonHostile = false;
|
||||
NPC.boss = true;
|
||||
NPC.chaseable = true;
|
||||
NPC.netUpdate = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
NPC.damage = 0;
|
||||
|
||||
// Percent life remaining
|
||||
float lifeRatio = NPC.life / (float)NPC.lifeMax;
|
||||
|
||||
// Phases
|
||||
bool phase2 = lifeRatio < 0.75f;
|
||||
bool phase3 = lifeRatio < 0.5f;
|
||||
bool phase4 = lifeRatio < 0.25f;
|
||||
|
||||
// Set worm variable
|
||||
if (NPC.ai[2] > 0f)
|
||||
NPC.realLife = (int)NPC.ai[2];
|
||||
|
||||
// Get a target
|
||||
if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active)
|
||||
NPC.TargetClosest();
|
||||
|
||||
Player player = Main.player[NPC.target];
|
||||
|
||||
bool notOcean = player.position.Y < 300f ||
|
||||
player.position.Y > Main.worldSurface * 16.0 ||
|
||||
(player.position.X > 7680f && player.position.X < (Main.maxTilesX * 16 - 7680));
|
||||
|
||||
// Check for the flipped Abyss
|
||||
if (Main.remixWorld)
|
||||
{
|
||||
notOcean = player.position.Y < Main.UnderworldLayer * 0.8f || player.position.Y > Main.UnderworldLayer ||
|
||||
(player.position.X > 7680f && player.position.X < (Main.maxTilesX * 16 - 7680));
|
||||
}
|
||||
|
||||
// Enrage
|
||||
if (notOcean && !player.Calamity().ZoneSulphur && !bossRush)
|
||||
{
|
||||
if (NPC.localAI[2] > 0f)
|
||||
NPC.localAI[2] -= 1f;
|
||||
}
|
||||
else
|
||||
NPC.localAI[2] = CalamityGlobalNPC.biomeEnrageTimerMax;
|
||||
|
||||
bool biomeEnraged = NPC.localAI[2] <= 0f || bossRush;
|
||||
|
||||
float enrageScale = bossRush ? 1f : 0f;
|
||||
if (biomeEnraged)
|
||||
{
|
||||
NPC.Calamity().CurrentlyEnraged = !bossRush;
|
||||
enrageScale += 2f;
|
||||
}
|
||||
|
||||
// Circular movement
|
||||
float colorFadeTimeAfterSpiral = 90f;
|
||||
float spiralGateValue = 480f;
|
||||
bool doSpiral = false;
|
||||
if (calamityGlobalNPC.newAI[0] == 1f && calamityGlobalNPC.newAI[2] == 1f && (revenge || getFuckedAI))
|
||||
{
|
||||
doSpiral = calamityGlobalNPC.newAI[1] == 0f && calamityGlobalNPC.newAI[3] >= spiralGateValue;
|
||||
if (Vector2.Distance(NPC.Center, player.Center) < (getFuckedAI ? 1600f : 1000f) || doSpiral)
|
||||
calamityGlobalNPC.newAI[3] += 1f;
|
||||
|
||||
if (doSpiral)
|
||||
{
|
||||
NPC.localAI[3] = colorFadeTimeAfterSpiral;
|
||||
|
||||
// Vomit acid mist
|
||||
float acidMistBarfDivisor = getFuckedAI ? 2f : ((float)Math.Floor(bossRush ? 4f : death ? 5f : 6f) * (phase3 ? 1.5f : 1f));
|
||||
if (calamityGlobalNPC.newAI[3] % acidMistBarfDivisor == 0f)
|
||||
{
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
{
|
||||
float mistVelocity = death ? 10f : 8f;
|
||||
Vector2 projectileVelocity = (NPC.Center + NPC.velocity * 10f - NPC.Center).SafeNormalize(Vector2.UnitY);
|
||||
int type = ModContent.ProjectileType<SulphuricAcidMist>();
|
||||
int damage = NPC.GetProjectileDamage(type);
|
||||
int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + projectileVelocity * 5f, projectileVelocity * mistVelocity, type, damage, 0f, Main.myPlayer);
|
||||
Main.projectile[proj].tileCollide = false;
|
||||
Main.projectile[proj].timeLeft = getFuckedAI ? 240 : 600;
|
||||
}
|
||||
}
|
||||
|
||||
// Vomit circular spreads of acid clouds while in phase 3
|
||||
float toxicCloudBarfDivisor = bossRush ? 20f : death ? 30f : 40f;
|
||||
if (calamityGlobalNPC.newAI[3] % toxicCloudBarfDivisor == 0f && phase3)
|
||||
{
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
{
|
||||
int type = ModContent.ProjectileType<ToxicCloud>();
|
||||
int damage = NPC.GetProjectileDamage(type);
|
||||
int totalProjectiles = (phase4 ? 6 : 9) + (getFuckedAI ? Main.rand.Next(-2, 3) : (int)((calamityGlobalNPC.newAI[3] - spiralGateValue) / toxicCloudBarfDivisor) * (phase4 ? 2 : 3));
|
||||
float radians = MathHelper.TwoPi / totalProjectiles;
|
||||
float cloudVelocity = 1f + enrageScale;
|
||||
Vector2 spinningPoint = new Vector2(0f, -cloudVelocity);
|
||||
for (int k = 0; k < totalProjectiles; k++)
|
||||
{
|
||||
Vector2 vector255 = spinningPoint.RotatedBy(radians * k);
|
||||
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + vector255.SafeNormalize(Vector2.UnitY) * 5f, vector255, type, damage, 0f, Main.myPlayer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Velocity boost
|
||||
if (calamityGlobalNPC.newAI[3] == spiralGateValue)
|
||||
{
|
||||
NPC.velocity = NPC.velocity.SafeNormalize(Vector2.UnitY);
|
||||
NPC.velocity *= 24f;
|
||||
}
|
||||
|
||||
// Spin velocity
|
||||
float velocity = (float)(MathHelper.Pi * 2D) / 120f;
|
||||
// In GFB, contracts the radius as the fight progresses
|
||||
if (getFuckedAI)
|
||||
velocity *= phase3 ? 1.5f : phase2 ? 1.25f : 1f;
|
||||
NPC.velocity = NPC.velocity.RotatedBy(-(double)velocity * NPC.localAI[1]);
|
||||
// Speed up even more in GFB for more radius
|
||||
if (getFuckedAI && NPC.velocity.Length() <= 32f)
|
||||
NPC.velocity *= 1.1f;
|
||||
NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X) + MathHelper.PiOver2;
|
||||
|
||||
// Reset and charge at target
|
||||
// Don't reset in GFB
|
||||
if (!getFuckedAI && calamityGlobalNPC.newAI[3] >= spiralGateValue + 120f)
|
||||
{
|
||||
calamityGlobalNPC.newAI[3] = 0f;
|
||||
NPC.TargetClosest();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!Collision.CanHit(NPC.Center, 1, 1, player.position, player.width, player.height) && calamityGlobalNPC.newAI[3] > 300f)
|
||||
calamityGlobalNPC.newAI[3] -= 2f;
|
||||
|
||||
if (NPC.localAI[3] > 0f)
|
||||
NPC.localAI[3] -= 1f;
|
||||
|
||||
NPC.localAI[1] = NPC.Center.X - player.Center.X < 0 ? 1f : -1f;
|
||||
}
|
||||
}
|
||||
|
||||
// Adjust slowing debuff immunity
|
||||
bool immuneToSlowingDebuffs = doSpiral || getFuckedAI;
|
||||
NPC.buffImmune[ModContent.BuffType<GlacialState>()] = immuneToSlowingDebuffs;
|
||||
NPC.buffImmune[ModContent.BuffType<TemporalSadness>()] = immuneToSlowingDebuffs;
|
||||
NPC.buffImmune[ModContent.BuffType<Eutrophication>()] = immuneToSlowingDebuffs;
|
||||
NPC.buffImmune[ModContent.BuffType<TimeDistortion>()] = immuneToSlowingDebuffs;
|
||||
NPC.buffImmune[ModContent.BuffType<GalvanicCorrosion>()] = immuneToSlowingDebuffs;
|
||||
NPC.buffImmune[ModContent.BuffType<Vaporfied>()] = immuneToSlowingDebuffs;
|
||||
NPC.buffImmune[BuffID.Slow] = immuneToSlowingDebuffs;
|
||||
NPC.buffImmune[BuffID.Webbed] = immuneToSlowingDebuffs;
|
||||
|
||||
// Spawn segments
|
||||
if (calamityGlobalNPC.newAI[2] == 0f && NPC.ai[0] == 0f)
|
||||
{
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
{
|
||||
int maxLength = getFuckedAI ? 24 : death ? 80 : revenge ? 40 : expertMode ? 35 : 30;
|
||||
int Previous = NPC.whoAmI;
|
||||
for (int segments = 0; segments < maxLength; segments++)
|
||||
{
|
||||
int lol;
|
||||
if (segments >= 0 && segments < maxLength - 1)
|
||||
{
|
||||
if (segments % 2 == 0)
|
||||
lol = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType<AquaticScourgeBodyAlt>(), NPC.whoAmI);
|
||||
else
|
||||
lol = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType<AquaticScourgeBody>(), NPC.whoAmI);
|
||||
}
|
||||
else
|
||||
lol = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType<AquaticScourgeTail>(), NPC.whoAmI);
|
||||
|
||||
Main.npc[lol].realLife = NPC.whoAmI;
|
||||
Main.npc[lol].ai[2] = NPC.whoAmI;
|
||||
Main.npc[lol].ai[1] = Previous;
|
||||
Main.npc[Previous].ai[0] = lol;
|
||||
NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, lol);
|
||||
Previous = lol;
|
||||
}
|
||||
}
|
||||
|
||||
calamityGlobalNPC.newAI[2] = 1f;
|
||||
}
|
||||
|
||||
// Big barf attack
|
||||
if (calamityGlobalNPC.newAI[0] == 1f && (!doSpiral && phase2) || (getFuckedAI && !phase3))
|
||||
{
|
||||
NPC.localAI[0] += 1f;
|
||||
if (NPC.localAI[0] >= (revenge ? 360f : 420f))
|
||||
{
|
||||
if (Vector2.Distance(player.Center, NPC.Center) > 320f)
|
||||
{
|
||||
NPC.localAI[0] = 0f;
|
||||
NPC.netUpdate = true;
|
||||
SoundEngine.PlaySound(SoundID.NPCDeath13, NPC.Center);
|
||||
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
{
|
||||
int totalProjectiles = bossRush ? 10 : expertMode ? 8 : 6;
|
||||
if (phase3)
|
||||
totalProjectiles *= 2;
|
||||
|
||||
int type = ModContent.ProjectileType<SandPoisonCloud>();
|
||||
int damage = NPC.GetProjectileDamage(type);
|
||||
for (int i = 0; i < totalProjectiles; i++)
|
||||
{
|
||||
Vector2 velocity = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101));
|
||||
velocity = velocity.SafeNormalize(Vector2.UnitY);
|
||||
velocity *= Main.rand.Next(phase3 ? 300 : 100, 401) * 0.01f;
|
||||
|
||||
float maximumVelocityMult = death ? 0.75f : 0.5f;
|
||||
if (expertMode)
|
||||
velocity *= 1f + (maximumVelocityMult * (0.5f - lifeRatio));
|
||||
|
||||
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + velocity.SafeNormalize(Vector2.UnitY) * 5f, velocity, type, damage, 0f, Main.myPlayer);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (NPC.life > Main.npc[(int)NPC.ai[0]].life)
|
||||
NPC.life = Main.npc[(int)NPC.ai[0]].life;
|
||||
|
||||
float maxDistance = calamityGlobalNPC.newAI[0] == 1f ? 12800f : 6400f;
|
||||
if (player.dead || Vector2.Distance(NPC.Center, player.Center) > maxDistance || (nonHostile && biomeEnraged))
|
||||
{
|
||||
calamityGlobalNPC.newAI[1] = 1f;
|
||||
NPC.TargetClosest(false);
|
||||
NPC.velocity.Y += 2f;
|
||||
|
||||
if (NPC.position.Y > Main.worldSurface * 16D)
|
||||
NPC.velocity.Y += 2f;
|
||||
|
||||
if (NPC.position.Y > Main.worldSurface * 16D)
|
||||
{
|
||||
for (int a = 0; a < Main.npc.Length; a++)
|
||||
{
|
||||
int type = Main.npc[a].type;
|
||||
if (AquaticScourgeIDList.Includes(type))
|
||||
Main.npc[a].active = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
calamityGlobalNPC.newAI[1] = 0f;
|
||||
|
||||
// Change direction
|
||||
if (NPC.velocity.X < 0f)
|
||||
NPC.spriteDirection = -1;
|
||||
else if (NPC.velocity.X > 0f)
|
||||
NPC.spriteDirection = 1;
|
||||
|
||||
// Alpha changes
|
||||
NPC.alpha -= 42;
|
||||
if (NPC.alpha < 0)
|
||||
NPC.alpha = 0;
|
||||
|
||||
Vector2 scourgePosition = NPC.Center;
|
||||
Vector2 predictionVector = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? Main.player[NPC.target].velocity * 20f : Vector2.Zero;
|
||||
float scourgeTargetX = player.Center.X + predictionVector.X;
|
||||
float scourgeTargetY = player.Center.Y + predictionVector.Y;
|
||||
|
||||
// Velocity and movement
|
||||
float scourgeMaxSpeed = 5f;
|
||||
float scourgeAcceleration = 0.08f;
|
||||
if (calamityGlobalNPC.newAI[0] == 1f)
|
||||
{
|
||||
scourgeMaxSpeed = revenge ? 14.4f : 12f;
|
||||
scourgeAcceleration = revenge ? 0.18f : 0.15f;
|
||||
if (expertMode)
|
||||
{
|
||||
scourgeMaxSpeed += 2.4f * (1f - lifeRatio);
|
||||
scourgeAcceleration += 0.03f * (1f - lifeRatio);
|
||||
}
|
||||
scourgeMaxSpeed += 3f * enrageScale;
|
||||
scourgeAcceleration += 0.06f * enrageScale;
|
||||
if (death || getFuckedAI)
|
||||
{
|
||||
scourgeMaxSpeed += 5f;
|
||||
scourgeAcceleration -= getFuckedAI ? 0f : 0.03f;
|
||||
scourgeMaxSpeed += Vector2.Distance(player.Center, NPC.Center) * 0.001f;
|
||||
scourgeAcceleration += Vector2.Distance(player.Center, NPC.Center) * 0.000045f;
|
||||
}
|
||||
|
||||
// Increase acceleration after spiral attack
|
||||
if (NPC.localAI[3] > 0f)
|
||||
{
|
||||
float accelerationMultiplier = MathHelper.Lerp(1f, 2f, NPC.localAI[3] / colorFadeTimeAfterSpiral);
|
||||
scourgeAcceleration *= accelerationMultiplier;
|
||||
}
|
||||
|
||||
if (CalamityWorld.LegendaryMode)
|
||||
{
|
||||
scourgeMaxSpeed *= 1.15f;
|
||||
scourgeAcceleration *= 1.15f;
|
||||
}
|
||||
}
|
||||
|
||||
if (!doSpiral)
|
||||
{
|
||||
if (calamityGlobalNPC.newAI[0] != 1f)
|
||||
{
|
||||
scourgeTargetY += 400;
|
||||
if (Math.Abs(NPC.Center.X - player.Center.X) < 500f)
|
||||
{
|
||||
if (NPC.velocity.X > 0f)
|
||||
scourgeTargetX = player.Center.X + 600f;
|
||||
else
|
||||
scourgeTargetX = player.Center.X - 600f;
|
||||
}
|
||||
}
|
||||
|
||||
float scourgeHigherSpeed = scourgeMaxSpeed * 1.3f;
|
||||
float scourgeLowerSpeed = scourgeMaxSpeed * 0.7f;
|
||||
float scourgeSpeed = NPC.velocity.Length();
|
||||
if (scourgeSpeed > 0f)
|
||||
{
|
||||
if (scourgeSpeed > scourgeHigherSpeed)
|
||||
{
|
||||
NPC.velocity = NPC.velocity.SafeNormalize(Vector2.UnitY);
|
||||
NPC.velocity *= scourgeHigherSpeed;
|
||||
}
|
||||
else if (scourgeSpeed < scourgeLowerSpeed)
|
||||
{
|
||||
NPC.velocity = NPC.velocity.SafeNormalize(Vector2.UnitY);
|
||||
NPC.velocity *= scourgeLowerSpeed;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
scourgeTargetX = (int)(scourgeTargetX / 16f) * 16;
|
||||
scourgeTargetY = (int)(scourgeTargetY / 16f) * 16;
|
||||
scourgePosition.X = (int)(scourgePosition.X / 16f) * 16;
|
||||
scourgePosition.Y = (int)(scourgePosition.Y / 16f) * 16;
|
||||
scourgeTargetX -= scourgePosition.X;
|
||||
scourgeTargetY -= scourgePosition.Y;
|
||||
float scourgeTargetDist = (float)Math.Sqrt(scourgeTargetX * scourgeTargetX + scourgeTargetY * scourgeTargetY);
|
||||
|
||||
if (!doSpiral)
|
||||
{
|
||||
float scourgeAbsoluteTargetX = Math.Abs(scourgeTargetX);
|
||||
float scourgeAbsoluteTargetY = Math.Abs(scourgeTargetY);
|
||||
float scourgeTimeToReachTarget = scourgeMaxSpeed / scourgeTargetDist;
|
||||
scourgeTargetX *= scourgeTimeToReachTarget;
|
||||
scourgeTargetY *= scourgeTimeToReachTarget;
|
||||
|
||||
if ((NPC.velocity.X > 0f && scourgeTargetX > 0f) || (NPC.velocity.X < 0f && scourgeTargetX < 0f) || (NPC.velocity.Y > 0f && scourgeTargetY > 0f) || (NPC.velocity.Y < 0f && scourgeTargetY < 0f))
|
||||
{
|
||||
if (NPC.velocity.X < scourgeTargetX)
|
||||
{
|
||||
NPC.velocity.X += scourgeAcceleration;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (NPC.velocity.X > scourgeTargetX)
|
||||
NPC.velocity.X -= scourgeAcceleration;
|
||||
}
|
||||
|
||||
if (NPC.velocity.Y < scourgeTargetY)
|
||||
{
|
||||
NPC.velocity.Y += scourgeAcceleration;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (NPC.velocity.Y > scourgeTargetY)
|
||||
NPC.velocity.Y -= scourgeAcceleration;
|
||||
}
|
||||
|
||||
if (Math.Abs(scourgeTargetY) < scourgeMaxSpeed * 0.2 && ((NPC.velocity.X > 0f && scourgeTargetX < 0f) || (NPC.velocity.X < 0f && scourgeTargetX > 0f)))
|
||||
{
|
||||
if (NPC.velocity.Y > 0f)
|
||||
NPC.velocity.Y += scourgeAcceleration * 2f;
|
||||
else
|
||||
NPC.velocity.Y -= scourgeAcceleration * 2f;
|
||||
}
|
||||
|
||||
if (Math.Abs(scourgeTargetX) < scourgeMaxSpeed * 0.2 && ((NPC.velocity.Y > 0f && scourgeTargetY < 0f) || (NPC.velocity.Y < 0f && scourgeTargetY > 0f)))
|
||||
{
|
||||
if (NPC.velocity.X > 0f)
|
||||
NPC.velocity.X += scourgeAcceleration * 2f;
|
||||
else
|
||||
NPC.velocity.X -= scourgeAcceleration * 2f;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (scourgeAbsoluteTargetX > scourgeAbsoluteTargetY)
|
||||
{
|
||||
if (NPC.velocity.X < scourgeTargetX)
|
||||
NPC.velocity.X += scourgeAcceleration * 1.1f;
|
||||
else if (NPC.velocity.X > scourgeTargetX)
|
||||
NPC.velocity.X -= scourgeAcceleration * 1.1f;
|
||||
|
||||
if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < scourgeMaxSpeed * 0.5)
|
||||
{
|
||||
if (NPC.velocity.Y > 0f)
|
||||
NPC.velocity.Y += scourgeAcceleration;
|
||||
else
|
||||
NPC.velocity.Y -= scourgeAcceleration;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (NPC.velocity.Y < scourgeTargetY)
|
||||
NPC.velocity.Y += scourgeAcceleration * 1.1f;
|
||||
else if (NPC.velocity.Y > scourgeTargetY)
|
||||
NPC.velocity.Y -= scourgeAcceleration * 1.1f;
|
||||
|
||||
if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < scourgeMaxSpeed * 0.5)
|
||||
{
|
||||
if (NPC.velocity.X > 0f)
|
||||
NPC.velocity.X += scourgeAcceleration;
|
||||
else
|
||||
NPC.velocity.X -= scourgeAcceleration;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X) + MathHelper.PiOver2;
|
||||
}
|
||||
|
||||
// Calculate contact damage based on velocity
|
||||
if (!nonHostile)
|
||||
{
|
||||
float minimalContactDamageVelocity = scourgeMaxSpeed * 0.25f;
|
||||
float minimalDamageVelocity = scourgeMaxSpeed * 0.5f;
|
||||
if (NPC.velocity.Length() <= minimalContactDamageVelocity)
|
||||
NPC.damage = (int)Math.Round(NPC.defDamage * 0.5);
|
||||
else
|
||||
{
|
||||
float velocityDamageScalar = MathHelper.Clamp((NPC.velocity.Length() - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f);
|
||||
NPC.damage = (int)MathHelper.Lerp((float)Math.Round(NPC.defDamage * 0.5), NPC.defDamage, velocityDamageScalar);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor)
|
||||
@@ -205,7 +665,7 @@ namespace CalamityMod.NPCs.AquaticScourge
|
||||
if (spawnInfo.Player.Calamity().ZoneSulphur && spawnInfo.Water)
|
||||
{
|
||||
if (!NPC.AnyNPCs(ModContent.NPCType<AquaticScourgeHead>()))
|
||||
return (Main.getGoodWorld ? 0.05f : 0.01f);
|
||||
return (CalamityWorld.LegendaryMode ? 0.05f : 0.01f);
|
||||
}
|
||||
|
||||
return 0f;
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
using System.IO;
|
||||
using System;
|
||||
using System.IO;
|
||||
using CalamityMod.Buffs.DamageOverTime;
|
||||
using CalamityMod.Buffs.StatDebuffs;
|
||||
using CalamityMod.Events;
|
||||
using CalamityMod.NPCs.CalamityAIs.CalamityBossAIs;
|
||||
using CalamityMod.Systems.Collections;
|
||||
using CalamityMod.World;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
@@ -35,7 +37,7 @@ namespace CalamityMod.NPCs.AquaticScourge
|
||||
NPC.knockBackResist = 0f;
|
||||
NPC.alpha = 255;
|
||||
NPC.LifeMaxNERB(80000, 96000, 1000000);
|
||||
if (CalamityWorld.LegendaryMode && CalamityWorld.revenge)
|
||||
if (CalamityWorld.LegendaryMode)
|
||||
NPC.lifeMax *= 2;
|
||||
NPC.behindTiles = true;
|
||||
NPC.noGravity = true;
|
||||
@@ -55,7 +57,7 @@ namespace CalamityMod.NPCs.AquaticScourge
|
||||
else if (Main.expertMode)
|
||||
NPC.scale *= 1.1f;
|
||||
|
||||
if (Main.getGoodWorld)
|
||||
if (CalamityWorld.LegendaryMode)
|
||||
NPC.scale *= 1.25f;
|
||||
|
||||
NPC.Calamity().VulnerableToHeat = false;
|
||||
@@ -88,7 +90,218 @@ namespace CalamityMod.NPCs.AquaticScourge
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
AquaticScourgeAI.VanillaAquaticScourgeAI(NPC, Mod, false);
|
||||
CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity();
|
||||
bool bossRush = BossRushEvent.BossRushActive;
|
||||
bool expertMode = Main.expertMode || bossRush;
|
||||
bool revenge = CalamityWorld.revenge || bossRush;
|
||||
bool death = CalamityWorld.death || bossRush;
|
||||
|
||||
bool getFuckedAI = Main.zenithWorld;
|
||||
|
||||
// Adjust hostility and stats
|
||||
bool nonHostile = calamityGlobalNPC.newAI[0] == 0f;
|
||||
if (NPC.justHit || NPC.life <= NPC.lifeMax * 0.999 || bossRush || CalamityWorld.LegendaryMode)
|
||||
{
|
||||
if (nonHostile)
|
||||
{
|
||||
// Kiss my motherfucking ass you piece of shit game
|
||||
NPC.timeLeft *= 20;
|
||||
NPC.npcSlots = 16f;
|
||||
CalamityGlobalNPC.BossKillTimes.TryGetValue(NPC.type, out int revKillTime);
|
||||
calamityGlobalNPC.KillTime = revKillTime;
|
||||
calamityGlobalNPC.newAI[0] = 1f;
|
||||
nonHostile = false;
|
||||
NPC.chaseable = true;
|
||||
NPC.netUpdate = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
NPC.damage = 0;
|
||||
|
||||
// Percent life remaining
|
||||
float lifeRatio = NPC.life / (float)NPC.lifeMax;
|
||||
|
||||
// Phases
|
||||
bool phase2 = lifeRatio < 0.75f;
|
||||
bool phase3 = lifeRatio < 0.5f;
|
||||
bool phase4 = lifeRatio < 0.25f;
|
||||
|
||||
// Set worm variable
|
||||
if (NPC.ai[2] > 0f)
|
||||
NPC.realLife = (int)NPC.ai[2];
|
||||
if (NPC.life > Main.npc[(int)NPC.ai[1]].life)
|
||||
NPC.life = Main.npc[(int)NPC.ai[1]].life;
|
||||
|
||||
// Get a target
|
||||
if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active)
|
||||
NPC.TargetClosest();
|
||||
|
||||
Player player = Main.player[NPC.target];
|
||||
|
||||
bool notOcean = player.position.Y < 300f ||
|
||||
player.position.Y > Main.worldSurface * 16.0 ||
|
||||
(player.position.X > 7680f && player.position.X < (Main.maxTilesX * 16 - 7680));
|
||||
|
||||
// Check for the flipped Abyss
|
||||
if (Main.remixWorld)
|
||||
{
|
||||
notOcean = player.position.Y < Main.UnderworldLayer * 0.8f || player.position.Y > Main.UnderworldLayer ||
|
||||
(player.position.X > 7680f && player.position.X < (Main.maxTilesX * 16 - 7680));
|
||||
}
|
||||
|
||||
bool biomeEnraged = NPC.localAI[2] <= 0f || bossRush;
|
||||
float enrageScale = bossRush ? 1f : 0f;
|
||||
if (biomeEnraged)
|
||||
{
|
||||
NPC.Calamity().CurrentlyEnraged = !bossRush;
|
||||
enrageScale += 2f;
|
||||
}
|
||||
|
||||
// Adjust slowing debuff immunity
|
||||
bool immuneToSlowingDebuffs = getFuckedAI;
|
||||
NPC.buffImmune[ModContent.BuffType<GlacialState>()] = immuneToSlowingDebuffs;
|
||||
NPC.buffImmune[ModContent.BuffType<TemporalSadness>()] = immuneToSlowingDebuffs;
|
||||
NPC.buffImmune[ModContent.BuffType<Eutrophication>()] = immuneToSlowingDebuffs;
|
||||
NPC.buffImmune[ModContent.BuffType<TimeDistortion>()] = immuneToSlowingDebuffs;
|
||||
NPC.buffImmune[ModContent.BuffType<GalvanicCorrosion>()] = immuneToSlowingDebuffs;
|
||||
NPC.buffImmune[ModContent.BuffType<Vaporfied>()] = immuneToSlowingDebuffs;
|
||||
NPC.buffImmune[BuffID.Slow] = immuneToSlowingDebuffs;
|
||||
NPC.buffImmune[BuffID.Webbed] = immuneToSlowingDebuffs;
|
||||
|
||||
// Kill body and tail
|
||||
bool shouldDespawn = true;
|
||||
for (int i = 0; i < Main.maxNPCs; i++)
|
||||
{
|
||||
if (Main.npc[i].active && Main.npc[i].type == ModContent.NPCType<AquaticScourgeHead>())
|
||||
{
|
||||
shouldDespawn = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!shouldDespawn)
|
||||
{
|
||||
if (NPC.ai[1] <= 0f)
|
||||
shouldDespawn = true;
|
||||
else if (Main.npc[(int)NPC.ai[1]].life <= 0)
|
||||
shouldDespawn = true;
|
||||
}
|
||||
if (shouldDespawn)
|
||||
{
|
||||
NPC.life = 0;
|
||||
NPC.HitEffect(0, 10.0);
|
||||
NPC.checkDead();
|
||||
NPC.active = false;
|
||||
}
|
||||
|
||||
float maxDistance = calamityGlobalNPC.newAI[0] == 1f ? 12800f : 6400f;
|
||||
if (player.dead || Vector2.Distance(NPC.Center, player.Center) > maxDistance || (nonHostile && biomeEnraged))
|
||||
{
|
||||
calamityGlobalNPC.newAI[1] = 1f;
|
||||
NPC.TargetClosest(false);
|
||||
NPC.velocity.Y += 2f;
|
||||
|
||||
if (NPC.position.Y > Main.worldSurface * 16D)
|
||||
NPC.velocity.Y += 2f;
|
||||
|
||||
if (NPC.position.Y > Main.worldSurface * 16D)
|
||||
{
|
||||
for (int a = 0; a < Main.npc.Length; a++)
|
||||
{
|
||||
int type = Main.npc[a].type;
|
||||
if (AquaticScourgeIDList.Includes(type))
|
||||
Main.npc[a].active = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
calamityGlobalNPC.newAI[1] = 0f;
|
||||
|
||||
// Change direction
|
||||
if (NPC.velocity.X < 0f)
|
||||
NPC.spriteDirection = -1;
|
||||
else if (NPC.velocity.X > 0f)
|
||||
NPC.spriteDirection = 1;
|
||||
|
||||
// Alpha changes
|
||||
if (Main.npc[(int)NPC.ai[1]].alpha < 128)
|
||||
{
|
||||
NPC.alpha -= 42;
|
||||
if (NPC.alpha < 0)
|
||||
NPC.alpha = 0;
|
||||
}
|
||||
|
||||
Vector2 scourgePosition = NPC.Center;
|
||||
Vector2 predictionVector = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? Main.player[NPC.target].velocity * 20f : Vector2.Zero;
|
||||
float scourgeTargetX = player.Center.X + predictionVector.X;
|
||||
float scourgeTargetY = player.Center.Y + predictionVector.Y;
|
||||
|
||||
// Velocity and movement
|
||||
float scourgeMaxSpeed = 5f;
|
||||
if (calamityGlobalNPC.newAI[0] == 1f)
|
||||
{
|
||||
scourgeMaxSpeed = revenge ? 14.4f : 12f;
|
||||
if (expertMode)
|
||||
scourgeMaxSpeed += 2.4f * (1f - lifeRatio);
|
||||
scourgeMaxSpeed += 3f * enrageScale;
|
||||
if (death || getFuckedAI)
|
||||
{
|
||||
scourgeMaxSpeed += 5f;
|
||||
scourgeMaxSpeed += Vector2.Distance(player.Center, NPC.Center) * 0.001f;
|
||||
}
|
||||
|
||||
if (CalamityWorld.LegendaryMode)
|
||||
scourgeMaxSpeed *= 1.15f;
|
||||
}
|
||||
|
||||
scourgeTargetX = (int)(scourgeTargetX / 16f) * 16;
|
||||
scourgeTargetY = (int)(scourgeTargetY / 16f) * 16;
|
||||
scourgePosition.X = (int)(scourgePosition.X / 16f) * 16;
|
||||
scourgePosition.Y = (int)(scourgePosition.Y / 16f) * 16;
|
||||
scourgeTargetX -= scourgePosition.X;
|
||||
scourgeTargetY -= scourgePosition.Y;
|
||||
|
||||
if (NPC.ai[1] > 0f && NPC.ai[1] < Main.npc.Length)
|
||||
{
|
||||
try
|
||||
{
|
||||
scourgePosition = NPC.Center;
|
||||
scourgeTargetX = Main.npc[(int)NPC.ai[1]].Center.X - scourgePosition.X;
|
||||
scourgeTargetY = Main.npc[(int)NPC.ai[1]].Center.Y - scourgePosition.Y;
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
|
||||
NPC.rotation = (float)Math.Atan2(scourgeTargetY, scourgeTargetX) + MathHelper.PiOver2;
|
||||
float scourgeTargetDist = (float)Math.Sqrt(scourgeTargetX * scourgeTargetX + scourgeTargetY * scourgeTargetY);
|
||||
int scourgeWidth = NPC.width;
|
||||
scourgeTargetDist = (scourgeTargetDist - scourgeWidth) / scourgeTargetDist;
|
||||
scourgeTargetX *= scourgeTargetDist;
|
||||
scourgeTargetY *= scourgeTargetDist;
|
||||
NPC.velocity = Vector2.Zero;
|
||||
NPC.position.X = NPC.position.X + scourgeTargetX;
|
||||
NPC.position.Y = NPC.position.Y + scourgeTargetY;
|
||||
|
||||
if (scourgeTargetX < 0f)
|
||||
NPC.spriteDirection = -1;
|
||||
else if (scourgeTargetX > 0f)
|
||||
NPC.spriteDirection = 1;
|
||||
}
|
||||
|
||||
// Calculate contact damage based on velocity
|
||||
if (!nonHostile)
|
||||
{
|
||||
float minimalContactDamageVelocity = scourgeMaxSpeed * 0.25f;
|
||||
float minimalDamageVelocity = scourgeMaxSpeed * 0.5f;
|
||||
float bodyAndTailVelocity = (NPC.position - NPC.oldPosition).Length();
|
||||
if (bodyAndTailVelocity <= minimalContactDamageVelocity)
|
||||
NPC.damage = 0;
|
||||
else
|
||||
{
|
||||
float velocityDamageScalar = MathHelper.Clamp((bodyAndTailVelocity - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f);
|
||||
NPC.damage = (int)MathHelper.Lerp(0f, NPC.defDamage, velocityDamageScalar);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor)
|
||||
|
||||
@@ -19,12 +19,13 @@ using CalamityMod.Items.Weapons.Melee;
|
||||
using CalamityMod.Items.Weapons.Ranged;
|
||||
using CalamityMod.Items.Weapons.Rogue;
|
||||
using CalamityMod.Items.Weapons.Summon;
|
||||
using CalamityMod.NPCs.CalamityAIs.CalamityBossAIs;
|
||||
using CalamityMod.NPCs.TownNPCs;
|
||||
using CalamityMod.NPCs.VanillaNPCAIOverrides.RegularEnemies;
|
||||
using CalamityMod.Projectiles.Boss;
|
||||
using CalamityMod.World;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using ReLogic.Content;
|
||||
using System;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.GameContent;
|
||||
@@ -109,7 +110,7 @@ namespace CalamityMod.NPCs.AstrumAureus
|
||||
NPC.Calamity().VulnerableToSickness = false;
|
||||
SpawnModBiomes = new int[1] { ModContent.GetInstance<BiomeManagers.AstralInfectionBiome>().Type };
|
||||
|
||||
if (Main.getGoodWorld)
|
||||
if (CalamityWorld.LegendaryMode)
|
||||
NPC.scale *= 0.8f;
|
||||
if (Main.zenithWorld)
|
||||
NPC.scale *= 1.5f;
|
||||
@@ -153,7 +154,934 @@ namespace CalamityMod.NPCs.AstrumAureus
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
AstrumAureusAI.VanillaAstrumAureusAI(NPC, Mod);
|
||||
CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity();
|
||||
CalamityGlobalNPC.astrumAureus = NPC.whoAmI;
|
||||
|
||||
// Variables
|
||||
bool bossRush = BossRushEvent.BossRushActive;
|
||||
bool expertMode = Main.expertMode || bossRush;
|
||||
bool revenge = CalamityWorld.revenge || bossRush;
|
||||
bool death = CalamityWorld.death || bossRush;
|
||||
|
||||
// Percent life remaining
|
||||
float lifeRatio = NPC.life / (float)NPC.lifeMax;
|
||||
|
||||
// Phases
|
||||
bool phase2 = lifeRatio < (revenge ? 0.85f : expertMode ? 0.8f : 0.75f);
|
||||
bool phase3 = lifeRatio < (revenge ? 0.7f : expertMode ? 0.6f : 0.5f);
|
||||
bool phase4 = lifeRatio < (revenge ? 0.5f : 0.4f) && expertMode;
|
||||
bool phase5 = lifeRatio < 0.3f && revenge;
|
||||
|
||||
// Exhaustion
|
||||
bool exhausted = NPC.ai[2] >= (phase3 ? 2f : 1f);
|
||||
calamityGlobalNPC.DR = exhausted ? 0.2f : 0.4f;
|
||||
NPC.defense = exhausted ? NPC.defDefense / 2 : NPC.defDefense;
|
||||
|
||||
// Get a target
|
||||
if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active)
|
||||
NPC.TargetClosest();
|
||||
|
||||
// Despawn safety, make sure to target another player if the current player target is too far away
|
||||
if (Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles)
|
||||
NPC.TargetClosest();
|
||||
|
||||
Player player = Main.player[NPC.target];
|
||||
|
||||
// Don't fire projectiles and don't increment phase timers for 4 seconds after the teleport phase to avoid cheap bullshit
|
||||
float noProjectileOrPhaseIncrementTime = 240f;
|
||||
|
||||
bool dontAttack = NPC.localAI[3] > 0f;
|
||||
if (dontAttack)
|
||||
{
|
||||
NPC.localAI[3] -= 1f;
|
||||
if (NPC.Distance(player.Center) < 240f)
|
||||
NPC.localAI[3] -= death ? 4f : expertMode ? 2f : 1f;
|
||||
}
|
||||
|
||||
float enrageScale = bossRush ? 1f : 0f;
|
||||
if ((Main.IsItDay() && !player.Calamity().ZoneAstral) || bossRush)
|
||||
{
|
||||
NPC.Calamity().CurrentlyEnraged = !bossRush;
|
||||
enrageScale += 1f;
|
||||
}
|
||||
|
||||
float astralFlameBarrageTimerIncrement = 1f;
|
||||
if (expertMode)
|
||||
astralFlameBarrageTimerIncrement += death ? (float)Math.Round(3f * (1f - lifeRatio)) : (float)Math.Round(2f * (1f - lifeRatio));
|
||||
|
||||
float walkingVelocity = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 6f : 5f;
|
||||
walkingVelocity += 3f * enrageScale;
|
||||
if (phase5)
|
||||
walkingVelocity += 2f;
|
||||
if (expertMode)
|
||||
walkingVelocity += 1.5f * (1f - lifeRatio);
|
||||
if (revenge)
|
||||
walkingVelocity += Math.Abs(NPC.Center.X - player.Center.X) * 0.0025f;
|
||||
if (CalamityWorld.LegendaryMode)
|
||||
walkingVelocity *= 1.15f;
|
||||
|
||||
float walkingProjectileVelocity = walkingVelocity * 0.8f;
|
||||
|
||||
// Direction
|
||||
NPC.spriteDirection = (NPC.direction > 0) ? 1 : -1;
|
||||
|
||||
// Used to reduce Aureus' fall speed
|
||||
bool reduceFallSpeed = NPC.velocity.Y > 0f && Collision.SolidCollision(NPC.position + Vector2.UnitY * 1.1f * NPC.velocity.Y, NPC.width, NPC.height) && NPC.ai[0] == 4f;
|
||||
|
||||
// Despawn
|
||||
bool despawnDistance = Vector2.Distance(player.Center, NPC.Center) > CalamityGlobalNPC.CatchUpDistance350Tiles;
|
||||
if (!player.active || player.dead || despawnDistance)
|
||||
{
|
||||
NPC.TargetClosest(false);
|
||||
player = Main.player[NPC.target];
|
||||
if (!player.active || player.dead || despawnDistance)
|
||||
{
|
||||
NPC.noTileCollide = true;
|
||||
|
||||
if (NPC.velocity.Y < -3f)
|
||||
NPC.velocity.Y = -3f;
|
||||
NPC.velocity.Y += 0.1f;
|
||||
if (NPC.velocity.Y > 12f)
|
||||
NPC.velocity.Y = 12f;
|
||||
|
||||
if (NPC.timeLeft > 60)
|
||||
NPC.timeLeft = 60;
|
||||
|
||||
if (NPC.ai[0] != 0f)
|
||||
{
|
||||
NPC.ai[0] = 0f;
|
||||
NPC.ai[1] = 0f;
|
||||
NPC.ai[2] = 0f;
|
||||
NPC.ai[3] = 0f;
|
||||
NPC.localAI[2] = 0f;
|
||||
NPC.localAI[3] = 0f;
|
||||
calamityGlobalNPC.newAI[0] = 0f;
|
||||
calamityGlobalNPC.newAI[1] = 0f;
|
||||
NPC.netUpdate = true;
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (NPC.timeLeft < 1800)
|
||||
NPC.timeLeft = 1800;
|
||||
|
||||
bool geldonPhase1 = lifeRatio > 0.6f && lifeRatio <= 0.7f;
|
||||
bool geldonPhase2 = lifeRatio <= 0.1f;
|
||||
if (Main.zenithWorld && (geldonPhase1 || geldonPhase2))
|
||||
{
|
||||
slimeProjCounter++;
|
||||
if (slimeProjCounter % 180 == 0)
|
||||
{
|
||||
SoundEngine.PlaySound(SoundID.Item33, NPC.Center); // Intentionally keeping the old laser sound in GFB
|
||||
|
||||
if (slimePhase == 1)
|
||||
{
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
{
|
||||
int type = ModContent.ProjectileType<AstralFlame>();
|
||||
int damage = NPC.GetProjectileDamage(type);
|
||||
int totalProjectiles = bossRush ? 14 : death ? 12 : revenge ? 10 : expertMode ? 8 : 6;
|
||||
float radians = MathHelper.TwoPi / totalProjectiles;
|
||||
float velocity = 10f;
|
||||
Vector2 spinningPoint = new Vector2(0f, -velocity);
|
||||
for (int k = 0; k < totalProjectiles; k++)
|
||||
{
|
||||
Vector2 velocity2 = spinningPoint.RotatedBy(radians * k);
|
||||
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, velocity2, type, damage, 0f, Main.myPlayer, 0f, 1f);
|
||||
}
|
||||
}
|
||||
slimePhase = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
{
|
||||
int type = ModContent.ProjectileType<AstralLaser>();
|
||||
int damage = NPC.GetProjectileDamage(type);
|
||||
float aureusLaserSpeed = 7f;
|
||||
float aureusLaserTargetX = player.Center.X - NPC.Center.X;
|
||||
float aureusLaserTargetY = player.Center.Y - NPC.Center.Y;
|
||||
float aureusLaserTargetDist = (float)Math.Sqrt(aureusLaserTargetX * aureusLaserTargetX + aureusLaserTargetY * aureusLaserTargetY);
|
||||
aureusLaserTargetDist = aureusLaserSpeed / aureusLaserTargetDist;
|
||||
aureusLaserTargetX *= aureusLaserTargetDist;
|
||||
aureusLaserTargetY *= aureusLaserTargetDist;
|
||||
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center.X, NPC.Center.Y, aureusLaserTargetX, aureusLaserTargetY, type, damage, 0f, Main.myPlayer);
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
Vector2 offset = new Vector2(Main.rand.Next(-6, 7), Main.rand.Next(-6, 7));
|
||||
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center.X, NPC.Center.Y, aureusLaserTargetX + offset.X, aureusLaserTargetY + offset.Y, type, damage, 0f, Main.myPlayer);
|
||||
}
|
||||
}
|
||||
slimePhase = 1;
|
||||
}
|
||||
}
|
||||
RevengeanceAndDeathAI.BuffedMimicAI(NPC, Mod);
|
||||
NPC.noGravity = false;
|
||||
NPC.noTileCollide = false;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
NPC.noGravity = true;
|
||||
}
|
||||
|
||||
// Emit light when not Idle
|
||||
if (NPC.ai[0] != 1f)
|
||||
Lighting.AddLight((int)((NPC.position.X + (NPC.width / 2)) / 16f), (int)((NPC.position.Y + (NPC.height / 2)) / 16f), 1.3f, 0.5f, 0f);
|
||||
|
||||
// Fire projectiles while walking, teleporting, or falling
|
||||
if (NPC.ai[0] == 2f || NPC.ai[0] >= 5f)
|
||||
{
|
||||
if (!dontAttack)
|
||||
NPC.localAI[0] += NPC.ai[0] == 2f ? 1f : astralFlameBarrageTimerIncrement;
|
||||
|
||||
float astralFlameBarrageGateValue = phase4 ? 30f : 60f;
|
||||
if (NPC.localAI[0] >= astralFlameBarrageGateValue)
|
||||
{
|
||||
// Fire astral flames while teleporting
|
||||
if (NPC.ai[0] >= 5f && NPC.ai[0] != 7)
|
||||
{
|
||||
NPC.localAI[0] = 0f;
|
||||
SoundEngine.PlaySound(FlameCrystalSound, NPC.Center);
|
||||
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
{
|
||||
float velocity = death ? (8f + NPC.localAI[2] * 0.025f) : 7f;
|
||||
int type = ModContent.ProjectileType<AstralFlame>();
|
||||
int damage = NPC.GetProjectileDamage(type);
|
||||
float spreadLimit = (phase4 ? 100f : 50f) + enrageScale * 50f;
|
||||
float randomSpread = (Main.rand.NextFloat() - 0.5f) * spreadLimit;
|
||||
Vector2 spawnVector = new Vector2(NPC.Center.X, NPC.Center.Y - 80f * NPC.scale);
|
||||
Vector2 destination = new Vector2(spawnVector.X + randomSpread, spawnVector.Y - 100f * NPC.scale);
|
||||
Projectile.NewProjectile(NPC.GetSource_FromAI(), spawnVector, Vector2.Normalize(destination - spawnVector) * velocity, type, damage, 0f, Main.myPlayer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
float laserBarrageGateValue = phase5 ? 160f : phase3 ? 120f : phase2 ? 80f : 60f;
|
||||
if (NPC.localAI[0] >= laserBarrageGateValue)
|
||||
{
|
||||
// Fire astral lasers while walking
|
||||
if (NPC.ai[0] == 2f)
|
||||
{
|
||||
NPC.localAI[0] = 0f;
|
||||
|
||||
SoundEngine.PlaySound(LaserSound, NPC.Center);
|
||||
|
||||
if (calamityGlobalNPC.newAI[2] == 0f)
|
||||
{
|
||||
calamityGlobalNPC.newAI[2] = 1f;
|
||||
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
{
|
||||
int maxProjectiles = !phase2 ? (bossRush ? 5 : 3) : (bossRush ? 7 : 5);
|
||||
int spread = !phase2 ? (bossRush ? 11 : 8) : (bossRush ? 12 : 10);
|
||||
|
||||
int type = ModContent.ProjectileType<AstralLaser>();
|
||||
int damage = NPC.GetProjectileDamage(type);
|
||||
Vector2 projectileVelocity = Vector2.Normalize(player.Center - NPC.Center) * walkingProjectileVelocity;
|
||||
float rotation = MathHelper.ToRadians(spread);
|
||||
for (int i = 0; i < maxProjectiles; i++)
|
||||
{
|
||||
Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(maxProjectiles - 1)));
|
||||
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, perturbedSpeed, type, damage, 0f, Main.myPlayer, 0f, walkingProjectileVelocity * 2f);
|
||||
}
|
||||
|
||||
if (phase3)
|
||||
{
|
||||
float flameVelocity = walkingProjectileVelocity;
|
||||
maxProjectiles = 2;
|
||||
spread = 45;
|
||||
|
||||
type = ModContent.ProjectileType<AstralFlame>();
|
||||
damage = NPC.GetProjectileDamage(type);
|
||||
projectileVelocity = Vector2.Normalize(player.Center - NPC.Center) * flameVelocity;
|
||||
rotation = MathHelper.ToRadians(spread);
|
||||
for (int i = 0; i < maxProjectiles; i++)
|
||||
{
|
||||
Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(maxProjectiles - 1)));
|
||||
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, perturbedSpeed, type, damage, 0f, Main.myPlayer);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
calamityGlobalNPC.newAI[2] = 0f;
|
||||
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
{
|
||||
int maxProjectiles = !phase3 ? (bossRush ? 13 : death ? 11 : 9) : (bossRush ? 19 : death ? 17 : 15);
|
||||
int spread = !phase3 ? (bossRush ? 20 : death ? 18 : 16) : (bossRush ? 24 : death ? 22 : 20);
|
||||
|
||||
int type = ModContent.ProjectileType<AstralLaser>();
|
||||
int damage = NPC.GetProjectileDamage(type);
|
||||
int centralLaser = maxProjectiles / 2;
|
||||
int[] lasersToNotFire = new int[6] { centralLaser - 3, centralLaser - 2, centralLaser - 1, centralLaser + 1, centralLaser + 2, centralLaser + 3 };
|
||||
Vector2 projectileVelocity = Vector2.Normalize(player.Center - NPC.Center) * walkingProjectileVelocity;
|
||||
float rotation = MathHelper.ToRadians(spread);
|
||||
for (int i = 0; i < maxProjectiles; i++)
|
||||
{
|
||||
if (i != lasersToNotFire[0] && i != lasersToNotFire[1] && i != lasersToNotFire[2] && i != lasersToNotFire[3] && i != lasersToNotFire[4] && i != lasersToNotFire[5])
|
||||
{
|
||||
Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(maxProjectiles - 1)));
|
||||
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, perturbedSpeed, type, damage, 0f, Main.myPlayer, 0f, walkingProjectileVelocity * 2f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
NPC.localAI[0] = 0f;
|
||||
|
||||
// Start up
|
||||
if (NPC.ai[0] == 0f)
|
||||
{
|
||||
// Avoid cheap bullshit
|
||||
NPC.damage = 0;
|
||||
|
||||
NPC.ai[0] = 1f;
|
||||
NPC.netUpdate = true;
|
||||
CustomGravity();
|
||||
}
|
||||
|
||||
// Idle
|
||||
else if (NPC.ai[0] == 1f)
|
||||
{
|
||||
// Avoid cheap bullshit
|
||||
NPC.damage = 0;
|
||||
|
||||
// Slow down
|
||||
NPC.velocity.X *= 0.8f;
|
||||
|
||||
// Stay vulnerable for 3 seconds
|
||||
NPC.ai[1] += 1f;
|
||||
if (NPC.Distance(player.Center) < 240f)
|
||||
NPC.ai[1] += death ? 4f : expertMode ? 2f : 1f;
|
||||
|
||||
if (NPC.ai[1] >= 180f || bossRush)
|
||||
{
|
||||
// Set AI to random state and reset other AI arrays
|
||||
NPC.TargetClosest();
|
||||
switch (Main.rand.Next(phase3 ? 3 : 2))
|
||||
{
|
||||
case 0:
|
||||
NPC.ai[0] = 2f;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
NPC.ai[0] = 3f;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
NPC.ai[0] = 5f;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
NPC.ai[1] = 0f;
|
||||
NPC.ai[2] = 0f;
|
||||
|
||||
// Stop colliding with tiles if entering walking phase
|
||||
NPC.noTileCollide = NPC.ai[0] == 2f;
|
||||
|
||||
NPC.netUpdate = true;
|
||||
}
|
||||
else
|
||||
CustomGravity();
|
||||
}
|
||||
|
||||
// Walk
|
||||
else if (NPC.ai[0] == 2f)
|
||||
{
|
||||
// Avoid cheap bullshit
|
||||
NPC.damage = 0;
|
||||
|
||||
// Set walking direction
|
||||
if (Math.Abs(NPC.Center.X - player.Center.X) < 200f * NPC.scale)
|
||||
{
|
||||
NPC.velocity.X *= 0.8f;
|
||||
if (NPC.velocity.X > -0.1 && NPC.velocity.X < 0.1)
|
||||
NPC.velocity.X = 0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
float playerLocation = NPC.Center.X - player.Center.X;
|
||||
NPC.direction = playerLocation < 0 ? 1 : -1;
|
||||
|
||||
if (NPC.direction > 0)
|
||||
NPC.velocity.X = (NPC.velocity.X * 20f + walkingVelocity) / 21f;
|
||||
if (NPC.direction < 0)
|
||||
NPC.velocity.X = (NPC.velocity.X * 20f - walkingVelocity) / 21f;
|
||||
}
|
||||
|
||||
if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.Center, 1, 1) && !Collision.SolidCollision(NPC.position, NPC.width, NPC.height) && player.position.Y <= NPC.position.Y + NPC.height && !NPC.collideX)
|
||||
{
|
||||
CustomGravity();
|
||||
NPC.noTileCollide = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
NPC.noTileCollide = true;
|
||||
|
||||
// Walk through tiles if colliding with tiles and player is out of reach
|
||||
int aureusHitboxWidth = 80;
|
||||
int aureusHitboxHeight = 20;
|
||||
Vector2 aureusHitboxTileCollideSize = new Vector2(NPC.Center.X - (aureusHitboxWidth / 2), NPC.position.Y + NPC.height - aureusHitboxHeight);
|
||||
|
||||
bool nearPlayerWalkingThroughTiles = false;
|
||||
if (NPC.position.X < player.position.X && NPC.position.X + NPC.width > player.position.X + player.width && NPC.position.Y + NPC.height < player.position.Y + player.height - 16f)
|
||||
nearPlayerWalkingThroughTiles = true;
|
||||
|
||||
if (nearPlayerWalkingThroughTiles)
|
||||
{
|
||||
NPC.velocity.Y += 0.5f;
|
||||
}
|
||||
else if (Collision.SolidCollision(aureusHitboxTileCollideSize, aureusHitboxWidth, aureusHitboxHeight))
|
||||
{
|
||||
if (NPC.velocity.Y > 0f)
|
||||
NPC.velocity.Y = 0f;
|
||||
|
||||
if (NPC.velocity.Y > -0.2)
|
||||
NPC.velocity.Y -= 0.025f;
|
||||
else
|
||||
NPC.velocity.Y -= 0.2f;
|
||||
|
||||
if (NPC.velocity.Y < -4f)
|
||||
NPC.velocity.Y = -4f;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (NPC.velocity.Y < 0f)
|
||||
NPC.velocity.Y = 0f;
|
||||
|
||||
if (NPC.velocity.Y < 0.1)
|
||||
NPC.velocity.Y += 0.025f;
|
||||
else
|
||||
NPC.velocity.Y += 0.5f;
|
||||
}
|
||||
}
|
||||
|
||||
// Walk for a maximum of 6 seconds
|
||||
if (!dontAttack)
|
||||
{
|
||||
NPC.ai[1] += 1f;
|
||||
if (NPC.Distance(player.Center) < 240f)
|
||||
NPC.ai[1] += death ? 4f : expertMode ? 2f : 1f;
|
||||
}
|
||||
|
||||
if (NPC.ai[1] >= ((bossRush ? 270f : 360f) - (death ? 90f * (1f - lifeRatio) : 0f)))
|
||||
{
|
||||
// Collide with tiles again
|
||||
NPC.noTileCollide = false;
|
||||
|
||||
// Set AI to next phase (Jump) and reset other AI
|
||||
NPC.TargetClosest();
|
||||
NPC.ai[0] = exhausted ? 1f : 3f;
|
||||
NPC.ai[1] = 0f;
|
||||
NPC.ai[2] += 1f;
|
||||
NPC.netUpdate = true;
|
||||
}
|
||||
|
||||
// Limit downward velocity
|
||||
if (NPC.velocity.Y > 10f)
|
||||
NPC.velocity.Y = 10f;
|
||||
}
|
||||
|
||||
// Jump
|
||||
else if (NPC.ai[0] == 3f)
|
||||
{
|
||||
// Avoid cheap bullshit
|
||||
NPC.damage = 0;
|
||||
|
||||
NPC.noTileCollide = false;
|
||||
|
||||
if (NPC.velocity.Y == 0f)
|
||||
{
|
||||
// Slow down
|
||||
NPC.velocity.X *= 0.8f;
|
||||
|
||||
// Half second delay before jumping
|
||||
if (!dontAttack)
|
||||
NPC.ai[1] += 1f;
|
||||
|
||||
if (NPC.ai[1] >= 30f)
|
||||
{
|
||||
NPC.ai[1] = -20f;
|
||||
}
|
||||
else if (NPC.ai[1] == -1f)
|
||||
{
|
||||
// Set damage
|
||||
NPC.damage = NPC.defDamage;
|
||||
|
||||
// Set jump velocity, reset and set AI to next phase (Stomp)
|
||||
float distanceFromPlayerOnXAxis = NPC.Center.X - player.Center.X;
|
||||
NPC.direction = distanceFromPlayerOnXAxis < 0 ? 1 : -1;
|
||||
calamityGlobalNPC.newAI[3] = NPC.direction;
|
||||
|
||||
// The limit for how much Aureus can multiply its jump velocity
|
||||
float speedMultLimit = 1f;
|
||||
|
||||
// Maxes out when the player is a full 2000 pixels away from or above Aureus
|
||||
float multiplier = 1f / 2000f;
|
||||
|
||||
// Increase Aureus jump velocity X if it's far enough away from the player
|
||||
float distanceAwayFromTarget = Math.Abs(distanceFromPlayerOnXAxis);
|
||||
float distanceGateValue = 400f;
|
||||
bool increaseJumpVelocityX = distanceAwayFromTarget > distanceGateValue && expertMode;
|
||||
if (increaseJumpVelocityX)
|
||||
{
|
||||
calamityGlobalNPC.newAI[0] = (distanceAwayFromTarget - distanceGateValue) * multiplier;
|
||||
if (calamityGlobalNPC.newAI[0] > speedMultLimit)
|
||||
calamityGlobalNPC.newAI[0] = speedMultLimit;
|
||||
}
|
||||
|
||||
// Increase Aureus jump velocity Y if it's far enough above the player
|
||||
float distanceBelowTarget = NPC.position.Y - (player.position.Y + 80f);
|
||||
bool increaseJumpVelocityY = distanceBelowTarget > 0f && revenge;
|
||||
if (increaseJumpVelocityY)
|
||||
{
|
||||
calamityGlobalNPC.newAI[1] = distanceBelowTarget * multiplier;
|
||||
if (calamityGlobalNPC.newAI[1] > speedMultLimit)
|
||||
calamityGlobalNPC.newAI[1] = speedMultLimit;
|
||||
}
|
||||
|
||||
float velocity = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 27f : 20f;
|
||||
velocity += 6f * enrageScale;
|
||||
if (expertMode)
|
||||
velocity += death ? 6f * (1f - lifeRatio) : 4f * (1f - lifeRatio);
|
||||
if (CalamityWorld.LegendaryMode)
|
||||
velocity *= 1.15f;
|
||||
|
||||
NPC.velocity = (new Vector2(player.Center.X, player.Center.Y - 500f) - NPC.Center).SafeNormalize(Vector2.Zero) * velocity;
|
||||
NPC.velocity *= new Vector2(calamityGlobalNPC.newAI[0] + 1f, calamityGlobalNPC.newAI[1] + 1f);
|
||||
|
||||
NPC.noTileCollide = true;
|
||||
|
||||
NPC.ai[0] = 4f;
|
||||
NPC.ai[1] = 0f;
|
||||
|
||||
SoundEngine.PlaySound(JumpSound, NPC.Center);
|
||||
|
||||
NPC.netUpdate = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Don't run custom gravity when starting a jump
|
||||
if (NPC.ai[0] != 4f)
|
||||
CustomGravity();
|
||||
}
|
||||
|
||||
// Stomp
|
||||
else if (NPC.ai[0] == 4f)
|
||||
{
|
||||
if (NPC.velocity.Y == 0f)
|
||||
{
|
||||
// Avoid cheap bullshit
|
||||
NPC.damage = 0;
|
||||
|
||||
// Play stomp sound. Gotta specify the filepath to avoid confusion between the namespace and NPC
|
||||
SoundStyle soundToPlay = Main.zenithWorld ? ExoMechs.Ares.AresGaussNuke.NukeExplosionSound : StompSound;
|
||||
SoundEngine.PlaySound(soundToPlay, NPC.Center);
|
||||
|
||||
if (Main.zenithWorld)
|
||||
{
|
||||
float screenShakePower = 16 * Utils.GetLerpValue(1300f, 0f, NPC.Distance(Main.LocalPlayer.Center), true);
|
||||
if (Main.LocalPlayer.Calamity().GeneralScreenShakePower < screenShakePower)
|
||||
Main.LocalPlayer.Calamity().GeneralScreenShakePower = screenShakePower;
|
||||
}
|
||||
|
||||
// Stomp and jump again, if stomped twice then reset and set AI to next phase (Teleport or Idle)
|
||||
NPC.TargetClosest();
|
||||
NPC.localAI[1] += 1f;
|
||||
float maxStompAmt = phase5 ? 5f : phase3 ? 2f : 3f;
|
||||
if (NPC.localAI[1] >= maxStompAmt)
|
||||
{
|
||||
NPC.ai[0] = exhausted ? 1f : (phase3 ? 5f : 2f);
|
||||
NPC.localAI[1] = 0f;
|
||||
NPC.ai[2] += 1f;
|
||||
NPC.ai[3] = 0f;
|
||||
NPC.noTileCollide = false;
|
||||
NPC.netUpdate = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
float playerLocation = NPC.Center.X - player.Center.X;
|
||||
NPC.direction = playerLocation < 0 ? 1 : -1;
|
||||
NPC.ai[0] = 3f;
|
||||
NPC.ai[3] = 0f;
|
||||
NPC.netUpdate = true;
|
||||
}
|
||||
|
||||
calamityGlobalNPC.newAI[0] = 0f;
|
||||
calamityGlobalNPC.newAI[1] = 0f;
|
||||
calamityGlobalNPC.newAI[3] = 0f;
|
||||
|
||||
// Spawn dust for visual effect
|
||||
for (int i = (int)NPC.position.X - 20; i < (int)NPC.position.X + NPC.width + 40; i += 20)
|
||||
{
|
||||
for (int j = 0; j < 4; j++)
|
||||
{
|
||||
int stompDust = Dust.NewDust(new Vector2(NPC.position.X - 20f, NPC.position.Y + NPC.height), NPC.width + 20, 4, ModContent.DustType<AstralOrange>(), 0f, 0f, 100, default, 1.5f);
|
||||
Main.dust[stompDust].velocity *= 0.2f;
|
||||
}
|
||||
}
|
||||
|
||||
// Fire lasers or flames on stomp
|
||||
SoundEngine.PlaySound(LaserSound, NPC.Center);
|
||||
|
||||
if (Main.zenithWorld)
|
||||
{
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
{
|
||||
int type = Main.rand.NextBool() ? ModContent.ProjectileType<AstralLaser>() : ModContent.ProjectileType<AstralFlame>();
|
||||
int damage = NPC.GetProjectileDamage(type);
|
||||
int totalProjectiles = bossRush ? 14 : death ? 12 : revenge ? 10 : expertMode ? 8 : 6;
|
||||
float radians = MathHelper.TwoPi / totalProjectiles;
|
||||
float velocity = 10f;
|
||||
Vector2 spinningPoint = new Vector2(0f, -velocity);
|
||||
for (int k = 0; k < totalProjectiles; k++)
|
||||
{
|
||||
Vector2 velocity2 = spinningPoint.RotatedBy(radians * k);
|
||||
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, velocity2, type, damage, 0f, Main.myPlayer, 0f, 1f);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (calamityGlobalNPC.newAI[2] == 0f && phase2)
|
||||
{
|
||||
calamityGlobalNPC.newAI[2] = 1f;
|
||||
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
{
|
||||
float flameVelocity = 6f;
|
||||
int maxProjectiles = bossRush ? 4 : death ? 3 : 2;
|
||||
int spread = bossRush ? 36 : death ? 28 : 20;
|
||||
|
||||
int type = ModContent.ProjectileType<AstralFlame>();
|
||||
int damage = NPC.GetProjectileDamage(type);
|
||||
Vector2 spawnVector = new Vector2(NPC.Center.X, NPC.Center.Y - 80f * NPC.scale);
|
||||
Vector2 destination = new Vector2(spawnVector.X, spawnVector.Y + 100f * NPC.scale);
|
||||
Vector2 projectileVelocity = Vector2.Normalize(destination - spawnVector) * flameVelocity;
|
||||
float rotation = MathHelper.ToRadians(spread);
|
||||
for (int i = 0; i < maxProjectiles; i++)
|
||||
{
|
||||
Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(maxProjectiles - 1)));
|
||||
Projectile.NewProjectile(NPC.GetSource_FromAI(), spawnVector + Vector2.Normalize(perturbedSpeed) * 100f, perturbedSpeed, type, damage, 0f, Main.myPlayer);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
calamityGlobalNPC.newAI[2] = 0f;
|
||||
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
{
|
||||
float laserVelocity = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 7f : death ? 6f : 5f;
|
||||
int maxProjectiles = !phase3 ? (bossRush ? 13 : death ? 11 : 9) : (bossRush ? 17 : death ? 15 : 13);
|
||||
int spread = !phase3 ? (bossRush ? 20 : death ? 18 : 16) : (bossRush ? 24 : death ? 22 : 20);
|
||||
|
||||
int type = ModContent.ProjectileType<AstralLaser>();
|
||||
int damage = NPC.GetProjectileDamage(type);
|
||||
int[] lasersToNotFire = new int[4] { 1, 3, maxProjectiles - 2, maxProjectiles - 4 };
|
||||
Vector2 projectileVelocity = Vector2.Normalize(player.Center - NPC.Center) * laserVelocity;
|
||||
float rotation = MathHelper.ToRadians(spread);
|
||||
for (int i = 0; i < maxProjectiles; i++)
|
||||
{
|
||||
if (i != lasersToNotFire[0] && i != lasersToNotFire[1] && i != lasersToNotFire[2] && i != lasersToNotFire[3])
|
||||
{
|
||||
Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(maxProjectiles - 1)));
|
||||
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, perturbedSpeed, type, damage, 0f, Main.myPlayer, 0f, laserVelocity * 2f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Set damage
|
||||
NPC.damage = NPC.defDamage;
|
||||
|
||||
// Set velocities while falling, this happens before the stomp
|
||||
// Fall through
|
||||
if (!player.dead)
|
||||
{
|
||||
if ((player.position.Y > NPC.Bottom.Y && NPC.velocity.Y > 0f) || (player.position.Y < NPC.Bottom.Y && NPC.velocity.Y < 0f))
|
||||
NPC.noTileCollide = true;
|
||||
else if ((NPC.velocity.Y > 0f && NPC.Bottom.Y > Main.player[NPC.target].Top.Y) || (Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[NPC.target].Center, 1, 1) && !Collision.SolidCollision(NPC.position, NPC.width, NPC.height)))
|
||||
NPC.noTileCollide = false;
|
||||
}
|
||||
|
||||
if (NPC.position.X < player.position.X && NPC.position.X + NPC.width > player.position.X + player.width)
|
||||
{
|
||||
// Make sure Aureus falls quickly when directly on top of or below the player
|
||||
if (NPC.ai[3] < 30f)
|
||||
NPC.ai[3] = 30f;
|
||||
|
||||
NPC.velocity.X *= 0.8f;
|
||||
|
||||
if (NPC.Bottom.Y < player.position.Y)
|
||||
{
|
||||
// Make sure Aureus falls rather quickly
|
||||
if (NPC.velocity.Y < -3f)
|
||||
NPC.velocity.Y = -3f;
|
||||
|
||||
float fallSpeed = 1.2f;
|
||||
fallSpeed += 0.36f * enrageScale;
|
||||
if (expertMode)
|
||||
fallSpeed += death ? 0.36f * (1f - lifeRatio) : 0.24f * (1f - lifeRatio);
|
||||
if (CalamityWorld.LegendaryMode && CalamityWorld.revenge)
|
||||
fallSpeed += 0.5f;
|
||||
|
||||
if (calamityGlobalNPC.newAI[1] > 0f)
|
||||
fallSpeed *= calamityGlobalNPC.newAI[1] + 1f;
|
||||
|
||||
NPC.velocity.Y += fallSpeed;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Push Aureus towards the player on the X axis if he's not directly on top of or below the player
|
||||
float velocityXChange = 0.2f + Math.Abs(NPC.Center.X - player.Center.X) * 0.0001f;
|
||||
velocityXChange += 0.1f * enrageScale;
|
||||
|
||||
if (calamityGlobalNPC.newAI[0] > 0f)
|
||||
velocityXChange *= calamityGlobalNPC.newAI[0] + 1f;
|
||||
|
||||
if (NPC.direction < 0)
|
||||
NPC.velocity.X -= velocityXChange;
|
||||
else if (NPC.direction > 0)
|
||||
NPC.velocity.X += velocityXChange;
|
||||
|
||||
float velocityXCap = 12f;
|
||||
velocityXCap += 3.6f * enrageScale;
|
||||
if (expertMode)
|
||||
velocityXCap += death ? 3.6f * (1f - lifeRatio) : 2.4f * (1f - lifeRatio);
|
||||
if (CalamityWorld.LegendaryMode && CalamityWorld.revenge)
|
||||
velocityXCap += 5f;
|
||||
|
||||
if (calamityGlobalNPC.newAI[0] > 0f)
|
||||
velocityXCap *= calamityGlobalNPC.newAI[0] + 1f;
|
||||
|
||||
float playerLocation = NPC.Center.X - player.Center.X;
|
||||
int directionRelativeToTarget = playerLocation < 0 ? 1 : -1;
|
||||
bool slowDown = directionRelativeToTarget != calamityGlobalNPC.newAI[3];
|
||||
|
||||
if (slowDown)
|
||||
velocityXCap *= 0.333f;
|
||||
|
||||
if (NPC.velocity.X < -velocityXCap)
|
||||
NPC.velocity.X = -velocityXCap;
|
||||
if (NPC.velocity.X > velocityXCap)
|
||||
NPC.velocity.X = velocityXCap;
|
||||
}
|
||||
|
||||
// Don't start falling quickly until half a second has passed
|
||||
NPC.ai[3] += 1f;
|
||||
if (NPC.ai[3] > 30f)
|
||||
CustomGravity();
|
||||
}
|
||||
}
|
||||
|
||||
// Teleport
|
||||
else if (NPC.ai[0] == 5f)
|
||||
{
|
||||
// Avoid cheap bullshit
|
||||
NPC.damage = 0;
|
||||
|
||||
// Slow down
|
||||
NPC.velocity.X *= 0.8f;
|
||||
|
||||
// Start teleport
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
{
|
||||
NPC.localAI[1] += 1f;
|
||||
if (death)
|
||||
NPC.localAI[2] += 1.25f;
|
||||
|
||||
if (phase4)
|
||||
{
|
||||
NPC.localAI[1] += 1f;
|
||||
if (death)
|
||||
NPC.localAI[2] += 1.25f;
|
||||
}
|
||||
|
||||
if (NPC.localAI[1] >= (bossRush ? 60f : death ? 180f : 240f))
|
||||
{
|
||||
// Reset localAI and find a teleport destination
|
||||
NPC.TargetClosest();
|
||||
NPC.localAI[1] = 0f;
|
||||
|
||||
Vector2 vectorAimedAheadOfTarget = Main.player[NPC.target].Center + new Vector2((float)Math.Round(Main.player[NPC.target].velocity.X), 0f).SafeNormalize(Vector2.Zero) * 1000f;
|
||||
Point point4 = vectorAimedAheadOfTarget.ToTileCoordinates();
|
||||
int teleportTries = 0;
|
||||
while (teleportTries < 100)
|
||||
{
|
||||
teleportTries++;
|
||||
int teleportTileX = Main.rand.Next(point4.X - 5, point4.X + 6);
|
||||
int teleportTileY = Main.rand.Next(point4.Y - 5, point4.Y);
|
||||
|
||||
if (!Main.tile[teleportTileX, teleportTileY].HasUnactuatedTile)
|
||||
{
|
||||
NPC.ai[1] = teleportTileX * 16 + 8;
|
||||
NPC.ai[3] = teleportTileY * 16 + 16;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Default teleport if the above conditions aren't met in 100 iterations
|
||||
if (teleportTries >= 100)
|
||||
{
|
||||
Vector2 bottom = Main.player[Player.FindClosest(NPC.position, NPC.width, NPC.height)].Bottom;
|
||||
NPC.ai[1] = bottom.X;
|
||||
NPC.ai[3] = bottom.Y;
|
||||
}
|
||||
|
||||
// Set AI to next phase (Mid-teleport)
|
||||
NPC.ai[0] = 6f;
|
||||
NPC.netUpdate = true;
|
||||
}
|
||||
}
|
||||
|
||||
CustomGravity();
|
||||
}
|
||||
|
||||
// Mid-teleport
|
||||
else if (NPC.ai[0] == 6f)
|
||||
{
|
||||
// Avoid cheap bullshit
|
||||
NPC.damage = 0;
|
||||
|
||||
if (death)
|
||||
NPC.localAI[2] += 1.25f;
|
||||
|
||||
if (phase4)
|
||||
{
|
||||
if (death)
|
||||
NPC.localAI[2] += 1.25f;
|
||||
}
|
||||
|
||||
// Turn invisible
|
||||
NPC.alpha += 10;
|
||||
if (NPC.alpha >= 255)
|
||||
{
|
||||
// Set position to teleport destination
|
||||
NPC.Bottom = new Vector2(NPC.ai[1], NPC.ai[3]);
|
||||
|
||||
// Reset alpha and set AI to next phase (End of teleport)
|
||||
NPC.alpha = 255;
|
||||
NPC.ai[0] = 7f;
|
||||
NPC.localAI[2] = 0f;
|
||||
NPC.netUpdate = true;
|
||||
}
|
||||
|
||||
// Play sound for cool effect
|
||||
if (NPC.soundDelay == 0)
|
||||
{
|
||||
NPC.soundDelay = 15;
|
||||
SoundEngine.PlaySound(TeleportSound, NPC.Center);
|
||||
}
|
||||
|
||||
// Emit dust to make the teleport pretty
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
int teleportDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, ModContent.DustType<AstralOrange>(), NPC.velocity.X, NPC.velocity.Y, 255, default, 2f);
|
||||
Main.dust[teleportDust].noGravity = true;
|
||||
Main.dust[teleportDust].velocity *= 0.5f;
|
||||
}
|
||||
|
||||
CustomGravity();
|
||||
}
|
||||
|
||||
// End of teleport
|
||||
else if (NPC.ai[0] == 7f)
|
||||
{
|
||||
// Avoid cheap bullshit
|
||||
NPC.damage = 0;
|
||||
|
||||
// Turn visible
|
||||
NPC.alpha -= 10;
|
||||
if (NPC.alpha <= 0)
|
||||
{
|
||||
// Spawn Aureus Spawns
|
||||
bool spawnFlag = expertMode;
|
||||
if (NPC.CountNPCS(ModContent.NPCType<AureusSpawn>()) >= 2)
|
||||
spawnFlag = false;
|
||||
|
||||
if (spawnFlag && Main.netMode != NetmodeID.MultiplayerClient)
|
||||
{
|
||||
int aureusSpawn = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)(NPC.Center.Y - 25f * NPC.scale), ModContent.NPCType<AureusSpawn>());
|
||||
Main.npc[aureusSpawn].velocity.Y = -10f;
|
||||
Main.npc[aureusSpawn].netUpdate = true;
|
||||
if (revenge)
|
||||
{
|
||||
aureusSpawn = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)(NPC.Center.Y - 25f * NPC.scale), ModContent.NPCType<AureusSpawn>());
|
||||
Main.npc[aureusSpawn].velocity.Y = -15f;
|
||||
Main.npc[aureusSpawn].netUpdate = true;
|
||||
}
|
||||
|
||||
if (death)
|
||||
{
|
||||
int damageAmt = NPC.lifeMax / 50;
|
||||
NPC.life -= damageAmt;
|
||||
if (NPC.life < 1)
|
||||
NPC.life = 1;
|
||||
|
||||
NPC.DamageEffect(damageAmt);
|
||||
}
|
||||
}
|
||||
|
||||
// Reset alpha and set AI to next phase (Idle)
|
||||
NPC.alpha = 0;
|
||||
NPC.ai[0] = exhausted ? 1f : 2f;
|
||||
NPC.ai[1] = 0f;
|
||||
NPC.ai[2] += 1f;
|
||||
NPC.localAI[3] = noProjectileOrPhaseIncrementTime;
|
||||
|
||||
// Stop colliding with tiles if entering walking phase
|
||||
NPC.noTileCollide = NPC.ai[0] == 2f;
|
||||
|
||||
NPC.netUpdate = true;
|
||||
}
|
||||
|
||||
// Play sound at teleport destination for cool effect
|
||||
if (NPC.soundDelay == 0)
|
||||
{
|
||||
NPC.soundDelay = 15;
|
||||
SoundEngine.PlaySound(SoundID.Item109, NPC.Center);
|
||||
}
|
||||
|
||||
// Emit dust to make the teleport pretty
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
int teleportDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, ModContent.DustType<AstralOrange>(), NPC.velocity.X, NPC.velocity.Y, 255, default, 2f);
|
||||
Main.dust[teleportDust].noGravity = true;
|
||||
Main.dust[teleportDust].velocity *= 0.5f;
|
||||
}
|
||||
|
||||
CustomGravity();
|
||||
}
|
||||
|
||||
void CustomGravity()
|
||||
{
|
||||
float gravity = 0.36f + 0.12f * enrageScale;
|
||||
float maxFallSpeed = reduceFallSpeed ? 12f : 12f + 4f * enrageScale;
|
||||
|
||||
if (calamityGlobalNPC.newAI[1] > 0f && !reduceFallSpeed)
|
||||
maxFallSpeed *= calamityGlobalNPC.newAI[1] + 1f;
|
||||
|
||||
if (CalamityWorld.LegendaryMode && !reduceFallSpeed)
|
||||
{
|
||||
gravity *= 1.15f;
|
||||
maxFallSpeed *= 1.15f;
|
||||
}
|
||||
|
||||
NPC.velocity.Y += gravity;
|
||||
if (NPC.velocity.Y > maxFallSpeed)
|
||||
NPC.velocity.Y = maxFallSpeed;
|
||||
}
|
||||
}
|
||||
|
||||
public override void FindFrame(int frameHeight)
|
||||
|
||||
@@ -308,11 +308,11 @@ namespace CalamityMod.NPCs.AstrumAureus
|
||||
{
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
{
|
||||
int totalProjectiles = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 36 : (3 + (int)((NPC.scale - 1f) * 3));
|
||||
int totalProjectiles = CalamityWorld.LegendaryMode ? 36 : (3 + (int)((NPC.scale - 1f) * 3));
|
||||
double radians = MathHelper.TwoPi / totalProjectiles;
|
||||
int type = ModContent.ProjectileType<AstralLaser>();
|
||||
int damage2 = NPC.GetProjectileDamage(type);
|
||||
float velocity = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 10f : 6f;
|
||||
float velocity = CalamityWorld.LegendaryMode ? 10f : 6f;
|
||||
double angleA = radians * 0.5;
|
||||
double angleB = MathHelper.ToRadians(90f) - angleA;
|
||||
float velocityX = (float)(velocity * Math.Sin(angleA) / Math.Sin(angleB));
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
using System.IO;
|
||||
using System;
|
||||
using System.IO;
|
||||
using CalamityMod.Buffs.DamageOverTime;
|
||||
using CalamityMod.Buffs.StatDebuffs;
|
||||
using CalamityMod.Dusts;
|
||||
using CalamityMod.Events;
|
||||
using CalamityMod.NPCs.CalamityAIs.CalamityBossAIs;
|
||||
using CalamityMod.Projectiles.Boss;
|
||||
using CalamityMod.World;
|
||||
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.Localization;
|
||||
@@ -112,7 +115,331 @@ namespace CalamityMod.NPCs.AstrumDeus
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
AstrumDeusAI.VanillaAstrumDeusAI(NPC, Mod, false);
|
||||
CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity();
|
||||
|
||||
// Difficulty variables
|
||||
bool bossRush = BossRushEvent.BossRushActive;
|
||||
bool expertMode = Main.expertMode || bossRush;
|
||||
bool revenge = CalamityWorld.revenge || bossRush;
|
||||
bool death = CalamityWorld.death || bossRush;
|
||||
|
||||
float enrageScale = bossRush ? 0.5f : 0f;
|
||||
if (Main.IsItDay() || bossRush)
|
||||
{
|
||||
NPC.Calamity().CurrentlyEnraged = !bossRush;
|
||||
enrageScale += 1.5f;
|
||||
}
|
||||
|
||||
// Deus cannot hit for 3 seconds or while invulnerable
|
||||
bool doNotDealDamage = calamityGlobalNPC.newAI[1] < 180f || NPC.dontTakeDamage;
|
||||
if (doNotDealDamage)
|
||||
NPC.damage = 0;
|
||||
|
||||
// Get a target
|
||||
if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active)
|
||||
NPC.TargetClosest();
|
||||
|
||||
Player player = Main.player[NPC.target];
|
||||
|
||||
bool increaseSpeed = Vector2.Distance(player.Center, NPC.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles;
|
||||
bool increaseSpeedMore = Vector2.Distance(player.Center, NPC.Center) > CalamityGlobalNPC.CatchUpDistance350Tiles;
|
||||
|
||||
// Inflict Extreme Gravity to nearby players
|
||||
if (revenge)
|
||||
{
|
||||
if (!Main.dedServ)
|
||||
{
|
||||
if (!Main.LocalPlayer.dead && Main.LocalPlayer.active && Vector2.Distance(Main.LocalPlayer.Center, NPC.Center) < CalamityGlobalNPC.CatchUpDistance350Tiles)
|
||||
Main.LocalPlayer.AddBuff(ModContent.BuffType<DoGExtremeGravity>(), 2);
|
||||
}
|
||||
}
|
||||
|
||||
// Life
|
||||
float lifeRatio = NPC.life / (float)NPC.lifeMax;
|
||||
|
||||
// Phases based on life percentage
|
||||
bool halfHealth = lifeRatio < 0.5f;
|
||||
bool doubleWormPhase = calamityGlobalNPC.newAI[0] != 0f;
|
||||
bool startFlightPhase = lifeRatio < 0.8f || death || doubleWormPhase;
|
||||
bool phase2 = lifeRatio < 0.5f && doubleWormPhase && expertMode;
|
||||
bool phase3 = lifeRatio < 0.2f && doubleWormPhase && expertMode;
|
||||
bool splittingMines = lifeRatio < 0.7f;
|
||||
bool movingMines = lifeRatio < 0.3f && doubleWormPhase && expertMode;
|
||||
bool deathModeEnragePhase_Head = calamityGlobalNPC.newAI[0] == 3f;
|
||||
bool deathModeEnragePhase_BodyAndTail = false;
|
||||
|
||||
// 5 seconds of resistance in phase 2, 10 seconds in phase 1, to prevent spawn killing
|
||||
float resistanceTime = doubleWormPhase ? 300f : 600f;
|
||||
|
||||
calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = calamityGlobalNPC.newAI[1] < resistanceTime;
|
||||
|
||||
// Flight timer
|
||||
float aiSwitchTimer = doubleWormPhase ? (CalamityWorld.LegendaryMode ? 600f : 1200f) : (CalamityWorld.LegendaryMode ? 900f : 1800f);
|
||||
|
||||
calamityGlobalNPC.newAI[3] += 1f;
|
||||
if (calamityGlobalNPC.newAI[3] >= aiSwitchTimer)
|
||||
calamityGlobalNPC.newAI[3] = 0f;
|
||||
// Sound effect for swapping between attack behaviors in phase 2
|
||||
if (doubleWormPhase && calamityGlobalNPC.newAI[3] % aiSwitchTimer == 0f && !(deathModeEnragePhase_Head || deathModeEnragePhase_BodyAndTail))
|
||||
SoundEngine.PlaySound(AstrumDeusHead.SplitSound with { Pitch = -0.2f, Volume = 0.9f }, player.Center);
|
||||
|
||||
// Phase for flying at the player
|
||||
bool flyAtTarget = calamityGlobalNPC.newAI[3] >= (aiSwitchTimer * 0.5f) && startFlightPhase;
|
||||
|
||||
// Length of worms
|
||||
int phase1Length = death ? 80 : revenge ? 70 : expertMode ? 60 : 50;
|
||||
int phase2Length = death ? 40 : revenge ? 35 : expertMode ? 30 : 25;
|
||||
int gfbLength = death ? 8 : revenge ? 7 : expertMode ? 6 : 5;
|
||||
int maxLength = Main.zenithWorld && doubleWormPhase ? gfbLength : doubleWormPhase ? phase2Length : phase1Length;
|
||||
|
||||
// Become gradually more pissed as more worms are killed
|
||||
int gfbMaxWormCount = 10;
|
||||
int gfbWormCount = 0;
|
||||
if (CalamityWorld.LegendaryMode && revenge)
|
||||
gfbWormCount = NPC.CountNPCS(ModContent.NPCType<AstrumDeusHead>());
|
||||
if (gfbWormCount > gfbMaxWormCount)
|
||||
gfbWormCount = gfbMaxWormCount;
|
||||
if (gfbWormCount > 0)
|
||||
enrageScale += (gfbMaxWormCount - gfbWormCount) * 0.111f;
|
||||
|
||||
// Copy dontTakeDamage and Opacity from head
|
||||
NPC.dontTakeDamage = Main.npc[(int)NPC.ai[2]].dontTakeDamage;
|
||||
NPC.Opacity = Main.npc[(int)NPC.ai[2]].Opacity;
|
||||
deathModeEnragePhase_BodyAndTail = Main.npc[(int)NPC.ai[2]].Calamity().newAI[0] == 3f;
|
||||
if (deathModeEnragePhase_BodyAndTail)
|
||||
{
|
||||
NPC.defense = 25;
|
||||
calamityGlobalNPC.DR = 0.15f;
|
||||
}
|
||||
|
||||
// Set worm variable
|
||||
if (NPC.ai[2] > 0f)
|
||||
NPC.realLife = (int)NPC.ai[2];
|
||||
|
||||
// Alpha effects
|
||||
if (Main.npc[(int)NPC.ai[1]].alpha < 128 && !NPC.dontTakeDamage)
|
||||
{
|
||||
NPC.alpha -= 42;
|
||||
if (NPC.alpha < 0)
|
||||
NPC.alpha = 0;
|
||||
}
|
||||
|
||||
// Check if other segments are still alive, if not, die
|
||||
bool shouldDespawn = true;
|
||||
int headType = ModContent.NPCType<AstrumDeusHead>();
|
||||
for (int i = 0; i < Main.maxNPCs; i++)
|
||||
{
|
||||
if (Main.npc[i].type != headType || !Main.npc[i].active)
|
||||
continue;
|
||||
shouldDespawn = false;
|
||||
break;
|
||||
}
|
||||
if (shouldDespawn)
|
||||
{
|
||||
if (Main.npc.IndexInRange((int)NPC.ai[1]) && Main.npc[(int)NPC.ai[1]].active && Main.npc[(int)NPC.ai[1]].life > 0)
|
||||
shouldDespawn = false;
|
||||
}
|
||||
if (shouldDespawn)
|
||||
{
|
||||
NPC.life = 0;
|
||||
NPC.HitEffect(0, 10.0);
|
||||
NPC.checkDead();
|
||||
NPC.active = false;
|
||||
NPC.ForceNetUpdate(false);
|
||||
}
|
||||
|
||||
// Direction
|
||||
if (NPC.velocity.X < 0f)
|
||||
NPC.spriteDirection = -1;
|
||||
else if (NPC.velocity.X > 0f)
|
||||
NPC.spriteDirection = 1;
|
||||
|
||||
if (NPC.life > Main.npc[(int)NPC.ai[1]].life)
|
||||
NPC.life = Main.npc[(int)NPC.ai[1]].life;
|
||||
|
||||
bool hasJustSpawned = calamityGlobalNPC.newAI[1] < resistanceTime * 0.4f && !doubleWormPhase; // Speed boost for the first 4 seconds after spawning
|
||||
float segmentVelocity = hasJustSpawned ? 25f : deathModeEnragePhase_Head ? 19f : death ? 17.5f : 16f;
|
||||
|
||||
float segmentVelocityBoost = 5f * (1f - lifeRatio);
|
||||
segmentVelocity += segmentVelocityBoost;
|
||||
segmentVelocity += 4f * enrageScale;
|
||||
|
||||
if (revenge)
|
||||
{
|
||||
float revMultiplier = 1.1f;
|
||||
segmentVelocity *= revMultiplier;
|
||||
}
|
||||
|
||||
// Shoot lasers
|
||||
NPC.localAI[0] += 1f;
|
||||
|
||||
int shootTime = (doubleWormPhase && expertMode) ? 2 : 1;
|
||||
float shootProjectile = (doubleWormPhase && expertMode) ? 200 : 400;
|
||||
float timer = NPC.ai[0] + 15f;
|
||||
float divisor = timer + shootProjectile;
|
||||
bool canFireProjectiles = NPC.Opacity >= 1f;
|
||||
bool shootGodRays = phase2 || deathModeEnragePhase_BodyAndTail;
|
||||
|
||||
if (canFireProjectiles)
|
||||
{
|
||||
if (!flyAtTarget || deathModeEnragePhase_BodyAndTail)
|
||||
{
|
||||
float laserDivisor = (phase2 && !deathModeEnragePhase_BodyAndTail) ? 4f : 2f;
|
||||
if (NPC.localAI[0] % divisor == 0f && NPC.ai[0] % laserDivisor == 0f)
|
||||
{
|
||||
NPC.TargetClosest();
|
||||
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
{
|
||||
if (deathModeEnragePhase_BodyAndTail)
|
||||
{
|
||||
Vector2 velocity = Vector2.Zero;
|
||||
if (movingMines)
|
||||
{
|
||||
Vector2 randomMineMovement = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101));
|
||||
randomMineMovement.Normalize();
|
||||
randomMineMovement *= Main.rand.Next(90, 121) * 0.01f;
|
||||
velocity = randomMineMovement;
|
||||
}
|
||||
|
||||
int type = ModContent.ProjectileType<DeusMine>();
|
||||
int damage = NPC.GetProjectileDamage(type);
|
||||
float split = (splittingMines && NPC.ai[0] % 3f == 0f) ? 1f : 0f;
|
||||
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, velocity, type, damage, 0f, Main.myPlayer, split, 0f);
|
||||
}
|
||||
}
|
||||
|
||||
if (Vector2.Distance(player.Center, NPC.Center) > 80f)
|
||||
{
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
{
|
||||
float deusLaserSpeed = (death ? 16f : revenge ? 14f : 13f) + enrageScale * 4f;
|
||||
|
||||
Vector2 deusLaserCenter = NPC.Center;
|
||||
float deusLaserTargetX = player.Center.X - deusLaserCenter.X;
|
||||
float deusLaserTargetY = player.Center.Y - deusLaserCenter.Y;
|
||||
float deusLaserTargetDist = (float)Math.Sqrt(deusLaserTargetX * deusLaserTargetX + deusLaserTargetY * deusLaserTargetY);
|
||||
deusLaserTargetDist = deusLaserSpeed / deusLaserTargetDist;
|
||||
deusLaserTargetX *= deusLaserTargetDist;
|
||||
deusLaserTargetY *= deusLaserTargetDist;
|
||||
deusLaserCenter.X += deusLaserTargetX * 5f;
|
||||
deusLaserCenter.Y += deusLaserTargetY * 5f;
|
||||
|
||||
Vector2 shootDirection = new Vector2(deusLaserTargetX, deusLaserTargetY).SafeNormalize(Vector2.UnitY);
|
||||
Vector2 laserVelocity = shootDirection * deusLaserSpeed;
|
||||
|
||||
int type = shootGodRays ? ModContent.ProjectileType<AstralGodRay>() : ModContent.ProjectileType<AstralShot2>();
|
||||
int damage = NPC.GetProjectileDamage(type);
|
||||
if (shootGodRays)
|
||||
{
|
||||
SoundEngine.PlaySound(AstrumDeusHead.GodRaySound, NPC.Center);
|
||||
// Waving beams need to start offset so they cross each other neatly.
|
||||
float waveSideOffset = Main.rand.NextFloat(9f, 14f);
|
||||
Vector2 perp = shootDirection.RotatedBy(-MathHelper.PiOver2) * waveSideOffset;
|
||||
|
||||
for (int i = -1; i <= 1; i += 2)
|
||||
{
|
||||
Vector2 laserStartPos = deusLaserCenter + i * perp + Main.rand.NextVector2CircularEdge(6f, 6f);
|
||||
Projectile godRay = Projectile.NewProjectileDirect(NPC.GetSource_FromAI(), laserStartPos, laserVelocity, type, damage, 0f, Main.myPlayer, player.Center.X, player.Center.Y);
|
||||
|
||||
// Tell this Phased God Ray exactly which way it should be waving.
|
||||
godRay.localAI[1] = i * 0.5f;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SoundEngine.PlaySound(AstrumDeusHead.LaserSound, NPC.Center);
|
||||
Projectile.NewProjectile(NPC.GetSource_FromAI(), deusLaserCenter, laserVelocity, type, damage, 0f, Main.myPlayer, player.Center.X, player.Center.Y);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (NPC.localAI[0] % divisor == 0f && NPC.ai[0] % 2f == 0f)
|
||||
{
|
||||
Vector2 velocity = Vector2.Zero;
|
||||
if (movingMines)
|
||||
{
|
||||
Vector2 randomMineMovement = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101));
|
||||
randomMineMovement.Normalize();
|
||||
randomMineMovement *= Main.rand.Next(30, 121) * 0.01f;
|
||||
velocity = randomMineMovement;
|
||||
}
|
||||
|
||||
int type = ModContent.ProjectileType<DeusMine>();
|
||||
int damage = NPC.GetProjectileDamage(type);
|
||||
float split = (splittingMines && NPC.ai[0] % 3f == 0f) ? 1f : 0f;
|
||||
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, velocity, type, damage, 0f, Main.myPlayer, split, 0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Follow the head
|
||||
Vector2 segmentCenter = NPC.Center;
|
||||
float segmentTargetX = player.Center.X;
|
||||
float segmentTargetY = player.Center.Y;
|
||||
segmentTargetX = (int)(segmentTargetX / 16f) * 16;
|
||||
segmentTargetY = (int)(segmentTargetY / 16f) * 16;
|
||||
segmentCenter.X = (int)(segmentCenter.X / 16f) * 16;
|
||||
segmentCenter.Y = (int)(segmentCenter.Y / 16f) * 16;
|
||||
segmentTargetX -= segmentCenter.X;
|
||||
segmentTargetY -= segmentCenter.Y;
|
||||
|
||||
if (NPC.ai[1] > 0f && NPC.ai[1] < Main.npc.Length)
|
||||
{
|
||||
try
|
||||
{
|
||||
segmentCenter = NPC.Center;
|
||||
segmentTargetX = Main.npc[(int)NPC.ai[1]].Center.X - segmentCenter.X;
|
||||
segmentTargetY = Main.npc[(int)NPC.ai[1]].Center.Y - segmentCenter.Y;
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
|
||||
NPC.rotation = (float)Math.Atan2(segmentTargetY, segmentTargetX) + MathHelper.PiOver2;
|
||||
float segmentTargetDist = (float)Math.Sqrt(segmentTargetX * segmentTargetX + segmentTargetY * segmentTargetY);
|
||||
int segmentWidth = NPC.width;
|
||||
segmentTargetDist = (segmentTargetDist - segmentWidth) / segmentTargetDist;
|
||||
segmentTargetX *= segmentTargetDist;
|
||||
segmentTargetY *= segmentTargetDist;
|
||||
NPC.velocity = Vector2.Zero;
|
||||
NPC.position.X = NPC.position.X + segmentTargetX;
|
||||
NPC.position.Y = NPC.position.Y + segmentTargetY;
|
||||
|
||||
if (segmentTargetX < 0f)
|
||||
NPC.spriteDirection = -1;
|
||||
else if (segmentTargetX > 0f)
|
||||
NPC.spriteDirection = 1;
|
||||
}
|
||||
|
||||
// Play spawn sound on Deus on the first frame because otherwise the sound wouldn't play properly in multiplayer
|
||||
if (calamityGlobalNPC.newAI[1] == 0f && !doubleWormPhase)
|
||||
{
|
||||
SoundEngine.PlaySound(AstrumDeusHead.SpawnSound, NPC.Center);
|
||||
calamityGlobalNPC.newAI[1] = 1f;
|
||||
}
|
||||
|
||||
// 5 seconds of resistance in phase 2, 10 seconds in phase 1, to prevent spawn killing
|
||||
if (calamityGlobalNPC.newAI[1] < resistanceTime && ((NPC.position - NPC.oldPosition).Length() > 2f || calamityGlobalNPC.newAI[1] > 1f))
|
||||
calamityGlobalNPC.newAI[1] += 1f;
|
||||
|
||||
// Calculate contact damage based on velocity
|
||||
if (!doNotDealDamage)
|
||||
{
|
||||
float minimalContactDamageVelocity = segmentVelocity * 0.25f;
|
||||
float minimalDamageVelocity = segmentVelocity * 0.5f;
|
||||
float bodyAndTailVelocity = (NPC.position - NPC.oldPosition).Length();
|
||||
if (bodyAndTailVelocity <= minimalContactDamageVelocity)
|
||||
NPC.damage = 0;
|
||||
else
|
||||
{
|
||||
float velocityDamageScalar = MathHelper.Clamp((bodyAndTailVelocity - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f);
|
||||
NPC.damage = (int)MathHelper.Lerp(0f, NPC.defDamage, velocityDamageScalar);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor)
|
||||
@@ -130,7 +457,7 @@ namespace CalamityMod.NPCs.AstrumDeus
|
||||
|
||||
// Need segment amount to get a smooth transition down the worm based on length
|
||||
int segmentAmt = Main.zenithWorld ? (CalamityWorld.death ? 8 : CalamityWorld.revenge ? 7 : Main.expertMode ? 6 : 5) : (CalamityWorld.death ? 40 : CalamityWorld.revenge ? 35 : Main.expertMode ? 30 : 25);
|
||||
float cyanThreshold = Main.getGoodWorld ? 300f : 600f;
|
||||
float cyanThreshold = CalamityWorld.LegendaryMode ? 300f : 600f;
|
||||
float transitionStart = MathHelper.Lerp(cyanThreshold * 0.75f, cyanThreshold * 0.95f, 1f - (NPC.ai[3] / (float)segmentAmt));
|
||||
float transitionEnd = MathHelper.Lerp(cyanThreshold * 0.8f, cyanThreshold, 1f - (NPC.ai[3] / (float)segmentAmt));
|
||||
bool drawCyan = NPC.Calamity().newAI[3] >= transitionEnd && NPC.Calamity().newAI[3] <= cyanThreshold + transitionEnd;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.IO;
|
||||
using CalamityMod.BiomeManagers;
|
||||
using System;
|
||||
using System.IO;
|
||||
using CalamityMod.Buffs.DamageOverTime;
|
||||
using CalamityMod.Buffs.StatDebuffs;
|
||||
using CalamityMod.Dusts;
|
||||
using CalamityMod.Events;
|
||||
using CalamityMod.Items.Accessories;
|
||||
@@ -17,8 +18,7 @@ using CalamityMod.Items.Weapons.Melee;
|
||||
using CalamityMod.Items.Weapons.Ranged;
|
||||
using CalamityMod.Items.Weapons.Rogue;
|
||||
using CalamityMod.Items.Weapons.Summon;
|
||||
using CalamityMod.NPCs.Abyss;
|
||||
using CalamityMod.NPCs.CalamityAIs.CalamityBossAIs;
|
||||
using CalamityMod.Packets;
|
||||
using CalamityMod.UI.VanillaBossBars;
|
||||
using CalamityMod.World;
|
||||
using Microsoft.Xna.Framework;
|
||||
@@ -149,7 +149,652 @@ namespace CalamityMod.NPCs.AstrumDeus
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
AstrumDeusAI.VanillaAstrumDeusAI(NPC, Mod, true);
|
||||
CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity();
|
||||
|
||||
// Difficulty variables
|
||||
bool bossRush = BossRushEvent.BossRushActive;
|
||||
bool expertMode = Main.expertMode || bossRush;
|
||||
bool revenge = CalamityWorld.revenge || bossRush;
|
||||
bool death = CalamityWorld.death || bossRush;
|
||||
|
||||
float enrageScale = bossRush ? 0.5f : 0f;
|
||||
if (Main.IsItDay() || bossRush)
|
||||
{
|
||||
NPC.Calamity().CurrentlyEnraged = !bossRush;
|
||||
enrageScale += 1.5f;
|
||||
}
|
||||
|
||||
// Deus cannot hit for 3 seconds or while invulnerable
|
||||
bool doNotDealDamage = calamityGlobalNPC.newAI[1] < 180f || NPC.dontTakeDamage;
|
||||
if (doNotDealDamage)
|
||||
NPC.damage = 0;
|
||||
|
||||
// Get a target
|
||||
if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active)
|
||||
NPC.TargetClosest();
|
||||
|
||||
Player player = Main.player[NPC.target];
|
||||
|
||||
bool increaseSpeed = Vector2.Distance(player.Center, NPC.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles;
|
||||
bool increaseSpeedMore = Vector2.Distance(player.Center, NPC.Center) > CalamityGlobalNPC.CatchUpDistance350Tiles;
|
||||
|
||||
// Despawn safety, make sure to target another player if the current player target is too far away
|
||||
if (increaseSpeedMore)
|
||||
NPC.TargetClosest();
|
||||
|
||||
// Inflict Extreme Gravity to nearby players
|
||||
if (revenge)
|
||||
{
|
||||
if (!Main.dedServ)
|
||||
{
|
||||
if (!Main.LocalPlayer.dead && Main.LocalPlayer.active && Vector2.Distance(Main.LocalPlayer.Center, NPC.Center) < CalamityGlobalNPC.CatchUpDistance350Tiles)
|
||||
Main.LocalPlayer.AddBuff(ModContent.BuffType<DoGExtremeGravity>(), 2);
|
||||
}
|
||||
}
|
||||
|
||||
// Life
|
||||
float lifeRatio = NPC.life / (float)NPC.lifeMax;
|
||||
|
||||
// Phases based on life percentage
|
||||
bool halfHealth = lifeRatio < 0.5f;
|
||||
bool doubleWormPhase = calamityGlobalNPC.newAI[0] != 0f;
|
||||
bool startFlightPhase = lifeRatio < 0.8f || death || doubleWormPhase;
|
||||
bool phase2 = lifeRatio < 0.5f && doubleWormPhase && expertMode;
|
||||
bool phase3 = lifeRatio < 0.2f && doubleWormPhase && expertMode;
|
||||
bool splittingMines = lifeRatio < 0.7f;
|
||||
bool movingMines = lifeRatio < 0.3f && doubleWormPhase && expertMode;
|
||||
bool deathModeEnragePhase_Head = calamityGlobalNPC.newAI[0] == 3f;
|
||||
bool deathModeEnragePhase_BodyAndTail = false;
|
||||
|
||||
// 5 seconds of resistance in phase 2, 10 seconds in phase 1, to prevent spawn killing
|
||||
float resistanceTime = doubleWormPhase ? 300f : 600f;
|
||||
|
||||
calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = calamityGlobalNPC.newAI[1] < resistanceTime;
|
||||
|
||||
// Flight timer
|
||||
float aiSwitchTimer = doubleWormPhase ? (CalamityWorld.LegendaryMode ? 600f : 1200f) : (CalamityWorld.LegendaryMode ? 900f : 1800f);
|
||||
|
||||
calamityGlobalNPC.newAI[3] += 1f;
|
||||
if (calamityGlobalNPC.newAI[3] >= aiSwitchTimer)
|
||||
calamityGlobalNPC.newAI[3] = 0f;
|
||||
// Sound effect for swapping between attack behaviors in phase 2
|
||||
if (doubleWormPhase && calamityGlobalNPC.newAI[3] % aiSwitchTimer == 0f && !(deathModeEnragePhase_Head || deathModeEnragePhase_BodyAndTail))
|
||||
SoundEngine.PlaySound(SplitSound with { Pitch = -0.2f, Volume = 0.9f }, player.Center);
|
||||
|
||||
// Phase for flying at the player
|
||||
bool flyAtTarget = calamityGlobalNPC.newAI[3] >= (aiSwitchTimer * 0.5f) && startFlightPhase;
|
||||
|
||||
// Length of worms
|
||||
int phase1Length = death ? 80 : revenge ? 70 : expertMode ? 60 : 50;
|
||||
int phase2Length = death ? 40 : revenge ? 35 : expertMode ? 30 : 25;
|
||||
int gfbLength = death ? 8 : revenge ? 7 : expertMode ? 6 : 5;
|
||||
int maxLength = Main.zenithWorld && doubleWormPhase ? gfbLength : doubleWormPhase ? phase2Length : phase1Length;
|
||||
|
||||
// Become gradually more pissed as more worms are killed
|
||||
int gfbMaxWormCount = 10;
|
||||
int gfbWormCount = 0;
|
||||
if (CalamityWorld.LegendaryMode && revenge)
|
||||
gfbWormCount = NPC.CountNPCS(ModContent.NPCType<AstrumDeusHead>());
|
||||
if (gfbWormCount > gfbMaxWormCount)
|
||||
gfbWormCount = gfbMaxWormCount;
|
||||
if (gfbWormCount > 0)
|
||||
enrageScale += (gfbMaxWormCount - gfbWormCount) * 0.111f;
|
||||
|
||||
// Split into two worms
|
||||
float splitAnimationTime = 180f;
|
||||
bool oneWormAlive = NPC.CountNPCS(ModContent.NPCType<AstrumDeusHead>()) < 2;
|
||||
bool deathModeFinalWormEnrage = death && doubleWormPhase && oneWormAlive && calamityGlobalNPC.newAI[1] >= resistanceTime;
|
||||
if (deathModeFinalWormEnrage)
|
||||
{
|
||||
if (calamityGlobalNPC.newAI[0] != 3f)
|
||||
{
|
||||
SoundEngine.PlaySound(SplitSound, player.Center);
|
||||
calamityGlobalNPC.newAI[0] = 3f;
|
||||
NPC.defense = 12;
|
||||
calamityGlobalNPC.DR = 0.075f;
|
||||
|
||||
// Despawns the other deus worm segments
|
||||
int bodyID = ModContent.NPCType<AstrumDeusBody>();
|
||||
int tailID = ModContent.NPCType<AstrumDeusTail>();
|
||||
for (int i = 0; i < Main.maxNPCs; i++)
|
||||
{
|
||||
NPC wormseg = Main.npc[i];
|
||||
if (!wormseg.active)
|
||||
continue;
|
||||
|
||||
if ((wormseg.type == bodyID || wormseg.type == tailID) && Main.npc[(int)wormseg.ai[2]].Calamity().newAI[0] != 3f)
|
||||
{
|
||||
wormseg.life = 0;
|
||||
wormseg.active = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
calamityGlobalNPC.newAI[2] += 10f;
|
||||
if (calamityGlobalNPC.newAI[2] > 162f)
|
||||
calamityGlobalNPC.newAI[2] = 162f;
|
||||
|
||||
NPC.Opacity = MathHelper.Clamp(1f - (calamityGlobalNPC.newAI[2] / splitAnimationTime), 0f, 1f);
|
||||
}
|
||||
|
||||
bool despawnRemainingWorm = doubleWormPhase && oneWormAlive && !death;
|
||||
if ((halfHealth && calamityGlobalNPC.newAI[0] == 0f) || despawnRemainingWorm)
|
||||
{
|
||||
NPC.dontTakeDamage = true;
|
||||
|
||||
calamityGlobalNPC.newAI[2] += despawnRemainingWorm ? 10f : 1f;
|
||||
NPC.Opacity = MathHelper.Clamp(1f - (calamityGlobalNPC.newAI[2] / splitAnimationTime), 0f, 1f);
|
||||
|
||||
bool despawning = calamityGlobalNPC.newAI[2] == splitAnimationTime;
|
||||
|
||||
//
|
||||
// CODE TWEAKED BY: OZZATRON
|
||||
// September 20th, 2020
|
||||
// reason: fixing Astrum Deus death mode NPC cap bug
|
||||
//
|
||||
|
||||
// Despawn the unsplit Astrum Deus and spawn two half-size Astrum Deus worms.
|
||||
if (despawning)
|
||||
{
|
||||
// If this is already a split worm (newAI[0] != 0f) then don't do anything. At all.
|
||||
if (doubleWormPhase)
|
||||
return;
|
||||
|
||||
// Mark all existing body and tail segments as inactive. This instantly frees up their NPC slots for the freshly spawned worms.
|
||||
int bodyID = ModContent.NPCType<AstrumDeusBody>();
|
||||
int tailID = ModContent.NPCType<AstrumDeusTail>();
|
||||
for (int i = 0; i < Main.maxNPCs; i++)
|
||||
{
|
||||
NPC wormseg = Main.npc[i];
|
||||
if (!wormseg.active)
|
||||
continue;
|
||||
if (wormseg.type == bodyID || wormseg.type == tailID)
|
||||
{
|
||||
wormseg.life = 0;
|
||||
wormseg.active = false;
|
||||
}
|
||||
}
|
||||
|
||||
// The unsplit Astrum Deus worm head will die next frame.
|
||||
NPC.life = 0;
|
||||
|
||||
// Do not spawn worms client side. The server handles this.
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
{
|
||||
int wormamt = Main.zenithWorld ? 5 : 1;
|
||||
for (int i = 0; i < wormamt; i++)
|
||||
{
|
||||
// Now that the original worm doesn't exist, startCount can be zero.
|
||||
// int startCount = NPC.whoAmI + phase1Length + 1;
|
||||
int startIndexHeadOne = 1;
|
||||
int headOneID = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, NPC.type, startIndexHeadOne);
|
||||
Main.npc[headOneID].Calamity().newAI[0] = 1f;
|
||||
Main.npc[headOneID].velocity = Vector2.Normalize(player.Center - Main.npc[headOneID].Center) * 16f;
|
||||
Main.npc[headOneID].timeLeft *= 20;
|
||||
Main.npc[headOneID].ForceNetUpdate();
|
||||
|
||||
// On server, immediately send the correct extra AI of this head to clients.
|
||||
if (Main.dedServ)
|
||||
{
|
||||
SyncCalamityNPCAIArrayPacket.Send(Main.npc[headOneID]);
|
||||
}
|
||||
|
||||
// Make sure the second split worm is also contiguous.
|
||||
int startIndexHeadTwo = startIndexHeadOne + phase2Length + 1;
|
||||
int headTwoID = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, NPC.type, startIndexHeadTwo);
|
||||
Main.npc[headTwoID].Calamity().newAI[0] = 2f;
|
||||
Main.npc[headTwoID].Calamity().newAI[3] = CalamityWorld.LegendaryMode ? 300f : 600f;
|
||||
Main.npc[headTwoID].velocity = Vector2.Normalize(player.Center - Main.npc[headTwoID].Center) * 16f;
|
||||
Main.npc[headTwoID].timeLeft *= 20;
|
||||
Main.npc[headTwoID].ForceNetUpdate();
|
||||
|
||||
// On server, immediately send the correct extra AI of this head to clients.
|
||||
if (Main.dedServ)
|
||||
{
|
||||
SyncCalamityNPCAIArrayPacket.Send(Main.npc[headTwoID]);
|
||||
}
|
||||
}
|
||||
|
||||
SoundEngine.PlaySound(AstrumDeusHead.SplitSound, player.Center);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (Main.zenithWorld && calamityGlobalNPC.newAI[1] < 10f) // desync the deuses
|
||||
{
|
||||
float pushForce = 0.25f;
|
||||
for (int k = 0; k < Main.maxNPCs; k++)
|
||||
{
|
||||
NPC otherDeus = Main.npc[k];
|
||||
// Short circuits to make the loop as fast as possible
|
||||
if (!otherDeus.active || k == NPC.whoAmI)
|
||||
continue;
|
||||
|
||||
// If the other projectile is indeed the same owned by the same player and they're too close, nudge them away.
|
||||
bool sameProjType = otherDeus.type == NPC.type;
|
||||
float taxicabDist = Vector2.Distance(NPC.Center, otherDeus.Center);
|
||||
float distancegate = 320f;
|
||||
if (sameProjType && taxicabDist < distancegate)
|
||||
{
|
||||
if (NPC.position.X < otherDeus.position.X)
|
||||
NPC.velocity.X -= pushForce;
|
||||
else
|
||||
NPC.velocity.X += pushForce;
|
||||
|
||||
if (NPC.position.Y < otherDeus.position.Y)
|
||||
NPC.velocity.Y -= pushForce;
|
||||
else
|
||||
NPC.velocity.Y += pushForce;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Set worm variable
|
||||
if (NPC.ai[2] > 0f)
|
||||
NPC.realLife = (int)NPC.ai[2];
|
||||
|
||||
// Alpha effects
|
||||
NPC.alpha -= 42;
|
||||
if (NPC.alpha < 0)
|
||||
NPC.alpha = 0;
|
||||
|
||||
// Direction
|
||||
if (NPC.velocity.X < 0f)
|
||||
NPC.spriteDirection = -1;
|
||||
else if (NPC.velocity.X > 0f)
|
||||
NPC.spriteDirection = 1;
|
||||
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
{
|
||||
if (NPC.ai[0] == 0f)
|
||||
{
|
||||
int Previous = NPC.whoAmI;
|
||||
int bodyType = ModContent.NPCType<AstrumDeusBody>();
|
||||
int tailType = ModContent.NPCType<AstrumDeusTail>();
|
||||
for (int segments = 0; segments < maxLength; segments++)
|
||||
{
|
||||
int lol;
|
||||
if (segments >= 0 && segments < maxLength - 1)
|
||||
lol = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, bodyType, NPC.whoAmI);
|
||||
else
|
||||
lol = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, tailType, NPC.whoAmI);
|
||||
|
||||
if (segments % 2 == 0)
|
||||
Main.npc[lol].localAI[3] = 1f;
|
||||
|
||||
Main.npc[lol].realLife = NPC.whoAmI;
|
||||
Main.npc[lol].Calamity().newAI[0] = Main.npc[Previous].Calamity().newAI[0];
|
||||
Main.npc[lol].Calamity().newAI[3] = Main.npc[Previous].Calamity().newAI[3];
|
||||
|
||||
if (Main.dedServ)
|
||||
{
|
||||
SyncCalamityNPCAIArrayPacket.Send(Main.npc[lol]);
|
||||
}
|
||||
|
||||
Main.npc[lol].ai[3] = segments + 1;
|
||||
Main.npc[lol].ai[2] = NPC.whoAmI;
|
||||
Main.npc[lol].ai[1] = Previous;
|
||||
Main.npc[Previous].ai[0] = lol;
|
||||
NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, lol);
|
||||
Previous = lol;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (NPC.life > Main.npc[(int)NPC.ai[0]].life)
|
||||
NPC.life = Main.npc[(int)NPC.ai[0]].life;
|
||||
|
||||
bool hasJustSpawned = calamityGlobalNPC.newAI[1] < resistanceTime * 0.4f && !doubleWormPhase; // Speed boost for the first 4 seconds after spawning
|
||||
float segmentVelocity = hasJustSpawned ? 25f : deathModeEnragePhase_Head ? 19f : death ? 17.5f : 16f;
|
||||
|
||||
float segmentVelocityBoost = 5f * (1f - lifeRatio);
|
||||
segmentVelocity += segmentVelocityBoost;
|
||||
segmentVelocity += 4f * enrageScale;
|
||||
|
||||
if (revenge)
|
||||
{
|
||||
float revMultiplier = 1.1f;
|
||||
segmentVelocity *= revMultiplier;
|
||||
}
|
||||
|
||||
int headTilePositionX = (int)(NPC.position.X / 16f) - 1;
|
||||
int headTileWidthPosX = (int)((NPC.position.X + NPC.width) / 16f) + 2;
|
||||
int headTilePositionY = (int)(NPC.position.Y / 16f) - 1;
|
||||
int headTileWidthPosY = (int)((NPC.position.Y + NPC.height) / 16f) + 2;
|
||||
|
||||
if (headTilePositionX < 0)
|
||||
headTilePositionX = 0;
|
||||
if (headTileWidthPosX > Main.maxTilesX)
|
||||
headTileWidthPosX = Main.maxTilesX;
|
||||
if (headTilePositionY < 0)
|
||||
headTilePositionY = 0;
|
||||
if (headTileWidthPosY > Main.maxTilesY)
|
||||
headTileWidthPosY = Main.maxTilesY;
|
||||
|
||||
// Fly or not
|
||||
bool shouldFly = flyAtTarget;
|
||||
if (!shouldFly)
|
||||
{
|
||||
for (int k = headTilePositionX; k < headTileWidthPosX; k++)
|
||||
{
|
||||
for (int l = headTilePositionY; l < headTileWidthPosY; l++)
|
||||
{
|
||||
if (Main.tile[k, l] != null && ((Main.tile[k, l].HasUnactuatedTile && (Main.tileSolid[Main.tile[k, l].TileType] || (Main.tileSolidTop[Main.tile[k, l].TileType] && Main.tile[k, l].TileFrameY == 0))) || Main.tile[k, l].LiquidAmount > 64))
|
||||
{
|
||||
Vector2 vector2;
|
||||
vector2.X = k * 16f;
|
||||
vector2.Y = l * 16f;
|
||||
if (NPC.position.X + NPC.width > vector2.X && NPC.position.X < vector2.X + 16f && NPC.position.Y + NPC.height > vector2.Y && NPC.position.Y < vector2.Y + 16f)
|
||||
{
|
||||
shouldFly = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Start flying if target is not within a certain distance
|
||||
if (!shouldFly)
|
||||
{
|
||||
NPC.localAI[1] = 1f;
|
||||
|
||||
Rectangle rectangle = new Rectangle((int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height);
|
||||
int noFlyZone = 200;
|
||||
int heightReduction = death ? 130 : (int)(130f * (1f - lifeRatio));
|
||||
int height = 400 - heightReduction;
|
||||
bool outsideNoFlyZone = true;
|
||||
|
||||
if (NPC.position.Y > player.position.Y)
|
||||
{
|
||||
for (int m = 0; m < Main.maxPlayers; m++)
|
||||
{
|
||||
if (Main.player[m].active)
|
||||
{
|
||||
Rectangle rectangle2 = new Rectangle((int)Main.player[m].position.X - noFlyZone, (int)Main.player[m].position.Y - noFlyZone, noFlyZone * 2, height);
|
||||
if (rectangle.Intersects(rectangle2))
|
||||
{
|
||||
outsideNoFlyZone = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (outsideNoFlyZone)
|
||||
shouldFly = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
NPC.localAI[1] = 0f;
|
||||
|
||||
// Despawn
|
||||
if (player.dead)
|
||||
{
|
||||
shouldFly = false;
|
||||
float velocity = 2f;
|
||||
NPC.velocity.Y -= velocity;
|
||||
if ((double)NPC.position.Y < Main.topWorld + 16f)
|
||||
{
|
||||
segmentVelocity *= 2f;
|
||||
NPC.velocity.Y -= velocity;
|
||||
}
|
||||
|
||||
int headType = ModContent.NPCType<AstrumDeusHead>();
|
||||
int bodyType = ModContent.NPCType<AstrumDeusBody>();
|
||||
int tailType = ModContent.NPCType<AstrumDeusBody>();
|
||||
if ((double)NPC.position.Y < Main.topWorld + 16f)
|
||||
{
|
||||
for (int i = 0; i < Main.maxNPCs; i++)
|
||||
{
|
||||
if (Main.npc[i].type == headType || Main.npc[i].type == bodyType || Main.npc[i].type == tailType)
|
||||
{
|
||||
Main.npc[i].active = false;
|
||||
Main.npc[i].ForceNetUpdate(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Speed and movement
|
||||
float speedBoost = death ? (0.1f * (1f - lifeRatio)) : (0.13f * (1f - lifeRatio));
|
||||
float turnSpeedBoost = death ? (0.18f * (1f - lifeRatio)) : (0.2f * (1f - lifeRatio));
|
||||
float speed = (hasJustSpawned ? 0.26f : deathModeEnragePhase_Head ? 0.2f : death ? 0.18f : 0.13f) + speedBoost;
|
||||
float turnSpeed = (hasJustSpawned ? 0.3f : deathModeEnragePhase_Head ? 0.27f : death ? 0.25f : 0.2f) + turnSpeedBoost;
|
||||
speed += 0.05f * enrageScale;
|
||||
turnSpeed += 0.08f * enrageScale;
|
||||
|
||||
if (flyAtTarget)
|
||||
{
|
||||
float speedMultiplier = deathModeEnragePhase_Head ? 1.25f : doubleWormPhase ? (phase3 ? 1.25f : phase2 ? 1.2f : 1.15f) : 1f;
|
||||
speed *= speedMultiplier;
|
||||
}
|
||||
|
||||
if (revenge)
|
||||
{
|
||||
float revMultiplier = 1.1f;
|
||||
speed *= revMultiplier;
|
||||
turnSpeed *= revMultiplier;
|
||||
}
|
||||
|
||||
speed *= increaseSpeedMore ? 2f : increaseSpeed ? 1.5f : 1f;
|
||||
turnSpeed *= increaseSpeedMore ? 2f : increaseSpeed ? 1.5f : 1f;
|
||||
|
||||
if (CalamityWorld.LegendaryMode)
|
||||
{
|
||||
speed *= 1.15f;
|
||||
turnSpeed *= 1.15f;
|
||||
}
|
||||
|
||||
Vector2 deusCenter = NPC.Center;
|
||||
float deusTargetX = player.Center.X;
|
||||
float deusTargetY = player.Center.Y;
|
||||
deusTargetX = (int)(deusTargetX / 16f) * 16;
|
||||
deusTargetY = (int)(deusTargetY / 16f) * 16;
|
||||
deusCenter.X = (int)(deusCenter.X / 16f) * 16;
|
||||
deusCenter.Y = (int)(deusCenter.Y / 16f) * 16;
|
||||
deusTargetX -= deusCenter.X;
|
||||
deusTargetY -= deusCenter.Y;
|
||||
|
||||
if (!shouldFly)
|
||||
{
|
||||
NPC.velocity.Y += 0.15f;
|
||||
if (NPC.velocity.Y > segmentVelocity)
|
||||
NPC.velocity.Y = segmentVelocity;
|
||||
|
||||
// This bool exists to stop the strange wiggle behavior when worms are falling down
|
||||
bool slowXVelocity = Math.Abs(NPC.velocity.X) > speed;
|
||||
if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < segmentVelocity * 0.4)
|
||||
{
|
||||
if (NPC.velocity.X < 0f)
|
||||
NPC.velocity.X -= speed * 1.1f;
|
||||
else
|
||||
NPC.velocity.X += speed * 1.1f;
|
||||
}
|
||||
else if (NPC.velocity.Y == segmentVelocity)
|
||||
{
|
||||
if (slowXVelocity)
|
||||
{
|
||||
if (NPC.velocity.X < deusTargetX)
|
||||
NPC.velocity.X += speed;
|
||||
else if (NPC.velocity.X > deusTargetX)
|
||||
NPC.velocity.X -= speed;
|
||||
}
|
||||
else
|
||||
NPC.velocity.X = 0f;
|
||||
}
|
||||
else if (NPC.velocity.Y > 4f)
|
||||
{
|
||||
if (slowXVelocity)
|
||||
{
|
||||
if (NPC.velocity.X < 0f)
|
||||
NPC.velocity.X += speed * 0.9f;
|
||||
else
|
||||
NPC.velocity.X -= speed * 0.9f;
|
||||
}
|
||||
else
|
||||
NPC.velocity.X = 0f;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
float deusTargetDist = (float)Math.Sqrt(deusTargetX * deusTargetX + deusTargetY * deusTargetY);
|
||||
float deusAbsoluteTargetX = Math.Abs(deusTargetX);
|
||||
float deusAbsoluteTargetY = Math.Abs(deusTargetY);
|
||||
float deusTimeToReachTarget = segmentVelocity / deusTargetDist;
|
||||
deusTargetX *= deusTimeToReachTarget;
|
||||
deusTargetY *= deusTimeToReachTarget;
|
||||
|
||||
bool speedUpWhileFlying = false;
|
||||
if (flyAtTarget)
|
||||
{
|
||||
if (((NPC.velocity.X > 0f && deusTargetX < 0f) || (NPC.velocity.X < 0f && deusTargetX > 0f) || (NPC.velocity.Y > 0f && deusTargetY < 0f) || (NPC.velocity.Y < 0f && deusTargetY > 0f)) && Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y) > speed / 2f && deusTargetDist < 400f)
|
||||
{
|
||||
speedUpWhileFlying = true;
|
||||
|
||||
if (Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y) < segmentVelocity)
|
||||
NPC.velocity *= 1.1f;
|
||||
}
|
||||
|
||||
if (NPC.position.Y > player.position.Y)
|
||||
{
|
||||
speedUpWhileFlying = true;
|
||||
|
||||
if (Math.Abs(NPC.velocity.X) < segmentVelocity / 2f)
|
||||
{
|
||||
if (NPC.velocity.X == 0f)
|
||||
NPC.velocity.X -= NPC.direction;
|
||||
|
||||
NPC.velocity.X *= 1.1f;
|
||||
}
|
||||
else if (NPC.velocity.Y > -segmentVelocity)
|
||||
NPC.velocity.Y -= speed;
|
||||
}
|
||||
}
|
||||
|
||||
if (!speedUpWhileFlying)
|
||||
{
|
||||
if (!flyAtTarget)
|
||||
{
|
||||
if (((NPC.velocity.X > 0f && deusTargetX > 0f) || (NPC.velocity.X < 0f && deusTargetX < 0f)) && ((NPC.velocity.Y > 0f && deusTargetY > 0f) || (NPC.velocity.Y < 0f && deusTargetY < 0f)))
|
||||
{
|
||||
if (NPC.velocity.X < deusTargetX)
|
||||
NPC.velocity.X += turnSpeed;
|
||||
else if (NPC.velocity.X > deusTargetX)
|
||||
NPC.velocity.X -= turnSpeed;
|
||||
|
||||
if (NPC.velocity.Y < deusTargetY)
|
||||
NPC.velocity.Y += turnSpeed;
|
||||
else if (NPC.velocity.Y > deusTargetY)
|
||||
NPC.velocity.Y -= turnSpeed;
|
||||
}
|
||||
}
|
||||
|
||||
if ((NPC.velocity.X > 0f && deusTargetX > 0f) || (NPC.velocity.X < 0f && deusTargetX < 0f) || (NPC.velocity.Y > 0f && deusTargetY > 0f) || (NPC.velocity.Y < 0f && deusTargetY < 0f))
|
||||
{
|
||||
if (NPC.velocity.X < deusTargetX)
|
||||
NPC.velocity.X += speed;
|
||||
else if (NPC.velocity.X > deusTargetX)
|
||||
NPC.velocity.X -= speed;
|
||||
|
||||
if (NPC.velocity.Y < deusTargetY)
|
||||
NPC.velocity.Y += speed;
|
||||
else if (NPC.velocity.Y > deusTargetY)
|
||||
NPC.velocity.Y -= speed;
|
||||
|
||||
if (Math.Abs(deusTargetY) < segmentVelocity * 0.2 && ((NPC.velocity.X > 0f && deusTargetX < 0f) || (NPC.velocity.X < 0f && deusTargetX > 0f)))
|
||||
{
|
||||
if (NPC.velocity.Y > 0f)
|
||||
NPC.velocity.Y += speed * 2f;
|
||||
else
|
||||
NPC.velocity.Y -= speed * 2f;
|
||||
}
|
||||
|
||||
if (Math.Abs(deusTargetX) < segmentVelocity * 0.2 && ((NPC.velocity.Y > 0f && deusTargetY < 0f) || (NPC.velocity.Y < 0f && deusTargetY > 0f)))
|
||||
{
|
||||
if (NPC.velocity.X > 0f)
|
||||
NPC.velocity.X += speed * 2f;
|
||||
else
|
||||
NPC.velocity.X -= speed * 2f;
|
||||
}
|
||||
}
|
||||
else if (deusAbsoluteTargetX > deusAbsoluteTargetY)
|
||||
{
|
||||
if (NPC.velocity.X < deusTargetX)
|
||||
NPC.velocity.X += speed * 1.1f;
|
||||
else if (NPC.velocity.X > deusTargetX)
|
||||
NPC.velocity.X -= speed * 1.1f;
|
||||
|
||||
if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < segmentVelocity * 0.5)
|
||||
{
|
||||
if (NPC.velocity.Y > 0f)
|
||||
NPC.velocity.Y += speed;
|
||||
else
|
||||
NPC.velocity.Y -= speed;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (NPC.velocity.Y < deusTargetY)
|
||||
NPC.velocity.Y += speed * 1.1f;
|
||||
else if (NPC.velocity.Y > deusTargetY)
|
||||
NPC.velocity.Y -= speed * 1.1f;
|
||||
|
||||
if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < segmentVelocity * 0.5)
|
||||
{
|
||||
if (NPC.velocity.X > 0f)
|
||||
NPC.velocity.X += speed;
|
||||
else
|
||||
NPC.velocity.X -= speed;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (shouldFly)
|
||||
{
|
||||
if (NPC.localAI[0] != 1f)
|
||||
NPC.ForceNetUpdate(false);
|
||||
|
||||
NPC.localAI[0] = 1f;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (NPC.localAI[0] != 0f)
|
||||
NPC.ForceNetUpdate(false);
|
||||
|
||||
NPC.localAI[0] = 0f;
|
||||
}
|
||||
|
||||
if (((NPC.velocity.X > 0f && NPC.oldVelocity.X < 0f) || (NPC.velocity.X < 0f && NPC.oldVelocity.X > 0f) || (NPC.velocity.Y > 0f && NPC.oldVelocity.Y < 0f) || (NPC.velocity.Y < 0f && NPC.oldVelocity.Y > 0f)) && !NPC.justHit)
|
||||
NPC.ForceNetUpdate(false);
|
||||
|
||||
NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X) + MathHelper.PiOver2;
|
||||
|
||||
// Play spawn sound on Deus on the first frame because otherwise the sound wouldn't play properly in multiplayer
|
||||
if (calamityGlobalNPC.newAI[1] == 0f && !doubleWormPhase)
|
||||
{
|
||||
SoundEngine.PlaySound(SpawnSound, NPC.Center);
|
||||
calamityGlobalNPC.newAI[1] = 1f;
|
||||
}
|
||||
|
||||
// 5 seconds of resistance in phase 2, 10 seconds in phase 1, to prevent spawn killing
|
||||
if (calamityGlobalNPC.newAI[1] < resistanceTime && ((NPC.position - NPC.oldPosition).Length() > 2f || calamityGlobalNPC.newAI[1] > 1f))
|
||||
calamityGlobalNPC.newAI[1] += 1f;
|
||||
|
||||
// Calculate contact damage based on velocity
|
||||
if (!doNotDealDamage)
|
||||
{
|
||||
float minimalContactDamageVelocity = segmentVelocity * 0.25f;
|
||||
float minimalDamageVelocity = segmentVelocity * 0.5f;
|
||||
if (NPC.velocity.Length() <= minimalContactDamageVelocity)
|
||||
NPC.damage = (int)Math.Round(NPC.defDamage * 0.5);
|
||||
else
|
||||
{
|
||||
float velocityDamageScalar = MathHelper.Clamp((NPC.velocity.Length() - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f);
|
||||
NPC.damage = (int)MathHelper.Lerp((float)Math.Round(NPC.defDamage * 0.5), NPC.defDamage, velocityDamageScalar);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override bool CheckActive()
|
||||
@@ -172,7 +817,7 @@ namespace CalamityMod.NPCs.AstrumDeus
|
||||
bool deathModeEnragePhase = NPC.Calamity().newAI[0] == 3f;
|
||||
bool doubleWormPhase = NPC.Calamity().newAI[0] != 0f && !deathModeEnragePhase;
|
||||
|
||||
float cyanThreshold = Main.getGoodWorld ? 300f : 600f;
|
||||
float cyanThreshold = CalamityWorld.LegendaryMode ? 300f : 600f;
|
||||
// Head is always the last segment to visually transition
|
||||
float transitionStart = cyanThreshold * 0.95f;
|
||||
bool drawCyan = NPC.Calamity().newAI[3] >= cyanThreshold;
|
||||
@@ -274,7 +919,7 @@ namespace CalamityMod.NPCs.AstrumDeus
|
||||
|
||||
public override void BossLoot(ref string name, ref int potionType) => potionType = ModContent.ItemType<StarblightSoot>();
|
||||
|
||||
public static bool ShouldNotDropThings(NPC npc) => npc.Calamity().newAI[0] == 0f || ((CalamityWorld.death || BossRushEvent.BossRushActive) && npc.Calamity().newAI[0] != 3f);
|
||||
public static bool ShouldNotDropThings(NPC NPC) => NPC.Calamity().newAI[0] == 0f || ((CalamityWorld.death || BossRushEvent.BossRushActive) && NPC.Calamity().newAI[0] != 3f);
|
||||
|
||||
public override bool SpecialOnKill()
|
||||
{
|
||||
|
||||