mirror of
https://github.com/YouHaveTrouble/YHTMod.git
synced 2026-05-12 14:06:55 +00:00
Compare commits
10 Commits
feat-thekey
..
1.1.1
| Author | SHA1 | Date | |
|---|---|---|---|
| cc6d8d6dc2 | |||
| e300c3cddb | |||
| 8a9730f61f | |||
| 4819ceee25 | |||
| f46e4e1673 | |||
| bf556d059f | |||
| eb1bf9014d | |||
| 4a0f37f652 | |||
| 68025dd762 | |||
| 4495fd9cc3 |
+14
-1
@@ -4,6 +4,7 @@ using Terraria.GameContent.ItemDropRules;
|
|||||||
using Terraria.ID;
|
using Terraria.ID;
|
||||||
using Terraria.ModLoader;
|
using Terraria.ModLoader;
|
||||||
using YHTMod.Items;
|
using YHTMod.Items;
|
||||||
|
using YHTMod.Items.ArcaneMissle;
|
||||||
|
|
||||||
|
|
||||||
namespace YHTMod.Changes;
|
namespace YHTMod.Changes;
|
||||||
@@ -12,8 +13,20 @@ public class NpcLoot : GlobalNPC
|
|||||||
{
|
{
|
||||||
public override void ModifyNPCLoot(NPC npc, NPCLoot npcLoot) {
|
public override void ModifyNPCLoot(NPC npc, NPCLoot npcLoot) {
|
||||||
int id = npc.type;
|
int id = npc.type;
|
||||||
|
|
||||||
if (NPCID.Sets.CountsAsCritter[id]) {
|
if (NPCID.Sets.CountsAsCritter[id]) {
|
||||||
npcLoot.Add(ItemDropRule.Common(ModContent.ItemType<MithrilPebbleOfPigSmiting>(), 400, 1, 1));
|
npcLoot.Add(ItemDropRule.Common(ModContent.ItemType<MithrilPebbleOfPigSmiting>(), 400));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
switch (id) {
|
||||||
|
case NPCID.Plantera:
|
||||||
|
npcLoot.Add(ItemDropRule.Common(ItemID.ChlorophyteOre, 1, 60, 80));
|
||||||
|
break;
|
||||||
|
case NPCID.Tim:
|
||||||
|
npcLoot.Add(ItemDropRule.Common(ModContent.ItemType<ArcaneMissle>()));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,47 +0,0 @@
|
|||||||
|
|
||||||
using Microsoft.Xna.Framework;
|
|
||||||
using Terraria;
|
|
||||||
using Terraria.Chat;
|
|
||||||
using Terraria.ID;
|
|
||||||
using Terraria.Localization;
|
|
||||||
using Terraria.ModLoader;
|
|
||||||
using YHTMod.Items;
|
|
||||||
|
|
||||||
namespace YHTMod.Changes;
|
|
||||||
|
|
||||||
public class TheKeyBehavior : GlobalTile {
|
|
||||||
|
|
||||||
public override void RightClick(int i, int j, int type) {
|
|
||||||
|
|
||||||
if (type != TileID.Containers) {
|
|
||||||
base.RightClick(i, j, type);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool foundKey = false;
|
|
||||||
foreach (Item item in Main.LocalPlayer.inventory) {
|
|
||||||
if (item.type.Equals(ModContent.ItemType<TheKey>())) {
|
|
||||||
foundKey = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ChatHelper.BroadcastChatMessage(NetworkText.FromLiteral(foundKey.ToString()), Color.White);
|
|
||||||
|
|
||||||
if (!foundKey) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
ChatHelper.BroadcastChatMessage(NetworkText.FromLiteral("Found key!"), Color.White);
|
|
||||||
|
|
||||||
if (!Chest.IsLocked(i, j)) {
|
|
||||||
base.RightClick(i, j, type);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Chest.Unlock(i, j);
|
|
||||||
if (Main.netMode == NetmodeID.MultiplayerClient)
|
|
||||||
NetMessage.SendData(MessageID.Unlock, number: 1, number2: 1f, number3: i, number4: j);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
using Terraria;
|
||||||
|
using Terraria.GameContent.Creative;
|
||||||
|
using Terraria.ID;
|
||||||
|
using Terraria.ModLoader;
|
||||||
|
|
||||||
|
namespace YHTMod.Items.ArcaneMissle;
|
||||||
|
|
||||||
|
public class ArcaneMissle : ModItem {
|
||||||
|
|
||||||
|
public override void SetStaticDefaults() {
|
||||||
|
DisplayName.SetDefault("Arcane Missle");
|
||||||
|
Tooltip.SetDefault(
|
||||||
|
"Magical projectile crits shoot a homing arcane missle\n" +
|
||||||
|
"Arcane missles cannot crit"
|
||||||
|
);
|
||||||
|
CreativeItemSacrificesCatalog.Instance.SacrificeCountNeededByItemId[Type] = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void SetDefaults() {
|
||||||
|
Item.width = 64;
|
||||||
|
Item.height = 64;
|
||||||
|
Item.accessory = true;
|
||||||
|
Item.damage = 10;
|
||||||
|
Item.rare = ItemRarityID.LightRed;
|
||||||
|
Item.DamageType = DamageClass.Magic;
|
||||||
|
Item.noMelee = true;
|
||||||
|
Item.noUseGraphic = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void UpdateAccessory(Player player, bool hideVisual) {
|
||||||
|
|
||||||
|
player.GetModPlayer<YhtPlayer>().arcaneMissle = Item.damage;
|
||||||
|
|
||||||
|
base.UpdateAccessory(player, hideVisual);
|
||||||
|
}
|
||||||
|
}
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 3.4 KiB |
@@ -0,0 +1,47 @@
|
|||||||
|
using System;
|
||||||
|
using Terraria;
|
||||||
|
using Terraria.ID;
|
||||||
|
using Terraria.ModLoader;
|
||||||
|
|
||||||
|
namespace YHTMod.Items.ArcaneMissle;
|
||||||
|
|
||||||
|
public class ArcaneMissleBehavior : GlobalNPC {
|
||||||
|
|
||||||
|
public override void OnHitByProjectile(NPC npc, Projectile projectile, int damage, float knockback, bool crit) {
|
||||||
|
if (!crit) {
|
||||||
|
base.OnHitByProjectile(npc, projectile, damage, knockback, false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Main.netMode == NetmodeID.Server) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Player player = Main.LocalPlayer;
|
||||||
|
|
||||||
|
if (player.GetModPlayer<YhtPlayer>().arcaneMissle != 0 && projectile.DamageType == DamageClass.Magic) {
|
||||||
|
// player just crit with magic weapon while having arcane missle accessory
|
||||||
|
Projectile proj = Projectile.NewProjectileDirect(
|
||||||
|
projectile.GetSource_FromThis("arcaneMissle"),
|
||||||
|
Main.LocalPlayer.position,
|
||||||
|
npc.position.DirectionFrom(Main.LocalPlayer.position),
|
||||||
|
ProjectileID.MagicMissile,
|
||||||
|
player.GetModPlayer<YhtPlayer>().arcaneMissle,
|
||||||
|
0,
|
||||||
|
Main.LocalPlayer.whoAmI
|
||||||
|
);
|
||||||
|
proj.friendly = true;
|
||||||
|
proj.hostile = false;
|
||||||
|
proj.timeLeft = 300;
|
||||||
|
proj.maxPenetrate = 1;
|
||||||
|
proj.tileCollide = false;
|
||||||
|
proj.DamageType = DamageClass.Magic;
|
||||||
|
proj.aiStyle = ProjAIStyleID.MagicMissile;
|
||||||
|
|
||||||
|
// Prevent crits for the missles
|
||||||
|
proj.CritChance = Int32.MinValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
base.OnHitByProjectile(npc, projectile, damage, knockback, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -24,6 +24,11 @@ public class KatanaRedo : GlobalItem {
|
|||||||
|
|
||||||
public override bool? UseItem(Item item, Player player) {
|
public override bool? UseItem(Item item, Player player) {
|
||||||
if (item.type != ItemID.Katana || player.altFunctionUse != 2) return null;
|
if (item.type != ItemID.Katana || player.altFunctionUse != 2) return null;
|
||||||
|
YhtPlayer yhtPlayer = player.GetModPlayer<YhtPlayer>();
|
||||||
|
|
||||||
|
if (yhtPlayer.katanaTeleportCooldown > 0) return null;
|
||||||
|
yhtPlayer.katanaTeleportCooldown = 300;
|
||||||
|
|
||||||
for (int i = 0; i < Main.maxNPCs; i++) {
|
for (int i = 0; i < Main.maxNPCs; i++) {
|
||||||
NPC npc = Main.npc[i];
|
NPC npc = Main.npc[i];
|
||||||
if (!npc.CanBeChasedBy()) continue;
|
if (!npc.CanBeChasedBy()) continue;
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
using Terraria.GameContent.Creative;
|
|
||||||
using Terraria.ModLoader;
|
|
||||||
|
|
||||||
namespace YHTMod.Items;
|
|
||||||
|
|
||||||
public class TheKey : ModItem {
|
|
||||||
|
|
||||||
public override void SetStaticDefaults() {
|
|
||||||
DisplayName.SetDefault("The Key");
|
|
||||||
Tooltip.SetDefault("Opens all locks.");
|
|
||||||
CreativeItemSacrificesCatalog.Instance.SacrificeCountNeededByItemId[Type] = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.2 KiB |
@@ -0,0 +1,21 @@
|
|||||||
|
using System;
|
||||||
|
using Terraria.ModLoader;
|
||||||
|
|
||||||
|
namespace YHTMod;
|
||||||
|
|
||||||
|
public class YhtPlayer : ModPlayer {
|
||||||
|
|
||||||
|
public int arcaneMissle = 0;
|
||||||
|
public int katanaTeleportCooldown = 0;
|
||||||
|
|
||||||
|
public override void PreUpdate() {
|
||||||
|
this.katanaTeleportCooldown = Math.Max(this.katanaTeleportCooldown - 1, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void ResetEffects() {
|
||||||
|
|
||||||
|
this.arcaneMissle = 0;
|
||||||
|
|
||||||
|
base.ResetEffects();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
displayName = YHT Mod
|
displayName = YHT Mod
|
||||||
author = YouHaveTrouble
|
author = YouHaveTrouble
|
||||||
version = 1.0.1
|
version = 1.1.1
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
Bunch of random additions ranging from QoL to random references
|
Bunch of random additions ranging from QoL to random references
|
||||||
|
|
||||||
|
All new content and changes are documented on the wiki.
|
||||||
|
|
||||||
Wiki: https://github.com/YouHaveTrouble/YHTMod/wiki
|
Wiki: https://github.com/YouHaveTrouble/YHTMod/wiki
|
||||||
Source: https://github.com/YouHaveTrouble/YHTMod
|
Source: https://github.com/YouHaveTrouble/YHTMod
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,11 @@
|
|||||||
A bunch of random additions ranging from QoL to random references
|
A bunch of random additions ranging from QoL to random references
|
||||||
|
|
||||||
|
Steam workshop: https://steamcommunity.com/sharedfiles/filedetails/?id=2897350075
|
||||||
|
|
||||||
Mod wiki: https://github.com/YouHaveTrouble/YHTMod/wiki
|
Mod wiki: https://github.com/YouHaveTrouble/YHTMod/wiki
|
||||||
|
|
||||||
|
Discussion discord: [](https://discord.gg/j8KK5dGBps)
|
||||||
|
|
||||||
Code: YouHaveTrouble
|
Code: YouHaveTrouble
|
||||||
|
|
||||||
Sprites: YouHaveTrouble, Patrxon
|
Sprites: YouHaveTrouble, Patrxon
|
||||||
Reference in New Issue
Block a user