Merge PR 1327 (supernova-cookable) into lemon-nade
Testers have weighed in and liked the supernova change, so I am committing it into the main PR for lemon 'nade
This commit is contained in:
4 files changed
+148
-14
No files matched your search
@@ -14,14 +14,20 @@ namespace CalamityMod.Items.Weapons.Rogue
|
||||
{
|
||||
public class Supernova : RogueWeapon
|
||||
{
|
||||
public static float StealthTimeInSeconds => 2f;
|
||||
public static readonly SoundStyle ExplosionSound = new("CalamityMod/Sounds/Item/SupernovaBoom") { Volume = 0.9f };
|
||||
public static readonly SoundStyle StealthExplosionSound = new("CalamityMod/Sounds/Item/SupernovaStealthExplode") { Volume = 1f };
|
||||
public static readonly SoundStyle StealthChargeSound = new("CalamityMod/Sounds/Item/SupernovaStealthCharge") { Volume = 1f };
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true;
|
||||
}
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.width = 106;
|
||||
Item.height = 112;
|
||||
Item.damage = 5036;
|
||||
Item.damage = 5200;
|
||||
Item.noMelee = true;
|
||||
Item.noUseGraphic = true;
|
||||
Item.useAnimation = 70;
|
||||
@@ -31,26 +37,21 @@ namespace CalamityMod.Items.Weapons.Rogue
|
||||
Item.UseSound = SoundID.Item1;
|
||||
Item.autoReuse = true;
|
||||
Item.value = CalamityGlobalItem.RarityVioletBuyPrice;
|
||||
Item.shoot = ModContent.ProjectileType<SupernovaBomb>();
|
||||
Item.shoot = ModContent.ProjectileType<SupernovaHoldout>();
|
||||
Item.shootSpeed = 16f;
|
||||
Item.DamageType = RogueDamageClass.Instance;
|
||||
Item.rare = ModContent.RarityType<BurnishedAuric>();
|
||||
Item.channel = true;
|
||||
}
|
||||
|
||||
public override float StealthDamageMultiplier => 0.7f;
|
||||
public override bool AltFunctionUse(Player player) => true;
|
||||
|
||||
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
|
||||
public override float StealthDamageMultiplier => 0.8f;
|
||||
|
||||
public override void HoldItem(Player player)
|
||||
{
|
||||
if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike
|
||||
{
|
||||
int stealth = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI);
|
||||
if (stealth.WithinBounds(Main.maxProjectiles))
|
||||
Main.projectile[stealth].Calamity().stealthStrike = true;
|
||||
return false;
|
||||
}
|
||||
else
|
||||
Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI);
|
||||
return false;
|
||||
if (player.ownedProjectileCounts[Item.shoot] <= 0)
|
||||
player.Calamity().rogueStealth = 0;
|
||||
}
|
||||
|
||||
public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI)
|
||||
|
||||
@@ -1161,6 +1161,8 @@ Supernova: {
|
||||
DisplayName: Supernova
|
||||
Tooltip:
|
||||
'''
|
||||
Disables normal stealth generation
|
||||
Hold <left> to generate stealth, or hold <right> to toss the bomb without generating stealth
|
||||
Tosses a smart bomb that locks onto and tracks targets
|
||||
If no target is found it will return to you
|
||||
Each bomb creates a miniature supernova that drags in weak enemies and chases strong enemies
|
||||
|
||||
@@ -290,6 +290,7 @@ Stormfrontspark.DisplayName: Stormfront Spark
|
||||
SubductionFlameburst.DisplayName: Flame Pillar
|
||||
SubductionSlicerProj.DisplayName: Subduction Slicer
|
||||
SulphuricNukesplosion.DisplayName: Nuke
|
||||
SupernovaHoldout.DisplayName: Supernova
|
||||
SupernovaBomb.DisplayName: Supernova Bomb
|
||||
SupernovaBoom.DisplayName: Micro Supernova
|
||||
SupernovaStealthBoom.DisplayName: Exo Supernova
|
||||
|
||||
@@ -0,0 +1,130 @@
|
||||
using System;
|
||||
using CalamityMod.Items.Weapons.Rogue;
|
||||
using CalamityMod.Particles;
|
||||
using CalamityMod.Projectiles.BaseProjectiles;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Rogue
|
||||
{
|
||||
public class SupernovaHoldout : BaseSwordHoldoutProjectile, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Rogue";
|
||||
public override string Texture => "CalamityMod/Items/Weapons/Rogue/Supernova";
|
||||
public override bool useMeleeSpeed => false;
|
||||
public override bool useMeleeSize => false;
|
||||
public override int swingWidth => 180;
|
||||
public override Item BaseItem => ModContent.GetModItem(ModContent.ItemType<Supernova>()).Item;
|
||||
public override int AfterImageLength => 0;
|
||||
|
||||
public override int StartupTime { get; set; }
|
||||
public override int CooldownTime { get; set; }
|
||||
|
||||
int explodeTimer = 0;
|
||||
|
||||
public override void Defaults()
|
||||
{
|
||||
Projectile.width = 106;
|
||||
Projectile.height = 112;
|
||||
Projectile.MaxUpdates = 4;
|
||||
Projectile.noEnchantmentVisuals = true;
|
||||
Projectile.DamageType = RogueDamageClass.Instance;
|
||||
Projectile.ContinuouslyUpdateDamageStats = true;
|
||||
}
|
||||
|
||||
public Color randomColor => Main.rand.Next(4) switch
|
||||
{
|
||||
0 => Color.Red,
|
||||
1 => Color.MediumTurquoise,
|
||||
2 => Color.Orange,
|
||||
_ => Color.LawnGreen,
|
||||
};
|
||||
public override void Spawn()
|
||||
{
|
||||
var player = Main.player[Projectile.owner];
|
||||
var modplayer = player.GetModPlayer<BaseSwordHoldoutPlayer>();
|
||||
StartupTime = 50;
|
||||
CooldownTime = 10;
|
||||
swingTime -= StartupTime + CooldownTime;
|
||||
OffsetDistance = 48;
|
||||
modplayer.swingNum = 0;
|
||||
RotateInStartup = 1;
|
||||
Projectile.scale = 0.4f;
|
||||
}
|
||||
|
||||
public override void AdditionalAI()
|
||||
{
|
||||
Lighting.AddLight(Projectile.Center, new Vector3(1, 1, 1));
|
||||
var player = Main.player[Projectile.owner];
|
||||
var cplayer = player.Calamity();
|
||||
if (Projectile.Opacity > 0)
|
||||
{
|
||||
cplayer.temporaryStealthMax = 1.3f;
|
||||
cplayer.temporaryStealthTimer = 2;
|
||||
}
|
||||
|
||||
var avgStealth = 0.8f * cplayer.stealthGenMoving + 0.2f * cplayer.stealthGenStandstill;
|
||||
var explodeTimeGoal = CalamityUtils.SecondsToFrames(Supernova.StealthTimeInSeconds) / avgStealth + 30;
|
||||
var stealthTime = explodeTimeGoal - 30;
|
||||
|
||||
|
||||
cplayer.rogueStealth = Projectile.Opacity <= 0 ? 0 : Math.Max(cplayer.temporaryStealthMax, cplayer.rogueStealthMax) * MathHelper.Clamp(explodeTimer / stealthTime, 0f, 1f);
|
||||
|
||||
if (player.channel && inStartup)
|
||||
{
|
||||
|
||||
if (timer >= StartupTime - 1)
|
||||
{
|
||||
if (Projectile.FinalExtraUpdate() && explodeTimer < explodeTimeGoal)
|
||||
explodeTimer++;
|
||||
timer--;
|
||||
Projectile.timeLeft++;
|
||||
}
|
||||
}
|
||||
if (explodeTimer >= explodeTimeGoal && inCooldown && !Projectile.FinalExtraUpdate())
|
||||
{
|
||||
timer--;
|
||||
Projectile.timeLeft++;
|
||||
}
|
||||
|
||||
if (inSwing)
|
||||
{
|
||||
if (swingTimer == (int)(swingTime * 0.75f))
|
||||
{
|
||||
if (Projectile.owner == Main.myPlayer && Projectile.Opacity > 0)
|
||||
{
|
||||
var p = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, angle * -16 * cplayer.rogueVelocity, ModContent.ProjectileType<SupernovaBomb>(), Projectile.damage, Projectile.knockBack, Projectile.owner);
|
||||
if (player.Calamity().StealthStrikeAvailable())
|
||||
{
|
||||
p.Calamity().stealthStrike = true;
|
||||
}
|
||||
}
|
||||
Projectile.Opacity = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override float SwingFunction()
|
||||
{
|
||||
if (inStartup)
|
||||
{
|
||||
return MathHelper.ToRadians(MathHelper.SmoothStep(swingWidth * -0.2f, swingWidth * -0.5f, StartupCompletion));
|
||||
}
|
||||
if (inCooldown)
|
||||
return MathHelper.ToRadians(MathHelper.Lerp(swingWidth * 0.2f, swingWidth * 0.33f, 1 - MathF.Pow(1 - CooldownCompletion, 3f)));
|
||||
return MathHelper.ToRadians(MathHelper.SmoothStep(swingWidth * -0.7f, swingWidth * 0.2f, SwingCompletion));
|
||||
}
|
||||
|
||||
public override bool? CanHitNPC(NPC target)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public override bool CanHitPlayer(Player target)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user