Astral Update completed. For the most part. Few items need to be done.

This commit is contained in:
nomnomnomnomnom committed 2018-11-11 02:17:24 +00:00
1 parent 643c195492
commit 919e57c645
289 files changed
+8304 -405

No files matched your search

+58
View File
@@ -0,0 +1,58 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Backgrounds
{
public class AstralDesertSurfaceBGStyle : ModSurfaceBgStyle
{
public override int ChooseFarTexture()
{
return mod.GetBackgroundSlot("Backgrounds/AstralDesertSurfaceFar");
}
public override int ChooseMiddleTexture()
{
return mod.GetBackgroundSlot("Backgrounds/AstralDesertSurfaceMiddle");
}
public override int ChooseCloseTexture(ref float scale, ref double parallax, ref float a, ref float b)
{
b -= 75f;
return mod.GetBackgroundSlot("Backgrounds/AstralDesertSurfaceClose");
}
public override bool ChooseBgStyle()
{
return !Main.gameMenu && Main.LocalPlayer.GetModPlayer<CalamityPlayer>(mod).ZoneAstral && Main.LocalPlayer.ZoneDesert;
}
public override void ModifyFarFades(float[] fades, float transitionSpeed)
{
//This just fades in the background and fades out other backgrounds.
for (int i = 0; i < fades.Length; i++)
{
if (i == Slot)
{
fades[i] += transitionSpeed;
if (fades[i] > 1f)
{
fades[i] = 1f;
}
}
else
{
fades[i] -= transitionSpeed;
if (fades[i] < 0f)
{
fades[i] = 0f;
}
}
}
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

+57
View File
@@ -0,0 +1,57 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Backgrounds
{
public class AstralSnowSurfaceBGStyle : ModSurfaceBgStyle
{
public override int ChooseFarTexture()
{
return mod.GetBackgroundSlot("Backgrounds/AstralSnowSurfaceFar");
}
public override int ChooseMiddleTexture()
{
return mod.GetBackgroundSlot("Backgrounds/AstralSnowSurfaceMiddle");
}
public override int ChooseCloseTexture(ref float scale, ref double parallax, ref float a, ref float b)
{
return mod.GetBackgroundSlot("Backgrounds/AstralSurfaceClose");
}
public override bool ChooseBgStyle()
{
return !Main.gameMenu && Main.LocalPlayer.GetModPlayer<CalamityPlayer>(mod).ZoneAstral && Main.LocalPlayer.ZoneSnow;
}
public override void ModifyFarFades(float[] fades, float transitionSpeed)
{
//This just fades in the background and fades out other backgrounds.
for (int i = 0; i < fades.Length; i++)
{
if (i == Slot)
{
fades[i] += transitionSpeed;
if (fades[i] > 1f)
{
fades[i] = 1f;
}
}
else
{
fades[i] -= transitionSpeed;
if (fades[i] < 0f)
{
fades[i] = 0f;
}
}
}
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

+58
View File
@@ -0,0 +1,58 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Backgrounds
{
public class AstralSurfaceBGStyle : ModSurfaceBgStyle
{
public override int ChooseFarTexture()
{
return mod.GetBackgroundSlot("Backgrounds/AstralSurfaceFar");
}
public override int ChooseMiddleTexture()
{
return mod.GetBackgroundSlot("Backgrounds/AstralSurfaceMiddle");
}
public override int ChooseCloseTexture(ref float scale, ref double parallax, ref float a, ref float b)
{
scale *= 0.75f;
return mod.GetBackgroundSlot("Backgrounds/AstralSurfaceClose");
}
public override bool ChooseBgStyle()
{
return !Main.gameMenu && Main.LocalPlayer.GetModPlayer<CalamityPlayer>(mod).ZoneAstral && !Main.LocalPlayer.ZoneDesert && !Main.LocalPlayer.ZoneSnow;
}
public override void ModifyFarFades(float[] fades, float transitionSpeed)
{
//This just fades in the background and fades out other backgrounds.
for (int i = 0; i < fades.Length; i++)
{
if (i == Slot)
{
fades[i] += transitionSpeed;
if (fades[i] > 1f)
{
fades[i] = 1f;
}
}
else
{
fades[i] -= transitionSpeed;
if (fades[i] < 0f)
{
fades[i] = 0f;
}
}
}
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 768 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 757 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

+21
View File
@@ -0,0 +1,21 @@
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Backgrounds
{
public class ExampleUgBgStyle : ModUgBgStyle
{
public override bool ChooseBgStyle()
{
return Main.LocalPlayer.GetModPlayer<CalamityPlayer>().ZoneAstral;
}
public override void FillTextureArray(int[] textureSlots)
{
textureSlots[0] = mod.GetBackgroundSlot("Backgrounds/AstralUG0");
textureSlots[1] = mod.GetBackgroundSlot("Backgrounds/AstralUG1");
textureSlots[2] = mod.GetBackgroundSlot("Backgrounds/AstralUG2");
textureSlots[3] = mod.GetBackgroundSlot("Backgrounds/AstralUG3");
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

+26 -1
View File
@@ -26,6 +26,7 @@ using CalamityMod.NPCs.SupremeCalamitas;
using CalamityMod.NPCs.Polterghast;
using CalamityMod.Tiles;
using CalamityMod.UI;
using CalamityMod.Skies;
namespace CalamityMod
{
@@ -64,8 +65,16 @@ namespace CalamityMod
public static Texture2D manaOriginal;
public static Texture2D carpetOriginal;
public static Texture2D AstralCactusTexture;
public static Texture2D AstralCactusGlowTexture;
public static Texture2D AstralSky;
public static CalamityMod Instance;
public static Effect CustomShader;
public CalamityMod()
{
@@ -110,6 +119,11 @@ namespace CalamityMod
AddEquipTexture(new Items.Armor.SirenHeadAlt(), null, EquipType.Head, "SirenHeadAlt", "CalamityMod/Items/Armor/SirenTransAlt_Head");
AddEquipTexture(new Items.Armor.SirenBodyAlt(), null, EquipType.Body, "SirenBodyAlt", "CalamityMod/Items/Armor/SirenTransAlt_Body", "CalamityMod/Items/Armor/SirenTransAlt_Arms");
AddEquipTexture(new Items.Armor.SirenLegsAlt(), null, EquipType.Legs, "SirenLegAlt", "CalamityMod/Items/Armor/SirenTransAlt_Legs");
AstralCactusTexture = GetTexture("ExtraTextures/Tiles/AstralCactus");
AstralCactusGlowTexture = GetTexture("ExtraTextures/Tiles/AstralCactusGlow");
AstralSky = GetTexture("ExtraTextures/AstralSky");
CustomShader = GetEffect("Effects/CustomShader");
AddMusicBox(GetSoundSlot(SoundType.Music, "Sounds/Music/Cryogen"), ItemType("CryogenMusicbox"), TileType("CryogenMusicbox"));
AddMusicBox(GetSoundSlot(SoundType.Music, "Sounds/Music/Calamitas"), ItemType("CalamitasMusicbox"), TileType("CalamitasMusicbox"));
@@ -119,7 +133,7 @@ namespace CalamityMod
AddMusicBox(GetSoundSlot(SoundType.Music, "Sounds/Music/PlaguebringerGoliath"), ItemType("PlaguebringerMusicbox"), TileType("PlaguebringerMusicbox"));
AddMusicBox(GetSoundSlot(SoundType.Music, "Sounds/Music/AquaticScourge"), ItemType("AquaticScourgeMusicbox"), TileType("AquaticScourgeMusicbox"));
AddMusicBox(GetSoundSlot(SoundType.Music, "Sounds/Music/Astrageldon"), ItemType("AstrageldonMusicbox"), TileType("AstrageldonMusicbox"));
AddMusicBox(GetSoundSlot(SoundType.Music, "Sounds/Music/Astral"), ItemType("AstralMusicbox"), TileType("AstralMusicbox"));
//AddMusicBox(GetSoundSlot(SoundType.Music, "Sounds/Music/Astral"), ItemType("AstralMusicbox"), TileType("AstralMusicbox"));
AddMusicBox(GetSoundSlot(SoundType.Music, "Sounds/Music/RUIN"), ItemType("PolterghastMusicbox"), TileType("PolterghastMusicbox"));
AddMusicBox(GetSoundSlot(SoundType.Music, "Sounds/Music/Signus"), ItemType("SignusMusicbox"), TileType("SignusMusicbox"));
AddMusicBox(GetSoundSlot(SoundType.Music, "Sounds/Music/Weaver"), ItemType("StormWeaverMusicbox"), TileType("StormWeaverMusicbox"));
@@ -132,6 +146,7 @@ namespace CalamityMod
AddMusicBox(GetSoundSlot(SoundType.Music, "Sounds/Music/ProvidenceTheme"), ItemType("ProvidenceMusicbox"), TileType("ProvidenceMusicbox"));
AddMusicBox(GetSoundSlot(SoundType.Music, "Sounds/Music/Guardians"), ItemType("ProfanedGuardianMusicbox"), TileType("ProfanedGuardianMusicbox"));
AddMusicBox(GetSoundSlot(SoundType.Music, "Sounds/Music/Ravager"), ItemType("RavagerMusicbox"), TileType("RavagerMusicbox"));
AddMusicBox(GetSoundSlot(SoundType.Music, "Sounds/Music/Astral"), ItemType("AstralSurfaceMusicBox"), TileType("AstralSurfaceMusicBox"));
Filters.Scene["CalamityMod:DevourerofGodsHead"] = new Filter(new DoGScreenShaderData("FilterMiniTower").UseColor(0.4f, 0.1f, 1.0f).UseOpacity(0.5f), EffectPriority.VeryHigh);
SkyManager.Instance["CalamityMod:DevourerofGodsHead"] = new DoGSky();
@@ -156,6 +171,9 @@ namespace CalamityMod
Filters.Scene["CalamityMod:SupremeCalamitas"] = new Filter(new SCalScreenShaderData("FilterMiniTower").UseColor(1.1f, 0.3f, 0.3f).UseOpacity(0.65f), EffectPriority.VeryHigh);
SkyManager.Instance["CalamityMod:SupremeCalamitas"] = new SCalSky();
Filters.Scene["CalamityMod:Astral"] = new Filter(new AstralScreenShaderData(new Ref<Effect>(CustomShader), "AstralPass").UseColor(0.18f, 0.08f, 0.24f), EffectPriority.VeryHigh);
SkyManager.Instance["CalamityMod:Astral"] = new AstralSky();
Mod mod = ModLoader.GetMod("CalamityMod");
UIHandler.OnLoad(mod);
@@ -559,6 +577,9 @@ namespace CalamityMod
public override void Unload()
{
AstralCactusTexture = null;
AstralCactusGlowTexture = null;
AstralSky = null;
RageHotKey = null;
AdrenalineHotKey = null;
AegisHotKey = null;
@@ -620,6 +641,10 @@ namespace CalamityMod
{
music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/UniversalCollapse"); priority = MusicPriority.BossMedium;
}
if (Main.LocalPlayer.GetModPlayer<CalamityPlayer>(this).ZoneAstral)
{
if (!CalamityGlobalNPC.AnyBossNPCS()) { music = GetSoundSlot(SoundType.Music, "Sounds/Music/Astral"); priority = MusicPriority.BiomeHigh; }
}
}
}
}
+21 -4
View File
@@ -1303,13 +1303,15 @@ namespace CalamityMod
player.ManageSpecialBiomeVisuals("CalamityMod:Providence", useHoly);
bool useSBrimstone = NPC.AnyNPCs(mod.NPCType("SupremeCalamitas"));
player.ManageSpecialBiomeVisuals("CalamityMod:SupremeCalamitas", useSBrimstone);
bool inAstral = ZoneAstral;
player.ManageSpecialBiomeVisuals("CalamityMod:Astral", inAstral);
}
public override void UpdateBiomes()
{
Point point = player.Center.ToTileCoordinates();
ZoneCalamity = CalamityWorld.calamityTiles > 50;
ZoneAstral = CalamityWorld.astralTiles > 50;
ZoneAstral = CalamityWorld.astralTiles > 950 || (player.ZoneSnow && CalamityWorld.astralTiles > 300);
//ZoneGreatSea = CalamityWorld.seaTiles > 30;
int x = Main.maxTilesX;
@@ -1420,14 +1422,18 @@ namespace CalamityMod
ZoneSulphur = flags[7];
}
/*public override Texture2D GetMapBackgroundImage()
public override Texture2D GetMapBackgroundImage()
{
if (ZoneSulphur)
/*if (ZoneSulphur)
{
return mod.GetTexture("Backgrounds/SulphurBG");
}*/
if (ZoneAstral)
{
return mod.GetTexture("Backgrounds/MapBackgrounds/AstralBG");
}
return null;
}*/
}
#endregion
#region InventoryStartup
@@ -2502,6 +2508,17 @@ namespace CalamityMod
}
#endregion
#region PreUpdateBuffs
public override void PreUpdateBuffs()
{
//Remove the mighty wind buff if the player is in the astral desert.
if (player.ZoneDesert && ZoneAstral && player.HasBuff(BuffID.WindPushed))
{
player.ClearBuff(BuffID.WindPushed);
}
}
#endregion
#region PostUpdateEffects
public override void PostUpdateBuffs()
{
+589 -2
View File
@@ -613,10 +613,19 @@ namespace CalamityMod
public override void TileCountsAvailable(int[] tileCounts)
{
calamityTiles = tileCounts[mod.TileType("CharredOre")] + tileCounts[mod.TileType("BrimstoneSlag")];
astralTiles = tileCounts[mod.TileType("AstralOre")];
seaTiles = tileCounts[mod.TileType("EutrophicSand")] + tileCounts[mod.TileType("SeaPrism")];
abyssTiles = tileCounts[mod.TileType("AbyssGravel")];
sulphurTiles = tileCounts[mod.TileType("SulphurousSand")];
#region Astral Stuff
int astralDesertTiles = tileCounts[mod.TileType("AstralSand")] + tileCounts[mod.TileType("AstralSandstone")] + tileCounts[mod.TileType("HardenedAstralSand")];
int astralSnowTiles = tileCounts[mod.TileType("AstralIce")];
Main.sandTiles += astralDesertTiles;
Main.snowTiles += astralSnowTiles;
astralTiles = astralDesertTiles + astralSnowTiles + tileCounts[mod.TileType("AstralDirt")] + tileCounts[mod.TileType("AstralStone")] + tileCounts[mod.TileType("AstralGrass")]+ tileCounts[mod.TileType("AstralOre")];
#endregion
}
#endregion
@@ -1800,10 +1809,588 @@ namespace CalamityMod
if (Main.netMode != 1)
{
NetMessage.SendTileSquare(-1, i, j, 40, TileChangeType.None);
DoAstralConversion(new Point(i, j));
}
return true;
}
#endregion
public static void DoAstralConversion(object obj)
{
//Pre-calculate all variables necessary for elliptical area checking
Point origin = (Point)obj;
Vector2 center = origin.ToVector2() * 16f + new Vector2(8f);
float angle = MathHelper.Pi * 0.15f;
float otherAngle = MathHelper.PiOver2 - angle;
int distanceInTiles = 150 + ((Main.maxTilesX - 4200) / 4200) * 200;
float distance = distanceInTiles * 16f;
float constant = (distance * 2f) / (float)Math.Sin(angle);
float fociSpacing = ((distance * (float)Math.Sin(otherAngle)) / (float)Math.Sin(angle));
int verticalRadius = (int)(constant / 16f);
Vector2 fociOffset = Vector2.UnitY * fociSpacing;
Vector2 topFoci = center - fociOffset;
Vector2 bottomFoci = center + fociOffset;
for (int x = origin.X - distanceInTiles - 2; x <= origin.X + distanceInTiles + 2; x++)
{
for (int y = (int)(origin.Y - verticalRadius * 0.4f) - 3; y <= origin.Y + verticalRadius + 3; y++)
{
float dist;
if (CheckInEllipse(new Point(x, y), topFoci, bottomFoci, constant, center, out dist, y < origin.Y))
{
//If we're in the outer blurPercent% of the ellipse
float percent = dist / constant;
float blurPercent = 0.98f;
if (percent > blurPercent)
{
float outerEdgePercent = (percent - blurPercent) / (1f - blurPercent);
if (Main.rand.NextFloat(1f) > outerEdgePercent)
{
ConvertToAstral(x, y);
}
}
else
{
ConvertToAstral(x, y);
}
}
}
}
}
public static void ConvertToAstral(int startX, int endX, int startY, int endY)
{
for (int x = startX; x <= endX; x++)
{
for (int y = startY; y <= endY; y++)
{
ConvertToAstral(x, y);
}
}
}
public static void ConvertToAstral(int x, int y, bool tileframe = true)
{
Mod mod = ModLoader.GetMod("CalamityMod");
if (WorldGen.InWorld(x, y, 1))
{
int type = Main.tile[x, y].type;
int wallType = Main.tile[x, y].wall;
if (WallID.Sets.Conversion.Grass[wallType])
{
Main.tile[x, y].wall = (ushort)mod.WallType("AstralGrassWallUnsafe");
}
else if (WallID.Sets.Conversion.HardenedSand[wallType])
{
Main.tile[x, y].wall = (ushort)mod.WallType("HardenedAstralSandWallUnsafe");
}
else if (WallID.Sets.Conversion.Sandstone[wallType])
{
Main.tile[x, y].wall = (ushort)mod.WallType("AstralSandstoneWallUnsafe");
}
else if (WallID.Sets.Conversion.Stone[wallType])
{
Main.tile[x, y].wall = (ushort)mod.WallType("AstralStoneWallUnsafe");
}
else
{
switch (wallType)
{
case WallID.DirtUnsafe:
case WallID.DirtUnsafe1:
case WallID.DirtUnsafe2:
case WallID.DirtUnsafe3:
case WallID.DirtUnsafe4:
case WallID.Cave6Unsafe:
case WallID.Dirt:
Main.tile[x, y].wall = (ushort)mod.WallType("AstralDirtWallUnsafe");
break;
case WallID.IceUnsafe:
Main.tile[x, y].wall = (ushort)mod.WallType("AstralIceWallUnsafe");
break;
}
}
if (TileID.Sets.Conversion.Grass[type] && !TileID.Sets.GrassSpecial[type])
{
Main.tile[x, y].type = (ushort)mod.TileType("AstralGrass");
}
else if (TileID.Sets.Conversion.Stone[type] || Main.tileMoss[type])
{
Main.tile[x, y].type = (ushort)mod.TileType("AstralStone");
}
else if (TileID.Sets.Conversion.Sand[type])
{
Main.tile[x, y].type = (ushort)mod.TileType("AstralSand");
}
else if (TileID.Sets.Conversion.HardenedSand[type])
{
Main.tile[x, y].type = (ushort)mod.TileType("HardenedAstralSand");
}
else if (TileID.Sets.Conversion.Sandstone[type])
{
Main.tile[x, y].type = (ushort)mod.TileType("AstralSandstone");
}
else if (TileID.Sets.Conversion.Ice[type])
{
Main.tile[x, y].type = (ushort)mod.TileType("AstralIce");
}
else
{
Tile tile = Main.tile[x, y];
switch(type)
{
case TileID.Dirt:
Main.tile[x, y].type = (ushort)mod.TileType("AstralDirt");
break;
case TileID.Vines:
Main.tile[x, y].type = (ushort)mod.TileType("AstralVines");
break;
case TileID.LargePiles:
if (tile.frameX <= 1170)
{
RecursiveReplaceToAstral(TileID.LargePiles, (ushort)mod.TileType("AstralNormalLargePiles"), x, y, 324, 0, 1170, 0, 18);
}
if (tile.frameX >= 1728)
{
RecursiveReplaceToAstral(TileID.LargePiles, (ushort)mod.TileType("AstralNormalLargePiles"), x, y, 324, 1728, 1872, 0, 18);
}
if (tile.frameX >= 1404 && tile.frameX <= 1710)
{
RecursiveReplaceToAstral(TileID.LargePiles, (ushort)mod.TileType("AstralIceLargePiles"), x, y, 324, 1404, 1710, 0, 18);
}
break;
case TileID.LargePiles2:
if (tile.frameX >= 1566 && tile.frameY < 36)
{
RecursiveReplaceToAstral(TileID.LargePiles2, (ushort)mod.TileType("AstralDesertLargePiles"), x, y, 324, 1566, 1872, 0, 18);
}
if (tile.frameX >= 756 && tile.frameX <= 900)
{
RecursiveReplaceToAstral(TileID.LargePiles2, (ushort)mod.TileType("AstralNormalLargePiles"), x, y, 324, 756, 900, 0, 18);
}
break;
case TileID.SmallPiles:
if (tile.frameY == 18)
{
ushort newType = 9999;
if (tile.frameX >= 1476 && tile.frameX <= 1674)
{
newType = (ushort)mod.TileType("AstralDesertMediumPiles");
}
else if (tile.frameX <= 558 || (tile.frameX >= 1368 && tile.frameX <= 1458))
{
newType = (ushort)mod.TileType("AstralNormalMediumPiles");
}
else if (tile.frameX >= 900 && tile.frameX <= 1098)
{
newType = (ushort)mod.TileType("AstralIceMediumPiles");
}
else
{
break;
}
int leftMost = x;
if (tile.frameX % 36 != 0) //this means it's the right tile of the two
{
leftMost--;
}
Main.tile[leftMost, y].type = newType;
Main.tile[leftMost + 1, y].type = newType;
while (Main.tile[leftMost, y].frameX >= 216)
{
Main.tile[leftMost, y].frameX -= 216;
Main.tile[leftMost + 1, y].frameX -= 216;
}
}
else if (tile.frameY == 0)
{
ushort newType3 = 9999;
if (tile.frameX >= 972 && tile.frameX <= 1062)
{
newType3 = (ushort)mod.TileType("AstralDesertSmallPiles");
}
else if (tile.frameX <= 486)
{
newType3 = (ushort)mod.TileType("AstralNormalSmallPiles");
}
else if (tile.frameX >= 648 && tile.frameX <= 846)
{
newType3 = (ushort)mod.TileType("AstralIceSmallPiles");
}
else
{
break;
}
Main.tile[x, y].type = newType3;
while (Main.tile[x, y].frameX >= 108) //REFRAME IT
{
Main.tile[x, y].frameX -= 108;
}
}
break;
case TileID.Stalactite:
int topMost = tile.frameY <= 54 ? (tile.frameY % 36 == 0 ? y : y - 1) : y;
bool twoTall = tile.frameY <= 54;
bool hanging = tile.frameY <= 18 || tile.frameY == 72;
ushort newType2 = 9999;
if (tile.frameX >= 378 && tile.frameX <= 414) //DESERT
{
newType2 = (ushort)mod.TileType("AstralDesertStalactite");
}
else if ((tile.frameX >= 54 && tile.frameX <= 90) || (tile.frameX >= 216 && tile.frameX <= 360))
{
newType2 = (ushort)mod.TileType("AstralNormalStalactite");
}
else if (tile.frameX <= 36)
{
newType2 = (ushort)mod.TileType("AstralIceStalactite");
}
else
{
break;
}
//Set types
Main.tile[x, topMost].type = newType2;
if (twoTall)
Main.tile[x, topMost + 1].type = newType2;
//Fix frames
while (Main.tile[x, topMost].frameX >= 54)
{
Main.tile[x, topMost].frameX -= 54;
if (twoTall)
Main.tile[x, topMost + 1].frameX -= 54;
}
if (hanging)
{
ConvertToAstral(x, topMost - 1);
break;
}
else
{
if (twoTall)
{
ConvertToAstral(x, topMost + 2);
break;
}
ConvertToAstral(x, topMost + 1);
break;
}
}
}
if (tileframe)
{
if (Main.netMode == 0)
{
WorldGen.SquareTileFrame(x, y, true);
}
else if (Main.netMode == 2)
{
NetMessage.SendTileSquare(-1, x, y, 1);
}
}
}
}
public static void ConvertFromAstral(int x, int y, ConvertType convert)
{
Tile tile = Main.tile[x, y];
int type = tile.type;
int wallType = tile.wall;
Mod mod = CalamityMod.Instance;
if (WorldGen.InWorld(x, y, 1))
{
#region WALL
if (wallType == mod.WallType("AstralDirtWall"))
{
Main.tile[x, y].wall = WallID.DirtUnsafe;
}
else if (wallType == mod.WallType("AstralGrassWall"))
{
switch (convert)
{
case ConvertType.Corrupt:
Main.tile[x, y].wall = WallID.CorruptGrassUnsafe;
break;
case ConvertType.Crimson:
Main.tile[x, y].wall = WallID.CrimsonGrassUnsafe;
break;
case ConvertType.Hallow:
Main.tile[x, y].wall = WallID.HallowedGrassUnsafe;
break;
case ConvertType.Pure:
Main.tile[x, y].wall = WallID.GrassUnsafe;
break;
}
}
else if (wallType == mod.WallType("AstralIceWall"))
{
Main.tile[x, y].wall = WallID.IceUnsafe;
}
else if (wallType == mod.WallType("AstralStoneWall"))
{
switch (convert)
{
case ConvertType.Corrupt:
Main.tile[x, y].wall = WallID.EbonstoneUnsafe;
break;
case ConvertType.Crimson:
Main.tile[x, y].wall = WallID.CrimstoneUnsafe;
break;
case ConvertType.Hallow:
Main.tile[x, y].wall = WallID.PearlstoneBrickUnsafe;
break;
case ConvertType.Pure:
Main.tile[x, y].wall = WallID.Stone;
break;
}
}
#endregion
#region TILE
if (type == mod.TileType("AstralDirt"))
{
tile.type = TileID.Dirt;
}
else if (type == mod.TileType("AstralGrass"))
{
SetTileFromConvert(x, y, convert, TileID.CorruptGrass, TileID.FleshGrass, TileID.HallowedGrass, TileID.Grass);
}
else if (type == mod.TileType("AstralStone"))
{
SetTileFromConvert(x, y, convert, TileID.Ebonstone, TileID.Crimstone, TileID.Pearlstone, TileID.Stone);
}
else if (type == mod.TileType("AstralSand"))
{
SetTileFromConvert(x, y, convert, TileID.Ebonsand, TileID.Crimsand, TileID.Pearlsand, TileID.Sand);
}
else if (type == mod.TileType("AstralSandstone"))
{
SetTileFromConvert(x, y, convert, TileID.CorruptSandstone, TileID.CrimsonSandstone, TileID.HallowSandstone, TileID.Sandstone);
}
else if (type == mod.TileType("HardenedAstralSand"))
{
SetTileFromConvert(x, y, convert, TileID.CorruptHardenedSand, TileID.CrimsonHardenedSand, TileID.HallowHardenedSand, TileID.HardenedSand);
}
else if (type == mod.TileType("AstralIce"))
{
SetTileFromConvert(x, y, convert, TileID.CorruptIce, TileID.FleshIce, TileID.HallowedIce, TileID.IceBlock);
}
else if (type == mod.TileType("AstralVines"))
{
SetTileFromConvert(x, y, convert, ushort.MaxValue, TileID.CrimsonVines, TileID.HallowedVines, TileID.Vines);
}
else if (type == mod.TileType("AstralShortPlants"))
{
SetTileFromConvert(x, y, convert, TileID.CorruptPlants, ushort.MaxValue, TileID.HallowedPlants, TileID.Plants);
}
else if (type == mod.TileType("AstralTallPlants"))
{
SetTileFromConvert(x, y, convert, ushort.MaxValue, ushort.MaxValue, TileID.HallowedPlants2, TileID.Plants2);
}
else if (type == mod.TileType("AstralNormalLargePiles"))
{
RecursiveReplaceFromAstral((ushort)type, TileID.LargePiles, x, y, 378, 0);
}
else if (type == mod.TileType("AstralNormalMediumPiles"))
{
RecursiveReplaceFromAstral((ushort)type, TileID.SmallPiles, x, y, 0, 18);
}
else if (type == mod.TileType("AstralNormalSmallPiles"))
{
RecursiveReplaceFromAstral((ushort)type, TileID.SmallPiles, x, y, 0, 0);
}
else if (type == mod.TileType("AstralDesertLargePiles"))
{
RecursiveReplaceFromAstral((ushort)type, TileID.LargePiles2, x, y, 1566, 0);
}
else if (type == mod.TileType("AstralDesertMediumPiles"))
{
RecursiveReplaceFromAstral((ushort)type, TileID.SmallPiles, x, y, 1476, 18);
}
else if (type == mod.TileType("AstralDesertSmallPiles"))
{
RecursiveReplaceFromAstral((ushort)type, TileID.SmallPiles, x, y, 972, 0);
}
else if (type == mod.TileType("AstralIceLargePiles"))
{
RecursiveReplaceFromAstral((ushort)type, TileID.LargePiles, x, y, 1404, 0);
}
else if (type == mod.TileType("AstralIceMediumPiles"))
{
RecursiveReplaceFromAstral((ushort)type, TileID.SmallPiles, x, y, 900, 18);
}
else if (type == mod.TileType("AstralIceSmallPiles"))
{
RecursiveReplaceFromAstral((ushort)type, TileID.SmallPiles, x, y, 648, 0);
}
else if (type == mod.TileType("AstralNormalStalactite"))
{
ushort originType = TileID.Stone;
int frameXAdd = 54;
switch (convert)
{
case ConvertType.Corrupt:
originType = TileID.Ebonstone;
frameXAdd = 324;
break;
case ConvertType.Crimson:
originType = TileID.Crimstone;
frameXAdd = 270;
break;
case ConvertType.Hallow:
originType = TileID.Pearlstone;
frameXAdd = 216;
break;
}
ReplaceAstralStalactite((ushort)type, TileID.Stalactite, originType, x, y, frameXAdd, 0);
}
else if (type == mod.TileType("AstralDesertStalactite"))
{
ushort originType = TileID.Sandstone;
int frameXAdd = 378;
switch (convert)
{
case ConvertType.Corrupt:
originType = TileID.CorruptSandstone;
frameXAdd = 324;
break;
case ConvertType.Crimson:
originType = TileID.CrimsonSandstone;
frameXAdd = 270;
break;
case ConvertType.Hallow:
originType = TileID.HallowSandstone;
frameXAdd = 216;
break;
}
ReplaceAstralStalactite((ushort)type, TileID.Stalactite, originType, x, y, frameXAdd, 0);
}
else if (type == mod.TileType("AstralIceStalactite"))
{
ReplaceAstralStalactite((ushort)type, TileID.Stalactite, TileID.IceBlock, x, y, 0, 0);
}
if (TileID.Sets.Conversion.Grass[type] || type == TileID.Dirt)
{
WorldGen.SquareTileFrame(x, y);
}
#endregion
}
}
private static void SetTileFromConvert(int x, int y, ConvertType convert, ushort corrupt, ushort crimson, ushort hallow, ushort pure)
{
switch (convert)
{
case ConvertType.Corrupt:
if (corrupt != ushort.MaxValue)
{
Main.tile[x, y].type = corrupt;
WorldGen.SquareTileFrame(x, y);
}
break;
case ConvertType.Crimson:
if (crimson != ushort.MaxValue)
{
Main.tile[x, y].type = crimson;
WorldGen.SquareTileFrame(x, y);
}
break;
case ConvertType.Hallow:
if (hallow != ushort.MaxValue)
{
Main.tile[x, y].type = hallow;
WorldGen.SquareTileFrame(x, y);
}
break;
case ConvertType.Pure:
if (pure != ushort.MaxValue)
{
Main.tile[x, y].type = pure;
WorldGen.SquareTileFrame(x, y);
}
break;
}
}
private static void RecursiveReplaceToAstral(ushort checkType, ushort replaceType, int x, int y, int replaceTextureWidth, int minFrameX = 0, int maxFrameX = int.MaxValue, int minFrameY = 0, int maxFrameY = int.MaxValue)
{
Tile tile = Main.tile[x, y];
if (tile == null || !tile.active() || tile.type != checkType || tile.frameX < minFrameX || tile.frameX > maxFrameX || tile.frameY < minFrameY || tile.frameY > maxFrameY)
return;
Main.tile[x, y].type = replaceType;
while (Main.tile[x, y].frameX >= replaceTextureWidth)
{
Main.tile[x, y].frameX -= (short)replaceTextureWidth;
}
RecursiveReplaceToAstral(checkType, replaceType, x - 1, y, replaceTextureWidth, minFrameX, maxFrameX, minFrameY, maxFrameY);
RecursiveReplaceToAstral(checkType, replaceType, x + 1, y, replaceTextureWidth, minFrameX, maxFrameX, minFrameY, maxFrameY);
RecursiveReplaceToAstral(checkType, replaceType, x, y - 1, replaceTextureWidth, minFrameX, maxFrameX, minFrameY, maxFrameY);
RecursiveReplaceToAstral(checkType, replaceType, x, y + 1, replaceTextureWidth, minFrameX, maxFrameX, minFrameY, maxFrameY);
}
private static void RecursiveReplaceFromAstral(ushort checkType, ushort replaceType, int x, int y, int addFrameX, int addFrameY)
{
Tile tile = Main.tile[x, y];
if (tile == null || !tile.active() || tile.type != checkType)
return;
Main.tile[x, y].type = replaceType;
Main.tile[x, y].frameX += (short)addFrameX;
Main.tile[x, y].frameY += (short)addFrameY;
RecursiveReplaceFromAstral(checkType, replaceType, x - 1, y, addFrameX, addFrameY);
RecursiveReplaceFromAstral(checkType, replaceType, x + 1, y, addFrameX, addFrameY);
RecursiveReplaceFromAstral(checkType, replaceType, x, y - 1, addFrameX, addFrameY);
RecursiveReplaceFromAstral(checkType, replaceType, x, y + 1, addFrameX, addFrameY);
}
private static void ReplaceAstralStalactite(ushort checkType, ushort replaceType, ushort replaceOriginTile, int x, int y, int addFrameX, int addFrameY)
{
Tile tile = Main.tile[x, y];
int topMost = tile.frameY <= 54 ? (tile.frameY % 36 == 0 ? y : y - 1) : y;
bool twoTall = tile.frameY <= 54;
bool hanging = tile.frameY <= 18 || tile.frameY == 72;
int yOriginTile = (hanging ? topMost - 1 : (twoTall ? topMost + 2 : y + 1));
Main.tile[x, topMost++].type = replaceType;
if (twoTall)
{
Main.tile[x, topMost].type = replaceType;
}
Main.tile[x, yOriginTile].type = replaceOriginTile;
}
private static bool CheckInEllipse(Point tile, Vector2 focus1, Vector2 focus2, float distanceConstant, Vector2 center, out float distance, bool collapse = false)
{
Vector2 point = tile.ToVector2() * 16f + new Vector2(8f);
if (collapse) //Collapse ensures the ellipse is shrunk down a lot in terms of distance.
{
float distY = center.Y - point.Y;
point.Y -= distY * 8f;
}
float distance1 = Vector2.Distance(point, focus1);
float distance2 = Vector2.Distance(point, focus2);
distance = distance1 + distance2;
return distance <= distanceConstant;
}
#endregion
#region EvilIsland
public static void EvilIsland(int i, int j)
+955
View File
@@ -0,0 +1,955 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using CalamityMod.Tiles;
namespace CalamityMod
{
public static class CustomTileFraming
{
private static int[][] PlantCheckAgainst;
private static Dictionary<ushort, ushort> VineToGrass;
public static bool[] tileMergeAstralDirt;
static CustomTileFraming()
{
Mod mod = CalamityMod.Instance;
int size = CalamityGlobalTile.PlantTypes.Length;
PlantCheckAgainst = new int[TileLoader.TileCount][];
PlantCheckAgainst[TileID.Plants] = new int[3] { TileID.Grass, TileID.PlanterBox, TileID.ClayPot };
PlantCheckAgainst[TileID.CorruptPlants] = new int[1] { TileID.CorruptGrass };
PlantCheckAgainst[TileID.JunglePlants] = new int[1] { TileID.JungleGrass };
PlantCheckAgainst[TileID.MushroomPlants] = new int[1] { TileID.MushroomGrass };
PlantCheckAgainst[TileID.Plants2] = new int[3] { TileID.Grass, TileID.PlanterBox, TileID.ClayPot };
PlantCheckAgainst[TileID.JunglePlants2] = new int[1]{ TileID.JungleGrass };
PlantCheckAgainst[TileID.HallowedPlants] = new int[1] { TileID.HallowedGrass };
PlantCheckAgainst[TileID.HallowedPlants2] = new int[1] { TileID.HallowedGrass };
PlantCheckAgainst[TileID.FleshWeeds] = new int[1] { TileID.FleshWeeds };
PlantCheckAgainst[CalamityMod.Instance.TileType("AstralShortPlants")] = new int[1] { mod.TileType("AstralGrass") };
PlantCheckAgainst[CalamityMod.Instance.TileType("AstralTallPlants")] = new int[1] { mod.TileType("AstralGrass") };
VineToGrass = new Dictionary<ushort, ushort>();
VineToGrass[TileID.Vines] = TileID.Grass;
VineToGrass[TileID.CrimsonVines] = TileID.FleshGrass;
VineToGrass[TileID.HallowedVines] = TileID.HallowedGrass;
VineToGrass[(ushort)mod.TileType("AstralVines")] = (ushort)mod.TileType("AstralGrass");
tileMergeAstralDirt = new bool[TileLoader.TileCount];
//TODO: REST OF THESE
tileMergeAstralDirt[mod.TileType("AstralOre")] = true;
tileMergeAstralDirt[mod.TileType("AstralStone")] = true;
tileMergeAstralDirt[mod.TileType("AstralSand")] = true;
}
private static bool PlantNeedsUpdate(int plantType, int checkType)
{
int size = PlantCheckAgainst[plantType].Length;
for (int i = 0; i < size; i++)
{
if (PlantCheckAgainst[plantType][i] == checkType)
{
return false;
}
}
return true;
}
public static void CheckPlants(int x, int y)
{
int checkType = -1;
int plantType = Main.tile[x, y].type;
if (y + 1 >= Main.maxTilesY)
checkType = plantType;
Tile tile = Main.tile[x, y];
Tile below = Main.tile[x, y + 1];
if (y + 1 < Main.maxTilesY && below != null && below.nactive() && !below.halfBrick() && below.slope() == 0)
checkType = below.type;
if (checkType == -1) return;
//Check if this plant needs an update
if (PlantNeedsUpdate(plantType, checkType))
{
if ((plantType == TileID.Plants || plantType == TileID.Plants2) && checkType != TileID.Grass && tile.frameX >= 162)
{
Main.tile[x, y].frameX = 126;
}
if (plantType == TileID.JunglePlants2 && checkType != TileID.JungleGrass && tile.frameX >= 162)
{
Main.tile[x, y].frameX = 126;
}
if (checkType == TileID.CorruptGrass)
{
plantType = TileID.CorruptPlants;
if (tile.frameX >= 162)
{
Main.tile[x, y].frameX = 126;
}
}
else if (checkType == TileID.Grass)
{
if (plantType == TileID.HallowedPlants2)
{
plantType = TileID.Plants2;
}
else
{
plantType = TileID.Plants;
}
}
else if (checkType == TileID.HallowedGrass)
{
if (plantType == TileID.Plants2)
{
plantType = TileID.HallowedPlants2;
}
else
{
plantType = TileID.HallowedPlants;
}
}
else if (checkType == TileID.FleshGrass)
{
plantType = TileID.FleshWeeds;
}
else if (checkType == TileID.MushroomGrass)
{
plantType = TileID.MushroomPlants;
while (Main.tile[x, y].frameX > 72)
{
Main.tile[x, y].frameX -= 72;
}
}
else if (checkType == CalamityMod.Instance.TileType("AstralGrass")) //ASTRAL
{
if (plantType == TileID.Plants || plantType == TileID.CorruptPlants ||
plantType == TileID.FleshWeeds || plantType == TileID.HallowedPlants ||
plantType == TileID.MushroomPlants || plantType == TileID.JunglePlants)
{
plantType = CalamityMod.Instance.TileType("AstralShortPlants");
}
else
{
plantType = CalamityMod.Instance.TileType("AstralTallPlants");
}
}
if (plantType != Main.tile[x, y].type)
{
Main.tile[x, y].type = (ushort)plantType;
return;
}
WorldGen.KillTile(x, y, false, false, false);
}
}
public static void VineFrame(int x, int y)
{
Tile tile = Main.tile[x, y];
int myType = tile.type;
Tile tile2 = Main.tile[x, y - 1];
Tile tile3 = Main.tile[x, y + 1];
Tile tile4 = Main.tile[x - 1, y];
Tile tile5 = Main.tile[x + 1, y];
Tile tile6 = Main.tile[x - 1, y + 1];
Tile tile7 = Main.tile[x + 1, y + 1];
Tile tile8 = Main.tile[x - 1, y - 1];
Tile tile9 = Main.tile[x + 1, y - 1];
int num52 = -1;
int num53 = -1;
int num54 = -1;
int num55 = -1;
int num56 = -1;
int num57 = -1;
int num58 = -1;
int num59 = -1;
if (tile4 != null && tile4.active())
{
if (Main.tileStone[(int)tile4.type])
{
num55 = 1;
}
else
{
num55 = (int)tile4.type;
}
if (tile4.slope() == 1 || tile4.slope() == 3)
{
num55 = -1;
}
}
if (tile5 != null && tile5.active())
{
if (Main.tileStone[(int)tile5.type])
{
num56 = 1;
}
else
{
num56 = (int)tile5.type;
}
if (tile5.slope() == 2 || tile5.slope() == 4)
{
num56 = -1;
}
}
if (tile2 != null && tile2.active())
{
if (Main.tileStone[(int)tile2.type])
{
num53 = 1;
}
else
{
num53 = (int)tile2.type;
}
if (tile2.slope() == 3 || tile2.slope() == 4)
{
num53 = -1;
}
}
if (tile3 != null && tile3.active())
{
if (Main.tileStone[(int)tile3.type])
{
num58 = 1;
}
else
{
num58 = (int)tile3.type;
}
if (tile3.slope() == 1 || tile3.slope() == 2)
{
num58 = -1;
}
}
if (tile8 != null && tile8.active())
{
if (Main.tileStone[(int)tile8.type])
{
num52 = 1;
}
else
{
num52 = (int)tile8.type;
}
}
if (tile9 != null && tile9.active())
{
if (Main.tileStone[(int)tile9.type])
{
num54 = 1;
}
else
{
num54 = (int)tile9.type;
}
}
if (tile6 != null && tile6.active())
{
if (Main.tileStone[(int)tile6.type])
{
num57 = 1;
}
else
{
num57 = (int)tile6.type;
}
}
if (tile7 != null && tile7.active())
{
if (Main.tileStone[(int)tile7.type])
{
num59 = 1;
}
else
{
num59 = (int)tile7.type;
}
}
if (tile.slope() == 2)
{
num53 = -1;
num55 = -1;
}
if (tile.slope() == 1)
{
num53 = -1;
num56 = -1;
}
if (tile.slope() == 4)
{
num58 = -1;
num55 = -1;
}
if (tile.slope() == 3)
{
num58 = -1;
num56 = -1;
}
if (tile2 != null)
{
if (!tile2.active())
{
num53 = -1;
}
else if (tile2.bottomSlope())
{
num53 = -1;
}
else
{
num53 = (int)tile2.type;
}
}
else
{
num53 = myType;
}
ushort[] vines = VineToGrass.Keys.ToArray();
for (int i = 0; i < vines.Length; i++)
{
ushort myGrassType = VineToGrass[(ushort)vines[i]];
if (myType != vines[i] && (num53 == myGrassType || num53 == vines[i]))
{
Main.tile[x, y].type = vines[i];
WorldGen.SquareTileFrame(x, y, true);
return;
}
}
if (num53 != myType)
{
bool flag17 = false;
if (num53 == -1)
{
flag17 = true;
}
else
{
for (int i = 0; i < vines.Length; i++)
{
if (myType != TileID.Vines)
{
if (myType == vines[i] && num53 != VineToGrass[vines[i]])
{
flag17 = true;
}
}
else if (num53 != TileID.Grass && num53 != TileID.LeafBlock)
{
flag17 = true;
}
}
}
if (flag17)
{
WorldGen.KillTile(x, y, false, false, false);
}
}
return;
}
enum Similarity
{
Same,
MergeLink,
None
}
public static void FrameTileForCustomMerge(int x, int y, int myType, int mergeType, bool forceSameDown = false, bool forceSameUp = false, bool forceSameLeft = false, bool forceSameRight = false, bool resetFrame = true)
{
bool tmp;
FrameTileForCustomMerge(x, y, myType, mergeType, out tmp, out tmp, out tmp, out tmp, forceSameDown, forceSameUp, forceSameLeft, forceSameRight, resetFrame);
}
public static void FrameTileForCustomMerge(int x, int y, int myType, int mergeType, out bool mergedUp, out bool mergedLeft, out bool mergedRight, out bool mergedDown, bool forceSameDown = false, bool forceSameUp = false, bool forceSameLeft = false, bool forceSameRight = false, bool resetFrame = true)
{
Tile tileLeft = Main.tile[x - 1, y];
Tile tileRight = Main.tile[x + 1, y];
Tile tileUp = Main.tile[x, y - 1];
Tile tileDown = Main.tile[x, y + 1];
Tile tileTopLeft = Main.tile[x - 1, y - 1];
Tile tileTopRight = Main.tile[x + 1, y - 1];
Tile tileBottomLeft = Main.tile[x - 1, y + 1];
Tile tileBottomRight = Main.tile[x + 1, y + 1];
//CARDINAL
Similarity leftSim = GetSimilarity(tileLeft, myType, mergeType);
if (forceSameLeft) leftSim = Similarity.Same;
Similarity rightSim = GetSimilarity(tileRight, myType, mergeType);
if (forceSameRight) rightSim = Similarity.Same;
Similarity upSim = GetSimilarity(tileUp, myType, mergeType);
if (forceSameUp) upSim = Similarity.Same;
Similarity downSim = GetSimilarity(tileDown, myType, mergeType);
if (forceSameDown) downSim = Similarity.Same;
//DIAGONAL
Similarity topLeftSim = GetSimilarity(tileTopLeft, myType, mergeType);
Similarity topRightSim = GetSimilarity(tileTopRight, myType, mergeType);
Similarity bottomLeftSim = GetSimilarity(tileBottomLeft, myType, mergeType);
Similarity bottomRightSim = GetSimilarity(tileBottomRight, myType, mergeType);
int randomFrame;
if (resetFrame)
{
randomFrame = WorldGen.genRand.Next(3);
Main.tile[x, y].frameNumber((byte)randomFrame);
}
else
{
randomFrame = Main.tile[x, y].frameNumber();
}
/* DEBUGGING
if (Player.tileTargetX == x && Player.tileTargetY == y)
{
Main.NewText(StringWriter(leftSim, rightSim, upSim, downSim, topLeftSim, topRightSim, bottomLeftSim, bottomRightSim, forceSameDown, forceSameUp, forceSameLeft, forceSameRight));
}*/
mergedDown = mergedLeft = mergedRight = mergedUp = false;
if (leftSim == Similarity.None)
{
if (upSim == Similarity.Same)
{
if (downSim == Similarity.Same)
{
if (rightSim == Similarity.Same)
{
SetFrameAt(x, y, 0, 18 * randomFrame);
return;
}
else if (rightSim == Similarity.MergeLink)
{
mergedRight = true;
SetFrameAt(x, y, 234 + 18 * randomFrame, 36);
return;
}
SetFrameAt(x, y, 90, 18 * randomFrame);
return;
}
else if (downSim == Similarity.MergeLink)
{
if (rightSim == Similarity.Same)
{
mergedDown = true;
SetFrameAt(x, y, 72, 90 + 18 * randomFrame);
return;
}
else if (rightSim == Similarity.MergeLink)
{
SetFrameAt(x, y, 108 + 18 * randomFrame, 54);
return;
}
mergedDown = true;
SetFrameAt(x, y, 126, 90 + 18 * randomFrame);
return;
}
if (rightSim == Similarity.Same)
{
SetFrameAt(x, y, 36 * randomFrame, 72);
return;
}
SetFrameAt(x, y, 108 + 18 * randomFrame, 54);
return;
}
else if (upSim == Similarity.MergeLink)
{
if (downSim == Similarity.Same)
{
if (rightSim == Similarity.Same)
{
mergedUp = true;
SetFrameAt(x, y, 72, 144 + 18 * randomFrame);
return;
}
else if (rightSim == Similarity.MergeLink)
{
SetFrameAt(x, y, 108 + 18 * randomFrame, 0);
return;
}
mergedUp = true;
SetFrameAt(x, y, 126, 144 + 18 * randomFrame);
return;
}
else if (downSim == Similarity.MergeLink)
{
if (rightSim == Similarity.Same)
{
SetFrameAt(x, y, 162, 18 * randomFrame);
return;
}
else if (rightSim == Similarity.MergeLink)
{
SetFrameAt(x, y, 162 + 18 * randomFrame, 54);
return;
}
mergedUp = true;
mergedDown = true;
SetFrameAt(x, y, 108, 216 + 18 * randomFrame);
return;
}
if (rightSim == Similarity.Same)
{
SetFrameAt(x, y, 162, 18 * randomFrame);
return;
}
else if (rightSim == Similarity.MergeLink)
{
SetFrameAt(x, y, 162 + 18 * randomFrame, 54);
return;
}
mergedUp = true;
SetFrameAt(x, y, 108, 144 + 18 * randomFrame);
return;
}
if (downSim == Similarity.Same)
{
if (rightSim == Similarity.Same)
{
SetFrameAt(x, y, 36 * randomFrame, 54);
return;
}
else if (rightSim == Similarity.MergeLink)
{
SetFrameAt(x, y, 108 + 18 * randomFrame, 0);
return;
}
SetFrameAt(x, y, 108 + 18 * randomFrame, 0);
return;
}
else if (downSim == Similarity.MergeLink)
{
if (rightSim == Similarity.Same)
{
SetFrameAt(x, y, 162, 18 * randomFrame);
return;
}
else if (rightSim == Similarity.MergeLink)
{
SetFrameAt(x, y, 162 + 18 * randomFrame, 54);
return;
}
mergedDown = true;
SetFrameAt(x, y, 108, 90 + 18 * randomFrame);
return;
}
if (rightSim == Similarity.Same)
{
SetFrameAt(x, y, 162, 18 * randomFrame);
return;
}
else if (rightSim == Similarity.MergeLink)
{
mergedRight = true;
SetFrameAt(x, y, 54 + 18 * randomFrame, 234);
return;
}
SetFrameAt(x, y, 162 + 18 * randomFrame, 54);
return;
}
else if (leftSim == Similarity.MergeLink)
{
if (upSim == Similarity.Same)
{
if (downSim == Similarity.Same)
{
if (rightSim == Similarity.Same)
{
mergedLeft = true;
SetFrameAt(x, y, 162, 126 + 18 * randomFrame);
return;
}
else if (rightSim == Similarity.MergeLink)
{
mergedLeft = true;
mergedRight = true;
SetFrameAt(x, y, 180, 126 + 18 * randomFrame);
return;
}
mergedLeft = true;
SetFrameAt(x, y, 234 + 18 * randomFrame, 54);
return;
}
else if (downSim == Similarity.MergeLink)
{
if (rightSim == Similarity.Same)
{
mergedLeft = mergedDown = true;
SetFrameAt(x, y, 36, 108 + 36 * randomFrame);
return;
}
else if (rightSim == Similarity.MergeLink)
{
mergedLeft = mergedRight = mergedDown = true;
SetFrameAt(x, y, 198, 144 + 18 * randomFrame);
return;
}
SetFrameAt(x, y, 108 + 18 * randomFrame, 54);
return;
}
if (rightSim == Similarity.Same)
{
mergedLeft = true;
SetFrameAt(x, y, 18 * randomFrame, 216);
return;
}
SetFrameAt(x, y, 108 + 18 * randomFrame, 54);
return;
}
else if (upSim == Similarity.MergeLink)
{
if (downSim == Similarity.Same)
{
if (rightSim == Similarity.Same)
{
mergedUp = mergedLeft = true;
SetFrameAt(x, y, 36, 90 + 36 * randomFrame);
return;
}
else if (rightSim == Similarity.MergeLink)
{
mergedLeft = mergedRight = mergedUp = true;
SetFrameAt(x, y, 198, 90 + 18 * randomFrame);
return;
}
SetFrameAt(x, y, 108 + 18 * randomFrame, 0);
return;
}
else if (downSim == Similarity.MergeLink)
{
if (rightSim == Similarity.Same)
{
mergedUp = mergedLeft = mergedDown = true;
SetFrameAt(x, y, 216, 90 + 18 * randomFrame);
return;
}
else if (rightSim == Similarity.MergeLink)
{
mergedDown = mergedLeft = mergedRight = mergedUp = true;
SetFrameAt(x, y, 108 + 18 * randomFrame, 198);
return;
}
SetFrameAt(x, y, 162 + 18 * randomFrame, 54);
return;
}
if (rightSim == Similarity.Same)
{
SetFrameAt(x, y, 162, 18 * randomFrame);
return;
}
SetFrameAt(x, y, 162 + 18 * randomFrame, 54);
return;
}
if (downSim == Similarity.Same)
{
if (rightSim == Similarity.Same)
{
mergedLeft = true;
SetFrameAt(x, y, 18 * randomFrame, 198);
return;
}
else if (rightSim == Similarity.MergeLink)
{
SetFrameAt(x, y, 108 + 18 * randomFrame, 0);
return;
}
SetFrameAt(x, y, 108 + 18 * randomFrame, 0);
return;
}
else if (downSim == Similarity.MergeLink)
{
if (rightSim == Similarity.Same)
{
SetFrameAt(x, y, 162, 18 * randomFrame);
return;
}
else if (rightSim == Similarity.MergeLink)
{
SetFrameAt(x, y, 162 + 18 * randomFrame, 54);
return;
}
SetFrameAt(x, y, 162 + 18 * randomFrame, 54);
return;
}
if (rightSim == Similarity.Same)
{
mergedLeft = true;
SetFrameAt(x, y, 18 * randomFrame, 252);
return;
}
else if (rightSim == Similarity.MergeLink)
{
mergedRight = mergedLeft = true;
SetFrameAt(x, y, 162 + 18 * randomFrame, 198);
return;
}
mergedLeft = true;
SetFrameAt(x, y, 18 * randomFrame, 234);
return;
}
if (upSim == Similarity.Same)
{
if (downSim == Similarity.Same)
{
if (rightSim == Similarity.Same)
{
#region FULL TILE STUFF
if (topLeftSim == Similarity.MergeLink || topRightSim == Similarity.MergeLink || bottomLeftSim == Similarity.MergeLink || bottomRightSim == Similarity.MergeLink)
{
if (bottomRightSim == Similarity.MergeLink)
{
SetFrameAt(x, y, 0, 90 + 36 * randomFrame);
return;
}
else if (bottomLeftSim == Similarity.MergeLink)
{
SetFrameAt(x, y, 18, 90 + 36 * randomFrame);
return;
}
else if (topRightSim == Similarity.MergeLink)
{
SetFrameAt(x, y, 0, 108 + 36 * randomFrame);
return;
}
SetFrameAt(x, y, 18, 108 + 36 * randomFrame);
return;
}
if (topLeftSim == Similarity.Same)
{
if (topRightSim == Similarity.Same)
{
if (bottomLeftSim == Similarity.Same)
{
SetFrameAt(x, y, 18 + 18 * randomFrame, 18);
return;
}
if (bottomRightSim == Similarity.Same)
{
SetFrameAt(x, y, 18 + 18 * randomFrame, 18);
return;
}
SetFrameAt(x, y, 108 + 18 * randomFrame, 36);
return;
}
if (bottomLeftSim == Similarity.Same)
{
if (bottomRightSim == Similarity.Same)
{
if (topRightSim == Similarity.MergeLink)
{
SetFrameAt(x, y, 0, 108 + 36 * randomFrame);
return;
}
SetFrameAt(x, y, 18 + 18 * randomFrame, 18);
return;
}
SetFrameAt(x, y, 198, 18 * randomFrame);
return;
}
}
else if (topLeftSim == Similarity.None)
{
if (topRightSim == Similarity.Same)
{
if (bottomRightSim == Similarity.Same)
{
if (bottomLeftSim == Similarity.Same)
{
SetFrameAt(x, y, 18 + 18 * randomFrame, 18);
return;
}
SetFrameAt(x, y, 18 + 18 * randomFrame, 18);
return;
}
if (bottomLeftSim == Similarity.Same)
{
SetFrameAt(x, y, 18 + 18 * randomFrame, 18);
return;
}
}
SetFrameAt(x, y, 18 + 18 * randomFrame, 18);
return;
}
SetFrameAt(x, y, 18 + 18 * randomFrame, 18);
return;
#endregion
}
else if (rightSim == Similarity.MergeLink)
{
mergedRight = true;
SetFrameAt(x, y, 144, 126 + 18 * randomFrame);
return;
}
SetFrameAt(x, y, 72, 18 * randomFrame);
return;
}
else if (downSim == Similarity.MergeLink)
{
if (rightSim == Similarity.Same)
{
mergedDown = true;
SetFrameAt(x, y, 144 + 18 * randomFrame, 90);
return;
}
else if (rightSim == Similarity.MergeLink)
{
mergedDown = mergedRight = true;
SetFrameAt(x, y, 54, 108 + 36 * randomFrame);
return;
}
mergedDown = true;
SetFrameAt(x, y, 90, 90 + 18 * randomFrame);
return;
}
if (rightSim == Similarity.Same)
{
SetFrameAt(x, y, 18 + 18 * randomFrame, 36);
return;
}
else if (rightSim == Similarity.MergeLink)
{
mergedRight = true;
SetFrameAt(x, y, 54 + 18 * randomFrame, 216);
return;
}
SetFrameAt(x, y, 18 + 36 * randomFrame, 72);
return;
}
else if (upSim == Similarity.MergeLink)
{
if (downSim == Similarity.Same)
{
if (rightSim == Similarity.Same)
{
mergedUp = true;
SetFrameAt(x, y, 144 + 18 * randomFrame, 108);
return;
}
else if (rightSim == Similarity.MergeLink)
{
mergedRight = mergedUp = true;
SetFrameAt(x, y, 54, 90 + 36 * randomFrame);
return;
}
mergedUp = true;
SetFrameAt(x, y, 90, 144 + 18 * randomFrame);
return;
}
else if (downSim == Similarity.MergeLink)
{
if (rightSim == Similarity.Same)
{
mergedUp = mergedDown = true;
SetFrameAt(x, y, 144 + 18 * randomFrame, 180);
return;
}
else if (rightSim == Similarity.MergeLink)
{
mergedUp = mergedRight = mergedDown = true;
SetFrameAt(x, y, 216, 144 + 18 * randomFrame);
return;
}
SetFrameAt(x, y, 216, 18 * randomFrame);
return;
}
if (rightSim == Similarity.Same)
{
mergedUp = true;
SetFrameAt(x, y, 234 + 18 * randomFrame, 18);
return;
}
SetFrameAt(x, y, 216, 18 * randomFrame);
return;
}
if (downSim == Similarity.Same)
{
if (rightSim == Similarity.Same)
{
SetFrameAt(x, y, 18 + 18 * randomFrame, 0);
return;
}
else if (rightSim == Similarity.MergeLink)
{
mergedRight = true;
SetFrameAt(x, y, 54 + 18 * randomFrame, 198);
return;
}
SetFrameAt(x, y, 18 + 36 * randomFrame, 54);
return;
}
else if (downSim == Similarity.MergeLink)
{
if (rightSim == Similarity.Same)
{
mergedDown = true;
SetFrameAt(x, y, 234 + 18 * randomFrame, 0);
return;
}
SetFrameAt(x, y, 216, 18 * randomFrame);
return;
}
if (rightSim == Similarity.Same)
{
SetFrameAt(x, y, 108 + 18 * randomFrame, 72);
return;
}
else if (rightSim == Similarity.MergeLink)
{
mergedRight = true;
SetFrameAt(x, y, 54 + 18 * randomFrame, 252);
return;
}
SetFrameAt(x, y, 216, 18 * randomFrame);
return;
}
private static void SetFrameAt(int x, int y, int frameX, int frameY)
{
Main.tile[x, y].frameX = (short)frameX;
Main.tile[x, y].frameY = (short)frameY;
}
private static Similarity GetSimilarity(Tile check, int myType, int mergeType)
{
if (!check.active()) return Similarity.None;
if (check.type == myType || Main.tileMerge[myType][check.type])
return Similarity.Same;
else if (check.type == mergeType)
return Similarity.MergeLink;
return Similarity.None;
}
private static string StringWriter(params object[] strings)
{
string s = "";
for (int i = 0; i < strings.Length; i++)
{
s += strings[i].ToString();
if (i != strings.Length - 1)
{
s += ", ";
}
}
return s;
}
}
}
+34
View File
@@ -0,0 +1,34 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Dusts
{
public class AstralBasic : ModDust
{
public override void OnSpawn(Dust dust)
{
dust.scale = Main.rand.NextFloat(0.9f, 1f);
}
public override bool Update(Dust dust)
{
//update position
dust.position += dust.velocity;
dust.scale -= 0.02f;
if (dust.scale < 0.1f)
{
dust.active = false;
}
return false;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 285 B

+53
View File
@@ -0,0 +1,53 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Dusts
{
public class AstralBlue : ModDust
{
public override void OnSpawn(Dust dust)
{
dust.noGravity = true;
}
public override bool Update(Dust dust)
{
//update position
dust.position += dust.velocity;
//shrink scale
dust.scale -= 0.02f;
if (!dust.noLight)
{
Lighting.AddLight(dust.position, 0.1f * dust.scale, 0.3f * dust.scale, 0.4f * dust.scale);
}
if (dust.customData != null)
{
if (dust.customData is bool && (bool)dust.customData) //slowdown or nah
{
dust.velocity *= 0.94f;
}
else if (dust.customData is float)
{
dust.scale -= (float)dust.customData;
}
}
if (dust.scale < 0.1f)
{
dust.active = false;
}
return false;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 274 B

+36
View File
@@ -0,0 +1,36 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Dusts
{
public class AstralChunk : ModDust
{
public override void OnSpawn(Dust dust)
{
dust.scale = Main.rand.NextFloat(0.9f, 1.2f);
}
public override bool Update(Dust dust)
{
//update position / rotation
dust.velocity.Y += 0.1f;
dust.position += dust.velocity;
dust.rotation += dust.velocity.X;
dust.alpha += 6;
if (dust.alpha > 240)
{
dust.active = false;
}
return false;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 299 B

+35
View File
@@ -0,0 +1,35 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Dusts
{
public class AstralEnemy : ModDust
{
public override void OnSpawn(Dust dust)
{
dust.scale = Main.rand.NextFloat(0.9f, 1f);
}
public override bool Update(Dust dust)
{
//update position
dust.position += dust.velocity;
dust.velocity.Y += 0.1f;
dust.scale -= 0.02f;
if (dust.scale < 0.1f)
{
dust.active = false;
}
return false;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 258 B

+53
View File
@@ -0,0 +1,53 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Dusts
{
public class AstralOrange : ModDust
{
public override void OnSpawn(Dust dust)
{
dust.noGravity = true;
}
public override bool Update(Dust dust)
{
//update position
dust.position += dust.velocity;
//shrink scale
dust.scale -= 0.02f;
if (!dust.noLight)
{
Lighting.AddLight(dust.position, 0.4f * dust.scale, 0.24f * dust.scale, 0.04f * dust.scale);
}
if (dust.customData != null)
{
if (dust.customData is bool && (bool)dust.customData) //slowdown or nah
{
dust.velocity *= 0.94f;
}
else if (dust.customData is float)
{
dust.scale -= (float)dust.customData;
}
}
if (dust.scale < 0.1f)
{
dust.active = false;
}
return false;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 273 B

Binary file not shown.
+15
View File
@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace CalamityMod
{
public enum ConvertType
{
Pure,
Corrupt,
Crimson,
Hallow
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 517 B

+182
View File
@@ -0,0 +1,182 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Terraria;
using Terraria.ModLoader;
using Terraria.Graphics.Effects;
using Terraria.GameContent.Shaders;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
namespace CalamityMod.Gores
{
public class AstralWaterDroplet : ModGore
{
public override void OnSpawn(Gore gore)
{
gore.numFrames = 15;
gore.behindTiles = true;
gore.timeLeft = Gore.goreTime * 3;
}
public override bool DrawBehind(Gore gore)
{
Main.instance.LoadGore(gore.type);
int num = Main.goreTexture[gore.type].Height / (int)gore.numFrames;
Color alpha = gore.GetAlpha(Lighting.GetColor((int)((double)gore.position.X + (double)Main.goreTexture[gore.type].Width * 0.5) / 16, (int)(((double)gore.position.Y + (double)num * 0.5) / 16.0)));
Main.spriteBatch.Draw(
Main.goreTexture[gore.type],
new Vector2(gore.position.X - Main.screenPosition.X + (float)(Main.goreTexture[gore.type].Width / 2), gore.position.Y - Main.screenPosition.Y + (float)(num / 2) - 2f),
new Rectangle(0, num * (int)gore.frame, Main.goreTexture[gore.type].Width, num),
alpha, gore.rotation,
new Vector2((float)(Main.goreTexture[gore.type].Width / 2), (float)(num / 2)),
gore.scale, SpriteEffects.None, 0f);
return false;
}
public override bool Update(Gore gore)
{
if ((double)gore.position.Y < Main.worldSurface * 16.0 + 8.0)
{
gore.alpha = 0;
}
else
{
gore.alpha = 100;
}
int num = 4;
gore.frameCounter++;
if (gore.frame <= 4)
{
int num2 = (int)(gore.position.X / 16f);
int num3 = (int)(gore.position.Y / 16f) - 1;
if (WorldGen.InWorld(num2, num3, 0) && !Main.tile[num2, num3].active())
{
gore.active = false;
}
if (gore.frame == 0)
{
num = 24 + Main.rand.Next(256);
}
if (gore.frame == 1)
{
num = 24 + Main.rand.Next(256);
}
if (gore.frame == 2)
{
num = 24 + Main.rand.Next(256);
}
if (gore.frame == 3)
{
num = 24 + Main.rand.Next(96);
}
if (gore.frame == 5)
{
num = 16 + Main.rand.Next(64);
}
if ((int)gore.frameCounter >= num)
{
gore.frameCounter = 0;
gore.frame += 1;
if (gore.frame == 5)
{
int num4 = Gore.NewGore(gore.position, gore.velocity, gore.type, 1f);
Main.gore[num4].frame = 9;
Main.gore[num4].velocity *= 0f;
}
}
}
else if (gore.frame <= 6)
{
num = 8;
if ((int)gore.frameCounter >= num)
{
gore.frameCounter = 0;
gore.frame += 1;
if (gore.frame == 7)
{
gore.active = false;
}
}
}
else if (gore.frame <= 9)
{
num = 6;
gore.velocity.Y = gore.velocity.Y + 0.2f;
if ((double)gore.velocity.Y < 0.5)
{
gore.velocity.Y = 0.5f;
}
if (gore.velocity.Y > 12f)
{
gore.velocity.Y = 12f;
}
if ((int)gore.frameCounter >= num)
{
gore.frameCounter = 0;
gore.frame += 1;
}
if (gore.frame > 9)
{
gore.frame = 7;
}
}
else
{
gore.velocity.Y = gore.velocity.Y + 0.1f;
if ((int)gore.frameCounter >= num)
{
gore.frameCounter = 0;
gore.frame += 1;
}
gore.velocity *= 0f;
if (gore.frame > 14)
{
gore.active = false;
}
}
Vector2 value3 = gore.velocity;
gore.velocity = Collision.TileCollision(gore.position, gore.velocity, 16, 14, false, false, 1);
if (gore.velocity != value3)
{
if (gore.frame < 10)
{
gore.frame = 10;
gore.frameCounter = 0;
if (gore.type != 716 && gore.type != 717 && gore.type != 943)
{
Main.PlaySound(39, (int)gore.position.X + 8, (int)gore.position.Y + 8, Main.rand.Next(2), 1f, 0f);
}
}
}
else if (Collision.WetCollision(gore.position + gore.velocity, 16, 14))
{
if (gore.frame < 10)
{
gore.frame = 10;
gore.frameCounter = 0;
if (gore.type != 716 && gore.type != 717 && gore.type != 943)
{
Main.PlaySound(39, (int)gore.position.X + 8, (int)gore.position.Y + 8, 2, 1f, 0f);
}
((WaterShaderData)Filters.Scene["WaterDistortion"].GetShader()).QueueRipple(gore.position + new Vector2(8f, 8f), 1f, RippleShape.Square, 0f);
}
int num21 = (int)(gore.position.X + 8f) / 16;
int num22 = (int)(gore.position.Y + 14f) / 16;
if (Main.tile[num21, num22] != null && Main.tile[num21, num22].liquid > 0)
{
gore.velocity *= 0f;
gore.position.Y = (float)(num22 * 16 - (int)(Main.tile[num21, num22].liquid / 16));
}
}
return true;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 696 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 322 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 283 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 294 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 356 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 290 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 310 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 417 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 432 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 584 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 348 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 443 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 371 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 457 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 529 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 304 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 391 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 402 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 309 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 309 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 300 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 517 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 353 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 328 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 383 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 342 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 278 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 473 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 372 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 364 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 342 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 307 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 278 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 339 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 313 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 284 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 232 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 416 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 278 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 320 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 275 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 247 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 480 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 430 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 311 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 296 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 379 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 601 B

+38
View File
@@ -0,0 +1,38 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Ammo
{
public class AstralSolution : ModItem
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Astral Solution");
Tooltip.SetDefault("Used by the Clentaminator.\nSpreads the Astral.");
}
public override void SetDefaults()
{
item.ammo = AmmoID.Solution;
item.shoot = mod.ProjectileType("AstralSpray") - ProjectileID.PureSpray;
item.width = 10;
item.height = 12;
//item.value = Item.buyPrice(0, 0, 25, 0);
item.rare = 3;
item.maxStack = 999;
item.consumable = true;
return;
}
public override bool ConsumeAmmo(Player player)
{
return !(player.itemAnimation < player.HeldItem.useAnimation - 3);
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 271 B

-36
View File
@@ -1,36 +0,0 @@
using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.DataStructures;
using Terraria.ID;
using Terraria.ModLoader;
using CalamityMod.Items;
namespace CalamityMod.Items {
public class AstralBar : ModItem
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Astral Bar");
}
public override void SetDefaults()
{
item.width = 15;
item.height = 12;
item.maxStack = 999;
item.value = 58750;
item.rare = 7;
}
public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(null, "Stardust", 12);
recipe.AddIngredient(null, "AstralOre", 8);
recipe.AddTile(TileID.AdamantiteForge);
recipe.SetResult(this, 4);
recipe.AddRecipe();
}
}}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 513 B

+44 -42
View File
@@ -5,51 +5,53 @@ using Terraria;
using Terraria.DataStructures;
using Terraria.ID;
using Terraria.ModLoader;
using CalamityMod.Items;
namespace CalamityMod.Items {
public class AstralHamaxe : ModItem
namespace CalamityMod.Items
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Astral Hamaxe");
}
public class AstralHamaxe : ModItem
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Astral Hamaxe");
}
public override void SetDefaults()
{
item.damage = 70;
item.crit += 25;
item.melee = true;
item.width = 38;
item.height = 36;
item.useTime = 10;
item.useAnimation = 20;
item.useTurn = true;
item.axe = 30;
item.hammer = 150;
item.useStyle = 1;
item.knockBack = 5f;
item.value = 350000;
item.rare = 7;
item.UseSound = SoundID.Item1;
item.autoReuse = true;
item.tileBoost += 3;
}
public override void MeleeEffects(Player player, Rectangle hitbox)
{
if (Main.rand.Next(5) == 0)
public override void SetDefaults()
{
int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 173);
item.damage = 70;
item.crit += 25;
item.melee = true;
item.width = 60;
item.height = 70;
item.useTime = 10;
item.useAnimation = 20;
item.useTurn = true;
item.axe = 30;
item.hammer = 150;
item.useStyle = 1;
item.knockBack = 5f;
item.value = 350000;
item.rare = 7;
item.UseSound = SoundID.Item1;
item.autoReuse = true;
item.tileBoost += 3;
}
public override void MeleeEffects(Player player, Rectangle hitbox)
{
Dust d = CalamityGlobalItem.MeleeDustHelper(player, Main.rand.Next(2) == 0 ? mod.DustType("AstralOrange") : mod.DustType("AstralBlue"), 0.48f, 50, 78, -0.1f, 0.1f);
if (d != null)
{
d.customData = 0.02f;
}
}
public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(null, "AstralBar", 8);
recipe.AddTile(TileID.MythrilAnvil);
recipe.SetResult(this);
recipe.AddRecipe();
}
}
public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(null, "AstralBar", 8);
recipe.AddTile(TileID.MythrilAnvil);
recipe.SetResult(this);
recipe.AddRecipe();
}
}}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 885 B

After

Width:  |  Height:  |  Size: 1.8 KiB

+43 -41
View File
@@ -5,50 +5,52 @@ using Terraria;
using Terraria.DataStructures;
using Terraria.ID;
using Terraria.ModLoader;
using CalamityMod.Items;
namespace CalamityMod.Items {
public class AstralPickaxe : ModItem
namespace CalamityMod.Items
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Astral Pickaxe");
}
public class AstralPickaxe : ModItem
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Astral Pickaxe");
}
public override void SetDefaults()
{
item.damage = 58;
item.crit += 25;
item.melee = true;
item.width = 36;
item.height = 36;
item.useTime = 5;
item.useAnimation = 10;
item.useTurn = true;
item.pick = 200;
item.useStyle = 1;
item.knockBack = 5f;
item.value = 350000;
item.rare = 7;
item.UseSound = SoundID.Item1;
item.autoReuse = true;
item.tileBoost += 3;
}
public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(null, "AstralBar", 7);
recipe.AddTile(TileID.MythrilAnvil);
recipe.SetResult(this);
recipe.AddRecipe();
}
public override void MeleeEffects(Player player, Rectangle hitbox)
{
if (Main.rand.Next(5) == 0)
public override void SetDefaults()
{
int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 173);
item.damage = 58;
item.crit += 25;
item.melee = true;
item.width = 50;
item.height = 60;
item.useTime = 5;
item.useAnimation = 10;
item.useTurn = true;
item.pick = 200;
item.useStyle = 1;
item.knockBack = 5f;
item.value = 350000;
item.rare = 7;
item.UseSound = SoundID.Item1;
item.autoReuse = true;
item.tileBoost += 3;
}
public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(null, "AstralBar", 7);
recipe.AddTile(TileID.MythrilAnvil);
recipe.SetResult(this);
recipe.AddRecipe();
}
public override void MeleeEffects(Player player, Rectangle hitbox)
{
Dust d = CalamityGlobalItem.MeleeDustHelper(player, Main.rand.Next(2) == 0 ? mod.DustType("AstralOrange") : mod.DustType("AstralBlue"), 0.56f, 40, 65, -0.13f, 0.13f);
if (d != null)
{
d.customData = 0.02f;
}
}
}
}}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 804 B

After

Width:  |  Height:  |  Size: 1.4 KiB

+39 -1
View File
@@ -264,5 +264,43 @@ namespace CalamityMod.Items
modPlayer.jellyfishNecklace = true;
}
}
}
/// <summary>
/// Dust helper to spawn dust for an item. Allows you to specify where on the item to spawn the dust, essentially. (ONLY WORKS FOR SWINGING WEAPONS?)
/// </summary>
/// <param name="player">The player using the item.</param>
/// <param name="dustType">The type of dust to use.</param>
/// <param name="chancePerFrame">The chance per frame to spawn the dust (0f-1f)</param>
/// <param name="minDistance">The minimum distance between the player and the dust</param>
/// <param name="maxDistance">The maximum distance between the player and the dust</param>
/// <param name="minRandRot">The minimum random rotation offset for the dust</param>
/// <param name="maxRandRot">The maximum random rotation offset for the dust</param>
/// <param name="minSpeed">The minimum speed that the dust should travel</param>
/// <param name="maxSpeed">The maximum speed that the dust should travel</param>
public static Dust MeleeDustHelper(Player player, int dustType, float chancePerFrame, float minDistance, float maxDistance, float minRandRot = -0.2f, float maxRandRot = 0.2f, float minSpeed = 0.9f, float maxSpeed = 1.1f)
{
if (Main.rand.NextFloat(1f) < chancePerFrame)
{
//Calculate values
//distance from player,
//the vector offset from the player center
//the vector between the pos and the player
float distance = Main.rand.NextFloat(minDistance, maxDistance);
Vector2 offset = (player.itemRotation - (MathHelper.PiOver4 * player.direction) + Main.rand.NextFloat(minRandRot, maxRandRot)).ToRotationVector2() * distance * player.direction;
Vector2 pos = player.Center + offset;
Vector2 vec = pos - player.Center;
//spawn the dust
Dust d = Dust.NewDustPerfect(pos, dustType);
//normalise vector and multiply by velocity magnitude
vec.Normalize();
d.velocity = vec * Main.rand.NextFloat(minSpeed, maxSpeed);
return d;
}
return null;
}
}
}
+44
View File
@@ -0,0 +1,44 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Placeables
{
public class AstralBar : ModItem
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Astral Bar");
}
public override void SetDefaults()
{
item.createTile = mod.TileType("AstralBar");
item.useStyle = 1;
item.useTurn = true;
item.useAnimation = 15;
item.useTime = 10;
item.autoReuse = true;
item.consumable = true;
item.width = 16;
item.height = 16;
item.maxStack = 99;
}
public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
//ASTRAL_IMPLEMENT: UNDO THIS COMMENT
//recipe.AddIngredient(null, "Stardust", 12);
recipe.AddIngredient(mod.ItemType("AstralOre"), 8);
recipe.AddTile(TileID.AdamantiteForge);
recipe.SetResult(this, 4);
recipe.AddRecipe();
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 648 B

+43
View File
@@ -0,0 +1,43 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Placeables
{
public class AstralDirt : ModItem
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Astral Dirt");
}
public override void SetDefaults()
{
item.createTile = mod.TileType("AstralDirt");
item.useStyle = 1;
item.useTurn = true;
item.useAnimation = 15;
item.useTime = 10;
item.autoReuse = true;
item.consumable = true;
item.width = 16;
item.height = 16;
item.maxStack = 999;
}
public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddTile(18);
recipe.AddIngredient(mod.ItemType("AstralDirtWall"), 4);
recipe.SetResult(this, 1);
recipe.AddRecipe();
base.AddRecipes();
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 232 B

+43
View File
@@ -0,0 +1,43 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Items.Placeables
{
public class AstralDirtWall : ModItem
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Astral Dirt Wall");
}
public override void SetDefaults()
{
//item.createWall = mod.TileType("AstralDirtWall");
item.createWall = Terraria.ID.WallID.Cave8Unsafe;
item.useStyle = 1;
item.useTurn = true;
item.useAnimation = 15;
item.useTime = 10;
item.autoReuse = true;
item.consumable = true;
item.width = 16;
item.height = 16;
item.maxStack = 999;
}
public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddTile(18);
recipe.AddIngredient(mod.ItemType("AstralDirt"));
recipe.SetResult(this, 4);
recipe.AddRecipe();
base.AddRecipes();
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 406 B

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