mirror of
https://github.com/YouHaveTrouble/YHTMod.git
synced 2026-05-11 21:56:54 +00:00
warrior's ambition item setup and locale
This commit is contained in:
@@ -0,0 +1,31 @@
|
|||||||
|
using Terraria;
|
||||||
|
using Terraria.Localization;
|
||||||
|
using Terraria.ModLoader;
|
||||||
|
|
||||||
|
namespace YHTMod.Buffs;
|
||||||
|
|
||||||
|
public class WarriorAmbitionBuff : ModBuff {
|
||||||
|
public override void SetStaticDefaults() {
|
||||||
|
Main.buffNoSave[Type] = true;
|
||||||
|
Main.buffNoTimeDisplay[Type] = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void ModifyBuffText(ref string buffName, ref string tip, ref int rare) {
|
||||||
|
YhtPlayer modPlayer = Main.LocalPlayer.TryGetModPlayer(out YhtPlayer mp) ? mp : null;
|
||||||
|
if (modPlayer == null) return;
|
||||||
|
tip = Language.GetTextValue("Mods.YHTMod.Buffs.WarriorAmbitionBuff.Description",
|
||||||
|
modPlayer.WarriorAmbitions.Count);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Update(Player player, ref int buffIndex) {
|
||||||
|
YhtPlayer modPlayer = player.GetModPlayer<YhtPlayer>();
|
||||||
|
|
||||||
|
if (modPlayer.WarriorAmbition) {
|
||||||
|
player.buffTime[buffIndex] = 18000;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
player.DelBuff(buffIndex);
|
||||||
|
buffIndex--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 3.2 KiB |
@@ -83,6 +83,12 @@ public class BossKillListener : GlobalNPC {
|
|||||||
Color.MediumPurple,
|
Color.MediumPurple,
|
||||||
player.whoAmI
|
player.whoAmI
|
||||||
);
|
);
|
||||||
|
} else if (modPlayer.WarriorAmbition && modPlayer.WarriorAmbitions.Add(bossKey)) {
|
||||||
|
ChatHelper.SendChatMessageToClient(
|
||||||
|
NetworkText.FromLiteral("Your Warrior Ambition's potential grows stronger!"),
|
||||||
|
Color.OrangeRed,
|
||||||
|
player.whoAmI
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,11 @@ public class SummonersAmbition : ModItem {
|
|||||||
ItemID.Sets.ShimmerTransformToItem[Type] = 0;
|
ItemID.Sets.ShimmerTransformToItem[Type] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override bool CanAccessoryBeEquippedWith(Item equippedItem, Item incomingItem, Player player) {
|
||||||
|
YhtPlayer modPlayer = player.GetModPlayer<YhtPlayer>();
|
||||||
|
return !modPlayer.hasAmbitionEquipped() && base.CanAccessoryBeEquippedWith(equippedItem, incomingItem, player);
|
||||||
|
}
|
||||||
|
|
||||||
public override void UpdateAccessory(Player player, bool hideVisual) {
|
public override void UpdateAccessory(Player player, bool hideVisual) {
|
||||||
YhtPlayer modPlayer = player.GetModPlayer<YhtPlayer>();
|
YhtPlayer modPlayer = player.GetModPlayer<YhtPlayer>();
|
||||||
modPlayer.SummonerAmbition = true;
|
modPlayer.SummonerAmbition = true;
|
||||||
|
|||||||
@@ -0,0 +1,151 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using Terraria;
|
||||||
|
using Terraria.GameContent.Creative;
|
||||||
|
using Terraria.ID;
|
||||||
|
using Terraria.Localization;
|
||||||
|
using Terraria.ModLoader;
|
||||||
|
using YHTMod.Changes;
|
||||||
|
|
||||||
|
namespace YHTMod.Items;
|
||||||
|
|
||||||
|
public class WarriorsAmbition : ModItem {
|
||||||
|
public override void SetStaticDefaults() {
|
||||||
|
CreativeItemSacrificesCatalog.Instance.SacrificeCountNeededByItemId[Type] = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override LocalizedText Tooltip => Language.GetText("");
|
||||||
|
|
||||||
|
public override void SetDefaults() {
|
||||||
|
Item.width = 32;
|
||||||
|
Item.height = 32;
|
||||||
|
Item.accessory = true;
|
||||||
|
Item.rare = ItemRarityID.White;
|
||||||
|
Item.noMelee = true;
|
||||||
|
Item.noUseGraphic = true;
|
||||||
|
ItemID.Sets.ShimmerTransformToItem[Type] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool CanAccessoryBeEquippedWith(Item equippedItem, Item incomingItem, Player player) {
|
||||||
|
YhtPlayer modPlayer = player.GetModPlayer<YhtPlayer>();
|
||||||
|
return !modPlayer.hasAmbitionEquipped() && base.CanAccessoryBeEquippedWith(equippedItem, incomingItem, player);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void UpdateAccessory(Player player, bool hideVisual) {
|
||||||
|
YhtPlayer modPlayer = player.GetModPlayer<YhtPlayer>();
|
||||||
|
modPlayer.SummonerAmbition = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void ModifyTooltips(List<TooltipLine> tooltips) {
|
||||||
|
YhtPlayer player = Main.LocalPlayer.GetModPlayer<YhtPlayer>();
|
||||||
|
tooltips.Add(new TooltipLine(Mod, "WarriorsAmbition",
|
||||||
|
Language.GetTextValue("Mods.YHTMod.Items.WarriorAmbition.Tooltip")));
|
||||||
|
|
||||||
|
if (player.SummonerAmbitions.Contains("king_slime")) {
|
||||||
|
float bonus = 5f;
|
||||||
|
if (ModLoader.HasMod("CalamityMod")) {
|
||||||
|
bonus = 2.5f;
|
||||||
|
}
|
||||||
|
tooltips.Add(new TooltipLine(Mod, "WarriorAmbitionKingSlime",
|
||||||
|
Language.GetTextValue("Mods.YHTMod.Items.WarriorsAmbition.KingSlime", bonus)));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ModLoader.HasMod("CalamityMod") && player.WarriorAmbitions.Contains("desert_scourge")) {
|
||||||
|
int id = CalamityHelper.GetBossIconId("desert_scourge");
|
||||||
|
tooltips.Add(new TooltipLine(Mod, "WarriorAmbitionDesertScourge",
|
||||||
|
Language.GetTextValue("Mods.YHTMod.Items.WarriorsAmbition.DesertScourge", "[i:" + id + "]")));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (player.WarriorAmbitions.Contains("eye_of_cthulhu")) {
|
||||||
|
tooltips.Add(new TooltipLine(Mod, "WarriorAmbitionEyeOfCthulhu",
|
||||||
|
Language.GetTextValue("Mods.YHTMod.Items.WarriorsAmbition.EyeOfCthulhu")));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ModLoader.HasMod("CalamityMod") && player.WarriorAmbitions.Contains("crabulon")) {
|
||||||
|
int id = CalamityHelper.GetBossIconId("crabulon");
|
||||||
|
tooltips.Add(new TooltipLine(Mod, "WarriorAmbitionCrabulon",
|
||||||
|
Language.GetTextValue("Mods.YHTMod.Items.WarriorsAmbition.Crabulon", "[i:" + id + "]")));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (player.WarriorAmbitions.Contains("deerclops")) {
|
||||||
|
tooltips.Add(new TooltipLine(Mod, "WarriorAmbitionDeerclops",
|
||||||
|
Language.GetTextValue("Mods.YHTMod.Items.WarriorsAmbition.Deerclops")));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (player.WarriorAmbitions.Contains("eater_of_worlds")) {
|
||||||
|
tooltips.Add(new TooltipLine(Mod, "WarriorAmbitionEaterOfWorlds",
|
||||||
|
Language.GetTextValue("Mods.YHTMod.Items.WarriorsAmbition.EaterOfWorlds")));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (player.WarriorAmbitions.Contains("brain_of_cthulhu")) {
|
||||||
|
tooltips.Add(new TooltipLine(Mod, "WarriorAmbitionBrainOfCthulhu",
|
||||||
|
Language.GetTextValue("Mods.YHTMod.Items.WarriorsAmbition.BrainOfCthulhu")));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ModLoader.HasMod("CalamityMod") && player.WarriorAmbitions.Contains("perforators")) {
|
||||||
|
int id = CalamityHelper.GetBossIconId("perforators");
|
||||||
|
tooltips.Add(new TooltipLine(Mod, "WarriorAmbitionPerforators",
|
||||||
|
Language.GetTextValue("Mods.YHTMod.Items.WarriorsAmbition.Perforators", "[i:" + id + "]")));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ModLoader.HasMod("CalamityMod") && player.WarriorAmbitions.Contains("hive_mind")) {
|
||||||
|
int id = CalamityHelper.GetBossIconId("hive_mind");
|
||||||
|
tooltips.Add(new TooltipLine(Mod, "WarriorAmbitionHiveMind",
|
||||||
|
Language.GetTextValue("Mods.YHTMod.Items.WarriorsAmbition.HiveMind", "[i:" + id + "]")));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (player.WarriorAmbitions.Contains("queen_bee")) {
|
||||||
|
tooltips.Add(new TooltipLine(Mod, "WarriorAmbitionQueenBee",
|
||||||
|
Language.GetTextValue("Mods.YHTMod.Items.WarriorsAmbition.QueenBee")));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (player.WarriorAmbitions.Contains("skeletron")) {
|
||||||
|
tooltips.Add(new TooltipLine(Mod, "WarriorAmbitionSkeletron",
|
||||||
|
Language.GetTextValue("Mods.YHTMod.Items.WarriorsAmbition.Skeletron")));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (player.WarriorAmbitions.Contains("wall_of_flesh")) {
|
||||||
|
tooltips.Add(new TooltipLine(Mod, "WarriorAmbitionWallOfFlesh",
|
||||||
|
Language.GetTextValue("Mods.YHTMod.Items.WarriorsAmbition.WallOfFlesh")));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ModLoader.HasMod("CalamityMod") && player.WarriorAmbitions.Contains("slime_god")) {
|
||||||
|
int id = CalamityHelper.GetBossIconId("slime_god");
|
||||||
|
tooltips.Add(new TooltipLine(Mod, "WarriorAmbitionSlimeGod",
|
||||||
|
Language.GetTextValue("Mods.YHTMod.Items.WarriorsAmbition.SlimeGod", "[i:" + id + "]")));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void AddRecipes() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private static bool IsPreHardmodeRealized(Player player) {
|
||||||
|
YhtPlayer modPlayer = player.GetModPlayer<YhtPlayer>();
|
||||||
|
|
||||||
|
HashSet<string> bossesToCheck = [
|
||||||
|
"king_slime",
|
||||||
|
"eye_of_cthulhu",
|
||||||
|
"deerclops",
|
||||||
|
"queen_bee",
|
||||||
|
"skeletron",
|
||||||
|
"wall_of_flesh"
|
||||||
|
];
|
||||||
|
|
||||||
|
if (!modPlayer.WarriorAmbitions.Contains("eater_of_worlds") && !modPlayer.WarriorAmbitions.Contains("brain_of_cthulhu")) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ModLoader.HasMod("CalamityMod")) {
|
||||||
|
bossesToCheck.Add("desert_scourge");
|
||||||
|
bossesToCheck.Add("crabulon");
|
||||||
|
bossesToCheck.Add("slime_god");
|
||||||
|
|
||||||
|
if (!modPlayer.WarriorAmbitions.Contains("perforators") && !modPlayer.WarriorAmbitions.Contains("hive_mind")) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return bossesToCheck.All(boss => modPlayer.WarriorAmbitions.Contains(boss));
|
||||||
|
}
|
||||||
|
}
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 1.6 KiB |
@@ -27,6 +27,16 @@ Buffs: {
|
|||||||
And smell like mushrooms.
|
And smell like mushrooms.
|
||||||
'''
|
'''
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WarriorAmbitionBuff: {
|
||||||
|
DisplayName: Warrior's Ambition
|
||||||
|
Description:
|
||||||
|
'''
|
||||||
|
Your power grows with your ambition
|
||||||
|
|
||||||
|
Essences absorbed: {0}
|
||||||
|
'''
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Items: {
|
Items: {
|
||||||
@@ -97,6 +107,30 @@ Items: {
|
|||||||
SlimeGod: "{0} 10% increased whip size"
|
SlimeGod: "{0} 10% increased whip size"
|
||||||
PreHardmodeRealized: Fully realized. Seek greater heights.
|
PreHardmodeRealized: Fully realized. Seek greater heights.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WarriorsAmbition: {
|
||||||
|
DisplayName: Warriors Ambition
|
||||||
|
Tooltip:
|
||||||
|
'''
|
||||||
|
Grants Warrior's Ambition.
|
||||||
|
"For those who wish to face enemy head on."
|
||||||
|
{0} defense
|
||||||
|
'''
|
||||||
|
KingSlime: "[i:560] {0}% increased true melee weapon size"
|
||||||
|
DesertScourge: "{0} Increases maximum life by 10"
|
||||||
|
EyeOfCthulhu: "[i:43] Increases melee damage by 10%"
|
||||||
|
Crabulon: "{0} Enemies struck by whips glow slightly"
|
||||||
|
EaterOfWorlds: "[i:70] Melee damage penetrates 5 armor"
|
||||||
|
BrainOfCthulhu: "[i:1331] 5% increased true melee damage"
|
||||||
|
HiveMind: "{0} defense"
|
||||||
|
Perforators: "{0} defense"
|
||||||
|
QueenBee: "[i:1133] Damaging debuffs expire 5% faster on you"
|
||||||
|
Deerclops: "[i:5120] Melee hits can throw debris"
|
||||||
|
Skeletron: "[i:4801] Increases melee knockback"
|
||||||
|
WallOfFlesh: "[i:267] +5 defense"
|
||||||
|
SlimeGod: "{0} 2.5% increased true melee weapon size"
|
||||||
|
PreHardmodeRealized: Fully realized. Seek greater heights.
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Projectiles: {
|
Projectiles: {
|
||||||
|
|||||||
+29
-1
@@ -15,11 +15,13 @@ public class YhtPlayer : ModPlayer {
|
|||||||
|
|
||||||
|
|
||||||
public bool SummonerAmbition = false;
|
public bool SummonerAmbition = false;
|
||||||
|
public bool WarriorAmbition = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set of boss and event ids for unlocking perks from Summoner's Ambition accessory
|
* Set of boss and event ids for unlocking perks from Summoner's Ambition accessory
|
||||||
*/
|
*/
|
||||||
public HashSet<string> SummonerAmbitions = [];
|
public HashSet<string> SummonerAmbitions = [];
|
||||||
|
public HashSet<string> WarriorAmbitions = [];
|
||||||
|
|
||||||
public override void PreUpdate() {
|
public override void PreUpdate() {
|
||||||
KatanaTeleportCooldown = Math.Max(KatanaTeleportCooldown - 1, 0);
|
KatanaTeleportCooldown = Math.Max(KatanaTeleportCooldown - 1, 0);
|
||||||
@@ -61,24 +63,40 @@ public class YhtPlayer : ModPlayer {
|
|||||||
Player.whipRangeMultiplier += 0.1f;
|
Player.whipRangeMultiplier += 0.1f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (WarriorAmbition) {
|
||||||
|
Player.AddBuff(ModContent.BuffType<WarriorAmbitionBuff>(), 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool hasAmbitionEquipped() {
|
||||||
|
if (SummonerAmbition) return true;
|
||||||
|
if (WarriorAmbition) return true;
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void ResetEffects() {
|
public override void ResetEffects() {
|
||||||
ArcaneMissile = 0;
|
ArcaneMissile = 0;
|
||||||
SummonerAmbition = false;
|
SummonerAmbition = false;
|
||||||
|
WarriorAmbition = false;
|
||||||
|
|
||||||
base.ResetEffects();
|
base.ResetEffects();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void SaveData(TagCompound tag) {
|
public override void SaveData(TagCompound tag) {
|
||||||
tag["summonerAmbitions"] = new List<string>(SummonerAmbitions);
|
tag["summonerAmbitions"] = new List<string>(SummonerAmbitions);
|
||||||
|
tag["warriorAmbitions"] = new List<string>(WarriorAmbitions);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void LoadData(TagCompound tag) {
|
public override void LoadData(TagCompound tag) {
|
||||||
if (!tag.ContainsKey("summonerAmbitions")) return;
|
if (tag.ContainsKey("summonerAmbitions")) {
|
||||||
IList<string> list = tag.GetList<string>("summonerAmbitions");
|
IList<string> list = tag.GetList<string>("summonerAmbitions");
|
||||||
SummonerAmbitions = new HashSet<string>(list);
|
SummonerAmbitions = new HashSet<string>(list);
|
||||||
}
|
}
|
||||||
|
if (tag.ContainsKey("warriorAmbitions")) {
|
||||||
|
IList<string> warriorList = tag.GetList<string>("warriorAmbitions");
|
||||||
|
WarriorAmbitions = new HashSet<string>(warriorList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public int GetSummonersAmbitionMinionBonus() {
|
public int GetSummonersAmbitionMinionBonus() {
|
||||||
int amount = 1;
|
int amount = 1;
|
||||||
@@ -88,4 +106,14 @@ public class YhtPlayer : ModPlayer {
|
|||||||
|
|
||||||
return amount;
|
return amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int GetWarriorsAmbitionDefenseBonus() {
|
||||||
|
int amount = 2;
|
||||||
|
|
||||||
|
if (WarriorAmbitions.Contains("wall_of_flesh")) {
|
||||||
|
amount += 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
return amount;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user