Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion AdventureDropDatabase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,12 @@ private static void ModifyDropRate(IItemDropRule rule, int type, int numerator,
foreach (var ruleChainAttempt in rule.ChainedRules)
ModifyDropRate(ruleChainAttempt.RuleToChain, type, numerator, denominator);
}

public class NotInHardmodeCondition : IItemDropRuleCondition
{
public bool CanDrop(DropAttemptInfo info) => !Main.hardMode;
public bool CanShowItemDropInUI() => true;
public string GetConditionDescription() => "Drops in pre-Hardmode";
}
public static void ModifyNPCLoot(NPC npc, NPCLoot npcLoot)
{
var drops = npcLoot.Get();
Expand Down Expand Up @@ -218,6 +223,16 @@ public static void ModifyNPCLoot(NPC npc, NPCLoot npcLoot)
case NPCID.SkeletronHead:
npcLoot.Add(ItemDropRule.Common(ItemID.GoldenKey));
break;

case NPCID.WallofFlesh:
npcLoot.Add(new LeadingConditionRule(new NotInHardmodeCondition()))
.OnSuccess(ItemDropRule.OneFromOptions(1,
ItemID.SummonerEmblem,
ItemID.RangerEmblem,
ItemID.WarriorEmblem,
ItemID.SorcererEmblem
));
break;
}
}
}
35 changes: 35 additions & 0 deletions AdventureItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,41 @@ public class AdventureItem : GlobalItem
ItemID.Sets.Factory.CreateBoolSet(ItemID.MagicMirror, ItemID.CellPhone, ItemID.IceMirror, ItemID.Shellphone,
ItemID.ShellphoneSpawn);

public class PickaxeAdjustments : GlobalItem
{
public override void SetDefaults(Item item)
{
if (item.type == ItemID.SpectrePickaxe || item.type == ItemID.ShroomiteDiggingClaw)
{
item.pick = 210;
}
}
}
public class GelatinCrystalRestriction : GlobalItem
{
public override bool CanUseItem(Item item, Player player)
{
if (item.type == ItemID.QueenSlimeCrystal)
{
bool isUnderground = player.position.Y > Main.worldSurface * 16;
bool inUndergroundHallow = isUnderground && player.ZoneHallow;

if (inUndergroundHallow)
{
Main.NewText("Queen Slime refuses to emerge in the corrupted crystals here!", 255, 50, 50);
return false;
}

// Still block summon in other underground areas but without message
if (isUnderground)
{
return false;
}
}
return base.CanUseItem(item, player);
}
}

public override void SetDefaults(Item item)
{
var adventureConfig = ModContent.GetInstance<AdventureConfig>();
Expand Down
63 changes: 63 additions & 0 deletions AdventurePlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,58 @@ public override bool PreKill(double damage, int hitDirection, bool pvp, ref bool
return true;
}

private bool hadShinyStoneLastFrame;

public override void PostUpdateEquips()
{
// Check if Shiny Stone is equipped
bool hasShinyStone = IsShinyStoneEquipped();

// Apply debuff when first equipped or after respawn
if (hasShinyStone && !hadShinyStoneLastFrame)
{
Player.AddBuff(ModContent.BuffType<ShinyStoneHotswap>(), 3600); // 60 seconds
}

// Disable Shiny Stone effects while debuffed
if (Player.HasBuff(ModContent.BuffType<ShinyStoneHotswap>()))
{
Player.shinyStone = false;
}

hadShinyStoneLastFrame = hasShinyStone;

// Check if wearing full Tiki Armor
if (Player.armor[0].type == ItemID.TikiMask &&
Player.armor[1].type == ItemID.TikiShirt &&
Player.armor[2].type == ItemID.TikiPants)
{
Player.noKnockback = true;
}

}
public override void OnRespawn()
{
// Re-apply debuff if equipped during respawn
if (IsShinyStoneEquipped())
{
Player.AddBuff(ModContent.BuffType<ShinyStoneHotswap>(), 900);
}
}

private bool IsShinyStoneEquipped()
{
for (int i = 3; i < 10; i++) // Check all accessory slots
{
if (Player.armor[i].type == ItemID.ShinyStone &&
(i < 7 || !Player.hideVisibleAccessory[i - 3]))
{
return true;
}
}
return false;
}

public override void Kill(double damage, int hitDirection, bool pvp, PlayerDeathReason damageSource)
{
// Only play kill markers on clients that we hurt that aren't ourselves
Expand Down Expand Up @@ -851,4 +903,15 @@ public override string ToString()
{
return $"{Player.whoAmI}/{Player.name}/{DiscordUser?.Id}";
}
}
public class ShinyStoneHotswap : ModBuff
{
public override string Texture => $"PvPAdventure/Assets/Buff/ShinyStoneHotswap";

public override void SetStaticDefaults()
{
Main.debuff[Type] = true;
Main.buffNoSave[Type] = true;
Main.buffNoTimeDisplay[Type] = false; // Show timer
}
}
Loading