public static float STAB(object attack, object defense) { ElementHelper elementHelper = new ElementHelper(); int defensePrimary = (int)elementHelper.Primary(defense); int defenseSecondary = (int)elementHelper.Secondary(defense); int defenseTertiary = (int)elementHelper.Tertiary(defense); int attackQuatrinary = (int)elementHelper.Quatrinary(attack); float multiplier = 1.0f; if (attackQuatrinary != (int)Element.none) { if (defensePrimary == attackQuatrinary) { multiplier *= Config.STAB; } else if (defenseSecondary == attackQuatrinary) { multiplier *= Config.STAB; } else if (defenseTertiary == attackQuatrinary) { multiplier *= Config.STAB; } } if (!Main.expertMode) { multiplier = (multiplier + 1) / 2; } return(multiplier); }
public static int LifeRegen(object buff, object defense, int lifeRegen) { ElementHelper elementHelper = new ElementHelper(); int defensePrimary = (int)elementHelper.Primary(defense); int defenseSecondary = (int)elementHelper.Secondary(defense); int defenseTertiary = (int)elementHelper.Tertiary(defense); int attackQuatrinary = (int)elementHelper.Quatrinary(buff); float multiplier1 = Table.Effectiveness[attackQuatrinary, defensePrimary]; float multiplier2 = Table.Effectiveness[attackQuatrinary, defenseSecondary]; float multiplier3 = Table.Effectiveness[attackQuatrinary, defenseTertiary]; return((int)(lifeRegen * multiplier1 * multiplier2 * multiplier3)); }
//public static string Text(object attack, object defense) //{ // ElementHelper elementHelper = new ElementHelper(); // int defensePrimary = (int)elementHelper.Primary(defense); // int defenseSecondary = (int)elementHelper.Secondary(defense); // int defenseTertiary = (int)elementHelper.Tertiary(defense); // int attackQuatrinary = (int)elementHelper.Quatrinary(attack); // float multiplier1 = Table.Effectiveness[attackQuatrinary, defensePrimary]; // float multiplier2 = Table.Effectiveness[attackQuatrinary, defenseSecondary]; // float multiplier3 = Table.Effectiveness[attackQuatrinary, defenseTertiary]; // string text = string.Empty; // int mult = (int)(multiplier1 * multiplier2 * multiplier3 * 10); // if (mult == 0) // text = "Immune!"; // if (mult == 0.25) // text = "" // return text; //} public static float Damage(object attack, object defense) { ElementHelper elementHelper = new ElementHelper(); int defensePrimary = (int)elementHelper.Primary(defense); int defenseSecondary = (int)elementHelper.Secondary(defense); int defenseTertiary = (int)elementHelper.Tertiary(defense); int attackQuatrinary = (int)elementHelper.Quatrinary(attack); float multiplier1 = Table.Effectiveness[attackQuatrinary, defensePrimary]; float multiplier2 = Table.Effectiveness[attackQuatrinary, defenseSecondary]; float multiplier3 = Table.Effectiveness[attackQuatrinary, defenseTertiary]; float dmg = multiplier1 * multiplier2 * multiplier3; if (dmg != 0) { if (!Main.expertMode) { dmg = (dmg + dmg + 1) / 3; } } return(dmg); }
public override void ModifyInterfaceLayers(List <GameInterfaceLayer> layers) { PlayerInput.SetZoom_Unscaled(); PlayerInput.SetZoom_MouseInWorld(); Microsoft.Xna.Framework.Rectangle rectangle1 = new Microsoft.Xna.Framework.Rectangle((int)((double)Main.mouseX + (double)Main.screenPosition.X), (int)((double)Main.mouseY + (double)Main.screenPosition.Y), 1, 1); if ((double)Main.player[Main.myPlayer].gravDir == -1.0) { rectangle1.Y = (int)Main.screenPosition.Y + Main.screenHeight - Main.mouseY; } PlayerInput.SetZoom_UI(); IngameOptions.MouseOver(); IngameFancyUI.MouseOver(); for (int index1 = 0; index1 < 200; ++index1) { if (Main.npc[index1].active) { Rectangle rectangle2 = new Rectangle((int)Main.npc[index1].Bottom.X - Main.npc[index1].frame.Width / 2, (int)Main.npc[index1].Bottom.Y - Main.npc[index1].frame.Height, Main.npc[index1].frame.Width, Main.npc[index1].frame.Height); if (Main.npc[index1].type >= 87 && Main.npc[index1].type <= 92) { rectangle2 = new Rectangle((int)((double)Main.npc[index1].position.X + (double)Main.npc[index1].width * 0.5 - 32.0), (int)((double)Main.npc[index1].position.Y + (double)Main.npc[index1].height * 0.5 - 32.0), 64, 64); } bool flag1 = rectangle1.Intersects(rectangle2); bool flag2 = flag1 || Main.SmartInteractShowingGenuine && Main.SmartInteractNPC == index1; if (flag2 && ( Main.npc[index1].type != 85 && Main.npc[index1].type != 341 && Main.npc[index1].aiStyle != 87 || Main.npc[index1].ai[0] != 0.0) && Main.npc[index1].type != 488) { if (flag1) { ElementHelper elementHelper = new ElementHelper(); float buffer = 4 * Main.UIScale; float prev = 0; Element Primary = elementHelper.Primary(Main.npc[index1]); Element Secondary = elementHelper.Secondary(Main.npc[index1]); Element Tertiary = elementHelper.Tertiary(Main.npc[index1]); Element Quatrinary = elementHelper.Quatrinary(Main.npc[index1]); var icon1 = GetTexture("Types/" + Formal.Name[Primary]); var icon2 = GetTexture("Types/" + Formal.Name[Secondary]); var icon3 = GetTexture("Types/" + Formal.Name[Tertiary]); var icon4 = GetTexture("Types/" + Formal.Name[Quatrinary]); int yOffset = 38; int xOffset = 12; Main.spriteBatch.Begin(); int x = (int)((Main.mouseX + xOffset) * Main.UIScale); int y = (int)((Main.mouseY + yOffset) * Main.UIScale); if (Primary != Element.none && Primary != Element.levitate) { Main.spriteBatch.Draw(icon1, new Vector2(x + prev, y), null, Color.White, 0, new Vector2(0, 0), Main.UIScale, SpriteEffects.None, 0); prev += icon1.Width * Main.UIScale + buffer; } if (Secondary != Element.none && Secondary != Element.levitate) { Main.spriteBatch.Draw(icon2, new Vector2(x + prev, y), null, Color.White, 0, new Vector2(0, 0), Main.UIScale, SpriteEffects.None, 0); prev += icon2.Width * Main.UIScale + buffer; } if (Tertiary != Element.none && Tertiary != Element.levitate) { Main.spriteBatch.Draw(icon3, new Vector2(Main.mouseX + prev, Main.mouseY), null, Color.White, 0, new Vector2(0, 0), Main.UIScale, SpriteEffects.None, 0); } if (Quatrinary != Element.none && Quatrinary != Element.levitate) { Main.spriteBatch.Draw(icon4, new Vector2(x, y + icon1.Width * Main.UIScale + buffer), null, Color.White, 0, new Vector2(0, 0), Main.UIScale, SpriteEffects.None, 0); } Main.spriteBatch.End(); break; } break; } } } //PlayerInput.SetZoom_UI(); base.ModifyInterfaceLayers(layers); }