Merge branch 'master' of https://github.com/CalamityTeam/CalamityMod
This commit is contained in:
commit
45f1cd1329
27 files changed
+388
-426
No files matched your search
@@ -1059,7 +1059,7 @@ namespace CalamityMod.CalPlayer
|
||||
#endregion Calamitas Enchant Effects
|
||||
|
||||
#region Draw Effects
|
||||
public FireParticleSet ProvidenceBurnEffectDrawer = new FireParticleSet(-1, 1, Color.Yellow, Color.Red * 1.2f, 10f, 0.65f);
|
||||
public FireParticleSet ProvidenceBurnEffectDrawer = new FireParticleSet(-1, int.MaxValue, Color.Yellow, Color.Red * 1.2f, 10f, 0.65f);
|
||||
#endregion Draw Effects
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -681,10 +681,10 @@ namespace CalamityMod.CalPlayer
|
||||
}
|
||||
}
|
||||
|
||||
//extra DoT in the lava of the crags
|
||||
// Extra DoT in the lava of the crags. Negated by Abaddon.
|
||||
if (player.lavaWet)
|
||||
{
|
||||
if (modPlayer.ZoneCalamity)
|
||||
if (modPlayer.ZoneCalamity && !modPlayer.abaddon)
|
||||
player.AddBuff(ModContent.BuffType<CragsLava>(), 2, false);
|
||||
}
|
||||
else
|
||||
|
||||
+7
-1
@@ -1,4 +1,5 @@
|
||||
using CalamityMod.Events;
|
||||
using CalamityMod.Items;
|
||||
using CalamityMod.NPCs;
|
||||
using CalamityMod.NPCs.NormalNPCs;
|
||||
using CalamityMod.NPCs.Providence;
|
||||
@@ -110,6 +111,10 @@ namespace CalamityMod
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
NPC.NewNPC(x, y, ModContent.NPCType<SuperDummyNPC>());
|
||||
break;
|
||||
case CalamityModMessageType.DeleteAllSuperDummies:
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
SuperDummy.DeleteDummies();
|
||||
break;
|
||||
case CalamityModMessageType.ServersideSpawnOldDuke:
|
||||
byte playerIndex2 = reader.ReadByte();
|
||||
CalamityUtils.SpawnOldDuke(playerIndex2);
|
||||
@@ -271,7 +276,8 @@ namespace CalamityMod
|
||||
|
||||
// Syncs for specific bosses or entities
|
||||
SyncCalamityNPCAIArray,
|
||||
SpawnSuperDummy, // TODO -- super dummies STILL don't work in multiplayer
|
||||
SpawnSuperDummy,
|
||||
DeleteAllSuperDummies,
|
||||
ServersideSpawnOldDuke,
|
||||
DoGCountdownSync, // TODO -- this gets written in about six thousand places which all need to be individually evaluated
|
||||
ArmoredDiggerCountdownSync, // TODO -- remove this mechanic entirely
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using CalamityMod.Buffs.DamageOverTime;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Items.Accessories
|
||||
{
|
||||
[AutoloadEquip(EquipType.Face)]
|
||||
@@ -10,7 +10,7 @@ namespace CalamityMod.Items.Accessories
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Abaddon");
|
||||
Tooltip.SetDefault("Reduces the damage caused by the Brimstone Flames debuff");
|
||||
Tooltip.SetDefault("Reduces the damage caused by the Brimstone Flames debuff and provides immunity to Searing Lava");
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
@@ -22,9 +22,6 @@ namespace CalamityMod.Items.Accessories
|
||||
item.accessory = true;
|
||||
}
|
||||
|
||||
public override void UpdateAccessory(Player player, bool hideVisual)
|
||||
{
|
||||
player.Calamity().abaddon = true;
|
||||
}
|
||||
public override void UpdateAccessory(Player player, bool hideVisual) => player.Calamity().abaddon = true;
|
||||
}
|
||||
}
|
||||
@@ -51,6 +51,7 @@ namespace CalamityMod.Items.Accessories
|
||||
CalamityPlayer modPlayer = player.Calamity();
|
||||
modPlayer.dashMod = 4;
|
||||
modPlayer.elysianAegis = true;
|
||||
modPlayer.abaddon = true;
|
||||
player.noKnockback = true;
|
||||
player.fireWalk = true;
|
||||
player.statLifeMax2 += 40;
|
||||
|
||||
@@ -43,6 +43,9 @@ namespace CalamityMod.Items
|
||||
// This is placed between vanilla tooltip edits and mod mechanics because it can apply to vanilla items.
|
||||
StealthGenAccessoryTooltip(item, tooltips);
|
||||
|
||||
// If an item has special tags (specifically Ice, Fire, and Nature), show that in the tooltip.
|
||||
ElementTooltip(item, tooltips);
|
||||
|
||||
// If an item has an enchantment, show its prefix in the first tooltip line and append its description to the
|
||||
// tooltip list.
|
||||
EnchantmentTooltips(item, tooltips);
|
||||
@@ -988,6 +991,38 @@ namespace CalamityMod.Items
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Element Tooltip
|
||||
private void ElementTooltip(Item item, IList<TooltipLine> tooltips)
|
||||
{
|
||||
if (CalamityLists.fireWeaponList.Contains(item.type))
|
||||
{
|
||||
TooltipLine fireTooltip = new TooltipLine(mod, "FireWeapon", "-Fire Weapon-")
|
||||
{
|
||||
overrideColor = new Color(255, 165, 0)
|
||||
};
|
||||
tooltips.Add(fireTooltip);
|
||||
}
|
||||
|
||||
if (CalamityLists.iceWeaponList.Contains(item.type))
|
||||
{
|
||||
TooltipLine iceTooltip = new TooltipLine(mod, "IceWeapon", "-Ice Weapon-")
|
||||
{
|
||||
overrideColor = new Color(94, 230, 255)
|
||||
};
|
||||
tooltips.Add(iceTooltip);
|
||||
}
|
||||
|
||||
if (CalamityLists.natureWeaponList.Contains(item.type))
|
||||
{
|
||||
TooltipLine natureTooltip = new TooltipLine(mod, "NatureWeapon", "-Nature Weapon-")
|
||||
{
|
||||
overrideColor = new Color(46, 165, 0)
|
||||
};
|
||||
tooltips.Add(natureTooltip);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Enchanted Rarity Text Drawing
|
||||
public override bool PreDrawTooltipLine(Item item, DrawableTooltipLine line, ref int yOffset)
|
||||
{
|
||||
|
||||
@@ -8,12 +8,14 @@ using CalamityMod.Items.Weapons.Melee;
|
||||
using CalamityMod.Items.Weapons.Ranged;
|
||||
using CalamityMod.Items.Weapons.Rogue;
|
||||
using CalamityMod.Items.Weapons.Summon;
|
||||
using CalamityMod.Tiles.Abyss;
|
||||
using CalamityMod.World;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
using CrateTile = CalamityMod.Tiles.Abyss.AbyssalCrateTile;
|
||||
using CalamityMod.Items.Placeables;
|
||||
|
||||
namespace CalamityMod.Items.Fishing.SulphurCatches
|
||||
{
|
||||
public class AbyssalCrate : ModItem
|
||||
@@ -32,7 +34,7 @@ namespace CalamityMod.Items.Fishing.SulphurCatches
|
||||
item.height = 32;
|
||||
item.rare = ItemRarityID.Green;
|
||||
item.value = Item.sellPrice(gold: 1);
|
||||
item.createTile = ModContent.TileType<AbyssalCrateTile>();
|
||||
item.createTile = ModContent.TileType<CrateTile>();
|
||||
item.useTurn = true;
|
||||
item.autoReuse = true;
|
||||
item.useAnimation = 15;
|
||||
@@ -45,21 +47,22 @@ namespace CalamityMod.Items.Fishing.SulphurCatches
|
||||
public override void RightClick(Player player)
|
||||
{
|
||||
//Modded materials
|
||||
DropHelper.DropItem(player, ModContent.ItemType<Items.Placeables.SulphurousSand>(), 5, 10);
|
||||
DropHelper.DropItem(player, ModContent.ItemType<Items.Placeables.SulphurousSandstone>(), 5, 10);
|
||||
DropHelper.DropItem(player, ModContent.ItemType<SulphurousSand>(), 5, 10);
|
||||
DropHelper.DropItem(player, ModContent.ItemType<SulphurousSandstone>(), 5, 10);
|
||||
DropHelper.DropItem(player, ModContent.ItemType<HardenedSulphurousSandstone>(), 5, 10);
|
||||
DropHelper.DropItem(player, ModContent.ItemType<Acidwood>(), 5, 10);
|
||||
DropHelper.DropItemChance(player, ItemID.Starfish, 0.5f, 2, 3);
|
||||
DropHelper.DropItemChance(player, ItemID.Seashell, 0.5f, 2, 3);
|
||||
DropHelper.DropItemChance(player, ItemID.Coral, 0.5f, 2, 3);
|
||||
DropHelper.DropItemChance(player, ModContent.ItemType<VictoryShard>(), 0.25f, 2, 3);
|
||||
DropHelper.DropItemCondition(player, ModContent.ItemType<SulfuricScale>(), CalamityWorld.downedEoCAcidRain, 0.1f, 1, 3);
|
||||
DropHelper.DropItemCondition(player, ModContent.ItemType<CorrodedFossil>(), CalamityWorld.downedAquaticScourgeAcidRain, 0.1f, 1, 3);
|
||||
DropHelper.DropItemCondition(player, ModContent.ItemType<DepthCells>(), CalamityWorld.downedCalamitas, 0.2f, 2, 5);
|
||||
DropHelper.DropItemCondition(player, ModContent.ItemType<Lumenite>(), CalamityWorld.downedCalamitas, 0.2f, 2, 5);
|
||||
DropHelper.DropItemCondition(player, ModContent.ItemType<Items.Placeables.PlantyMush>(), CalamityWorld.downedCalamitas, 0.2f, 2, 5);
|
||||
DropHelper.DropItemCondition(player, ModContent.ItemType<Items.Placeables.Tenebris>(), CalamityWorld.downedCalamitas, 0.2f, 2, 5);
|
||||
DropHelper.DropItemCondition(player, ModContent.ItemType<CruptixBar>(), NPC.downedGolemBoss, 0.1f, 1, 3);
|
||||
DropHelper.DropItemCondition(player, ModContent.ItemType<ReaperTooth>(), CalamityWorld.downedPolterghast && CalamityWorld.downedBoomerDuke, 0.1f, 1, 5);
|
||||
DropHelper.DropItemCondition(player, ModContent.ItemType<SulfuricScale>(), CalamityWorld.downedEoCAcidRain, 0.1f, 1, 3);
|
||||
DropHelper.DropItemCondition(player, ModContent.ItemType<CorrodedFossil>(), CalamityWorld.downedAquaticScourgeAcidRain, 0.1f, 1, 3);
|
||||
DropHelper.DropItemCondition(player, ModContent.ItemType<DepthCells>(), CalamityWorld.downedCalamitas, 0.2f, 2, 5);
|
||||
DropHelper.DropItemCondition(player, ModContent.ItemType<Lumenite>(), CalamityWorld.downedCalamitas, 0.2f, 2, 5);
|
||||
DropHelper.DropItemCondition(player, ModContent.ItemType<PlantyMush>(), CalamityWorld.downedCalamitas, 0.2f, 2, 5);
|
||||
DropHelper.DropItemCondition(player, ModContent.ItemType<Tenebris>(), CalamityWorld.downedCalamitas, 0.2f, 2, 5);
|
||||
DropHelper.DropItemCondition(player, ModContent.ItemType<CruptixBar>(), NPC.downedGolemBoss, 0.1f, 1, 3);
|
||||
DropHelper.DropItemCondition(player, ModContent.ItemType<ReaperTooth>(), CalamityWorld.downedPolterghast && CalamityWorld.downedBoomerDuke, 0.1f, 1, 5);
|
||||
|
||||
// Weapons
|
||||
DropHelper.DropItemFromSetCondition(player, CalamityWorld.downedSlimeGod || Main.hardMode, 0.1f,
|
||||
@@ -101,29 +104,29 @@ namespace CalamityMod.Items.Fishing.SulphurCatches
|
||||
DropHelper.DropItemChance(player, ItemID.HeartreachPotion, 10, 1, 3);
|
||||
DropHelper.DropItemChance(player, ItemID.TrapsightPotion, 10, 1, 3); //Dangersense Potion
|
||||
DropHelper.DropItemChance(player, ModContent.ItemType<AnechoicCoating>(), 10, 1, 3);
|
||||
int healingPotID = ItemID.LesserHealingPotion;
|
||||
int manaPotID = ItemID.LesserManaPotion;
|
||||
if (CalamityWorld.downedDoG)
|
||||
{
|
||||
healingPotID = ModContent.ItemType<SupremeHealingPotion>();
|
||||
manaPotID = ModContent.ItemType<SupremeManaPotion>();
|
||||
}
|
||||
else if (CalamityWorld.downedProvidence)
|
||||
{
|
||||
healingPotID = ItemID.SuperHealingPotion;
|
||||
manaPotID = ItemID.SuperManaPotion;
|
||||
}
|
||||
else if (NPC.downedMechBossAny)
|
||||
{
|
||||
healingPotID = ItemID.GreaterHealingPotion;
|
||||
manaPotID = ItemID.GreaterManaPotion;
|
||||
}
|
||||
else if (NPC.downedBoss3)
|
||||
{
|
||||
healingPotID = ItemID.HealingPotion;
|
||||
manaPotID = ItemID.ManaPotion;
|
||||
}
|
||||
DropHelper.DropItemChance(player, Main.rand.Next(100) >= 49 ? healingPotID : manaPotID, 0.25f, 2, 5);
|
||||
int healingPotID = ItemID.LesserHealingPotion;
|
||||
int manaPotID = ItemID.LesserManaPotion;
|
||||
if (CalamityWorld.downedDoG)
|
||||
{
|
||||
healingPotID = ModContent.ItemType<SupremeHealingPotion>();
|
||||
manaPotID = ModContent.ItemType<SupremeManaPotion>();
|
||||
}
|
||||
else if (CalamityWorld.downedProvidence)
|
||||
{
|
||||
healingPotID = ItemID.SuperHealingPotion;
|
||||
manaPotID = ItemID.SuperManaPotion;
|
||||
}
|
||||
else if (NPC.downedMechBossAny)
|
||||
{
|
||||
healingPotID = ItemID.GreaterHealingPotion;
|
||||
manaPotID = ItemID.GreaterManaPotion;
|
||||
}
|
||||
else if (NPC.downedBoss3)
|
||||
{
|
||||
healingPotID = ItemID.HealingPotion;
|
||||
manaPotID = ItemID.ManaPotion;
|
||||
}
|
||||
DropHelper.DropItemChance(player, Main.rand.NextBool(2) ? healingPotID : manaPotID, 0.25f, 2, 5);
|
||||
|
||||
//Money
|
||||
DropHelper.DropItem(player, ItemID.SilverCoin, 10, 90);
|
||||
|
||||
+29
-9
@@ -35,21 +35,41 @@ namespace CalamityMod.Items
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void DeleteDummies()
|
||||
{
|
||||
for (int i = 0; i < Main.maxNPCs; i++)
|
||||
{
|
||||
NPC npc = Main.npc[i];
|
||||
if (npc.type == ModContent.NPCType<SuperDummyNPC>() && npc.active)
|
||||
{
|
||||
npc.life = 0;
|
||||
npc.active = false;
|
||||
|
||||
if (Main.netMode == NetmodeID.Server)
|
||||
NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override bool UseItem(Player player)
|
||||
{
|
||||
if (player.altFunctionUse == 2)
|
||||
{
|
||||
for (int i = 0; i < Main.maxNPCs; i++)
|
||||
if (Main.myPlayer == player.whoAmI)
|
||||
{
|
||||
NPC npc = Main.npc[i];
|
||||
if (npc.type == ModContent.NPCType<SuperDummyNPC>() && npc.active)
|
||||
if (Main.netMode == NetmodeID.SinglePlayer)
|
||||
DeleteDummies();
|
||||
|
||||
// A custom packet must be sent so that the deletion can be done on the server. This hook does not run there.
|
||||
// Why? Well, netUpdate/MessageID.SyncNPC packets do not send data to the server. They only send data to other clients. What this means is that prior to this fix
|
||||
// what would happen was every client EXCEPT THE SERVER would be told by this player that the dummies disappeared.
|
||||
// However, since the server isn't notified, it is inevitable that the server will do a sync of its own, unaware that the
|
||||
// dummies are gone, and cause them to reappear, making the deletion moot.
|
||||
else
|
||||
{
|
||||
if (player.whoAmI == Main.myPlayer)
|
||||
{
|
||||
npc.active = false;
|
||||
npc.netUpdate = true;
|
||||
}
|
||||
Main.PlaySound(SoundID.NPCDeath2, npc.Center);
|
||||
var netMessage = mod.GetPacket();
|
||||
netMessage.Write((byte)CalamityModMessageType.DeleteAllSuperDummies);
|
||||
netMessage.Send();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,10 +93,9 @@ namespace CalamityMod.NPCs.NormalNPCs
|
||||
|
||||
public override float SpawnChance(NPCSpawnInfo spawnInfo)
|
||||
{
|
||||
if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneSulphur)
|
||||
{
|
||||
if (spawnInfo.playerSafe || !Main.hardMode || spawnInfo.player.Calamity().ZoneSulphur)
|
||||
return 0f;
|
||||
}
|
||||
|
||||
return SpawnCondition.OceanMonster.Chance * 0.2f;
|
||||
}
|
||||
|
||||
|
||||
@@ -77,14 +77,14 @@ namespace CalamityMod.NPCs.NormalNPCs
|
||||
|
||||
Player player = Main.player[npc.target];
|
||||
|
||||
bool farFromPlayer = npc.Distance(player.Center) > 640f;
|
||||
bool farFromPlayer = npc.Distance(player.Center) > 920f;
|
||||
bool obstanceInFrontOfPlayer = !Collision.CanHitLine(npc.position, npc.width, npc.height, player.position, player.width, player.height);
|
||||
|
||||
if (npc.target < 0 || npc.target >= 255 || farFromPlayer || obstanceInFrontOfPlayer || player.dead || !player.active)
|
||||
{
|
||||
npc.TargetClosest(false);
|
||||
player = Main.player[npc.target];
|
||||
farFromPlayer = npc.Distance(player.Center) > 640f;
|
||||
farFromPlayer = npc.Distance(player.Center) > 920f;
|
||||
obstanceInFrontOfPlayer = !Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height);
|
||||
// Fly away if there is no living target, or the closest target is too far away.
|
||||
if (player.dead || !player.active || farFromPlayer || obstanceInFrontOfPlayer)
|
||||
@@ -173,7 +173,7 @@ namespace CalamityMod.NPCs.NormalNPCs
|
||||
|
||||
public override float SpawnChance(NPCSpawnInfo spawnInfo)
|
||||
{
|
||||
float pylonMult = NPC.AnyNPCs(ModContent.NPCType<WulfrumPylon>()) ? 3f : 1f;
|
||||
float pylonMult = NPC.AnyNPCs(ModContent.NPCType<WulfrumPylon>()) ? 5.5f : 1f;
|
||||
if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneSulphur)
|
||||
return 0f;
|
||||
|
||||
|
||||
@@ -149,7 +149,7 @@ namespace CalamityMod.NPCs.NormalNPCs
|
||||
|
||||
public override float SpawnChance(NPCSpawnInfo spawnInfo)
|
||||
{
|
||||
float pylonMult = NPC.AnyNPCs(ModContent.NPCType<WulfrumPylon>()) ? 3f : 1f;
|
||||
float pylonMult = NPC.AnyNPCs(ModContent.NPCType<WulfrumPylon>()) ? 5.5f : 1f;
|
||||
if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneSulphur)
|
||||
return 0f;
|
||||
return SpawnCondition.OverworldDaySlime.Chance * (Main.hardMode ? 0.0333f : 0.115f) * pylonMult;
|
||||
|
||||
@@ -100,14 +100,14 @@ namespace CalamityMod.NPCs.NormalNPCs
|
||||
|
||||
Player player = Main.player[npc.target];
|
||||
|
||||
bool farFromPlayer = npc.Distance(player.Center) > 640f;
|
||||
bool farFromPlayer = npc.Distance(player.Center) > 920f;
|
||||
bool obstanceInFrontOfPlayer = !Collision.CanHitLine(npc.position, npc.width, npc.height, player.position, player.width, player.height);
|
||||
|
||||
if (npc.target < 0 || npc.target >= 255 || farFromPlayer || obstanceInFrontOfPlayer || player.dead || !player.active)
|
||||
{
|
||||
npc.TargetClosest(false);
|
||||
player = Main.player[npc.target];
|
||||
farFromPlayer = npc.Distance(player.Center) > 640f;
|
||||
farFromPlayer = npc.Distance(player.Center) > 920f;
|
||||
obstanceInFrontOfPlayer = !Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height);
|
||||
// Fly away if there is no living target, or the closest target is too far away.
|
||||
if (player.dead || !player.active || farFromPlayer || obstanceInFrontOfPlayer)
|
||||
@@ -238,7 +238,7 @@ namespace CalamityMod.NPCs.NormalNPCs
|
||||
|
||||
public override float SpawnChance(NPCSpawnInfo spawnInfo)
|
||||
{
|
||||
float pylonMult = NPC.AnyNPCs(ModContent.NPCType<WulfrumPylon>()) ? 3f : 1f;
|
||||
float pylonMult = NPC.AnyNPCs(ModContent.NPCType<WulfrumPylon>()) ? 5.5f : 1f;
|
||||
if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneSulphur)
|
||||
return 0f;
|
||||
return SpawnCondition.OverworldDaySlime.Chance * (Main.hardMode ? 0.025f : 0.1f) * pylonMult;
|
||||
|
||||
@@ -6,6 +6,7 @@ using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using Microsoft.Xna.Framework;
|
||||
using System.Collections.Generic;
|
||||
using CalamityMod.World;
|
||||
|
||||
namespace CalamityMod.NPCs.NormalNPCs
|
||||
{
|
||||
@@ -27,8 +28,8 @@ namespace CalamityMod.NPCs.NormalNPCs
|
||||
ModContent.NPCType<WulfrumGyrator>(),
|
||||
ModContent.NPCType<WulfrumHovercraft>()
|
||||
};
|
||||
public const float ChargeRadiusMax = 200f;
|
||||
public const float SuperchargeTime = 600f;
|
||||
public const float ChargeRadiusMax = 495f;
|
||||
public const float SuperchargeTime = 720f;
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Wulfrum Pylon");
|
||||
@@ -43,7 +44,7 @@ namespace CalamityMod.NPCs.NormalNPCs
|
||||
npc.width = 44;
|
||||
npc.height = 44;
|
||||
npc.defense = 4;
|
||||
npc.lifeMax = 49;
|
||||
npc.lifeMax = 92;
|
||||
npc.knockBackResist = 0f;
|
||||
npc.value = Item.buyPrice(0, 0, 1, 50);
|
||||
npc.noGravity = false;
|
||||
@@ -60,8 +61,31 @@ namespace CalamityMod.NPCs.NormalNPCs
|
||||
|
||||
Player player = Main.player[npc.target];
|
||||
|
||||
if (!Charging && npc.Distance(player.Center) < ChargeRadiusMax * 0.667f)
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient && !Charging && npc.Distance(player.Center) < ChargeRadiusMax * 0.667f)
|
||||
{
|
||||
// Spawn some off-screen enemies to act as threats if the player enters the field.
|
||||
int enemiesToSpawn = CalamityWorld.death ? 2 : 1;
|
||||
for (int i = 0; i < enemiesToSpawn; i++)
|
||||
{
|
||||
int tries = 0;
|
||||
Vector2 spawnPosition;
|
||||
do
|
||||
{
|
||||
spawnPosition = player.Center + Main.rand.NextVector2Unit() * Main.rand.NextFloat(600f, 1015f) * new Vector2(1.5f, 1f);
|
||||
if (spawnPosition.Y > player.Center.Y)
|
||||
spawnPosition.Y = player.Center.Y;
|
||||
if (tries > 500)
|
||||
break;
|
||||
tries++;
|
||||
}
|
||||
while (WorldGen.SolidTile(CalamityUtils.ParanoidTileRetrieval((int)spawnPosition.X / 16, (int)spawnPosition.Y / 16)));
|
||||
|
||||
if (tries < 500)
|
||||
{
|
||||
int npcToSpawn = Main.rand.NextBool(2) ? ModContent.NPCType<WulfrumDrone>() : ModContent.NPCType<WulfrumHovercraft>();
|
||||
NPC.NewNPC((int)spawnPosition.X, (int)spawnPosition.Y, npcToSpawn);
|
||||
}
|
||||
}
|
||||
Charging = true;
|
||||
npc.netUpdate = true;
|
||||
}
|
||||
@@ -71,12 +95,13 @@ namespace CalamityMod.NPCs.NormalNPCs
|
||||
|
||||
if (Main.rand.NextBool(4))
|
||||
{
|
||||
float dustCount = MathHelper.TwoPi * ChargeRadius / 5f;
|
||||
float dustCount = MathHelper.TwoPi * ChargeRadius / 8f;
|
||||
for (int i = 0; i < dustCount; i++)
|
||||
{
|
||||
float angle = MathHelper.TwoPi * i / dustCount;
|
||||
Dust dust = Dust.NewDustPerfect(npc.Center, 229);
|
||||
dust.position = npc.Center + angle.ToRotationVector2() * ChargeRadius;
|
||||
dust.scale = 0.7f;
|
||||
dust.noGravity = true;
|
||||
dust.velocity = npc.velocity;
|
||||
}
|
||||
@@ -91,8 +116,7 @@ namespace CalamityMod.NPCs.NormalNPCs
|
||||
// For some strange reason, the Wulfrum Rover is not counted when it's added to a static list.
|
||||
// What I assume is going on is that it hasn't been loaded yet since it's later alphabetically (Pylon is before Rover).
|
||||
// As a result, they are checked separately.
|
||||
if (!SuperchargableEnemies.Contains(npcAtIndex.type) &&
|
||||
npcAtIndex.type != ModContent.NPCType<WulfrumRover>())
|
||||
if (!SuperchargableEnemies.Contains(npcAtIndex.type) && npcAtIndex.type != ModContent.NPCType<WulfrumRover>())
|
||||
continue;
|
||||
if (npcAtIndex.ai[3] > 0f)
|
||||
continue;
|
||||
|
||||
@@ -93,7 +93,7 @@ namespace CalamityMod.NPCs.NormalNPCs
|
||||
|
||||
public override float SpawnChance(NPCSpawnInfo spawnInfo)
|
||||
{
|
||||
float pylonMult = NPC.AnyNPCs(ModContent.NPCType<WulfrumPylon>()) ? 3f : 1f;
|
||||
float pylonMult = NPC.AnyNPCs(ModContent.NPCType<WulfrumPylon>()) ? 5.5f : 1f;
|
||||
if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneSulphur)
|
||||
return 0f;
|
||||
return SpawnCondition.OverworldDaySlime.Chance * (Main.hardMode ? 0.05f : 0.135f) * pylonMult;
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace CalamityMod.NPCs.Other
|
||||
npc.width = npc.height = 28;
|
||||
npc.damage = 0;
|
||||
npc.defense = 0;
|
||||
npc.lifeMax = 97444;
|
||||
npc.lifeMax = 181445;
|
||||
npc.noGravity = true;
|
||||
npc.noTileCollide = true;
|
||||
npc.value = 0f;
|
||||
@@ -36,7 +36,7 @@ namespace CalamityMod.NPCs.Other
|
||||
npc.Calamity().DoesNotGenerateRage = true;
|
||||
}
|
||||
|
||||
public override void ScaleExpertStats(int numPlayers, float bossLifeScale) => npc.lifeMax = 97444;
|
||||
public override void ScaleExpertStats(int numPlayers, float bossLifeScale) => npc.lifeMax = 181445;
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
@@ -53,6 +53,8 @@ namespace CalamityMod.NPCs.Other
|
||||
}
|
||||
|
||||
Vector2 destination = Vector2.Lerp(Owner.Center, Main.MouseWorld, 0.3f);
|
||||
if (!Owner.WithinRange(Main.MouseWorld, 225f))
|
||||
destination = Owner.Center + Owner.SafeDirectionTo(Main.MouseWorld) * 225f;
|
||||
npc.Center = Vector2.Lerp(npc.Center, destination, 0.035f).MoveTowards(destination, 5f);
|
||||
if (!npc.WithinRange(destination, 2000f))
|
||||
npc.Center = Owner.Center;
|
||||
@@ -95,7 +97,8 @@ namespace CalamityMod.NPCs.Other
|
||||
|
||||
public override void NPCLoot()
|
||||
{
|
||||
for (int i = 0; i < 8; i++)
|
||||
int heartsToGive = (int)MathHelper.Lerp(0f, 7f, Utils.InverseLerp(45f, 540f, Time, true));
|
||||
for (int i = 0; i < heartsToGive; i++)
|
||||
DropHelper.DropItem(npc, ItemID.Heart);
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace CalamityMod.Particles
|
||||
return;
|
||||
|
||||
bool closeToDeath = LocalTimer >= SetLifetime - ParticleLifetime && SetLifetime > 0;
|
||||
if (LocalTimer % ParticleSpawnRate == 0 && !closeToDeath)
|
||||
if (LocalTimer % ParticleSpawnRate == ParticleSpawnRate - 1 && !closeToDeath)
|
||||
{
|
||||
Particle particle = SpawnParticle();
|
||||
particle.Lifetime = ParticleLifetime;
|
||||
|
||||
@@ -40,7 +40,10 @@ namespace CalamityMod.Projectiles.Enemy
|
||||
if (projectile.localAI[0] == 0f)
|
||||
{
|
||||
// play a sound frame 1. changed this from space gun sound because that sound was way too annoying
|
||||
Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"), projectile.Center);
|
||||
var sound = Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"), projectile.Center);
|
||||
if (sound != null)
|
||||
sound.Volume *= 0.35f;
|
||||
|
||||
projectile.localAI[0] = 1f;
|
||||
}
|
||||
projectile.alpha = (int)(Math.Sin(projectile.timeLeft / 240f * MathHelper.Pi) * 1.6f * 255f);
|
||||
|
||||
@@ -18,8 +18,7 @@ namespace CalamityMod.Tiles.Abyss
|
||||
dustType = 32;
|
||||
drop = ModContent.ItemType<Items.Placeables.HardenedSulphurousSandstone>();
|
||||
AddMapEntry(new Color(76, 58, 59));
|
||||
mineResist = 1f;
|
||||
minPick = 55;
|
||||
mineResist = 1.45f;
|
||||
soundType = SoundID.Dig;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@ namespace CalamityMod.Tiles.Abyss
|
||||
drop = ModContent.ItemType<Items.Placeables.SulphurousSand>();
|
||||
AddMapEntry(new Color(150, 100, 50));
|
||||
mineResist = 1f;
|
||||
minPick = 55;
|
||||
soundType = SoundID.Dig;
|
||||
SetModPalmTree(new AcidWoodTree());
|
||||
SetModCactus(new SulphurousCactus());
|
||||
|
||||
@@ -18,8 +18,7 @@ namespace CalamityMod.Tiles.Abyss
|
||||
dustType = 32;
|
||||
drop = ModContent.ItemType<Items.Placeables.SulphurousSandstone>();
|
||||
AddMapEntry(new Color(113, 90, 71));
|
||||
mineResist = 1f;
|
||||
minPick = 55;
|
||||
mineResist = 1.2f;
|
||||
soundType = SoundID.Dig;
|
||||
}
|
||||
|
||||
|
||||
@@ -41,9 +41,8 @@ namespace CalamityMod.Tiles.DraedonStructures
|
||||
soundType = SoundID.Item;
|
||||
soundStyle = 14;
|
||||
|
||||
// Requires a Gold Pickaxe or better to mine. Has 500% durability.
|
||||
mineResist = 5.00f;
|
||||
minPick = 55;
|
||||
// Has 500% durability.
|
||||
mineResist = 5f;
|
||||
}
|
||||
|
||||
public override bool CanExplode(int i, int j) => false;
|
||||
|
||||
@@ -24,7 +24,6 @@ namespace CalamityMod.Tiles.SunkenSea
|
||||
name.SetDefault("Navystone");
|
||||
AddMapEntry(new Color(0, 50, 50), name);
|
||||
mineResist = 2f;
|
||||
minPick = 55;
|
||||
soundType = SoundID.Tink;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,6 @@ namespace CalamityMod.Tiles.SunkenSea
|
||||
name.SetDefault("Sea Prism");
|
||||
AddMapEntry(new Color(0, 150, 200), name);
|
||||
mineResist = 3f;
|
||||
minPick = 55;
|
||||
soundType = SoundID.Tink;
|
||||
Main.tileSpelunker[Type] = true;
|
||||
}
|
||||
|
||||
@@ -984,10 +984,10 @@ namespace CalamityMod.World
|
||||
#region ModifyWorldGenTasks
|
||||
public override void ModifyWorldGenTasks(List<GenPass> tasks, ref float totalWeight)
|
||||
{
|
||||
int ShiniesIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Shinies"));
|
||||
if (ShiniesIndex != -1)
|
||||
int islandIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Floating Island Houses"));
|
||||
if (islandIndex != -1)
|
||||
{
|
||||
tasks.Insert(ShiniesIndex + 2, new PassLegacy("EvilIsland", delegate (GenerationProgress progress)
|
||||
tasks.Insert(islandIndex + 2, new PassLegacy("EvilIsland", delegate (GenerationProgress progress)
|
||||
{
|
||||
progress.Message = "Evil Island";
|
||||
WorldEvilIsland.PlaceEvilIsland();
|
||||
|
||||
@@ -40,6 +40,20 @@ namespace CalamityMod.World
|
||||
}
|
||||
}
|
||||
|
||||
public class SetPaint : GenAction
|
||||
{
|
||||
private readonly byte _paintID;
|
||||
public SetPaint(byte paintID) => _paintID = paintID;
|
||||
public override bool Apply(Point origin, int x, int y, params object[] args)
|
||||
{
|
||||
if (!WorldGen.InWorld(x, y))
|
||||
return false;
|
||||
|
||||
WorldGen.paintTile(x, y, _paintID);
|
||||
return UnitApply(origin, x, y, args);
|
||||
}
|
||||
}
|
||||
|
||||
public class JungleGrass : GenAction
|
||||
{
|
||||
private bool _tryMushrooms;
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using Terraria;
|
||||
using Terraria.World.Generation;
|
||||
|
||||
namespace CalamityMod.World
|
||||
{
|
||||
public static class CustomShapes
|
||||
{
|
||||
public class DistortedCircle : GenShape
|
||||
{
|
||||
private readonly int baseRadius;
|
||||
private readonly float distortionFactor;
|
||||
|
||||
public DistortedCircle(int radius, float distortionFactor)
|
||||
{
|
||||
baseRadius = radius;
|
||||
this.distortionFactor = distortionFactor;
|
||||
}
|
||||
|
||||
public override bool Perform(Point origin, GenAction action)
|
||||
{
|
||||
float offsetAngle = WorldGen.genRand.NextFloat(-10f, 10f);
|
||||
for (float angle = 0f; angle < MathHelper.TwoPi; angle += MathHelper.Pi * 0.0084f)
|
||||
{
|
||||
// Adding two sinusoids with irrational periods results in final sinusoid having no period at all.
|
||||
// This behavior is ideal for creating a unique distortion surface with many varying hills and valleys.
|
||||
float distortionQuantity = (float)(Math.Sin(MathHelper.PiOver2 * angle + offsetAngle) + Math.Sin(Math.E * angle * 0.5f + offsetAngle)) * distortionFactor * 0.5f;
|
||||
int currentRadius = (int)(baseRadius - distortionQuantity * baseRadius);
|
||||
if (currentRadius <= 0)
|
||||
continue;
|
||||
|
||||
int horizontalOffset = (int)(Math.Cos(angle) * currentRadius);
|
||||
int verticalOffset = (int)(Math.Sin(angle) * currentRadius);
|
||||
for (int dx = 0; dx != horizontalOffset; dx += Math.Sign(horizontalOffset))
|
||||
{
|
||||
for (int dy = 0; dy != verticalOffset; dy += Math.Sign(verticalOffset))
|
||||
UnitApply(action, origin, origin.X + dx, origin.Y + dy, new object[0]);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+154
-336
@@ -1,8 +1,12 @@
|
||||
using CalamityMod.DataStructures;
|
||||
using CalamityMod.World.Planets;
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using Terraria.World.Generation;
|
||||
|
||||
namespace CalamityMod.World
|
||||
{
|
||||
@@ -18,14 +22,14 @@ namespace CalamityMod.World
|
||||
do
|
||||
{
|
||||
xIslandGen = WorldGen.crimson ?
|
||||
WorldGen.genRand.Next((int)(x * 0.1), (int)(x * 0.15)) :
|
||||
WorldGen.genRand.Next((int)(x * 0.85), (int)(x * 0.9));
|
||||
yIslandGen = WorldGen.genRand.Next(90, 151);
|
||||
WorldGen.genRand.Next((int)(x * 0.1), (int)(x * 0.2)) :
|
||||
WorldGen.genRand.Next((int)(x * 0.8), (int)(x * 0.9));
|
||||
yIslandGen = WorldGen.genRand.Next(95, 126);
|
||||
yIslandGen = Math.Min(yIslandGen, (int)WorldGen.worldSurfaceLow - 50);
|
||||
|
||||
int checkAreaX = 200;
|
||||
int checkAreaY = 200;
|
||||
potentialArea = new Rectangle(xIslandGen + checkAreaX / 2, yIslandGen + checkAreaY / 2, checkAreaX, checkAreaY);
|
||||
int checkAreaX = 180;
|
||||
int checkAreaY = 95;
|
||||
potentialArea = Utils.CenteredRectangle(new Vector2(xIslandGen, yIslandGen), new Vector2(checkAreaX, checkAreaY));
|
||||
}
|
||||
while (!Planetoid.InvalidSkyPlacementArea(potentialArea));
|
||||
|
||||
@@ -50,370 +54,184 @@ namespace CalamityMod.World
|
||||
|
||||
public static void EvilIsland(int i, int j)
|
||||
{
|
||||
double num = (double)WorldGen.genRand.Next(100, 150);
|
||||
float num2 = (float)WorldGen.genRand.Next(20, 30);
|
||||
int num3 = i;
|
||||
int num4 = i;
|
||||
int num5 = i;
|
||||
int num6 = j;
|
||||
Vector2 vector;
|
||||
vector.X = (float)i;
|
||||
vector.Y = (float)j;
|
||||
Vector2 vector2;
|
||||
vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f;
|
||||
while (vector2.X > -2f && vector2.X < 2f)
|
||||
// Generate puffy clouds along the bottom.
|
||||
int leftOffset = 86;
|
||||
int rightOffset = 86;
|
||||
int maxVerticalOffset = 24;
|
||||
List<Point> cloudPositions = new List<Point>();
|
||||
for (int dx = -leftOffset; dx < rightOffset; dx += WorldGen.genRand.Next(21, 26))
|
||||
{
|
||||
vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f;
|
||||
float completionRatio = Utils.InverseLerp(-leftOffset - 22f, rightOffset + 22f, dx, true);
|
||||
float completionRatio010 = CalamityUtils.Convert01To010(completionRatio);
|
||||
int verticalOffset = (int)(completionRatio010 * maxVerticalOffset);
|
||||
Point cloudPosition = new Point(i + dx, j + verticalOffset);
|
||||
|
||||
int radius = WorldGen.genRand.Next(22, 26) - (int)((1f - completionRatio010) * 15);
|
||||
WorldUtils.Gen(cloudPosition, new CustomShapes.DistortedCircle(radius, 0.1f), Actions.Chain(
|
||||
new Actions.SetTile(TileID.Cloud),
|
||||
new Modifiers.Blotches(4, 1f)));
|
||||
|
||||
cloudPositions.Add(cloudPosition);
|
||||
}
|
||||
vector2.Y = (float)WorldGen.genRand.Next(-20, -10) * 0.02f;
|
||||
while (num > 0.0 && num2 > 0f)
|
||||
|
||||
// Clear out a hole.
|
||||
WorldUtils.Gen(new Point(i, j - 4), new Shapes.Circle((leftOffset + rightOffset - 30) / 2, 16), new Actions.ClearTile());
|
||||
|
||||
// Create random smaller clouds with offsets to fill in the cut out area.
|
||||
foreach (Point cloudPosition in cloudPositions)
|
||||
{
|
||||
num -= (double)WorldGen.genRand.Next(4);
|
||||
num2 -= 1f;
|
||||
int num7 = (int)((double)vector.X - num * 0.5);
|
||||
int num8 = (int)((double)vector.X + num * 0.5);
|
||||
int num9 = (int)((double)vector.Y - num * 0.5);
|
||||
int num10 = (int)((double)vector.Y + num * 0.5);
|
||||
if (num7 < 0)
|
||||
Vector2 offsetCloudPosition = cloudPosition.ToVector2();
|
||||
while (!CalamityUtils.ParanoidTileRetrieval((int)offsetCloudPosition.X, (int)offsetCloudPosition.Y).active())
|
||||
offsetCloudPosition.Y++;
|
||||
|
||||
for (int k = 0; k < 3; k++)
|
||||
{
|
||||
num7 = 0;
|
||||
}
|
||||
if (num8 > Main.maxTilesX)
|
||||
{
|
||||
num8 = Main.maxTilesX;
|
||||
}
|
||||
if (num9 < 0)
|
||||
{
|
||||
num9 = 0;
|
||||
}
|
||||
if (num10 > Main.maxTilesY)
|
||||
{
|
||||
num10 = Main.maxTilesY;
|
||||
}
|
||||
double num11 = num * (double)WorldGen.genRand.Next(80, 120) * 0.01; //80 120
|
||||
float num12 = vector.Y + 1f;
|
||||
for (int k = num7; k < num8; k++)
|
||||
{
|
||||
if (WorldGen.genRand.Next(2) == 0)
|
||||
{
|
||||
num12 += (float)WorldGen.genRand.Next(-1, 2);
|
||||
}
|
||||
if (num12 < vector.Y)
|
||||
{
|
||||
num12 = vector.Y;
|
||||
}
|
||||
if (num12 > vector.Y + 2f)
|
||||
{
|
||||
num12 = vector.Y + 2f;
|
||||
}
|
||||
for (int l = num9; l < num10; l++)
|
||||
{
|
||||
if ((float)l > num12)
|
||||
{
|
||||
float arg_218_0 = Math.Abs((float)k - vector.X);
|
||||
float num13 = Math.Abs((float)l - vector.Y) * 3f;
|
||||
if (Math.Sqrt((double)(arg_218_0 * arg_218_0 + num13 * num13)) < num11 * 0.4)
|
||||
{
|
||||
if (k < num3)
|
||||
{
|
||||
num3 = k;
|
||||
}
|
||||
if (k > num4)
|
||||
{
|
||||
num4 = k;
|
||||
}
|
||||
if (l < num5)
|
||||
{
|
||||
num5 = l;
|
||||
}
|
||||
if (l > num6)
|
||||
{
|
||||
num6 = l;
|
||||
}
|
||||
Main.tile[k, l].active(true);
|
||||
Main.tile[k, l].type = (ushort)(WorldGen.crimson ? 400 : 401); //ebonstone or crimstone
|
||||
WorldGen.SquareTileFrame(k, l, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
vector += vector2;
|
||||
vector2.X += (float)WorldGen.genRand.Next(-20, 21) * 0.05f;
|
||||
if (vector2.X > 1f)
|
||||
{
|
||||
vector2.X = 1f;
|
||||
}
|
||||
if (vector2.X < -1f)
|
||||
{
|
||||
vector2.X = -1f;
|
||||
}
|
||||
if ((double)vector2.Y > 0.2)
|
||||
{
|
||||
vector2.Y = -0.2f;
|
||||
}
|
||||
if ((double)vector2.Y < -0.2)
|
||||
{
|
||||
vector2.Y = -0.2f;
|
||||
int radius = WorldGen.genRand.Next(6, 9);
|
||||
Vector2 randomCloudPosition = offsetCloudPosition + WorldGen.genRand.NextVector2Circular(radius, radius) * 0.75f;
|
||||
|
||||
// Account for centering, somewhat.
|
||||
randomCloudPosition.Y -= radius * 0.4f;
|
||||
randomCloudPosition.Y += 5f;
|
||||
|
||||
WorldUtils.Gen(randomCloudPosition.ToPoint(), new Shapes.Circle(radius / 2), new Actions.SetTile(TileID.Cloud));
|
||||
}
|
||||
}
|
||||
int m = num3;
|
||||
int num15;
|
||||
for (m += WorldGen.genRand.Next(5); m < num4; m += WorldGen.genRand.Next(num15, (int)((double)num15 * 1.5)))
|
||||
|
||||
// Fill the not cloud area with evil sandstone.
|
||||
for (int dx = -leftOffset + 10; dx < rightOffset - 10; dx++)
|
||||
{
|
||||
int num14 = num6;
|
||||
while (!Main.tile[m, num14].active())
|
||||
float completionRatio = Utils.InverseLerp(-leftOffset - 22f, rightOffset + 22f, dx, true);
|
||||
float completionRatio010 = CalamityUtils.Convert01To010(completionRatio);
|
||||
int verticalOffset = (int)((1f - completionRatio010) * maxVerticalOffset);
|
||||
for (int dy = -5; dy < maxVerticalOffset + 13 - verticalOffset; dy++)
|
||||
{
|
||||
num14--;
|
||||
}
|
||||
num14 += WorldGen.genRand.Next(-3, 4);
|
||||
num15 = WorldGen.genRand.Next(4, 8);
|
||||
int num16 = WorldGen.crimson ? 400 : 401;
|
||||
if (WorldGen.genRand.Next(4) == 0)
|
||||
{
|
||||
num16 = WorldGen.crimson ? 398 : 399;
|
||||
}
|
||||
for (int n = m - num15; n <= m + num15; n++)
|
||||
{
|
||||
for (int num17 = num14 - num15; num17 <= num14 + num15; num17++)
|
||||
if (!CalamityUtils.ParanoidTileRetrieval(i + dx, j + dy).active())
|
||||
{
|
||||
if (num17 > num5)
|
||||
{
|
||||
float arg_409_0 = (float)Math.Abs(n - m);
|
||||
float num18 = (float)(Math.Abs(num17 - num14) * 2);
|
||||
if (Math.Sqrt((double)(arg_409_0 * arg_409_0 + num18 * num18)) < (double)(num15 + WorldGen.genRand.Next(2)))
|
||||
{
|
||||
Main.tile[n, num17].active(true);
|
||||
Main.tile[n, num17].type = (ushort)num16;
|
||||
WorldGen.SquareTileFrame(n, num17, true);
|
||||
}
|
||||
}
|
||||
Main.tile[i + dx, j + dy].type = WorldGen.crimson ? TileID.CorruptSandstone : TileID.CrimsonSandstone;
|
||||
Main.tile[i + dx, j + dy].active(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
num = (double)WorldGen.genRand.Next(80, 95);
|
||||
num2 = (float)WorldGen.genRand.Next(10, 15);
|
||||
vector.X = (float)i;
|
||||
vector.Y = (float)num5;
|
||||
vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f;
|
||||
while (vector2.X > -2f && vector2.X < 2f)
|
||||
|
||||
// Determine the lines at which clouds begin to form.
|
||||
List<Point> borderPoints = new List<Point>();
|
||||
for (int dx = -leftOffset + 14; dx < rightOffset - 14; dx++)
|
||||
{
|
||||
vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f;
|
||||
int verticalBorder = j - 10;
|
||||
while (CalamityUtils.ParanoidTileRetrieval(i + dx, verticalBorder).type != TileID.Cloud)
|
||||
{
|
||||
verticalBorder++;
|
||||
if (verticalBorder > j + 35)
|
||||
break;
|
||||
}
|
||||
|
||||
if (verticalBorder >= j + 35)
|
||||
continue;
|
||||
|
||||
borderPoints.Add(new Point(i + dx, verticalBorder));
|
||||
}
|
||||
vector2.Y = (float)WorldGen.genRand.Next(-20, -10) * 0.02f;
|
||||
while (num > 0.0 && num2 > 0f)
|
||||
|
||||
// And generate blotches at those borders.
|
||||
for (int k = 0; k < 10; k++)
|
||||
{
|
||||
num -= (double)WorldGen.genRand.Next(4);
|
||||
num2 -= 1f;
|
||||
int num7 = (int)((double)vector.X - num * 0.5);
|
||||
int num8 = (int)((double)vector.X + num * 0.5);
|
||||
int num9 = num5 - 1;
|
||||
int num10 = (int)((double)vector.Y + num * 0.5);
|
||||
if (num7 < 0)
|
||||
Point borderToGenerateAt = borderPoints[WorldGen.genRand.Next(borderPoints.Count)];
|
||||
Vector2 moveDirection = Vector2.UnitY.RotatedBy(WorldGen.genRand.NextFloat(-0.4f, 0.4f));
|
||||
for (int l = 0; l < 4; l++)
|
||||
{
|
||||
num7 = 0;
|
||||
}
|
||||
if (num8 > Main.maxTilesX)
|
||||
{
|
||||
num8 = Main.maxTilesX;
|
||||
}
|
||||
if (num9 < 0)
|
||||
{
|
||||
num9 = 0;
|
||||
}
|
||||
if (num10 > Main.maxTilesY)
|
||||
{
|
||||
num10 = Main.maxTilesY;
|
||||
}
|
||||
double num11 = num * (double)WorldGen.genRand.Next(80, 120) * 0.01;
|
||||
float num19 = vector.Y + 1f;
|
||||
for (int num20 = num7; num20 < num8; num20++)
|
||||
{
|
||||
if (WorldGen.genRand.Next(2) == 0)
|
||||
{
|
||||
num19 += (float)WorldGen.genRand.Next(-1, 2);
|
||||
}
|
||||
if (num19 < vector.Y)
|
||||
{
|
||||
num19 = vector.Y;
|
||||
}
|
||||
if (num19 > vector.Y + 2f)
|
||||
{
|
||||
num19 = vector.Y + 2f;
|
||||
}
|
||||
for (int num21 = num9; num21 < num10; num21++)
|
||||
{
|
||||
if ((float)num21 > num19)
|
||||
{
|
||||
float arg_69E_0 = Math.Abs((float)num20 - vector.X);
|
||||
float num22 = Math.Abs((float)num21 - vector.Y) * 3f;
|
||||
if (Math.Sqrt((double)(arg_69E_0 * arg_69E_0 + num22 * num22)) < num11 * 0.4 &&
|
||||
Main.tile[num20, num21].type == (WorldGen.crimson ? 400 : 401))
|
||||
{
|
||||
Main.tile[num20, num21].type = (ushort)(WorldGen.crimson ? 22 : 204); //ore
|
||||
WorldGen.SquareTileFrame(num20, num21, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
vector += vector2;
|
||||
vector2.X += (float)WorldGen.genRand.Next(-20, 21) * 0.05f;
|
||||
if (vector2.X > 1f)
|
||||
{
|
||||
vector2.X = 1f;
|
||||
}
|
||||
if (vector2.X < -1f)
|
||||
{
|
||||
vector2.X = -1f;
|
||||
}
|
||||
if ((double)vector2.Y > 0.2)
|
||||
{
|
||||
vector2.Y = -0.2f;
|
||||
}
|
||||
if ((double)vector2.Y < -0.2)
|
||||
{
|
||||
vector2.Y = -0.2f;
|
||||
Point blotchPosition = (borderToGenerateAt.ToVector2() + Main.rand.NextVector2Circular(5f, 5f) + moveDirection * l * 3f).ToPoint();
|
||||
WorldUtils.Gen(blotchPosition, new CustomShapes.DistortedCircle(WorldGen.genRand.Next(8, 10) - l, 0.4f), Actions.Chain(
|
||||
new Actions.SetTile(WorldGen.crimson ? TileID.CorruptSandstone : TileID.CrimsonSandstone),
|
||||
new Modifiers.IsSolid(),
|
||||
new Modifiers.Blotches(5, 1f),
|
||||
new Modifiers.OnlyTiles(TileID.CorruptSandstone, TileID.CrimsonSandstone)));
|
||||
}
|
||||
}
|
||||
int num23 = num3;
|
||||
num23 += WorldGen.genRand.Next(5);
|
||||
while (num23 < num4)
|
||||
|
||||
// Create some blotches of hardened evil sand and evil ore.
|
||||
for (int k = 0; k < 12; k++)
|
||||
{
|
||||
int num24 = num6;
|
||||
while ((!Main.tile[num23, num24].active() || Main.tile[num23, num24].type != 0) && num23 < num4)
|
||||
int radius = WorldGen.genRand.Next(6, 8);
|
||||
ushort tileType = WorldGen.crimson ? TileID.CorruptHardenedSand : TileID.CrimsonHardenedSand;
|
||||
|
||||
Point blotchPosition = new Point(i + WorldGen.genRand.Next(-leftOffset + 20, rightOffset - 20), j + WorldGen.genRand.Next(-3, 12));
|
||||
if (k > 4)
|
||||
{
|
||||
num24--;
|
||||
if (num24 < num5)
|
||||
if (blotchPosition.Y > j + 3)
|
||||
{
|
||||
num24 = num6;
|
||||
num23 += WorldGen.genRand.Next(1, 4);
|
||||
radius -= WorldGen.genRand.Next(3);
|
||||
tileType = WorldGen.crimson ? TileID.Demonite : TileID.Crimtane;
|
||||
}
|
||||
else
|
||||
continue;
|
||||
}
|
||||
if (num23 < num4)
|
||||
{
|
||||
num24 += WorldGen.genRand.Next(0, 4);
|
||||
int num25 = WorldGen.genRand.Next(2, 5);
|
||||
int num26 = WorldGen.crimson ? 400 : 401;
|
||||
for (int num27 = num23 - num25; num27 <= num23 + num25; num27++)
|
||||
{
|
||||
for (int num28 = num24 - num25; num28 <= num24 + num25; num28++)
|
||||
{
|
||||
if (num28 > num5)
|
||||
{
|
||||
float arg_890_0 = (float)Math.Abs(num27 - num23);
|
||||
float num29 = (float)(Math.Abs(num28 - num24) * 2);
|
||||
if (Math.Sqrt((double)(arg_890_0 * arg_890_0 + num29 * num29)) < (double)num25)
|
||||
{
|
||||
Main.tile[num27, num28].type = (ushort)num26;
|
||||
WorldGen.SquareTileFrame(num27, num28, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
num23 += WorldGen.genRand.Next(num25, (int)((double)num25 * 1.5));
|
||||
}
|
||||
|
||||
WorldUtils.Gen(blotchPosition, new CustomShapes.DistortedCircle(radius, 0.35f), Actions.Chain(
|
||||
new Actions.SetTile(tileType),
|
||||
new Modifiers.IsSolid(),
|
||||
new Modifiers.Blotches(5, 1f),
|
||||
new Modifiers.OnlyTiles(TileID.CorruptSandstone, TileID.CrimsonSandstone)));
|
||||
}
|
||||
for (int num30 = num3 - 20; num30 <= num4 + 20; num30++)
|
||||
|
||||
// Determine the lines at which ground begins to appear. This only applies if the ground is an evil tile.
|
||||
List<Point> surfacePoints = new List<Point>();
|
||||
for (int dx = -leftOffset + 24; dx < rightOffset - 24; dx++)
|
||||
{
|
||||
for (int num31 = num5 - 20; num31 <= num6 + 20; num31++)
|
||||
// Ignore points near the center because bumps there could cause the house to offset in weird ways.
|
||||
if (Math.Abs(dx) < 15)
|
||||
continue;
|
||||
|
||||
int surface = j - 15;
|
||||
bool hitCloud = false;
|
||||
while (!CalamityUtils.ParanoidTileRetrieval(i + dx, surface).active())
|
||||
{
|
||||
bool flag = true;
|
||||
for (int num32 = num30 - 1; num32 <= num30 + 1; num32++)
|
||||
surface++;
|
||||
if (CalamityUtils.ParanoidTileRetrieval(i + dx, surface).type == TileID.Cloud)
|
||||
{
|
||||
for (int num33 = num31 - 1; num33 <= num31 + 1; num33++)
|
||||
{
|
||||
if (!Main.tile[num32, num33].active())
|
||||
{
|
||||
flag = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (flag)
|
||||
{
|
||||
Main.tile[num30, num31].wall = (ushort)(WorldGen.crimson ? 220 : 221);
|
||||
WorldGen.SquareWallFrame(num30, num31, true);
|
||||
hitCloud = true;
|
||||
break;
|
||||
}
|
||||
if (surface > j + 35)
|
||||
break;
|
||||
}
|
||||
|
||||
if (hitCloud || surface >= j + 35)
|
||||
continue;
|
||||
|
||||
surfacePoints.Add(new Point(i + dx, surface));
|
||||
}
|
||||
for (int num34 = num3; num34 <= num4; num34++)
|
||||
|
||||
// Create "bumps" on the top by creating blotches just a bit below the surface.
|
||||
for (int k = 0; k < 4; k++)
|
||||
{
|
||||
int num35 = num5 - 10;
|
||||
while (!Main.tile[num34, num35 + 1].active())
|
||||
{
|
||||
num35++;
|
||||
}
|
||||
if (num35 < num6 && Main.tile[num34, num35 + 1].type == (WorldGen.crimson ? 400 : 401))
|
||||
{
|
||||
if (WorldGen.genRand.Next(10) == 0)
|
||||
{
|
||||
int num36 = WorldGen.genRand.Next(1, 3);
|
||||
for (int num37 = num34 - num36; num37 <= num34 + num36; num37++)
|
||||
{
|
||||
if (Main.tile[num37, num35].type == (WorldGen.crimson ? 400 : 401))
|
||||
{
|
||||
Main.tile[num37, num35].active(false);
|
||||
Main.tile[num37, num35].liquid = 255;
|
||||
Main.tile[num37, num35].lava(false);
|
||||
WorldGen.SquareTileFrame(num34, num35, true);
|
||||
}
|
||||
if (Main.tile[num37, num35 + 1].type == (WorldGen.crimson ? 400 : 401))
|
||||
{
|
||||
Main.tile[num37, num35 + 1].active(false);
|
||||
Main.tile[num37, num35 + 1].liquid = 255;
|
||||
Main.tile[num37, num35 + 1].lava(false);
|
||||
WorldGen.SquareTileFrame(num34, num35 + 1, true);
|
||||
}
|
||||
if (num37 > num34 - num36 && num37 < num34 + 2 && Main.tile[num37, num35 + 2].type == (WorldGen.crimson ? 400 : 401))
|
||||
{
|
||||
Main.tile[num37, num35 + 2].active(false);
|
||||
Main.tile[num37, num35 + 2].liquid = 255;
|
||||
Main.tile[num37, num35 + 2].lava(false);
|
||||
WorldGen.SquareTileFrame(num34, num35 + 2, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (WorldGen.genRand.Next(5) == 0)
|
||||
{
|
||||
Main.tile[num34, num35].liquid = 255;
|
||||
}
|
||||
Main.tile[num34, num35].lava(false);
|
||||
WorldGen.SquareTileFrame(num34, num35, true);
|
||||
}
|
||||
Point surfaceToGenerateAt = surfacePoints[WorldGen.genRand.Next(surfacePoints.Count)];
|
||||
Point blotchPosition = (surfaceToGenerateAt.ToVector2() + Vector2.UnitY * 5f).ToPoint();
|
||||
WorldUtils.Gen(blotchPosition, new Shapes.Circle(WorldGen.genRand.Next(8, 10)), Actions.Chain(
|
||||
new Actions.SetTile(CalamityUtils.ParanoidTileRetrieval(surfaceToGenerateAt.X, surfaceToGenerateAt.Y).type),
|
||||
new Modifiers.SkipTiles(TileID.Demonite, TileID.Crimtane),
|
||||
new Modifiers.Blotches(5, 1f)));
|
||||
}
|
||||
int num38 = WorldGen.genRand.Next(4);
|
||||
for (int num39 = 0; num39 <= num38; num39++)
|
||||
|
||||
// Generate one large chunk of ore somewhere, just in case there isn't much otherwise.
|
||||
Vector2 oreStartPosition = new Vector2(i + WorldGen.genRand.Next(-leftOffset + 28, rightOffset - 28), j + WorldGen.genRand.Next(8, 14));
|
||||
Vector2 oreEndPosition = oreStartPosition + Vector2.UnitX.RotatedBy(WorldGen.genRand.NextFloat(-0.36f, -0.14f)) * WorldGen.genRand.NextBool(2).ToDirectionInt() * WorldGen.genRand.NextFloat(18f, 25f);
|
||||
Vector2 oreMiddlePosition = (oreStartPosition + oreEndPosition) * 0.5f + WorldGen.genRand.NextVector2Circular(6f, 6f);
|
||||
List<Vector2> smoothOrePositions = new BezierCurve(oreStartPosition, oreMiddlePosition, oreStartPosition).GetPoints(25);
|
||||
for (int k = 0; k < smoothOrePositions.Count; k++)
|
||||
{
|
||||
int num40 = WorldGen.genRand.Next(num3 - 5, num4 + 5);
|
||||
int num41 = num5 - WorldGen.genRand.Next(20, 40);
|
||||
int num42 = WorldGen.genRand.Next(4, 8);
|
||||
int num43 = WorldGen.crimson ? 400 : 401;
|
||||
if (WorldGen.genRand.Next(2) == 0)
|
||||
float strength = MathHelper.Lerp(1f, 4f, CalamityUtils.Convert01To010(k / (float)smoothOrePositions.Count));
|
||||
Point orePosition = smoothOrePositions[k].ToPoint();
|
||||
|
||||
WorldUtils.Gen(orePosition, new Shapes.Circle((int)strength), Actions.Chain(
|
||||
new Actions.SetTile(WorldGen.crimson ? TileID.Demonite : TileID.Crimtane)));
|
||||
}
|
||||
|
||||
// Paint all clouds.
|
||||
for (int dx = -leftOffset - 30; dx < rightOffset + 30; dx++)
|
||||
{
|
||||
for (int dy = -8; dy < 55; dy++)
|
||||
{
|
||||
num43 = WorldGen.crimson ? 398 : 399;
|
||||
}
|
||||
for (int num44 = num40 - num42; num44 <= num40 + num42; num44++)
|
||||
{
|
||||
for (int num45 = num41 - num42; num45 <= num41 + num42; num45++)
|
||||
{
|
||||
float arg_C74_0 = (float)Math.Abs(num44 - num40);
|
||||
float num46 = (float)(Math.Abs(num45 - num41) * 2);
|
||||
if (Math.Sqrt((double)(arg_C74_0 * arg_C74_0 + num46 * num46)) < (double)(num42 + WorldGen.genRand.Next(-1, 2)))
|
||||
{
|
||||
Main.tile[num44, num45].active(true);
|
||||
Main.tile[num44, num45].type = (ushort)num43;
|
||||
WorldGen.SquareTileFrame(num44, num45, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int num47 = num40 - num42 + 2; num47 <= num40 + num42 - 2; num47++)
|
||||
{
|
||||
int num48 = num41 - num42;
|
||||
while (!Main.tile[num47, num48].active())
|
||||
{
|
||||
num48++;
|
||||
}
|
||||
Main.tile[num47, num48].active(false);
|
||||
Main.tile[num47, num48].liquid = 255;
|
||||
WorldGen.SquareTileFrame(num47, num48, true);
|
||||
if (CalamityUtils.ParanoidTileRetrieval(i + dx, j + dy).type == TileID.Cloud)
|
||||
WorldGen.paintTile(i + dx, j + dy, WorldGen.crimson ? PaintID.Purple : PaintID.Red);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user