mirror of
https://github.com/YouHaveTrouble/YHTMod.git
synced 2026-05-11 21:56:54 +00:00
pre-hardmode summoner's ambition
This commit is contained in:
@@ -17,7 +17,7 @@ public class SummonerAmbitionBuff : ModBuff
|
||||
var modPlayer = Main.LocalPlayer.TryGetModPlayer<YhtPlayer>(out var mp) ? mp : null;
|
||||
if (modPlayer == null) return;
|
||||
|
||||
tip = Language.GetTextValue("Mods.YHTMod.Buffs.SummonerAmbitionBuff.Description", modPlayer.SummonerAmbitionCrafts.Count);
|
||||
tip = Language.GetTextValue("Mods.YHTMod.Buffs.SummonerAmbitionBuff.Description", modPlayer.SummonerAmbitions.Count);
|
||||
}
|
||||
|
||||
public override void Update(Player player, ref int buffIndex)
|
||||
|
||||
@@ -20,11 +20,27 @@ public class BossKillListener : GlobalNPC
|
||||
HandleBossKill(npc, "eye_of_cthulhu");
|
||||
break;
|
||||
case NPCID.EaterofWorldsHead:
|
||||
case NPCID.EaterofWorldsBody:
|
||||
case NPCID.EaterofWorldsTail:
|
||||
var foundEaterSegments = 0;
|
||||
foreach (var activeNpC in Main.ActiveNPCs)
|
||||
{
|
||||
if (activeNpC.friendly || activeNpC.townNPC) continue;
|
||||
if (activeNpC.type is not NPCID.EaterofWorldsBody
|
||||
and not NPCID.EaterofWorldsHead
|
||||
and not NPCID.EaterofWorldsTail
|
||||
) continue;
|
||||
if (++foundEaterSegments > 1) break;
|
||||
}
|
||||
|
||||
HandleBossKill(npc, "eater_of_worlds");
|
||||
break;
|
||||
case NPCID.BrainofCthulhu:
|
||||
HandleBossKill(npc, "brain_of_cthulhu");
|
||||
break;
|
||||
case NPCID.Deerclops:
|
||||
HandleBossKill(npc, "deerclops");
|
||||
break;
|
||||
case NPCID.QueenBee:
|
||||
HandleBossKill(npc, "queen_bee");
|
||||
break;
|
||||
@@ -45,10 +61,11 @@ public class BossKillListener : GlobalNPC
|
||||
{
|
||||
var modPlayer = player.GetModPlayer<YhtPlayer>();
|
||||
if (!npc.playerInteraction[player.whoAmI]) continue;
|
||||
if (modPlayer.KilledBosses.Add(bossKey))
|
||||
|
||||
if (modPlayer.SummonerAmbition && modPlayer.SummonerAmbitions.Add(bossKey))
|
||||
{
|
||||
ChatHelper.SendChatMessageToClient(
|
||||
NetworkText.FromLiteral("Your Ambition's potential grows stronger!"),
|
||||
NetworkText.FromLiteral("Your Summoner Ambition's potential grows stronger!"),
|
||||
Color.MediumPurple,
|
||||
player.whoAmI
|
||||
);
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using Vector2 = Microsoft.Xna.Framework.Vector2;
|
||||
|
||||
namespace YHTMod.Changes;
|
||||
|
||||
public class SummonerOnHitEffects : GlobalProjectile
|
||||
{
|
||||
public override void OnHitNPC(Projectile projectile, NPC target, NPC.HitInfo hit, int damageDone)
|
||||
{
|
||||
var player = Main.player[projectile.owner];
|
||||
var modPlayer = player.GetModPlayer<YhtPlayer>();
|
||||
if (projectile.minion && Main.myPlayer == projectile.owner)
|
||||
{
|
||||
if (modPlayer.SummonerAmbition)
|
||||
{
|
||||
if (
|
||||
modPlayer.SummonerAmbitions.Contains("deerclops")
|
||||
&& modPlayer.SummonerAmbitionDeerclopsCooldown == 0
|
||||
&& Main.rand.NextBool(10)
|
||||
)
|
||||
{
|
||||
modPlayer.SummonerAmbitionDeerclopsCooldown = 5 * 60;
|
||||
var direction = new Vector2(Main.rand.NextFloat(-1f, 1f), Main.rand.NextFloat(-1f, 1f));
|
||||
direction.Normalize();
|
||||
direction *= Main.rand.NextFloat(4f, 8f);
|
||||
Projectile.NewProjectile(
|
||||
player.GetSource_OnHit(target),
|
||||
target.Center,
|
||||
direction,
|
||||
ProjectileID.InsanityShadowFriendly,
|
||||
projectile.damage / 2,
|
||||
0f,
|
||||
projectile.owner
|
||||
);
|
||||
}
|
||||
|
||||
if (
|
||||
modPlayer.SummonerAmbitions.Contains("queen_bee")
|
||||
&& Main.rand.NextBool(4)
|
||||
)
|
||||
{
|
||||
target.AddBuff(BuffID.Poisoned, 5 * 60);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (projectile.WhipSettings.Segments > 0)
|
||||
{
|
||||
projectile.damage = (int)(projectile.damage * 1.1);
|
||||
}
|
||||
|
||||
base.OnHitNPC(projectile, target, hit, damageDone);
|
||||
}
|
||||
}
|
||||
+47
-60
@@ -31,19 +31,62 @@ public class SummonersAmbition : ModItem
|
||||
{
|
||||
var modPlayer = player.GetModPlayer<YhtPlayer>();
|
||||
modPlayer.SummonerAmbition = true;
|
||||
modPlayer.HasAmbition = true;
|
||||
}
|
||||
|
||||
public override void ModifyTooltips(List<TooltipLine> tooltips)
|
||||
{
|
||||
var player = Main.LocalPlayer.GetModPlayer<YhtPlayer>();
|
||||
tooltips.Add(new TooltipLine(Mod, "SummonerAmbition", Language.GetTextValue("Mods.YHTMod.Items.SummonersAmbition.Tooltip", player.GetSummonersAmbitionMinionBonus())));
|
||||
tooltips.Add(new TooltipLine(Mod, "SummonerAmbition",
|
||||
Language.GetTextValue("Mods.YHTMod.Items.SummonersAmbition.Tooltip",
|
||||
player.GetSummonersAmbitionMinionBonus())));
|
||||
|
||||
if (player.KilledBosses.Contains("king_slime"))
|
||||
if (player.SummonerAmbitions.Contains("king_slime"))
|
||||
{
|
||||
tooltips.Add(new TooltipLine(Mod, "SummonerAmbitionKingSlime", Language.GetTextValue("Mods.YHTMod.Items.SummonersAmbition.KingSlime")));
|
||||
tooltips.Add(new TooltipLine(Mod, "SummonerAmbitionKingSlime",
|
||||
Language.GetTextValue("Mods.YHTMod.Items.SummonersAmbition.KingSlime")));
|
||||
}
|
||||
|
||||
if (player.SummonerAmbitions.Contains("eye_of_cthulhu"))
|
||||
{
|
||||
tooltips.Add(new TooltipLine(Mod, "SummonerAmbitionEyeOfCthulhu",
|
||||
Language.GetTextValue("Mods.YHTMod.Items.SummonersAmbition.EyeOfCthulhu")));
|
||||
}
|
||||
|
||||
if (player.SummonerAmbitions.Contains("deerclops"))
|
||||
{
|
||||
tooltips.Add(new TooltipLine(Mod, "SummonerAmbitionDeerclops",
|
||||
Language.GetTextValue("Mods.YHTMod.Items.SummonersAmbition.Deerclops")));
|
||||
}
|
||||
|
||||
if (player.SummonerAmbitions.Contains("eater_of_worlds"))
|
||||
{
|
||||
tooltips.Add(new TooltipLine(Mod, "SummonerAmbitionEaterOfWorlds",
|
||||
Language.GetTextValue("Mods.YHTMod.Items.SummonersAmbition.EaterOfWorlds")));
|
||||
}
|
||||
|
||||
if (player.SummonerAmbitions.Contains("brain_of_cthulhu"))
|
||||
{
|
||||
tooltips.Add(new TooltipLine(Mod, "SummonerAmbitionBrainOfCthulhu",
|
||||
Language.GetTextValue("Mods.YHTMod.Items.SummonersAmbition.BrainOfCthulhu")));
|
||||
}
|
||||
|
||||
if (player.SummonerAmbitions.Contains("queen_bee"))
|
||||
{
|
||||
tooltips.Add(new TooltipLine(Mod, "SummonerAmbitionQueenBee",
|
||||
Language.GetTextValue("Mods.YHTMod.Items.SummonersAmbition.QueenBee")));
|
||||
}
|
||||
|
||||
if (player.SummonerAmbitions.Contains("skeletron"))
|
||||
{
|
||||
tooltips.Add(new TooltipLine(Mod, "SummonerAmbitionSkeletron",
|
||||
Language.GetTextValue("Mods.YHTMod.Items.SummonersAmbition.Skeletron")));
|
||||
}
|
||||
|
||||
if (player.SummonerAmbitions.Contains("wall_of_flesh"))
|
||||
{
|
||||
tooltips.Add(new TooltipLine(Mod, "SummonerAmbitionWallOfFlesh",
|
||||
Language.GetTextValue("Mods.YHTMod.Items.SummonersAmbition.WallOfFlesh")));
|
||||
}
|
||||
}
|
||||
|
||||
public override void AddRecipes()
|
||||
@@ -55,61 +98,5 @@ public class SummonersAmbition : ModItem
|
||||
.AddTile(TileID.WorkBenches)
|
||||
.Register();
|
||||
|
||||
#region Upgrades
|
||||
|
||||
CreateRecipe()
|
||||
.AddIngredient(this)
|
||||
.AddTile(TileID.DemonAltar)
|
||||
.AddIngredient(ItemID.Gel, 250)
|
||||
.AddCondition(new Condition(
|
||||
Language.GetText("Mods.YHTMod.Recipes.Ambitions.KingSlimeDead"),
|
||||
() =>
|
||||
{
|
||||
var player = Main.LocalPlayer.GetModPlayer<YhtPlayer>();
|
||||
return player.KilledBosses.Contains("king_slime") && !player.SummonerAmbitionCrafts.Contains("king_slime");
|
||||
})
|
||||
)
|
||||
.AddOnCraftCallback((recipe, item, consumed, destination) =>
|
||||
{
|
||||
Main.LocalPlayer.GetModPlayer<YhtPlayer>().SummonerAmbitionCrafts.Add("king_slime");
|
||||
})
|
||||
.Register();
|
||||
|
||||
CreateRecipe()
|
||||
.AddIngredient(this)
|
||||
.AddTile(TileID.DemonAltar)
|
||||
.AddIngredient(ItemID.Lens, 100)
|
||||
.AddCondition(new Condition(Language.GetText(
|
||||
"Mods.YHTMod.Recipes.Ambitions.EyeOfCthulhuDead"),
|
||||
() =>
|
||||
{
|
||||
var player = Main.LocalPlayer.GetModPlayer<YhtPlayer>();
|
||||
return player.KilledBosses.Contains("eye_of_cthulhu") && !player.SummonerAmbitionCrafts.Contains("eye_of_cthulhu");
|
||||
})
|
||||
)
|
||||
.AddOnCraftCallback((recipe, item, consumed, destination) =>
|
||||
{
|
||||
Main.LocalPlayer.GetModPlayer<YhtPlayer>().SummonerAmbitionCrafts.Add("eye_of_cthulhu");
|
||||
})
|
||||
.Register();
|
||||
|
||||
CreateRecipe()
|
||||
.AddIngredient(this)
|
||||
.AddTile(TileID.DemonAltar)
|
||||
.AddIngredient(ItemID.Bone, 250)
|
||||
.AddCondition(new Condition(Language.GetText(
|
||||
"Mods.YHTMod.Recipes.Ambitions.SkeletronDead"),
|
||||
() => {
|
||||
var player = Main.LocalPlayer.GetModPlayer<YhtPlayer>();
|
||||
return player.KilledBosses.Contains("skeletron") && !player.SummonerAmbitionCrafts.Contains("skeletron");
|
||||
})
|
||||
)
|
||||
.AddOnCraftCallback((recipe, item, consumed, destination) =>
|
||||
{
|
||||
Main.LocalPlayer.GetModPlayer<YhtPlayer>().SummonerAmbitionCrafts.Add("skeletron");
|
||||
})
|
||||
.Register();
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,16 +1,6 @@
|
||||
Recipes: {
|
||||
AnyWatch: Any Watch
|
||||
Tier2Bars: Tier 2 Hardmode Bars
|
||||
|
||||
Ambitions: {
|
||||
KingSlimeDead: King Slime Defeated
|
||||
EyeOfCthulhuDead: Eye of Cthulhu Defeated
|
||||
EaterOfWorldsDead: Eater of Worlds Defeated
|
||||
BrainOfCthulhuDead: Brain of Cthulhu Defeated
|
||||
QueenBeeDead: Queen Bee Defeated
|
||||
SkeletronDead: Skeletron Defeated
|
||||
WallOfFleshDead: Wall of Flesh Defeated
|
||||
}
|
||||
}
|
||||
|
||||
Buffs: {
|
||||
@@ -80,18 +70,17 @@ Items: {
|
||||
Tooltip:
|
||||
'''
|
||||
Grants Summoner's Ambition.
|
||||
Buff can be empowered by slaying powerful enemies and absorbing their essences.
|
||||
"For those who seek to lead."
|
||||
{$CommonItemTooltip.IncreasesMaxMinionsBy@0}
|
||||
'''
|
||||
KingSlime: "[i:560] +5 summon tag damage."
|
||||
EyeOfCthulhu: "[i:43] Increases minion speed."
|
||||
EaterOfWorlds: "[i:70] Minions penetrate 5 armor."
|
||||
BrainOfCthulhu: "[i:1331] 5% increased minion damage."
|
||||
QueenBee: "[i:1133] Minion hits can inflict poison."
|
||||
Deerclops: "[i:5120] Minion hits can spawn shadow hands."
|
||||
Skeletron: "[i:4801] Increases minion knockback."
|
||||
WallOfFlesh: "[i:267] Increases max number of minions by 1."
|
||||
KingSlime: "[i:560] 20% increased whip size"
|
||||
EyeOfCthulhu: "[i:43] Increases whip damage by 10%"
|
||||
EaterOfWorlds: "[i:70] Summon damage penetrates 5 armor"
|
||||
BrainOfCthulhu: "[i:1331] 5% increased minion damage"
|
||||
QueenBee: "[i:1133] Minion hits can inflict poison"
|
||||
Deerclops: "[i:5120] Minion hits can spawn shadow hands"
|
||||
Skeletron: "[i:4801] Increases minion knockback"
|
||||
WallOfFlesh: "[i:267] Increases max number of minions by 1"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+37
-15
@@ -10,32 +10,54 @@ public class YhtPlayer : ModPlayer
|
||||
{
|
||||
public int ArcaneMissile = 0;
|
||||
public int KatanaTeleportCooldown = 0;
|
||||
public int SummonerAmbitionDeerclopsCooldown = 0;
|
||||
|
||||
|
||||
public bool HasAmbition = false;
|
||||
public bool SummonerAmbition = false;
|
||||
|
||||
public HashSet<string> KilledBosses = [];
|
||||
|
||||
public HashSet<string> SummonerAmbitionCrafts = [];
|
||||
/**
|
||||
* Set of boss and event ids for unlocking perks from Summoner's Ambition accessory
|
||||
*/
|
||||
public HashSet<string> SummonerAmbitions = [];
|
||||
|
||||
public override void PreUpdate()
|
||||
{
|
||||
KatanaTeleportCooldown = Math.Max(KatanaTeleportCooldown - 1, 0);
|
||||
SummonerAmbitionDeerclopsCooldown = Math.Max(SummonerAmbitionDeerclopsCooldown - 1, 0);
|
||||
}
|
||||
|
||||
public override void PostUpdateMiscEffects()
|
||||
public override void PostUpdateEquips()
|
||||
{
|
||||
if (SummonerAmbition)
|
||||
{
|
||||
Player.AddBuff(ModContent.BuffType<SummonerAmbitionBuff>(), 1);
|
||||
Player.maxMinions += GetSummonersAmbitionMinionBonus();
|
||||
|
||||
if (SummonerAmbitions.Contains("king_slime"))
|
||||
{
|
||||
Player.whipRangeMultiplier += 0.2f;
|
||||
}
|
||||
|
||||
if (SummonerAmbitions.Contains("eater_of_worlds"))
|
||||
{
|
||||
Player.GetArmorPenetration(DamageClass.Summon) += 5;
|
||||
}
|
||||
|
||||
if (SummonerAmbitions.Contains("brain_of_cthulhu"))
|
||||
{
|
||||
Player.GetDamage(DamageClass.Summon) += 0.05f;
|
||||
}
|
||||
|
||||
if (SummonerAmbitions.Contains("skeletron"))
|
||||
{
|
||||
Player.GetKnockback(DamageClass.Summon) += 0.1f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void ResetEffects()
|
||||
{
|
||||
ArcaneMissile = 0;
|
||||
HasAmbition = false;
|
||||
SummonerAmbition = false;
|
||||
|
||||
base.ResetEffects();
|
||||
@@ -43,26 +65,26 @@ public class YhtPlayer : ModPlayer
|
||||
|
||||
public override void SaveData(TagCompound tag)
|
||||
{
|
||||
tag["killedBosses"] = new List<string>(KilledBosses);
|
||||
tag["summonerAmbitions"] = new List<string>(SummonerAmbitionCrafts);
|
||||
tag["summonerAmbitions"] = new List<string>(SummonerAmbitions);
|
||||
}
|
||||
|
||||
public override void LoadData(TagCompound tag)
|
||||
{
|
||||
if (tag.ContainsKey("killedBosses"))
|
||||
{
|
||||
var list = tag.GetList<string>("killedBosses");
|
||||
KilledBosses = new HashSet<string>(list);
|
||||
}
|
||||
if (tag.ContainsKey("summonerAmbitions"))
|
||||
{
|
||||
var list = tag.GetList<string>("summonerAmbitions");
|
||||
SummonerAmbitionCrafts = new HashSet<string>(list);
|
||||
SummonerAmbitions = new HashSet<string>(list);
|
||||
}
|
||||
}
|
||||
|
||||
public int GetSummonersAmbitionMinionBonus()
|
||||
{
|
||||
return SummonerAmbitionCrafts.Count / 3 + 1;
|
||||
var amount = 1;
|
||||
if (SummonerAmbitions.Contains("wall_of_flesh"))
|
||||
{
|
||||
amount += 1;
|
||||
}
|
||||
|
||||
return amount;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user