Merge branch 'master' into There-will-always-be-a-fixes/balances-branch

This commit is contained in:
termigator1359 committed 2020-07-14 10:21:39 -04:00
commit b5df78908e
184 files changed
+8243 -1508

No files matched your search

+2 -11
View File
@@ -8,8 +8,8 @@ namespace CalamityMod.Buffs.StatBuffs
{
public override void SetDefaults()
{
DisplayName.SetDefault("Siren");
Description.SetDefault("You are a siren now");
DisplayName.SetDefault("Water Elemental");
Description.SetDefault("You are a water elemental now");
Main.debuff[Type] = true;
Main.buffNoSave[Type] = true;
Main.buffNoTimeDisplay[Type] = true;
@@ -22,17 +22,8 @@ namespace CalamityMod.Buffs.StatBuffs
if (modPlayer.sirenBoobsPrevious)
{
modPlayer.sirenBoobsPower = true;
player.statDefense += 1 +
(NPC.downedBoss3 ? 4 : 0) +
(Main.hardMode ? 5 : 0) +
(NPC.downedMoonlord ? 5 : 0);
player.detectCreature = true;
player.lifeRegen += 0 +
(NPC.downedBoss3 ? 1 : 0) +
(NPC.downedMoonlord ? 1 : 0);
player.ignoreWater = NPC.downedBoss3;
player.accFlipper = true;
player.discount = Main.hardMode;
if (player.breath <= player.breathMax + 2 && !modPlayer.ZoneAbyss && NPC.downedBoss3)
{
player.breath = player.breathMax + 3;
-52
View File
@@ -1,52 +0,0 @@
using CalamityMod.CalPlayer;
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Buffs.StatBuffs
{
public class SirenBobsAlt : ModBuff
{
public override void SetDefaults()
{
DisplayName.SetDefault("Siren");
Description.SetDefault("You are a siren now");
Main.debuff[Type] = true;
Main.buffNoSave[Type] = true;
Main.buffNoTimeDisplay[Type] = true;
canBeCleared = false;
}
public override void Update(Player player, ref int buffIndex)
{
CalamityPlayer modPlayer = player.Calamity();
if (modPlayer.sirenBoobsAltPrevious)
{
modPlayer.sirenBoobsAltPower = true;
player.statDefense += 1 +
(NPC.downedBoss3 ? 4 : 0) +
(Main.hardMode ? 5 : 0) +
(NPC.downedMoonlord ? 5 : 0);
player.dangerSense = true;
player.lifeRegen += 0 +
(NPC.downedBoss3 ? 1 : 0) +
(NPC.downedMoonlord ? 1 : 0);
player.ignoreWater = NPC.downedBoss3;
player.accFlipper = true;
player.discount = Main.hardMode;
if (player.breath <= player.breathMax + 2 && !modPlayer.ZoneAbyss && NPC.downedBoss3)
{
player.breath = player.breathMax + 3;
}
if (Main.myPlayer == player.whoAmI && player.wet && NPC.downedBoss3)
{
player.AddBuff(ModContent.BuffType<SirenWaterSpeed>(), 360);
}
}
else
{
player.DelBuff(buffIndex);
buffIndex--;
}
}
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

+36
View File
@@ -0,0 +1,36 @@
using CalamityMod.CalPlayer;
using CalamityMod.Projectiles.DraedonsArsenal;
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Buffs.Summon
{
public class MountedScannerBuff : ModBuff
{
public override void SetDefaults()
{
DisplayName.SetDefault("Mounted Scanner");
Description.SetDefault("Powerful machinery surrounds you");
Main.buffNoTimeDisplay[Type] = true;
Main.buffNoSave[Type] = true;
}
public override void Update(Player player, ref int buffIndex)
{
CalamityPlayer modPlayer = player.Calamity();
if (player.ownedProjectileCounts[ModContent.ProjectileType<MountedScannerSummon>()] > 0)
{
modPlayer.mountedScanner = true;
}
if (!modPlayer.mountedScanner)
{
player.DelBuff(buffIndex);
buffIndex--;
}
else
{
player.buffTime[buffIndex] = 18000;
}
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 515 B

+36
View File
@@ -0,0 +1,36 @@
using CalamityMod.CalPlayer;
using CalamityMod.Projectiles.DraedonsArsenal;
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Buffs.Summon
{
public class PoleWarperBuff : ModBuff
{
public override void SetDefaults()
{
DisplayName.SetDefault("Pole Warper");
Description.SetDefault("Sentient magnets are attracted to you");
Main.buffNoTimeDisplay[Type] = true;
Main.buffNoSave[Type] = true;
}
public override void Update(Player player, ref int buffIndex)
{
CalamityPlayer modPlayer = player.Calamity();
if (player.ownedProjectileCounts[ModContent.ProjectileType<PoleWarperSummon>()] > 0)
{
modPlayer.poleWarper = true;
}
if (!modPlayer.poleWarper)
{
player.DelBuff(buffIndex);
buffIndex--;
}
else
{
player.buffTime[buffIndex] = 18000;
}
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 481 B

+36
View File
@@ -0,0 +1,36 @@
using CalamityMod.CalPlayer;
using CalamityMod.Projectiles.DraedonsArsenal;
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Buffs.Summon
{
public class SnakeEyesBuff : ModBuff
{
public override void SetDefaults()
{
DisplayName.SetDefault("Snake Eyes");
Description.SetDefault("Always watching...");
Main.buffNoTimeDisplay[Type] = true;
Main.buffNoSave[Type] = true;
}
public override void Update(Player player, ref int buffIndex)
{
CalamityPlayer modPlayer = player.Calamity();
if (player.ownedProjectileCounts[ModContent.ProjectileType<SnakeEyesSummon>()] > 0)
{
modPlayer.snakeEyes = true;
}
if (!modPlayer.snakeEyes)
{
player.DelBuff(buffIndex);
buffIndex--;
}
else
{
player.buffTime[buffIndex] = 18000;
}
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 516 B

+36
View File
@@ -0,0 +1,36 @@
using CalamityMod.CalPlayer;
using CalamityMod.Projectiles.DraedonsArsenal;
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Buffs.Summon
{
public class StarSwallowerBuff : ModBuff
{
public override void SetDefaults()
{
DisplayName.SetDefault("Star Swallower");
Description.SetDefault("Mmmm myes");
Main.buffNoTimeDisplay[Type] = true;
Main.buffNoSave[Type] = true;
}
public override void Update(Player player, ref int buffIndex)
{
CalamityPlayer modPlayer = player.Calamity();
if (player.ownedProjectileCounts[ModContent.ProjectileType<StarSwallowerSummon>()] > 0)
{
modPlayer.starSwallowerPetFroge = true;
}
if (!modPlayer.starSwallowerPetFroge)
{
player.DelBuff(buffIndex);
buffIndex--;
}
else
{
player.buffTime[buffIndex] = 18000;
}
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 520 B

+171 -91
View File
@@ -21,6 +21,7 @@ using CalamityMod.NPCs.Abyss;
using CalamityMod.NPCs.AcidRain;
using CalamityMod.NPCs.Astral;
using CalamityMod.NPCs.Calamitas;
using CalamityMod.NPCs.Cryogen;
using CalamityMod.NPCs.Crags;
using CalamityMod.NPCs.DevourerofGods;
using CalamityMod.NPCs.GreatSandShark;
@@ -43,6 +44,7 @@ using CalamityMod.Projectiles.Ranged;
using CalamityMod.Projectiles.Rogue;
using CalamityMod.Projectiles.Summon;
using CalamityMod.Projectiles.Typeless;
using CalamityMod.TileEntities;
using CalamityMod.Tiles;
using CalamityMod.UI;
using CalamityMod.World;
@@ -119,8 +121,21 @@ namespace CalamityMod.CalPlayer
public float animusBoost = 1f;
#endregion
#region External variables -- Only set by Mod.Call
public int externalAbyssLight = 0;
public int CurrentlyViewedFactoryX = -1;
public int CurrentlyViewedFactoryY = -1;
public TEDraedonFuelFactory CurrentlyViewedFactory;
public int CurrentlyViewedChargerX = -1;
public int CurrentlyViewedChargerY = -1;
public TEDraedonItemCharger CurrentlyViewedCharger;
public int CurrentlyViewedHologramX = -1;
public int CurrentlyViewedHologramY = -1;
public string CurrentlyViewedHologramText;
#endregion
#region External variables -- Only set by Mod.Call
public int externalAbyssLight = 0;
public bool externalColdImmunity = false;
public bool externalHeatImmunity = false;
#endregion
@@ -910,9 +925,13 @@ namespace CalamityMod.CalPlayer
public List<int> GammaCanisters = new List<int>();
public bool rustyDrone = false;
public bool tundraFlameBlossom = false;
public bool starSwallowerPetFroge = false;
public bool snakeEyes = false;
public bool poleWarper = false;
public bool causticDragon = false;
public bool plaguebringerPatronSummon = false;
public bool howlTrio = false;
public bool mountedScanner = false;
#endregion
#region Biome
@@ -948,11 +967,6 @@ namespace CalamityMod.CalPlayer
public bool sirenBoobsHide;
public bool sirenBoobsForce;
public bool sirenBoobsPower;
public bool sirenBoobsAltPrevious;
public bool sirenBoobsAlt;
public bool sirenBoobsAltHide;
public bool sirenBoobsAltForce;
public bool sirenBoobsAltPower;
public bool snowmanPrevious;
public bool snowman;
public bool snowmanHide;
@@ -965,8 +979,6 @@ namespace CalamityMod.CalPlayer
public bool meldTransformationPower;
#endregion
#endregion
#region SavingAndLoading
public override void Initialize()
{
@@ -1266,7 +1278,7 @@ namespace CalamityMod.CalPlayer
player.statLifeMax2 += player.statLifeMax2 / 5 / 20 * 100;
if (leviathanAndSirenLore)
{
if (sirenBoobsPrevious || sirenBoobsAltPrevious)
if (sirenBoobsPrevious)
player.statLifeMax2 += player.statLifeMax2 / 5 / 20 * 5;
}
if (absoluteRage)
@@ -1927,17 +1939,19 @@ namespace CalamityMod.CalPlayer
gammaHead = false;
rustyDrone = false;
tundraFlameBlossom = false;
starSwallowerPetFroge = false;
snakeEyes = false;
poleWarper = false;
causticDragon = false;
plaguebringerPatronSummon = false;
howlTrio = false;
mountedScanner = false;
abyssalDivingSuitPrevious = abyssalDivingSuit;
abyssalDivingSuit = abyssalDivingSuitHide = abyssalDivingSuitForce = abyssalDivingSuitPower = false;
sirenBoobsPrevious = sirenBoobs;
sirenBoobs = sirenBoobsHide = sirenBoobsForce = sirenBoobsPower = false;
sirenBoobsAltPrevious = sirenBoobsAlt;
sirenBoobsAlt = sirenBoobsAltHide = sirenBoobsAltForce = sirenBoobsAltPower = false;
profanedCrystalPrevious = profanedCrystal;
profanedCrystal = profanedCrystalBuffs = profanedCrystalForce = profanedCrystalHide = false;
@@ -2297,6 +2311,15 @@ namespace CalamityMod.CalPlayer
elysianGuard = false;
#endregion
CurrentlyViewedFactoryX = CurrentlyViewedFactoryY = -1;
CurrentlyViewedFactory = null;
CurrentlyViewedChargerX = CurrentlyViewedChargerY = -1;
CurrentlyViewedCharger = null;
CurrentlyViewedHologramX = CurrentlyViewedHologramY = -1;
CurrentlyViewedHologramText = string.Empty;
KameiBladeUseDelay = 0;
lastProjectileHit = null;
brimlashBusterBoost = false;
@@ -2352,6 +2375,19 @@ namespace CalamityMod.CalPlayer
bool usePlague = NPC.AnyNPCs(ModContent.NPCType<PlaguebringerGoliath>());
player.ManageSpecialBiomeVisuals("CalamityMod:PlaguebringerGoliath", usePlague);
bool useCryogen = NPC.AnyNPCs(ModContent.NPCType<Cryogen>());
if (SkyManager.Instance["CalamityMod:Cryogen"] != null && useCryogen != SkyManager.Instance["CalamityMod:Cryogen"].IsActive())
{
if (useCryogen)
{
SkyManager.Instance.Activate("CalamityMod:Cryogen", player.Center);
}
else
{
SkyManager.Instance.Deactivate("CalamityMod:Cryogen");
}
}
Point point = player.Center.ToTileCoordinates();
bool aboveGround = point.Y > Main.maxTilesY - 320;
bool overworld = player.ZoneOverworldHeight && (point.X < 380 || point.X > Main.maxTilesX - 380);
@@ -3304,11 +3340,6 @@ namespace CalamityMod.CalPlayer
sirenBoobsHide = false;
sirenBoobsForce = true;
}
else if (item.type == ModContent.ItemType<SirensHeartAlt>())
{
sirenBoobsAltHide = false;
sirenBoobsAltForce = true;
}
else if (item.type == ModContent.ItemType<ProfanedSoulCrystal>())
{
profanedCrystalHide = false;
@@ -3485,11 +3516,7 @@ namespace CalamityMod.CalPlayer
{
player.AddBuff(ModContent.BuffType<SirenBobs>(), 60, true);
}
else if (sirenBoobsAlt)
{
player.AddBuff(ModContent.BuffType<SirenBobsAlt>(), 60, true);
}
if ((sirenBoobs || sirenBoobsAlt) && NPC.downedBoss3)
if (sirenBoobs && NPC.downedBoss3)
{
if (player.whoAmI == Main.myPlayer && !sirenIceCooldown)
{
@@ -3593,6 +3620,36 @@ namespace CalamityMod.CalPlayer
rage = 0;
gaelSwitchTimer = GaelSwitchPhase.None;
}
// Disable the factory UI if the player is far from the associated factory.
if (CurrentlyViewedFactory != null)
{
Vector2 factoryPosition = new Vector2(CurrentlyViewedFactoryX, CurrentlyViewedFactoryY);
if (player.Distance(factoryPosition) > 1200f)
{
CurrentlyViewedFactory = null;
CurrentlyViewedFactoryX = CurrentlyViewedFactoryY = -1;
}
}
// Disable the charger UI if the player is far from the associated charger.
if (CurrentlyViewedCharger != null)
{
Vector2 chargerPosition = new Vector2(CurrentlyViewedChargerX, CurrentlyViewedChargerY);
if (player.Distance(chargerPosition) > 1200f)
{
CurrentlyViewedCharger = null;
CurrentlyViewedChargerX = CurrentlyViewedChargerY = -1;
}
}
// Disable the hologram UI if the player is far from the associated hologram.
Vector2 hologramPosition = new Vector2(CurrentlyViewedHologramX, CurrentlyViewedHologramY) * 16f;
if (player.Distance(hologramPosition) > 120f)
{
CurrentlyViewedHologramX = CurrentlyViewedHologramY = -1;
CurrentlyViewedHologramText = string.Empty;
}
}
#region Dragon Scale Logic
@@ -3809,6 +3866,7 @@ namespace CalamityMod.CalPlayer
#region Pre Kill
public override bool PreKill(double damage, int hitDirection, bool pvp, ref bool playSound, ref bool genGore, ref PlayerDeathReason damageSource)
{
PopupGUIManager.SuspendAll();
if (player.Calamity().andromedaState == AndromedaPlayerState.LargeRobot)
{
if (!Main.dedServ)
@@ -5976,6 +6034,47 @@ namespace CalamityMod.CalPlayer
contactDamageReduction += 0.1;
}
if (trinketOfChiBuff)
contactDamageReduction += 0.15;
// Fearmonger set provides 15% multiplicative DR that ignores caps during the Holiday Moons.
// To prevent abuse, this effect does not work if there are any bosses alive.
if (fearmongerSet && !areThereAnyDamnBosses && (Main.pumpkinMoon || Main.snowMoon))
contactDamageReduction += 0.15;
if (abyssalDivingSuitPlates)
contactDamageReduction += 0.15;
if (sirenIce)
contactDamageReduction += 0.2;
if (encased)
contactDamageReduction += 0.3;
if (player.ownedProjectileCounts[ModContent.ProjectileType<EnergyShell>()] > 0 && player.ActiveItem().type == ModContent.ItemType<LionHeart>())
contactDamageReduction += 0.5;
if (theBee && player.statLife >= player.statLifeMax2 && theBeeCooldown <= 0)
{
contactDamageReduction += 0.5;
theBeeCooldown = 600;
}
if (CalamityWorld.revenge)
{
if (!CalamityWorld.downedBossAny)
contactDamageReduction += 0.2;
if (CalamityConfig.Instance.Rippers)
{
if (adrenaline == adrenalineMax && !adrenalineModeActive)
contactDamageReduction += 0.5;
}
}
if (player.mount.Active && (player.mount.Type == ModContent.MountType<AngryDogMount>() || player.mount.Type == ModContent.MountType<OnyxExcavator>()) && Math.Abs(player.velocity.X) > player.mount.RunSpeed / 2f)
contactDamageReduction += 0.1;
if (leviathanAndSirenLore)
{
if (!player.IsUnderwater())
@@ -6205,6 +6304,47 @@ namespace CalamityMod.CalPlayer
projectileDamageReduction += 0.25;
}
if (trinketOfChiBuff)
projectileDamageReduction += 0.15;
// Fearmonger set provides 15% multiplicative DR that ignores caps during the Holiday Moons.
// To prevent abuse, this effect does not work if there are any bosses alive.
if (fearmongerSet && !areThereAnyDamnBosses && (Main.pumpkinMoon || Main.snowMoon))
projectileDamageReduction += 0.15;
if (abyssalDivingSuitPlates)
projectileDamageReduction += 0.15;
if (sirenIce)
projectileDamageReduction += 0.2;
if (encased)
projectileDamageReduction += 0.3;
if (player.ownedProjectileCounts[ModContent.ProjectileType<EnergyShell>()] > 0 && player.ActiveItem().type == ModContent.ItemType<LionHeart>())
projectileDamageReduction += 0.5;
if (theBee && player.statLife >= player.statLifeMax2 && theBeeCooldown <= 0)
{
projectileDamageReduction += 0.5;
theBeeCooldown = 600;
}
if (CalamityWorld.revenge)
{
if (!CalamityWorld.downedBossAny)
projectileDamageReduction += 0.2;
if (CalamityConfig.Instance.Rippers)
{
if (adrenaline == adrenalineMax && !adrenalineModeActive)
projectileDamageReduction += 0.5;
}
}
if (player.mount.Active && (player.mount.Type == ModContent.MountType<AngryDogMount>() || player.mount.Type == ModContent.MountType<OnyxExcavator>()) && Math.Abs(player.velocity.X) > player.mount.RunSpeed / 2f)
projectileDamageReduction += 0.1;
if (leviathanAndSirenLore)
{
if (!player.IsUnderwater())
@@ -7109,13 +7249,6 @@ namespace CalamityMod.CalPlayer
player.head = mod.GetEquipSlot("SirenHead", EquipType.Head);
player.face = -1;
}
else if ((sirenBoobsAltPower || sirenBoobsAltForce) && !sirenBoobsAltHide)
{
player.legs = mod.GetEquipSlot("SirenLegAlt", EquipType.Legs);
player.body = mod.GetEquipSlot("SirenBodyAlt", EquipType.Body);
player.head = mod.GetEquipSlot("SirenHeadAlt", EquipType.Head);
player.face = -1;
}
else if (meldTransformationPower || meldTransformationForce)
{
player.legs = mod.GetEquipSlot("MeldTransformationLegs", EquipType.Legs);
@@ -7235,7 +7368,7 @@ namespace CalamityMod.CalPlayer
Main.PlaySound(SoundID.NPCHit, (int)player.position.X, (int)player.position.Y, 4, 1f, 0f); //metal hit noise
hurtSoundTimer = 10;
}
else if (((sirenBoobsPower || sirenBoobsForce) && !sirenBoobsHide) || ((sirenBoobsAltPower || sirenBoobsAltForce) && !sirenBoobsAltHide))
else if ((sirenBoobsPower || sirenBoobsForce) && !sirenBoobsHide)
{
playSound = false;
Main.PlaySound(SoundID.FemaleHit, (int)player.position.X, (int)player.position.Y, 1, 1f, 0f); //female hit noise
@@ -7255,7 +7388,6 @@ namespace CalamityMod.CalPlayer
}
}
#region MultiplierBoosts
double damageMult = 1.0 +
(dArtifact ? 0.25 : 0.0) +
@@ -7313,64 +7445,11 @@ namespace CalamityMod.CalPlayer
Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/IronHeartBigHurt"), (int)player.position.X, (int)player.position.Y);
}
#region MultiplicativeReductions
if (trinketOfChiBuff)
{
damage = (int)(damage * 0.85);
}
if (purpleCandle)
{
damage = (int)(damage - (player.statDefense * 0.05));
}
// Fearmonger set provides 15% multiplicative DR that ignores caps during the Holiday Moons.
// To prevent abuse, this effect does not work if there are any bosses alive.
if (fearmongerSet && !areThereAnyDamnBosses && (Main.pumpkinMoon || Main.snowMoon))
{
damage = (int)(damage * 0.85f);
}
if (abyssalDivingSuitPlates)
{
damage = (int)(damage * 0.85);
}
if (sirenIce)
{
damage = (int)(damage * 0.85);
}
if (encased)
{
damage = (int)(damage * 0.7);
}
if (player.ownedProjectileCounts[ModContent.ProjectileType<EnergyShell>()] > 0 && player.ActiveItem().type == ModContent.ItemType<LionHeart>())
{
damage = (int)(damage * 0.5);
}
if (theBee && player.statLife >= player.statLifeMax2 && theBeeCooldown <= 0)
{
damage = (int)(damage * 0.5);
theBeeCooldown = 600;
}
if (CalamityWorld.revenge)
{
if (!CalamityWorld.downedBossAny)
damage = (int)(damage * 0.8);
if (purpleCandle)
damage = (int)(damage - (player.statDefense * 0.05));
if (CalamityConfig.Instance.Rippers)
{
if (adrenaline == adrenalineMax && !adrenalineModeActive)
damage = (int)(damage * 0.5);
}
}
if (player.mount.Active && (player.mount.Type == ModContent.MountType<AngryDogMount>() || player.mount.Type == ModContent.MountType<OnyxExcavator>())
&& Math.Abs(player.velocity.X) > player.mount.RunSpeed / 2f)
{
damage = (int)(damage * 0.9);
}
#endregion
if ((godSlayerDamage && damage <= 80) || damage < 1)
{
if ((godSlayerDamage && damage <= 80) || damage < 1)
damage = 1;
}
#region HealingEffects
if (revivify)
@@ -7516,7 +7595,7 @@ namespace CalamityMod.CalPlayer
{
player.AddBuff(ModContent.BuffType<ReaverRage>(), 180);
}
if (fBarrier || ((sirenBoobs || sirenBoobsAlt) && NPC.downedBoss3))
if (fBarrier || (sirenBoobs && NPC.downedBoss3))
{
Main.PlaySound(SoundID.Item, (int)player.position.X, (int)player.position.Y, 27);
for (int m = 0; m < Main.maxNPCs; m++)
@@ -9765,8 +9844,9 @@ namespace CalamityMod.CalPlayer
tailFrame = 0;
}
tailFrameUp = 0;
}
}
}
Main.blockInput = PopupGUIManager.AnyGUIsActive;
}
public static readonly PlayerLayer Tail = new PlayerLayer("CalamityMod", "Tail", PlayerLayer.BackAcc, delegate (PlayerDrawInfo drawInfo)
{
@@ -12124,7 +12204,7 @@ namespace CalamityMod.CalPlayer
light += 1;
if (fathomSwarmerVisage)
light += 1;
if (sirenBoobs || sirenBoobsAlt)
if (sirenBoobs)
light += 1;
if (aAmpoule) // sponge inherits this and doesn't stack with ampoule
light += 1;
+7 -8
View File
@@ -429,7 +429,7 @@ namespace CalamityMod.CalPlayer
player.buffImmune[BuffID.Electrified] = true;
// Reduce breath meter while in icy water instead of chilling
bool canBreath = (modPlayer.sirenBoobs && NPC.downedBoss3) || (modPlayer.sirenBoobsAlt && NPC.downedBoss3) || player.gills || player.merman;
bool canBreath = (modPlayer.sirenBoobs && NPC.downedBoss3) || player.gills || player.merman;
if (player.arcticDivingGear || canBreath)
{
player.buffImmune[ModContent.BuffType<FrozenLungs>()] = true;
@@ -1251,7 +1251,7 @@ namespace CalamityMod.CalPlayer
if (modPlayer.cFreeze)
{
light[0] += 0.3f;
light[1] += (float)Main.DiscoG / 400f;
light[1] += Main.DiscoG / 400f;
light[2] += 0.5f;
}
if (modPlayer.sirenIce)
@@ -1260,11 +1260,11 @@ namespace CalamityMod.CalPlayer
light[1] += 1f;
light[2] += 1.25f;
}
if (modPlayer.sirenBoobs || modPlayer.sirenBoobsAlt)
if (modPlayer.sirenBoobs)
{
light[0] += 1.5f;
light[0] += 0.1f;
light[1] += 1f;
light[2] += 0.1f;
light[2] += 1.5f;
}
if (modPlayer.tarraSummon)
{
@@ -1914,7 +1914,7 @@ namespace CalamityMod.CalPlayer
(modPlayer.aquaticEmblem ? 0.25 : 0D) - // 0.75
(player.accMerman ? 0.3 : 0D) - // 0.7
(modPlayer.victideSet ? 0.2 : 0D) - // 0.85
(((modPlayer.sirenBoobs || modPlayer.sirenBoobsAlt) && NPC.downedBoss3) ? 0.3 : 0D) - // 0.7
((modPlayer.sirenBoobs && NPC.downedBoss3) ? 0.3 : 0D) - // 0.7
(modPlayer.abyssalDivingSuit ? 0.3 : 0D); // 0.7
// Limit the multiplier to 5%
@@ -1978,7 +1978,7 @@ namespace CalamityMod.CalPlayer
(modPlayer.aquaticEmblem ? 10D : 0D) + // 40
(player.accMerman ? 15D : 0D) + // 55
(modPlayer.victideSet ? 5D : 0D) + // 60
(((modPlayer.sirenBoobs || modPlayer.sirenBoobsAlt) && NPC.downedBoss3) ? 15D : 0D) + // 75
((modPlayer.sirenBoobs && NPC.downedBoss3) ? 15D : 0D) + // 75
(modPlayer.abyssalDivingSuit ? 15D : 0D); // 90
// Limit the multiplier to 50
@@ -2864,7 +2864,6 @@ namespace CalamityMod.CalPlayer
player.ClearBuff(BuffID.Regeneration);
if (player.FindBuffIndex(BuffID.Lifeforce) > -1)
player.ClearBuff(BuffID.Lifeforce);
player.discount = true;
player.lifeMagnet = true;
player.calmed = true;
}
+65 -9
View File
@@ -86,6 +86,9 @@ using Terraria.ID;
using Terraria.ModLoader;
using Terraria.ModLoader.Config;
using Terraria.UI;
using CalamityMod.Schematics;
using CalamityMod.Tiles;
using CalamityMod.TileEntities;
namespace CalamityMod
{
@@ -112,7 +115,7 @@ namespace CalamityMod
public static int astralKillCount = 0;
// Textures & Shaders
public static Texture2D heartOriginal2;
public static Texture2D heartOriginal2;
public static Texture2D heartOriginal;
public static Texture2D rainOriginal;
public static Texture2D manaOriginal;
@@ -245,7 +248,6 @@ namespace CalamityMod
}
ILChanges.Initialize();
thorium = ModLoader.GetMod("ThoriumMod");
BossHealthBarManager.Load(this);
@@ -269,10 +271,6 @@ namespace CalamityMod
AddEquipTexture(new SirenBody(), null, EquipType.Body, "SirenBody", "CalamityMod/Items/Accessories/SirenTrans_Body", "CalamityMod/Items/Accessories/SirenTrans_Arms");
AddEquipTexture(new SirenLegs(), null, EquipType.Legs, "SirenLeg", "CalamityMod/Items/Accessories/SirenTrans_Legs");
AddEquipTexture(new SirenHeadAlt(), null, EquipType.Head, "SirenHeadAlt", "CalamityMod/Items/Accessories/SirenTransAlt_Head");
AddEquipTexture(new SirenBodyAlt(), null, EquipType.Body, "SirenBodyAlt", "CalamityMod/Items/Accessories/SirenTransAlt_Body", "CalamityMod/Items/Accessories/SirenTransAlt_Arms");
AddEquipTexture(new SirenLegsAlt(), null, EquipType.Legs, "SirenLegAlt", "CalamityMod/Items/Accessories/SirenTransAlt_Legs");
AddEquipTexture(new AndromedaHead(), null, EquipType.Head, "NoHead", "CalamityMod/ExtraTextures/AndromedaWithout_Head");
AddEquipTexture(new PopoHead(), null, EquipType.Head, "PopoHead", "CalamityMod/Items/Accessories/Vanity/Popo_Head");
@@ -335,13 +333,17 @@ namespace CalamityMod
GameShaders.Misc["CalamityMod:SubsumingTentacle"] = new MiscShaderData(new Ref<Effect>(TentacleShader), "BurstPass");
RipperUI.Reset();
RipperUI.Reset();
AstralArcanumUI.Load(this);
GameShaders.Hair.BindShader(ModContent.ItemType<AdrenalineHairDye>(), new LegacyHairShaderData().UseLegacyMethod((Player player, Color newColor, ref bool lighting) => Color.Lerp(player.hairColor, new Color(0, 255, 171), ((float)player.Calamity().adrenaline / (float)player.Calamity().adrenalineMax))));
GameShaders.Hair.BindShader(ModContent.ItemType<RageHairDye>(), new LegacyHairShaderData().UseLegacyMethod((Player player, Color newColor, ref bool lighting) => Color.Lerp(player.hairColor, new Color(255, 83, 48), ((float)player.Calamity().rage / (float)player.Calamity().rageMax))));
GameShaders.Hair.BindShader(ModContent.ItemType<WingTimeHairDye>(), new LegacyHairShaderData().UseLegacyMethod((Player player, Color newColor, ref bool lighting) => Color.Lerp(player.hairColor, new Color(139, 205, 255), ((float)player.wingTime / (float)player.wingTimeMax))));
GameShaders.Hair.BindShader(ModContent.ItemType<StealthHairDye>(), new LegacyHairShaderData().UseLegacyMethod((Player player, Color newColor, ref bool lighting) => Color.Lerp(player.hairColor, new Color(186, 85, 211), (player.Calamity().rogueStealth / player.Calamity().rogueStealthMax))));
SchematicLoader.LoadEverything();
PopupGUIManager.LoadGUIs();
}
#endregion
@@ -450,6 +452,8 @@ namespace CalamityMod
Instance = null;
PopupGUIManager.UnloadGUIs();
SchematicLoader.UnloadEverything();
BossHealthBarManager.Unload();
base.Unload();
@@ -473,7 +477,7 @@ namespace CalamityMod
rainOriginal = null;
manaOriginal = null;
carpetOriginal = null;
}
}
#endregion
#region Late Loading
@@ -3345,6 +3349,29 @@ namespace CalamityMod
return true;
}, InterfaceScaleType.None));
layers.Insert(mouseIndex, new LegacyGameInterfaceLayer("Draedon Hologram", () =>
{
DraedonHologramChatUI.Draw(Main.spriteBatch);
return true;
}, InterfaceScaleType.None));
layers.Insert(mouseIndex, new LegacyGameInterfaceLayer("Draedon Factory Tiles", () =>
{
DraedonsFactoryUI.Draw(Main.spriteBatch);
DraedonsItemChargerUI.Draw(Main.spriteBatch);
return true;
}, InterfaceScaleType.Game)); // InterfaceScaleType.Game tells the game that this UI should take zoom into account.
layers.Insert(mouseIndex, new LegacyGameInterfaceLayer("Boss HP Bars", delegate ()
{
if (Main.LocalPlayer.Calamity().drawBossHPBar)
{
BossHealthBarManager.Update();
BossHealthBarManager.Draw(Main.spriteBatch);
}
return true;
}, InterfaceScaleType.None));
// Astral Arcanum overlay (if open)
layers.Insert(mouseIndex, new LegacyGameInterfaceLayer("Astral Arcanum UI", delegate ()
{
@@ -3379,6 +3406,11 @@ namespace CalamityMod
}
return true;
}, InterfaceScaleType.None));
layers.Insert(invasionIndex + 1, new LegacyGameInterfaceLayer("Popup GUIs", () =>
{
PopupGUIManager.UpdateAndDraw(Main.spriteBatch);
return true;
}, InterfaceScaleType.None));
}
}
@@ -4033,6 +4065,27 @@ namespace CalamityMod
// Not strictly necessary, but helps prevent unnecessary packetstorm in MP
if (Main.netMode != NetmodeID.MultiplayerClient)
NPC.NewNPC(x, y, ModContent.NPCType<SuperDummyNPC>());
break;
case CalamityModMessageType.DraedonGeneratorStackSync:
(TileEntity.ByID[reader.ReadInt32()] as TEDraedonFuelFactory).HeldItem.stack = reader.ReadInt32();
break;
case CalamityModMessageType.DraedonChargerSync:
int entityID = reader.ReadInt32();
(TileEntity.ByID[entityID] as TEDraedonItemCharger).FuelItem.type = reader.ReadInt32();
(TileEntity.ByID[entityID] as TEDraedonItemCharger).FuelItem.stack = reader.ReadInt32();
(TileEntity.ByID[entityID] as TEDraedonItemCharger).ItemBeingCharged.type = reader.ReadInt32();
(TileEntity.ByID[entityID] as TEDraedonItemCharger).ItemBeingCharged.stack = reader.ReadInt32();
int currentCharge = reader.ReadInt32();
if (currentCharge != -1)
{
(TileEntity.ByID[entityID] as TEDraedonItemCharger).ItemBeingCharged.Calamity().CurrentCharge = currentCharge;
}
(TileEntity.ByID[entityID] as TEDraedonItemCharger).ActiveTimer = reader.ReadInt32();
break;
case CalamityModMessageType.DraedonFieldGeneratorSync:
int entityID2 = reader.ReadInt32();
(TileEntity.ByID[entityID2] as TEDraedonFieldGenerator).Time = reader.ReadInt32();
(TileEntity.ByID[entityID2] as TEDraedonFieldGenerator).ActiveTimer = reader.ReadInt32();
break;
case CalamityModMessageType.SyncCalamityNPCAIArray:
byte npcIndex2 = reader.ReadByte();
@@ -4124,6 +4177,9 @@ namespace CalamityMod
AcidRainOldDukeSummonSync,
GaelsGreatswordSwingSync,
SpawnSuperDummy,
SyncCalamityNPCAIArray
SyncCalamityNPCAIArray,
DraedonGeneratorStackSync,
DraedonChargerSync,
DraedonFieldGeneratorSync
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 150 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 202 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 268 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 272 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

+3 -7
View File
@@ -8,17 +8,13 @@ namespace CalamityMod.Items.Accessories
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Siren's Heart (Blue)");
Tooltip.SetDefault("Transforms the holder into a siren\n" +
"Siren scales give increased defense (gives more defense in hardmode and post-ML)\n" +
"Siren sight reveals enemy locations (blue-only)\n" +
"Increases life regen (gives more life regen in hardmode and post-ML)\n" +
DisplayName.SetDefault("Aquatic Heart");
Tooltip.SetDefault("Transforms the holder into a water elemental\n" +
"Going underwater gives you a buff\n" +
"Greatly reduces breath loss and provides a small amount of light in the abyss\n" +
"Enemies become frozen when they touch you\n" +
"You have a layer of ice around you that absorbs 15% damage but breaks after one hit\n" +
"You have a layer of ice around you that absorbs 20% damage but breaks after one hit\n" +
"After 30 seconds the ice shield will regenerate\n" +
"Your alluring figure allows you to buy items at a reduced price from town npcs (only works in hardmode)\n" +
"Wow, you can swim now!\n" +
"Most of these effects are only active after Skeletron has been defeated\n" +
"Revengeance drop");
-68
View File
@@ -1,68 +0,0 @@
using CalamityMod.CalPlayer;
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Items.Accessories
{
public class SirensHeartAlt : ModItem
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Siren's Heart (Green)");
Tooltip.SetDefault("Transforms the holder into a siren\n" +
"Siren scales give increased defense (gives more defense in hardmode and post-ML)\n" +
"Siren sight reveals danger locations (green-only)\n" +
"Increases life regen (gives more life regen in hardmode and post-ML)\n" +
"Going underwater gives you a buff\n" +
"Greatly reduces breath loss and provides a small amount of light in the abyss\n" +
"Enemies become frozen when they touch you\n" +
"You have a layer of ice around you that absorbs 15% damage but breaks after one hit\n" +
"After 30 seconds the ice shield will regenerate\n" +
"Your alluring figure allows you to buy items at a reduced price from town npcs (only works in hardmode)\n" +
"Wow, you can swim now!\n" +
"Most of these effects are only active after Skeletron has been defeated\n" +
"Revengeance drop");
}
public override void SetDefaults()
{
item.width = 18;
item.height = 18;
item.accessory = true;
item.value = CalamityGlobalItem.Rarity4BuyPrice;
item.rare = 4;
}
public override void UpdateAccessory(Player player, bool hideVisual)
{
CalamityPlayer modPlayer = player.Calamity();
modPlayer.sirenBoobsAlt = true;
if (hideVisual)
modPlayer.sirenBoobsAltHide = true;
}
}
public class SirenHeadAlt : EquipTexture
{
public override bool DrawHead()
{
return false;
}
}
public class SirenBodyAlt : EquipTexture
{
public override bool DrawBody()
{
return false;
}
}
public class SirenLegsAlt : EquipTexture
{
public override bool DrawLegs()
{
return false;
}
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1001 B

+48 -15
View File
@@ -21,6 +21,7 @@ using CalamityMod.Projectiles.Ranged;
using CalamityMod.Projectiles.Rogue;
using CalamityMod.Projectiles.Summon;
using CalamityMod.Projectiles.Typeless;
using CalamityMod.UI;
using CalamityMod.World;
using Microsoft.Xna.Framework;
using System;
@@ -59,8 +60,14 @@ namespace CalamityMod.Items
public int timesUsed = 0;
// Rarity is provided both as the classic int and the new enum.
public CalamityRarity customRarity = CalamityRarity.NoEffect;
// The damage modifications for the item are handled in player files.
public int CurrentCharge = ChargeMax;
public bool Chargeable = false;
public const int ChargeMax = 150;
public const float ChargeDamageMinMultiplier = 0.4f;
// Rarity is provided both as the classic int and the new enum.
public CalamityRarity customRarity = CalamityRarity.NoEffect;
public int postMoonLordRarity
{
get => (int)customRarity;
@@ -211,6 +218,10 @@ namespace CalamityMod.Items
#region Shoot
public override bool Shoot(Item item, Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
{
if (item.type >= ItemID.Count && item.Calamity().Chargeable && item.Calamity().CurrentCharge > 0 && Main.rand.NextBool(120 / (int)MathHelper.Max(1, item.useAnimation)))
{
CurrentCharge--;
}
CalamityPlayer modPlayer = player.Calamity();
if (rogue)
{
@@ -446,15 +457,10 @@ namespace CalamityMod.Items
{
return new TagCompound
{
{
"rogue", rogue
},
{
"timesUsed", timesUsed
},
{
"rarity", (int)customRarity
}
["rogue"] = rogue,
["timesUsed"] = timesUsed,
["rarity"] = (int)customRarity,
["Charge"] = CurrentCharge
};
}
@@ -463,6 +469,7 @@ namespace CalamityMod.Items
rogue = tag.GetBool("rogue");
timesUsed = tag.GetInt("timesUsed");
customRarity = (CalamityRarity)tag.GetInt("rarity");
CurrentCharge = tag.GetInt("Charge");
}
public override void LoadLegacy(Item item, BinaryReader reader)
@@ -470,6 +477,7 @@ namespace CalamityMod.Items
int loadVersion = reader.ReadInt32();
customRarity = (CalamityRarity)reader.ReadInt32();
timesUsed = reader.ReadInt32();
CurrentCharge = reader.ReadInt32();
if (loadVersion == 0)
{
@@ -490,6 +498,7 @@ namespace CalamityMod.Items
writer.Write(flags);
writer.Write((int)customRarity);
writer.Write(timesUsed);
writer.Write(CurrentCharge);
}
public override void NetReceive(Item item, BinaryReader reader)
@@ -499,6 +508,7 @@ namespace CalamityMod.Items
customRarity = (CalamityRarity)reader.ReadInt32();
timesUsed = reader.ReadInt32();
CurrentCharge = reader.ReadInt32();
}
#endregion
@@ -866,6 +876,11 @@ namespace CalamityMod.Items
public override bool CanUseItem(Item item, Player player)
{
CalamityPlayer modPlayer = player.Calamity();
// Restrict behavior when reading Dreadon's Log.
if (PopupGUIManager.AnyGUIsActive)
return false;
if (player.ownedProjectileCounts[ModContent.ProjectileType<RelicOfDeliveranceSpear>()] > 0 &&
(item.damage > 0 || item.ammo != AmmoID.None))
{
@@ -985,6 +1000,16 @@ namespace CalamityMod.Items
}
#endregion
#region Modify Weapon Damage
public override void ModifyWeaponDamage(Item item, Player player, ref float add, ref float mult, ref float flat)
{
if (item.Calamity().Chargeable)
{
mult *= MathHelper.Lerp(ChargeDamageMinMultiplier, 1f, item.Calamity().CurrentCharge / (float)ChargeMax);
}
}
#endregion
#region Modify Tooltips
public override void ModifyTooltips(Item item, List<TooltipLine> tooltips)
{
@@ -1128,9 +1153,9 @@ namespace CalamityMod.Items
}
}
}
#endregion
#endregion
/*if (item.ammo == 97)
/*if (item.ammo == 97)
{
foreach (TooltipLine line2 in tooltips)
{
@@ -1142,7 +1167,7 @@ namespace CalamityMod.Items
}
}*/
if (item.type == ItemID.RodofDiscord)
if (item.type == ItemID.RodofDiscord)
{
foreach (TooltipLine line2 in tooltips)
{
@@ -2797,7 +2822,15 @@ Grants immunity to fire blocks, and temporary immunity to lava";
TooltipLine line = new TooltipLine(mod, "Tooltip0", "Forces surrounding biome state to Astral upon activation");
tooltips.Add(line);
}
}
}
if (item.type > ItemID.Count && item.Calamity().Chargeable)
{
float chargeRatio = item.Calamity().CurrentCharge / (float)ChargeMax;
chargeRatio *= 100f; // Turn the 0-1 ratio to a 0-100 percentage.
TooltipLine line = new TooltipLine(mod, "Tooltip0", $"Current Charge: {chargeRatio:N1}%");
tooltips.Add(line);
}
}
#endregion
+34
View File
@@ -0,0 +1,34 @@
using CalamityMod.UI;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items
{
public class DraedonsLog : ModItem
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Draedon's Log");
Tooltip.SetDefault("Click to view its contents");
}
public override void SetDefaults()
{
item.width = 40;
item.height = 40;
item.rare = 11;
item.useAnimation = item.useTime = 20;
item.useStyle = ItemUseStyleID.HoldingUp;
}
public override bool UseItem(Player player)
{
if (Main.myPlayer == player.whoAmI)
{
PopupGUIManager.DraedonLogGUI.Active = !PopupGUIManager.DraedonLogGUI.Active;
}
return true;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 774 B

+22
View File
@@ -0,0 +1,22 @@
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Items.Materials
{
public class DubiousPlating : ModItem
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Dubious Plating");
}
public override void SetDefaults()
{
item.width = 30;
item.height = 24;
item.maxStack = 999;
item.value = Item.sellPrice(silver: 3);
item.rare = 1;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 453 B

+22
View File
@@ -0,0 +1,22 @@
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Items.Materials
{
public class MysteriousCircuitry : ModItem
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Mysterious Circuitry");
}
public override void SetDefaults()
{
item.width = 30;
item.height = 24;
item.maxStack = 999;
item.value = Item.sellPrice(silver: 3);
item.rare = 1;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 512 B

@@ -0,0 +1,30 @@
using CalamityMod.Items.Placeables.Walls;
using CalamityMod.Items.Materials;
using Terraria.ID;
using Terraria.ModLoader;
using CalamityMod.Tiles;
namespace CalamityMod.Items.Placeables
{
public class DraedonsChargingStation : ModItem
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Draedon's Charging Station");
}
public override void SetDefaults()
{
item.rare = 10;
item.width = 26;
item.height = 26;
item.maxStack = 999;
item.useTurn = true;
item.autoReuse = true;
item.useAnimation = item.useTime = 15;
item.useStyle = ItemUseStyleID.SwingThrow;
item.consumable = true;
item.createTile = ModContent.TileType<DraedonItemCharger>();
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 509 B

@@ -0,0 +1,28 @@
using Terraria.ID;
using Terraria.ModLoader;
using CalamityMod.Tiles;
namespace CalamityMod.Items.Placeables
{
public class DraedonsFuelFactoryItem : ModItem
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Draedon's Fuel Factory");
}
public override void SetDefaults()
{
item.rare = 10;
item.width = 26;
item.height = 26;
item.maxStack = 999;
item.useTurn = true;
item.autoReuse = true;
item.useAnimation = item.useTime = 15;
item.useStyle = ItemUseStyleID.SwingThrow;
item.consumable = true;
item.createTile = ModContent.TileType<DraedonFuelFactory>();
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 451 B

@@ -0,0 +1,36 @@
using CalamityMod.Items.Materials;
using CalamityMod.Tiles;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Placeables.Furniture
{
public class AgedSecurityChest : ModItem
{
public override void SetDefaults()
{
item.width = 32;
item.height = 26;
item.maxStack = 99;
item.useTurn = true;
item.autoReuse = true;
item.useAnimation = 15;
item.useTime = 14;
item.rare = 2;
item.useStyle = ItemUseStyleID.SwingThrow;
item.consumable = true;
item.value = 500;
item.createTile = ModContent.TileType<AgedSecurityChestTile>();
}
public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ModContent.ItemType<MysteriousCircuitry>(), 4);
recipe.AddIngredient(ModContent.ItemType<DubiousPlating>(), 4);
recipe.AddIngredient(ItemID.IronBar, 4);
recipe.anyIronBar = true;
recipe.AddTile(TileID.Anvils);
recipe.SetResult(this);
recipe.AddRecipe();
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 581 B

@@ -0,0 +1,34 @@
using CalamityMod.Tiles;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Placeables.Furniture
{
public class SecurityChest : ModItem
{
public override void SetDefaults()
{
item.width = 32;
item.height = 26;
item.maxStack = 99;
item.useTurn = true;
item.autoReuse = true;
item.useAnimation = 15;
item.useTime = 14;
item.rare = 3;
item.useStyle = ItemUseStyleID.SwingThrow;
item.consumable = true;
item.value = 500;
item.createTile = ModContent.TileType<SecurityChestTile>();
}
public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ItemID.IronBar, 10);
recipe.anyIronBar = true;
recipe.AddIngredient(ModContent.ItemType<AgedSecurityChest>());
recipe.AddTile(TileID.Anvils);
recipe.SetResult(this);
recipe.AddRecipe();
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 534 B

+1 -1
View File
@@ -11,7 +11,7 @@ namespace CalamityMod.Items.Potions
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Cadance Potion");
Tooltip.SetDefault("Gives the cadance buff which reduces shop prices and enemy aggro\n" +
Tooltip.SetDefault("Gives the cadance buff which reduces enemy aggro\n" +
"Increases life regen and increases max life by 25%\n" +
"Increases heart pickup range\n" +
"While this potion's buff is active, Regeneration Potion and Lifeforce Potion buffs are disabled");
+24
View File
@@ -0,0 +1,24 @@
using CalamityMod.UI;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items
{
public class PowerCell : ModItem
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Draedon Power Cell");
Tooltip.SetDefault("Used at a charger to charge special weapons");
}
public override void SetDefaults()
{
item.width = 26;
item.height = 14;
item.rare = 10;
item.maxStack = 999;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 334 B

+5 -2
View File
@@ -62,11 +62,11 @@ namespace CalamityMod.Items.Tools
item.pick = PickPower;
item.shoot = ProjectileID.None;
item.shootSpeed = 0f;
item.tileBoost += 50;
item.tileBoost = 50;
item.UseSound = SoundID.Item1;
item.useStyle = ItemUseStyleID.SwingThrow;
item.useTime = 2;
item.useAnimation = 10;
item.useAnimation = 2;
item.useTurn = true;
item.autoReuse = true;
item.noMelee = false;
@@ -92,6 +92,9 @@ namespace CalamityMod.Items.Tools
public override void MeleeEffects(Player player, Rectangle hitbox)
{
if (player.altFunctionUse == 2)
return;
if (Main.rand.NextBool(3))
{
int num307 = Main.rand.Next(3);
+14 -10
View File
@@ -1,3 +1,4 @@
using CalamityMod.Items.Materials;
using CalamityMod.Projectiles.DraedonsArsenal;
using Microsoft.Xna.Framework;
using Terraria;
@@ -41,6 +42,8 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal
item.shoot = ModContent.ProjectileType<GatlingLaserProj>();
item.shootSpeed = 24f;
item.useAmmo = AmmoID.Bullet;
item.Calamity().Chargeable = true;
}
public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0;
@@ -62,16 +65,17 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal
return new Vector2(-20, 0);
}
/*public override void AddRecipes()
public override void AddRecipes()
{
ModRecipe r = new ModRecipe(mod);
r.AddIngredient(null, "CrownJewel");
r.AddIngredient(null, "GalacticaSingularity", 5);
r.AddIngredient(null, "BarofLife", 10);
r.AddIngredient(null, "CosmiliteBar", 15);
r.AddTile(TileID.LunarCraftingStation);
r.SetResult(this);
r.AddRecipe();
}*/
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ModContent.ItemType<MysteriousCircuitry>(), 15);
recipe.AddIngredient(ModContent.ItemType<DubiousPlating>(), 15);
recipe.AddIngredient(ModContent.ItemType<AuricBar>(), 5);
recipe.AddIngredient(ModContent.ItemType<LaserRifle>());
recipe.AddIngredient(ItemID.LaserMachinegun);
recipe.AddTile(TileID.LunarCraftingStation);
recipe.SetResult(this);
recipe.AddRecipe();
}
}
}
@@ -0,0 +1,50 @@
using CalamityMod.Items.Materials;
using CalamityMod.Projectiles.DraedonsArsenal;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Weapons.DraedonsArsenal
{
public class GaussPistol : ModItem
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Gauss Pistol");
}
public override void SetDefaults()
{
item.width = 40;
item.height = 22;
item.magic = true;
item.mana = 6;
item.damage = 25;
item.knockBack = 11f;
item.useTime = item.useAnimation = 20;
item.autoReuse = true;
item.useStyle = ItemUseStyleID.HoldingOut;
item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/GaussWeaponFire");
item.noMelee = true;
item.value = CalamityGlobalItem.Rarity3BuyPrice;
item.rare = 3;
item.shoot = ModContent.ProjectileType<GaussPistolShot>();
item.shootSpeed = 14f;
item.Calamity().Chargeable = true;
}
public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ModContent.ItemType<MysteriousCircuitry>(), 7);
recipe.AddIngredient(ModContent.ItemType<DubiousPlating>(), 5);
recipe.AddIngredient(ModContent.ItemType<AerialiteBar>(), 10);
recipe.AddTile(TileID.Anvils);
recipe.SetResult(this);
recipe.AddRecipe();
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 600 B

@@ -0,0 +1,62 @@
using CalamityMod.Items.Materials;
using CalamityMod.Projectiles.DraedonsArsenal;
using CalamityMod.Tiles.Furniture.CraftingStations;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Weapons.DraedonsArsenal
{
public class GaussRifle : ModItem
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Gauss Rifle");
Tooltip.SetDefault("Fires an enormous pulse of energy");
}
public override void SetDefaults()
{
item.width = 112;
item.height = 36;
item.ranged = true;
item.damage = 8000;
item.knockBack = 30f;
item.useTime = item.useAnimation = 28;
item.autoReuse = true;
item.useStyle = ItemUseStyleID.HoldingOut;
item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/GaussWeaponFire");
item.noMelee = true;
item.value = CalamityGlobalItem.RarityVioletBuyPrice;
item.rare = ItemRarityID.Red;
item.Calamity().customRarity = CalamityRarity.RareVariant; // In accordance with the other post-ML Arsenal weapons that Fabsol made.
item.shoot = ModContent.ProjectileType<GaussRifleBlast>();
item.shootSpeed = 27f;
item.useAmmo = AmmoID.Bullet;
item.Calamity().Chargeable = true;
}
public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
{
Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType<GaussRifleBlast>(), damage, knockBack, player.whoAmI, 0f, 0f);
return false;
}
public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ModContent.ItemType<MysteriousCircuitry>(), 20);
recipe.AddIngredient(ModContent.ItemType<DubiousPlating>(), 10);
recipe.AddIngredient(ModContent.ItemType<AuricBar>(), 5);
recipe.AddIngredient(ItemID.LaserRifle);
recipe.AddTile(ModContent.TileType<DraedonsForge>());
recipe.SetResult(this);
recipe.AddRecipe();
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 993 B

@@ -0,0 +1,51 @@
using CalamityMod.Items.Materials;
using CalamityMod.Projectiles.DraedonsArsenal;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Weapons.DraedonsArsenal
{
public class HydraulicVoltCrasher : ModItem
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Hydraulic Volt Crasher");
Tooltip.SetDefault("Zaps nearby enemies on hit");
}
public override void SetDefaults()
{
item.useStyle = ItemUseStyleID.HoldingOut;
item.useAnimation = 16;
item.useTime = 4;
item.shootSpeed = 46f;
item.knockBack = 12f;
item.width = 56;
item.height = 24;
item.damage = 99;
item.hammer = 230;
item.UseSound = SoundID.Item23;
item.shoot = ModContent.ProjectileType<HydraulicVoltCrasherProjectile>();
item.rare = 10;
item.Calamity().customRarity = CalamityRarity.RareVariant;
item.value = CalamityGlobalItem.Rarity10BuyPrice;
item.noMelee = true;
item.noUseGraphic = true;
item.melee = true;
item.channel = true;
item.Calamity().Chargeable = true;
}
public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ModContent.ItemType<MysteriousCircuitry>(), 10);
recipe.AddIngredient(ModContent.ItemType<DubiousPlating>(), 10);
recipe.AddIngredient(ModContent.ItemType<MeldiateBar>(), 5);
recipe.AddTile(TileID.LunarCraftingStation);
recipe.SetResult(this);
recipe.AddRecipe();
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 749 B

+15 -11
View File
@@ -1,3 +1,4 @@
using CalamityMod.Items.Materials;
using CalamityMod.Projectiles.DraedonsArsenal;
using Microsoft.Xna.Framework;
using Terraria;
@@ -32,13 +33,15 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal
item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserRifleFire");
item.noMelee = true;
item.value = Item.buyPrice(1, 80, 0, 0);
item.value = CalamityGlobalItem.Rarity10BuyPrice;
item.rare = 10;
item.Calamity().customRarity = CalamityRarity.RareVariant;
item.shoot = ModContent.ProjectileType<LaserRifleShot>();
item.shootSpeed = 1f;
item.useAmmo = AmmoID.Bullet;
item.Calamity().Chargeable = true;
}
public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
@@ -72,16 +75,17 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal
return new Vector2(-20, 0);
}
/*public override void AddRecipes()
public override void AddRecipes()
{
ModRecipe r = new ModRecipe(mod);
r.AddIngredient(null, "CrownJewel");
r.AddIngredient(null, "GalacticaSingularity", 5);
r.AddIngredient(null, "BarofLife", 10);
r.AddIngredient(null, "CosmiliteBar", 15);
r.AddTile(TileID.LunarCraftingStation);
r.SetResult(this);
r.AddRecipe();
}*/
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ModContent.ItemType<MysteriousCircuitry>(), 15);
recipe.AddIngredient(ModContent.ItemType<DubiousPlating>(), 15);
recipe.AddIngredient(ModContent.ItemType<MeldiateBar>(), 5);
recipe.AddIngredient(ItemID.LaserRifle);
recipe.AddTile(TileID.LunarCraftingStation);
recipe.SetResult(this);
recipe.AddRecipe();
}
}
}
@@ -0,0 +1,88 @@
using CalamityMod.Items.Materials;
using CalamityMod.Projectiles.DraedonsArsenal;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Weapons.DraedonsArsenal
{
public class MountedScanner : ModItem
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Mounted Scanner");
}
public override void SetDefaults()
{
item.width = 26;
item.height = 26;
item.summon = true;
item.damage = 27;
item.knockBack = 2f;
item.useTime = item.useAnimation = 35;
item.autoReuse = true;
item.useStyle = ItemUseStyleID.HoldingUp;
item.UseSound = SoundID.Item15;
item.noMelee = true;
item.value = CalamityGlobalItem.Rarity4BuyPrice;
item.rare = 4;
item.shoot = ModContent.ProjectileType<MountedScannerSummon>();
item.shootSpeed = 1f;
}
public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
{
Projectile.NewProjectile(player.Center, Vector2.Zero, type, damage, knockBack, player.whoAmI);
int totalOwnedScanners = player.ownedProjectileCounts[type];
int currentScannerIndex = 0;
foreach (Projectile projectile in Main.projectile)
{
if (!projectile.active)
continue;
if (projectile.type != type)
continue;
if (projectile.owner != player.whoAmI)
continue;
float completionRatio = currentScannerIndex / (float)totalOwnedScanners;
// ai[0] is the angular offset relative to the projectile's owner.
// For the first 15 summons, wrap around the player angularly, but not at a perfect angle, a bit like the Dazzling Stabbers when idle.
// But once the total summon count is greater than 15, just create a perfect circle depending on the total amount of summons.
if (totalOwnedScanners <= 14)
{
projectile.ai[0] = Utils.AngleLerp(0f, MathHelper.Pi, currentScannerIndex / 15f);
if (currentScannerIndex % 2f == 1f)
projectile.ai[0] = -Utils.AngleLerp(0f, MathHelper.Pi, (currentScannerIndex + 1) / 15f);
}
else
{
projectile.ai[0] = MathHelper.TwoPi / totalOwnedScanners * currentScannerIndex;
}
// Add a specific offset so that the scanners spawn above the player at first and not to the side.
projectile.ai[0] -= MathHelper.PiOver2;
projectile.netUpdate = true;
currentScannerIndex++;
}
return false;
}
public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ModContent.ItemType<MysteriousCircuitry>(), 15);
recipe.AddIngredient(ModContent.ItemType<DubiousPlating>(), 5);
recipe.AddIngredient(ModContent.ItemType<EssenceofEleum>(), 3);
recipe.AddIngredient(ModContent.ItemType<EssenceofCinder>(), 3);
recipe.AddIngredient(ModContent.ItemType<EssenceofChaos>(), 3);
recipe.AddTile(TileID.Anvils);
recipe.SetResult(this);
recipe.AddRecipe();
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 693 B

@@ -40,6 +40,8 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal
item.shoot = ModContent.ProjectileType<PlasmaCasterShot>();
item.shootSpeed = 1f;
item.useAmmo = AmmoID.Bullet;
item.Calamity().Chargeable = true;
}
public override bool AltFunctionUse(Player player) => true;
@@ -0,0 +1,58 @@
using CalamityMod.Items.Materials;
using CalamityMod.Items.Weapons.Rogue;
using CalamityMod.Projectiles.DraedonsArsenal;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Weapons.DraedonsArsenal
{
public class PlasmaGrenade : RogueWeapon
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Plasma Grenade");
Tooltip.SetDefault("Throws a rolling barrel that explodes on wall collision\n" +
"Stealth strikes make it rain on collision");
}
public override void SafeSetDefaults()
{
item.width = 22;
item.height = 28;
item.damage = 50;
item.noMelee = true;
item.noUseGraphic = true;
item.consumable = true;
item.maxStack = 999;
item.useStyle = ItemUseStyleID.SwingThrow;
item.useAnimation = item.useTime = 22;
item.knockBack = 3f;
item.UseSound = SoundID.Item1;
item.autoReuse = true;
item.value = CalamityGlobalItem.Rarity5BuyPrice;
item.rare = 5;
item.shoot = ModContent.ProjectileType<PlasmaGrenadeProjectile>();
item.shootSpeed = 10f;
item.Calamity().rogue = true;
}
public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
{
Projectile grenade = Projectile.NewProjectileDirect(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI);
grenade.Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable();
return false;
}
public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ModContent.ItemType<MysteriousCircuitry>(), 1);
recipe.AddIngredient(ModContent.ItemType<DubiousPlating>(), 1);
recipe.AddIngredient(ItemID.HallowedBar, 2);
recipe.AddTile(TileID.MythrilAnvil);
recipe.SetResult(this, 200);
recipe.AddRecipe();
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 501 B

