Exemplo n.º 1
0
        public override bool CanEquipAccessory(Item item, Player player, int slot)
        {
            PlayerEdits modPlayer = player.GetModPlayer <PlayerEdits>();

            if (JobHooks.CanEquip(item, player))
            {
                return(base.CanEquipAccessory(item, player, slot));
            }
            return(false);
        }
Exemplo n.º 2
0
        public override bool CanUseItem(Item item, Player player)
        {
            PlayerEdits modPlayer = player.GetModPlayer <PlayerEdits>();

            if (JobHooks.CanEquip(item, player))
            {
                return(base.CanUseItem(item, player));
            }
            return(false);
        }
Exemplo n.º 3
0
        public override void ModifyWeaponDamage(Item item, Player player, ref float add, ref float mult, ref float flat)
        {
            ItemEdits   modItem   = item.GetGlobalItem <ItemEdits>();
            PlayerEdits modPlayer = player.GetModPlayer <PlayerEdits>();

            if (modItem.chemical == true)
            {
                add += ((player.thrownDamage - 1f) / 2 + (modPlayer.chemicalDamage - 1f));
                mult = modPlayer.chemicalDamageMult * player.allDamageMult;
            }
        }
Exemplo n.º 4
0
 public override bool CheckDead(NPC npc)
 {
     if (base.CheckDead(npc))
     {
         PlayerEdits modPlayer = Main.player[Main.myPlayer].GetModPlayer <PlayerEdits>();
         if (npc.type == NPCID.WallofFlesh && modPlayer.defeatedWoF == false)
         {
             modPlayer.defeatedWoF = true;
         }
     }
     return(base.CheckDead(npc));
 }
Exemplo n.º 5
0
        public override void UpdateInventory(Item item, Player player)
        {
            base.UpdateInventory(item, player);
            PlayerEdits modPlayer = player.GetModPlayer <PlayerEdits>();

            if (item.melee == true)
            {
                if (modPlayer.job == JobID.rogue)
                {
                    if (item.type != ItemID.PaladinsHammer && item.type != ItemID.SolarEruption)
                    {
                        item.shoot = ProjectileID.None;
                    }
                    item.autoReuse = true;
                }
                else
                {
                    Item originalitem = item.DeepClone();
                    item.shoot     = originalitem.shoot;
                    item.autoReuse = originalitem.autoReuse;
                }
            }
        }
Exemplo n.º 6
0
        public override void UpdateArmorSet(Player player, string set)
        {
            base.UpdateArmorSet(player, set);
            PlayerEdits modPlayer = player.GetModPlayer <PlayerEdits>();
            string      Root      = "Mods.ClassOverhaul";

            if (Language.Exists($"{Root}.ArmorSetBonus." + set))
            {
                player.setBonus = Language.GetTextValue($"{Root}.ArmorSetBonus." + set);
            }
            switch (set)
            {
            case "Apprentice":
            case "DarkArtist":
                if (modPlayer.job == JobID.summoner)
                {
                    modPlayer.armorJob = JobID.mage;
                }
                else
                {
                    modPlayer.armorJob = JobID.summoner;
                }
                break;

            case "Huntress":
            case "RedRiding":
                if (modPlayer.job == JobID.summoner)
                {
                    modPlayer.armorJob = JobID.ranger;
                }
                else
                {
                    modPlayer.armorJob = JobID.summoner;
                }
                break;

            case "Squire":
            case "ValhallaKnight":
                if (modPlayer.job == JobID.summoner)
                {
                    modPlayer.armorJob = JobID.knight;
                }
                else
                {
                    modPlayer.armorJob = JobID.summoner;
                }
                break;

            case "Monk":
            case "ShinobiInfiltrator":
                if (modPlayer.job == JobID.summoner)
                {
                    modPlayer.armorJob = JobID.rogue;
                }
                else
                {
                    modPlayer.armorJob = JobID.summoner;
                }
                player.thrownVelocity += 0.30f;
                break;

            case "FrostArmor":
                if (modPlayer.job == JobID.knight)
                {
                    modPlayer.armorJob = JobID.ranger;
                }
                else
                {
                    modPlayer.armorJob = JobID.knight;
                }
                break;

            case "ForbiddenArmor":
                if (modPlayer.job == JobID.mage)
                {
                    modPlayer.armorJob = JobID.summoner;
                }
                else
                {
                    modPlayer.armorJob = JobID.mage;
                }
                break;

            case "BeetleScaleArmor":
                player.thrownVelocity += 0.25f;
                break;

            case "AdamantiteKnight":
                player.meleeSpeed -= 0.09f;    // 9% on set
                player.moveSpeed  -= 0.09f;    // 9% on set
                break;

            case "MythrilKnight":
                player.meleeCrit -= 2;     // 3% on set
                break;

            case "CobaltKnight":
                player.meleeSpeed -= 0.07f;     // 8% on set
                break;

            case "HallowedKnight":
                player.meleeSpeed -= 0.8f;     // 11% on set
                player.moveSpeed  -= 0.10f;    // 9% on set
                break;
            }
        }
