diff --git a/Models/MinionModel.cs b/Models/MinionModel.cs index 25b7bf9..3cd9fcd 100644 --- a/Models/MinionModel.cs +++ b/Models/MinionModel.cs @@ -4,17 +4,17 @@ namespace SummonersAssociation.Models { - public class MinionModel - { - public int ItemID { get; set; } - public int BuffID { get; set; } - public List ProjectileIDs { get; set; } + public class MinionModel + { + public int ItemID { get; set; } + public int BuffID { get; set; } + public List ProjectileIDs { get; set; } - public MinionModel(int itemID, int buffID, List projectileIDs) - { - this.ItemID = itemID; - this.BuffID = buffID; - this.ProjectileIDs = projectileIDs; - } - } + public MinionModel(int itemID, int buffID, List projectileIDs) + { + this.ItemID = itemID; + this.BuffID = buffID; + this.ProjectileIDs = projectileIDs; + } + } } \ No newline at end of file diff --git a/Projectiles/BloodTailismanGlobalProjectile.cs b/Projectiles/BloodTailismanGlobalProjectile.cs index 7eab54d..0fe48a3 100644 --- a/Projectiles/BloodTailismanGlobalProjectile.cs +++ b/Projectiles/BloodTailismanGlobalProjectile.cs @@ -49,39 +49,40 @@ public override void ModifyHitNPC(Projectile projectile, NPC target, ref int dam { if (Main.projectile[j].active && Main.projectile[j].owner == projectile.owner) { - if (Main.projectile[j].type == mod.ProjectileType()){ + if (Main.projectile[j].type == mod.ProjectileType()) + { p = Main.projectile[j]; break; } - } + } } if (p != null) { - if(Vector2.Distance(p.Center , target.Center/*projectile.Center*/) < 50) + if (Vector2.Distance(p.Center, target.Center/*projectile.Center*/) < 50) { // 155 max // 10x damage - if(p.alpha == 155) + if (p.alpha == 155) { damage *= 10; knockback *= 2.5f; // 1.5 } // 5 to almost 10x - else if(p.alpha < 170) + else if (p.alpha < 170) { damage = (int)((5 + ((170 - p.alpha) / 5f)) * damage); // 5 to 10 - knockback *= (1.75f + .75f*((195 - p.alpha) / 25f)); // .75 to 1.5 + knockback *= (1.75f + .75f * ((195 - p.alpha) / 25f)); // .75 to 1.5 } // else if (p.alpha < 195) { damage = (int)((2.5 + ((195 - p.alpha) / 10f)) * damage); - knockback *= ((1.3f + .3f*((195 - p.alpha) / 25f)) ); + knockback *= ((1.3f + .3f * ((195 - p.alpha) / 25f))); } else if (p.alpha < 220) { damage = (int)((1.25 + ((220 - p.alpha) / 20f)) * damage); - knockback *= ((1.15f + .15f*((195 - p.alpha) / 25f))); + knockback *= ((1.15f + .15f * ((195 - p.alpha) / 25f))); } else /*if (p.alpha < 255)*/ { diff --git a/SummonersAssociation.cs b/SummonersAssociation.cs index 8bf446d..323351d 100644 --- a/SummonersAssociation.cs +++ b/SummonersAssociation.cs @@ -11,195 +11,191 @@ using SummonersAssociation.Models; using SummonersAssociation.Items; +using Terraria.Localization; namespace SummonersAssociation { - public class SummonersAssociation : Mod - { - private static List SupportedMinions = new List() { - new MinionModel(ItemID.SlimeStaff, BuffID.BabySlime, new List() { 266 }), - new MinionModel(ItemID.HornetStaff, BuffID.HornetMinion, new List() { 373 }), - new MinionModel(ItemID.ImpStaff, BuffID.ImpMinion, new List() { 375 }), - new MinionModel(ItemID.SpiderStaff, BuffID.SpiderMinion, new List() { 390, 391, 392 }), - new MinionModel(ItemID.OpticStaff, BuffID.TwinEyesMinion, new List() { 387, 388 }), - new MinionModel(ItemID.PirateStaff, BuffID.PirateMinion, new List() { 393, 394, 395 }), - new MinionModel(ItemID.PygmyStaff, BuffID.Pygmies, new List() { 191, 192, 193, 194 }), - new MinionModel(ItemID.XenoStaff, BuffID.UFOMinion, new List() { 423 }), - new MinionModel(ItemID.RavenStaff, BuffID.Ravens, new List() { 317 }), - new MinionModel(ItemID.TempestStaff, BuffID.SharknadoMinion, new List() { 407 }), - new MinionModel(ItemID.DeadlySphereStaff, BuffID.DeadlySphere, new List() { 533 }), - new MinionModel(ItemID.StardustDragonStaff, BuffID.StardustDragonMinion, new List() { 626 }), // and 627? + public class SummonersAssociation : Mod + { + private static List SupportedMinions = new List() { + new MinionModel(ItemID.SlimeStaff, BuffID.BabySlime, new List() { 266 }), + new MinionModel(ItemID.HornetStaff, BuffID.HornetMinion, new List() { 373 }), + new MinionModel(ItemID.ImpStaff, BuffID.ImpMinion, new List() { 375 }), + new MinionModel(ItemID.SpiderStaff, BuffID.SpiderMinion, new List() { 390, 391, 392 }), + new MinionModel(ItemID.OpticStaff, BuffID.TwinEyesMinion, new List() { 387, 388 }), + new MinionModel(ItemID.PirateStaff, BuffID.PirateMinion, new List() { 393, 394, 395 }), + new MinionModel(ItemID.PygmyStaff, BuffID.Pygmies, new List() { 191, 192, 193, 194 }), + new MinionModel(ItemID.XenoStaff, BuffID.UFOMinion, new List() { 423 }), + new MinionModel(ItemID.RavenStaff, BuffID.Ravens, new List() { 317 }), + new MinionModel(ItemID.TempestStaff, BuffID.SharknadoMinion, new List() { 407 }), + new MinionModel(ItemID.DeadlySphereStaff, BuffID.DeadlySphere, new List() { 533 }), + new MinionModel(ItemID.StardustDragonStaff, BuffID.StardustDragonMinion, new List() { 626 }), // and 627? new MinionModel(ItemID.StardustCellStaff, BuffID.StardustMinion, new List() { 613 }) - }; - - public SummonersAssociation() - { } - - public override void AddRecipeGroups() - { - List itemList = new List(); - foreach (MinionModel minion in SummonersAssociation.SupportedMinions) - { - itemList.Add(minion.ItemID); - } - -#pragma warning disable CS0618 // Type or member is obsolete (Lang.misc) - RecipeGroup group = new RecipeGroup(() => Lang.misc[37].Value + " Minion Staff", itemList.ToArray()); -#pragma warning restore CS0618 // Type or member is obsolete - - RecipeGroup.RegisterGroup("SummonersAssociation:MinionStaffs", group); - -#pragma warning disable CS0618 // Type or member is obsolete (Lang.misc) - group = new RecipeGroup(() => Lang.misc[37].Value + " Magic Mirror", new int[] -#pragma warning restore CS0618 // Type or member is obsolete - { - ItemID.IceMirror, - ItemID.MagicMirror - }); - RecipeGroup.RegisterGroup("SummonersAssociation:MagicMirrors", group); - } - - public override void PostDrawInterface(SpriteBatch spriteBatch) - { - // Give this to everyone because why not - if (Main.playerInventory) - { - DisplayMaxMinionIcon(Main.LocalPlayer); - } - - if (!Main.LocalPlayer.GetModPlayer().SummonersAssociationCardInInventory) - { - return; - } - - // But only give them the buff info if they carry the card! - if (!Main.ingameOptionsWindow && !Main.playerInventory/* && !Main.achievementsWindow*/) - { - UpdateBuffText(Main.LocalPlayer); - } - } - - private void UpdateBuffText(Player player) - { - float vanillaMinionSlots = 0; - int xPosition; - int yPosition; - Color color; - int buffsPerLine = 11; - bool TwoLines = false; - for (int b = 0; b < 22; ++b) - { - if (player.buffType[b] > 0) - { - if (b == 11) - { - TwoLines = true; - } - int buffID = player.buffType[b]; - xPosition = 32 + b * 38; - yPosition = 76; - if (b >= buffsPerLine) - { - xPosition = 32 + (b - buffsPerLine) * 38; - yPosition += 50; - } - color = new Color(Main.buffAlpha[b], Main.buffAlpha[b], Main.buffAlpha[b], Main.buffAlpha[b]); - - int number = 0; - - // Check to see if this buff represents a minion or not - MinionModel minion = SummonersAssociation.SupportedMinions.SingleOrDefault(minionEntry => minionEntry.BuffID == buffID); - if (minion != null) - { - List projectileList = minion.ProjectileIDs; - - foreach (int projectile in projectileList) - { - number = player.ownedProjectileCounts[projectile]; - } - - string text2 = number + " / " + player.maxMinions; - if (buffID == BuffID.TwinEyesMinion) - { - text2 = number + " / " + 2 * player.maxMinions; - vanillaMinionSlots += number / 2f; - } - else - { - vanillaMinionSlots += number; - } - Main.spriteBatch.DrawString(Main.fontItemStack, text2, new Vector2((float)xPosition, (float)(yPosition + Main.buffTexture[buffID].Height)), color, 0.0f, new Vector2(), 0.8f, SpriteEffects.None, 0.0f); - } - } - } - // Count mod minions. - //color = new Color(Main.buffAlpha[1], Main.buffAlpha[1], Main.buffAlpha[1], Main.buffAlpha[1]); - color = new Color(.4f, .4f, .4f, .4f); - xPosition = 32; - yPosition = 76 + 20; - if (TwoLines) - { - yPosition += 50; - } - float otherMinions = 0; - - for (int j = 0; j < 1000; j++) - { - if (Main.projectile[j].active && Main.projectile[j].owner == player.whoAmI && Main.projectile[j].minion) - { - otherMinions += Main.projectile[j].minionSlots; - } - } - otherMinions = otherMinions - vanillaMinionSlots; - if (otherMinions > 0) - { - string modMinionText = "Uncountable mod minions: " + otherMinions + " / " + player.maxMinions; - Main.spriteBatch.DrawString(Main.fontItemStack, modMinionText, new Vector2((float)xPosition, (float)(yPosition + Main.buffTexture[1].Height)), color, 0.0f, new Vector2(), 0.8f, SpriteEffects.None, 0.0f); - } - } - - private void DisplayMaxMinionIcon(Player player) - { - if (Main.EquipPage == 0) - { - int mH = 0; - if (Main.mapEnabled) - { - if (!Main.mapFullscreen && Main.mapStyle == 1) - { - mH = 256; - } - if (mH + 600 > Main.screenHeight) - { - mH = Main.screenHeight - 600; - } - } - - int num8 = 6; - int slot = num8; - int num9 = Main.screenWidth - 64 - 28; - - float inventoryScale = 0.85f; - - int num11 = mH + (int)((double)(174 + 0) + (double)(slot * 56) * (double)inventoryScale); - Vector2 vector2_1 = new Vector2((float)(num9 - 10 - 47 - 47 - 14), (float)num11 + (float)Main.inventoryBackTexture.Height * 0.5f); - Main.spriteBatch.Draw(Main.buffTexture[150], vector2_1, new Microsoft.Xna.Framework.Rectangle?(), Color.White, 0.0f, Utils.Size(Main.buffTexture[150]) / 2f, inventoryScale, SpriteEffects.None, 0.0f); - Vector2 vector2_2 = Main.fontMouseText.MeasureString(player.maxMinions.ToString()); - Terraria.UI.Chat.ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, Main.fontMouseText, player.maxMinions.ToString(), vector2_1 - vector2_2 * 0.5f * inventoryScale, Color.White, 0.0f, Vector2.Zero, new Vector2(inventoryScale), -1f, 2f); - if (Utils.CenteredRectangle(vector2_1, Utils.Size(Main.buffTexture[150])).Contains(new Point(Main.mouseX, Main.mouseY))) - { - player.mouseInterface = true; - string str = "" + player.maxMinions + " Max Minions"; - if (!string.IsNullOrEmpty(str)) - Main.hoverItemName = str; - } - } - } - - // TODO: summonersAssociation.Call("Buff->Projectile", BuffType("CoolMinionBuff"), ProjectileType("CoolMinionProjectile")); style call. - //public override object Call(params object[] args) - //{ - // return base.Call(args); - //} - } + }; + + public SummonersAssociation() + { } + + public override void AddRecipeGroups() + { + List itemList = new List(); + foreach (MinionModel minion in SummonersAssociation.SupportedMinions) + { + itemList.Add(minion.ItemID); + } + + RecipeGroup group = new RecipeGroup(() => Language.GetTextValue("LegacyMisc.37") + " Minion Staff", itemList.ToArray()); + RecipeGroup.RegisterGroup("SummonersAssociation:MinionStaffs", group); + + group = new RecipeGroup(() => Language.GetTextValue("LegacyMisc.37") + " Magic Mirror", new int[] + { + ItemID.IceMirror, + ItemID.MagicMirror + }); + RecipeGroup.RegisterGroup("SummonersAssociation:MagicMirrors", group); + } + + public override void PostDrawInterface(SpriteBatch spriteBatch) + { + // Give this to everyone because why not + if (Main.playerInventory) + { + DisplayMaxMinionIcon(Main.LocalPlayer); + } + + if (!Main.LocalPlayer.GetModPlayer().SummonersAssociationCardInInventory) + { + return; + } + + // But only give them the buff info if they carry the card! + if (!Main.ingameOptionsWindow && !Main.playerInventory/* && !Main.achievementsWindow*/) + { + UpdateBuffText(Main.LocalPlayer); + } + } + + private void UpdateBuffText(Player player) + { + float vanillaMinionSlots = 0; + int xPosition; + int yPosition; + Color color; + int buffsPerLine = 11; + bool TwoLines = false; + for (int b = 0; b < 22; ++b) + { + if (player.buffType[b] > 0) + { + if (b == 11) + { + TwoLines = true; + } + int buffID = player.buffType[b]; + xPosition = 32 + b * 38; + yPosition = 76; + if (b >= buffsPerLine) + { + xPosition = 32 + (b - buffsPerLine) * 38; + yPosition += 50; + } + color = new Color(Main.buffAlpha[b], Main.buffAlpha[b], Main.buffAlpha[b], Main.buffAlpha[b]); + + int number = 0; + + // Check to see if this buff represents a minion or not + MinionModel minion = SummonersAssociation.SupportedMinions.SingleOrDefault(minionEntry => minionEntry.BuffID == buffID); + if (minion != null) + { + List projectileList = minion.ProjectileIDs; + + foreach (int projectile in projectileList) + { + number += player.ownedProjectileCounts[projectile]; + } + + string text2 = number + " / " + player.maxMinions; + if (buffID == BuffID.TwinEyesMinion) + { + text2 = number + " / " + 2 * player.maxMinions; + vanillaMinionSlots += number / 2f; + } + else + { + vanillaMinionSlots += number; + } + Main.spriteBatch.DrawString(Main.fontItemStack, text2, new Vector2((float)xPosition, (float)(yPosition + Main.buffTexture[buffID].Height)), color, 0.0f, new Vector2(), 0.8f, SpriteEffects.None, 0.0f); + } + } + } + // Count mod minions. + //color = new Color(Main.buffAlpha[1], Main.buffAlpha[1], Main.buffAlpha[1], Main.buffAlpha[1]); + color = new Color(.4f, .4f, .4f, .4f); + xPosition = 32; + yPosition = 76 + 20; + if (TwoLines) + { + yPosition += 50; + } + float otherMinions = 0; + + for (int j = 0; j < 1000; j++) + { + if (Main.projectile[j].active && Main.projectile[j].owner == player.whoAmI && Main.projectile[j].minion) + { + otherMinions += Main.projectile[j].minionSlots; + } + } + otherMinions = otherMinions - vanillaMinionSlots; + if (otherMinions > 0) + { + string modMinionText = "Uncountable mod minions: " + otherMinions + " / " + player.maxMinions; + Main.spriteBatch.DrawString(Main.fontItemStack, modMinionText, new Vector2((float)xPosition, (float)(yPosition + Main.buffTexture[1].Height)), color, 0.0f, new Vector2(), 0.8f, SpriteEffects.None, 0.0f); + } + } + + private void DisplayMaxMinionIcon(Player player) + { + if (Main.EquipPage == 0) + { + int mH = 0; + if (Main.mapEnabled) + { + if (!Main.mapFullscreen && Main.mapStyle == 1) + { + mH = 256; + } + if (mH + 600 > Main.screenHeight) + { + mH = Main.screenHeight - 600; + } + } + + int num8 = 6; + int slot = num8; + int num9 = Main.screenWidth - 64 - 28; + + float inventoryScale = 0.85f; + + int num11 = mH + (int)((double)(174 + 0) + (double)(slot * 56) * (double)inventoryScale); + Vector2 vector2_1 = new Vector2((float)(num9 - 10 - 47 - 47 - 14), (float)num11 + (float)Main.inventoryBackTexture.Height * 0.5f); + Main.spriteBatch.Draw(Main.buffTexture[150], vector2_1, new Microsoft.Xna.Framework.Rectangle?(), Color.White, 0.0f, Utils.Size(Main.buffTexture[150]) / 2f, inventoryScale, SpriteEffects.None, 0.0f); + Vector2 vector2_2 = Main.fontMouseText.MeasureString(player.maxMinions.ToString()); + Terraria.UI.Chat.ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, Main.fontMouseText, player.maxMinions.ToString(), vector2_1 - vector2_2 * 0.5f * inventoryScale, Color.White, 0.0f, Vector2.Zero, new Vector2(inventoryScale), -1f, 2f); + if (Utils.CenteredRectangle(vector2_1, Utils.Size(Main.buffTexture[150])).Contains(new Point(Main.mouseX, Main.mouseY))) + { + player.mouseInterface = true; + string str = "" + player.maxMinions + " Max Minions"; + if (!string.IsNullOrEmpty(str)) + Main.hoverItemName = str; + } + } + } + + // TODO: summonersAssociation.Call("Buff->Projectile", BuffType("CoolMinionBuff"), ProjectileType("CoolMinionProjectile")); style call. + //public override object Call(params object[] args) + //{ + // return base.Call(args); + //} + } } diff --git a/SummonersAssociation.csproj b/SummonersAssociation.csproj index 82282e5..2371d66 100644 --- a/SummonersAssociation.csproj +++ b/SummonersAssociation.csproj @@ -36,14 +36,7 @@ - - - - - - - - + @@ -63,11 +56,11 @@ ..\..\XNA Framework Dlls\Microsoft.Xna.Framework.Xact.dll - D:\Work\Terraria\tModLoader\references\ReLogic.dll + ..\..\..\Modding\tModLoader\references\ReLogic.dll - D:\Work\Terraria\tModLoader\tModLoader.Windows.v0.10.1.1\Terraria.exe + C:\Program Files (x86)\Steam\steamapps\common\Terraria\Terraria.exe diff --git a/build.txt b/build.txt index 6136d69..61f9c67 100644 --- a/build.txt +++ b/build.txt @@ -1,10 +1,10 @@ author = jopojelly -version = 0.3.0 +version = 0.3 displayName = Summoners Association homepage = http://forums.terraria.org/index.php?threads/summoners-association.30041/ buildIgnore = .vs\*, *.csproj, *.user, obj\*, bin\*, *.config, .git\*, README.md, .gitignore includePDB = true hideCode = false hideResources = false -includeSource = true +includeSource = false languageVersion = 6 diff --git a/icon.png b/icon.png new file mode 100644 index 0000000..46e0609 Binary files /dev/null and b/icon.png differ