Started work on the hallow attunement and gn
This commit is contained in:
1 parent
34f33a1195
commit
ac58cf289a
3 files changed
+150
-15
No files matched your search
@@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
{
|
||||
public class TrueBiomeBlade : ModItem
|
||||
{
|
||||
public enum Attunement : byte { Default, Hot, Cold, Tropical, Evil, Holy, HolyStar, Marine }
|
||||
public enum Attunement : byte { Default, Hot, Cold, Tropical, Evil, Holy, Astral, Marine }
|
||||
public Attunement? mainAttunement = null;
|
||||
public Attunement? secondaryAttunement = null;
|
||||
public int Combo = 0;
|
||||
@@ -124,13 +124,13 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
break;
|
||||
case Attunement.Holy:
|
||||
AttunementInfo.name = "Heaven's Might";
|
||||
AttunementInfo.function_description = "Hold LMB to charge up a heaven-piercing sword thrust, and release to unleash the devastating blow";
|
||||
AttunementInfo.function_extra = "Striking the ground will create an impact so powerful, massive fragments of crystal will rise up from the earth";
|
||||
AttunementInfo.function_description = "Hold LMB to swing the sword around you, powering up as it spins";
|
||||
AttunementInfo.function_extra = "Releasing LMB will throw the sword in front of you, flying a short distance away before coming back";
|
||||
AttunementInfo.color = new Color(220, 143, 255);
|
||||
break;
|
||||
case Attunement.HolyStar:
|
||||
AttunementInfo.name = "Heaven's Abhorrence";
|
||||
AttunementInfo.function_description = "Hold LMB to charge up a star-ravaging sword thrust, and release to unleash the devastating blow";
|
||||
case Attunement.Astral:
|
||||
AttunementInfo.name = "The One Beyond's Abhorrence";
|
||||
AttunementInfo.function_description = "Hold LMB to charge up a star-piercing sword thrust, and release to unleash the devastating blow";
|
||||
AttunementInfo.function_extra = "Striking the ground will create an impact so powerful, massive otherwordly monoliths will rise up from the earth";
|
||||
AttunementInfo.color = new Color(136, 133, 23);
|
||||
break;
|
||||
@@ -255,10 +255,9 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
|
||||
player.Calamity().rightClickListener = true;
|
||||
|
||||
if (player.velocity.Y == 0) //reset the amount of lunges on ground contact, but also set the power lunge counter back to zero
|
||||
if (player.velocity.Y == 0) //reset the amount of lunges on ground contact
|
||||
{
|
||||
StoredLunges = 2;
|
||||
PowerLungeCounter = 0;
|
||||
}
|
||||
|
||||
//Change the swords function based on its attunement
|
||||
@@ -322,7 +321,18 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
Combo = 0;
|
||||
break;
|
||||
case Attunement.Holy:
|
||||
case Attunement.HolyStar:
|
||||
item.channel = true;
|
||||
item.noUseGraphic = true;
|
||||
item.useStyle = ItemUseStyleID.HoldingOut;
|
||||
item.shoot = ProjectileType<HeavensMight>();
|
||||
item.shootSpeed = 12f;
|
||||
item.UseSound = null;
|
||||
item.noMelee = true;
|
||||
|
||||
Combo = 0;
|
||||
PowerLungeCounter = 0;
|
||||
break;
|
||||
case Attunement.Astral:
|
||||
item.channel = true;
|
||||
item.noUseGraphic = true;
|
||||
item.useStyle = ItemUseStyleID.Stabbing;
|
||||
@@ -379,7 +389,7 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
public override bool CanUseItem(Player player)
|
||||
{
|
||||
return !Main.projectile.Any(n => n.active && n.owner == player.whoAmI &&
|
||||
(n.type == ProjectileType<TrueBitingEmbrace>() || n.type == ProjectileType<TrueGrovetendersTouch>() || n.type == ProjectileType<TrueAridGrandeur>())); // || n.type == ProjectileType<HeavensMightAbhorrence>()
|
||||
(n.type == ProjectileType<TrueBitingEmbrace>() || n.type == ProjectileType<TrueGrovetendersTouch>() || n.type == ProjectileType<TrueAridGrandeur>() || n.type == ProjectileType<HeavensMight>())); // || n.type == ProjectileType<HeavensMightAbhorrence>()
|
||||
}
|
||||
|
||||
public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
|
||||
@@ -435,9 +445,8 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
StoredLunges = 0;
|
||||
return false;
|
||||
|
||||
case Attunement.Holy:
|
||||
case Attunement.HolyStar:
|
||||
float astralVariant = mainAttunement == Attunement.HolyStar ? 1f : 0f;
|
||||
case Attunement.Astral:
|
||||
float astralVariant = mainAttunement == Attunement.Astral ? 1f : 0f;
|
||||
// Projectile.NewProjectile(player.Center, new Vector2(speedX, speedY), ProjectileType<HeavensMightyAbhorrence>(), damage * 2, knockBack, player.whoAmI, astralVariant);
|
||||
return false;
|
||||
|
||||
@@ -446,6 +455,7 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
}
|
||||
}
|
||||
|
||||
//This is only used for the purity sigil effect of the default attunement
|
||||
public override void OnHitNPC(Player player, NPC target, int damage, float knockBack, bool crit)
|
||||
{
|
||||
foreach (Projectile proj in Main.projectile)
|
||||
@@ -502,7 +512,7 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
BiomeEnergyParticles.CenterColor = new Color(195, 42, 200);
|
||||
break;
|
||||
case Attunement.Holy:
|
||||
case Attunement.HolyStar:
|
||||
case Attunement.Astral:
|
||||
BiomeEnergyParticles.EdgeColor = new Color(62, 55, 110);
|
||||
BiomeEnergyParticles.CenterColor = new Color(255, 143, 255);
|
||||
break;
|
||||
@@ -643,7 +653,7 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
if (holy)
|
||||
attunement = Attunement.Holy;
|
||||
if (astral)
|
||||
attunement = Attunement.HolyStar;
|
||||
attunement = Attunement.Astral;
|
||||
if (marine)
|
||||
attunement = Attunement.Marine;
|
||||
|
||||
|
||||
@@ -1528,4 +1528,129 @@ namespace CalamityMod.Projectiles.Melee
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class HeavensMight : ModProjectile
|
||||
{
|
||||
public override string Texture => "CalamityMod/Projectiles/Melee/MendedBiomeBlade_HeavensMight";
|
||||
private bool initialized = false;
|
||||
Vector2 direction = Vector2.Zero;
|
||||
public ref float CurrentState => ref projectile.ai[0];
|
||||
public Player Owner => Main.player[projectile.owner];
|
||||
private bool OwnerCanShoot => Owner.channel && !Owner.noItems && !Owner.CCed;
|
||||
public const float throwOutTime = 40f;
|
||||
public const float throwOutDistance = 240f;
|
||||
public const float maxEmpowerment = 1.7f;
|
||||
public float Empowerment => (projectile.scale - 1f) / (maxEmpowerment - 1f);
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Heaven's Might");
|
||||
}
|
||||
public override void SetDefaults()
|
||||
{
|
||||
projectile.melee = true;
|
||||
projectile.width = projectile.height = 74;
|
||||
projectile.tileCollide = false;
|
||||
projectile.friendly = true;
|
||||
projectile.penetrate = -1;
|
||||
projectile.extraUpdates = 1;
|
||||
projectile.usesLocalNPCImmunity = true;
|
||||
projectile.localNPCHitCooldown = 16;
|
||||
}
|
||||
|
||||
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox)
|
||||
{
|
||||
float collisionPoint = 0f;
|
||||
float bladeLenght = 100 * projectile.scale;
|
||||
float bladeWidth = 20 * projectile.scale;
|
||||
|
||||
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center, Owner.Center + (direction * bladeLenght), bladeWidth, ref collisionPoint);
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
if (!initialized) //Initialization. Here its litterally just playing a sound tho lmfao
|
||||
{
|
||||
Main.PlaySound(SoundID.Item90, projectile.Center);
|
||||
direction = Owner.DirectionTo(Main.MouseWorld);
|
||||
direction.Normalize();
|
||||
initialized = true;
|
||||
}
|
||||
|
||||
if (!OwnerCanShoot)
|
||||
{
|
||||
if (CurrentState == 2f)
|
||||
{
|
||||
projectile.Kill();
|
||||
return;
|
||||
}
|
||||
|
||||
else if (CurrentState == 0f)
|
||||
{
|
||||
CurrentState = 1f;
|
||||
direction = Owner.DirectionTo(Main.MouseWorld);
|
||||
}
|
||||
}
|
||||
|
||||
if (CurrentState == 0f)
|
||||
{
|
||||
//Manage position and rotation
|
||||
projectile.scale *= 1.01f;
|
||||
if (projectile.scale > maxEmpowerment)
|
||||
projectile.scale = maxEmpowerment;
|
||||
|
||||
direction = direction.RotatedBy((Empowerment) * MathHelper.PiOver4 * 0.25);
|
||||
projectile.rotation = direction.ToRotation();
|
||||
projectile.Center = Owner.Center + (direction * projectile.scale * 10);
|
||||
projectile.timeLeft = (int)throwOutTime + 1;
|
||||
}
|
||||
|
||||
if (CurrentState == 1f)
|
||||
{
|
||||
projectile.Center = Owner.Center + (direction * projectile.scale * 10) + ( direction * throwOutDistance * (float)Math.Sin(projectile.timeLeft / throwOutTime * MathHelper.Pi));
|
||||
}
|
||||
|
||||
//Make the owner look like theyre holding the sword bla bla
|
||||
Owner.heldProj = projectile.whoAmI;
|
||||
Owner.direction = Math.Sign(direction.X);
|
||||
Owner.itemRotation = direction.ToRotation();
|
||||
if (Owner.direction != 1)
|
||||
{
|
||||
Owner.itemRotation -= 3.14f;
|
||||
}
|
||||
Owner.itemRotation = MathHelper.WrapAngle(Owner.itemRotation);
|
||||
Owner.itemTime = 2;
|
||||
Owner.itemAnimation = 2;
|
||||
}
|
||||
|
||||
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
|
||||
{
|
||||
Texture2D handle = GetTexture("CalamityMod/Items/Weapons/Melee/TrueBiomeBlade");
|
||||
Texture2D blade = GetTexture("CalamityMod/Projectiles/Melee/MendedBiomeBlade_HeavensMight");
|
||||
|
||||
float drawAngle = direction.ToRotation();
|
||||
float drawRotation = drawAngle + MathHelper.PiOver4;
|
||||
|
||||
Vector2 drawOrigin = new Vector2(0f, handle.Height);
|
||||
Vector2 drawOffset = projectile.Center - Main.screenPosition;
|
||||
|
||||
spriteBatch.Draw(handle, drawOffset, null, lightColor, drawRotation, drawOrigin, projectile.scale, 0f, 0f);
|
||||
|
||||
//Turn on additive blending
|
||||
spriteBatch.End();
|
||||
spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
|
||||
//Update the parameters
|
||||
drawOrigin = new Vector2(0f, blade.Height);
|
||||
|
||||
spriteBatch.Draw(blade, drawOffset, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.9f, drawRotation, drawOrigin, projectile.scale, 0f, 0f);
|
||||
|
||||
//Back to normal
|
||||
spriteBatch.End();
|
||||
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 784 B |
Reference in new issue
Block a user