@@ -0,0 +1,84 @@
using CalamityMod.Items.Materials;
using CalamityMod.Projectiles.DraedonsArsenal;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Weapons.DraedonsArsenal
{
public class PoleWarper : ModItem
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Pole Warper");
Tooltip.SetDefault("Summons two floating magnets which repel each other");
}
public override void SetDefaults()
{
item.shootSpeed = 10f;
item.damage = 38;
item.mana = 12;
item.width = 38;
item.height = 24;
item.useTime = item.useAnimation = 30;
item.useStyle = ItemUseStyleID.HoldingUp;
item.noMelee = true;
item.knockBack = 8f;
item.value = CalamityGlobalItem.Rarity4BuyPrice;
item.rare = 4;
item.UseSound = SoundID.Item15;
item.autoReuse = true;
item.shoot = ModContent.ProjectileType<PoleWarperSummon>();
item.shootSpeed = 10f;
item.summon = true;
}
public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
{
Projectile north = Projectile.NewProjectileDirect(Main.MouseWorld + Vector2.UnitY * 30f, Vector2.Zero, type, damage, knockBack, player.whoAmI);
Projectile south = Projectile.NewProjectileDirect(Main.MouseWorld - Vector2.UnitY * 30f, Vector2.Zero, type, damage, knockBack, player.whoAmI);
north.ai[1] = 1f;
south.ai[1] = 0f;
float magnetCount = 0f;
for (int i = 0; i < Main.projectile.Length; i++)
{
if (Main.projectile[i].type == type && Main.projectile[i].active && Main.projectile[i].owner == player.whoAmI)
{
magnetCount++;
}
}
// Adjust the offset of all existing magnets such that they form a psuedo-circle.
// This offset is used when determining where a magnet should move to relative to its true destination (such as the player or an enemy).
int magnetIndex = 0;
for (int i = 0; i < Main.projectile.Length; i++)
{
if (Main.projectile[i].type == type && Main.projectile[i].active && Main.projectile[i].owner == player.whoAmI)
{
((PoleWarperSummon)Main.projectile[i].modProjectile).Time = 0f;
((PoleWarperSummon)Main.projectile[i].modProjectile).AngularOffset = MathHelper.TwoPi * magnetIndex / magnetCount;
magnetIndex++;
}
}
return false;
}
public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ModContent.ItemType<MysteriousCircuitry>(), 6);
recipe.AddIngredient(ModContent.ItemType<DubiousPlating>(), 6);
recipe.AddIngredient(ModContent.ItemType<EssenceofEleum>(), 3);
recipe.AddIngredient(ModContent.ItemType<EssenceofCinder>(), 3);
recipe.AddIngredient(ModContent.ItemType<EssenceofChaos>(), 3);
recipe.AddTile(TileID.Anvils);
recipe.SetResult(this);
recipe.AddRecipe();
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 512 B

