Core functionality done
This commit is contained in:
1 parent
2085d7d3c1
commit
5e7c162e90
10 files changed
+355
-200
No files matched your search
@@ -865,8 +865,6 @@ namespace CalamityMod.CalPlayer
|
||||
public bool tesla = false;
|
||||
public bool teslaVisuals = true;
|
||||
public bool cryogenSoul = false;
|
||||
public bool springStool = false;
|
||||
public int springStoolTimer = 0;
|
||||
public bool ascendantInsignia = false;
|
||||
public int ascendantInsigniaBuffTime = 0;
|
||||
public int ascendantInsigniaCooldown = 0;
|
||||
@@ -2415,8 +2413,6 @@ namespace CalamityMod.CalPlayer
|
||||
tesla = false;
|
||||
teslaVisuals = true;
|
||||
cryogenSoul = false;
|
||||
springStool = false;
|
||||
springStoolTimer = 0;
|
||||
ascendantInsignia = false;
|
||||
magmaStoneVisuals = true;
|
||||
eGauntlet = false;
|
||||
@@ -4574,21 +4570,6 @@ namespace CalamityMod.CalPlayer
|
||||
#region PreUpdateMovement
|
||||
public override void PreUpdateMovement()
|
||||
{
|
||||
if (springStoolTimer > 0)
|
||||
{
|
||||
springStoolTimer--;
|
||||
|
||||
if (Player.whoAmI == Main.myPlayer)
|
||||
{
|
||||
float launchPower = 18f * Utils.GetLerpValue(0, 10, springStoolTimer, true);
|
||||
Player.velocity.Y = -launchPower;
|
||||
|
||||
// Prevent vanilla jump logic from interfering
|
||||
Player.jump = 0;
|
||||
Player.fallStart = (int)(Player.position.Y / 16f);
|
||||
}
|
||||
}
|
||||
|
||||
// Rain armor set effects
|
||||
if (rainSet)
|
||||
{
|
||||
@@ -5027,85 +5008,6 @@ namespace CalamityMod.CalPlayer
|
||||
if (gSabaton && Player.whoAmI == Main.myPlayer)
|
||||
Player.jumpSpeedBoost += 2f;
|
||||
}
|
||||
|
||||
if (CalamityKeybinds.SpringStoolJumpHotKey.JustPressed && springStool && Main.myPlayer == Player.whoAmI && !Player.HasCooldown(Stooldown.ID) && !Player.mount.Active)
|
||||
{
|
||||
springStoolTimer = 12;
|
||||
|
||||
Player.AddCooldown(Stooldown.ID, (int) SpringStool.JumpCooldown / 10, true);
|
||||
|
||||
Vector2 spawnPos = Player.Bottom + new Vector2(0f, -60f);
|
||||
|
||||
Projectile.NewProjectile(Player.GetSource_FromThis(), spawnPos, new Vector2(Main.rand.NextFloat(-1f, 1f), 2f), ModContent.ProjectileType<SpringStoolJumpFX>(), 0, 0f, Player.whoAmI);
|
||||
|
||||
SoundEngine.PlaySound(SoundID.Item61 with { Pitch = 0.3f, Volume = 0.8f }, Player.Center);
|
||||
}
|
||||
|
||||
if (springStool)
|
||||
{
|
||||
bool holdingUp = Player.controlUp;
|
||||
bool standingStill = Player.velocity.Y == 0 && Math.Abs(Player.velocity.X) < 0.1f;
|
||||
|
||||
if (holdingUp && standingStill && !Player.mount.Active)
|
||||
{
|
||||
int boost = 61;
|
||||
if (IsVanillaStoolEquipped(Player))
|
||||
boost += 24;
|
||||
|
||||
Player.portableStoolInfo.HasAStool = true;
|
||||
Player.portableStoolInfo.IsInUse = true;
|
||||
Player.portableStoolInfo.HeightBoost = boost;
|
||||
Player.portableStoolInfo.VisualYOffset = boost;
|
||||
Player.portableStoolInfo.MapYOffset = boost;
|
||||
|
||||
// Forces the player into the stool-standing frame
|
||||
Player.UpdatePortableStoolUsage();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Ensures the player can use the stool if they stop moving/hold up
|
||||
Player.portableStoolInfo.HasAStool = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void HandleStoolStacking(On_PlayerDrawLayers.orig_DrawPlayer_03_PortableStool orig, ref PlayerDrawSet drawInfo)
|
||||
{
|
||||
bool isUsingStool = drawInfo.drawPlayer.portableStoolInfo.IsInUse;
|
||||
var modPlayer = drawInfo.drawPlayer.GetModPlayer<CalamityPlayer>();
|
||||
bool hasSpring = modPlayer.springStool;
|
||||
|
||||
if (!isUsingStool)
|
||||
{
|
||||
orig(ref drawInfo);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!hasSpring)
|
||||
{
|
||||
orig(ref drawInfo);
|
||||
return;
|
||||
}
|
||||
|
||||
if (IsVanillaStoolEquipped(drawInfo.drawPlayer))
|
||||
{
|
||||
orig(ref drawInfo);
|
||||
return;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
private bool IsVanillaStoolEquipped(Player player)
|
||||
{
|
||||
for (int k = 3; k <= 12; k++)
|
||||
{
|
||||
if (player.armor[k].type == ItemID.PortableStool)
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -6345,12 +6247,6 @@ namespace CalamityMod.CalPlayer
|
||||
GeneralParticleHandler.SpawnParticle(square2);
|
||||
}
|
||||
|
||||
public override void Load()
|
||||
{
|
||||
// Hook directly into vanilla's stool drawing
|
||||
On_PlayerDrawLayers.DrawPlayer_03_PortableStool += HandleStoolStacking;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Mana Consumption Effects
|
||||
|
||||
@@ -461,25 +461,6 @@ namespace CalamityMod.CalPlayer
|
||||
#endregion
|
||||
|
||||
#region Modify Hit NPC
|
||||
|
||||
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
|
||||
{
|
||||
if (springStool)
|
||||
{
|
||||
if (Main.LocalPlayer.Top.Y < target.Top.Y)
|
||||
{
|
||||
// Effective +10% crit chance. Increasing crit chance additively through manual rolling is scuffed for crossmod compatability, feel free to improve it if you know a better way
|
||||
float finalCritChance = Player.GetTotalCritChance(modifiers.DamageType) + 100f;
|
||||
|
||||
if (Main.rand.NextFloat(1f, 101f) <= finalCritChance)
|
||||
modifiers.SetCrit();
|
||||
|
||||
else
|
||||
modifiers.DisableCrit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void ModifyHitNPCWithItem(Item item, NPC target, ref NPC.HitModifiers modifiers)
|
||||
{
|
||||
modifiers.CritDamage += critDamage;
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using CalamityMod.ExtraJumps;
|
||||
using CalamityMod.Items.Accessories;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using ReLogic.Content;
|
||||
@@ -25,7 +26,7 @@ namespace CalamityMod.CalPlayer.DrawLayers
|
||||
public override bool GetDefaultVisibility(PlayerDrawSet drawInfo)
|
||||
{
|
||||
// Only draw if the player is holding Up and still
|
||||
return drawInfo.drawPlayer.GetModPlayer<CalamityPlayer>().springStool &&
|
||||
return drawInfo.drawPlayer.GetModPlayer<SpringStoolPlayer>().springStool &&
|
||||
drawInfo.drawPlayer.portableStoolInfo.IsInUse;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,12 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using CalamityMod.Items.Accessories;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.GameContent;
|
||||
using Terraria.ID;
|
||||
using Terraria.Localization;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Cooldowns
|
||||
{
|
||||
@@ -15,8 +21,8 @@ namespace CalamityMod.Cooldowns
|
||||
}
|
||||
public override LocalizedText DisplayName => CalamityUtils.GetText($"UI.Cooldowns.{ID}");
|
||||
public override string Texture => "CalamityMod/Cooldowns/Stooldown";
|
||||
public override Color OutlineColor => new Color(197, 165, 108);
|
||||
public override Color CooldownStartColor => new Color(144, 84, 29);
|
||||
public override Color OutlineColor => Color.SandyBrown;
|
||||
public override Color CooldownStartColor => Color.Brown;
|
||||
public override Color CooldownEndColor => Color.Khaki;
|
||||
|
||||
public override SoundStyle? EndSound => new("CalamityMod/Sounds/Item/AscendantOff");
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
using System.Collections.Generic;
|
||||
using CalamityMod.CalPlayer;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using CalamityMod.Cooldowns;
|
||||
using CalamityMod.Projectiles.Typeless;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
@@ -11,7 +16,7 @@ namespace CalamityMod.Items.Accessories
|
||||
public new string LocalizationCategory => "Items.Accessories";
|
||||
public override void ModifyTooltips(List<TooltipLine> list) => list.IntegrateHotkey(CalamityKeybinds.SpringStoolJumpHotKey);
|
||||
|
||||
public static int JumpCooldown = CalamityUtils.SecondsToFrames(5);
|
||||
public static int JumpCooldown = CalamityUtils.SecondsToFrames(25);
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
@@ -24,8 +29,7 @@ namespace CalamityMod.Items.Accessories
|
||||
|
||||
public override void UpdateAccessory(Player player, bool hideVisual)
|
||||
{
|
||||
CalamityPlayer modPlayer = player.Calamity();
|
||||
modPlayer.springStool = true;
|
||||
player.GetModPlayer<SpringStoolPlayer>().springStool = true;
|
||||
}
|
||||
|
||||
public override void AddRecipes()
|
||||
@@ -37,4 +41,151 @@ namespace CalamityMod.Items.Accessories
|
||||
Register();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class SpringStoolPlayer : ModPlayer
|
||||
{
|
||||
public bool springStool = false;
|
||||
public int springStoolTimer = 0;
|
||||
public bool hasGroundedSinceJump = true;
|
||||
|
||||
public override void Load()
|
||||
{
|
||||
// Hook directly into vanilla's stool drawing
|
||||
On_PlayerDrawLayers.DrawPlayer_03_PortableStool += HandleStoolStacking;
|
||||
}
|
||||
|
||||
public override void PostUpdateEquips()
|
||||
{
|
||||
if (CalamityKeybinds.SpringStoolJumpHotKey.JustPressed && springStool && Main.myPlayer == Player.whoAmI && !Player.HasCooldown(Stooldown.ID) && !Player.mount.Active)
|
||||
{
|
||||
springStoolTimer = 12;
|
||||
|
||||
Player.AddCooldown(Stooldown.ID, (int)SpringStool.JumpCooldown, true);
|
||||
hasGroundedSinceJump = false;
|
||||
|
||||
|
||||
Vector2 spawnPos = Player.Bottom + new Vector2(0f, -60f);
|
||||
|
||||
// Spawn stool with downward and randomly angled force
|
||||
Projectile.NewProjectile(Player.GetSource_FromThis(), spawnPos, new Vector2(Main.rand.NextFloat(-1f, 1f), 1.2f), ModContent.ProjectileType<SpringStoolFX>(), 0, 0f, Player.whoAmI);
|
||||
SoundEngine.PlaySound(SoundID.Item61 with { Pitch = 0.3f, Volume = 0.7f }, Player.Center);
|
||||
|
||||
if (IsVanillaStoolEquipped(Player))
|
||||
{
|
||||
// Spawn a step stool copy with a random velocity. Only works if step stool is equipped as well as spring stool.
|
||||
Projectile.NewProjectile(Player.GetSource_FromThis(), spawnPos, new Vector2(Main.rand.NextBool() ? Main.rand.NextFloat(6f, 7f) : Main.rand.NextFloat(-6f, -7f), Main.rand.NextFloat(-8f, -10f)), ModContent.ProjectileType<StepStoolBonusFX>(), 0, 0f, Player.whoAmI);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (springStool)
|
||||
{
|
||||
bool holdingUp = Player.controlUp;
|
||||
bool standingStill = Player.velocity.Y == 0 && Math.Abs(Player.velocity.X) < 0.1f;
|
||||
|
||||
if (holdingUp && standingStill && !Player.mount.Active)
|
||||
{
|
||||
int boost = 61;
|
||||
if (IsVanillaStoolEquipped(Player))
|
||||
boost += 24;
|
||||
|
||||
Player.portableStoolInfo.HasAStool = true;
|
||||
Player.portableStoolInfo.IsInUse = true;
|
||||
Player.portableStoolInfo.HeightBoost = boost;
|
||||
Player.portableStoolInfo.VisualYOffset = boost;
|
||||
Player.portableStoolInfo.MapYOffset = boost;
|
||||
|
||||
// Forces the player into the stool-standing frame
|
||||
Player.UpdatePortableStoolUsage();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Ensures the player can use the stool if they stop moving/hold up
|
||||
Player.portableStoolInfo.HasAStool = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void HandleStoolStacking(On_PlayerDrawLayers.orig_DrawPlayer_03_PortableStool orig, ref PlayerDrawSet drawInfo)
|
||||
{
|
||||
bool isUsingStool = drawInfo.drawPlayer.portableStoolInfo.IsInUse;
|
||||
var modPlayer = drawInfo.drawPlayer.GetModPlayer<SpringStoolPlayer>();
|
||||
bool hasSpring = modPlayer.springStool;
|
||||
|
||||
if (!isUsingStool)
|
||||
{
|
||||
orig(ref drawInfo);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!hasSpring)
|
||||
{
|
||||
orig(ref drawInfo);
|
||||
return;
|
||||
}
|
||||
|
||||
if (IsVanillaStoolEquipped(drawInfo.drawPlayer))
|
||||
{
|
||||
orig(ref drawInfo);
|
||||
return;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
private bool IsVanillaStoolEquipped(Player player)
|
||||
{
|
||||
for (int k = 3; k <= 12; k++)
|
||||
{
|
||||
if (player.armor[k].type == ItemID.PortableStool)
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void PreUpdateMovement()
|
||||
{
|
||||
if (Player.velocity.Y == 0 || Player.sliding || Player.grappling[0] >= 0)
|
||||
hasGroundedSinceJump = true;
|
||||
|
||||
if (springStoolTimer > 0)
|
||||
{
|
||||
springStoolTimer--;
|
||||
|
||||
if (Player.whoAmI == Main.myPlayer)
|
||||
{
|
||||
float launchPower = 20f * Utils.GetLerpValue(0, 10, springStoolTimer, true);
|
||||
Player.velocity.Y = -launchPower;
|
||||
|
||||
// Prevent vanilla jump logic from interfering
|
||||
Player.jump = 0;
|
||||
Player.fallStart = (int)(Player.position.Y / 16f);
|
||||
}
|
||||
}
|
||||
}
|
||||
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
|
||||
{
|
||||
if (springStool)
|
||||
{
|
||||
if (Main.LocalPlayer.Top.Y < target.Top.Y)
|
||||
{
|
||||
// Effective +10% crit chance. Increasing crit chance additively through manual rolling is scuffed for crossmod compatability, feel free to improve it if you know a better way
|
||||
float finalCritChance = Player.GetTotalCritChance(modifiers.DamageType) + 100f;
|
||||
|
||||
if (Main.rand.NextFloat(1f, 101f) <= finalCritChance)
|
||||
modifiers.SetCrit();
|
||||
|
||||
else
|
||||
modifiers.DisableCrit();
|
||||
}
|
||||
}
|
||||
}
|
||||
public override void ResetEffects()
|
||||
{
|
||||
springStool = false;
|
||||
springStoolTimer = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,137 @@
|
||||
using System;
|
||||
using CalamityMod.Particles;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Typeless
|
||||
{
|
||||
public class SpringStoolFX : ModProjectile, ILocalizedModType
|
||||
{
|
||||
float rotationFactor = 0.015f;
|
||||
public static float EaseOutElastic(float x, float amplitude = 1f, float period = 0.3f)
|
||||
{
|
||||
if (x == 0f) return 0f;
|
||||
if (x == 1f) return 1f;
|
||||
|
||||
amplitude = Math.Max(1f, amplitude);
|
||||
|
||||
float s = (float)(period / (2 * Math.PI) * Math.Asin(1f / amplitude));
|
||||
|
||||
return (float)(
|
||||
amplitude *
|
||||
Math.Pow(2, -10f * x) *
|
||||
Math.Sin((x - s) * (2 * Math.PI) / period)
|
||||
+ 1f
|
||||
);
|
||||
}
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
Main.projFrames[Type] = 5;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 78;
|
||||
Projectile.height = 142;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.friendly = false;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.alpha = 0;
|
||||
Projectile.timeLeft = 120;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Player player = Main.player[Projectile.owner];
|
||||
|
||||
if (Projectile.frame < 4)
|
||||
{
|
||||
Projectile.frameCounter++;
|
||||
|
||||
if (Projectile.frameCounter >= 4)
|
||||
{
|
||||
Projectile.frameCounter = 0;
|
||||
Projectile.frame++;
|
||||
|
||||
if (Projectile.frame > 4)
|
||||
{
|
||||
{
|
||||
Projectile.frame = 4; // clamp to last frame
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
float progress = MathHelper.Clamp(Projectile.ai[0] / 70f, 0f, 1f);
|
||||
|
||||
Projectile.ai[1] = EaseOutElastic(progress);
|
||||
|
||||
|
||||
Projectile.ai[0]++;
|
||||
|
||||
if (Projectile.ai[0] < 3f) // Stick to bottom of player initially
|
||||
{
|
||||
Projectile.Center = player.Bottom + new Vector2(0f, -25f);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
// Begin rotating after initial launch at an increasingly fast rate
|
||||
rotationFactor *= 1.033f;
|
||||
Projectile.rotation -= rotationFactor;
|
||||
}
|
||||
|
||||
if (Projectile.ai[0] == 4f)
|
||||
{
|
||||
{
|
||||
SoundStyle boing = new("CalamityMod/Sounds/Item/Springy");
|
||||
SoundEngine.PlaySound(boing with { Volume = 1f, PitchVariance = 0.1f });
|
||||
}
|
||||
}
|
||||
|
||||
if (Projectile.ai[0] == 16) // About when the spring retracts into itself, spawn dusts and sparks
|
||||
{
|
||||
for (int k = 0; k < 6; k++)
|
||||
{
|
||||
Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(3) ? 7 : 8);
|
||||
dust.scale = Main.rand.NextFloat(0.8f, 1.3f);
|
||||
dust.velocity = new Vector2(8, 2).RotatedByRandom(100) * Main.rand.NextFloat(0.25f, 1.2f);
|
||||
dust.noGravity = false;
|
||||
Particle spark = new AltLineParticle(Projectile.Center, new Vector2(8, 8).RotatedByRandom(100) * Main.rand.NextFloat(0.4f, 0.9f), true, 15, 0.8f, Color.Lerp(Color.LightGray, Color.Brown, Main.rand.NextFloat(0.3f, 0.7f)) * 0.75f);
|
||||
GeneralParticleHandler.SpawnParticle(spark);
|
||||
}
|
||||
}
|
||||
|
||||
if (Projectile.ai[0] >= 28f) // Begin fading
|
||||
{
|
||||
Projectile.alpha += 10;
|
||||
Projectile.scale *= 0.98f;
|
||||
|
||||
}
|
||||
|
||||
if (Projectile.alpha >= 255 || !player.active || player.dead)
|
||||
Projectile.Kill();
|
||||
}
|
||||
|
||||
public override bool? CanDamage() => false;
|
||||
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value;
|
||||
int frameHeight = texture.Height / Main.projFrames[Type];
|
||||
Rectangle sourceRect = new Rectangle(0, frameHeight * Projectile.frame, texture.Width, frameHeight);
|
||||
Vector2 drawOrigin = new Vector2(texture.Width * 0.5f, frameHeight * 0.5f);
|
||||
Vector2 drawPos = Projectile.Center - Main.screenPosition;
|
||||
|
||||
Vector2 scale = new Vector2(Projectile.scale, Projectile.scale * Projectile.ai[1]);
|
||||
|
||||
Main.EntitySpriteDraw(texture, drawPos, sourceRect, Projectile.GetAlpha(lightColor), Projectile.rotation, drawOrigin, scale, SpriteEffects.None, 0);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
File renamed without changes.
|
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.2 KiB |
@@ -1,68 +0,0 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Typeless
|
||||
{
|
||||
public class SpringStoolJumpFX : ModProjectile, ILocalizedModType
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
Main.projFrames[Type] = 5;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 78;
|
||||
Projectile.height = 142;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.friendly = false;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.alpha = 0;
|
||||
Projectile.timeLeft = 120;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Player player = Main.player[Projectile.owner];
|
||||
|
||||
|
||||
Projectile.rotation -= 0.005f;
|
||||
|
||||
if (Projectile.frame < 4)
|
||||
{
|
||||
Projectile.frameCounter++;
|
||||
|
||||
if (Projectile.frameCounter >= 5)
|
||||
{
|
||||
Projectile.frameCounter = 0;
|
||||
Projectile.frame++;
|
||||
|
||||
if (Projectile.frame > 4)
|
||||
Projectile.frame = 4; // clamp to last frame
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Projectile.ai[0]++;
|
||||
|
||||
/* if (Projectile.ai[0] < 10f) // Stick to bottom of player initially
|
||||
{
|
||||
Projectile.Center = player.Bottom + new Vector2(0f, -50f);
|
||||
Projectile.velocity = Vector2.Zero;
|
||||
} */
|
||||
|
||||
if (Projectile.ai[0] >= 20f) // Begin fading
|
||||
{
|
||||
Projectile.alpha += 8;
|
||||
Projectile.scale *= 0.985f;
|
||||
}
|
||||
|
||||
if (Projectile.alpha >= 255 || !player.active || player.dead)
|
||||
Projectile.Kill();
|
||||
}
|
||||
|
||||
public override bool? CanDamage() => false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.GameContent;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Typeless
|
||||
{
|
||||
public class StepStoolBonusFX : ModProjectile
|
||||
{
|
||||
public override string Texture => "Calamitymod/Projectiles/InvisibleProj";
|
||||
public float OpacityMultiplier = 1f;
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 28;
|
||||
Projectile.height = 28;
|
||||
|
||||
Projectile.tileCollide = true;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.friendly = false;
|
||||
Projectile.penetrate = -1;
|
||||
|
||||
Projectile.timeLeft = 100;
|
||||
Projectile.alpha = 0;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
// Gravity!
|
||||
Projectile.velocity.Y += 0.15f;
|
||||
|
||||
Projectile.rotation += 0.1f;
|
||||
Projectile.scale -= 0.01f;
|
||||
OpacityMultiplier -= 0.02f;
|
||||
|
||||
}
|
||||
|
||||
public override bool? CanDamage() => false;
|
||||
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
Texture2D texture = TextureAssets.Extra[102].Value;
|
||||
Vector2 origin = texture.Size() / 2f;
|
||||
|
||||
Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, null, Color.White * OpacityMultiplier, Projectile.rotation, origin, Projectile.scale * 1.25f, SpriteEffects.None);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Reference in new issue
Block a user