Skip to content

Commit

Permalink
does thing (Thorium Patch, and misc)
Browse files Browse the repository at this point in the history
  • Loading branch information
UriBuilder committed Dec 31, 2022
1 parent c1f853a commit d13c266
Show file tree
Hide file tree
Showing 17 changed files with 338 additions and 56 deletions.
10 changes: 5 additions & 5 deletions Aequus.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions AequusHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -829,6 +829,27 @@ public static int FixedDamage(this NPC npc)
return Main.masterMode ? npc.damage / 3 : Main.expertMode ? npc.damage / 2 : npc.damage;
}

public static void DrawLineList(List<Vector2> list)
{
Texture2D texture = TextureAssets.FishingLine.Value;
Rectangle frame = texture.Frame();
Vector2 origin = new Vector2(frame.Width / 2, 2);

Vector2 pos = list[0];
for (int i = 0; i < list.Count - 1; i++)
{
Vector2 element = list[i];
Vector2 diff = list[i + 1] - element;

float rotation = diff.ToRotation() - MathHelper.PiOver2;
Color color = Lighting.GetColor(element.ToTileCoordinates(), Color.White);
Vector2 scale = new Vector2(1, (diff.Length() + 2) / frame.Height);

Main.EntitySpriteDraw(texture, pos - Main.screenPosition, frame, color, rotation, origin, scale, SpriteEffects.None, 0);

pos += diff;
}
}
public static void DrawLine(Vector2 start, float rotation, float length, float width, Color color)
{
Main.spriteBatch.Draw(TextureAssets.MagicPixel.Value, start, new Rectangle(0, 0, 1, 1), color, rotation, new Vector2(1f, 0.5f), new Vector2(length, width), SpriteEffects.None, 0f);
Expand Down
22 changes: 14 additions & 8 deletions Content/CrossMod/ModCalls/ModCallManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@

namespace Aequus.Content.CrossMod.ModCalls
{
/// <summary>
/// Check https://terrariamods.wiki.gg/wiki/Aequus/Mod_Calls
/// </summary>
public class ModCallManager
{
public const string Success = "Success";
Expand Down Expand Up @@ -46,17 +49,20 @@ public static object HandleModCall(object[] args)
case "PylonColor":
{
var key = new Point(AequusHelpers.UnboxInt.Unbox(args[2]), args.Length > 4 ? AequusHelpers.UnboxInt.Unbox(args[3]) : 0);
int index = args.Length > 4 ? 4 : 3;
if (args[index] is Color color)
if (args.Length >= 3)
{
AequusTile.PylonColors[key] = () => color;
}
else if (args[index] is Func<Color> getColor)
{
AequusTile.PylonColors[key] = getColor;
int index = args.Length > 4 ? 4 : 3;
if (args[index] is Color color)
{
AequusTile.PylonColors[key] = () => color;
}
else if (args[index] is Func<Color> getColor)
{
AequusTile.PylonColors[key] = getColor;
}
}
return AequusTile.PylonColors[key];
}
return null;

case "NecromancyDatabase":
return NecromancyDatabase.CallAddNecromancyData(mod, args);
Expand Down
28 changes: 28 additions & 0 deletions Content/CrossMod/ThoriumModSupport.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using Aequus.Common;
using Terraria.ModLoader;

namespace Aequus.Content.CrossMod
{
public class ThoriumModSupport : IAddRecipes
{
public static Mod ThoriumMod { get; private set; }

void ILoadable.Load(Mod mod)
{
}

void IAddRecipes.AddRecipes(Aequus aequus)
{
ThoriumMod = null;
if (ModLoader.TryGetMod("ThoriumMod", out var thoriumMod))
{
ThoriumMod = thoriumMod;
}
}

void ILoadable.Unload()
{
ThoriumMod = null;
}
}
}
26 changes: 19 additions & 7 deletions Content/Necromancy/NecromancyDatabase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -215,11 +215,6 @@ public static int CalcPriority(float tiering, int life, int damage, int defense,
/// <para>Parameter 1: NPC Type (short)</para>
/// <para>Parameter 2: Tier (float), <see cref="ZombieScepter"/> is tier 1, <see cref="Insurgency"/> is tier 4</para>
/// <para>Parameter 3 (Optional): View range (float), how close a slave needs to be to an enemy in order for it to target it. Defaults to 800</para>
/// <para>Parameter 4+ (Optional): Two paired arguments. One string and one value</para>
/// <para>A successful mod call would look like:</para>
/// <code>aequus.Call("NecroStats", ModContent.NPCType{...}(), 1f);</code> OR
/// <code>aequus.Call("NecroStats", ModContent.NPCType{...}(), 1f, 800f);</code> OR
/// <code>aequus.Call("NecroStats", ModContent.NPCType{...}(), 1f, 800f, "PrioritizePlayerMultiplier", 4f);</code>
/// <para>Please handle these mod calls in <see cref="Mod.PostSetupContent"/>. As buff immunities are setup in <see cref="IAddRecipes.AddRecipes(Aequus)"/></para>
/// </summary>
/// <param name="callingMod"></param>
Expand All @@ -237,10 +232,27 @@ public static object CallAddNecromancyData(Mod callingMod, object[] args)
{
AequusHelpers.UnboxFloat.TryUnbox(args[4], out viewDistance);
}
var stats = new GhostInfo(tier, viewDistance);
if (args.Length > 5 && args[5] != null)
{
AequusHelpers.UnboxInt.TryUnbox(args[5], out stats.despawnPriority);
}
if (args.Length > 6 && args[6] != null)
{
AequusHelpers.UnboxBoolean.TryUnbox(args[6], out stats.DontModifyVelocity);
}
if (args.Length > 7 && args[7] != null)
{
AequusHelpers.UnboxInt.TryUnbox(args[7], out int slotsUsed);
stats.slotsUsed = slotsUsed;
}
if (args.Length > 8 && args[8] != null)
{
AequusHelpers.UnboxFloat.TryUnbox(args[8], out float timeLeftMultiplier);
stats.TimeLeftMultiplier = timeLeftMultiplier;
}
if (Aequus.LogMore)
Aequus.Instance.Logger.Info("Adding necromancy data for: " + Lang.GetNPCName(npc) + " -- Tier: " + tier + ", SightRange: " + viewDistance + " --");
var stats = new GhostInfo(tier, viewDistance);
stats = (GhostInfo)ICrapModCallHandler.HandleArgs(stats, args.Length >= 5 ? 5 : 4, args);
NPCs.Set(npc, stats);
}
catch (Exception ex)
Expand Down
8 changes: 4 additions & 4 deletions Content/WorldGeneration/CrabCreviceGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -596,10 +596,10 @@ public void Generate(GenerationProgress progress)
{
reccomendedDir = Main.dungeonX * 2 < Main.maxTilesX ? 1 : -1;
}
//else if (AQMod.thoriumMod.IsActive)
//{
// reccomendedDir = Main.dungeonX * 2 < Main.maxTilesX ? -1 : 1;
//}
else if (ThoriumModSupport.ThoriumMod != null)
{
reccomendedDir = Main.dungeonX * 2 < Main.maxTilesX ? -1 : 1;
}

for (int i = 0; i < 5000; i++)
{
Expand Down
Binary file removed Items/Weapons/Magic/Dayrise.png
Binary file not shown.
43 changes: 43 additions & 0 deletions Items/Weapons/Magic/WindFan.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
using Aequus.Items.Misc.Energies;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace Aequus.Items.Weapons.Magic
{
public class WindFan : ModItem
{
public override bool IsLoadingEnabled(Mod mod)
{
return false;
}

public override void SetStaticDefaults()
{
SacrificeTotal = 1;
}

public override void SetDefaults()
{
Item.DefaultToMagicWeapon(ProjectileID.BallofFrost, 40, 12f, hasAutoReuse: true);
Item.SetWeaponValues(50, 10f, bonusCritChance: 21);
Item.rare = ItemDefaults.RarityDustDevil;
Item.value = ItemDefaults.DustDevilValue;
}

public override void AddRecipes()
{
CreateRecipe()
.AddIngredient(ItemID.FlowerofFire)
.AddIngredient(ItemID.FlowerofFrost)
.AddIngredient<AtmosphericEnergy>()
.AddTile(TileID.MythrilAnvil)
.TryRegisterAfter(ItemID.SkyFracture);
}

public override bool MeleePrefix()
{
return true;
}
}
}
Binary file added Items/Weapons/Magic/WindFan.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion Items/Weapons/Ranged/Slingsaber.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public override void AddRecipes()
.AddIngredient<Slingshot>()
.AddIngredient(ItemID.HallowedBar, 12)
.AddIngredient(ItemID.SoulofSight, 20)
.AddIngredient<AtmosphericEnergy>()
.AddIngredient<CosmicEnergy>()
.AddTile(TileID.MythrilAnvil)
.Register();
}
Expand Down
43 changes: 43 additions & 0 deletions Items/Weapons/Summon/Whip/TornadoWhip.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
using Aequus.Items.Misc.Energies;
using Aequus.Projectiles.Summon.Whip;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace Aequus.Items.Weapons.Summon.Whip
{
public class TornadoWhip : ModItem
{
public override bool IsLoadingEnabled(Mod mod)
{
return false;
}

public override void SetStaticDefaults()
{
SacrificeTotal = 1;
}

public override void SetDefaults()
{
Item.DefaultToWhip(ModContent.ProjectileType<TornadoWhipProj>(), 33, 5f, 4f);
Item.rare = ItemDefaults.RarityDustDevil;
Item.value = ItemDefaults.DustDevilValue;
}

public override void AddRecipes()
{
CreateRecipe()
.AddIngredient(ItemID.FireWhip)
.AddIngredient(ItemID.CoolWhip)
.AddIngredient<AtmosphericEnergy>()
.AddTile(TileID.MythrilAnvil)
.TryRegisterAfter(ItemID.CoolWhip);
}

public override bool MeleePrefix()
{
return true;
}
}
}
Loading

0 comments on commit d13c266

Please sign in to comment.