@@ -0,0 +1,69 @@
using CalamityMod.Items.Materials;
using CalamityMod.Projectiles.DraedonsArsenal;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Weapons.DraedonsArsenal
{
public class PulsePistol : ModItem
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Pulse Pistol");
Tooltip.SetDefault("Fires a pulse that arcs to a new target on enemy hits\n" +
"Inflicts more damage to inorganic targets");
}
public override void SetDefaults()
{
item.width = 62;
item.height = 22;
item.ranged = true;
item.damage = 22;
item.knockBack = 0f;
item.useTime = item.useAnimation = 20;
item.autoReuse = true;
item.useStyle = ItemUseStyleID.HoldingOut;
item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PulseRifleFire");
item.noMelee = true;
item.value = CalamityGlobalItem.Rarity3BuyPrice;
item.rare = 3;
item.shoot = ModContent.ProjectileType<PulseRifleShot>();
item.shootSpeed = 1.2f; // Keep in mind that the shot has extra updates.
item.useAmmo = AmmoID.Bullet;
item.Calamity().Chargeable = true;
}
public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
{
Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType<PulsePistolShot>(), damage, knockBack, player.whoAmI, 0f, 0f);
// Consume 6 ammo per shot
CalamityGlobalItem.ConsumeAdditionalAmmo(player, item, 6);
return false;
}
public override Vector2? HoldoutOffset() => new Vector2(10f, 0f);
// Disable vanilla ammo consumption
public override bool ConsumeAmmo(Player player) => false;
public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ModContent.ItemType<MysteriousCircuitry>(), 5);
recipe.AddIngredient(ModContent.ItemType<DubiousPlating>(), 7);
recipe.AddIngredient(ModContent.ItemType<AerialiteBar>(), 10);
recipe.AddTile(TileID.Anvils);
recipe.SetResult(this);
recipe.AddRecipe();
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 489 B

