No files matched your search
|
After Width: | Height: | Size: 376 B |
@@ -0,0 +1,76 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
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;
|
||||
using Terraria;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.ModLoader;
|
||||
using static Terraria.ModLoader.PlayerDrawLayer;
|
||||
|
||||
namespace CalamityMod.CalPlayer.DrawLayers
|
||||
{
|
||||
public class SpringStoolLayer : PlayerDrawLayer
|
||||
{
|
||||
private Asset<Texture2D> stoolTexture;
|
||||
private Asset<Texture2D> springTexture;
|
||||
private Asset<Texture2D> topTexture;
|
||||
|
||||
public override Position GetDefaultPosition() => new BeforeParent(PlayerDrawLayers.Leggings);
|
||||
|
||||
public override bool GetDefaultVisibility(PlayerDrawSet drawInfo)
|
||||
{
|
||||
// Only draw if the player is holding Up and still
|
||||
return drawInfo.drawPlayer.GetModPlayer<SpringStoolPlayer>().springStool &&
|
||||
drawInfo.drawPlayer.portableStoolInfo.IsInUse;
|
||||
}
|
||||
|
||||
protected override void Draw(ref PlayerDrawSet drawInfo)
|
||||
{
|
||||
Player drawPlayer = drawInfo.drawPlayer;
|
||||
|
||||
// Load textures if null
|
||||
stoolTexture ??= ModContent.Request<Texture2D>("CalamityMod/CalPlayer/DrawLayers/SpringStoolBottom");
|
||||
springTexture ??= ModContent.Request<Texture2D>("CalamityMod/CalPlayer/DrawLayers/SpringStoolSpring");
|
||||
topTexture ??= ModContent.Request<Texture2D>("CalamityMod/CalPlayer/DrawLayers/SpringStoolTop");
|
||||
|
||||
Texture2D stoolTex = stoolTexture.Value;
|
||||
Texture2D springTex = springTexture.Value;
|
||||
Texture2D topTex = topTexture.Value;
|
||||
|
||||
// Bottom Position
|
||||
Vector2 bottomPosition = new Vector2(
|
||||
(int)(drawInfo.Position.X - Main.screenPosition.X + drawPlayer.width / 2f),
|
||||
(int)(drawInfo.Position.Y - Main.screenPosition.Y + drawPlayer.height + drawPlayer.portableStoolInfo.HeightBoost)
|
||||
);
|
||||
Rectangle bottomSource = stoolTex.Frame();
|
||||
Vector2 bottomOrigin = new Vector2(bottomSource.Width / 2f, bottomSource.Height - 2);
|
||||
|
||||
// Spring
|
||||
Vector2 springPosition = bottomPosition - new Vector2(0, bottomSource.Height);
|
||||
Rectangle springSource = springTex.Frame();
|
||||
Vector2 springOrigin = new Vector2(springSource.Width / 2f, springSource.Height - 2);
|
||||
|
||||
// Top
|
||||
Vector2 topPosition = springPosition - new Vector2(0, springSource.Height - 5);
|
||||
Rectangle topSource = topTex.Frame();
|
||||
Vector2 topOrigin = new Vector2(topSource.Width / 2f, topSource.Height);
|
||||
|
||||
// Add all to cache
|
||||
DrawPart(ref drawInfo, stoolTex, bottomPosition, bottomSource, bottomOrigin);
|
||||
DrawPart(ref drawInfo, springTex, springPosition, springSource, springOrigin);
|
||||
DrawPart(ref drawInfo, topTex, topPosition, topSource, topOrigin);
|
||||
}
|
||||
|
||||
private void DrawPart(ref PlayerDrawSet drawInfo, Texture2D tex, Vector2 pos, Rectangle src, Vector2 origin)
|
||||
{
|
||||
drawInfo.DrawDataCache.Add(new DrawData(tex, pos, src, drawInfo.colorArmorLegs, drawInfo.drawPlayer.bodyRotation, origin, 1f, drawInfo.playerEffect, 0)
|
||||
{ shader = drawInfo.cPortableStool });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 202 B |
|
After Width: | Height: | Size: 232 B |
@@ -18,6 +18,7 @@ namespace CalamityMod
|
||||
public static ModKeybind NormalityRelocatorHotKey { get; private set; }
|
||||
public static ModKeybind RageHotKey { get; private set; }
|
||||
public static ModKeybind SpectralVeilHotKey { get; private set; }
|
||||
public static ModKeybind SpringStoolJumpHotKey { get; private set; }
|
||||
public static ModKeybind TransformerHotKey { get; private set; }
|
||||
public static ModKeybind SwitchGravityHotkey {get; private set;}
|
||||
public static ModKeybind ExpandDebuffInfo { get; private set; }
|
||||
@@ -40,6 +41,7 @@ namespace CalamityMod
|
||||
NormalityRelocatorHotKey = KeybindLoader.RegisterKeybind(Mod, "NormalityRelocator", "Z");
|
||||
RageHotKey = KeybindLoader.RegisterKeybind(Mod, "RageMode", "V");
|
||||
SpectralVeilHotKey = KeybindLoader.RegisterKeybind(Mod, "SpectralVeilTeleport", "Z");
|
||||
SpringStoolJumpHotKey = KeybindLoader.RegisterKeybind(Mod, "SpringStoolJumpHotKey", "U");
|
||||
TransformerHotKey = KeybindLoader.RegisterKeybind(Mod, "TransformerHotKey", "K");
|
||||
SwitchGravityHotkey = KeybindLoader.RegisterKeybind(Mod, "GravitySwapOverride", "T");
|
||||
ExpandDebuffInfo = KeybindLoader.RegisterKeybind(Mod, "ExpandDebuffInfo", "LeftControl");
|
||||
@@ -62,6 +64,7 @@ namespace CalamityMod
|
||||
NormalityRelocatorHotKey = null;
|
||||
RageHotKey = null;
|
||||
SpectralVeilHotKey = null;
|
||||
SpringStoolJumpHotKey = null;
|
||||
TransformerHotKey = null;
|
||||
ExpandDebuffInfo = null;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
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
|
||||
{
|
||||
public class Stooldown : CooldownHandler
|
||||
{
|
||||
public static new string ID => "Stooldown";
|
||||
public override bool ShouldDisplay => true;
|
||||
public override bool CanTickDown => true;
|
||||
public override void Tick()
|
||||
{
|
||||
base.Tick();
|
||||
}
|
||||
public override LocalizedText DisplayName => CalamityUtils.GetText($"UI.Cooldowns.{ID}");
|
||||
public override string Texture => "CalamityMod/Cooldowns/Stooldown";
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 270 B |
|
After Width: | Height: | Size: 185 B |
|
After Width: | Height: | Size: 166 B |
@@ -0,0 +1,226 @@
|
||||
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.Localization;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Items.Accessories
|
||||
{
|
||||
public class SpringStool : ModItem, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Items.Accessories";
|
||||
public override void ModifyTooltips(List<TooltipLine> list) => list.IntegrateHotkey(CalamityKeybinds.SpringStoolJumpHotKey);
|
||||
public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs((JumpCooldown).FramesToSeconds(), (CritRateBoostAboveTargets));
|
||||
|
||||
public static int JumpCooldown = CalamityUtils.SecondsToFrames(20);
|
||||
public static int CritRateBoostAboveTargets = 5;
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.width = 30;
|
||||
Item.height = 46;
|
||||
Item.value = CalamityGlobalItem.RarityGreenBuyPrice;
|
||||
Item.rare = ItemRarityID.Green;
|
||||
Item.accessory = true;
|
||||
}
|
||||
|
||||
public override void UpdateAccessory(Player player, bool hideVisual)
|
||||
{
|
||||
player.GetModPlayer<SpringStoolPlayer>().springStool = true;
|
||||
}
|
||||
|
||||
public override void AddRecipes()
|
||||
{
|
||||
CreateRecipe().
|
||||
AddIngredient(ItemID.PortableStool).
|
||||
AddRecipeGroup("AnyCopperBar", 3).
|
||||
AddTile(TileID.Anvils).
|
||||
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;
|
||||
|
||||
// Used to apply the conditional crit chance boost
|
||||
// Projectiles uses standard tML hooks
|
||||
On_Player.ProcessHitAgainstNPC += HandleExtraMeleeHitboxCrit;
|
||||
}
|
||||
|
||||
public override void PostUpdate()
|
||||
{
|
||||
bool theCollisionCheck = Collision.TileCollision(Player.position + Vector2.UnitY, Vector2.Zero, Player.width, Player.height, fallThrough: false, fall2: false).Y == 0f;
|
||||
|
||||
if ((Player.velocity.Y == 0 && theCollisionCheck) || Player.grappling[0] >= 0)
|
||||
hasGroundedSinceJump = true;
|
||||
}
|
||||
|
||||
public override void PostUpdateEquips()
|
||||
{
|
||||
if (CalamityKeybinds.SpringStoolJumpHotKey.JustPressed && springStool && Main.myPlayer == Player.whoAmI && !Player.HasCooldown(Stooldown.ID) && !Player.mount.Active && hasGroundedSinceJump)
|
||||
{
|
||||
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(0f, -4f), 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 (springStoolTimer > 0)
|
||||
{
|
||||
springStoolTimer--;
|
||||
|
||||
if (Player.whoAmI == Main.myPlayer)
|
||||
{
|
||||
float launchPower = 20f * Utils.GetLerpValue(0, 10, springStoolTimer, true);
|
||||
Player.velocity.Y = -launchPower * Player.gravDir;
|
||||
|
||||
// Prevent vanilla jump logic from interfering
|
||||
Player.jump = 0;
|
||||
Player.fallStart = (int)(Player.position.Y / 16f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Adds crit to melee hitboxes
|
||||
private static void HandleExtraMeleeHitboxCrit(On_Player.orig_ProcessHitAgainstNPC orig, Player self, Item sItem, Rectangle itemRectangle, int originalDamage, float knockback, int npcIndex)
|
||||
{
|
||||
bool getBoost = self.GetModPlayer<SpringStoolPlayer>().springStool && self.Top.Y < Main.npc[npcIndex].Top.Y;
|
||||
if (getBoost)
|
||||
sItem.crit += SpringStool.CritRateBoostAboveTargets;
|
||||
|
||||
orig(self, sItem, itemRectangle, originalDamage, knockback, npcIndex);
|
||||
|
||||
if (getBoost)
|
||||
sItem.crit -= SpringStool.CritRateBoostAboveTargets;
|
||||
}
|
||||
// Scuffed implementation to add crit to projectiles, using one hook to add it and then a later hook to remove it
|
||||
// There are two return statements in between these hooks that I would normally be nervous of, however neither actually affect this at all:
|
||||
// * The first is Electrosphere Launcher's rockets dying on hit, which kills the projectile anyways and can just have a manual check against
|
||||
// * The second is Abigail's Flower hit cooldown logic, which does nothing since it's a minion that doesn't crit
|
||||
public override void ModifyHitNPCWithProj(Projectile proj, NPC target, ref NPC.HitModifiers modifiers)
|
||||
{
|
||||
if (springStool && proj.type != ProjectileID.ElectrosphereMissile)
|
||||
{
|
||||
if (Player.Top.Y < target.Top.Y)
|
||||
proj.CritChance += SpringStool.CritRateBoostAboveTargets;
|
||||
}
|
||||
}
|
||||
public override void OnHitNPCWithProj(Projectile proj, NPC target, NPC.HitInfo hit, int damageDone)
|
||||
{
|
||||
if (springStool && proj.type != ProjectileID.ElectrosphereMissile)
|
||||
{
|
||||
if (Player.Top.Y < target.Top.Y)
|
||||
proj.CritChance -= SpringStool.CritRateBoostAboveTargets;
|
||||
}
|
||||
}
|
||||
|
||||
public override void ResetEffects()
|
||||
{
|
||||
springStool = false;
|
||||
springStoolTimer = 0;
|
||||
}
|
||||
|
||||
public override void UpdateDead()
|
||||
{
|
||||
springStool = false;
|
||||
springStoolTimer = 0;
|
||||
hasGroundedSinceJump = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 719 B |
@@ -1682,6 +1682,17 @@ SpiritGlyph: {
|
||||
'''
|
||||
}
|
||||
|
||||
SpringStool: {
|
||||
DisplayName: Spring Stool
|
||||
Tooltip:
|
||||
'''
|
||||
Hold Up to reach higher
|
||||
Press [KEY] to jump super high
|
||||
Super jumps can only be performed once every {0} seconds and after landing
|
||||
+{1}% critical strike chance when striking enemies below you
|
||||
'''
|
||||
}
|
||||
|
||||
StarbusterCore: {
|
||||
DisplayName: Starbuster Core
|
||||
Tooltip:
|
||||
|
||||
@@ -16,3 +16,4 @@ TransformerHotKey.DisplayName: Transformer Hot Key
|
||||
GravitySwapOverride.DisplayName: Gravity Swap Override
|
||||
ExpandDebuffInfo.DisplayName: See Debuff Information
|
||||
ThePointerLock.DisplayName: The Pointer Lock On
|
||||
SpringStoolJumpHotKey.DisplayName: Spring Stool Jump Hotkey
|
||||
@@ -135,8 +135,10 @@ SkyFlareFriendly.DisplayName: Flare
|
||||
SlimeStream.DisplayName: Slime Stream
|
||||
SlurperBobber.DisplayName: Slurper Bobber
|
||||
SpiritOriginBullseye.DisplayName: Spirit Origin Bullseye
|
||||
SpringStoolFX.DisplayName: Spring Stool
|
||||
StandingFire.DisplayName: Flame
|
||||
StarStruckWaterBottle.DisplayName: Bottle
|
||||
StepStoolBonusFX.DisplayName: Step Stool Bonus
|
||||
StickyFeatherAero.DisplayName: Feather
|
||||
StomperSlam.DisplayName: Stomper Slam
|
||||
SuicideBomberDemon.DisplayName: Demon
|
||||
|
||||
@@ -151,6 +151,7 @@ Cooldowns: {
|
||||
SpongeDurability: Sponge Barrier Durability
|
||||
SpongeRecharge: Sponge Barrier Recharge
|
||||
Starburst: Stratus Starbursts
|
||||
Stooldown: Stooldown
|
||||
SuperradiantSawBoost: Superradiant Saw Boost
|
||||
TarragonCloak: Tarragon Cloak Cooldown
|
||||
TarragonImmunity: Tarragon Immunity Cooldown
|
||||
|
||||
@@ -0,0 +1,140 @@
|
||||
using System;
|
||||
using CalamityMod.Particles;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using rail;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Typeless
|
||||
{
|
||||
public class SpringStoolFX : ModProjectile, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Typeless";
|
||||
|
||||
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 + (Main.player[Projectile.owner].gravDir == -1 ? MathHelper.Pi : 0), drawOrigin, scale, SpriteEffects.None, 0);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 4.2 KiB |
@@ -0,0 +1,56 @@
|
||||
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, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Typeless";
|
||||
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.12f;
|
||||
Projectile.scale -= 0.0125f;
|
||||
OpacityMultiplier -= 0.025f;
|
||||
|
||||
if (Projectile.timeLeft > 99)
|
||||
Projectile.alpha = 255;
|
||||
else
|
||||
Projectile.alpha = 0;
|
||||
}
|
||||
|
||||
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 * ((1f - (Projectile.alpha / 255f)) * OpacityMultiplier), Projectile.rotation + (Main.player[Projectile.owner].gravDir == -1 ? MathHelper.Pi : 0), origin, Projectile.scale * 1.25f, SpriteEffects.None);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||