+ Moved Transformation fixes to current branch and moved over all new transformation items

This commit is contained in:
Big E authored and Cameron Ewell committed 2025-07-08 15:20:36 -04:00
1 parent 06339398c5
commit ecded70417
32 files changed
+549 -1033

No files matched your search

+2 -5
View File
@@ -1,4 +1,5 @@
using CalamityMod.CalPlayer;
using CalamityMod.Items.Accessories.Vanity;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
@@ -18,11 +19,7 @@ namespace CalamityMod.Buffs
public override void Update(Player player, ref int buffIndex)
{
CalamityPlayer modPlayer = player.Calamity();
if (modPlayer.snowmanPrevious)
{
modPlayer.snowmanPower = true;
}
else
if (player.Transformation().Type != ModContent.ItemType<Popo>())
{
player.DelBuff(buffIndex);
buffIndex--;
+2 -4
View File
@@ -1,4 +1,5 @@
using CalamityMod.CalPlayer;
using CalamityMod.Items.Accessories.Vanity;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
@@ -17,11 +18,8 @@ namespace CalamityMod.Buffs
public override void Update(Player player, ref int buffIndex)
{
CalamityPlayer modPlayer = player.Calamity();
if (modPlayer.snowmanPrevious)
{
modPlayer.snowmanPower = true;
if (player.Transformation().Type != ModContent.ItemType<Popo>())
modPlayer.snowmanNoseless = true;
}
else
{
player.DelBuff(buffIndex);
-1
View File
@@ -26,7 +26,6 @@ namespace CalamityMod.Buffs.StatBuffs
player.maxFallSpeed = 9f;
player.gills = true;
}
modPlayer.abyssalDivingSuitPower = true;
modPlayer.depthCharm = true;
modPlayer.jellyfishNecklace = true;
modPlayer.anechoicPlating = true;
-1
View File
@@ -20,7 +20,6 @@ namespace CalamityMod.Buffs.StatBuffs
CalamityPlayer modPlayer = player.Calamity();
if (modPlayer.aquaticHeartPrevious)
{
modPlayer.aquaticHeartPower = true;
player.ignoreWater = NPC.downedBoss3;
player.accFlipper = true;
if (player.breath <= player.breathMax + 2 && !modPlayer.ZoneAbyss && NPC.downedBoss3)
+6 -180
View File
@@ -1576,33 +1576,20 @@ namespace CalamityMod.CalPlayer
#endregion
#region Transformation
public bool abyssalDivingSuitPrevious;
public bool abyssalDivingSuit;
public bool abyssalDivingSuitHide;
public bool abyssalDivingSuitForce;
public bool abyssalDivingSuitPower;
public bool abyssalDivingSuitPrevious;
public bool profanedCrystal;
public int profanedCrystalStatePrevious;
public bool profanedCrystalPrevious;
public int profanedCrystalAnim;
public bool profanedCrystalForce;
public bool profanedCrystalBuffs;
public bool profanedCrystalHide;
public KeyValuePair<int, int> profanedCrystalWingCounter = new KeyValuePair<int, int>(0, 10);
public KeyValuePair<int, int> profanedCrystalAnimCounter = new KeyValuePair<int, int>(0, 10);
public int pscState;
public Color pscLerpColor = Color.White;
public bool aquaticHeartPrevious;
public bool aquaticHeart;
public bool aquaticHeartHide;
public bool aquaticHeartForce;
public bool aquaticHeartPower;
public bool snowmanPrevious;
public bool snowman;
public bool snowmanHide;
public bool snowmanForce;
public bool snowmanNoseless;
public bool snowmanPower;
public bool meldTransformationPrevious;
public bool meldTransformation;
public bool meldTransformationForce;
@@ -1611,8 +1598,6 @@ namespace CalamityMod.CalPlayer
public bool omegaBlueTransformation;
public bool omegaBlueTransformationForce;
public bool omegaBlueTransformationPower;
public bool ghostBracelet;
public bool punchCard;
#endregion
#region Calamitas Enchant Effects
@@ -2720,19 +2705,17 @@ namespace CalamityMod.CalPlayer
*/
abyssalDivingSuitPrevious = abyssalDivingSuit;
abyssalDivingSuit = abyssalDivingSuitHide = abyssalDivingSuitForce = abyssalDivingSuitPower = false;
abyssalDivingSuit = false;
aquaticHeartPrevious = aquaticHeart;
aquaticHeart = aquaticHeartHide = aquaticHeartForce = aquaticHeartPower = false;
aquaticHeart = false;
profanedCrystalStatePrevious = pscState;
profanedCrystalPrevious = profanedCrystal;
profanedCrystal = profanedCrystalBuffs = profanedCrystalForce = profanedCrystalHide = false;
profanedCrystal = profanedCrystalBuffs = false;
pscState = 0;
pscLerpColor = Color.White;
snowmanPrevious = snowman;
snowman = snowmanHide = snowmanForce = snowmanPower = false;
snowman = false;
meldTransformationPrevious = meldTransformation;
meldTransformation = meldTransformationForce = meldTransformationPower = false;
@@ -2740,9 +2723,6 @@ namespace CalamityMod.CalPlayer
omegaBlueTransformationPrevious = omegaBlueTransformation;
omegaBlueTransformation = omegaBlueTransformationForce = omegaBlueTransformationPower = false;
ghostBracelet = false;
punchCard = false;
rageModeActive = false;
adrenalineModeActive = false;
AdrenalineTrail = false;
@@ -4881,37 +4861,6 @@ namespace CalamityMod.CalPlayer
&& Player.armor[1].type == ModContent.ItemType<SnowRuffianChestplate>()
&& Player.armor[2].type == ModContent.ItemType<SnowRuffianGreaves>())
snowRuffianSet = true;
// Accessories
for (int i = 3; i < 8; i++)
{
Item vanity = Player.armor[i];
if (vanity.type == ModContent.ItemType<AbandonedWulfrumHelmet>())
Player.GetModPlayer<WulfrumTransformationPlayer>().transformationActive = true;
if (vanity.type == ModContent.ItemType<AbyssalDivingSuit>())
abyssalDivingSuitForce = true;
if (vanity.type == ModContent.ItemType<AquaticHeart>())
aquaticHeartForce = true;
if (vanity.type == ModContent.ItemType<GhostBracelet>())
ghostBracelet = true;
if (vanity.type == ModContent.ItemType<HapuFruit>())
Player.GetModPlayer<HapuFruitPlayer>().vanityEquipped = true;
if (vanity.type == ModContent.ItemType<OracleHeadphones>())
Player.GetModPlayer<OracleHeadphonesPlayer>().vanityEquipped = true;
if (vanity.type == ModContent.ItemType<Popo>())
snowmanForce = true;
if (vanity.type == ModContent.ItemType<ProfanedSoulCrystal>())
profanedCrystalForce = true;
if (vanity.type == ModContent.ItemType<PunchCard>())
punchCard = true;
if (vanity.type == ModContent.ItemType<SharkyPlush>())
Player.GetModPlayer<SharkyPlushPlayer>().vanityEquipped = true;
if (vanity.type == ModContent.ItemType<XyksBlessingBlue>())
Player.GetModPlayer<XyksBlessingBluePlayer>().vanityEquipped = true;
if (vanity.type == ModContent.ItemType<XyksBlessingOrange>())
Player.GetModPlayer<XyksBlessingOrangePlayer>().vanityEquipped = true;
}
}
if (Player.Calamity().andromedaState == AndromedaPlayerState.LargeRobot ||
@@ -4919,58 +4868,8 @@ namespace CalamityMod.CalPlayer
{
Player.head = EquipLoader.GetEquipSlot(Mod, "HeadlessEquipTexture", EquipType.Head); // To make the head invisible on the map. The map was having a hissy fit because of hitbox changes.
}
else if ((profanedCrystal || profanedCrystalForce) && !profanedCrystalHide)
{
Player.legs = EquipLoader.GetEquipSlot(Mod, Main.dayTime ? "ProfanedSoulCrystal" : "PscNightLegs", EquipType.Legs);
Player.body = EquipLoader.GetEquipSlot(Mod, "ProfanedSoulCrystal", EquipType.Body);
Player.head = EquipLoader.GetEquipSlot(Mod, Main.dayTime ? "ProfanedSoulCrystal" : "PscNightHead", EquipType.Head);
Player.wings = EquipLoader.GetEquipSlot(Mod, Main.dayTime ? "ProfanedSoulCrystal" : "PscNightWings", EquipType.Wings);
Player.face = -1;
bool enrage = pscState >= (int)ProfanedSoulCrystal.ProfanedSoulCrystalState.Enraged;
if (profanedCrystalWingCounter.Value == 0)
{
int key = profanedCrystalWingCounter.Key;
profanedCrystalWingCounter = new KeyValuePair<int, int>(key == 3 ? 0 : key + 1, enrage ? 5 : 8);
}
Player.wingFrame = profanedCrystalWingCounter.Key;
profanedCrystalWingCounter = new KeyValuePair<int, int>(profanedCrystalWingCounter.Key, profanedCrystalWingCounter.Value - 1);
Player.armorEffectDrawOutlines = true;
if (profanedCrystalBuffs)
{
Player.armorEffectDrawShadow = true;
if (enrage)
{
Player.armorEffectDrawOutlinesForbidden = true;
}
}
}
else if ((snowmanPower || snowmanForce) && !snowmanHide)
{
Player.legs = EquipLoader.GetEquipSlot(Mod, "Popo", EquipType.Legs);
Player.body = EquipLoader.GetEquipSlot(Mod, "Popo", EquipType.Body);
Player.head = EquipLoader.GetEquipSlot(Mod, snowmanNoseless ? "PopoNoseless" : "Popo", EquipType.Head);
Player.face = -1;
}
else if (AresExoskeleton.ArmExists(Player))
Player.body = EquipLoader.GetEquipSlot(Mod, "AresExoskeleton", EquipType.Body);
else if ((abyssalDivingSuitPower || abyssalDivingSuitForce) && !abyssalDivingSuitHide)
{
Player.legs = EquipLoader.GetEquipSlot(Mod, "AbyssalDivingSuit", EquipType.Legs);
Player.body = EquipLoader.GetEquipSlot(Mod, "AbyssalDivingSuit", EquipType.Body);
Player.head = EquipLoader.GetEquipSlot(Mod, "AbyssalDivingSuit", EquipType.Head);
Player.face = -1;
}
else if ((aquaticHeartPower || aquaticHeartForce) && !aquaticHeartHide)
{
Player.legs = EquipLoader.GetEquipSlot(Mod, "AquaticHeart", EquipType.Legs);
Player.body = EquipLoader.GetEquipSlot(Mod, "AquaticHeart", EquipType.Body);
Player.head = EquipLoader.GetEquipSlot(Mod, "AquaticHeart", EquipType.Head);
Player.face = -1;
}
else if (meldTransformationPower || meldTransformationForce)
{
Player.legs = EquipLoader.GetEquipSlot(Mod, "MeldTransformation", EquipType.Legs);
@@ -4985,26 +4884,7 @@ namespace CalamityMod.CalPlayer
if (hasOmegaBlueCooldown && cd.timeLeft > 1500)
Player.head = EquipLoader.GetEquipSlot(Mod, "OmegaBlueTransformation", EquipType.Head);
}
else
{
if (profanedCrystalWingCounter.Key != 1)
profanedCrystalWingCounter = new KeyValuePair<int, int>(1, 7);
if (profanedCrystalAnimCounter.Key != 0)
profanedCrystalAnimCounter = new KeyValuePair<int, int>(0, 10);
}
if (ghostBracelet)
{
Player.legs = EquipLoader.GetEquipSlot(Mod, "GhostBracelet", EquipType.Legs);
Player.body = EquipLoader.GetEquipSlot(Mod, "GhostBracelet", EquipType.Body);
Player.head = EquipLoader.GetEquipSlot(Mod, "GhostBracelet", EquipType.Head);
}
if (punchCard)
{
Player.legs = EquipLoader.GetEquipSlot(Mod, "PunchCard", EquipType.Legs);
Player.body = EquipLoader.GetEquipSlot(Mod, "PunchCard", EquipType.Body);
Player.head = EquipLoader.GetEquipSlot(Mod, "PunchCard", EquipType.Head);
}
if (snowRuffianSet)
{
@@ -5602,60 +5482,6 @@ namespace CalamityMod.CalPlayer
}
}
private bool IsValidTransitionFrame(AnimationType currentAnim, AnimationType newAnim, int frame, int counter) //this exists so it doesn't loop through the entire walk/idle anim just to find one frame for switching.
{
bool result = newAnim != AnimationType.Jump && currentAnim != AnimationType.Jump;
if (currentAnim == AnimationType.Walk && newAnim == AnimationType.Idle)
{
result = counter <= 0 && (frame == 11 || frame == 15 || frame == 19);
}
else if (currentAnim == AnimationType.Idle && newAnim == AnimationType.Walk)
{
result = counter <= 0 && (frame == 2 || frame == 6);
}
return currentAnim != newAnim && result; //swapping to jumps should be instant, no need to check the counter here
}
private int HandlePSCAnimationFrames(AnimationType newType)
{
int key = profanedCrystalAnimCounter.Key; //0-based indexing
int value = profanedCrystalAnimCounter.Value - 1;
AnimationType currentType = key < 8 ? AnimationType.Idle : key == 8 ? AnimationType.Jump : AnimationType.Walk;
bool isInvalidTransFrame = !IsValidTransitionFrame(currentType, newType, key, value); //to make the transition between walk and idle frames less jarring and smoother
AnimationType type = isInvalidTransFrame ? newType : currentType;
int frameCount = type == AnimationType.Walk || (!profanedCrystalForce && Player.statLife <= (int)(Player.statLifeMax2 * 0.5)) ? 7 : 10;
int lowerRange = type == AnimationType.Idle ? 0 : type == AnimationType.Jump ? 8 : 9;
int upperRange = type == AnimationType.Idle ? 7 : type == AnimationType.Jump ? 8 : 22;
if (value <= 0 || !isInvalidTransFrame)
{
value = frameCount;
if (key >= lowerRange && key < upperRange)
key++;
else
key = lowerRange;
}
profanedCrystalAnimCounter = new KeyValuePair<int, int>(key, value);
return profanedCrystalAnimCounter.Key;
}
public override void PostUpdate() //needs to be here else it doesn't work properly, otherwise i'd have stuck it with the wing anim stuffs
{
bool validEquipSlot = Player.legs == EquipLoader.GetEquipSlot(Mod, "ProfanedSoulCrystal", EquipType.Legs) ||
Player.legs == EquipLoader.GetEquipSlot(Mod, "PscNightLegs", EquipType.Legs);
if (!profanedCrystalHide && (profanedCrystal || profanedCrystalForce) && validEquipSlot)
{
bool usingCarpet = Player.carpetTime > 0 && Player.controlJump; //doesn't make sense for carpet to use jump frame since you have solid ground
AnimationType animType = AnimationType.Walk;
if ((Player.sliding || Player.velocity.Y != 0 || Player.mount.Active || (Player.grappling[0] != -1 || !Player.CheckSolidGround()) || Player.GoingDownWithGrapple) && !usingCarpet)
animType = AnimationType.Jump;
else if (Player.velocity.X == 0 || usingCarpet)
animType = AnimationType.Idle;
int frame = HandlePSCAnimationFrames(animType);
Player.legFrame.Y = Player.legFrame.Height * frame;
}
}
#endregion
#region Misc Stuff
-46
View File
@@ -442,52 +442,6 @@ namespace CalamityMod.CalPlayer
Player drawPlayer = drawInfo.drawPlayer;
Item item = drawPlayer.ActiveItem();
// Vanity accessory effects, allows them to draw while the game is paused
if (drawPlayer.Calamity().ghostBracelet)
{
drawPlayer.legs = EquipLoader.GetEquipSlot(Mod, "GhostBracelet", EquipType.Legs);
drawPlayer.body = EquipLoader.GetEquipSlot(Mod, "GhostBracelet", EquipType.Body);
drawPlayer.head = EquipLoader.GetEquipSlot(Mod, "GhostBracelet", EquipType.Head);
}
else if ((drawPlayer.Calamity().snowmanPower || drawPlayer.Calamity().snowmanForce) && !drawPlayer.Calamity().snowmanHide)
{
drawPlayer.legs = EquipLoader.GetEquipSlot(Mod, "Popo", EquipType.Legs);
drawPlayer.body = EquipLoader.GetEquipSlot(Mod, "Popo", EquipType.Body);
drawPlayer.head = EquipLoader.GetEquipSlot(Mod, snowmanNoseless ? "PopoNoseless" : "Popo", EquipType.Head);
drawPlayer.face = -1;
}
else if (drawPlayer.Calamity().punchCard)
{
drawPlayer.legs = EquipLoader.GetEquipSlot(Mod, "PunchCard", EquipType.Legs);
drawPlayer.body = EquipLoader.GetEquipSlot(Mod, "PunchCard", EquipType.Body);
drawPlayer.head = EquipLoader.GetEquipSlot(Mod, "PunchCard", EquipType.Head);
}
else if ((drawPlayer.Calamity().abyssalDivingSuitPower || drawPlayer.Calamity().abyssalDivingSuitForce) && !drawPlayer.Calamity().abyssalDivingSuitHide)
{
drawPlayer.legs = EquipLoader.GetEquipSlot(Mod, "AbyssalDivingSuit", EquipType.Legs);
drawPlayer.body = EquipLoader.GetEquipSlot(Mod, "AbyssalDivingSuit", EquipType.Body);
drawPlayer.head = EquipLoader.GetEquipSlot(Mod, "AbyssalDivingSuit", EquipType.Head);
drawPlayer.face = -1;
}
else if ((drawPlayer.Calamity().aquaticHeartPower || drawPlayer.Calamity().aquaticHeartForce) && !drawPlayer.Calamity().aquaticHeartHide)
{
drawPlayer.legs = EquipLoader.GetEquipSlot(Mod, "AquaticHeart", EquipType.Legs);
drawPlayer.body = EquipLoader.GetEquipSlot(Mod, "AquaticHeart", EquipType.Body);
drawPlayer.head = EquipLoader.GetEquipSlot(Mod, "AquaticHeart", EquipType.Head);
drawPlayer.face = -1;
}
// Need to set all of these so that certain vanity pieces like Capricorn Tail don't screw it up
if (drawPlayer.Calamity().ghostBracelet || ((drawPlayer.Calamity().snowmanPower || drawPlayer.Calamity().snowmanForce) && !drawPlayer.Calamity().snowmanHide) ||
drawPlayer.Calamity().punchCard || ((drawPlayer.Calamity().abyssalDivingSuitPower || drawPlayer.Calamity().abyssalDivingSuitForce) && !drawPlayer.Calamity().abyssalDivingSuitHide) ||
((drawPlayer.Calamity().aquaticHeartPower || drawPlayer.Calamity().aquaticHeartForce) && !drawPlayer.Calamity().aquaticHeartHide))
{
drawInfo.legsGlowMask = -1;
drawInfo.legsOffset = Vector2.Zero;
drawInfo.bodyGlowMask = -1;
drawInfo.headGlowMask = -1;
drawInfo.helmetOffset = Vector2.Zero;
}
if (!drawPlayer.frozen &&
(item.IsAir || item.type > ItemID.None) &&
!drawPlayer.dead &&
+9 -33
View File
@@ -485,7 +485,7 @@ namespace CalamityMod.CalPlayer
damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.Withered").ToNetworkText(Player.name));
}
}
if (profanedCrystalBuffs && !profanedCrystalHide)
if (profanedCrystalBuffs && Player.Transformation().Type == ModContent.ItemType<ProfanedSoulCrystal>())
{
damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.ProfanedSoulCrystal").ToNetworkText(Player.name));
}
@@ -1745,11 +1745,17 @@ namespace CalamityMod.CalPlayer
// Handles energy shields and Boss Rush, in that order
modifiers.ModifyHurtInfo += ModifyHurtInfo_Calamity;
// TODO -- At some point it'd be nice to have a "TransformationPlayer" that has all the transformation sfx and visuals so their priorities can be more easily managed.
#region Custom Hurt Sounds
if (hurtSoundTimer == 0)
{
if (roverDrive && RoverDriveShieldDurability > 0)
if(Player.Transformation().Type != -1 && Player.Transformation().currentTransformation.HurtSound(Player) != null)
{
var hurtSound = Player.Transformation().currentTransformation.HurtSound(Player).Value;
modifiers.DisableSound();
SoundEngine.PlaySound(hurtSound.sound, Player.Center);
hurtSoundTimer = hurtSound.delay;
}
else if (roverDrive && RoverDriveShieldDurability > 0)
{
modifiers.DisableSound();
SoundEngine.PlaySound(RoverDrive.ShieldHurtSound, Player.Center);
@@ -1767,42 +1773,12 @@ namespace CalamityMod.CalPlayer
SoundEngine.PlaySound(TheSponge.ShieldHurtSound, Player.Center);
hurtSoundTimer = 20;
}
else if (((pSoulArtifact && !profanedCrystal) || profanedCrystalBuffs) && pSoulShieldDurability > 0)
{
modifiers.DisableSound();
SoundEngine.PlaySound(ProfanedGuardianDefender.ShieldDeathSound);
hurtSoundTimer = 20;
}
else if ((profanedCrystal || profanedCrystalForce) && !profanedCrystalHide)
{
modifiers.DisableSound();
SoundEngine.PlaySound(Providence.HurtSound, Player.Center);
hurtSoundTimer = 20;
}
else if ((abyssalDivingSuitPower || abyssalDivingSuitForce) && !abyssalDivingSuitHide)
{
modifiers.DisableSound();
SoundEngine.PlaySound(SoundID.NPCHit4, Player.Center); //metal hit noise
hurtSoundTimer = 10;
}
else if ((aquaticHeartPower || aquaticHeartForce) && !aquaticHeartHide)
{
modifiers.DisableSound();
SoundEngine.PlaySound(SoundID.FemaleHit, Player.Center); //female hit noise
hurtSoundTimer = 10;
}
else if (titanHeartSet)
{
modifiers.DisableSound();
SoundEngine.PlaySound(NPCs.Astral.Atlas.HurtSound, Player.Center);
hurtSoundTimer = 10;
}
else if (Player.GetModPlayer<WulfrumTransformationPlayer>().transformationActive)
{
modifiers.DisableSound();
SoundEngine.PlaySound(SoundID.NPCHit4, Player.Center);
hurtSoundTimer = 10;
}
else if (Player.GetModPlayer<WulfrumArmorPlayer>().wulfrumSet && (Player.name.ToLower() == "wagstaff" || Player.name.ToLower() == "john wulfrum"))
{
modifiers.DisableSound();
+14 -36
View File
@@ -1,30 +1,31 @@
using CalamityMod.CalPlayer;
using CalamityMod.Items.BaseItems;
using CalamityMod.Items.Materials;
using CalamityMod.Items.Placeables;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Accessories
{
public class AbyssalDivingSuit : ModItem, ILocalizedModType
public class AbyssalDivingSuit : TransformationAccessory, ILocalizedModType
{
public new string LocalizationCategory => "Items.Accessories";
public static double PlatesAllDamageReduction = 0.15D;
public static double PlatesHitDecay = 0.03D;
public override void Load()
{
// All code below runs only if we're not loading on a server
if (!Main.dedServ)
{
// Add equip textures
EquipLoader.AddEquipTexture(Mod, $"{Texture}_{EquipType.Head}", EquipType.Head, this);
EquipLoader.AddEquipTexture(Mod, $"{Texture}_{EquipType.Body}", EquipType.Body, this);
EquipLoader.AddEquipTexture(Mod, $"{Texture}_{EquipType.Legs}", EquipType.Legs, this);
}
}
public override string AssetPath => "CalamityMod/Items/Accessories/";
public override (EquipType, string, string)[] EquipSlots =>
[
(EquipType.Head, "AbyssalDivingSuit", null),
(EquipType.Body, "AbyssalDivingSuit", null),
(EquipType.Legs, "AbyssalDivingSuit", null),
(EquipType.Face, null, null), //results in setting this equip slot to -1
];
public override (SoundStyle sound, int delay)? HurtSound(Player p) => (SoundID.NPCHit4, 10);
public override void SetDefaults()
{
@@ -33,32 +34,9 @@ namespace CalamityMod.Items.Accessories
Item.accessory = true;
Item.value = CalamityGlobalItem.RarityPurpleBuyPrice;
Item.rare = ItemRarityID.Purple;
if (!Main.dedServ)
{
int equipSlotHead = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Head);
int equipSlotBody = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Body);
int equipSlotLegs = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Legs);
ArmorIDs.Head.Sets.DrawHead[equipSlotHead] = false;
ArmorIDs.Body.Sets.HidesTopSkin[equipSlotBody] = true;
ArmorIDs.Body.Sets.HidesArms[equipSlotBody] = true;
ArmorIDs.Legs.Sets.HidesBottomSkin[equipSlotLegs] = true;
}
}
public override void UpdateAccessory(Player player, bool hideVisual)
{
CalamityPlayer modPlayer = player.Calamity();
modPlayer.abyssalDivingSuit = true;
if (hideVisual)
modPlayer.abyssalDivingSuitHide = true;
}
public override void UpdateVanity(Player player)
{
player.Calamity().abyssalDivingSuitHide = false;
player.Calamity().abyssalDivingSuitForce = true;
}
public override void UpdateAccessory(Player player, bool hideVisual) => player.Calamity().abyssalDivingSuit = true;
public override void AddRecipes()
{
+13 -38
View File
@@ -1,45 +1,32 @@
using System;
using System.Collections.Generic;
using CalamityMod.CalPlayer;
using CalamityMod.Items.BaseItems;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Accessories
{
[LegacyName("SirensHeart")]
public class AquaticHeart : ModItem, ILocalizedModType
public class AquaticHeart : TransformationAccessory, ILocalizedModType
{
public new string LocalizationCategory => "Items.Accessories";
public static float WaterSpeedBoost = 0.15f;
public static double IceShieldAllDamageReduction = 0.2D;
public override void Load()
{
// All code below runs only if we're not loading on a server
if (!Main.dedServ)
{
// Add equip textures
EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/AquaticTrans_Head", EquipType.Head, this);
EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/AquaticTrans_Body", EquipType.Body, this);
EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/AquaticTrans_Legs", EquipType.Legs, this);
}
}
public override string AssetPath => "CalamityMod/Items/Accessories/";
public override (EquipType, string, string)[] EquipSlots =>
[
(EquipType.Head, "AquaticTrans", null),
(EquipType.Body, "AquaticTrans", null),
(EquipType.Legs, "AquaticTrans", null),
(EquipType.Face, null, null), //results in setting this equip slot to -1
];
public override void SetStaticDefaults()
{
if (!Main.dedServ)
{
int equipSlotHead = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Head);
int equipSlotBody = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Body);
int equipSlotLegs = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Legs);
ArmorIDs.Head.Sets.DrawHead[equipSlotHead] = false;
ArmorIDs.Body.Sets.HidesTopSkin[equipSlotBody] = true;
ArmorIDs.Body.Sets.HidesArms[equipSlotBody] = true;
ArmorIDs.Legs.Sets.HidesBottomSkin[equipSlotLegs] = true;
}
}
public override (SoundStyle sound, int delay)? HurtSound(Player p) => (SoundID.FemaleHit, 10);
public override void SetDefaults()
{
@@ -50,19 +37,7 @@ namespace CalamityMod.Items.Accessories
Item.rare = ItemRarityID.LightRed;
}
public override void UpdateAccessory(Player player, bool hideVisual)
{
CalamityPlayer modPlayer = player.Calamity();
modPlayer.aquaticHeart = true;
if (hideVisual)
modPlayer.aquaticHeartHide = true;
}
public override void UpdateVanity(Player player)
{
player.Calamity().aquaticHeartHide = false;
player.Calamity().aquaticHeartForce = true;
}
public override void UpdateAccessory(Player player, bool hideVisual) => player.Calamity().aquaticHeart = true;
public override void ModifyTooltips(List<TooltipLine> tooltips)
{
+112 -36
View File
@@ -5,7 +5,9 @@ using CalamityMod.Buffs.StatBuffs;
using CalamityMod.Buffs.Summon.Whips;
using CalamityMod.CalPlayer;
using CalamityMod.DataStructures;
using CalamityMod.Items.BaseItems;
using CalamityMod.Items.Materials;
using CalamityMod.NPCs.ProfanedGuardians;
using CalamityMod.NPCs.Providence;
using CalamityMod.Particles;
using CalamityMod.Projectiles.Summon;
@@ -23,7 +25,7 @@ using Terraria.ModLoader;
namespace CalamityMod.Items.Accessories
{
//Developer item, dedicatee: Mishiro Usui/Amber Sienna
public class ProfanedSoulCrystal : ModItem, ILocalizedModType, IDyeableShaderRenderer
public class ProfanedSoulCrystal : TransformationAccessory, ILocalizedModType, IDyeableShaderRenderer
{
public static string[] contributorNames = new[] { "IbanPlay", "Chen", "Nincity", "Amber", "Mishiro", "LordMetarex", "Memes" };
public static int ShieldDurabilityMax = 125;
@@ -104,7 +106,7 @@ namespace CalamityMod.Items.Accessories
if (ignoreNoBuffs &&
(!DownedBossSystem.downedCalamitas || !DownedBossSystem.downedExoMechs ||
(player.maxMinions - player.slotsMinions) < maxMinionRequirement) ||
player.Calamity().profanedCrystalForce || !player.HasBuff<ProfanedCrystalBuff>())
player.Transformation().Type == ModContent.ItemType<ProfanedSoulCrystal>() || !player.HasBuff<ProfanedCrystalBuff>())
{
return ProfanedSoulCrystalState.Vanity; //failsafe for vanity
}
@@ -178,28 +180,22 @@ namespace CalamityMod.Items.Accessories
* Projectiles transformed are ONLY affected by alldamage and summon damage bonuses, likewise the weapon's base damage/usetime is NOT taken into account.
* The on-hit effect for the whip is in globalnpc
*/
public override void Load()
public override string AssetPath => "CalamityMod/Items/Accessories/";
public override (EquipType Type, string AssetName, string EquipName)[] EquipSlots =>
[
(EquipType.Head, "ProfanedSoulTrans", null),
(EquipType.Body, "ProfanedSoulTrans", null),
(EquipType.Legs, "ProfanedSoulTrans", null),
(EquipType.Wings, "ProfanedSoulTrans", null),
(EquipType.Head, "ProfanedSoulTransNight", "PscNightHead"),
(EquipType.Legs, "ProfanedSoulTransNight", "PscNightLegs"),
(EquipType.Wings, "ProfanedSoulTransNight", "PscNightWings"),
(EquipType.Face, null, null), //results in setting this equip slot to -1
];
public override void ArmorIDSets()
{
if (Main.dedServ)
return;
EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/ProfanedSoulTransHead", EquipType.Head, this);
EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/ProfanedSoulTransHeadNight", EquipType.Head, this, "PscNightHead");
EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/ProfanedSoulTransBody", EquipType.Body, this);
EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/ProfanedSoulTransLegs", EquipType.Legs, this);
EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/ProfanedSoulTransLegsNight", EquipType.Legs, this, "PscNightLegs");
EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Wings/ProfanedSoulTransWings", EquipType.Wings, this);
EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Wings/ProfanedSoulTransWingsNight", EquipType.Wings, this, "PscNightWings");
}
public override void SetStaticDefaults()
{
Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(8, 4));
ItemID.Sets.AnimatesAsSoul[Type] = true;
if (Main.dedServ)
return;
int equipSlotBody = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Body);
ArmorIDs.Body.Sets.HidesTopSkin[equipSlotBody] = true;
ArmorIDs.Body.Sets.HidesArms[equipSlotBody] = true;
@@ -213,6 +209,16 @@ namespace CalamityMod.Items.Accessories
ArmorIDs.Legs.Sets.OverridesLegs[equipSlotNightLegs] = true;
}
public override (SoundStyle sound, int delay)? HurtSound(Player p) => (p.Calamity().pSoulShieldDurability > 0 ? ProfanedGuardianDefender.ShieldDeathSound : Providence.HurtSound, 20);
public override void SetStaticDefaults()
{
Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(8, 4));
ItemID.Sets.AnimatesAsSoul[Type] = true;
base.SetStaticDefaults();
}
public override void SetDefaults()
{
SummonTag.TagItem = Item.type;
@@ -225,10 +231,7 @@ namespace CalamityMod.Items.Accessories
Item.Calamity().devItem = true;
}
public override bool CanAccessoryBeEquippedWith(Item equippedItem, Item incomingItem, Player player)
{
return incomingItem.type != ModContent.ItemType<ProfanedSoulArtifact>();
}
public override bool CanAccessoryBeEquippedWith(Item equippedItem, Item incomingItem, Player player) => incomingItem.type != ModContent.ItemType<ProfanedSoulArtifact>();
public override void ModifyTooltips(List<TooltipLine> tooltips)
{
@@ -266,6 +269,7 @@ namespace CalamityMod.Items.Accessories
modPlayer.pSoulArtifact = true;
modPlayer.profanedCrystal = true;
if (!modPlayer.profanedCrystalPrevious && player.ownedProjectileCounts[ModContent.ProjectileType<PscTransformAnimation>()] == 0)
{
modPlayer.pSoulShieldDurability = 1;
@@ -275,23 +279,15 @@ namespace CalamityMod.Items.Accessories
if (DownedBossSystem.downedCalamitas && DownedBossSystem.downedExoMechs)
player.Calamity().profanedSoulRelicBuff = true;
modPlayer.profanedCrystalHide = hideVisual || modPlayer.profanedCrystalAnim > 0;
modPlayer.pSoulShieldVisible = !hideVisual;
DetermineTransformationEligibility(player);
}
public override void UpdateVanity(Player player)
{
player.Calamity().profanedCrystalHide = false;
player.Calamity().profanedCrystalForce = true;
}
internal static void DetermineTransformationEligibility(Player player)
{
//short circuit immediately if profanedcrystalbuffs has already been set
if (!player.Calamity().profanedCrystalBuffs && player.Calamity().profanedCrystalAnim == -1 && DownedBossSystem.downedCalamitas && DownedBossSystem.downedExoMechs && (player.maxMinions - player.slotsMinions) >= maxMinionRequirement && !player.Calamity().profanedCrystalForce && player.HasBuff<ProfanedCrystalBuff>())
if (!player.Calamity().profanedCrystalBuffs && player.Calamity().profanedCrystalAnim == -1 && DownedBossSystem.downedCalamitas && DownedBossSystem.downedExoMechs && (player.maxMinions - player.slotsMinions) >= maxMinionRequirement && player.HasBuff<ProfanedCrystalBuff>())
{
player.Calamity().profanedCrystalBuffs = true;
player.Calamity().pscState = (int)GetPscStateFor(player); //update psc state, default is 0 which is the same as the int value of vanity
@@ -535,6 +531,86 @@ namespace CalamityMod.Items.Accessories
return false;
}
public override void TransformFrameEffects(Player player)
{
bool enrage = player.Calamity().pscState >= (int)ProfanedSoulCrystal.ProfanedSoulCrystalState.Enraged;
if (profanedCrystalWingCounter.Value == 0)
{
int key = profanedCrystalWingCounter.Key;
profanedCrystalWingCounter = new KeyValuePair<int, int>(key == 3 ? 0 : key + 1, enrage ? 5 : 8);
}
player.wingFrame = profanedCrystalWingCounter.Key;
profanedCrystalWingCounter = new KeyValuePair<int, int>(profanedCrystalWingCounter.Key, profanedCrystalWingCounter.Value - 1);
player.armorEffectDrawOutlines = true;
if (player.Calamity().profanedCrystalBuffs)
{
player.armorEffectDrawShadow = true;
if (enrage)
{
player.armorEffectDrawOutlinesForbidden = true;
}
}
}
public KeyValuePair<int, int> profanedCrystalWingCounter = new KeyValuePair<int, int>(1, 10);
public KeyValuePair<int, int> profanedCrystalAnimCounter = new KeyValuePair<int, int>(0, 10);
private bool IsValidTransitionFrame(AnimationType currentAnim, AnimationType newAnim, int frame, int counter) //this exists so it doesn't loop through the entire walk/idle anim just to find one frame for switching.
{
bool result = newAnim != AnimationType.Jump && currentAnim != AnimationType.Jump;
if (currentAnim == AnimationType.Walk && newAnim == AnimationType.Idle)
{
result = counter <= 0 && (frame == 11 || frame == 15 || frame == 19);
}
else if (currentAnim == AnimationType.Idle && newAnim == AnimationType.Walk)
{
result = counter <= 0 && (frame == 2 || frame == 6);
}
return currentAnim != newAnim && result; //swapping to jumps should be instant, no need to check the counter here
}
private int HandlePSCAnimationFrames(Player player, AnimationType newType)
{
int key = profanedCrystalAnimCounter.Key; //0-based indexing
int value = profanedCrystalAnimCounter.Value - 1;
AnimationType currentType = key < 8 ? AnimationType.Idle : key == 8 ? AnimationType.Jump : AnimationType.Walk;
bool isInvalidTransFrame = !IsValidTransitionFrame(currentType, newType, key, value); //to make the transition between walk and idle frames less jarring and smoother
AnimationType type = isInvalidTransFrame ? newType : currentType;
int frameCount = type == AnimationType.Walk || (player.Calamity().profanedCrystal && player.statLife <= (int)(player.statLifeMax2 * 0.5)) ? 7 : 10;
int lowerRange = type == AnimationType.Idle ? 0 : type == AnimationType.Jump ? 8 : 9;
int upperRange = type == AnimationType.Idle ? 7 : type == AnimationType.Jump ? 8 : 22;
if (value <= 0 || !isInvalidTransFrame)
{
value = frameCount;
if (key >= lowerRange && key < upperRange)
key++;
else
key = lowerRange;
}
profanedCrystalAnimCounter = new KeyValuePair<int, int>(key, value);
return profanedCrystalAnimCounter.Key;
}
public override void TransformPostUpdate(Player player)
{
bool validEquipSlot = player.legs == EquipLoader.GetEquipSlot(Mod, "ProfanedSoulCrystal", EquipType.Legs) ||
player.legs == EquipLoader.GetEquipSlot(Mod, "PscNightLegs", EquipType.Legs);
if (player.Transformation().Type == ModContent.ItemType<ProfanedSoulCrystal>() && validEquipSlot)
{
bool usingCarpet = player.carpetTime > 0 && player.controlJump; //doesn't make sense for carpet to use jump frame since you have solid ground
AnimationType animType = AnimationType.Walk;
if ((player.sliding || player.velocity.Y != 0 || player.mount.Active || (player.grappling[0] != -1 || !player.CheckSolidGround()) || player.GoingDownWithGrapple) && !usingCarpet)
animType = AnimationType.Jump;
else if (player.velocity.X == 0 || usingCarpet)
animType = AnimationType.Idle;
int frame = HandlePSCAnimationFrames(player, animType);
player.legFrame.Y = player.legFrame.Height * frame;
}
}
public override void AddRecipes()
{
CreateRecipe().
File renamed without changes.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

File renamed without changes.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

File renamed without changes.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

File renamed without changes.

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 4.7 KiB

File renamed without changes.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

File renamed without changes.

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 4.0 KiB

File renamed without changes.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

@@ -1,4 +1,5 @@
using CalamityMod.CalPlayer;
using CalamityMod.Items.BaseItems;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Audio;
@@ -20,35 +21,19 @@ namespace CalamityMod.Items.Accessories.Vanity
[LegacyName("WulfrumHeadMelee")]
[LegacyName("WulfrumHood")]
[LegacyName("WulfrumHeadMagic")]
public class AbandonedWulfrumHelmet : ModItem, ILocalizedModType
public class AbandonedWulfrumHelmet : TransformationAccessory, ILocalizedModType
{
public new string LocalizationCategory => "Items.Accessories";
public override void Load()
{
if (!Main.dedServ)
{
EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/AbandonedWulfrumHelmet_HeadSet", EquipType.Head, name: "WulfrumOldSetHead");
EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/AbandonedWulfrumHelmet_Body", EquipType.Body, this);
EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/AbandonedWulfrumHelmet_Legs", EquipType.Legs, this);
}
}
public override (EquipType, string, string)[] EquipSlots =>
[
(EquipType.Head, "AbandonedWulfrumHelmet", "WulfrumOldSetHead"),
(EquipType.Body, "AbandonedWulfrumHelmet", null),
(EquipType.Legs, "AbandonedWulfrumHelmet", null),
(EquipType.Face, null, null), //results in setting this equip slot to -1
];
public override bool ShouldHideAccessories => true;
public override void SetStaticDefaults()
{
if (Main.dedServ)
return;
int equipSlotHead = EquipLoader.GetEquipSlot(Mod, "WulfrumOldSetHead", EquipType.Head);
ArmorIDs.Head.Sets.DrawHead[equipSlotHead] = false;
int equipSlotBody = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Body);
ArmorIDs.Body.Sets.HidesTopSkin[equipSlotBody] = true;
ArmorIDs.Body.Sets.HidesArms[equipSlotBody] = true;
int equipSlotLegs = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Legs);
ArmorIDs.Legs.Sets.HidesBottomSkin[equipSlotLegs] = true;
}
public override (SoundStyle sound, int delay)? HurtSound(Player p) => (SoundID.NPCHit4, 10);
public override void SetDefaults()
{
@@ -62,7 +47,6 @@ namespace CalamityMod.Items.Accessories.Vanity
public override void UpdateVanity(Player player)
{
player.GetModPlayer<WulfrumTransformationPlayer>().transformationActive = true;
player.GetModPlayer<WulfrumTransformationPlayer>().vanityEquipped = true;
}
@@ -70,7 +54,6 @@ namespace CalamityMod.Items.Accessories.Vanity
{
if (!hideVisual)
{
player.GetModPlayer<WulfrumTransformationPlayer>().transformationActive = true;
player.GetModPlayer<WulfrumTransformationPlayer>().vanityEquipped = true;
}
}
@@ -79,53 +62,10 @@ namespace CalamityMod.Items.Accessories.Vanity
public class WulfrumTransformationPlayer : ModPlayer
{
public bool vanityEquipped = false;
public bool transformationActive = false;
public bool forceHelmetOn = false;
public override void ResetEffects()
{
vanityEquipped = false;
transformationActive = false;
forceHelmetOn = false;
}
public override void FrameEffects()
{
if (forceHelmetOn || transformationActive)
{
Player.head = EquipLoader.GetEquipSlot(Mod, "WulfrumOldSetHead", EquipType.Head);
Player.face = -1;
}
if (transformationActive)
{
Player.legs = EquipLoader.GetEquipSlot(Mod, "AbandonedWulfrumHelmet", EquipType.Legs);
Player.body = EquipLoader.GetEquipSlot(Mod, "AbandonedWulfrumHelmet", EquipType.Body);
Player.HideAccessories();
}
}
public override void ModifyDrawInfo(ref PlayerDrawSet drawInfo)
{
if (forceHelmetOn || transformationActive)
{
drawInfo.drawPlayer.head = EquipLoader.GetEquipSlot(Mod, "WulfrumOldSetHead", EquipType.Head);
drawInfo.headGlowMask = -1;
drawInfo.helmetOffset = Vector2.Zero;
drawInfo.drawPlayer.face = -1;
}
if (transformationActive)
{
drawInfo.drawPlayer.legs = EquipLoader.GetEquipSlot(Mod, "AbandonedWulfrumHelmet", EquipType.Legs);
drawInfo.legsGlowMask = -1;
drawInfo.legsOffset = Vector2.Zero;
drawInfo.drawPlayer.body = EquipLoader.GetEquipSlot(Mod, "AbandonedWulfrumHelmet", EquipType.Body);
drawInfo.bodyGlowMask = -1;
drawInfo.drawPlayer.HideAccessories();
}
}
}
}
+9 -40
View File
@@ -1,38 +1,20 @@
using Terraria;
using CalamityMod.Items.BaseItems;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Accessories.Vanity
{
[LegacyName("RedBow")]
public class GhostBracelet : ModItem, ILocalizedModType
public class GhostBracelet : TransformationAccessory, ILocalizedModType
{
public new string LocalizationCategory => "Items.Accessories";
public override void Load()
{
if (!Main.dedServ)
{
EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Dandy_Head", EquipType.Head, this);
EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Dandy_Body", EquipType.Body, this);
EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Dandy_Legs", EquipType.Legs, this);
}
}
public override void SetStaticDefaults()
{
if (Main.dedServ)
return;
int equipSlotHead = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Head);
ArmorIDs.Head.Sets.DrawHead[equipSlotHead] = false;
int equipSlotBody = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Body);
ArmorIDs.Body.Sets.HidesTopSkin[equipSlotBody] = true;
ArmorIDs.Body.Sets.HidesArms[equipSlotBody] = true;
int equipSlotLegs = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Legs);
ArmorIDs.Legs.Sets.HidesBottomSkin[equipSlotLegs] = true;
}
public override (EquipType, string, string)[] EquipSlots =>
[
(EquipType.Head, "Dandy", null),
(EquipType.Body, "Dandy", null),
(EquipType.Legs, "Dandy", null),
];
public override void SetDefaults()
{
@@ -45,19 +27,6 @@ namespace CalamityMod.Items.Accessories.Vanity
Item.Calamity().devItem = true;
}
public override void UpdateVanity(Player player)
{
player.Calamity().ghostBracelet = true;
}
public override void UpdateAccessory(Player player, bool hideVisual)
{
if (!hideVisual)
{
player.Calamity().ghostBracelet = true;
}
}
public override void AddRecipes()
{
CreateRecipe().
+8 -76
View File
@@ -1,39 +1,19 @@
using Microsoft.Xna.Framework;
using CalamityMod.Items.BaseItems;
using Terraria;
using Terraria.DataStructures;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Accessories.Vanity
{
public class GoldenBomb : ModItem, ILocalizedModType
public class GoldenBomb : TransformationAccessory, ILocalizedModType
{
public new string LocalizationCategory => "Items.Accessories";
public override void Load()
{
if (!Main.dedServ)
{
EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Mihaii_Head", EquipType.Head, this);
EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Mihaii_Body", EquipType.Body, this);
EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Mihaii_Legs", EquipType.Legs, this);
}
}
public override void SetStaticDefaults()
{
if (Main.dedServ)
return;
int equipSlotHead = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Head);
ArmorIDs.Head.Sets.DrawHead[equipSlotHead] = false;
int equipSlotBody = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Body);
ArmorIDs.Body.Sets.HidesTopSkin[equipSlotBody] = true;
ArmorIDs.Body.Sets.HidesArms[equipSlotBody] = true;
int equipSlotLegs = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Legs);
ArmorIDs.Legs.Sets.HidesBottomSkin[equipSlotLegs] = true;
}
public override (EquipType, string, string)[] EquipSlots =>
[
(EquipType.Head, "Mihaii", null),
(EquipType.Body, "Mihaii", null),
(EquipType.Legs, "Mihaii", null),
];
public override void SetDefaults()
{
@@ -45,53 +25,5 @@ namespace CalamityMod.Items.Accessories.Vanity
Item.vanity = true;
Item.Calamity().devItem = true;
}
public override void UpdateVanity(Player player)
{
player.GetModPlayer<GoldenBombPlayer>().vanityEquipped = true;
}
public override void UpdateAccessory(Player player, bool hideVisual)
{
if (!hideVisual)
{
player.GetModPlayer<GoldenBombPlayer>().vanityEquipped = true;
}
}
}
public class GoldenBombPlayer : ModPlayer
{
public bool vanityEquipped = false;
public override void ResetEffects()
{
vanityEquipped = false;
}
public override void FrameEffects()
{
if (vanityEquipped)
{
Player.legs = EquipLoader.GetEquipSlot(Mod, "GoldenBomb", EquipType.Legs);
Player.body = EquipLoader.GetEquipSlot(Mod, "GoldenBomb", EquipType.Body);
Player.head = EquipLoader.GetEquipSlot(Mod, "GoldenBomb", EquipType.Head);
}
}
public override void ModifyDrawInfo(ref PlayerDrawSet drawInfo)
{
if (vanityEquipped)
{
drawInfo.drawPlayer.legs = EquipLoader.GetEquipSlot(Mod, "GoldenBomb", EquipType.Legs);
drawInfo.legsGlowMask = -1;
drawInfo.legsOffset = Vector2.Zero;
drawInfo.drawPlayer.body = EquipLoader.GetEquipSlot(Mod, "GoldenBomb", EquipType.Body);
drawInfo.bodyGlowMask = -1;
drawInfo.drawPlayer.head = EquipLoader.GetEquipSlot(Mod, "GoldenBomb", EquipType.Head);
drawInfo.headGlowMask = -1;
drawInfo.helmetOffset = Vector2.Zero;
}
}
}
}
+9 -83
View File
@@ -1,43 +1,20 @@
using CalamityMod.CalPlayer;
using Microsoft.Xna.Framework;
using CalamityMod.Items.BaseItems;
using Terraria;
using Terraria.Audio;
using Terraria.DataStructures;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Accessories.Vanity
{
public class HapuFruit : ModItem, ILocalizedModType
public class HapuFruit : TransformationAccessory, ILocalizedModType
{
public new string LocalizationCategory => "Items.Accessories";
public override void Load()
{
if (!Main.dedServ)
{
EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Heart_Head", EquipType.Head, this);
EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Heart_Body", EquipType.Body, this);
EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Heart_Legs", EquipType.Legs, this);
EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Heart_Back", EquipType.Back, this);
}
}
public override void SetStaticDefaults()
{
if (Main.dedServ)
return;
int equipSlotHead = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Head);
ArmorIDs.Head.Sets.DrawHead[equipSlotHead] = false;
int equipSlotBody = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Body);
ArmorIDs.Body.Sets.HidesTopSkin[equipSlotBody] = true;
ArmorIDs.Body.Sets.HidesArms[equipSlotBody] = true;
int equipSlotLegs = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Legs);
ArmorIDs.Legs.Sets.HidesBottomSkin[equipSlotLegs] = true;
}
public override (EquipType, string, string)[] EquipSlots =>
[
(EquipType.Head, "Heart", null),
(EquipType.Body, "Heart", null),
(EquipType.Legs, "Heart", null),
(EquipType.Back, "Heart", null)
];
public override void SetDefaults()
{
@@ -49,56 +26,5 @@ namespace CalamityMod.Items.Accessories.Vanity
Item.vanity = true;
Item.Calamity().devItem = true;
}
public override void UpdateVanity(Player player)
{
player.GetModPlayer<HapuFruitPlayer>().vanityEquipped = true;
}
public override void UpdateAccessory(Player player, bool hideVisual)
{
if (!hideVisual)
{
player.GetModPlayer<HapuFruitPlayer>().vanityEquipped = true;
}
}
}
public class HapuFruitPlayer : ModPlayer
{
public bool vanityEquipped = false;
public override void ResetEffects()
{
vanityEquipped = false;
}
public override void FrameEffects()
{
if (vanityEquipped)
{
Player.back = EquipLoader.GetEquipSlot(Mod, "HapuFruit", EquipType.Back);
Player.legs = EquipLoader.GetEquipSlot(Mod, "HapuFruit", EquipType.Legs);
Player.body = EquipLoader.GetEquipSlot(Mod, "HapuFruit", EquipType.Body);
Player.head = EquipLoader.GetEquipSlot(Mod, "HapuFruit", EquipType.Head);
//Player.HideAccessories();
}
}
public override void ModifyDrawInfo(ref PlayerDrawSet drawInfo)
{
if (vanityEquipped)
{
drawInfo.drawPlayer.back = EquipLoader.GetEquipSlot(Mod, "HapuFruit", EquipType.Back);
drawInfo.drawPlayer.legs = EquipLoader.GetEquipSlot(Mod, "HapuFruit", EquipType.Legs);
drawInfo.legsGlowMask = -1;
drawInfo.legsOffset = Vector2.Zero;
drawInfo.drawPlayer.body = EquipLoader.GetEquipSlot(Mod, "HapuFruit", EquipType.Body);
drawInfo.drawPlayer.head = EquipLoader.GetEquipSlot(Mod, "HapuFruit", EquipType.Head);
drawInfo.headGlowMask = -1;
drawInfo.helmetOffset = Vector2.Zero;
}
}
}
}
+7 -11
View File
@@ -1,22 +1,18 @@
using Terraria;
using CalamityMod.Items.BaseItems;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Accessories.Vanity
{
[AutoloadEquip(EquipType.Face)]
public class LucisSight : ModItem, ILocalizedModType
public class LucisSight : TransformationAccessory, ILocalizedModType
{
public new string LocalizationCategory => "Items.Accessories";
public override void SetStaticDefaults()
{
if (!Main.dedServ)
{
int equipSlot = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Face);
ArmorIDs.Face.Sets.DrawInFaceUnderHairLayer[equipSlot] = true;
}
}
public override (EquipType, string, string)[] EquipSlots =>
[
(EquipType.Face, "LucisSight", null),
];
public override void SetDefaults()
{
+10 -81
View File
@@ -1,4 +1,5 @@
using Microsoft.Xna.Framework;
using CalamityMod.Items.BaseItems;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.DataStructures;
using Terraria.ID;
@@ -6,36 +7,16 @@ using Terraria.ModLoader;
namespace CalamityMod.Items.Accessories.Vanity
{
public class OracleHeadphones : ModItem, ILocalizedModType
public class OracleHeadphones : TransformationAccessory, ILocalizedModType
{
public new string LocalizationCategory => "Items.Accessories";
public override void Load()
{
if (!Main.dedServ)
{
EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Mishiro_Head", EquipType.Head, this);
EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Mishiro_Body", EquipType.Body, this);
EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Mishiro_Legs", EquipType.Legs, this);
EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Mishiro_Back", EquipType.Back, this);
}
}
public override void SetStaticDefaults()
{
if (Main.dedServ)
return;
int equipSlotHead = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Head);
ArmorIDs.Head.Sets.DrawHead[equipSlotHead] = false;
int equipSlotBody = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Body);
ArmorIDs.Body.Sets.HidesTopSkin[equipSlotBody] = true;
ArmorIDs.Body.Sets.HidesArms[equipSlotBody] = true;
int equipSlotLegs = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Legs);
ArmorIDs.Legs.Sets.HidesBottomSkin[equipSlotLegs] = true;
}
public override (EquipType, string, string)[] EquipSlots =>
[
(EquipType.Head, "Mishiro", null),
(EquipType.Body, "Mishiro", null),
(EquipType.Legs, "Mishiro", null),
(EquipType.Back, "Mishiro", null)
];
public override void SetDefaults()
{
@@ -47,57 +28,5 @@ namespace CalamityMod.Items.Accessories.Vanity
Item.vanity = true;
Item.Calamity().devItem = true;
}
public override void UpdateVanity(Player player)
{
player.GetModPlayer<OracleHeadphonesPlayer>().vanityEquipped = true;
}
public override void UpdateAccessory(Player player, bool hideVisual)
{
if (!hideVisual)
{
player.GetModPlayer<OracleHeadphonesPlayer>().vanityEquipped = true;
}
}
}
public class OracleHeadphonesPlayer : ModPlayer
{
public bool vanityEquipped = false;
public override void ResetEffects()
{
vanityEquipped = false;
}
public override void FrameEffects()
{
if (vanityEquipped)
{
Player.back = EquipLoader.GetEquipSlot(Mod, "OracleHeadphones", EquipType.Back);
Player.legs = EquipLoader.GetEquipSlot(Mod, "OracleHeadphones", EquipType.Legs);
Player.body = EquipLoader.GetEquipSlot(Mod, "OracleHeadphones", EquipType.Body);
Player.head = EquipLoader.GetEquipSlot(Mod, "OracleHeadphones", EquipType.Head);
//Player.HideAccessories();
}
}
public override void ModifyDrawInfo(ref PlayerDrawSet drawInfo)
{
if (vanityEquipped)
{
drawInfo.drawPlayer.back = EquipLoader.GetEquipSlot(Mod, "OracleHeadphones", EquipType.Back);
drawInfo.drawPlayer.legs = EquipLoader.GetEquipSlot(Mod, "OracleHeadphones", EquipType.Legs);
drawInfo.legsGlowMask = -1;
drawInfo.legsOffset = Vector2.Zero;
drawInfo.drawPlayer.body = EquipLoader.GetEquipSlot(Mod, "OracleHeadphones", EquipType.Body);
drawInfo.bodyGlowMask = -1;
drawInfo.drawPlayer.head = EquipLoader.GetEquipSlot(Mod, "OracleHeadphones", EquipType.Head);
drawInfo.headGlowMask = -1;
drawInfo.helmetOffset = Vector2.Zero;
}
}
}
}
+18 -36
View File
@@ -1,36 +1,22 @@
using CalamityMod.CalPlayer;
using CalamityMod.Items.BaseItems;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Accessories.Vanity
{
public class Popo : ModItem, ILocalizedModType
public class Popo : TransformationAccessory, ILocalizedModType
{
public new string LocalizationCategory => "Items.Accessories";
public override void Load()
{
if (!Main.dedServ)
{
EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Popo_Head", EquipType.Head, this);
EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/PopoNoseless_Head", EquipType.Head, name: "PopoNoseless");
EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Popo_Body", EquipType.Body, this);
EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Popo_Legs", EquipType.Legs, this);
}
}
public override void SetStaticDefaults()
{
if (Main.dedServ)
return;
int equipSlotBody = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Body);
ArmorIDs.Body.Sets.HidesTopSkin[equipSlotBody] = true;
ArmorIDs.Body.Sets.HidesArms[equipSlotBody] = true;
int equipSlotLegs = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Legs);
ArmorIDs.Legs.Sets.HidesBottomSkin[equipSlotLegs] = true;
}
public override (EquipType, string, string)[] EquipSlots =>
[
(EquipType.Head, "Popo", null),
(EquipType.Head, "PopoNoseless", "PopoNoseless"),
(EquipType.Body, "Popo", null),
(EquipType.Legs, "Popo", null),
(EquipType.Face, null, null), //results in setting this equip slot to -1
];
public override void SetDefaults()
{
@@ -42,20 +28,16 @@ namespace CalamityMod.Items.Accessories.Vanity
Item.Calamity().devItem = true;
}
public override void UpdateVanity(Player player)
public override bool CustomSetEquipType(Player player, EquipType type, Mod mod, string name)
{
player.Calamity().snowmanHide = false;
player.Calamity().snowmanForce = true;
if (type == EquipType.Head)
{
player.head = EquipLoader.GetEquipSlot(Mod, player.Calamity().snowmanNoseless ? "PopoNoseless" : "Popo", EquipType.Head);
return true;
}
return false;
}
public override void UpdateAccessory(Player player, bool hideVisual)
{
CalamityPlayer modPlayer = player.Calamity();
modPlayer.snowman = true;
if (hideVisual)
{
modPlayer.snowmanHide = true;
}
}
public override void UpdateAccessory(Player player, bool hideVisual) => player.Calamity().snowman = true;
}
}
+9 -40
View File
@@ -1,38 +1,20 @@
using CalamityMod.UI;
using CalamityMod.Items.BaseItems;
using CalamityMod.UI;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Accessories.Vanity
{
public class PunchCard : ModItem, ILocalizedModType
public class PunchCard : TransformationAccessory, ILocalizedModType
{
public new string LocalizationCategory => "Items.Accessories";
public override void Load()
{
if (!Main.dedServ)
{
EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Shayy_Head", EquipType.Head, this);
EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Shayy_Body", EquipType.Body, this);
EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Shayy_Legs", EquipType.Legs, this);
}
}
public override void SetStaticDefaults()
{
if (Main.dedServ)
return;
int equipSlotHead = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Head);
ArmorIDs.Head.Sets.DrawHead[equipSlotHead] = false;
int equipSlotBody = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Body);
ArmorIDs.Body.Sets.HidesTopSkin[equipSlotBody] = true;
ArmorIDs.Body.Sets.HidesArms[equipSlotBody] = true;
int equipSlotLegs = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Legs);
ArmorIDs.Legs.Sets.HidesBottomSkin[equipSlotLegs] = true;
}
public override (EquipType, string, string)[] EquipSlots =>
[
(EquipType.Head, "Shayy", null),
(EquipType.Body, "Shayy", null),
(EquipType.Legs, "Shayy", null),
];
public override void SetDefaults()
{
@@ -53,18 +35,5 @@ namespace CalamityMod.Items.Accessories.Vanity
PopupGUIManager.FlipActivityOfGUIWithType(typeof(PunchCardGUI));
return true;
}
public override void UpdateVanity(Player player)
{
player.Calamity().punchCard = true;
}
public override void UpdateAccessory(Player player, bool hideVisual)
{
if (!hideVisual)
{
player.Calamity().punchCard = true;
}
}
}
}
+8 -78
View File
@@ -1,42 +1,20 @@
using Microsoft.Xna.Framework;
using System;
using CalamityMod.Items.BaseItems;
using Terraria;
using Terraria.DataStructures;
using Terraria.Graphics.Renderers;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Accessories.Vanity
{
public class SharkyPlush : ModItem, ILocalizedModType
public class SharkyPlush : TransformationAccessory, ILocalizedModType
{
public new string LocalizationCategory => "Items.Accessories";
public override void Load()
{
if (!Main.dedServ)
{
EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Shark_Head", EquipType.Head, this);
EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Shark_Body", EquipType.Body, this);
EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Shark_Legs", EquipType.Legs, this);
}
}
public override void SetStaticDefaults()
{
if (Main.dedServ)
return;
int equipSlotHead = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Head);
ArmorIDs.Head.Sets.DrawHead[equipSlotHead] = false;
int equipSlotBody = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Body);
ArmorIDs.Body.Sets.HidesTopSkin[equipSlotBody] = true;
ArmorIDs.Body.Sets.HidesArms[equipSlotBody] = true;
int equipSlotLegs = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Legs);
ArmorIDs.Legs.Sets.HidesBottomSkin[equipSlotLegs] = true;
}
public override (EquipType, string, string)[] EquipSlots =>
[
(EquipType.Head, "Shark", null),
(EquipType.Body, "Shark", null),
(EquipType.Legs, "Shark", null),
];
public override void SetDefaults()
{
@@ -48,53 +26,5 @@ namespace CalamityMod.Items.Accessories.Vanity
Item.value = CalamityGlobalItem.RarityBlueBuyPrice;
Item.Calamity().devItem = true;
}
public override void UpdateVanity(Player player)
{
player.GetModPlayer<SharkyPlushPlayer>().vanityEquipped = true;
}
public override void UpdateAccessory(Player player, bool hideVisual)
{
if (!hideVisual)
{
player.GetModPlayer<SharkyPlushPlayer>().vanityEquipped = true;
}
}
}
public class SharkyPlushPlayer : ModPlayer
{
public bool vanityEquipped = false;
public override void ResetEffects()
{
vanityEquipped = false;
}
public override void FrameEffects()
{
if (vanityEquipped)
{
Player.legs = EquipLoader.GetEquipSlot(Mod, "SharkyPlush", EquipType.Legs);
Player.body = EquipLoader.GetEquipSlot(Mod, "SharkyPlush", EquipType.Body);
Player.head = EquipLoader.GetEquipSlot(Mod, "SharkyPlush", EquipType.Head);
}
}
public override void ModifyDrawInfo(ref PlayerDrawSet drawInfo)
{
if (vanityEquipped)
{
drawInfo.drawPlayer.legs = EquipLoader.GetEquipSlot(Mod, "SharkyPlush", EquipType.Legs);
drawInfo.legsGlowMask = -1;
drawInfo.legsOffset = Vector2.Zero;
drawInfo.drawPlayer.body = EquipLoader.GetEquipSlot(Mod, "SharkyPlush", EquipType.Body);
drawInfo.bodyGlowMask = -1;
drawInfo.drawPlayer.head = EquipLoader.GetEquipSlot(Mod, "SharkyPlush", EquipType.Head);
drawInfo.headGlowMask = -1;
drawInfo.helmetOffset = Vector2.Zero;
}
}
}
}
+9 -64
View File
@@ -1,4 +1,5 @@
using CalamityMod.CalPlayer;
using CalamityMod.Items.BaseItems;
using CalamityMod.Rarities;
using Microsoft.Xna.Framework;
using Terraria;
@@ -8,35 +9,17 @@ using Terraria.ModLoader;
namespace CalamityMod.Items.Accessories.Vanity
{
public class XyksBlessingBlue : ModItem, ILocalizedModType
public class XyksBlessingBlue : TransformationAccessory, ILocalizedModType
{
public new string LocalizationCategory => "Items.Accessories";
public override void Load()
{
if (!Main.dedServ)
{
EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Xyk_Head", EquipType.Head, this);
EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Xyk_Body", EquipType.Body, this);
EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Xyk_Legs", EquipType.Legs, this);
EquipLoader.AddEquipTexture(Mod, "CalamityMod/Projectiles/InvisibleProj", EquipType.Wings, this);
}
}
public override void SetStaticDefaults()
{
if (Main.dedServ)
return;
int equipSlotHead = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Head);
ArmorIDs.Head.Sets.DrawHead[equipSlotHead] = false;
int equipSlotBody = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Body);
ArmorIDs.Body.Sets.HidesTopSkin[equipSlotBody] = false;
ArmorIDs.Body.Sets.HidesArms[equipSlotBody] = true;
int equipSlotLegs = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Legs);
ArmorIDs.Legs.Sets.HidesBottomSkin[equipSlotLegs] = true;
}
public override (EquipType, string, string)[] EquipSlots =>
[
(EquipType.Head, "Xyk", null),
(EquipType.Body, "Xyk", null),
(EquipType.Legs, "Xyk", null),
(EquipType.Wings, null, null), //results in setting this equip slot to -1
];
public override void SetDefaults()
{
@@ -55,7 +38,6 @@ namespace CalamityMod.Items.Accessories.Vanity
}
public override void UpdateVanity(Player player)
{
player.GetModPlayer<XyksBlessingBluePlayer>().vanityEquipped = true;
CalamityPlayer modPlayer = player.Calamity();
modPlayer.XykVisualsBlue = true;
}
@@ -64,46 +46,9 @@ namespace CalamityMod.Items.Accessories.Vanity
{
if (!hideVisual)
{
player.GetModPlayer<XyksBlessingBluePlayer>().vanityEquipped = true;
CalamityPlayer modPlayer = player.Calamity();
modPlayer.XykVisualsBlue = true;
}
}
}
public class XyksBlessingBluePlayer : ModPlayer
{
public bool vanityEquipped = false;
public override void ResetEffects()
{
vanityEquipped = false;
}
public override void FrameEffects()
{
if (vanityEquipped)
{
Player.legs = EquipLoader.GetEquipSlot(Mod, "XyksBlessingBlue", EquipType.Legs);
Player.body = EquipLoader.GetEquipSlot(Mod, "XyksBlessingBlue", EquipType.Body);
Player.head = EquipLoader.GetEquipSlot(Mod, "XyksBlessingBlue", EquipType.Head);
Player.wings = EquipLoader.GetEquipSlot(Mod, "XyksBlessingOrange", EquipType.Wings);
}
}
public override void ModifyDrawInfo(ref PlayerDrawSet drawInfo)
{
if (vanityEquipped)
{
drawInfo.drawPlayer.legs = EquipLoader.GetEquipSlot(Mod, "XyksBlessingBlue", EquipType.Legs);
drawInfo.legsGlowMask = -1;
drawInfo.legsOffset = Vector2.Zero;
drawInfo.drawPlayer.body = EquipLoader.GetEquipSlot(Mod, "XyksBlessingBlue", EquipType.Body);
drawInfo.bodyGlowMask = -1;
drawInfo.drawPlayer.head = EquipLoader.GetEquipSlot(Mod, "XyksBlessingBlue", EquipType.Head);
drawInfo.headGlowMask = -1;
drawInfo.helmetOffset = Vector2.Zero;
}
}
}
}
+9 -66
View File
@@ -1,43 +1,24 @@
using CalamityMod.CalPlayer;
using CalamityMod.Items.BaseItems;
using CalamityMod.Rarities;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.DataStructures;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Accessories.Vanity
{
public class XyksBlessingOrange : ModItem, ILocalizedModType
public class XyksBlessingOrange : TransformationAccessory, ILocalizedModType
{
public new string LocalizationCategory => "Items.Accessories";
public override void Load()
{
if (!Main.dedServ)
{
EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Xyk_Head2", EquipType.Head, this);
EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Xyk_Body2", EquipType.Body, this);
EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Xyk_Legs2", EquipType.Legs, this);
EquipLoader.AddEquipTexture(Mod, "CalamityMod/Projectiles/InvisibleProj", EquipType.Wings, this);
}
}
public override void SetStaticDefaults()
{
if (Main.dedServ)
return;
int equipSlotHead = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Head);
ArmorIDs.Head.Sets.DrawHead[equipSlotHead] = true;
int equipSlotBody = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Body);
ArmorIDs.Body.Sets.HidesTopSkin[equipSlotBody] = false;
ArmorIDs.Body.Sets.HidesArms[equipSlotBody] = true;
int equipSlotLegs = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Legs);
ArmorIDs.Legs.Sets.HidesBottomSkin[equipSlotLegs] = true;
}
public override (EquipType, string, string)[] EquipSlots =>
[
(EquipType.Head, "Xyk", null),
(EquipType.Body, "Xyk", null),
(EquipType.Legs, "Xyk", null),
(EquipType.Wings, null, null), //results in setting this equip slot to -1
];
public override void SetDefaults()
{
@@ -56,7 +37,6 @@ namespace CalamityMod.Items.Accessories.Vanity
}
public override void UpdateVanity(Player player)
{
player.GetModPlayer<XyksBlessingOrangePlayer>().vanityEquipped = true;
CalamityPlayer modPlayer = player.Calamity();
modPlayer.XykVisualsOrange = true;
}
@@ -65,46 +45,9 @@ namespace CalamityMod.Items.Accessories.Vanity
{
if (!hideVisual)
{
player.GetModPlayer<XyksBlessingOrangePlayer>().vanityEquipped = true;
CalamityPlayer modPlayer = player.Calamity();
modPlayer.XykVisualsOrange = true;
}
}
}
public class XyksBlessingOrangePlayer : ModPlayer
{
public bool vanityEquipped = false;
public override void ResetEffects()
{
vanityEquipped = false;
}
public override void FrameEffects()
{
if (vanityEquipped)
{
Player.legs = EquipLoader.GetEquipSlot(Mod, "XyksBlessingOrange", EquipType.Legs);
Player.body = EquipLoader.GetEquipSlot(Mod, "XyksBlessingOrange", EquipType.Body);
Player.head = EquipLoader.GetEquipSlot(Mod, "XyksBlessingOrange", EquipType.Head);
Player.wings = EquipLoader.GetEquipSlot(Mod, "XyksBlessingOrange", EquipType.Wings);
}
}
public override void ModifyDrawInfo(ref PlayerDrawSet drawInfo)
{
if (vanityEquipped)
{
drawInfo.drawPlayer.legs = EquipLoader.GetEquipSlot(Mod, "XyksBlessingOrange", EquipType.Legs);
drawInfo.legsGlowMask = -1;
drawInfo.legsOffset = Vector2.Zero;
drawInfo.drawPlayer.body = EquipLoader.GetEquipSlot(Mod, "XyksBlessingOrange", EquipType.Body);
drawInfo.bodyGlowMask = -1;
drawInfo.drawPlayer.head = EquipLoader.GetEquipSlot(Mod, "XyksBlessingOrange", EquipType.Head);
drawInfo.headGlowMask = -1;
drawInfo.helmetOffset = Vector2.Zero;
}
}
}
}
+8 -6
View File
@@ -146,8 +146,9 @@ namespace CalamityMod.Items.Armor.Wulfrum
player.endurance += 0.05f; //10% Dr in total with the chestplate
//Can't account for previous fullbody transformations but at this point, whatever.
bool transformed = player.Transformation().Type == ItemType<AbandonedWulfrumHelmet>();
Item headItem = player.armor[10].type != ItemID.None ? player.armor[10] : player.armor[0];
bool hatVisible = !transformationPlayer.transformationActive && headItem.type == ItemType<WulfrumHat>();
bool hatVisible = !transformed && headItem.type == ItemType<WulfrumHat>();
//Spawn the hat
if (cd.timeLeft == BastionCooldown + BastionTime - (int)(BastionBuildTime * 0.9f) && hatVisible)
@@ -158,9 +159,7 @@ namespace CalamityMod.Items.Armor.Wulfrum
//Visuals
if (cd.timeLeft < BastionCooldown + BastionTime - BastionBuildTime)
player.GetModPlayer<WulfrumTransformationPlayer>().transformationActive = true;
else if (cd.timeLeft <= BastionCooldown + BastionTime - (int)(BastionBuildTime * 0.9f))
player.GetModPlayer<WulfrumTransformationPlayer>().forceHelmetOn = true;
player.Transformation().Type = ItemType<AbandonedWulfrumHelmet>();
//Swapping the arm.
if (DummyCannon.IsAir)
@@ -187,6 +186,9 @@ namespace CalamityMod.Items.Armor.Wulfrum
Main.mouseItem = new Item();
DummyCannon.TurnToAir();
if (player.Transformation().Type == ItemType<AbandonedWulfrumHelmet>() && player.Transformation().currentTransformation.IsForced)
player.Transformation().currentTransformation.IsForced = false;
}
}
@@ -195,7 +197,7 @@ namespace CalamityMod.Items.Armor.Wulfrum
SoundEngine.PlaySound(SetActivationSound);
//Do'nt do the effect ifthe player is already using the wulfrum vanity lol.
bool transformedAlready = player.GetModPlayer<WulfrumTransformationPlayer>().transformationActive;
bool transformedAlready = player.Transformation().Type == ItemType<AbandonedWulfrumHelmet>(); ;
if (!transformedAlready)
{
@@ -364,7 +366,7 @@ namespace CalamityMod.Items.Armor.Wulfrum
{
SetBonusEndEffect(true);
if (!Player.GetModPlayer<WulfrumTransformationPlayer>().vanityEquipped)
Player.GetModPlayer<WulfrumTransformationPlayer>().transformationActive = false;
Player.Transformation().currentTransformation = null;
}
}
+271
View File
@@ -0,0 +1,271 @@
using Terraria.DataStructures;
using Terraria;
using Terraria.ModLoader;
using Terraria.ID;
using System.Linq;
using System;
using Microsoft.Xna.Framework;
using Terraria.Audio;
namespace CalamityMod.Items.BaseItems
{
public abstract class TransformationAccessory : ModItem
{
public bool IsForced = false;
public virtual string AssetPath => "CalamityMod/Items/Accessories/Vanity/";
public virtual (EquipType Type, string AssetName, string EquipName)[] EquipSlots => [];
public virtual float Priority => 1;
public virtual Func<Player, bool> ShouldTransform => (player) => true;
public virtual bool ShouldHideAccessories => false;
public virtual (SoundStyle sound, int delay)? HurtSound(Player p) => null;
public virtual void ModifyDrawInfo(ref PlayerDrawSet drawInfo) { }
public virtual void ArmorIDSets()
{
if (EquipSlots.Any(s => s.Type == EquipType.Head))
{
string name = EquipSlots.First(s => s.Type == EquipType.Head).EquipName;
int equipSlotHead = EquipLoader.GetEquipSlot(Mod, name ?? Name, EquipType.Head);
ArmorIDs.Head.Sets.DrawHead[equipSlotHead] = false;
}
if (EquipSlots.Any(s => s.Type == EquipType.Body))
{
string name = EquipSlots.First(s => s.Type == EquipType.Body).EquipName;
int equipSlotBody = EquipLoader.GetEquipSlot(Mod, name ?? Name, EquipType.Body);
ArmorIDs.Body.Sets.HidesTopSkin[equipSlotBody] = true;
ArmorIDs.Body.Sets.HidesArms[equipSlotBody] = true;
}
if (EquipSlots.Any(s => s.Type == EquipType.Legs))
{
string name = EquipSlots.First(s => s.Type == EquipType.Legs).EquipName;
int equipSlotLegs = EquipLoader.GetEquipSlot(Mod, name ?? Name, EquipType.Legs);
ArmorIDs.Legs.Sets.HidesBottomSkin[equipSlotLegs] = true;
}
}
public virtual bool CustomSetEquipType(Player player, EquipType type, Mod mod, string name) => false;
public virtual void TransformFrameEffects(Player player) { }
public virtual void TransformPostUpdate(Player player) { }
public override void Load()
{
if (Main.netMode != NetmodeID.Server)
{
foreach (var v in EquipSlots)
{
if (v.AssetName == null)
continue;
EquipLoader.AddEquipTexture(Mod, AssetPath + v.AssetName + "_" + v.Type.ToString(), v.Type, this, v.EquipName);
}
}
}
public override void SetStaticDefaults()
{
if (Main.netMode == NetmodeID.Server)
return;
ArmorIDSets();
}
}
public class TransformationPlayer : ModPlayer
{
public override void Load()
{
On_Player.UpdateVisibleAccessory += SetTransformationItem;
}
internal TransformationAccessory currentTransformation = null;
int prevSlot = -1;
public int Type
{
get => currentTransformation == null ? -1 : currentTransformation.Type;
set
{
ModItem item = ModContent.GetModItem(value);
if (item != null && item is TransformationAccessory trans)
{
currentTransformation = trans;
currentTransformation.IsForced = true;
}
else
currentTransformation = null;
}
}
private void SetTransformationItem(On_Player.orig_UpdateVisibleAccessory orig, Player self, int itemSlot, Item item, bool modded)
{
orig(self, itemSlot, item, modded);
if (self.Transformation().currentTransformation == null || !self.Transformation().currentTransformation.IsForced)
{
if (self.Transformation().prevSlot > itemSlot) //determines if we're on the first visible slot (as this isnt called on non-visible slots)
self.Transformation().currentTransformation = null;
if (item.ModItem is TransformationAccessory transformation && transformation.ShouldTransform.Invoke(self) && (currentTransformation == null || transformation.Priority >= currentTransformation.Priority))
self.Transformation().currentTransformation = transformation;
}
if (self.Transformation().currentTransformation != null && itemSlot == 19) // last item slot, can set equip slots to our transformation if one is equipped
{
TransformationAccessory trans = self.Transformation().currentTransformation;
bool[] list = new bool[15];
foreach (var (Type, AssetName, EquipName) in trans.EquipSlots)
{
string name = AssetName == null ? null : EquipName ?? trans.Name;
if (!trans.CustomSetEquipType(self, Type, Mod, name) && !list[(int)Type])
{
SetEquipSlot(self, Type, Mod, name);
list[(int)Type] = true;
}
}
if(trans.ShouldHideAccessories)
self.HideAccessories();
}
self.Transformation().prevSlot = itemSlot;
}
public override void UpdateAutopause()
{
if (currentTransformation != null)
{
if (!currentTransformation.CustomSetEquipType(Player, EquipType.Head, Mod, currentTransformation.Name))
{
var (Type, AssetName, EquipName) = currentTransformation.EquipSlots.First(v => v.Type == EquipType.Head);
string name = (EquipName == null && AssetName == null) ? null : EquipName ?? currentTransformation.Name;
SetEquipSlot(Player, EquipType.Head, Mod, name);
}
}
}
public override void ModifyDrawInfo(ref PlayerDrawSet drawInfo)
{
if (currentTransformation != null)
{
currentTransformation.ModifyDrawInfo(ref drawInfo);
if (currentTransformation.EquipSlots.Any(s => s.Type == EquipType.Head))
{
drawInfo.headGlowMask = -1;
drawInfo.helmetOffset = Vector2.Zero;
}
if (currentTransformation.EquipSlots.Any(s => s.Type == EquipType.Body))
{
drawInfo.bodyGlowMask = -1;
}
if (currentTransformation.EquipSlots.Any(s => s.Type == EquipType.Legs))
{
drawInfo.legsGlowMask = -1;
drawInfo.legsOffset = Vector2.Zero;
}
}
}
public override void FrameEffects()
{
if (currentTransformation != null)
{
currentTransformation.TransformFrameEffects(Player);
if (currentTransformation.ShouldHideAccessories)
Player.HideAccessories();
}
}
public override void PostUpdate()
{
currentTransformation?.TransformPostUpdate(Player);
}
public static void SetEquipSlot(Player player, EquipType type, Mod mod, string name)
{
switch (type)
{
case EquipType.Head:
player.head = name == null ? -1 : EquipLoader.GetEquipSlot(mod, name, type);
break;
case EquipType.Body:
player.body = name == null ? -1 : EquipLoader.GetEquipSlot(mod, name, type);
break;
case EquipType.Legs:
player.legs = name == null ? -1 : EquipLoader.GetEquipSlot(mod, name, type);
break;
case EquipType.HandsOn:
player.handon = name == null ? -1 : EquipLoader.GetEquipSlot(mod, name, type);
break;
case EquipType.HandsOff:
player.handoff = name == null ? -1 : EquipLoader.GetEquipSlot(mod, name, type);
break;
case EquipType.Back:
player.back = name == null ? -1 : EquipLoader.GetEquipSlot(mod, name, type);
break;
case EquipType.Front:
player.front = name == null ? -1 : EquipLoader.GetEquipSlot(mod, name, type);
break;
case EquipType.Shoes:
player.shoe = name == null ? -1 : EquipLoader.GetEquipSlot(mod, name, type);
break;
case EquipType.Waist:
player.waist = name == null ? -1 : EquipLoader.GetEquipSlot(mod, name, type);
break;
case EquipType.Wings:
player.wings = name == null ? -1 : EquipLoader.GetEquipSlot(mod, name, type);
break;
case EquipType.Shield:
player.shield = name == null ? -1 : EquipLoader.GetEquipSlot(mod, name, type);
break;
case EquipType.Neck:
player.neck = name == null ? -1 : EquipLoader.GetEquipSlot(mod, name, type);
break;
case EquipType.Face:
player.face = name == null ? -1 : EquipLoader.GetEquipSlot(mod, name, type);
break;
case EquipType.Balloon:
player.balloon = name == null ? -1 : EquipLoader.GetEquipSlot(mod, name, type);
break;
case EquipType.Beard:
player.beard = name == null ? -1 : EquipLoader.GetEquipSlot(mod, name, type);
break;
}
}
public static int GetEquipSlot(Player player, EquipType type) => type switch
{
EquipType.Head => player.head,
EquipType.Body => player.body,
EquipType.Legs => player.legs,
EquipType.HandsOn => player.handon,
EquipType.HandsOff => player.handoff,
EquipType.Back => player.back,
EquipType.Front => player.front,
EquipType.Shoes => player.shoe,
EquipType.Waist => player.waist,
EquipType.Wings => player.wings,
EquipType.Shield => player.shield,
EquipType.Neck => player.neck,
EquipType.Face => player.face,
EquipType.Balloon => player.balloon,
EquipType.Beard => player.beard,
_ => -1,
};
public static EquipTexture GetEquipTexture(Player p, EquipType type) => EquipLoader.GetEquipTexture(type, GetEquipSlot(p, type));
}
}
+2 -1
View File
@@ -6,6 +6,7 @@ using CalamityMod.Buffs.StatDebuffs;
using CalamityMod.Dusts;
using CalamityMod.Events;
using CalamityMod.Items.Accessories;
using CalamityMod.Items.Accessories.Vanity;
using CalamityMod.Items.Armor.Vanity;
using CalamityMod.Items.LoreItems;
using CalamityMod.Items.Materials;
@@ -2807,7 +2808,7 @@ namespace CalamityMod.NPCs.DevourerofGods
Rectangle location = new Rectangle((int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height);
// Speak in Wingdings if the Punch Card is equipped
if (target.Calamity().punchCard && DoGWingdings.Wingdings != null && System.Environment.OSVersion.Platform == PlatformID.Win32NT && !GameCulture.FromCultureName(GameCulture.CultureName.Chinese).IsActive && !GameCulture.FromCultureName(GameCulture.CultureName.Russian).IsActive)
if (target.Transformation().Type == ModContent.ItemType<PunchCard>() && DoGWingdings.Wingdings != null && System.Environment.OSVersion.Platform == PlatformID.Win32NT && !GameCulture.FromCultureName(GameCulture.CultureName.Chinese).IsActive && !GameCulture.FromCultureName(GameCulture.CultureName.Russian).IsActive)
{
Vector2 vector = DoGWingdings.Wingdings.MeasureString(Language.GetTextValue(text));
// This is how normal combat text spawn positioning is handled
+3
View File
@@ -1,5 +1,6 @@
using CalamityMod.CalPlayer;
using CalamityMod.Items;
using CalamityMod.Items.BaseItems;
using CalamityMod.NPCs;
using CalamityMod.Projectiles;
using Terraria;
@@ -15,5 +16,7 @@ namespace CalamityMod
public static CalamityGlobalItem Calamity(this Item item) => item.GetGlobalItem<CalamityGlobalItem>();
public static CalamityGlobalProjectile Calamity(this Projectile proj) => proj.GetGlobalProjectile<CalamityGlobalProjectile>();
public static Item ActiveItem(this Player player) => Main.mouseItem.IsAir ? player.HeldItem : Main.mouseItem;
public static TransformationPlayer Transformation(this Player player) => player.GetModPlayer<TransformationPlayer>();
}
}