+15 -10
View File
@@ -1,4 +1,6 @@
using CalamityMod.Items.Materials;
using CalamityMod.Projectiles.DraedonsArsenal;
using CalamityMod.Tiles.Furniture.CraftingStations;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
@@ -41,6 +43,8 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal
item.shoot = ModContent.ProjectileType<PulseRifleShot>();
item.shootSpeed = 1f;
item.useAmmo = AmmoID.Bullet;
item.Calamity().Chargeable = true;
}
public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
@@ -74,16 +78,17 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal
return new Vector2(-10, 0);
}
/*public override void AddRecipes()
public override void AddRecipes()
{
ModRecipe r = new ModRecipe(mod);
r.AddIngredient(null, "CrownJewel");
r.AddIngredient(null, "GalacticaSingularity", 5);
r.AddIngredient(null, "BarofLife", 10);
r.AddIngredient(null, "CosmiliteBar", 15);
r.AddTile(TileID.LunarCraftingStation);
r.SetResult(this);
r.AddRecipe();
}*/
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ModContent.ItemType<MysteriousCircuitry>(), 15);
recipe.AddIngredient(ModContent.ItemType<DubiousPlating>(), 15);
recipe.AddIngredient(ModContent.ItemType<AuricBar>(), 5);
recipe.AddIngredient(ModContent.ItemType<PulsePistol>());
recipe.AddIngredient(ItemID.LaserRifle);
recipe.AddTile(ModContent.TileType<DraedonsForge>());
recipe.SetResult(this);
recipe.AddRecipe();
}
}
}
@@ -0,0 +1,75 @@
using CalamityMod.Items.Materials;
using CalamityMod.Projectiles.DraedonsArsenal;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Weapons.DraedonsArsenal
{
public class PulseTurretRemote : ModItem
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Pulse Turret Remote");
}
public override void SetDefaults()
{
item.width = 28;
item.height = 26;
item.sentry = true;
item.damage = 21;
item.knockBack = 0f;
item.useTime = item.useAnimation = 35;
item.autoReuse = true;
item.useStyle = ItemUseStyleID.HoldingUp;
item.UseSound = SoundID.Item15;
item.noMelee = true;
item.value = CalamityGlobalItem.Rarity4BuyPrice;
item.rare = 4;
item.shoot = ModContent.ProjectileType<PulseTurret>();
item.shootSpeed = 1f;
}
public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
{
Point mouseTileCoords = Main.MouseWorld.ToTileCoordinates();
if (!CalamityUtils.ParanoidTileRetrieval(mouseTileCoords.X, mouseTileCoords.Y).active())
{
int existingTurrets = player.ownedProjectileCounts[type];
if (existingTurrets > 0)
{
for (int i = 0; i < Main.projectile.Length || existingTurrets > 0; i++)
{
if (Main.projectile[i].type == type &&
Main.projectile[i].owner == player.whoAmI &&
Main.projectile[i].active)
{
Main.projectile[i].Kill();
existingTurrets--;
}
}
}
Projectile.NewProjectile(Main.MouseWorld, Vector2.Zero, type, damage, knockBack, player.whoAmI);
}
return false;
}
public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ModContent.ItemType<MysteriousCircuitry>(), 10);
recipe.AddIngredient(ModContent.ItemType<DubiousPlating>(), 10);
recipe.AddIngredient(ModContent.ItemType<EssenceofEleum>(), 3);
recipe.AddIngredient(ModContent.ItemType<EssenceofCinder>(), 3);
recipe.AddIngredient(ModContent.ItemType<EssenceofChaos>(), 3);
recipe.AddTile(TileID.Anvils);
recipe.SetResult(this);
recipe.AddRecipe();
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 481 B

@@ -0,0 +1,54 @@
using CalamityMod.Items.Materials;
using CalamityMod.Projectiles.DraedonsArsenal;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Weapons.DraedonsArsenal
{
public class SnakeEyes : ModItem
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Snake Eyes");
}
public override void SetDefaults()
{
item.shootSpeed = 10f;
item.damage = 15;
item.mana = 12;
item.width = 38;
item.height = 24;
item.useTime = item.useAnimation = 30;
item.useStyle = ItemUseStyleID.HoldingUp;
item.noMelee = true;
item.knockBack = 3f;
item.value = CalamityGlobalItem.Rarity3BuyPrice;
item.rare = ItemRarityID.Orange;
item.UseSound = SoundID.Item15;
item.autoReuse = true;
item.shoot = ModContent.ProjectileType<SnakeEyesSummon>();
item.shootSpeed = 10f;
item.summon = true;
}
public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
{
Projectile.NewProjectile(Main.MouseWorld, Vector2.Zero, type, damage, knockBack, player.whoAmI);
return false;
}
public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ModContent.ItemType<MysteriousCircuitry>(), 7);
recipe.AddIngredient(ModContent.ItemType<DubiousPlating>(), 7);
recipe.AddIngredient(ModContent.ItemType<AerialiteBar>(), 7);
recipe.AddTile(TileID.Anvils);
recipe.SetResult(this);
recipe.AddRecipe();
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 610 B

@@ -0,0 +1,58 @@
using CalamityMod.Items.Materials;
using CalamityMod.Projectiles.DraedonsArsenal;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Weapons.DraedonsArsenal
{
public class StarSwallowerContainmentUnit : ModItem
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Star Swallower Containment Unit");
}
public override void SetDefaults()
{
item.shootSpeed = 10f;
item.damage = 20;
item.mana = 10;
item.width = 18;
item.height = 28;
item.useTime = item.useAnimation = 30;
item.useStyle = ItemUseStyleID.HoldingUp;
item.noMelee = true;
item.knockBack = 2.25f;
item.value = CalamityGlobalItem.Rarity3BuyPrice;
item.rare = 3;
item.UseSound = SoundID.Item15;
item.autoReuse = true;
item.shoot = ModContent.ProjectileType<StarSwallowerSummon>();
item.shootSpeed = 10f;
item.summon = true;
}
public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
{
Point mouseTileCoords = Main.MouseWorld.ToTileCoordinates();
if (!CalamityUtils.ParanoidTileRetrieval(mouseTileCoords.X, mouseTileCoords.Y).active())
{
Projectile.NewProjectile(Main.MouseWorld, Vector2.Zero, type, damage, knockBack, player.whoAmI);
}
return false;
}
public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ModContent.ItemType<MysteriousCircuitry>(), 6);
recipe.AddIngredient(ModContent.ItemType<DubiousPlating>(), 6);
recipe.AddIngredient(ModContent.ItemType<AerialiteBar>(), 8);
recipe.AddTile(TileID.Anvils);
recipe.SetResult(this);
recipe.AddRecipe();
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 419 B