Exemplo n.º 7
0
        public override void ModifyTooltips(Item item, List <TooltipLine> tooltips)
        {
            string    Root    = "Mods.ClassOverhaul";
            ItemEdits modItem = item.GetGlobalItem <ItemEdits>();

            if (modItem.chemical == true)
            {
                var tt = tooltips.FirstOrDefault(x => x.Name == "Damage" && x.mod == "Terraria");
                if (tt != null)
                {
                    string[] split = tt.text.Split(' ');
                    tt.text = split.First() + " " + Language.GetTextValue($"{Root}.CommonName.ChemicalDamage");
                }
            }
            if (modItem.magicDefense > 0)
            {
                TooltipLine socialDesc = tooltips.FirstOrDefault(x => x.Name == "SocialDesc" && x.mod == "Terraria");
                if (socialDesc == null)
                {
                    TooltipLine defense = tooltips.FirstOrDefault(x => x.Name == "Defense" && x.mod == "Terraria");
                    TooltipLine damage  = tooltips.FirstOrDefault(x => x.Name == "Damage" && x.mod == "Terraria");
                    TooltipLine favDesc = tooltips.FirstOrDefault(x => x.Name == "FavoriteDesc" && x.mod == "Terraria");
                    TooltipLine line    = new TooltipLine(mod, "Magic Defense", modItem.magicDefense + " " + Language.GetTextValue($"{Root}.CommonName.MagicDefense"));
                    if (defense != null)
                    {
                        tooltips.Insert(tooltips.FindIndex(x => x.Name == "Defense" && x.mod == "Terraria") + 1, line);
                    }
                    else if (damage != null)
                    {
                        tooltips.Insert(tooltips.FindIndex(x => x.Name == "Damage" && x.mod == "Terraria") + 1, line);
                    }
                    else if (favDesc != null)
                    {
                        tooltips.Insert(tooltips.FindIndex(x => x.Name == "FavoriteDesc" && x.mod == "Terraria") + 1, line);
                    }
                    else
                    {
                        tooltips.Insert(tooltips.FindIndex(x => x.Name == "ItemName" && x.mod == "Terraria") + 1, line);
                    }
                }
            }

            PlayerEdits modPlayer = Main.player[Main.myPlayer].GetModPlayer <PlayerEdits>();

            if (item.melee == true && (modPlayer.job == JobID.rogue || modPlayer.armorJob == JobID.rogue) && item.type != ItemID.SolarEruption)
            {
                TooltipLine line = tooltips.FirstOrDefault(x => x.Name == "Damage" && x.mod == "Terraria");
                if (line != null)
                {
                    TooltipLine armorPen = new TooltipLine(mod, "Armor Penetration", (item.rare * 2).ToString() + " " + Language.GetTextValue($"{Root}.CommonName.ArmorPenetration"));
                    tooltips.Insert(tooltips.FindIndex(x => x.Name == "Damage" && x.mod == "Terraria") + 1, armorPen);
                }
            }
            if (IsModItem(item) == false && Language.Exists($"{Root}.VanillaItemTooltip." + ItemID.Search.GetName(item.type)))
            {
                tooltips.RemoveAll(x => x.Name == "Tooltip1" && x.mod == "Terraria");
                TooltipLine line = tooltips.FirstOrDefault(x => x.Name == "Tooltip0" && x.mod == "Terraria");
                if (line != null)
                {
                    line.text = Language.GetTextValue($"{Root}.VanillaItemTooltip." + ItemID.Search.GetName(item.type));
                }
            }
            if (item.prefix == mod.PrefixType("Blessed") || item.prefix == mod.PrefixType("Runic") ||
                item.prefix == mod.PrefixType("Witchs") || item.prefix == mod.PrefixType("Magic"))
            {
                TooltipLine line = new TooltipLine(mod, "PrefixAccMagicDefense", "");
                line.isModifier = true;
                tooltips.Add(line);
                line = tooltips.FirstOrDefault(x => x.Name == "PrefixAccMagicDefense" && x.mod == mod.Name);
                if (item.prefix == mod.PrefixType("Magic"))
                {
                    line.text = "+1 " + Language.GetTextValue($"{Root}.CommonName.MagicDefense");
                }
                if (item.prefix == mod.PrefixType("Blessed"))
                {
                    line.text = "+2 " + Language.GetTextValue($"{Root}.CommonName.MagicDefense");
                }
                if (item.prefix == mod.PrefixType("Runic"))
                {
                    line.text = "+3 " + Language.GetTextValue($"{Root}.CommonName.MagicDefense");
                }
                if (item.prefix == mod.PrefixType("Witchs"))
                {
                    line.text = "+4 " + Language.GetTextValue($"{Root}.CommonName.MagicDefense");
                }
            }
            else
            {
                tooltips.RemoveAll(x => x.Name == "PrefixAccMagicDefense" && x.mod == mod.Name);
            }
            if (item.type == ItemID.AnkhCharm)
            {
                tooltips.RemoveAll(x => x.Name == "Tooltip0" && x.mod == "Terraria");
                tooltips.RemoveAll(x => x.Name == "Tooltip1" && x.mod == "Terraria");
            }
            if (item.type == ItemID.CobaltShield)
            {
                tooltips.RemoveAll(x => x.Name == "Tooltip0" && x.mod == "Terraria");
            }
        }
