예제 #1
0
        public static int Buff(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];

            float mult = -lifeRegen;

            mult += (lifeRegen * multiplier1 * multiplier2 * multiplier3);
            return((int)mult);
        }
예제 #2
0
        //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);
        }
예제 #3
0
        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);
        }
예제 #4
0
        public override void ModifyWeaponDamage(Item item, Player player, ref float add, ref float mult, ref float flat)
        {
            ElementHelper elementHelper = new ElementHelper();
            Element       element       = elementHelper.Quatrinary(item);

            float[] boosts = player.GetModPlayer <HeldItems.HeldItemsPlayer>().boosts;
            boostMult = boosts[(int)elementHelper.Quatrinary(item)];

            weatherMult   = 1;
            weatherReason = string.Empty;
            if (Main.expertMode)
            {
                if (player.ZoneOverworldHeight || player.ZoneSkyHeight || player.ZoneDirtLayerHeight)
                {
                    if (Main.bloodMoon)
                    {
                        if (element == Element.blood)
                        {
                            weatherReason = "Blood moon";
                            weatherMult   = Config.RainMultiplier;
                        }
                    }
                    if (Main.eclipse)
                    {
                        if (element == Element.dark)
                        {
                            weatherReason = "Eclipse";
                            weatherMult   = Config.RainMultiplier;
                        }
                    }
                    if (player.ZoneRain && !player.ZoneDesert && !player.ZoneSnow)
                    {
                        if (element == Element.water)
                        {
                            weatherReason = "Rain";
                            weatherMult   = Config.RainMultiplier;
                        }
                        if (element == Element.fire)
                        {
                            weatherReason = "Rain";
                            weatherMult   = 1 / Config.RainMultiplier;
                        }
                    }
                    if (player.ZoneSnow && player.ZoneSnow)
                    {
                        if (element == Element.ice)
                        {
                            weatherReason = "Snow";
                            weatherMult   = Config.RainMultiplier;
                        }
                    }
                    if (player.ZoneSandstorm)
                    {
                        switch (element)
                        {
                        case Element.ground:
                        case Element.rock:
                        case Element.steel:
                            weatherReason = "Sandstorm";
                            weatherMult   = Config.RainMultiplier;
                            break;
                        }
                    }
                }
            }

            float myMult = weatherMult + boostMult;

            if (myMult != 1)
            {
                mult = myMult;
            }
        }