+14 -10
View File
@@ -1,4 +1,6 @@
using CalamityMod.Items.Materials;
using CalamityMod.Projectiles.DraedonsArsenal;
using CalamityMod.Tiles.Furniture.CraftingStations;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
@@ -40,6 +42,8 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal
item.shoot = ModContent.ProjectileType<TeslaCannonShot>();
item.shootSpeed = 1f;
item.useAmmo = AmmoID.Bullet;
item.Calamity().Chargeable = true;
}
public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
@@ -73,16 +77,16 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal
return new Vector2(-20, 0);
}
/*public override void AddRecipes()
public override void AddRecipes()
{
ModRecipe r = new ModRecipe(mod);
r.AddIngredient(null, "CrownJewel");
r.AddIngredient(null, "GalacticaSingularity", 5);
r.AddIngredient(null, "BarofLife", 10);
r.AddIngredient(null, "CosmiliteBar", 15);
r.AddTile(TileID.LunarCraftingStation);
r.SetResult(this);
r.AddRecipe();
}*/
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ModContent.ItemType<MysteriousCircuitry>(), 15);
recipe.AddIngredient(ModContent.ItemType<DubiousPlating>(), 15);
recipe.AddIngredient(ModContent.ItemType<AuricBar>(), 5);
recipe.AddIngredient(ItemID.ChargedBlasterCannon);
recipe.AddTile(ModContent.TileType<DraedonsForge>());
recipe.SetResult(this);
recipe.AddRecipe();
}
}
}
+8 -8
View File
@@ -4194,7 +4194,7 @@ namespace CalamityMod.NPCs
}
npc.ai[1] += 0.0333333351f;
float velocity = 18f + (enrageScale - 1) * 6f;
float velocity = 16f + (enrageScale - 1) * 4f;
float scaleFactor18 = velocity + npc.ai[1];
float num1310 = 4f;
value54.Normalize();
@@ -4211,7 +4211,7 @@ namespace CalamityMod.NPCs
Vector2 vector206 = player.Center - npc.Center;
vector206.Y -= 12f;
float scaleFactor19 = 32f + (enrageScale - 1) * 4f;
float scaleFactor19 = 28f + (enrageScale - 1) * 4f;
float num1311 = 8f;
vector206.Normalize();
vector206 *= scaleFactor19;
@@ -4243,14 +4243,14 @@ namespace CalamityMod.NPCs
// Charge
else if (npc.ai[0] == 3.2f)
{
npc.damage = (int)(npc.defDamage * 1.5);
npc.damage = (int)(npc.defDamage * 1.3);
npc.collideX = false;
npc.collideY = false;
npc.noTileCollide = true;
npc.ai[2] += 0.0333333351f;
float velocity = 32f + (enrageScale - 1) * 4f;
float velocity = 28f + (enrageScale - 1) * 4f;
npc.velocity.X = (velocity + npc.ai[2]) * npc.ai[1];
if ((npc.ai[1] > 0f && npc.Center.X > player.Center.X + (chargeDistance - 140f)) || (npc.ai[1] < 0f && npc.Center.X < player.Center.X - (chargeDistance - 140f)))
@@ -4847,7 +4847,7 @@ namespace CalamityMod.NPCs
if (Main.netMode != NetmodeID.MultiplayerClient)
{
Vector2 vector6 = Vector2.Normalize(player.Center - vector) * (npc.width + 20) / 2f + vector;
NPC.NewNPC((int)vector6.X, (int)vector6.Y + 45, ModContent.NPCType<OldDukeToothBall>(), 0, 0f, 0f, 0f, 0f, 255);
NPC.NewNPC((int)vector6.X, (int)vector6.Y + 45, ModContent.NPCType<OldDukeToothBall>());
}
}
@@ -5115,7 +5115,7 @@ namespace CalamityMod.NPCs
if (Main.netMode != NetmodeID.MultiplayerClient)
{
Vector2 vector10 = Vector2.Normalize(npc.velocity) * (npc.width + 20) / 2f + vector;
int num31 = NPC.NewNPC((int)vector10.X, (int)vector10.Y + 45, ModContent.NPCType<OldDukeToothBall>(), 0, 0f, 0f, 0f, 0f, 255);
int num31 = NPC.NewNPC((int)vector10.X, (int)vector10.Y + 45, ModContent.NPCType<OldDukeToothBall>());
Main.npc[num31].target = npc.target;
Main.npc[num31].velocity = Vector2.Normalize(npc.velocity).RotatedBy(MathHelper.PiOver2 * npc.direction) * scaleFactor3;
Main.npc[num31].netUpdate = true;
@@ -5521,8 +5521,8 @@ namespace CalamityMod.NPCs
if (Main.netMode != NetmodeID.MultiplayerClient)
{
Vector2 vector10 = Vector2.Normalize(npc.velocity) * (float)(npc.width + 20) / 2f + vector;
int num31 = NPC.NewNPC((int)vector10.X, (int)vector10.Y + 45, ModContent.NPCType<OldDukeToothBall>(), 0, 0f, 0f, 0f, 0f, 255);
Vector2 vector10 = Vector2.Normalize(npc.velocity) * (npc.width + 20) / 2f + vector;
int num31 = NPC.NewNPC((int)vector10.X, (int)vector10.Y + 45, ModContent.NPCType<OldDukeToothBall>());
Main.npc[num31].target = npc.target;
Main.npc[num31].velocity = Vector2.Normalize(npc.velocity).RotatedBy(MathHelper.PiOver2 * npc.direction) * scaleFactor3;
Main.npc[num31].netUpdate = true;
+384 -387
View File
File diff suppressed because it is too large. Load diff
+1 -1
View File
@@ -2967,7 +2967,7 @@ namespace CalamityMod.NPCs
case 33:
if (npc.type != NPCType<Siren>() && npc.type != NPCType<Leviathan.Leviathan>() &&
npc.type != NPCType<AquaticAberration>() && npc.type != NPCType<Parasea>() &&
npc.type != NPCType<SirenClone>() && npc.type != NPCType<SirenIce>())
npc.type != NPCType<SirenIce>())
{
npc.active = false;
npc.netUpdate = true;
+51 -77
View File
@@ -95,11 +95,11 @@ namespace CalamityMod.NPCs.DevourerofGods
bool revenge = CalamityWorld.revenge;
bool death = CalamityWorld.death;
// Percent life remaining
float lifeRatio = npc.life / (float)npc.lifeMax;
// Percent life remaining
float lifeRatio = npc.life / (float)npc.lifeMax;
// Light
Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f);
Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f);
// Worm variable
if (npc.ai[3] > 0f)
@@ -160,9 +160,6 @@ namespace CalamityMod.NPCs.DevourerofGods
}
}
// Velocity
npc.velocity.Length();
// Spawn dust
if (npc.alpha != 0)
{
@@ -194,9 +191,9 @@ namespace CalamityMod.NPCs.DevourerofGods
segment = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), ModContent.NPCType<DevourerofGodsTail>(), npc.whoAmI);
Main.npc[segment].realLife = npc.whoAmI;
Main.npc[segment].ai[2] = (float)npc.whoAmI;
Main.npc[segment].ai[1] = (float)Previous;
Main.npc[Previous].ai[0] = (float)segment;
Main.npc[segment].ai[2] = npc.whoAmI;
Main.npc[segment].ai[1] = Previous;
Main.npc[Previous].ai[0] = segment;
NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, segment, 0f, 0f, 0f, 0);
Previous = segment;
}
@@ -226,9 +223,9 @@ namespace CalamityMod.NPCs.DevourerofGods
// Movement
int num180 = (int)(npc.position.X / 16f) - 1;
int num181 = (int)((npc.position.X + (float)npc.width) / 16f) + 2;
int num181 = (int)((npc.position.X + npc.width) / 16f) + 2;
int num182 = (int)(npc.position.Y / 16f) - 1;
int num183 = (int)((npc.position.Y + (float)npc.height) / 16f) + 2;
int num183 = (int)((npc.position.Y + npc.height) / 16f) + 2;
if (num180 < 0)
num180 = 0;
@@ -279,9 +276,9 @@ namespace CalamityMod.NPCs.DevourerofGods
float num188 = speed;
float num189 = turnSpeed;
Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f);
float num191 = player.position.X + (float)(player.width / 2);
float num192 = player.position.Y + (float)(player.height / 2);
Vector2 vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f);
float num191 = player.position.X + (player.width / 2);
float num192 = player.position.Y + (player.height / 2);
int num42 = -1;
int num43 = (int)(player.Center.X / 16f);
int num44 = (int)(player.Center.Y / 16f);
@@ -303,7 +300,7 @@ namespace CalamityMod.NPCs.DevourerofGods
if (num42 > 0)
{
num42 *= 16;
float num47 = (float)(num42 - 800);
float num47 = num42 - 800;
if (player.position.Y > num47)
{
num192 = num47;
@@ -322,6 +319,12 @@ namespace CalamityMod.NPCs.DevourerofGods
num189 = homingTurnSpeed;
}
if (revenge)
{
num188 += Vector2.Distance(player.Center, npc.Center) * 0.005f * (1f - lifeRatio);
num189 += Vector2.Distance(player.Center, npc.Center) * 0.0001f * (1f - lifeRatio);
}
float num48 = num188 * 1.3f;
float num49 = num188 * 0.7f;
float num50 = npc.velocity.Length();
@@ -339,50 +342,15 @@ namespace CalamityMod.NPCs.DevourerofGods
}
}
if (num42 > 0)
{
for (int num51 = 0; num51 < 200; num51++)
{
if (Main.npc[num51].active && Main.npc[num51].type == npc.type && num51 != npc.whoAmI)
{
Vector2 vector3 = Main.npc[num51].Center - npc.Center;
if (vector3.Length() < 400f)
{
vector3.Normalize();
vector3 *= 1000f;
num191 -= vector3.X;
num192 -= vector3.Y;
}
}
}
}
else
{
for (int num52 = 0; num52 < 200; num52++)
{
if (Main.npc[num52].active && Main.npc[num52].type == npc.type && num52 != npc.whoAmI)
{
Vector2 vector4 = Main.npc[num52].Center - npc.Center;
if (vector4.Length() < 60f)
{
vector4.Normalize();
vector4 *= 200f;
num191 -= vector4.X;
num192 -= vector4.Y;
}
}
}
}
num191 = (float)((int)(num191 / 16f) * 16);
num192 = (float)((int)(num192 / 16f) * 16);
vector18.X = (float)((int)(vector18.X / 16f) * 16);
vector18.Y = (float)((int)(vector18.Y / 16f) * 16);
num191 = (int)(num191 / 16f) * 16;
num192 = (int)(num192 / 16f) * 16;
vector18.X = (int)(vector18.X / 16f) * 16;
vector18.Y = (int)(vector18.Y / 16f) * 16;
num191 -= vector18.X;
num192 -= vector18.Y;
float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192));
float num196 = System.Math.Abs(num191);
float num197 = System.Math.Abs(num192);
float num193 = (float)Math.Sqrt(num191 * num191 + num192 * num192);
float num196 = Math.Abs(num191);
float num197 = Math.Abs(num192);
float num198 = num188 / num193;
num191 *= num198;
num192 *= num198;
@@ -405,7 +373,7 @@ namespace CalamityMod.NPCs.DevourerofGods
npc.velocity.Y -= num189;
}
if ((double)System.Math.Abs(num192) < (double)num188 * 0.2 && ((npc.velocity.X > 0f && num191 < 0f) || (npc.velocity.X < 0f && num191 > 0f)))
if (Math.Abs(num192) < num188 * 0.2 && ((npc.velocity.X > 0f && num191 < 0f) || (npc.velocity.X < 0f && num191 > 0f)))
{
if (npc.velocity.Y > 0f)
npc.velocity.Y += num189 * 2f;
@@ -413,7 +381,7 @@ namespace CalamityMod.NPCs.DevourerofGods
npc.velocity.Y -= num189 * 2f;
}
if ((double)System.Math.Abs(num191) < (double)num188 * 0.2 && ((npc.velocity.Y > 0f && num192 < 0f) || (npc.velocity.Y < 0f && num192 > 0f)))
if (Math.Abs(num191) < num188 * 0.2 && ((npc.velocity.Y > 0f && num192 < 0f) || (npc.velocity.Y < 0f && num192 > 0f)))
{
if (npc.velocity.X > 0f)
npc.velocity.X += num189 * 2f;
@@ -430,7 +398,7 @@ namespace CalamityMod.NPCs.DevourerofGods
else if (npc.velocity.X > num191)
npc.velocity.X -= num189 * 1.1f;
if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5)
if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < num188 * 0.5)
{
if (npc.velocity.Y > 0f)
npc.velocity.Y += num189;
@@ -445,7 +413,7 @@ namespace CalamityMod.NPCs.DevourerofGods
else if (npc.velocity.Y > num192)
npc.velocity.Y -= num189 * 1.1f;
if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5)
if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < num188 * 0.5)
{
if (npc.velocity.X > 0f)
npc.velocity.X += num189;
@@ -455,7 +423,7 @@ namespace CalamityMod.NPCs.DevourerofGods
}
}
npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f;
npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) + MathHelper.PiOver2;
if (calamityGlobalNPC.newAI[2] > 900f)
{
@@ -487,7 +455,13 @@ namespace CalamityMod.NPCs.DevourerofGods
turnSpeed += 0.12f * (1f - lifeRatio);
}
bool increaseSpeed = Vector2.Distance(player.Center, vector) > 3200f;
if (revenge)
{
speed += Vector2.Distance(player.Center, npc.Center) * 0.00005f * (1f - lifeRatio);
turnSpeed += Vector2.Distance(player.Center, npc.Center) * 0.00005f * (1f - lifeRatio);
}
bool increaseSpeed = Vector2.Distance(player.Center, vector) > 3200f;
// Enrage
if (Vector2.Distance(player.Center, vector) > 5600f)
@@ -507,12 +481,12 @@ namespace CalamityMod.NPCs.DevourerofGods
{
for (int num953 = num182; num953 < num183; num953++)
{
if (Main.tile[num952, num953] != null && ((Main.tile[num952, num953].nactive() && (Main.tileSolid[(int)Main.tile[num952, num953].type] || (Main.tileSolidTop[(int)Main.tile[num952, num953].type] && Main.tile[num952, num953].frameY == 0))) || Main.tile[num952, num953].liquid > 64))
if (Main.tile[num952, num953] != null && ((Main.tile[num952, num953].nactive() && (Main.tileSolid[Main.tile[num952, num953].type] || (Main.tileSolidTop[Main.tile[num952, num953].type] && Main.tile[num952, num953].frameY == 0))) || Main.tile[num952, num953].liquid > 64))
{
Vector2 vector105;
vector105.X = (float)(num952 * 16);
vector105.Y = (float)(num953 * 16);
if (npc.position.X + (float)npc.width > vector105.X && npc.position.X < vector105.X + 16f && npc.position.Y + (float)npc.height > vector105.Y && npc.position.Y < vector105.Y + 16f)
vector105.X = num952 * 16;
vector105.Y = num953 * 16;
if (npc.position.X + npc.width > vector105.X && npc.position.X < vector105.X + 16f && npc.position.Y + npc.height > vector105.Y && npc.position.Y < vector105.Y + 16f)
{
flies = true;
break;
@@ -549,16 +523,16 @@ namespace CalamityMod.NPCs.DevourerofGods
else
npc.localAI[1] = 0f;
Vector2 vector3 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f);
float num20 = player.position.X + (float)(player.width / 2);
float num21 = player.position.Y + (float)(player.height / 2);
num20 = (float)((int)(num20 / 16f) * 16);
num21 = (float)((int)(num21 / 16f) * 16);
vector3.X = (float)((int)(vector3.X / 16f) * 16);
vector3.Y = (float)((int)(vector3.Y / 16f) * 16);
Vector2 vector3 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f);
float num20 = player.position.X + (player.width / 2);
float num21 = player.position.Y + (player.height / 2);
num20 = (int)(num20 / 16f) * 16;
num21 = (int)(num21 / 16f) * 16;
vector3.X = (int)(vector3.X / 16f) * 16;
vector3.Y = (int)(vector3.Y / 16f) * 16;
num20 -= vector3.X;
num21 -= vector3.Y;
float num22 = (float)Math.Sqrt((double)(num20 * num20 + num21 * num21));
float num22 = (float)Math.Sqrt(num20 * num20 + num21 * num21);
if (!flies)
{
@@ -568,7 +542,7 @@ namespace CalamityMod.NPCs.DevourerofGods
if (npc.velocity.Y > fallSpeed)
npc.velocity.Y = fallSpeed;
if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)fallSpeed * 1.8)
if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < fallSpeed * 1.8)
{
if (npc.velocity.X < 0f)
npc.velocity.X -= speed * 1.1f;
@@ -686,7 +660,7 @@ namespace CalamityMod.NPCs.DevourerofGods
}
}
npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) + 1.57f;
npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) + MathHelper.PiOver2;
if (flies)
{
+11 -2
View File
@@ -525,7 +525,13 @@ namespace CalamityMod.NPCs.DevourerofGods
num189 = homingTurnSpeed;
}
float num48 = num188 * 1.3f;
if (revenge)
{
num188 += Vector2.Distance(player.Center, npc.Center) * 0.005f * (1f - lifeRatio);
num189 += Vector2.Distance(player.Center, npc.Center) * 0.0001f * (1f - lifeRatio);
}
float num48 = num188 * 1.3f;
float num49 = num188 * 0.7f;
float num50 = npc.velocity.Length();
if (num50 > 0f)
@@ -649,7 +655,10 @@ namespace CalamityMod.NPCs.DevourerofGods
if (expertMode)
turnSpeed += 0.12f * (1f - lifeRatio);
bool increaseSpeed = distanceFromTarget > 3200f;
if (revenge)
turnSpeed += Vector2.Distance(player.Center, npc.Center) * 0.00005f * (1f - lifeRatio);
bool increaseSpeed = distanceFromTarget > 3200f;
// Enrage
if (tooFarAway)
+2 -2
View File
@@ -20,8 +20,8 @@ namespace CalamityMod.NPCs.Leviathan
{
npc.aiStyle = -1;
npc.damage = 55;
npc.width = 70;
npc.height = 40;
npc.width = 50;
npc.height = 50;
npc.defense = 14;
npc.lifeMax = 1600;
if (CalamityWorld.bossRushActive)
+12 -7
View File
@@ -26,21 +26,27 @@ namespace CalamityMod.NPCs.Leviathan
private float GetIntensity()
{
if (this.UpdateLIndex())
if (UpdateLIndex())
{
float x = 0f;
if (this.LevIndex != -1)
if (LevIndex != -1)
{
x = Vector2.Distance(Main.player[Main.myPlayer].Center, Main.npc[this.LevIndex].Center);
x = Vector2.Distance(Main.player[Main.myPlayer].Center, Main.npc[LevIndex].Center);
}
return 1f - Utils.SmoothStep(3000f, 6000f, x);
float spawnAnimationTimer = 180f;
float intensityScalar = 1f;
if (Main.npc[CalamityGlobalNPC.leviathan].Calamity().newAI[3] < spawnAnimationTimer)
intensityScalar = MathHelper.Lerp(0f, intensityScalar, Main.npc[CalamityGlobalNPC.leviathan].Calamity().newAI[3] / spawnAnimationTimer);
return (1f - Utils.SmoothStep(3000f, 6000f, x)) * intensityScalar;
}
return 0f;
}
public override Color OnTileColor(Color inColor)
{
float intensity = this.GetIntensity();
float intensity = GetIntensity();
return new Color(Vector4.Lerp(new Vector4(0.5f, 0.8f, 1f, 1f), inColor.ToVector4(), 1f - intensity));
}
@@ -60,7 +66,6 @@ namespace CalamityMod.NPCs.Leviathan
break;
}
}
//this.DoGIndex = DoGIndex;
return LevIndex != -1;
}
@@ -68,7 +73,7 @@ namespace CalamityMod.NPCs.Leviathan
{
if (maxDepth >= 0 && minDepth < 0)
{
float intensity = this.GetIntensity();
float intensity = GetIntensity();
spriteBatch.Draw(Main.blackTileTexture, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), new Color(0, 0, 15) * intensity);
}
}
+129 -80
View File
@@ -46,7 +46,8 @@ namespace CalamityMod.NPCs.Leviathan
npc.knockBackResist = 0f;
npc.aiStyle = -1;
aiType = -1;
npc.value = Item.buyPrice(0, 15, 0, 0);
npc.Opacity = 0f;
npc.value = Item.buyPrice(0, 15, 0, 0);
for (int k = 0; k < npc.buffImmune.Length; k++)
{
npc.buffImmune[k] = true;
@@ -103,6 +104,8 @@ namespace CalamityMod.NPCs.Leviathan
public override void AI()
{
CalamityGlobalNPC calamityGlobalNPC = npc.Calamity();
CalamityGlobalNPC.leviathan = npc.whoAmI;
bool death = CalamityWorld.death || CalamityWorld.bossRushActive;
@@ -110,40 +113,58 @@ namespace CalamityMod.NPCs.Leviathan
bool expertMode = Main.expertMode || CalamityWorld.bossRushActive;
Vector2 vector = npc.Center;
// Is in spawning animation
float spawnAnimationTime = 180f;
bool spawnAnimation = calamityGlobalNPC.newAI[3] < spawnAnimationTime;
// Don't do damage during spawn animation
npc.damage = npc.defDamage;
if (spawnAnimation)
npc.damage = 0;
// Percent life remaining
float lifeRatio = npc.life / (float)npc.lifeMax;
// Phases
bool phase2 = (lifeRatio < 0.5f && expertMode) || death;
bool phase2 = lifeRatio < 0.7f && expertMode;
bool phase3 = lifeRatio < 0.4f;
bool phase4 = lifeRatio < 0.1f;
npc.spriteDirection = (npc.direction > 0) ? 1 : -1;
bool sirenAlive = false;
if (CalamityGlobalNPC.siren != -1)
{
sirenAlive = Main.npc[CalamityGlobalNPC.siren].active;
}
int soundChoiceRage = 92;
if (CalamityGlobalNPC.siren != -1)
{
if (Main.npc[CalamityGlobalNPC.siren].active)
{
if (Main.npc[CalamityGlobalNPC.siren].damage == 0)
{
sirenAlive = false;
}
}
}
int soundChoiceRage = 92;
int soundChoice = Utils.SelectRandom(Main.rand, new int[]
{
38,
39,
40
});
if (Main.rand.NextBool(600))
{
Main.PlaySound(SoundID.Zombie, (int)npc.position.X, (int)npc.position.Y, (sirenAlive && !death) ? soundChoice : soundChoiceRage);
}
if (Main.rand.NextBool(600) && !spawnAnimation)
Main.PlaySound(SoundID.Zombie, (int)npc.Center.X, (int)npc.Center.Y, (sirenAlive && !death) ? soundChoice : soundChoiceRage);
if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active)
{
npc.TargetClosest(true);
}
Player player = Main.player[npc.target];
bool flag6 = player.position.Y < 800f || player.position.Y > Main.worldSurface * 16.0 || (player.position.X > 6400f && player.position.X < (Main.maxTilesX * 16 - 6400));
npc.dontTakeDamage = flag6 && !CalamityWorld.bossRushActive;
npc.dontTakeDamage = (flag6 && !CalamityWorld.bossRushActive) || spawnAnimation;
if (!player.active || player.dead || Vector2.Distance(player.Center, vector) > 5600f)
{
@@ -178,17 +199,36 @@ namespace CalamityMod.NPCs.Leviathan
npc.ai[2] = 0f;
npc.netUpdate = true;
}
return;
}
}
else
{
if (npc.ai[0] == 0f)
// Slowly drift up when spawning
if (spawnAnimation)
{
float minSpawnVelocity = 0.4f;
float maxSpawnVelocity = 4f;
float velocityY = maxSpawnVelocity - MathHelper.Lerp(minSpawnVelocity, maxSpawnVelocity, calamityGlobalNPC.newAI[3] / spawnAnimationTime);
npc.velocity = new Vector2(0f, -velocityY);
if (calamityGlobalNPC.newAI[3] == 10f)
Main.PlaySound(SoundID.Zombie, (int)npc.Center.X, (int)npc.Center.Y, soundChoiceRage);
npc.Opacity = MathHelper.Clamp(calamityGlobalNPC.newAI[3] / spawnAnimationTime, 0f, 1f);
calamityGlobalNPC.newAI[3] += 1f;
return;
}
if (npc.ai[0] == 0f)
{
npc.TargetClosest(true);
float num412 = sirenAlive ? 3.5f : 7f;
float num413 = sirenAlive ? 0.1f : 0.2f;
if (expertMode && !sirenAlive)
float num412 = (sirenAlive && !phase4) ? 3.5f : 7f;
float num413 = (sirenAlive && !phase4) ? 0.1f : 0.2f;
if (expertMode && (!sirenAlive || phase4))
{
num412 += death ? 3.5f : 3.5f * (1f - lifeRatio);
num413 += death ? 0.1f : 0.1f * (1f - lifeRatio);
@@ -201,12 +241,10 @@ namespace CalamityMod.NPCs.Leviathan
int num414 = 1;
if (npc.position.X + (npc.width / 2) < player.position.X + player.width)
{
num414 = -1;
}
Vector2 vector40 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f);
float num415 = player.position.X + (player.width / 2) + (num414 * 800) - vector40.X;
float num415 = player.position.X + (player.width / 2) + (num414 * ((sirenAlive && !phase4) ? 1000f : 800f)) - vector40.X;
float num416 = player.position.Y + (player.height / 2) - vector40.Y;
float num417 = (float)Math.Sqrt(num415 * num415 + num416 * num416);
num417 = num412 / num417;
@@ -247,7 +285,11 @@ namespace CalamityMod.NPCs.Leviathan
}
npc.ai[1] += 1f;
if (npc.ai[1] >= 240f)
float phaseTimer = 240f;
if (!sirenAlive || phase4)
phaseTimer -= 120f * (1f - lifeRatio);
if (npc.ai[1] >= phaseTimer)
{
npc.ai[0] = 1f;
npc.ai[1] = 0f;
@@ -260,35 +302,40 @@ namespace CalamityMod.NPCs.Leviathan
if (!player.dead)
{
npc.ai[2] += 1f;
if (!sirenAlive || death)
if (!sirenAlive || death || phase4)
npc.ai[2] += 2f;
}
if (npc.ai[2] >= 75f)
{
npc.ai[2] = 0f;
vector40 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f + 160f);
vector40 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f + 20f);
num415 = player.position.X + (player.width / 2) - vector40.X;
num416 = player.position.Y + (player.height / 2) - vector40.Y;
if (Main.netMode != NetmodeID.MultiplayerClient)
{
float num418 = (sirenAlive && !death) ? 13.5f : 16f;
float num418 = (sirenAlive && !phase4 && !death) ? 13.5f : 16f;
int num419 = 40;
int num420 = ModContent.ProjectileType<LeviathanBomb>();
if (expertMode)
{
num418 = (sirenAlive && !death) ? 14f : 17f;
num419 = 33;
num418 = (sirenAlive && !phase4 && !death) ? 14f : 17f;
num419 = 33;
}
if (npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive))
{
num418 = 22f;
}
if (CalamityWorld.bossRushActive)
{
if (!sirenAlive || phase4)
{
num418 += 3f * (1f - lifeRatio);
num419 += expertMode ? 3 : 4;
}
if (CalamityWorld.bossRushActive)
num418 *= 1.5f;
}
num417 = (float)Math.Sqrt(num415 * num415 + num416 * num416);
num417 = num418 / num417;
@@ -305,45 +352,52 @@ namespace CalamityMod.NPCs.Leviathan
{
npc.TargetClosest(true);
Vector2 vector119 = new Vector2(npc.position.X + (npc.width / 2) + (Main.rand.Next(20) * npc.direction), npc.position.Y + npc.height * 0.8f);
Vector2 vector119 = new Vector2(npc.position.X + (npc.width / 2), npc.position.Y + npc.height * 0.8f);
Vector2 vector120 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f);
float num1058 = player.position.X + (player.width / 2) - vector120.X;
float num1059 = player.position.Y + (player.height / 2) - vector120.Y;
float num1060 = (float)Math.Sqrt(num1058 * num1058 + num1059 * num1059);
npc.ai[1] += revenge ? 2f : 1f;
if (!sirenAlive || death)
{
npc.ai[1] += 2.5f;
}
npc.ai[1] += 1f;
int num638 = 0;
for (int num639 = 0; num639 < 255; num639++)
{
if (Main.player[num639].active && !Main.player[num639].dead && (vector - Main.player[num639].Center).Length() < 1000f)
num638++;
}
npc.ai[1] += num638 / 2;
bool flag103 = false;
if (npc.ai[1] > 80f)
float num640 = 60f;
if (!sirenAlive || phase4)
num640 -= 40f * (1f - lifeRatio);
if (npc.ai[1] > num640)
{
npc.ai[1] = 0f;
npc.ai[2] += 1f;
flag103 = true;
}
int spawnLimit = sirenAlive ? 2 : 4;
int spawnLimit = (sirenAlive && !phase4) ? 2 : 4;
bool spawnParasea = NPC.CountNPCS(ModContent.NPCType<Parasea>()) < spawnLimit;
bool spawnAberration = !sirenAlive && !NPC.AnyNPCs(ModContent.NPCType<AquaticAberration>());
bool spawnAberration = (!sirenAlive || phase4) && !NPC.AnyNPCs(ModContent.NPCType<AquaticAberration>());
if (flag103 && (spawnParasea || spawnAberration))
{
Main.PlaySound(SoundID.Zombie, (int)npc.position.X, (int)npc.position.Y, soundChoice);
Main.PlaySound(SoundID.Zombie, (int)npc.Center.X, (int)npc.Center.Y, soundChoice);
if (Main.netMode != NetmodeID.MultiplayerClient)
{
int type = spawnAberration ? ModContent.NPCType<AquaticAberration>() : ModContent.NPCType<Parasea>();
NPC.NewNPC((int)vector119.X, (int)vector119.Y, type, 0, 0f, 0f, 0f, 0f, 255);
NPC.NewNPC((int)vector119.X, (int)vector119.Y, type);
}
}
if (num1060 > 1200f)
if (num1060 > ((sirenAlive && !phase4) ? 1000f : 800f))
{
float num1063 = sirenAlive ? 7f : 8f;
float num1064 = sirenAlive ? 0.05f : 0.065f;
if (expertMode && !sirenAlive)
float num1063 = (sirenAlive && !phase4) ? 7f : 8f;
float num1064 = (sirenAlive && !phase4) ? 0.05f : 0.065f;
if (expertMode && (!sirenAlive || phase4))
{
num1063 += death ? 4f : 4f * (1f - lifeRatio);
num1064 += death ? 0.03f : 0.03f * (1f - lifeRatio);
@@ -364,45 +418,35 @@ namespace CalamityMod.NPCs.Leviathan
{
npc.velocity.X += num1064;
if (npc.velocity.X < 0f && num1058 > 0f)
{
npc.velocity.X += num1064;
}
}
else if (npc.velocity.X > num1058)
{
npc.velocity.X -= num1064;
if (npc.velocity.X > 0f && num1058 < 0f)
{
npc.velocity.X -= num1064;
}
}
if (npc.velocity.Y < num1059)
{
npc.velocity.Y += num1064;
if (npc.velocity.Y < 0f && num1059 > 0f)
{
npc.velocity.Y += num1064;
}
}
else if (npc.velocity.Y > num1059)
{
npc.velocity.Y -= num1064;
if (npc.velocity.Y > 0f && num1059 < 0f)
{
npc.velocity.Y -= num1064;
}
}
}
else
{
npc.velocity *= 0.9f;
}
npc.spriteDirection = npc.direction;
if (npc.ai[2] > (sirenAlive ? 2f : 3f))
if (npc.ai[2] > ((sirenAlive && !phase4) ? 2f : 3f))
{
npc.ai[0] = phase2 ? 2f : 0f;
npc.ai[0] = (((phase2 || phase3) && !sirenAlive) || phase4) ? 2f : 0f;
npc.ai[1] = 0f;
npc.ai[2] = 0f;
npc.netUpdate = true;
@@ -420,14 +464,17 @@ namespace CalamityMod.NPCs.Leviathan
return;
}
float chargeDistance = sirenAlive ? 1100f : 900f;
float chargeDistance = (sirenAlive && !phase4) ? 1100f : 900f;
if (!sirenAlive || phase4)
chargeDistance -= 250f * (1f - lifeRatio);
if (npc.ai[1] % 2f == 0f)
{
int num24 = 7;
for (int j = 0; j < num24; j++)
{
Vector2 arg_E1C_0 = (Vector2.Normalize(npc.velocity) * new Vector2((npc.width + 50) / 2f, npc.height) * 0.75f).RotatedBy((j - (num24 / 2 - 1)) * 3.1415926535897931 / (float)num24, default) + vector;
Vector2 vector4 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * Main.rand.Next(3, 8);
Vector2 arg_E1C_0 = (Vector2.Normalize(npc.velocity) * new Vector2((npc.width + 50) / 2f, npc.height) * 0.75f).RotatedBy((j - (num24 / 2 - 1)) * MathHelper.Pi / num24) + vector;
Vector2 vector4 = ((float)(Main.rand.NextDouble() * MathHelper.Pi) - MathHelper.PiOver2).ToRotationVector2() * Main.rand.Next(3, 8);
int num25 = Dust.NewDust(arg_E1C_0 + vector4, 0, 0, 172, vector4.X * 2f, vector4.Y * 2f, 100, default, 1.4f);
Main.dust[num25].noGravity = true;
Main.dust[num25].noLight = true;
@@ -441,19 +488,17 @@ namespace CalamityMod.NPCs.Leviathan
{
npc.ai[1] += 1f;
npc.ai[2] = 0f;
float num1044 = revenge ? 20f : 18f;
if (revenge && !sirenAlive)
{
num1044 += death ? 4f : 4f * (1f - lifeRatio);
}
if (revenge && (!sirenAlive || phase4))
num1044 += death ? 6f : 6f * (1f - lifeRatio);
if (npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive))
{
num1044 += 4f;
}
if (CalamityWorld.bossRushActive)
{
num1044 *= 1.25f;
}
Vector2 vector117 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f);
float num1045 = player.position.X + (player.width / 2) - vector117.X;
@@ -463,13 +508,13 @@ namespace CalamityMod.NPCs.Leviathan
npc.velocity.X = num1045 * num1047;
npc.velocity.Y = num1046 * num1047;
npc.spriteDirection = npc.direction;
Main.PlaySound(SoundID.Zombie, (int)npc.position.X, (int)npc.position.Y, soundChoiceRage);
Main.PlaySound(SoundID.Zombie, (int)npc.Center.X, (int)npc.Center.Y, soundChoiceRage);
return;
}
float num1048 = revenge ? 7.5f : 6.5f;
float num1049 = revenge ? 0.12f : 0.11f;
if (revenge && !sirenAlive)
if (revenge && (!sirenAlive || phase4))
{
num1048 += death ? 6f : 6f * (1f - lifeRatio);
num1049 += death ? 0.1f : 0.1f * (1f - lifeRatio);
@@ -534,7 +579,7 @@ namespace CalamityMod.NPCs.Leviathan
npc.velocity *= 0.9f;
float num1052 = revenge ? 0.11f : 0.1f;
if (revenge && !sirenAlive)
if (revenge && (!sirenAlive || phase4))
{
npc.velocity *= death ? 0.81f : MathHelper.Lerp(0.81f, 1f, lifeRatio);
num1052 += death ? 0.1f : 0.1f * (1f - lifeRatio);
@@ -558,10 +603,10 @@ namespace CalamityMod.NPCs.Leviathan
}
if (npc.life <= 0)
{
npc.position.X = npc.position.X + (float)(npc.width / 2);
npc.position.Y = npc.position.Y + (float)(npc.height / 2);
npc.position.X = npc.position.X - (float)(npc.width / 2);
npc.position.Y = npc.position.Y - (float)(npc.height / 2);
npc.position.X = npc.position.X + (npc.width / 2);
npc.position.Y = npc.position.Y + (npc.height / 2);
npc.position.X = npc.position.X - (npc.width / 2);
npc.position.Y = npc.position.Y - (npc.height / 2);
for (int num621 = 0; num621 < 40; num621++)
{
int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, DustID.Blood, 0f, 0f, 100, default, 2f);
@@ -569,7 +614,7 @@ namespace CalamityMod.NPCs.Leviathan
if (Main.rand.NextBool(2))
{
Main.dust[num622].scale = 0.5f;
Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f;
Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f;
}
}
for (int num623 = 0; num623 < 70; num623++)
@@ -580,7 +625,7 @@ namespace CalamityMod.NPCs.Leviathan
num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, DustID.Blood, 0f, 0f, 100, default, 2f);
Main.dust[num624].velocity *= 2f;
}
float randomSpread = (float)(Main.rand.Next(-200, 200) / 100);
float randomSpread = Main.rand.Next(-200, 200) / 100;
Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/LeviathanGores/LeviGore"), 1f);
Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/LeviathanGores/LeviGore2"), 1f);
Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/LeviathanGores/LeviGore3"), 1f);
@@ -657,7 +702,7 @@ namespace CalamityMod.NPCs.Leviathan
public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor)
{
Texture2D texture = Main.npcTexture[npc.type];
if (npc.ai[0] == 1f)
if (npc.ai[0] == 1f || npc.Calamity().newAI[3] < 180f)
{
texture = Main.npcTexture[npc.type];
}
@@ -670,9 +715,13 @@ namespace CalamityMod.NPCs.Leviathan
int height = texture.Height / verticalFrameCount;
int width = texture.Width / horizontalFrameCount;
SpriteEffects spriteEffects = SpriteEffects.FlipHorizontally;
float xOffset = -50f;
if (npc.spriteDirection == -1)
{
spriteEffects = SpriteEffects.None;
Main.spriteBatch.Draw(texture, npc.Center - Main.screenPosition + new Vector2(0f, npc.gfxOffY), npc.frame, npc.GetAlpha(drawColor), npc.rotation, new Vector2((float)width / 2f, (float)height / 2f), npc.scale, spriteEffects, 0f);
xOffset *= -1f;
}
Main.spriteBatch.Draw(texture, npc.Center - Main.screenPosition + new Vector2(xOffset, npc.gfxOffY), npc.frame, npc.GetAlpha(drawColor), npc.rotation, new Vector2(width / 2f, height / 2f), npc.scale, spriteEffects, 0f);
return false;
}
@@ -692,7 +741,7 @@ namespace CalamityMod.NPCs.Leviathan
initialised = true;
}
//ensure width and height are set.
// Ensure width and height are set.
npc.frame.Width = width;
npc.frame.Height = height;
npc.frameCounter++;
+2 -2
View File
@@ -43,7 +43,7 @@ namespace CalamityMod.NPCs.Leviathan
public override void AI()
{
npc.TargetClosest(true);
Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.55f, 0.25f, 0f);
Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 0f, 0.25f, 0.55f);
for (int num569 = 0; num569 < 200; num569++)
{
if (Main.npc[num569].active && Main.npc[num569].boss)
@@ -86,7 +86,7 @@ namespace CalamityMod.NPCs.Leviathan
{
if (CalamityWorld.revenge && Main.rand.NextBool(4))
{
Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, Main.rand.NextBool(2) ? ModContent.ItemType<SirensHeart>() : ModContent.ItemType<SirensHeartAlt>());
Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType<SirensHeart>());
}
}
+240 -263
View File
@@ -17,7 +17,6 @@ namespace CalamityMod.NPCs.Leviathan
public class Siren : ModNPC
{
private bool spawnedLevi = false;
private bool secondClone = false;
private bool forceChargeFrames = false;
private int frameUsed = 0;
private static Texture2D sirenStabTexture = ModContent.GetTexture("CalamityMod/NPCs/Leviathan/SirenStabbing");
@@ -26,7 +25,7 @@ namespace CalamityMod.NPCs.Leviathan
public override void SetStaticDefaults()
{
DisplayName.SetDefault("The Siren");
DisplayName.SetDefault("Anahita");
Main.npcFrameCount[npc.type] = 6;
}
@@ -37,7 +36,7 @@ namespace CalamityMod.NPCs.Leviathan
npc.width = 100;
npc.height = 100;
npc.defense = 20;
npc.DR_NERD(0.05f);
npc.DR_NERD(0.2f);
npc.LifeMaxNERB(27400, 41600, 2600000);
double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01;
npc.lifeMax += (int)(npc.lifeMax * HPBoost);
@@ -88,20 +87,22 @@ namespace CalamityMod.NPCs.Leviathan
public override void SendExtraAI(BinaryWriter writer)
{
writer.Write(spawnedLevi);
writer.Write(secondClone);
writer.Write(forceChargeFrames);
writer.Write(npc.localAI[0]);
writer.Write(frameUsed);
writer.Write(npc.localAI[2]);
writer.Write(npc.localAI[3]);
writer.Write(frameUsed);
writer.Write(npc.dontTakeDamage);
}
public override void ReceiveExtraAI(BinaryReader reader)
{
spawnedLevi = reader.ReadBoolean();
secondClone = reader.ReadBoolean();
forceChargeFrames = reader.ReadBoolean();
npc.localAI[0] = reader.ReadSingle();
frameUsed = reader.ReadInt32();
npc.localAI[2] = reader.ReadSingle();
npc.localAI[3] = reader.ReadSingle();
frameUsed = reader.ReadInt32();
npc.dontTakeDamage = reader.ReadBoolean();
}
@@ -117,86 +118,143 @@ namespace CalamityMod.NPCs.Leviathan
if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active)
npc.TargetClosest(true);
// Check for Leviathan
bool leviAlive = false;
if (CalamityGlobalNPC.leviathan != -1)
leviAlive = Main.npc[CalamityGlobalNPC.leviathan].active;
// Variables
Player player = Main.player[npc.target];
bool death = CalamityWorld.death || CalamityWorld.bossRushActive;
bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive;
bool expertMode = Main.expertMode || CalamityWorld.bossRushActive;
Vector2 vector = npc.Center;
Vector2 spawnAt = vector + new Vector2(0f, npc.height / 2f);
bool isNotOcean = player.position.Y < 800f || player.position.Y > Main.worldSurface * 16.0 || (player.position.X > 6400f && player.position.X < (Main.maxTilesX * 16 - 6400));
bool isNotOcean = player.position.Y < 800f || player.position.Y > Main.worldSurface * 16.0 || (player.position.X > 6400f && player.position.X < (Main.maxTilesX * 16 - 6400));
float lifeRatio = npc.life / (float)npc.lifeMax;
float bubbleVelocity = CalamityWorld.bossRushActive ? 10f : 5f;
if (!leviAlive)
bubbleVelocity += 1.5f * (1f - lifeRatio);
// Percent life remaining
float lifeRatio = npc.life / (float)npc.lifeMax;
npc.damage = npc.defDamage;
// Phases
bool phase2 = lifeRatio < 0.66f || death;
bool phase3 = lifeRatio < 0.33f || (death && lifeRatio < 0.66f);
Vector2 vector = npc.Center;
// Check for Leviathan
bool leviAlive = false;
if (CalamityGlobalNPC.leviathan != -1)
leviAlive = Main.npc[CalamityGlobalNPC.leviathan].active;
// Phases
bool phase2 = lifeRatio < 0.7f;
bool phase3 = lifeRatio < 0.4f;
bool phase4 = lifeRatio < 0.1f;
// Spawn Leviathan and Clones, change music
if (Main.netMode != NetmodeID.MultiplayerClient)
{
if (phase2 || death)
if (phase3)
{
if (!spawnedLevi)
{
if (revenge)
NPC.NewNPC((int)spawnAt.X, (int)spawnAt.Y - 200, ModContent.NPCType<SirenClone>());
Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic");
if (calamityModMusic != null)
music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/LeviathanAndSiren");
else
music = MusicID.Boss3;
NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType<Leviathan>());
spawnedLevi = true;
}
}
// Spawn Clone
if (phase3 && revenge)
{
if (!secondClone)
{
NPC.NewNPC((int)spawnAt.X, (int)spawnAt.Y - 200, ModContent.NPCType<SirenClone>());
secondClone = true;
NPC.NewNPC((int)vector.X, (int)vector.Y + 480, ModContent.NPCType<Leviathan>(), 1);
spawnedLevi = true;
}
}
}
// Ice Shield
if (npc.ai[3] == 0f && npc.localAI[1] == 0f && Main.netMode != NetmodeID.MultiplayerClient)
{
int num6 = NPC.NewNPC((int)vector.X, (int)vector.Y, ModContent.NPCType<SirenIce>(), npc.whoAmI);
npc.ai[3] = num6 + 1;
npc.localAI[1] = -1f;
npc.netUpdate = true;
Main.npc[num6].ai[0] = npc.whoAmI;
Main.npc[num6].netUpdate = true;
}
// Ice Shield
if (npc.localAI[2] < 3f)
{
if (npc.ai[3] == 0f && npc.localAI[1] == 0f && Main.netMode != NetmodeID.MultiplayerClient)
{
int num6 = NPC.NewNPC((int)vector.X, (int)vector.Y, ModContent.NPCType<SirenIce>(), npc.whoAmI);
npc.ai[3] = num6 + 1;
npc.localAI[1] = -1f;
npc.localAI[2] += 1f;
npc.netUpdate = true;
Main.npc[num6].ai[0] = npc.whoAmI;
Main.npc[num6].netUpdate = true;
}
int num7 = (int)npc.ai[3] - 1;
if (num7 != -1 && Main.npc[num7].active && Main.npc[num7].type == ModContent.NPCType<SirenIce>())
npc.dontTakeDamage = true;
else
{
npc.dontTakeDamage = isNotOcean && !CalamityWorld.bossRushActive;
npc.ai[3] = 0f;
int num7 = (int)npc.ai[3] - 1;
if (num7 != -1 && Main.npc[num7].active && Main.npc[num7].type == ModContent.NPCType<SirenIce>())
npc.dontTakeDamage = true;
else
{
npc.dontTakeDamage = isNotOcean && !CalamityWorld.bossRushActive;
npc.ai[3] = 0f;
if (npc.localAI[1] == -1f)
npc.localAI[1] = revenge ? 600f : 1200f;
if (npc.localAI[1] > 0f)
npc.localAI[1] -= 1f;
}
if (npc.localAI[1] == -1f)
npc.localAI[1] = 1f;
else
{
switch ((int)npc.localAI[2])
{
case 1:
if (phase2)
npc.localAI[1] = 0f;
break;
case 2:
if (phase3)
npc.localAI[1] = 0f;
break;
}
}
}
}
else
{
npc.dontTakeDamage = isNotOcean && !CalamityWorld.bossRushActive;
// Alpha
if (isNotOcean)
int num7 = (int)npc.ai[3] - 1;
if (num7 != -1 && Main.npc[num7].active && Main.npc[num7].type == ModContent.NPCType<SirenIce>())
npc.dontTakeDamage = true;
}
if (phase3)
{
if (CalamityGlobalNPC.leviathan != -1)
{
if (Main.npc[CalamityGlobalNPC.leviathan].active)
{
if (Main.npc[CalamityGlobalNPC.leviathan].life / (float)Main.npc[CalamityGlobalNPC.leviathan].lifeMax >= 0.4f)
{
ChargeRotation(player, vector);
ChargeLocation(player, vector, false, true);
npc.alpha += 3;
if (npc.alpha >= 255)
npc.alpha = 255;
else
{
for (int k = 0; k < 3; k++)
{
int dust = Dust.NewDust(npc.position, npc.width, npc.height, 172, 0f, 0f, 100, default, 2f);
Main.dust[dust].noGravity = true;
Main.dust[dust].noLight = true;
}
}
npc.dontTakeDamage = true;
npc.damage = 0;
if (npc.ai[0] != -1f)
{
npc.ai[0] = -1f;
npc.ai[1] = 0f;
npc.ai[2] = 0f;
npc.localAI[0] = 0f;
npc.netUpdate = true;
}
return;
}
}
}
}
// Alpha
if (isNotOcean)
{
npc.alpha += 3;
if (npc.alpha >= 150)
@@ -254,6 +312,7 @@ namespace CalamityMod.NPCs.Leviathan
npc.localAI[0] = 0f;
npc.netUpdate = true;
}
return;
}
}
@@ -265,17 +324,12 @@ namespace CalamityMod.NPCs.Leviathan
// Phase switch
if (npc.ai[0] == -1f)
{
int random = (phase2 && expertMode) ? 3 : 2;
int num871 = Main.rand.Next(random);
int random = ((phase2 && expertMode && !leviAlive) || phase4) ? 4 : 3;
int num618;
do num618 = Main.rand.Next(random);
while (num618 == npc.ai[1] || num618 == 1);
if (num871 == 0)
num871 = phase3 ? 3 : 0;
else if (num871 == 1)
num871 = 2;
else
num871 = 3;
npc.ai[0] = num871;
npc.ai[0] = num618;
if (npc.ai[0] != 3f)
{
@@ -351,20 +405,27 @@ namespace CalamityMod.NPCs.Leviathan
npc.rotation = npc.velocity.X * 0.02f;
npc.TargetClosest(true);
Vector2 vector119 = new Vector2(npc.position.X + (npc.width / 2) + (Main.rand.Next(20) * npc.direction), npc.position.Y + npc.height * 0.8f);
Vector2 vector119 = new Vector2(npc.position.X + (npc.width / 2) + (15 * npc.direction), npc.position.Y + 30);
Vector2 vector120 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f);
float num1058 = player.position.X + (player.width / 2) - vector120.X;
float num1059 = player.position.Y + (player.height / 2) - vector120.Y;
float num1060 = (float)Math.Sqrt(num1058 * num1058 + num1059 * num1059);
npc.ai[1] += 1f;
if (phase2)
npc.ai[1] += 0.25f;
if (phase3)
npc.ai[1] += 0.25f;
int num638 = 0;
for (int num639 = 0; num639 < 255; num639++)
{
if (Main.player[num639].active && !Main.player[num639].dead && (vector - Main.player[num639].Center).Length() < 1000f)
num638++;
}
npc.ai[1] += num638 / 2;
bool flag103 = false;
if (npc.ai[1] > 20f)
float num640 = 20f;
if (!leviAlive || phase4)
num640 -= 12f * (1f - lifeRatio);
if (npc.ai[1] > num640)
{
npc.ai[1] = 0f;
npc.ai[2] += 1f;
@@ -376,13 +437,14 @@ namespace CalamityMod.NPCs.Leviathan
Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 85);
if (Main.netMode != NetmodeID.MultiplayerClient)
{
int num1061 = 371;
int num1062 = NPC.NewNPC((int)vector119.X, (int)vector119.Y - 30, num1061, 0, 0f, 0f, 0f, 0f, 255);
Main.npc[num1062].velocity.X = Main.rand.Next(-200, 201) * (CalamityWorld.bossRushActive ? 0.02f : 0.01f);
Main.npc[num1062].velocity.Y = Main.rand.Next(-200, 201) * (CalamityWorld.bossRushActive ? 0.02f : 0.01f);
Main.npc[num1062].localAI[0] = 60f;
Main.npc[num1062].netUpdate = true;
}
int spawn = NPC.NewNPC((int)vector119.X, (int)vector119.Y, NPCID.DetonatingBubble);
Main.npc[spawn].target = npc.target;
Main.npc[spawn].velocity = player.Center - vector119;
Main.npc[spawn].velocity.Normalize();
Main.npc[spawn].velocity *= bubbleVelocity;
Main.npc[spawn].netUpdate = true;
Main.npc[spawn].ai[3] = Main.rand.Next(80, 121) / 100f;
}
}
if (num1060 > 600f)
@@ -434,125 +496,88 @@ namespace CalamityMod.NPCs.Leviathan
}
}
// Float around and fire projectiles
// Fly near target and summon bullet hells
else if (npc.ai[0] == 2f)
{
npc.rotation = npc.velocity.X * 0.02f;
Vector2 vector121 = new Vector2(npc.position.X + (npc.width / 2), npc.position.Y + (npc.height / 2));
npc.ai[1] += 1f;
bool flag104 = false;
if (npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive))
Vector2 targetVector = player.Center + new Vector2(0f, -350f);
Vector2 vector3 = Vector2.Normalize(targetVector - vector - npc.velocity) * (CalamityWorld.bossRushActive ? 18f : 12f);
float acceleration = CalamityWorld.bossRushActive ? 0.5f : 0.25f;
if (Math.Abs(npc.Center.Y - targetVector.Y) > 50f || Math.Abs(npc.Center.X - player.Center.X) > 350f)
npc.SimpleFlyMovement(vector3, acceleration);
npc.ai[1] += 1f;
float divisor = 140f;
if (!leviAlive || phase4)
divisor -= (float)Math.Ceiling(50f * (1f - lifeRatio));
bool shootProjectiles = npc.ai[1] % divisor == 0f;
if (Main.netMode != NetmodeID.MultiplayerClient && shootProjectiles)
{
if (npc.ai[1] % 10f == 9f)
flag104 = true;
int projectileDamage = expertMode ? 26 : 32;
float projectileVelocity = expertMode ? 3f : 2f;
if (!leviAlive || phase4)
{
projectileDamage += expertMode ? 3 : 4;
projectileVelocity += 2f * (1f - lifeRatio);
}
int totalProjectiles = 8;
int projectileDistance = 600;
int projectileType = ModContent.ProjectileType<WaterSpear>();
switch ((int)npc.localAI[3])
{
case 0:
Main.PlaySound(SoundID.Item21, player.position);
break;
case 1:
totalProjectiles = 3;
projectileType = ModContent.ProjectileType<FrostMist>();
Main.PlaySound(SoundID.Item30, player.position);
break;
case 2:
totalProjectiles = 5;
projectileType = ModContent.ProjectileType<SirenSong>();
float soundPitch = (Main.rand.NextFloat() - 0.5f) * 0.5f;
Main.harpNote = soundPitch;
Main.PlaySound(SoundID.Item26, player.position);
break;
}
npc.localAI[3] += 1f;
if (npc.localAI[3] > 2f)
npc.localAI[3] = 0f;
if ((phase2 && !leviAlive) || phase4)
totalProjectiles += (int)(totalProjectiles * 0.67);
float radians = MathHelper.TwoPi / totalProjectiles;
for (int i = 0; i < totalProjectiles; i++)
{
Vector2 spawnVector = player.Center + Vector2.Normalize(new Vector2(0f, -projectileVelocity).RotatedBy(radians * i)) * projectileDistance;
Vector2 velocity = Vector2.Normalize(player.Center - spawnVector) * projectileVelocity;
Projectile.NewProjectile(spawnVector, velocity, projectileType, projectileDamage, 0f, Main.myPlayer);
}
}
else if (expertMode)
if (Math.Abs(npc.Center.X - player.Center.X) > 10f)
{
if ((phase3 && !leviAlive) || CalamityWorld.bossRushActive)
{
if (npc.ai[1] % 15f == 14f)
flag104 = true;
}
else if (phase2)
{
if (npc.ai[1] % 20f == 19f)
flag104 = true;
}
else if (npc.ai[1] % 25f == 24f)
flag104 = true;
float playerLocation = vector.X - player.Center.X;
npc.direction = playerLocation < 0f ? 1 : -1;
npc.spriteDirection = npc.direction;
}
else if (npc.ai[1] % 30f == 29f)
flag104 = true;
if (flag104 && (npc.position.Y + npc.height < player.position.Y || (!leviAlive && phase2)) && Collision.CanHit(vector121, 1, 1, player.position, player.width, player.height))
{
if (Main.netMode != NetmodeID.MultiplayerClient)
{
float num1070 = revenge ? 15f : 13f;
if (npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive))
num1070 = 24f;
else if (isNotOcean || (!leviAlive && phase2) || death)
num1070 = revenge ? 17f : 16f;
else
{
if (phase3)
num1070 += 2f;
}
float phaseTimer = 300f;
if (!leviAlive || phase4)
phaseTimer -= 150f * (1f - lifeRatio);
float num1071 = player.position.X + player.width * 0.5f - vector121.X;
float num1072 = player.position.Y + player.height * 0.5f - vector121.Y;
float num1073 = (float)Math.Sqrt(num1071 * num1071 + num1072 * num1072);
num1073 = num1070 / num1073;
num1071 *= num1073;
num1072 *= num1073;
int num1074 = expertMode ? 26 : 32;
int num1075 = ModContent.ProjectileType<WaterSpear>();
switch (Main.rand.Next(6))
{
case 0:
num1075 = ModContent.ProjectileType<SirenSong>();
break;
case 1:
num1075 = ModContent.ProjectileType<FrostMist>();
break;
case 2:
case 3:
case 4:
case 5:
num1075 = ModContent.ProjectileType<WaterSpear>();
break;
}
if (isNotOcean)
num1074 *= 2;
float ai0 = (!leviAlive && num1075 == ModContent.ProjectileType<FrostMist>()) ? 1f : 0f;
Projectile.NewProjectile(vector121.X, vector121.Y, num1071, num1072, num1075, num1074, 0f, Main.myPlayer, ai0, 0f);
}
}
if (npc.position.Y > player.position.Y - 300f)
{
if (npc.velocity.Y > 0f)
npc.velocity.Y *= 0.98f;
npc.velocity.Y -= CalamityWorld.bossRushActive ? 0.15f : 0.1f;
if (npc.velocity.Y > 4f)
npc.velocity.Y = 4f;
}
else if (npc.position.Y < player.position.Y - 500f)
{
if (npc.velocity.Y < 0f)
npc.velocity.Y *= 0.98f;
npc.velocity.Y += CalamityWorld.bossRushActive ? 0.15f : 0.1f;
if (npc.velocity.Y < -4f)
npc.velocity.Y = -4f;
}
if (npc.position.X + (npc.width / 2) > player.position.X + (player.width / 2) + 100f)
{
if (npc.velocity.X > 0f)
npc.velocity.X *= 0.98f;
npc.velocity.X -= CalamityWorld.bossRushActive ? 0.15f : 0.1f;
if (npc.velocity.X > 8f)
npc.velocity.X = 8f;
}
if (npc.position.X + (npc.width / 2) < player.position.X + (player.width / 2) - 100f)
{
if (npc.velocity.X < 0f)
npc.velocity.X *= 0.98f;
npc.velocity.X += CalamityWorld.bossRushActive ? 0.15f : 0.1f;
if (npc.velocity.X < -8f)
npc.velocity.X = -8f;
}
float playerLocation = vector.X - player.Center.X;
npc.direction = playerLocation < 0f ? 1 : -1;
npc.spriteDirection = npc.direction;
if (npc.ai[1] >= 300f)
if (npc.ai[1] >= phaseTimer)
{
npc.ai[0] = -1f;
npc.ai[1] = 0f;
npc.ai[1] = 2f;
npc.netUpdate = true;
}
}
@@ -560,26 +585,23 @@ namespace CalamityMod.NPCs.Leviathan
// Set up charge
else if (npc.ai[0] == 3f)
{
ChargeLocation(player, vector, leviAlive, revenge);
ChargeLocation(player, vector, leviAlive && !phase4, revenge);
npc.ai[1] += 1f;
if (npc.ai[1] >= (revenge ? 40f : 60f))
if (npc.ai[1] >= (revenge ? 45f : 60f))
{
forceChargeFrames = true;
npc.ai[0] = npc.ai[2] >= (leviAlive ? 2f : 3f) ? -1f : 4f;
npc.ai[1] = 0f;
npc.ai[0] = npc.ai[2] >= ((leviAlive && !phase4) ? 2f : 3f) ? -1f : 4f;
npc.ai[1] = npc.ai[2] >= ((leviAlive && !phase4) ? 2f : 3f) ? 3f : 0f;
npc.localAI[0] = 0f;
// Velocity and rotation
float chargeVelocity = leviAlive ? 16f : 21f;
float chargeVelocity = CalamityWorld.bossRushActive ? 31f : (leviAlive && !phase4) ? 21f : 26f;
if (revenge)
chargeVelocity += 2f + (death ? 4f : 4f * (1f - lifeRatio));
if (CalamityWorld.bossRushActive)
chargeVelocity = 26f;
npc.velocity = Vector2.Normalize(player.Center - vector) * chargeVelocity;
npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X);
@@ -590,7 +612,7 @@ namespace CalamityMod.NPCs.Leviathan
npc.direction = num22;
if (npc.spriteDirection == 1)
npc.rotation += 3.14159274f;
npc.rotation += MathHelper.Pi;
npc.spriteDirection = -npc.direction;
}
@@ -600,12 +622,14 @@ namespace CalamityMod.NPCs.Leviathan
// Charge
else if (npc.ai[0] == 4f)
{
// Spawn dust
int num24 = 7;
npc.damage = (int)(npc.defDamage * 1.5);
// Spawn dust
int num24 = 7;
for (int j = 0; j < num24; j++)
{
Vector2 arg_E1C_0 = (Vector2.Normalize(npc.velocity) * new Vector2((npc.width + 50) / 2f, npc.height) * 0.75f).RotatedBy((j - (num24 / 2 - 1)) * 3.1415926535897931 / (float)num24, default) + vector;
Vector2 vector4 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * Main.rand.Next(3, 8);
Vector2 arg_E1C_0 = (Vector2.Normalize(npc.velocity) * new Vector2((npc.width + 50) / 2f, npc.height) * 0.75f).RotatedBy((j - (num24 / 2 - 1)) * MathHelper.Pi / num24) + vector;
Vector2 vector4 = ((float)(Main.rand.NextDouble() * MathHelper.Pi) - MathHelper.PiOver2).ToRotationVector2() * Main.rand.Next(3, 8);
int num25 = Dust.NewDust(arg_E1C_0 + vector4, 0, 0, 172, vector4.X * 2f, vector4.Y * 2f, 100, default, 1.4f);
Main.dust[num25].noGravity = true;
Main.dust[num25].noLight = true;
@@ -614,7 +638,7 @@ namespace CalamityMod.NPCs.Leviathan
}
npc.ai[1] += 1f;
if (npc.ai[1] >= (leviAlive ? 45f : 35f))
if (npc.ai[1] >= ((leviAlive && !phase4) ? 50f : 35f))
{
npc.ai[0] = 3f;
npc.ai[1] = 0f;
@@ -629,82 +653,35 @@ namespace CalamityMod.NPCs.Leviathan
{
float num17 = (float)Math.Atan2(player.Center.Y - vector.Y, player.Center.X - vector.X);
if (npc.spriteDirection == 1)
num17 += 3.14159274f;
num17 += MathHelper.Pi;
if (num17 < 0f)
num17 += 6.28318548f;
if (num17 > 6.28318548f)
num17 -= 6.28318548f;
num17 += MathHelper.TwoPi;
if (num17 > MathHelper.TwoPi)
num17 -= MathHelper.TwoPi;
float num18 = 0.04f;
if (npc.ai[0] == 4f)
num18 = 0f;
if (npc.rotation < num17)
{
if ((num17 - npc.rotation) > 3.1415926535897931)
npc.rotation -= num18;
else
npc.rotation += num18;
}
if (npc.rotation > num17)
{
if ((npc.rotation - num17) > 3.1415926535897931)
npc.rotation += num18;
else
npc.rotation -= num18;
}
if (npc.rotation > num17 - num18 && npc.rotation < num17 + num18)
npc.rotation = num17;
if (npc.rotation < 0f)
npc.rotation += 6.28318548f;
if (npc.rotation > 6.28318548f)
npc.rotation -= 6.28318548f;
if (npc.rotation > num17 - num18 && npc.rotation < num17 + num18)
npc.rotation = num17;
}
if (num18 != 0f)
npc.rotation = npc.rotation.AngleTowards(num17, num18);
}
// Move to charge location
private void ChargeLocation(Player player, Vector2 vector, bool leviAlive, bool revenge)
{
float distance = leviAlive ? 400f : 350f;
float distance = leviAlive ? 600f : 500f;
// Velocity
if (npc.localAI[0] == 0f)
npc.localAI[0] = (int)distance * Math.Sign((vector - player.Center).X);
Vector2 vector3 = Vector2.Normalize(player.Center + new Vector2(npc.localAI[0], -distance) - vector - npc.velocity) * 9f;
float acceleration = revenge ? 0.75f : 0.5f;
if (CalamityWorld.bossRushActive)
acceleration = 1f;
Vector2 vector3 = Vector2.Normalize(player.Center + new Vector2(npc.localAI[0], -distance) - vector - npc.velocity) * 12f;
float acceleration = CalamityWorld.bossRushActive ? 1f : revenge ? 0.75f : 0.5f;
npc.SimpleFlyMovement(vector3, acceleration);
if (npc.velocity.X < vector3.X)
{
npc.velocity.X += acceleration;
if (npc.velocity.X < 0f && vector3.X > 0f)
npc.velocity.X += acceleration;
}
else if (npc.velocity.X > vector3.X)
{
npc.velocity.X -= acceleration;
if (npc.velocity.X > 0f && vector3.X < 0f)
npc.velocity.X -= acceleration;
}
if (npc.velocity.Y < vector3.Y)
{
npc.velocity.Y += acceleration;
if (npc.velocity.Y < 0f && vector3.Y > 0f)
npc.velocity.Y += acceleration;
}
else if (npc.velocity.Y > vector3.Y)
{
npc.velocity.Y -= acceleration;
if (npc.velocity.Y > 0f && vector3.Y < 0f)
npc.velocity.Y -= acceleration;
}
// Rotation
int num22 = Math.Sign(player.Center.X - vector.X);
// Rotation
int num22 = Math.Sign(player.Center.X - vector.X);
if (num22 != 0)
{
if (npc.ai[1] == 0f && num22 != npc.direction)
-104
View File
@@ -1,104 +0,0 @@
using CalamityMod.Projectiles.Boss;
using CalamityMod.World;
using Microsoft.Xna.Framework;
using System;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.NPCs.Leviathan
{
public class SirenClone : ModNPC
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Siren Clone");
Main.npcFrameCount[npc.type] = 6;
}
public override void SetDefaults()
{
npc.aiStyle = -1;
aiType = -1;
npc.damage = 0;
npc.width = 70;
npc.height = 120;
npc.lifeMax = 3000;
npc.knockBackResist = 0f;
npc.noGravity = true;
npc.chaseable = false;
npc.dontTakeDamage = true;
npc.HitSound = SoundID.NPCHit1;
npc.alpha = 255;
}
public override void FindFrame(int frameHeight)
{
npc.frameCounter += 0.1f;
npc.frameCounter %= Main.npcFrameCount[npc.type];
int frame = (int)npc.frameCounter;
npc.frame.Y = frame * frameHeight;
}
public override void AI()
{
Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0f, 0.5f, 0.3f);
if (CalamityGlobalNPC.siren < 0 || !Main.npc[CalamityGlobalNPC.siren].active)
{
npc.active = false;
npc.netUpdate = true;
return;
}
if (npc.alpha > 50)
{
npc.alpha -= 5;
}
npc.TargetClosest(true);
Vector2 center = npc.Center;
int num14 = Math.Sign(Main.player[npc.target].Center.X - center.X);
if (num14 != 0)
{
npc.direction = npc.spriteDirection = num14;
}
Vector2 direction = Main.player[npc.target].Center - center;
direction.Normalize();
direction *= CalamityWorld.bossRushActive ? 16f : 11f;
npc.ai[0] += 1f;
if (npc.ai[0] > 45f)
{
npc.ai[0] = 0f;
if (Main.netMode != NetmodeID.MultiplayerClient)
{
int damage = Main.expertMode ? 26 : 32;
Projectile.NewProjectile(center.X, center.Y, direction.X, direction.Y, ModContent.ProjectileType<WaterSpear>(), damage, 0f, npc.target);
}
}
}
public override bool CheckActive()
{
return false;
}
public override void ScaleExpertStats(int numPlayers, float bossLifeScale)
{
npc.lifeMax = 3000;
npc.damage = 0;
}
public override void HitEffect(int hitDirection, double damage)
{
for (int k = 0; k < 5; k++)
{
Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f);
}
if (npc.life <= 0)
{
for (int k = 0; k < 20; k++)
{
Dust.NewDust(npc.position, npc.width, npc.height, 67, hitDirection, -1f, 0, default, 1f);
}
}
}
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

+42 -14
View File
@@ -1,5 +1,6 @@
using CalamityMod.World;
using Microsoft.Xna.Framework;
using System.IO;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
@@ -34,26 +35,45 @@ namespace CalamityMod.NPCs.Leviathan
npc.DeathSound = SoundID.NPCDeath7;
}
public override void AI()
public override void SendExtraAI(BinaryWriter writer)
{
writer.Write(npc.dontTakeDamage);
}
public override void ReceiveExtraAI(BinaryReader reader)
{
npc.dontTakeDamage = reader.ReadBoolean();
}
public override void AI()
{
if (npc.alpha > 100)
int num989 = (int)npc.ai[0];
if (Main.npc[num989].active && Main.npc[num989].type == ModContent.NPCType<Siren>())
{
npc.alpha -= 2;
}
Player player = Main.player[npc.target];
int num989 = (int)npc.ai[0];
if (Main.npc[num989].active && Main.npc[num989].type == ModContent.NPCType<Siren>())
{
npc.rotation = Main.npc[num989].rotation;
if (npc.alpha > 100 && npc.ai[1] == 0f)
npc.alpha -= 2;
if (Main.npc[num989].damage == 0)
npc.ai[1] = 1f;
else
npc.ai[1] = 0f;
if (npc.ai[1] == 1f)
npc.alpha = Main.npc[num989].alpha;
npc.dontTakeDamage = Main.npc[num989].damage == 0;
npc.rotation = Main.npc[num989].rotation;
npc.spriteDirection = Main.npc[num989].direction;
npc.velocity = Vector2.Zero;
npc.position = Main.npc[num989].Center;
npc.position.X = npc.position.X - (float)(npc.width / 2) + ((npc.spriteDirection == 1) ? -20f : 20f);
npc.position.Y = npc.position.Y - (float)(npc.height / 2) - 30;
npc.position.X = npc.position.X - (npc.width / 2) + ((npc.spriteDirection == 1) ? -20f : 20f);
npc.position.Y = npc.position.Y - (npc.height / 2) - 30;
npc.gfxOffY = Main.npc[num989].gfxOffY;
Lighting.AddLight((int)npc.Center.X / 16, (int)npc.Center.Y / 16, 0f, 0.8f, 1.1f);
return;
}
npc.dontTakeDamage = false;
npc.life = 0;
npc.HitEffect(0, 10.0);
npc.active = false;
@@ -74,14 +94,22 @@ namespace CalamityMod.NPCs.Leviathan
}
}
public override Color? GetAlpha(Color drawColor)
public override bool CanHitPlayer(Player target, ref int cooldownSlot) => npc.ai[1] == 0f;
public override Color? GetAlpha(Color drawColor)
{
return new Color(200, 200, 200, npc.alpha);
if (npc.ai[1] == 1f)
return Color.Transparent;
return new Color(200, 200, 200, npc.alpha);
}
public override void OnHitPlayer(Player player, int damage, bool crit)
{
player.AddBuff(BuffID.Frostburn, 240, true);
if (npc.ai[1] == 1f)
return;
player.AddBuff(BuffID.Frostburn, 240, true);
}
public override void HitEffect(int hitDirection, double damage)
+9 -5
View File
@@ -93,16 +93,20 @@ namespace CalamityMod.NPCs.OldDuke
npc.active = false;
return;
}
npc.ai[3] += 1f;
npc.dontTakeDamage = (npc.ai[3] >= 600f ? false : true);
npc.dontTakeDamage = npc.ai[3] >= 600f ? false : true;
if (npc.ai[3] >= 480f)
{
npc.velocity.Y *= 0.985f;
npc.velocity.X *= 0.985f;
npc.velocity *= 0.985f;
return;
}
float num1372 = 12f;
Vector2 vector167 = new Vector2(npc.Center.X + npc.direction * 20, npc.Center.Y + 6f);
if (Main.expertMode || CalamityWorld.bossRushActive)
num1372 += Vector2.Distance(player.Center, npc.Center) * 0.01f;
Vector2 vector167 = new Vector2(npc.Center.X + npc.direction * 20, npc.Center.Y + 6f);
float num1373 = player.position.X + player.width * 0.5f - vector167.X;
float num1374 = player.Center.Y - vector167.Y;
float num1375 = (float)Math.Sqrt(num1373 * num1373 + num1374 * num1374);
@@ -183,7 +187,7 @@ namespace CalamityMod.NPCs.OldDuke
npc.position.X = npc.position.X + (npc.width / 2);
npc.position.Y = npc.position.Y + (npc.height / 2);
npc.width = (npc.height = 96);
npc.width = npc.height = 96;
npc.position.X = npc.position.X - (npc.width / 2);
npc.position.Y = npc.position.Y - (npc.height / 2);
+33 -1
View File
@@ -75,12 +75,16 @@ namespace CalamityMod.NPCs.StormWeaver
{
writer.Write(invinceTime);
writer.Write(npc.dontTakeDamage);
writer.Write(npc.localAI[1]);
writer.Write(npc.localAI[2]);
}
public override void ReceiveExtraAI(BinaryReader reader)
{
invinceTime = reader.ReadInt32();
npc.dontTakeDamage = reader.ReadBoolean();
npc.localAI[1] = reader.ReadSingle();
npc.localAI[2] = reader.ReadSingle();
}
public override void AI()
@@ -278,8 +282,28 @@ namespace CalamityMod.NPCs.StormWeaver
{
if (npc.localAI[1] == 2f)
{
num188 += Vector2.Distance(Main.player[npc.target].Center, npc.Center) * 0.01f * (1f - (float)lifeRatio);
num189 += Vector2.Distance(Main.player[npc.target].Center, npc.Center) * 0.0001f * (1f - (float)lifeRatio);
num188 *= 2f;
num189 *= 0.75f;
float stopChargeDistance = 800f * npc.localAI[2];
if (stopChargeDistance < 0)
{
if (npc.Center.X < Main.player[npc.target].Center.X + stopChargeDistance)
{
npc.localAI[1] = 0f;
calamityGlobalNPC.newAI[0] = 0f;
}
}
else
{
if (npc.Center.X > Main.player[npc.target].Center.X + stopChargeDistance)
{
npc.localAI[1] = 0f;
calamityGlobalNPC.newAI[0] = 0f;
}
}
}
int dustAmt = 5;
@@ -347,7 +371,15 @@ namespace CalamityMod.NPCs.StormWeaver
}
if (revenge)
npc.velocity = Vector2.Normalize(Main.player[npc.target].Center - npc.Center) * num188 * 2f;
npc.velocity = Vector2.Normalize(Main.player[npc.target].Center - npc.Center) * (num188 + Vector2.Distance(Main.player[npc.target].Center, npc.Center) * 0.01f * (1f - (float)lifeRatio)) * 2f;
float chargeDirection = 0;
if (npc.velocity.X < 0f)
chargeDirection = -1f;
else if (npc.velocity.X > 0f)
chargeDirection = 1f;
npc.localAI[2] = chargeDirection;
}
num191 = (int)(num191 / 16f) * 16;
+3 -4
View File
@@ -1,6 +1,6 @@
using CalamityMod.Items.Placeables.Furniture;
using CalamityMod.Items.Potions.Alcohol;
using CalamityMod.Projectiles.Magic;
using CalamityMod.Projectiles.Typeless;
using CalamityMod.World;
using System.Collections.Generic;
using Terraria;
@@ -194,8 +194,7 @@ namespace CalamityMod.NPCs.TownNPCs
if (Main.player[Main.myPlayer].Calamity().chibii)
dialogue.Add("Is that a toy? Looks like something I'd carry around if I was 5 years old.");
if ((Main.player[Main.myPlayer].Calamity().sirenBoobs && !Main.player[Main.myPlayer].Calamity().sirenBoobsHide) ||
(Main.player[Main.myPlayer].Calamity().sirenBoobsAlt && !Main.player[Main.myPlayer].Calamity().sirenBoobsAltHide))
if (Main.player[Main.myPlayer].Calamity().sirenBoobs && !Main.player[Main.myPlayer].Calamity().sirenBoobsHide)
dialogue.Add("Nice scales...did it get hot in here?");
if (Main.player[Main.myPlayer].Calamity().fabsolVodka)
@@ -386,7 +385,7 @@ namespace CalamityMod.NPCs.TownNPCs
public override void TownNPCAttackProj(ref int projType, ref int attackDelay)
{
projType = ModContent.ProjectileType<FabRay>();
projType = ModContent.ProjectileType<CirrusRay>();
attackDelay = 1;
}
+1 -2
View File
@@ -123,8 +123,7 @@ namespace CalamityMod.NPCs.TownNPCs
dialogue.Add("Ah, nice duds, my child!");
}
if ((Main.player[Main.myPlayer].Calamity().sirenBoobs && !Main.player[Main.myPlayer].Calamity().sirenBoobsHide) ||
(Main.player[Main.myPlayer].Calamity().sirenBoobsAlt && !Main.player[Main.myPlayer].Calamity().sirenBoobsAltHide))
if (Main.player[Main.myPlayer].Calamity().sirenBoobs && !Main.player[Main.myPlayer].Calamity().sirenBoobsHide)
{
dialogue.Add("Shouldn't you be wearing a clam bra?");
}
+2 -2
View File
@@ -2130,7 +2130,7 @@ namespace CalamityMod.NPCs.Yharon
npc.ai[1] += 1f;
if (Main.netMode != NetmodeID.MultiplayerClient)
{
if (secondPhasePhase == 3)
if (secondPhasePhase >= 3)
{
// Rotate spiral by 9 * (240 / 12) = +90 degrees and then back -90 degrees
@@ -2178,7 +2178,7 @@ namespace CalamityMod.NPCs.Yharon
if (npc.ai[1] >= spinPhaseTimer)
{
npc.ai[0] = 1f;
npc.ai[1] = secondPhasePhase == 2 ? increasedIdleTimeAfterBulletHell : 0f;
npc.ai[1] = secondPhasePhase >= 2 ? increasedIdleTimeAfterBulletHell : 0f;
npc.ai[2] = 0f;
npc.localAI[2] = 0f;
npc.velocity /= 2f;
+15 -13
View File
@@ -1,3 +1,4 @@
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
@@ -16,36 +17,37 @@ namespace CalamityMod.Projectiles.Boss
projectile.width = 26;
projectile.height = 26;
projectile.hostile = true;
projectile.alpha = 60;
projectile.penetrate = 1;
projectile.tileCollide = false;
projectile.timeLeft = 120;
projectile.alpha = 60;
projectile.tileCollide = false;
projectile.timeLeft = 240;
}
public override void AI()
{
if (projectile.ai[1] == 0f)
if (projectile.timeLeft < 60)
projectile.Opacity = MathHelper.Clamp(projectile.timeLeft / 60f, 0f, 1f);
if (projectile.ai[1] == 0f)
{
projectile.ai[1] = 1f;
Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 33);
}
if (Main.rand.NextBool(2))
{
Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 173, 0f, 0f);
}
}
public override void Kill(int timeLeft)
{
for (int k = 0; k < 5; k++)
{
Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 173, 0f, 0f);
}
}
public override bool CanHitPlayer(Player target) => projectile.timeLeft >= 60;
public override void OnHitPlayer(Player target, int damage, bool crit)
public override void OnHitPlayer(Player target, int damage, bool crit)
{
target.AddBuff(BuffID.Weak, 120);
if (projectile.timeLeft < 60)
return;
target.AddBuff(BuffID.Weak, 120);
}
}
}
+14 -13
View File
@@ -1,3 +1,4 @@
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
@@ -16,19 +17,23 @@ namespace CalamityMod.Projectiles.Boss
projectile.width = 26;
projectile.height = 26;
projectile.hostile = true;
projectile.alpha = 60;
projectile.penetrate = 1;
projectile.tileCollide = false;
projectile.alpha = 60;
projectile.tileCollide = false;
projectile.timeLeft = 300;
}
public override void AI()
{
if (projectile.ai[1] == 0f)
if (projectile.timeLeft < 60)
projectile.Opacity = MathHelper.Clamp(projectile.timeLeft / 60f, 0f, 1f);
if (projectile.ai[1] == 0f)
{
projectile.ai[1] = 1f;
Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 33);
}
if (Main.rand.NextBool(2))
{
int dust = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 127, 0f, 0f);
@@ -36,18 +41,14 @@ namespace CalamityMod.Projectiles.Boss
}
}
public override void Kill(int timeLeft)
{
for (int k = 0; k < 5; k++)
{
int dust = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 127, 0f, 0f);
Main.dust[dust].noGravity = true;
}
}
public override bool CanHitPlayer(Player target) => projectile.timeLeft >= 60;
public override void OnHitPlayer(Player target, int damage, bool crit)
public override void OnHitPlayer(Player target, int damage, bool crit)
{
target.AddBuff(BuffID.Cursed, 90);
if (projectile.timeLeft < 60)
return;
target.AddBuff(BuffID.Cursed, 90);
}
}
}
+2 -2
View File
@@ -119,7 +119,7 @@ namespace CalamityMod.Projectiles.Boss
int damage = Main.expertMode ? 75 : 100;
if (projectile.ai[0] >= 1f)
{
x += 500f;
x += 750f;
if ((int)(x / 16f) > Main.maxTilesX - 10)
{
x = (Main.maxTilesX - 10) * 16f;
@@ -130,7 +130,7 @@ namespace CalamityMod.Projectiles.Boss
Main.projectile[num237].timeLeft = 900;
Main.projectile[num237].netUpdate = true;
x -= 1000f;
x -= 1500f;
if ((int)(x / 16f) < 10)
{
x = 160f;
+83 -98
View File
@@ -24,9 +24,10 @@ namespace CalamityMod.Projectiles.Boss
projectile.height = 20;
projectile.hostile = true;
projectile.ignoreWater = true;
projectile.tileCollide = false;
projectile.penetrate = -1;
projectile.timeLeft = 300;
projectile.alpha = 255;
projectile.Opacity = 0f;
projectile.coldDamage = true;
}
@@ -42,107 +43,91 @@ namespace CalamityMod.Projectiles.Boss
projectile.localAI[1] = reader.ReadSingle();
}
public override void AI()
{
projectile.frameCounter++;
if (projectile.frameCounter > 4)
{
projectile.frame++;
projectile.frameCounter = 0;
}
if (projectile.frame >= Main.projFrames[projectile.type])
{
projectile.frame = 0;
}
if (projectile.ai[1] == 0f)
{
for (int num621 = 0; num621 < 5; num621++)
{
int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 187, 0f, 0f, 100, default, 2f);
Main.dust[num622].velocity *= 3f;
if (Main.rand.NextBool(2))
{
Main.dust[num622].scale = 0.5f;
Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f;
}
}
projectile.ai[1] = 1f;
Main.PlaySound(SoundID.Item30, projectile.position);
}
projectile.localAI[1] += 1f;
if (projectile.localAI[1] == 16f)
{
projectile.localAI[1] = 0f;
for (int l = 0; l < 12; l++)
{
Vector2 vector3 = Vector2.UnitX * (float)-(float)projectile.width / 2f;
vector3 += -Vector2.UnitY.RotatedBy((double)((float)l * 3.14159274f / 6f), default) * new Vector2(8f, 16f);
vector3 = vector3.RotatedBy((double)(projectile.rotation - 1.57079637f), default);
int num9 = Dust.NewDust(projectile.Center, 0, 0, 187, 0f, 0f, 160, default, 1f);
Main.dust[num9].scale = 1.1f;
Main.dust[num9].noGravity = true;
Main.dust[num9].position = projectile.Center + vector3;
Main.dust[num9].velocity = projectile.velocity * 0.1f;
Main.dust[num9].velocity = Vector2.Normalize(projectile.Center - projectile.velocity * 3f - Main.dust[num9].position) * 1.25f;
}
}
if (projectile.localAI[0] == 0f)
{
projectile.scale -= 0.01f;
projectile.alpha += 10;
if (projectile.alpha >= 100)
{
projectile.alpha = 100;
projectile.localAI[0] = 1f;
}
}
else if (projectile.localAI[0] == 1f)
{
projectile.scale += 0.01f;
projectile.alpha -= 10;
if (projectile.alpha <= 0)
{
projectile.alpha = 0;
projectile.localAI[0] = 0f;
}
}
if (projectile.ai[0] == 1f)
{
int num103 = (int)Player.FindClosest(projectile.Center, 1, 1);
projectile.ai[1] += 1f;
if (projectile.ai[1] < 110f && projectile.ai[1] > 30f)
{
float scaleFactor2 = projectile.velocity.Length();
Vector2 vector11 = Main.player[num103].Center - projectile.Center;
vector11.Normalize();
vector11 *= scaleFactor2;
projectile.velocity = (projectile.velocity * 24f + vector11) / 25f;
projectile.velocity.Normalize();
projectile.velocity *= scaleFactor2;
}
if (projectile.velocity.Length() < 12f)
{
projectile.velocity *= 1.02f;
}
}
projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f;
Lighting.AddLight(projectile.Center, 0f, (255 - projectile.alpha) * 0.35f / 255f, (255 - projectile.alpha) * 0.35f / 255f);
}
public override void AI()
{
projectile.frameCounter++;
if (projectile.frameCounter > 4)
{
projectile.frame++;
projectile.frameCounter = 0;
}
if (projectile.frame >= Main.projFrames[projectile.type])
projectile.frame = 0;
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
{
CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1);
return false;
}
if (projectile.ai[1] == 0f)
{
for (int num621 = 0; num621 < 5; num621++)
{
int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 187, 0f, 0f, 100, default, 2f);
Main.dust[num622].velocity *= 3f;
if (Main.rand.NextBool(2))
{
Main.dust[num622].scale = 0.5f;
Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f;
}
}
projectile.ai[1] = 1f;
}
public override Color? GetAlpha(Color lightColor)
{
return new Color(200, 200, 200, projectile.alpha);
}
projectile.localAI[1] += 1f;
if (projectile.localAI[1] == 16f)
{
projectile.localAI[1] = 0f;
for (int l = 0; l < 12; l++)
{
Vector2 vector3 = Vector2.UnitX * -projectile.width / 2f;
vector3 += -Vector2.UnitY.RotatedBy(l * MathHelper.Pi / 6f) * new Vector2(8f, 16f);
vector3 = vector3.RotatedBy(projectile.rotation - MathHelper.PiOver2);
int num9 = Dust.NewDust(projectile.Center, 0, 0, 187, 0f, 0f, 160, default, 1f);
Main.dust[num9].scale = 1.1f;
Main.dust[num9].noGravity = true;
Main.dust[num9].position = projectile.Center + vector3;
Main.dust[num9].velocity = projectile.velocity * 0.1f;
Main.dust[num9].velocity = Vector2.Normalize(projectile.Center - projectile.velocity * 3f - Main.dust[num9].position) * 1.25f;
}
}
public override void OnHitPlayer(Player target, int damage, bool crit)
if (projectile.timeLeft < 60)
projectile.Opacity = MathHelper.Clamp(projectile.timeLeft / 60f, 0f, 1f);
else
projectile.Opacity = MathHelper.Clamp(1f - ((projectile.timeLeft - 240) / 60f), 0f, 1f);
int num103 = Player.FindClosest(projectile.Center, 1, 1);
projectile.ai[1] += 1f;
if (projectile.ai[1] < 140f && projectile.ai[1] > 60f)
{
float scaleFactor2 = projectile.velocity.Length();
Vector2 vector11 = Main.player[num103].Center - projectile.Center;
vector11.Normalize();
vector11 *= scaleFactor2;
projectile.velocity = (projectile.velocity * 24f + vector11) / 25f;
projectile.velocity.Normalize();
projectile.velocity *= scaleFactor2;
}
if (projectile.velocity.Length() < 12f)
projectile.velocity *= 1.02f;
projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2;
Lighting.AddLight(projectile.Center, 0f, 0.35f * projectile.Opacity, 0.35f * projectile.Opacity);
}
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
{
lightColor.R = (byte)(255 * projectile.Opacity);
lightColor.G = (byte)(255 * projectile.Opacity);
lightColor.B = (byte)(255 * projectile.Opacity);
CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1);
return false;
}
public override bool CanHitPlayer(Player target) => projectile.Opacity == 1f;
public override void OnHitPlayer(Player target, int damage, bool crit)
{
target.AddBuff(BuffID.Frostburn, 240, true);
if (projectile.Opacity != 1f)
return;
target.AddBuff(BuffID.Frostburn, 240, true);
target.AddBuff(BuffID.Chilled, 120, true);
target.AddBuff(BuffID.Frozen, 30, true);
}
+31 -21
View File
@@ -1,4 +1,5 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System.IO;
using Terraria;
using Terraria.ID;
@@ -11,15 +12,19 @@ namespace CalamityMod.Projectiles.Boss
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Musical Note");
}
ProjectileID.Sets.TrailCacheLength[projectile.type] = 4;
ProjectileID.Sets.TrailingMode[projectile.type] = 0;
}
public override void SetDefaults()
{
projectile.width = 24;
projectile.height = 58;
projectile.hostile = true;
projectile.tileCollide = false;
projectile.penetrate = -1;
projectile.timeLeft = 1800;
projectile.timeLeft = 480;
projectile.Opacity = 0f;
}
public override void SendExtraAI(BinaryWriter writer)
@@ -35,40 +40,45 @@ namespace CalamityMod.Projectiles.Boss
public override void AI()
{
projectile.velocity *= 0.985f;
if (projectile.localAI[0] == 0f)
if (projectile.timeLeft < 60)
projectile.Opacity = MathHelper.Clamp(projectile.timeLeft / 60f, 0f, 1f);
else
projectile.Opacity = MathHelper.Clamp(1f - ((projectile.timeLeft - 420) / 60f), 0f, 1f);
if (projectile.localAI[0] == 0f)
{
projectile.scale += 0.01f;
if (projectile.scale >= 1.1f)
{
projectile.localAI[0] = 1f;
}
}
else if (projectile.localAI[0] == 1f)
{
projectile.scale -= 0.01f;
if (projectile.scale <= 0.9f)
{
projectile.localAI[0] = 0f;
}
}
if (projectile.ai[1] == 0f)
{
projectile.ai[1] = 1f;
float soundPitch = (Main.rand.NextFloat() - 0.5f) * 0.5f;
Main.harpNote = soundPitch;
Main.PlaySound(SoundID.Item26, projectile.position);
}
Lighting.AddLight(projectile.Center, 0.7f, 0.5f, 0f);
Lighting.AddLight(projectile.Center, 0.7f * projectile.Opacity, 0.5f * projectile.Opacity, 0f);
}
public override Color? GetAlpha(Color lightColor)
{
return new Color(255, 255, 255, 0);
}
public override bool CanHitPlayer(Player target) => projectile.Opacity == 1f;
public override void OnHitPlayer(Player target, int damage, bool crit)
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
{
lightColor.R = (byte)(255 * projectile.Opacity);
lightColor.G = (byte)(255 * projectile.Opacity);
lightColor.B = (byte)(255 * projectile.Opacity);
CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1);
return false;
}
public override void OnHitPlayer(Player target, int damage, bool crit)
{
target.AddBuff(BuffID.Confused, 120);
if (projectile.Opacity != 1f)
return;
target.AddBuff(BuffID.Confused, 120);
}
}
}
+29 -38
View File
@@ -23,9 +23,10 @@ namespace CalamityMod.Projectiles.Boss
projectile.height = 14;
projectile.hostile = true;
projectile.ignoreWater = true;
projectile.tileCollide = false;
projectile.penetrate = -1;
projectile.timeLeft = 300;
projectile.alpha = 255;
projectile.Opacity = 0f;
}
public override void SendExtraAI(BinaryWriter writer)
@@ -40,58 +41,45 @@ namespace CalamityMod.Projectiles.Boss
public override void AI()
{
projectile.velocity *= 1.005f;
if (projectile.velocity.Length() < 10f)
projectile.velocity *= 1.01f;
if (projectile.ai[1] == 0f)
{
for (int num621 = 0; num621 < 20; num621++)
for (int num621 = 0; num621 < 10; num621++)
{
int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default, 2f);
Main.dust[num622].velocity *= 3f;
if (Main.rand.NextBool(2))
{
Main.dust[num622].scale = 0.5f;
Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f;
Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f;
}
}
projectile.ai[1] = 1f;
Main.PlaySound(SoundID.Item21, projectile.position);
}
if (projectile.localAI[0] == 0f)
{
projectile.scale -= 0.01f;
projectile.alpha += 10;
if (projectile.alpha >= 100)
{
projectile.alpha = 100;
projectile.localAI[0] = 1f;
}
}
else if (projectile.localAI[0] == 1f)
{
projectile.scale += 0.01f;
projectile.alpha -= 10;
if (projectile.alpha <= 0)
{
projectile.alpha = 0;
projectile.localAI[0] = 0f;
}
}
projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f;
Lighting.AddLight(projectile.Center, 0f, (255 - projectile.alpha) * 0.05f / 255f, (255 - projectile.alpha) * 0.35f / 255f);
if (projectile.timeLeft < 60)
projectile.Opacity = MathHelper.Clamp(projectile.timeLeft / 60f, 0f, 1f);
else
projectile.Opacity = MathHelper.Clamp(1f - ((projectile.timeLeft - 240) / 60f), 0f, 1f);
projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2;
Lighting.AddLight(projectile.Center, 0f, 0f, 0.5f * projectile.Opacity);
}
public override Color? GetAlpha(Color lightColor)
{
return new Color(200, 200, 200, projectile.alpha);
}
public override bool CanHitPlayer(Player target) => projectile.Opacity == 1f;
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
{
CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1);
return false;
}
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
{
lightColor.R = (byte)(255 * projectile.Opacity);
lightColor.G = (byte)(255 * projectile.Opacity);
lightColor.B = (byte)(255 * projectile.Opacity);
CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1);
return false;
}
public override void Kill(int timeLeft)
public override void Kill(int timeLeft)
{
for (int k = 0; k < 5; k++)
{
@@ -101,7 +89,10 @@ namespace CalamityMod.Projectiles.Boss
public override void OnHitPlayer(Player target, int damage, bool crit)
{
target.AddBuff(BuffID.Wet, 240);
if (projectile.Opacity != 1f)
return;
target.AddBuff(BuffID.Wet, 240);
}
}
}
+26 -1
View File
@@ -67,7 +67,15 @@ namespace CalamityMod.Projectiles
public int lineColor = 0; //Note: Although this was intended for fishing line colors, I use this as an AI variable a lot because vanilla only has 4 that sometimes are already in use. ~Ben
public bool extorterBoost = false;
public bool overridesMinionDamagePrevention = false;
// Organic/Inorganic Boosts
public bool hasOrganicEnemyHitBoost = false;
public bool hasInorganicEnemyHitBoost = false;
public float organicEnemyHitBoost = 0f;
public float inorganicEnemyHitBoost = 0f;
public Action<NPC> organicEnemyHitEffect = null;
public Action<NPC> inorganicEnemyHitEffect = null;
public bool overridesMinionDamagePrevention = false;
#region SetDefaults
public override void SetDefaults(Projectile projectile)
@@ -1056,6 +1064,23 @@ namespace CalamityMod.Projectiles
Player player = Main.player[projectile.owner];
CalamityPlayer modPlayer = player.Calamity();
// Super dummies have nearly 10 million max HP (which is used in damage calculations).
// This can very easily cause damage numbers that are unrealistic for the weapon.
// As a result, they are omitted in this code.
if (!target.boss && target.type != NPCType<SuperDummyNPC>())
{
if (target.Inorganic() && hasInorganicEnemyHitBoost)
{
damage += (int)(target.lifeMax * inorganicEnemyHitBoost);
inorganicEnemyHitEffect?.Invoke(target);
}
if (target.Organic() && hasOrganicEnemyHitBoost)
{
damage += (int)(target.lifeMax * organicEnemyHitBoost);
organicEnemyHitEffect?.Invoke(target);
}
}
if (projectile.owner == Main.myPlayer && !projectile.npcProj && !projectile.trap)
{
int critMax = 100;
@@ -4,6 +4,7 @@ using Microsoft.Xna.Framework.Audio;
using Terraria;
using Terraria.ModLoader;
using CalamityMod.Items;
using Terraria.ID;
namespace CalamityMod.Projectiles.DraedonsArsenal
{
@@ -65,6 +66,15 @@ namespace CalamityMod.Projectiles.DraedonsArsenal
bool flag2 = player.channel && !player.noItems && !player.CCed;
if (flag2)
{
// Attempt to use power from the held item.
if (player.ActiveItem().type >= ItemID.Count &&
player.ActiveItem().Calamity().Chargeable &&
player.ActiveItem().Calamity().CurrentCharge > 0 &&
Main.rand.NextBool((int)(120 / (float)fireRate)))
{
player.ActiveItem().Calamity().CurrentCharge--;
}
// Consume 2 ammo per shot
CalamityGlobalItem.ConsumeAdditionalAmmo(player, player.ActiveItem(), 2);
@@ -0,0 +1,126 @@
using Microsoft.Xna.Framework;
using System;
using System.IO;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.DraedonsArsenal
{
public class GaussPistolShot : ModProjectile
{
public float Time
{
get => projectile.ai[0];
set => projectile.ai[0] = value;
}
public Vector2 OldVelocity;
public const float MaxChargeRadius = 7f;
public const float MinEnergyParticleSpeed = 0.25f;
public const float MaxEnergyParticleSpeed = 4f;
public const float EnergyChargeRadiusRatio = 1.45f;
public const float ChargeTime = 60f;
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Gauss Shot");
ProjectileID.Sets.TrailingMode[projectile.type] = 2;
ProjectileID.Sets.TrailCacheLength[projectile.type] = 12;
}
public override void SetDefaults()
{
projectile.width = 16;
projectile.height = 16;
projectile.friendly = true;
projectile.magic = true;
projectile.penetrate = 1;
projectile.timeLeft = 240;
}
public override void SendExtraAI(BinaryWriter writer)
{
writer.WriteVector2(OldVelocity);
}
public override void ReceiveExtraAI(BinaryReader reader)
{
OldVelocity = reader.ReadVector2();
}
public override void AI()
{
Time++;
if (Time < ChargeTime && OldVelocity == Vector2.Zero)
{
OldVelocity = projectile.velocity;
projectile.velocity = Vector2.Zero;
projectile.netUpdate = true;
}
if (Time >= ChargeTime && OldVelocity != Vector2.Zero)
{
projectile.velocity = OldVelocity;
OldVelocity = Vector2.Zero;
projectile.netUpdate = true;
}
float energyRadius = MathHelper.Lerp(MaxChargeRadius * 0.333f, MaxChargeRadius, Utils.InverseLerp(0f, ChargeTime, Time, true));
float energySphereSpeedMax = MathHelper.Lerp(MaxEnergyParticleSpeed, MinEnergyParticleSpeed, Utils.InverseLerp(0f, ChargeTime, Time, true));
// Charge up dust.
if (projectile.velocity.Length() == 0f && !Main.dedServ)
{
for (int i = 0; i < 2; i++)
{
Vector2 offset = Main.rand.NextVector2CircularEdge(energyRadius, energyRadius) * 3f;
float dustHue = Main.rand.NextFloat(0.15f, 0.3f);
Dust dust = Dust.NewDustPerfect(projectile.Center + offset, 261);
dust.velocity = projectile.DirectionFrom(dust.position) * energyRadius / 3f;
dust.color = Main.hslToRgb(dustHue, Main.rand.NextFloat(0.9f, 1f), Main.rand.NextFloat(0.5f, 0.66f));
dust.noGravity = true;
}
}
if (!Main.dedServ)
{
// To give a bubble effect.
float xOffsetFactor = MathHelper.Lerp(0.7f, 1.3f, (float)Math.Cos(Time / 15f) * 0.5f + 0.5f);
float yOffsetFactor = MathHelper.Lerp(0.7f, 1.3f, (float)Math.Sin(Time / 15f) * 0.5f + 0.5f);
// Idle energy pulse dust.
for (int i = 0; i < 10; i++)
{
Vector2 offset = Main.rand.NextVector2Circular(energyRadius, energyRadius);
offset.X *= xOffsetFactor;
offset.Y *= yOffsetFactor;
float dustHue = Main.rand.NextFloat(0.15f, 0.3f);
Dust dust = Dust.NewDustPerfect(projectile.Center + offset, 261);
dust.velocity = Main.rand.NextVector2Circular(energySphereSpeedMax, energySphereSpeedMax);
dust.velocity += projectile.velocity;
dust.color = Main.hslToRgb(dustHue, Main.rand.NextFloat(0.9f, 1f), Main.rand.NextFloat(0.5f, 0.66f));
dust.scale = 0.8f;
dust.noGravity = true;
}
// Ring of dust.
for (int i = 0; i < 25; i++)
{
float angle = i / 25f * MathHelper.TwoPi;
Vector2 offset = angle.ToRotationVector2().RotatedBy(projectile.velocity.ToRotation()) * energyRadius * 1.5f;
offset.X *= -xOffsetFactor;
offset.Y *= yOffsetFactor;
float dustHue = Main.rand.NextFloat(0.15f, 0.3f);
Dust dust = Dust.NewDustPerfect(projectile.Center + offset, 261);
dust.velocity = Vector2.Zero;
dust.color = Main.hslToRgb(dustHue, Main.rand.NextFloat(0.9f, 1f), Main.rand.NextFloat(0.5f, 0.66f));
dust.scale = 0.5f;
dust.noGravity = true;
}
}
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 121 B

@@ -0,0 +1,70 @@
using Microsoft.Xna.Framework;
using System;
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.DraedonsArsenal
{
public class GaussRifleBlast : ModProjectile
{
public float Time
{
get => projectile.ai[0];
set => projectile.ai[0] = value;
}
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Gauss Blast");
}
public override void SetDefaults()
{
projectile.width = projectile.height = 60;
projectile.friendly = true;
projectile.ranged = true;
projectile.penetrate = 1;
projectile.timeLeft = 300;
projectile.usesLocalNPCImmunity = true;
projectile.localNPCHitCooldown = 8;
}
public override void AI()
{
Time++;
if (!Main.dedServ)
{
// Idle dust.
for (int i = 0; i < 10; i++)
{
float angle = i / 10f * MathHelper.TwoPi;
for (int j = 0; j < 4; j++)
{
Dust dust = Dust.NewDustPerfect(projectile.Center, 263);
dust.velocity = angle.ToRotationVector2().RotatedByRandom(0.25f) * Main.rand.NextFloat(6f, 8f);
dust.noGravity = true;
dust.scale = 2.1f;
}
}
// Ring dust.
for (int i = 0; i < 4; i++)
{
float angle = projectile.velocity.ToRotation() + (i / 4f * MathHelper.TwoPi) + Time / 24f;
float radius = (float)Math.Sin(Time / 7.5f) * 40f + 10f;
Dust dust = Dust.NewDustPerfect(projectile.Center + angle.ToRotationVector2() * radius, 226);
dust.velocity = Vector2.Zero;
dust.noGravity = true;
dust.scale = 2f;
}
}
}
public override void Kill(int timeLeft)
{
if (Main.myPlayer == projectile.owner)
{
Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LargeMechGaussRifle"), projectile.Center);
Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType<GaussRifleExplosion>(), projectile.damage, projectile.knockBack, projectile.owner);
}
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 203 B

Loaded 100 of 184 files, more files were not shown because too many files have changed in this diff. Show more