Exemplo n.º 8
0
        public override void UpdateEquip(Item item, Player player)
        {
            PlayerEdits modPlayer = player.GetModPlayer <PlayerEdits>();
            ItemEdits   modItem   = item.GetGlobalItem <ItemEdits>();

            if (JobHooks.CanEquip(item, player) == false)
            {
                int num5 = (item.vanity && !item.accessory) ? 10 : 0;
                item.favorited = false;
                if (item.headSlot != -1)
                {
                    player.GetItem(Main.myPlayer, player.armor[num5].Clone());
                    player.armor[num5].ResetStats(0);
                    Main.PlaySound(SoundID.Grab, -1, -1, 1, 1f, 0f);
                    Recipe.FindRecipes();
                }
                else if (item.bodySlot != -1)
                {
                    player.GetItem(Main.myPlayer, player.armor[num5 + 1].Clone());
                    player.armor[num5 + 1].ResetStats(0);
                    Main.PlaySound(SoundID.Grab, -1, -1, 1, 1f, 0f);
                    Recipe.FindRecipes();
                }
                else if (item.legSlot != -1)
                {
                    player.GetItem(Main.myPlayer, player.armor[num5 + 2].Clone());
                    player.armor[num5 + 2].ResetStats(0);
                    Main.PlaySound(SoundID.Grab, -1, -1, 1, 1f, 0f);
                    Recipe.FindRecipes();
                }
            }
            if (modItem.magicDefense != 0)
            {
                modPlayer.magicDefense += modItem.magicDefense;
            }
            if (item.prefix == mod.PrefixType("Magic"))
            {
                modPlayer.magicDefense += 1;
            }
            if (item.prefix == mod.PrefixType("Blessed"))
            {
                modPlayer.magicDefense += 2;
            }
            if (item.prefix == mod.PrefixType("Runic"))
            {
                modPlayer.magicDefense += 3;
            }
            if (item.prefix == mod.PrefixType("Witchs"))
            {
                modPlayer.magicDefense += 4;
            }
            if (item.type == ItemID.SpectreHood)
            {
                player.magicDamage += 0.15f; // -25% mDamage
                player.manaCost    -= 0.05f;
            }
            if (item.type == ItemID.MeteorHelmet)
            {
                player.magicDamage  -= 0.03f;
                player.rangedDamage += 0.05f;
            }
            if (item.type == ItemID.MeteorSuit)
            {
                player.magicDamage  -= 0.03f;
                player.rangedDamage += 0.05f;
            }
            if (item.type == ItemID.MeteorLeggings)
            {
                player.magicDamage  -= 0.03f;
                player.rangedDamage += 0.05f;
            }
            if (item.type == ItemID.AncientCobaltHelmet)
            {
                player.magicCrit   += -4;
                player.magicDamage += 0.04f; // 4% mDamage
            }
            if (item.type == ItemID.AncientCobaltBreastplate)
            {
                player.magicCrit   += -4;
                player.magicDamage += 0.04f; // 4% mDamage
            }
            if (item.type == ItemID.AncientCobaltLeggings)
            {
                player.magicCrit   += -4;
                player.magicDamage += 0.04f; // 4% mDamage
            }
            if (item.type == ItemID.JungleHat)
            {
                player.magicCrit   += -4;
                player.magicDamage += 0.04f; // 4% mDamage
            }
            if (item.type == ItemID.JungleShirt)
            {
                player.magicCrit   += -4;
                player.magicDamage += 0.04f; // 4% mDamage
            }
            if (item.type == ItemID.JunglePants)
            {
                player.magicCrit   += -4;
                player.magicDamage += 0.04f; // 4% mDamage
            }
            if (item.type == ItemID.CobaltHat)
            {
                player.magicCrit   -= 3;
                player.magicDamage += 0.15f; // 15% mDamage
            }
            if (item.type == ItemID.PalladiumHeadgear)
            {
                player.magicCrit   -= 7;
                player.magicDamage += 0.13f; // 20% mDamage
            }
            if (item.type == ItemID.MythrilHood)
            {
                player.magicDamage += 0.06f; // 21% mDamage
            }
            if (item.type == ItemID.OrichalcumHeadgear)
            {
                player.magicCrit   -= 18;
                player.magicDamage += 0.24f; // 24% mDamage
            }
            if (item.type == ItemID.AdamantiteHeadgear)
            {
                player.magicDamage += 0.19f; // 30% mDamage
                player.magicCrit   -= 11;
            }
            if (item.type == ItemID.TitaniumHeadgear)
            {
                player.magicDamage += 0.12f; // 27% mDamage
                player.magicCrit   -= 7;
            }
            if (item.type == ItemID.AncientBattleArmorHat)
            {
                player.magicDamage += 0.06f; // 21% mDamage
            }
            if (item.type == ItemID.HallowedHeadgear)
            {
                player.magicDamage += 0.20f; // 32% mDamage
                player.magicCrit   -= 12;
            }
            if (item.type == ItemID.ChlorophyteHeadgear)
            {
                player.magicDamage += 0.19f; // 35% mDamage
            }
            if (item.type == ItemID.SpectreMask)
            {
                player.magicDamage += 0.15f;  // 20% mDamage (42% with full set)
                player.magicCrit   -= 5;
            }
            if (item.type == ItemID.SpectreRobe)
            {
                player.magicCrit   -= 7;
                player.magicDamage += 0.07f; // 14% mDamage
            }
            if (item.type == ItemID.NebulaHelmet)
            {
                player.magicDamage += 0.13f; // 20% mDamage (48% with full set)
                player.magicCrit   -= 7;
            }
            if (item.type == ItemID.NebulaBreastplate)
            {
                player.magicDamage += 0.09f; // 18% mDamage
                player.magicCrit   -= 9;
            }
            if (item.type == ItemID.ApprenticeAltPants)
            {
                player.magicCrit   -= 25;
                player.magicDamage += 21; // 23% mDamage (46% with full set)
            }
            if (item.type == ItemID.BeetleScaleMail)
            {
                player.meleeDamage  += 0.02f;
                player.meleeSpeed   += 0.20f;
                player.meleeCrit    += 43;
                player.thrownDamage += 0.25f;
            }
            if (item.type == ItemID.MonkBrows)
            {
                player.meleeSpeed += 0.15f;
            }
            if (item.type == ItemID.MonkShirt)
            {
                player.thrownDamage += 0.25f;
                player.meleeCrit    += 15;
            }
            if (item.type == ItemID.MonkPants)
            {
                player.meleeCrit += 10;
                player.moveSpeed += 0.05f;
            }
            if (item.type == ItemID.MonkAltHead)
            {
                player.thrownDamage += 0.20f;
            }
            if (item.type == ItemID.MonkAltShirt)
            {
                player.meleeSpeed += 0.10f;
            }
            if (item.type == ItemID.MonkAltPants)
            {
                player.meleeCrit += 20;
                player.moveSpeed += 0.15f;
            }
            if (item.type == ItemID.CobaltHelmet)
            {
                player.meleeSpeed -= 0.06f; // 6% on helmet
                player.moveSpeed  -= 0.03f; // 4% on helmet
            }
            if (item.type == ItemID.PalladiumMask)
            {
                player.meleeDamage -= 0.03f; // 5% on mask
                player.meleeSpeed  -= 0.06f; // 6% on mask
            }
            if (item.type == ItemID.MythrilHelmet)
            {
                player.meleeCrit   -= 2;     // 3% on helmet
                player.meleeDamage -= 0.03f; // 7% on helmet
            }
            if (item.type == ItemID.OrichalcumMask)
            {
                player.meleeDamage -= 0.02f; // 5% on mask
                player.meleeSpeed  -= 0.04f; // 4% on mask
                player.moveSpeed   -= 0.04f; // 4% on mask
            }
            if (item.type == ItemID.AdamantiteHelmet)
            {
                player.meleeCrit   -= 3;     // 4% on helmet
                player.meleeDamage -= 0.04f; // 10% on helmet
            }
            if (item.type == ItemID.TitaniumMask)
            {
                player.meleeDamage -= 0.02f; // 6% on mask
                player.meleeCrit   -= 2;     // 6% on mask
            }
            if (item.type == ItemID.SquireGreaves)
            {
                player.meleeCrit -= 10;    // 10% on greaves
                player.moveSpeed -= 0.08f; // 12% on greaves
            }
            if (item.type == ItemID.HallowedMask)
            {
                player.meleeDamage -= 0.02f; // 8% on mask
                player.meleeCrit   -= 4;     // 6% on mask
                player.meleeSpeed  -= 0.03f; // 7% on mask
            }
            if (item.type == ItemID.ChlorophyteMask)
            {
                player.meleeDamage -= 0.04f; // 12% on mask
                player.meleeCrit   -= 2;     // 4% on mask
            }
            if (item.type == ItemID.TurtleHelmet)
            {
                player.meleeDamage -= 0.02f; // 4% on helmet
            }
            if (item.type == ItemID.TurtleScaleMail)
            {
                player.meleeDamage -= 0.03f; // 5% on mail
                player.meleeCrit   -= 3;     // 5% on mail
            }
            if (item.type == ItemID.TurtleLeggings)
            {
                player.meleeCrit -= 2; // 2% on leggings
            }
            if (item.type == ItemID.BeetleShell)
            {
                player.meleeDamage -= 0.02f; // 3% on shell
                player.meleeCrit   -= 3;     // 2% on shell
            }
            if (item.type == ItemID.SquireAltPants)
            {
                player.meleeCrit -= 8;     // 12% on pants
                player.moveSpeed -= 0.15f; // 15% on pants
            }
            if (item.type == ItemID.SolarFlareHelmet)
            {
                player.meleeCrit -= 7; // 10% on helmet
            }
            if (item.type == ItemID.SolarFlareBreastplate)
            {
                player.meleeDamage -= 0.1f; // 12% on breastplate
            }
            if (item.type == ItemID.SolarFlareLeggings)
            {
                player.moveSpeed  -= 0.06f; // 9% on leggings
                player.meleeSpeed -= 0.05f; // 10% on leggings
            }
        }
