crystal leaf

This commit is contained in:
Altixal committed 2025-08-22 10:58:03 +07:00
1 parent c28c63de14
commit 6be98366b5
9 files changed
-231

No files matched your search

-4
View File
@@ -200,10 +200,6 @@ namespace CalamityMod.Buffs
tip = tip.Replace("25", "15");
break;
case BuffID.LeafCrystal:
tip = CalamityUtils.GetTextValue("Vanilla.BuffDescription.LeafCrystal");
break;
case BuffID.MagicPower:
tip = tip.Replace("20", "10");
break;
@@ -1,30 +0,0 @@
using Terraria.ID;
namespace CalamityMod.Items.VanillaArmorChanges
{
public class ChlorophyteArmorSetChange : VanillaArmorChange
{
public override int? HeadPieceID => ItemID.ChlorophyteHeadgear;
public override int? BodyPieceID => ItemID.ChlorophytePlateMail;
public override int? LegPieceID => ItemID.ChlorophyteGreaves;
public override int[] AlternativeHeadPieceIDs => new int[] { ItemID.ChlorophyteMask, ItemID.ChlorophyteHelmet };
public override string ArmorSetName => "Chlorophyte";
public const int AmountToHealPerPulse = 5;
public const int PulseReleaseRate = 300;
public const int DelayBetweenHeals = 270;
public const int BaseDamageToEnemies = 220;
public override void UpdateSetBonusText(ref string setBonusText)
{
setBonusText = $"{CalamityUtils.GetText($"Vanilla.Armor.SetBonus.{ArmorSetName}").Format(PulseReleaseRate / 60f, BaseDamageToEnemies, AmountToHealPerPulse, DelayBetweenHeals / 60f)}";
}
}
}
@@ -31,7 +31,6 @@ BossRushEndEffectThing.DisplayName: Boss Rush End Effect Thing
BossRushFailureEffectThing.DisplayName: Boss Rush Failure Effect Thing
BossRushTierAnimation.DisplayName: Boss Rush Tier Animation
ChaoticGeyser.DisplayName: Chaotic Geyser
ChlorophyteLifePulse.DisplayName: Life Pulse
ChronoClock.DisplayName: Chrono Clock
ClaretCannonProj.DisplayName: Claret Round
CoralBubble.DisplayName: Bubble
@@ -10,15 +10,6 @@ SetBonus: {
Melee: 15% increased melee speed and 20% increased movement speed
}
Chlorophyte:
'''
Summons a powerful leaf crystal to shoot pulses of life every {0} seconds
The pulses do a base damage of {1} to enemies within its range
The pulses also provide a {2} health boost to you and all players on your team
Players healed by pulses cannot be healed by another pulse until {3} seconds have passed
Both the health boost and the damage scale based on your strongest class
'''
Cobalt: {
$parentVal:
'''
@@ -255,7 +255,6 @@ BuffDescription: {
Banner: You have increased damage and defense against the following:
BeetleMight: Melee damage and speed increase by {0}% and {1}% respectively
ChaosState: Rod of Discord teleports are disabled
LeafCrystal: Emits powerful life pulses at nearby enemies
Rabies: Decreased life regen, Causes status effects
WarmthExtra: Reduced durations of Chilled and Frozen
WeaponImbueConfetti: All attacks cause confetti to appear
-11
View File
@@ -431,10 +431,6 @@ namespace CalamityMod.Projectiles
projectile.Kill();
}
// Chlorophyte Crystal AI rework.
if (projectile.type == ProjectileID.CrystalLeaf)
return ChlorophyteCrystalAI.DoChlorophyteCrystalAI(projectile);
if (projectile.minion && ExplosiveEnchantCountdown > 0)
{
ExplosiveEnchantCountdown--;
@@ -4200,13 +4196,6 @@ namespace CalamityMod.Projectiles
shouldDrawBool = false;
}
// Chlorophyte Crystal AI rework.
if (projectile.type == ProjectileID.CrystalLeaf)
{
ChlorophyteCrystalAI.DoChlorophyteCrystalDrawing(projectile);
shouldDrawBool = false;
}
if (Main.LocalPlayer.Calamity().trippy)
OddMushroomProjectileDrawing(projectile);
@@ -1,90 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using CalamityMod.Items.VanillaArmorChanges;
using CalamityMod.Projectiles.VanillaProjectileOverrides;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Typeless
{
public class ChlorophyteLifePulse : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Typeless";
public const int Lifetime = 60;
public float LifetimeCompletion => 1f - Projectile.timeLeft / (float)Lifetime;
public override void SetDefaults()
{
Projectile.width = 96;
Projectile.height = 96;
Projectile.friendly = true;
Projectile.tileCollide = false;
Projectile.ignoreWater = true;
Projectile.penetrate = -1;
Projectile.usesIDStaticNPCImmunity = true;
Projectile.idStaticNPCHitCooldown = 30;
Projectile.timeLeft = Lifetime;
}
public override bool? CanHitNPC(NPC target) => !target.CountsAsACritter && !target.friendly && target.chaseable;
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => Projectile.damage = (int)(Projectile.damage * 0.8f);
public override void AI()
{
Projectile.Opacity = 1f - (float)Math.Pow(LifetimeCompletion, 1.56);
Projectile.scale = MathHelper.Lerp(0.5f, 6f, LifetimeCompletion);
// Heal all members of the same team.
if (Projectile.timeLeft == (int)(Lifetime * 0.925f))
{
Player owner = Main.player[Projectile.owner];
List<Player> membersOfSameTeam = new List<Player>()
{
owner
};
if (owner.team != 0)
membersOfSameTeam.AddRange(Main.player.Where(p => p.team == owner.team && p.active && !p.dead));
foreach (Player player in membersOfSameTeam)
{
if (player.Calamity().ChlorophyteHealDelay > 0)
continue;
int healQuantity = (int)owner.GetBestClassDamage().ApplyTo(ChlorophyteArmorSetChange.AmountToHealPerPulse);
player.HealPlayer(healQuantity);
player.Calamity().ChlorophyteHealDelay = ChlorophyteArmorSetChange.DelayBetweenHeals;
}
}
}
public override Color? GetAlpha(Color lightColor)
{
Color c1 = new Color(142, 255, 155, 0);
Color c2 = new Color(0, 142, 113, 92);
return Color.Lerp(c1, c2, 1f - Projectile.Opacity) * Projectile.Opacity * 0.67f;
}
public override bool PreDraw(ref Color lightColor)
{
Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value;
Color drawColor = Projectile.GetAlpha(lightColor) * 0.4f;
for (int i = 0; i < 8; i++)
{
Vector2 drawOffset = (MathHelper.TwoPi * i / 8f).ToRotationVector2() * 4f;
Vector2 drawPosition = Projectile.Center - Main.screenPosition + drawOffset;
Main.EntitySpriteDraw(texture, drawPosition, null, drawColor, 0f, texture.Size() * 0.5f, Projectile.scale, 0, 0);
}
return false;
}
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.scale * 48f, targetHitbox);
public override bool OnTileCollide(Vector2 oldVelocity) => false;
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

@@ -1,85 +0,0 @@
using System;
using CalamityMod.Items.VanillaArmorChanges;
using CalamityMod.Projectiles.Typeless;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.Audio;
using Terraria.GameContent;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.VanillaProjectileOverrides
{
public static class ChlorophyteCrystalAI
{
public static bool DoChlorophyteCrystalAI(Projectile projectile)
{
Player owner = Main.player[projectile.owner];
ref float timer = ref projectile.ai[1];
timer++;
projectile.aiStyle = -1;
if (!owner.crystalLeaf)
{
projectile.Kill();
return false;
}
// Stay above the player.
projectile.Center = owner.Center + Vector2.UnitY * (owner.gfxOffY - 60f);
if (Main.player[projectile.owner].gravDir == -1f)
{
projectile.position.Y += 120f;
projectile.rotation = MathHelper.Pi;
}
else
projectile.rotation = 0f;
projectile.Center = projectile.Center.Floor();
// Disable hardcoded spaghetti that fires crystal shots in vanilla code.
owner.petalTimer = 2;
// Have a periodically pulsing scale.
projectile.scale = MathHelper.Lerp(0.9f, 1.15f, (float)Math.Sin(timer / 27f) * 0.5f + 0.5f);
// Emit life pulses periodically.
NPC potentialTarget = projectile.Center.ClosestNPCAt(560f, true, true);
bool ownerNotFullHealth = owner.statLife < owner.statLifeMax2;
bool willFirePulses = (potentialTarget is not null) || ownerNotFullHealth;
if (timer % ChlorophyteArmorSetChange.PulseReleaseRate == ChlorophyteArmorSetChange.PulseReleaseRate - 1f && willFirePulses)
{
if (Main.myPlayer == projectile.owner)
{
int pulseDamage = (int)owner.GetBestClassDamage().ApplyTo(ChlorophyteArmorSetChange.BaseDamageToEnemies);
Projectile.NewProjectile(projectile.GetSource_FromThis(), projectile.Center, Vector2.Zero, ModContent.ProjectileType<ChlorophyteLifePulse>(), pulseDamage, 0f, projectile.owner);
}
}
return false;
}
public static void DoChlorophyteCrystalDrawing(Projectile projectile)
{
// Why doesn't this work? How does one access the texture path of a vanilla projectile? Left bugged for someone else to figure out :)
// It's me. I was that someone - Dominic
// TextureAssets is the answer, along with Main.instance.LoadProjectile(projID), to ensure that the texture is loaded into memory.
// In this instance, however, that should happen already on vanilla's end.
Texture2D texture = TextureAssets.Projectile[projectile.type].Value;
Vector2 drawPosition = projectile.Center - Main.screenPosition;
Vector2 origin = texture.Size() * 0.5f;
float backglowColorInterpolant = MathHelper.Lerp(0.44f, 0.88f, (float)Math.Sin(Main.GlobalTimeWrappedHourly * 1.1f) * 0.5f + 0.5f);
Color backglowColor = Color.Lerp(Color.Cyan, Color.Lime, backglowColorInterpolant) * 0.37f;
backglowColor.A = 0;
for (int i = 0; i < 8; i++)
{
Vector2 drawOffset = (MathHelper.TwoPi * i / 8f).ToRotationVector2() * 3f;
Main.EntitySpriteDraw(texture, drawPosition + drawOffset, null, projectile.GetAlpha(backglowColor), projectile.rotation, origin, projectile.scale, 0, 0);
}
Main.EntitySpriteDraw(texture, drawPosition, null, projectile.GetAlpha(Color.White * 0.75f), projectile.rotation, origin, projectile.scale, 0, 0);
}
}
}