Exemplo n.º 9
0
        public override void HoldItem(Item item, Player player)
        {
            base.HoldItem(item, player);
            PlayerEdits modPlayer = player.GetModPlayer <PlayerEdits>();
            ItemEdits   modItem   = item.GetGlobalItem <ItemEdits>();

            if (item.melee == true)
            {
                if (modPlayer.job == JobID.rogue || modPlayer.armorJob == JobID.rogue)
                {
                    if (modPlayer.rogueBonus == false)
                    {
                        player.armorPenetration += item.rare * 2;
                        modPlayer.rogueBonus     = true;
                    }
                }
            }
            if (item.type == ItemID.PiranhaGun)
            {
                if (player.statMana < item.mana)
                {
                    modItem.blocked = true;
                }
                else
                {
                    modItem.blocked = false;
                }
                if (modItem.blocked == true)
                {
                    player.controlUseItem = false;
                }
                if (player.controlUseItem == true && modItem.blocked == false && player.itemAnimation > 0)
                {
                    if (modPlayer.itemCool == 0)
                    {
                        player.statMana -= item.mana;
                    }
                    if (modPlayer.itemCool == 0)
                    {
                        modPlayer.itemCool = item.useTime;
                    }
                    modPlayer.itemCool--;
                }
            }
            if (modItem.blocked == true)
            {
                player.controlUseItem = false;
                player.channel        = false;
            }
            if (player.itemTime == item.useTime && player.controlUseItem && modItem.hasSummon)
            {
                if (!(modPlayer.usedMinionSlots + modItem.summonSlots > player.maxMinions))
                {
                    int      id        = NPC.NewNPC((int)player.Center.X, (int)player.Center.Y, modItem.summonNPC);
                    NPC      minion    = Main.npc[id];
                    NPCEdits modMinion = minion.GetGlobalNPC <NPCEdits>();
                    modMinion.owner            = Main.myPlayer;
                    modPlayer.usedMinionSlots += modMinion.minionSlots;
                    modMinion.minionSlots      = modItem.summonSlots;
                    player.numMinions++;
                    modMinion.minionPos = player.numMinions;
                    minion.damage       = item.damage;
                }
            }
        }