This commit is contained in:
mountaindrew10 committed 2024-02-18 11:07:16 -06:00
commit c87d626b52
101 files changed
+1663 -882

No files matched your search

+6
View File
@@ -191,6 +191,9 @@ namespace CalamityMod.Balancing
// 40% resist to Flying Dragon.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.RavagerIDs, Do(new ProjectileResistBalancingRule(0.6f, ProjectileID.DD2SquireSonicBoom))));
// 30% resist to Flak Kraken.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.RavagerIDs, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType<FlakKrakenProjectile>()))));
// 30% resist to Aurora Blazer.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.RavagerIDs, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType<AuroraFire>()))));
#endregion
@@ -235,6 +238,9 @@ namespace CalamityMod.Balancing
// 60% resist to Aurora Blazer.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AstrumDeusIDs, Do(new ProjectileResistBalancingRule(0.4f, ProjectileType<AuroraFire>()))));
// 55% resist to Flak Kraken.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AstrumDeusIDs, Do(new ProjectileResistBalancingRule(0.45f, ProjectileType<FlakKrakenProjectile>()))));
// 50% resist to true melee.
NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AstrumDeusIDs, Do(ResistTrueMelee(0.5f))));
+87 -44
View File
@@ -2,6 +2,7 @@
{
public static class BalancingConstants
{
#region Movement
// When the relevant config is enabled: Gives the player a substantial +50% move speed boost at all times
internal static readonly float DefaultMoveSpeedBoost = 0.5f;
@@ -15,13 +16,9 @@
// Altered jump speed boost provided by Shiny Red Balloon via IL edit
// This is a const because it replaces a hardcoded value in vanilla
internal const float BalloonJumpSpeedBoost = 0.75f;
#endregion
// Altered default damage deviation
internal const int NewDefaultDamageVariationPercent = 5;
// Sharpening Station grants this much armor penetration to melee weapons.
internal const float SharpeningStationArmorPenetration = 5f;
#region Dashes and Dodges
// Dash cooldowns (in frames)
internal const int UniversalDashCooldown = 30;
internal const int UniversalShieldSlamCooldown = 30;
@@ -42,8 +39,23 @@
internal static readonly int MirrorDodgeCooldown = 5400;
internal static readonly int DaedalusReflectCooldown = 5400;
internal static readonly int EvolutionReflectCooldown = 5400;
#endregion
// Internal vanilla item damage variables
#region Damage
// Altered default damage deviation
internal const int NewDefaultDamageVariationPercent = 5;
// Summoner cross class nerf
internal static readonly float SummonerCrossClassNerf = 0.75f;
// Summon damage bonuses counting less towards "scales with your best class"
internal static readonly float SummonAllClassScalingFactor = 0.75f;
// Minimum and maximum allowed attack speed ratios when using Calamity Global Item Tweaks
internal static readonly float MinimumAllowedAttackSpeed = 0.25f;
internal static readonly float MaximumAllowedAttackSpeed = 10f;
// Internal vanilla whip damage variables
internal static readonly float LeatherWhipTagDamageMultiplier = 1.08f;
internal static readonly float SnapthornTagDamageMultiplier = 1.04f;
internal static readonly float SpinalTapTagDamageMultiplier = 1.08f;
@@ -53,10 +65,21 @@
internal static readonly float MorningStarTagDamageMultiplier = 1.11f;
internal static readonly float KaleidoscopeTagDamageMultiplier = 1.12f;
// Summoner cross class nerf
internal static readonly float SummonerCrossClassNerf = 0.75f;
// Sharpening Station grants this much armor penetration to melee weapons.
internal const float SharpeningStationArmorPenetration = 5f;
// Rogue stealth
// Beetle Scale Mail stats
internal static readonly float BeetleScaleMailMeleeDamagePerBeetle = 0.1f;
internal static readonly float BeetleScaleMailMeleeSpeedPerBeetle = 0.05f;
// Nebula Armor Damage Booster
internal static readonly float NebulaDamagePerBooster = 0.075f; // 0.15f in vanilla
// Nebula Armor Mana Booster
// nothing here yet
#endregion
#region Rogue Base Stats
// If stealth is too weak, increase this number. If stealth is too strong, decrease this number.
// This value is intentionally not readonly.
public static double UniversalStealthStrikeDamageFactor = 0.42;
@@ -67,37 +90,32 @@
internal static readonly float BaseStealthGenTime = 4f; // 4 seconds
internal static readonly float MovingStealthGenRatio = 0.5f;
#endregion
// Rage
internal static readonly int DefaultRageDuration = CalamityUtils.SecondsToFrames(9); // Rage lasts 9 seconds by default.
internal static readonly int RageDurationPerBooster = CalamityUtils.SecondsToFrames(1); // Each booster is +1 second: 10, 11, 12.
internal static readonly int RageCombatDelayTime = CalamityUtils.SecondsToFrames(10);
internal static readonly int RageFadeTime = CalamityUtils.SecondsToFrames(30);
internal static readonly float DefaultRageDamageBoost = 0.35f; // +35%
#region Defense, Health and Mana (Armor set stuff)
// Beetle Shell's multiplicative DR is removed by Calamity. In compensation, you get this much regular DR per beetle.
internal static readonly float BeetleShellDRPerBeetle = 0.1f;
// Proximity Rage
// These variables should be used in general to classify "enemies" vs "non-enemies" as well.
// See NPCUtils.IsAnEnemy
internal const int TinyHealthThreshold = 5;
internal const int TinyDamageThreshold = 5;
// If an enemy has more health than this, they are considered an enemy even if they have 0 contact damage
internal const int NoContactDamageHealthThreshold = 3000;
internal const int UnreasonableHealthThreshold = 25000000; // 25 million
// Solar Flare Armor's multiplicative DR is removed by Calamity. In compensation, you get this much DR from having at least one solar shield up.
internal static readonly float SolarFlareShieldDR = 0.25f;
// Adrenaline
internal static readonly float AdrenalineDamageBoost = 2f; // +200%
internal static readonly float AdrenalineDamagePerBooster = 0.15f; // +15%
internal static readonly float FullAdrenalineDR = 0.5f; // 50%
internal static readonly float AdrenalineDRPerBooster = 0.05f; // +5% per booster
// Nebula Armor Life Regen
internal static readonly int NebulaLifeRegenPerBooster = 4; // 6 in vanilla
// Summon damage bonuses counting less towards "scales with your best class"
internal static readonly float SummonAllClassScalingFactor = 0.75f;
// Nebula Armor Mana Regen
// This value works differently than you might expect. Raising it actually nerfs the mana regeneration of Nebula Armor
// Every frame, Terraria adds 1 to a counter for each Mana Booster the player has.
// If this counter reaches the below threshold, that player gains 1 mana.
// By default, it's 6, which has the following effects:
// 1 booster = +1 mana every 6 frames = +10 mana per second
// 2 boosters = +1 mana every 3 frames = +20 mana per second
// 3 boosters = +1 mana every 2 frames = +30 mana per second
//
// Calamity just halves this, that's probably good enough.
internal static readonly int NebulaManaRegenFrameCounterThreshold = 12; // 6 in vanilla
#endregion
// Minimum and maximum allowed attack speed ratios when using Calamity Global Item Tweaks
internal static readonly float MinimumAllowedAttackSpeed = 0.25f;
internal static readonly float MaximumAllowedAttackSpeed = 10f;
// Defense Damage
#region Defense Damage
internal const double DefaultDefenseDamageRatio = 0.3333;
// Defense damage floor: PHM | HM | PML
@@ -107,15 +125,40 @@
// Death Mode: 5 | 12 | 24
// Boss Rush: 25
internal static readonly int DefenseDamageFloor_NormalPHM = 3;
internal static readonly int DefenseDamageFloor_NormalHM = 8;
internal static readonly int DefenseDamageFloor_NormalHM = 8;
internal static readonly int DefenseDamageFloor_NormalPML = 16;
internal static readonly int DefenseDamageFloor_RevPHM = 4;
internal static readonly int DefenseDamageFloor_RevHM = 10;
internal static readonly int DefenseDamageFloor_RevPML = 20;
internal static readonly int DefenseDamageFloor_DeathPHM = 5;
internal static readonly int DefenseDamageFloor_DeathHM = 12;
internal static readonly int DefenseDamageFloor_DeathPML = 24;
internal static readonly int DefenseDamageFloor_BossRush = 25;
internal static readonly int DefenseDamageFloor_RevPHM = 4;
internal static readonly int DefenseDamageFloor_RevHM = 10;
internal static readonly int DefenseDamageFloor_RevPML = 20;
internal static readonly int DefenseDamageFloor_DeathPHM = 5;
internal static readonly int DefenseDamageFloor_DeathHM = 12;
internal static readonly int DefenseDamageFloor_DeathPML = 24;
internal static readonly int DefenseDamageFloor_BossRush = 25;
#endregion
#region Rage and Adrenaline (Rippers)
internal static readonly int DefaultRageDuration = CalamityUtils.SecondsToFrames(9); // Rage lasts 9 seconds by default.
internal static readonly int RageDurationPerBooster = CalamityUtils.SecondsToFrames(1); // Each booster is +1 second: 10, 11, 12.
internal static readonly int RageCombatDelayTime = CalamityUtils.SecondsToFrames(10);
internal static readonly int RageFadeTime = CalamityUtils.SecondsToFrames(30);
internal static readonly float DefaultRageDamageBoost = 0.35f; // +35%
internal static readonly float AdrenalineDamageBoost = 2f; // +200%
internal static readonly float AdrenalineDamagePerBooster = 0.15f; // +15%
internal static readonly float FullAdrenalineDR = 0.5f; // 50%
internal static readonly float AdrenalineDRPerBooster = 0.05f; // +5% per booster
#endregion
// TODO -- NPC classification is not done consistently with predictable thresholds.
// These variables should be used in general to classify "enemies" vs "non-enemies" as well.
// See NPCUtils.IsAnEnemy
#region NPC Classification
internal const int TinyHealthThreshold = 5;
internal const int TinyDamageThreshold = 5;
// If an enemy has more health than this, they are considered an enemy even if they have 0 contact damage
internal const int NoContactDamageHealthThreshold = 3000;
internal const int UnreasonableHealthThreshold = 25000000; // 25 million
#endregion
// TODO -- Add all balance related constants here that don't belong in other files.
// Review all constants and static readonlys in the entire mod to find things to add.
+16 -17
View File
@@ -1,6 +1,6 @@
using CalamityMod.Buffs.StatDebuffs;
using CalamityMod.Balancing;
using CalamityMod.Buffs.StatDebuffs;
using CalamityMod.NPCs;
using System.Text;
using Terraria;
using Terraria.ID;
using Terraria.Localization;
@@ -73,11 +73,22 @@ namespace CalamityMod.Buffs
{
player.endurance -= 0.1f;
}
else if (type >= BuffID.NebulaUpDmg1 && type <= BuffID.NebulaUpDmg3)
// Beetle Shell DR is a full compensation, as the vanilla multiplicative DR is removed entirely.
else if (type >= BuffID.BeetleEndurance1 && type <= BuffID.BeetleEndurance3 && player.beetleDefense)
{
float nebulaDamage = 0.075f * player.nebulaLevelDamage; // 15% to 45% changed to 7.5% to 22.5%
player.GetDamage<GenericDamageClass>() -= nebulaDamage;
int orbsToGrant = player.beetleOrbs < 0 ? 0 : player.beetleOrbs;
if (orbsToGrant > 3)
orbsToGrant = 3;
player.endurance += BalancingConstants.BeetleShellDRPerBeetle * orbsToGrant;
}
// Solar Flare DR is a full compensation, as the vanilla multiplicative DR is removed entirely.
else if (type >= BuffID.SolarShield1 && type <= BuffID.SolarShield3)
{
player.endurance += BalancingConstants.SolarFlareShieldDR;
}
else if (type == BuffID.Warmth)
{
player.buffImmune[ModContent.BuffType<GlacialState>()] = true;
@@ -88,18 +99,6 @@ namespace CalamityMod.Buffs
{
player.GetDamage<GenericDamageClass>() -= 0.2f;
}
else if (type == BuffID.BeetleMight1)
{
player.GetAttackSpeed<MeleeDamageClass>() -= 0.05f;
}
else if (type == BuffID.BeetleMight2)
{
player.GetAttackSpeed<MeleeDamageClass>() -= 0.1f;
}
else if (type == BuffID.BeetleMight3)
{
player.GetAttackSpeed<MeleeDamageClass>() -= 0.15f;
}
}
public override void Update(int type, NPC npc, ref int buffIndex)
+1 -3
View File
@@ -30,7 +30,6 @@ using CalamityMod.Items.TreasureBags.MiscGrabBags;
using CalamityMod.Items.VanillaArmorChanges;
using CalamityMod.Items.Weapons.DraedonsArsenal;
using CalamityMod.Items.Weapons.Melee;
using CalamityMod.Items.Weapons.Ranged;
using CalamityMod.Items.Weapons.Rogue;
using CalamityMod.Items.Weapons.Summon;
using CalamityMod.NPCs;
@@ -192,7 +191,6 @@ namespace CalamityMod.CalPlayer
public int StellarHammer = 0;
public int GalaxyHammer = 0;
public int hideOfDeusMeleeBoostTimer = 0;
public int nebulaManaNerfCounter = 0;
public int alcoholPoisonLevel = 0;
public int modStealthTimer;
public int dashTimeMod;
@@ -4043,7 +4041,7 @@ namespace CalamityMod.CalPlayer
Vector2 startingPosition = Main.MouseWorld - Vector2.UnitY.RotatedByRandom(0.4f) * 1250f;
Vector2 directionToMouse = (Main.MouseWorld - startingPosition).SafeNormalize(Vector2.UnitY).RotatedByRandom(0.1f);
int drop = Projectile.NewProjectile(source, startingPosition, directionToMouse * 15f, ModContent.ProjectileType<ToxicannonDrop>(), d, 0f, Player.whoAmI);
int drop = Projectile.NewProjectile(source, startingPosition, directionToMouse * 15f, ModContent.ProjectileType<FlakToxicannonHoldout>(), d, 0f, Player.whoAmI);
if (drop.WithinBounds(Main.maxProjectiles))
{
Main.projectile[drop].penetrate = 2;
-5
View File
@@ -1582,11 +1582,6 @@ namespace CalamityMod.CalPlayer
if (enraged) // Demonshade Enrage increases incoming damage by 25%.
damageMult += 0.25;
// Add 5% damage multiplier for each Beetle Shell beetle that is active, thus reducing the DR from 10% to 5% per stack.
// TODO -- Remove this when the new DR scaling system is implemented.
if (Player.beetleDefense && Player.beetleOrbs > 0)
damageMult += 0.05 * Player.beetleOrbs;
modifiers.SourceDamage *= (float)damageMult;
#endregion
+3 -4
View File
@@ -264,6 +264,7 @@ namespace CalamityMod.CalPlayer
if (alcoholPoisonLevel > (cirrusDress ? 5 : 3))
{
// Independently of Calamity's nerfs to Nebula life regen, it is disabled entirely by alcohol poisoning.
Player.nebulaLevelLife = 0;
if (Player.whoAmI == Main.myPlayer)
@@ -535,6 +536,8 @@ namespace CalamityMod.CalPlayer
// 3. Air drowning in the Abyss
//
// All forms of overtly disabling life regeneration disable Nebula Life boosters as well.
if (noLifeRegen)
{
Player.nebulaLevelLife = 0;
@@ -646,10 +649,6 @@ namespace CalamityMod.CalPlayer
if (trinketOfChi || chiRegen)
Player.lifeRegen += 2;
// Nebula armor life booster nerf
if (Player.nebulaLevelLife > 0)
Player.lifeRegen -= 2 * Player.nebulaLevelLife;
if (ursaSergeant)
{
if (Player.statLife <= (int)(actualMaxLife * 0.15))
-16
View File
@@ -901,22 +901,6 @@ namespace CalamityMod.CalPlayer
float lifeStealCooldown = BossRushEvent.BossRushActive ? 0.3f : CalamityWorld.death ? 0.25f : CalamityWorld.revenge ? 0.2f : Main.expertMode ? 0.15f : 0.1f;
Player.lifeSteal -= lifeStealCooldown;
// Nebula Armor nerf
if (Player.nebulaLevelMana > 0 && Player.statMana < Player.statManaMax2)
{
int num = 12;
nebulaManaNerfCounter += Player.nebulaLevelMana;
if (nebulaManaNerfCounter >= num)
{
nebulaManaNerfCounter -= num;
Player.statMana--;
if (Player.statMana < 0)
Player.statMana = 0;
}
}
else
nebulaManaNerfCounter = 0;
// Bool for drawing boss health bar small text or not
if (Main.myPlayer == Player.whoAmI)
BossHealthBarManager.CanDrawExtraSmallText = shouldDrawSmallText;
+2 -3
View File
@@ -850,7 +850,7 @@ namespace CalamityMod
ProjectileType<ContagionBow>(),
ProjectileType<DaemonsFlameBow>(),
ProjectileType<DrataliornusBow>(),
ProjectileType<FlakKrakenGun>(),
ProjectileType<FlakKrakenHoldout>(),
ProjectileType<ButcherGun>(),
ProjectileType<StarfleetMK2Gun>(),
ProjectileType<NorfleetCannon>(),
@@ -875,7 +875,7 @@ namespace CalamityMod
ProjectileType<RancorLaserbeam>(),
ProjectileType<NebulousCataclysm_Held>(),
ProjectileType<FlakKrakenProj>(),
ProjectileType<FlakKrakenProjectile>(),
ProjectileType<InfernadoFriendly>(),
ProjectileType<DragonRageStaff>(),
ProjectileType<MurasamaSlash>(),
@@ -2111,7 +2111,6 @@ namespace CalamityMod
ProjectileType<EyeOfNightCell>(),
ProjectileType<FantasyTalismanProj>(),
ProjectileType<FantasyTalismanStealth>(),
ProjectileType<FlakKrakenProj>(),
ProjectileType<GodsParanoiaProj>(),
ProjectileType<InsidiousHarpoon>(),
ProjectileType<JawsProjectile>(),
+142 -3
View File
@@ -1,9 +1,6 @@
using System;
using CalamityMod.Balancing;
using CalamityMod.Items.Accessories;
using CalamityMod.Items.Placeables.FurniturePlagued;
using CalamityMod.Items.Potions;
using CalamityMod.NPCs.DraedonLabThings;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using Terraria;
@@ -418,6 +415,148 @@ namespace CalamityMod.ILEditing
}
#endregion
#region Beetle Scale Mail (DPS chestplate) Nerf
private static void NerfBeetleScaleMail(ILContext il)
{
// Adjust melee damage from the Beetle Might buff.
var cursor = new ILCursor(il);
if (!cursor.TryGotoNext(MoveType.After, i => i.MatchLdcI4(BuffID.BeetleMight1)))
{
LogFailure("Beetle Scale Mail Nerf", "Could not locate the Beetle Might buff ID.");
return;
}
if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdcR4(0.1f))) // The amount of melee damage to grant.
{
LogFailure("Beetle Scale Mail Nerf", "Could not locate the amount of melee damage granted.");
return;
}
// Replace the value entirely.
cursor.Remove();
cursor.Emit(OpCodes.Ldc_R4, BalancingConstants.BeetleScaleMailMeleeDamagePerBeetle);
cursor.GotoNext();
// Adjust melee speed from the Beetle Might buff.
if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdcR4(0.1f))) // The amount of melee speed to grant.
{
LogFailure("Beetle Scale Mail Nerf", "Could not locate the amount of melee speed granted.");
return;
}
// Replace the value entirely.
cursor.Remove();
cursor.Emit(OpCodes.Ldc_R4, BalancingConstants.BeetleScaleMailMeleeSpeedPerBeetle);
}
#endregion
#region Nebula Armor Nerfs
private static void NerfNebulaArmorBaseLifeRegenAndDamage(ILContext il)
{
// Nebula's buffs are processed in the order Mana, Life, Damage
// The mana buff is merely tracked and updated in this function, so it is not IL edited here.
var cursor = new ILCursor(il);
// Adjust life regen from the Nebula Life Boosters.
if (!cursor.TryGotoNext(MoveType.After, i => i.MatchLdcI4(BuffID.NebulaUpLife1)))
{
LogFailure("Nebula Armor Nerf", "Could not locate the Nebula Life buff ID.");
return;
}
if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdfld<Player>("lifeRegen")))
{
LogFailure("Nebula Armor Nerf", "Could not locate the player's life regen being loaded.");
return;
}
if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdcI4(6)))
{
LogFailure("Nebula Armor Nerf", "Could not locate the amount of life regen to grant.");
return;
}
// Replace the constant "load 6" opcode with a regular integer load with Calamity's value.
cursor.Remove();
cursor.Emit(OpCodes.Ldc_I4, BalancingConstants.NebulaLifeRegenPerBooster);
// Adjust damage from Nebula Damage Boosters.
if (!cursor.TryGotoNext(MoveType.After, i => i.MatchLdcI4(BuffID.NebulaUpDmg1)))
{
LogFailure("Nebula Armor Nerf", "Could not locate the Nebula Damage buff ID.");
return;
}
if (!cursor.TryGotoNext(MoveType.AfterLabel, i => i.MatchLdcR4(0.15f)))
{
LogFailure("Nebula Armor Nerf", "Could not locate the amount of damage to grant.");
return;
}
// There are multiple branches pointing to this instruction, so it cannot be removed. Instead, swap its value directly.
cursor.Next.Operand = BalancingConstants.NebulaDamagePerBooster;
}
private static void RemoveNebulaLifeBoosterDoTImmunity(ILContext il)
{
// Prevent Nebula Life Boosters from canceling out all DoT debuff damage.
var cursor = new ILCursor(il);
if (!cursor.TryGotoNext(MoveType.After, i => i.MatchLdfld<Player>("nebulaLevelLife")))
{
LogFailure("Nebula Armor DoT Ignoring Nerf", "Could not locate the Nebula Armor Life Booster variable.");
return;
}
// Pop this value off the stack and replace it with a zero.
// Zero will never be greater than zero, so negative life regen will never be canceled out.
cursor.Emit(OpCodes.Pop);
cursor.Emit(OpCodes.Ldc_I4_0);
}
private static void NerfNebulaArmorManaRegen(ILContext il)
{
// Reduce Nebula armor mana regen.
// The regen is controlled by a frame counter threshold right at the top of the function, typically 6.
// 1 value is added to the counter for every Mana Booster you have.
// If the value reaches the threshold, you gain 1 mana.
// All that needs to be done is raising the threshold, so it takes more frames to get each point of mana.
var cursor = new ILCursor(il);
if (!cursor.TryGotoNext(MoveType.AfterLabel, i => i.MatchLdcI4(6)))
{
LogFailure("Nebula Armor Mana Regen Nerf", "Could not locate the Nebula Armor mana regeneration frame counter threshold.");
return;
}
// Swap the threshold with Calamity's value.
cursor.Next.Operand = BalancingConstants.NebulaManaRegenFrameCounterThreshold;
}
#endregion
#region Remove Melee Armor (Beetle Shell + Solar Flare) Multiplicative DR
private static void RemoveBeetleAndSolarFlareMultiplicativeDR(ILContext il)
{
// Remove the multiplicative DR from Solar Flare armor's Solar Shields
var cursor = new ILCursor(il);
if (!cursor.TryGotoNext(MoveType.After, i => i.MatchLdfld<Player>("setSolar")))
{
LogFailure("Melee Multiplicative DR Removal", "Could not locate the Solar Flare set bonus field.");
return;
}
// AND with 0 (false) so that the Solar Flare set bonus is never considered to be active. This stops the multiplicative DR from applying.
cursor.Emit(OpCodes.Ldc_I4_0);
cursor.Emit(OpCodes.And);
// Remove the multiplicative DR from Beetle Shell's beetles
if (!cursor.TryGotoNext(MoveType.After, i => i.MatchLdfld<Player>("beetleDefense")))
{
LogFailure("Melee Multiplicative DR Removal", "Could not locate the Beetle Shell set bonus field.");
return;
}
// AND with 0 (false) so that the Beetle Shell set bonus is never considered to be active. This stops the multiplicative DR from applying.
cursor.Emit(OpCodes.Ldc_I4_0);
cursor.Emit(OpCodes.And);
}
#endregion
#region Remove Lunatic Cultist Homing Resist
private static void RemoveLunaticCultistHomingResist(ILContext il)
{
+5 -2
View File
@@ -1,8 +1,6 @@
using System;
using System.Reflection;
using CalamityMod.Graphics.Renderers.CalamityRenderers;
using CalamityMod.Items.Accessories;
using CalamityMod.Items.Armor.LunicCorps;
using CalamityMod.Tiles.DraedonStructures;
using CalamityMod.Tiles.FurnitureExo;
using Terraria;
@@ -98,6 +96,9 @@ namespace CalamityMod.ILEditing
IL_Projectile.AI_001 += AdjustChlorophyteBullets;
IL_Projectile.AI_099_2 += LimitTerrarianProjectiles;
IL_Player.UpdateBuffs += NerfSharpeningStation;
IL_Player.UpdateBuffs += NerfBeetleScaleMail;
IL_Player.UpdateBuffs += NerfNebulaArmorBaseLifeRegenAndDamage;
IL_Player.ApplyVanillaHurtEffectModifiers += RemoveBeetleAndSolarFlareMultiplicativeDR;
// Movement speed balance
IL_Player.UpdateJumpHeight += FixJumpHeightBoosts;
@@ -108,10 +109,12 @@ namespace CalamityMod.ILEditing
// Life regen balance
IL_Player.UpdateLifeRegen += PreventWellFedFromBeingRequiredInExpertModeForFullLifeRegen;
IL_Player.UpdateLifeRegen += RemoveNebulaLifeBoosterDoTImmunity;
// Mana regen balance
IL_Player.Update += ManaRegenDelayAdjustment;
IL_Player.UpdateManaRegen += ManaRegenAdjustment;
IL_Player.UpdateManaRegen += NerfNebulaArmorManaRegen;
// Debuff balancing
IL_Projectile.StatusPlayer += RemoveFrozenInflictionFromDeerclopsIceSpikes;
+7 -8
View File
@@ -1,12 +1,12 @@
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Buffs.Potions;
using System;
using System.IO;
using CalamityMod.Buffs.StatBuffs;
using CalamityMod.Buffs.StatDebuffs;
using CalamityMod.CalPlayer;
using CalamityMod.Enums;
using CalamityMod.Events;
using CalamityMod.Items.Accessories;
using CalamityMod.Items.Placeables;
using CalamityMod.Items.Potions;
using CalamityMod.Items.VanillaArmorChanges;
using CalamityMod.Items.Weapons.Melee;
using CalamityMod.Items.Weapons.Summon;
@@ -25,9 +25,6 @@ using CalamityMod.UI.CalamitasEnchants;
using CalamityMod.World;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using System.IO;
using CalamityMod.Buffs.StatDebuffs;
using Terraria;
using Terraria.Audio;
using Terraria.DataStructures;
@@ -36,7 +33,6 @@ using Terraria.ID;
using Terraria.ModLoader;
using Terraria.ModLoader.IO;
using Terraria.Utilities;
using CalamityMod.Items.Potions.Alcohol;
namespace CalamityMod.Items
{
@@ -1036,7 +1032,10 @@ namespace CalamityMod.Items
}
else if (set == "SolarFlare")
{
player.endurance *= 0.8928f; // Removes the base 12% DR
// Cancel out the base 12% DR
player.endurance -= 0.12f;
// Solar Flare armor dash overrides modded dashes by default
if (player.solarShields > 0)
modPlayer.DashID = string.Empty;
}
+23 -24
View File
@@ -81,20 +81,20 @@ namespace CalamityMod.Items
{ ItemID.CrystalStorm, Do(DamageExact(40)) },
{ ItemID.CursedArrow, Do(DamageExact(15)) },
{ ItemID.CursedDart, Do(DamageExact(25)) },
{ ItemID.Cutlass, Do(UseRatio(0.9f), DamageRatio(1.85f)) },
{ ItemID.Cutlass, Do(UseRatio(0.9f), DamageExact(90)) },
{ ItemID.DaedalusStormbow, Do(DamageExact(30)) },
{ ItemID.DaoofPow, Do(DamageExact(160)) },
{ ItemID.DarkLance, Do(AutoReuse, TrueMelee, DamageExact(45)) },
{ ItemID.DartRifle, Do(PointBlank, DamageExact(58)) },
{ ItemID.DayBreak, Do(DamageExact(125), UseExact(20)) },
{ ItemID.DD2BetsyBow, Do(DamageRatio(1.1f)) }, // Aerial Bane's ridiculous multiplier is removed, so this compensates for that
{ ItemID.DD2BetsyBow, Do(DamageExact(42)) }, // Aerial Bane's ridiculous multiplier is removed, so this compensates for that
{ ItemID.DD2SquireBetsySword, Do(UseMeleeSpeed, DamageExact(150)) }, // Flying Dragon
{ ItemID.DD2SquireDemonSword, Do(DamageExact(110), UseExact(25)) }, // Brand of the Inferno
{ ItemID.DeathSickle, Do(UseMeleeSpeed, DamageExact(82), ShootSpeedExact(15f)) },
{ ItemID.DemonBow, Do(PointBlank, DamageExact(12), AutoReuse) },
{ ItemID.DemonScythe, Do(AutoReuse, DamageExact(33)) },
{ ItemID.DyeTradersScimitar, Do(AutoReuse, UseTurn, DamageExact(24)) }, // Exotic Scimitar
{ ItemID.ElectrosphereLauncher, Do(DamageRatio(1.1f)) },
{ ItemID.ElectrosphereLauncher, Do(DamageExact(44)) },
{ ItemID.ElfMelter, Do(ShootSpeedDelta(+5f)) },
{ ItemID.EmeraldStaff, Do(DamageExact(27)) },
{ ItemID.EmpressBlade, Do(AutoReuse, DamageExact(60), UseExact(20)) }, // Terraprisma
@@ -108,7 +108,7 @@ namespace CalamityMod.Items
// { ItemID.FireworksLauncher, Do(DamageRatio(2f)) }, // Celebration
{ ItemID.Flairon, Do(DamageExact(73)) },
{ ItemID.Flamarang, Do(DamageExact(40)) },
{ ItemID.Flamelash, Do(DamageRatio(1.25f)) },
{ ItemID.Flamelash, Do(DamageExact(40)) },
{ ItemID.Flamethrower, Do(DamageExact(21), ShootSpeedDelta(+3f)) },
{ ItemID.FlowerofFire, Do(AutoReuse, ManaExact(7), UseRatio(0.88f), DamageRatio(0.65f)) }, // Uses ratios due to remix seed
{ ItemID.FlowerofFrost, Do(AutoReuse, ManaExact(7), UseExact(22), DamageExact(70), ShootSpeedExact(14)) },
@@ -122,7 +122,7 @@ namespace CalamityMod.Items
{ ItemID.Gradient, Do(AutoReuse, DamageExact(39)) },
{ ItemID.GreenPhaseblade, Do(AutoReuse, UseTurn, DamageExact(32)) },
{ ItemID.GreenPhasesaber, Do(ScaleRatio(1.5f), DamageExact(60)) },
{ ItemID.GrenadeLauncher, Do(DamageRatio(1.5f)) },
{ ItemID.GrenadeLauncher, Do(DamageExact(90)) },
{ ItemID.Gungnir, Do(AutoReuse, TrueMelee, UseRatio(0.8f), DamageExact(92), ShootSpeedRatio(1.25f)) },
{ ItemID.HallowedRepeater, Do(PointBlank, UseExact(12)) },
{ ItemID.Handgun, Do(PointBlank, UseExact(22), DamageExact(36)) },
@@ -136,7 +136,7 @@ namespace CalamityMod.Items
{ ItemID.IceSickle, Do(AutoReuse, UseMeleeSpeed, DamageExact(75), ShootSpeedExact(20f)) },
{ ItemID.IchorArrow, Do(DamageExact(11)) },
{ ItemID.ImpStaff, Do(AutoReuse, UseExact(30), DamageExact(25)) },
{ ItemID.InfernoFork, Do(DamageRatio(1.2f)) },
{ ItemID.InfernoFork, Do(DamageExact(84)) },
{ ItemID.InfluxWaver, Do(UseMeleeSpeed, DamageExact(80), UseExact(25)) },
{ ItemID.IronShortsword, Do(AutoReuse, TrueMelee, DamageExact(10)) },
{ ItemID.JestersArrow, Do(DamageExact(6)) },
@@ -147,21 +147,21 @@ namespace CalamityMod.Items
{ ItemID.LastPrism, Do(DamageExact(57), ManaExact(10)) },
{ ItemID.LeadShortsword, Do(AutoReuse, TrueMelee, DamageExact(11)) },
{ ItemID.LightDisc, Do(DamageExact(128), ShootSpeedExact(18)) },
{ ItemID.LunarFlareBook, Do(DamageRatio(1.2f)) },
{ ItemID.LunarFlareBook, Do(DamageExact(120)) },
{ ItemID.MagicalHarp, Do(DamageExact(50), ShootSpeedExact(12f)) },
{ ItemID.MagicDagger, Do(DamageRatio(1.8f), UseRatio(1.88f), ShootSpeedExact(30)) }, // Uses ratios due to remix seed
{ ItemID.MagicMissile, Do(DamageExact(23), ManaExact(10), UseAnimationExact(20), UseTimeExact(10)) },
{ ItemID.MagnetSphere, Do(DamageRatio(1.1f)) },
{ ItemID.MagnetSphere, Do(DamageExact(52)) },
{ ItemID.Marrow, Do(PointBlank, DamageExact(69)) },
{ ItemID.MedusaHead, Do(ManaExact(6), DamageRatio(1.2f)) },
{ ItemID.Meowmere, Do(UseMeleeSpeed, DamageExact(240)/*, DamageRatio(1.33f) */) },
{ ItemID.MedusaHead, Do(ManaExact(6), DamageExact(48)) },
{ ItemID.Meowmere, Do(UseMeleeSpeed, DamageExact(240)) },
{ ItemID.MeteorStaff, Do(DamageExact(58), ManaExact(7), ShootSpeedExact(13f)) },
{ ItemID.MiniNukeI, Do(DamageExact(90)) },
{ ItemID.MiniNukeII, Do(DamageExact(90)) },
{ ItemID.Minishark, Do(PointBlank, DamageExact(4)) },
{ ItemID.MoltenFury, Do(PointBlank, UseExact(29), AutoReuse) },
{ ItemID.MonkStaffT1, Do(TrueMeleeNoSpeed, DamageExact(83)) }, // Sleepy Octopod
{ ItemID.MonkStaffT2, Do(AutoReuse, TrueMelee, DamageRatio(2f)) }, // Ghastly Glaive
{ ItemID.MonkStaffT2, Do(AutoReuse, TrueMelee, DamageExact(90)) }, // Ghastly Glaive
{ ItemID.MonkStaffT3, Do(DamageExact(225)) }, // Sky Dragon's Fury
{ ItemID.Muramasa, Do(CritDelta(+20)) },
{ ItemID.MushroomSpear, Do(AutoReuse, TrueMelee, UseRatio(0.8f), DamageExact(100)) },
@@ -182,8 +182,8 @@ namespace CalamityMod.Items
{ ItemID.PalladiumPike, Do(AutoReuse, TrueMelee, UseRatio(0.8f), DamageExact(96)) },
{ ItemID.PalladiumRepeater, Do(PointBlank, DamageExact(45)) },
{ ItemID.PalladiumSword, Do(UseTurn, ScaleRatio(1.4f), DamageExact(100)) },
{ ItemID.PearlwoodBow, Do(AutoReuse, PointBlank, DamageRatio(2.31f), UseDelta(+8), ShootSpeedDelta(+3.4f), KnockbackDelta(+1f)) },
{ ItemID.PearlwoodSword, Do(UseTurn, DamageRatio(1.5f)) },
{ ItemID.PearlwoodBow, Do(AutoReuse, PointBlank, DamageExact(20), UseDelta(+8), ShootSpeedDelta(+3.4f), KnockbackDelta(+1f)) },
{ ItemID.PearlwoodSword, Do(UseTurn, DamageExact(45)) },
{ ItemID.PewMaticHorn, Do(DamageExact(24)) },
{ ItemID.Phantasm, Do(PointBlank, DamageExact(48)) },
{ ItemID.PhoenixBlaster, Do(AutoReuse, PointBlank, UseExact(18)) },
@@ -192,7 +192,7 @@ namespace CalamityMod.Items
{ ItemID.PlatinumShortsword, Do(AutoReuse, TrueMelee, DamageExact(18)) },
{ ItemID.PoisonStaff, Do(DamageExact(57)) },
{ ItemID.PossessedHatchet, Do(DamageExact(135)) },
{ ItemID.PsychoKnife, Do(UseTurn, UseExact(11), DamageRatio(3f)) },
{ ItemID.PsychoKnife, Do(UseTurn, UseExact(11), DamageExact(255)) },
{ ItemID.PurpleClubberfish, Do(UseTurn, ScaleRatio(1.2f), KnockbackExact(10f)) },
{ ItemID.PurplePhaseblade, Do(AutoReuse, UseTurn, DamageExact(32)) },
{ ItemID.PurplePhasesaber, Do(ScaleRatio(1.5f), DamageExact(60)) },
@@ -224,21 +224,20 @@ namespace CalamityMod.Items
{ ItemID.SkyFracture, Do(DamageExact(54), ShootSpeedExact(30f)) },
{ ItemID.SlapHand, Do(UseTurn, ScaleRatio(1.5f), DamageExact(120)) },
{ ItemID.Smolstar, Do(DamageExact(9), AutoReuse, UseExact(25)) }, // Blade Staff
{ ItemID.SolarEruption, Do(DamageRatio(1.5f)) },
// Life Drain could probably get a bigger buff
{ ItemID.SoulDrain, Do(DamageRatio(1.1f)) }, // Life Drain
{ ItemID.SolarEruption, Do(DamageExact(157)) },
{ ItemID.SoulDrain, Do(DamageExact(38)) }, // Life Drain
{ ItemID.SpaceGun, Do(DamageExact(25)) },
{ ItemID.Spear, Do(AutoReuse, TrueMelee, DamageExact(14)) },
{ ItemID.SpectreStaff, Do(DamageRatio(1.2f)) },
{ ItemID.SpectreStaff, Do(DamageExact(78)) },
{ ItemID.SpiritFlame, Do(UseExact(20), ManaExact(11), ShootSpeedExact(2f)) },
{ ItemID.StaffofEarth, Do(DamageRatio(1.2f)) },
{ ItemID.StaffofEarth, Do(DamageExact(150)) },
{ ItemID.StarCannon, Do(DamageExact(25)) },
{ ItemID.StardustDragonStaff, Do(AutoReuse, DamageExact(20), UseExact(19)) },
{ ItemID.StormTigerStaff, Do(AutoReuse, DamageExact(49), UseExact(20)) }, // Desert Tiger Staff
{ ItemID.StylistKilLaKillScissorsIWish, Do(AutoReuse, UseTurn, DamageExact(18)) }, // Stylish Scissors
{ ItemID.Stynger, Do(DamageExact(75)) },
{ ItemID.Swordfish, Do(AutoReuse, TrueMelee, DamageExact(24)) },
{ ItemID.TacticalShotgun, Do(PointBlank, DamageRatio(1.2f)) },
{ ItemID.TacticalShotgun, Do(PointBlank, DamageExact(34)) },
{ ItemID.TaxCollectorsStickOfDoom, Do(AutoReuse, UseTurn, ScaleRatio(1.5f), UseRatio(0.8f), DamageExact(70)) },
{ ItemID.TendonBow, Do(PointBlank, DamageExact(17), AutoReuse) },
{ ItemID.TerraBlade, Do(DamageExact(122)) },
@@ -264,14 +263,14 @@ namespace CalamityMod.Items
{ ItemID.TungstenShortsword, Do(AutoReuse, TrueMelee, DamageExact(15)) },
{ ItemID.UnholyArrow, Do(DamageExact(11)) },
{ ItemID.UnholyTrident, Do(ManaRatio(0.78f), DamageRatio(0.91f)) }, // Uses ratios due to remix seed
{ ItemID.VampireKnives, Do(DamageRatio(1.33f)) },
{ ItemID.VampireKnives, Do(DamageExact(38)) },
{ ItemID.ValkyrieYoyo, Do(AutoReuse, DamageExact(48)) }, // Red's Throw and Valkyrie Yoyo are the same weapon basically
{ ItemID.VenomStaff, Do(DamageRatio(1.25f)) },
{ ItemID.VenomStaff, Do(DamageExact(55)) },
{ ItemID.WaspGun, Do(UseExact(11), DamageExact(58)) },
{ ItemID.WaterBolt, Do(DamageExact(23)) },
{ ItemID.WhitePhaseblade, Do(AutoReuse, UseTurn, DamageExact(32)) },
{ ItemID.WhitePhasesaber, Do(ScaleRatio(1.5f), DamageExact(60)) },
{ ItemID.WoodenBoomerang, Do(DamageRatio(2f), Value(Item.sellPrice(copper: 20))) },
{ ItemID.WoodenBoomerang, Do(DamageExact(16), Value(Item.sellPrice(copper: 20))) },
{ ItemID.Yelets, Do(AutoReuse, DamageExact(53)) },
{ ItemID.YellowPhaseblade, Do(AutoReuse, UseTurn, DamageExact(32)) },
{ ItemID.YellowPhasesaber, Do(ScaleRatio(1.5f), DamageExact(60)) },
@@ -373,7 +372,7 @@ namespace CalamityMod.Items
{ ItemID.PalladiumPickaxe, Do(PickPower(130), UseTimeExact(9)) },
{ ItemID.PalladiumWaraxe, Do(AxePower(125), UseTimeExact(12), TileBoostExact(+0)) },
{ ItemID.PalmWoodHammer, Do(HammerPower(25), UseTimeExact(11), TileBoostExact(+0)) },
{ ItemID.PearlwoodHammer, Do(HammerPower(25), UseTimeExact(4), UseAnimationExact(20), DamageRatio(4f), TileBoostExact(+0)) },
{ ItemID.PearlwoodHammer, Do(HammerPower(25), UseTimeExact(4), UseAnimationExact(20), DamageExact(36), TileBoostExact(+0)) },
{ ItemID.PickaxeAxe, Do(PickPower(200), AxePower(110), UseTimeExact(7), TileBoostExact(+1)) },
{ ItemID.Picksaw, Do(PickPower(210), AxePower(125), UseTimeExact(6), TileBoostExact(+1)) },
{ ItemID.PlatinumAxe, Do(AxePower(80), UseTimeExact(14), TileBoostExact(+0)) },
@@ -97,10 +97,9 @@ namespace CalamityMod.Items.Placeables.Furniture.DevPaintings
"StipulateVenus",
"Tomat",
"Triangle",
"Uberransy",
"Xyk",
"YuH",
// Former devs
"Afzofa",
"AdipemDragon",
"Akeeli",
@@ -192,7 +191,8 @@ namespace CalamityMod.Items.Placeables.Furniture.DevPaintings
"TikiWiki",
"Tinymanx",
"Trivaxy",
"Uncle Danny",
"Uberransy",
"Uncle Danny",
"Vaikyia",
"Vladimier",
"Yatagarasu",
+2 -1
View File
@@ -15,7 +15,8 @@ namespace CalamityMod.Items.Weapons.Melee
public const float DamagePerHealth = 0.001f; // 0.1 damage per additional health. 100 health = 10% damage.
public new string LocalizationCategory => "Items.Weapons.Melee";
BloomRing ring;
[CloneByReference]
public BloomRing ring;
public override void SetStaticDefaults()
{
+52 -13
View File
@@ -1,39 +1,78 @@
using Terraria.DataStructures;
using CalamityMod.Items.Materials;
using CalamityMod.Items.Materials;
using CalamityMod.Items.Placeables;
using CalamityMod.Projectiles.Ranged;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Audio;
using Terraria.DataStructures;
using Terraria.ID;
using Terraria.ModLoader;
using CalamityMod.Sounds;
namespace CalamityMod.Items.Weapons.Ranged
{
public class FlakKraken : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Weapons.Ranged";
#region Other Stats
public static int OriginalUseTime = 63;
public static float TimeBetweenShots = 21;
public static float ProjectilesPerBurst = 2f;
public static float OwnerKnockbackStrength = 2.5f;
public static float ProjectileGravityStrength = 0.22f;
public static float ProjectileShootSpeed = 25f;
public static float InitialShotDamageMultiplier = 1f;
public static float InitialShotHitShrapnelDamageMultiplier = 0.3f;
public static int ShrapnelAmount = 5;
public static float ShrapnelAngleOffset = MathHelper.PiOver4;
public static int ClusterShrapnelAmount = 8;
public static float ClusterShrapnelAngleOffset = MathHelper.PiOver2 + MathHelper.ToRadians(50f);
#endregion
public override void SetDefaults()
{
Item.damage = 124;
Item.DamageType = DamageClass.Ranged;
Item.useTime = Item.useAnimation = OriginalUseTime;
Item.shoot = ModContent.ProjectileType<FlakKrakenHoldout>();
Item.shootSpeed = 15f;
Item.width = 152;
Item.height = 58;
Item.damage = 88;
Item.DamageType = DamageClass.Ranged;
Item.useTime = 10;
Item.useAnimation = 10;
Item.useStyle = ItemUseStyleID.Shoot;
Item.noMelee = true;
Item.noUseGraphic = true;
Item.channel = true;
Item.knockBack = 0f;
Item.useAmmo = AmmoID.Rocket;
Item.value = CalamityGlobalItem.Rarity7BuyPrice;
Item.rare = ItemRarityID.Lime;
Item.UseSound = CommonCalamitySounds.LaserCannonSound;
Item.shoot = ModContent.ProjectileType<FlakKrakenGun>();
Item.shootSpeed = 30f; //30
Item.useStyle = ItemUseStyleID.Shoot;
Item.UseSound = new SoundStyle("CalamityMod/Sounds/Item/DudFire") with { Volume = .4f, Pitch = -.95f, PitchVariance = 0.1f };
}
public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0;
// Obviously we don't want multiple holdouts existing at the same time.
public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] == 0;
// Spawning the holdout won't consume ammo.
public override bool CanConsumeAmmo(Item ammo, Player player) => player.ownedProjectileCounts[Item.shoot] != 0;
// Makes the rotation of the mouse around the player sync in multiplayer.
public override void HoldItem(Player player) => player.Calamity().mouseWorldListener = true;
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
{
Projectile holdout = Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, ModContent.ProjectileType<FlakKrakenHoldout>(), 0, 0f, player.whoAmI);
// We set the rotation to the direction to the mouse so the first frame doesn't appear bugged out.
holdout.velocity = (player.Calamity().mouseWorld - player.MountedCenter).SafeNormalize(Vector2.Zero);
return false;
}
public override void AddRecipes()
{
+45 -19
View File
@@ -1,7 +1,8 @@
using Terraria.DataStructures;
using CalamityMod.Projectiles.Ranged;
using CalamityMod.Projectiles.Ranged;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Audio;
using Terraria.DataStructures;
using Terraria.ID;
using Terraria.ModLoader;
@@ -10,34 +11,59 @@ namespace CalamityMod.Items.Weapons.Ranged
public class FlakToxicannon : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Weapons.Ranged";
public override void SetStaticDefaults()
{
}
#region Other Stats
public static float OwnerKnockbackStrength = 1.1f;
public static float ProjectileGravityStrength = 0.17f;
public static float ProjectileShootSpeed = 25f;
public static float InitialShotDamageMultiplier = 1f;
public static float InitialShotHitShrapnelDamageMultiplier = .2f;
public static int ShrapnelAmount = 4;
public static float ShrapnelAngleOffset = 0.11f;
public static int ClusterShrapnelAmount = 7;
public static float ClusterShrapnelAngleOffset = 0.53f;
#endregion
public override void SetDefaults()
{
Item.damage = 73; // Here you're modifying the shrapnel's damage.
Item.DamageType = DamageClass.Ranged;
Item.useTime = Item.useAnimation = 44;
Item.shoot = ModContent.ProjectileType<FlakToxicannonHoldout>();
Item.shootSpeed = 15f;
Item.width = 88;
Item.height = 28;
Item.damage = 51;
Item.DamageType = DamageClass.Ranged;
Item.useTime = Item.useAnimation = 11;
Item.useStyle = ItemUseStyleID.Shoot;
Item.useTurn = false;
Item.noMelee = true;
Item.knockBack = 7f;
Item.noUseGraphic = true;
Item.channel = true;
Item.useAmmo = AmmoID.Rocket;
Item.value = CalamityGlobalItem.Rarity5BuyPrice;
Item.rare = ItemRarityID.Pink;
Item.UseSound = SoundID.Item109;
Item.autoReuse = true;
Item.shoot = ModContent.ProjectileType<ToxicannonShot>();
Item.shootSpeed = 16f;
Item.useStyle = ItemUseStyleID.Shoot;
Item.UseSound = new SoundStyle("CalamityMod/Sounds/Item/DudFire") with { Volume = .4f, Pitch = -.7f, PitchVariance = 0.1f };
}
// Obviously we don't want multiple holdouts existing at the same time.
public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] == 0;
// Spawning the holdout won't consume ammo.
public override bool CanConsumeAmmo(Item ammo, Player player) => player.ownedProjectileCounts[Item.shoot] != 0;
// Makes the rotation of the mouse around the player sync in multiplayer.
public override void HoldItem(Player player) => player.Calamity().mouseWorldListener = true;
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
{
float angle = velocity.ToRotation() + MathHelper.PiOver2;
if (angle <= -(MathHelper.Pi / 3) || angle >= (MathHelper.Pi / 3))
return false;
Projectile holdout = Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, ModContent.ProjectileType<FlakToxicannonHoldout>(), 0, 0f, player.whoAmI);
// We set the rotation to the direction to the mouse so the first frame doesn't appear bugged out.
holdout.velocity = (player.Calamity().mouseWorld - player.MountedCenter).SafeNormalize(Vector2.Zero);
Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType<ToxicannonShot>(), damage, knockback, player.whoAmI);
return false;
}
}
@@ -578,7 +578,7 @@ DragonScales: {
Tooltip:
'''
Rogue projectiles create slow fireballs as they travel
Stealth strikes create infernados on death
Stealth strikes create infernados where they hit
+10% max run speed and acceleration
Grants immunity to Dragonfire
'Only a living dragon holds true treasure'
@@ -680,7 +680,7 @@ EtherealExtorter: {
DisplayName: Ethereal Extorter
Tooltip:
'''
Rogue projectiles explode into homing souls on death
Rogue projectiles explode into homing souls on hit
8% increased rogue damage and +5 maximum stealth
'''
}
@@ -47,7 +47,7 @@ BubonicRound: {
ElysianArrow: {
DisplayName: Elysian Arrow
Tooltip: Summons meteors from the sky on death
Tooltip: Summons meteors from the sky on impact
}
FlashRound: {
@@ -332,7 +332,7 @@ FlareBolt: {
ForbiddenSun: {
DisplayName: Forbidden Sun
Tooltip: Casts a fire orb that emits a gigantic explosion on death
Tooltip: Casts a fire orb that emits a gigantic explosion on hit
}
FrigidflashBolt: {
@@ -189,7 +189,7 @@ Brimlance: {
Brimlash: {
DisplayName: Brimlash
Tooltip: Fires a brimstone bolt that explodes into more bolts on death
Tooltip: Fires a brimstone bolt that explodes into more bolts on hit
}
BrimstoneSword: {
@@ -305,7 +305,7 @@ CrescentMoon: {
DarklightGreatsword: {
DisplayName: Darklight Greatsword
Tooltip: Fires darklight blades that split on death
Tooltip: Fires darklight blades that split on impact
}
DeathsAscension: {
@@ -622,7 +622,7 @@ GreatswordofJudgement: {
DisplayName: Greatsword of Judgement
Tooltip:
'''
Fires a white orb that emits white rain on death for a time
Fires a white orb that emits white rain from where it dissipates for a time
A pale white sword from a forgotten land
You can hear faint yet comforting whispers emanating from the blade
'No matter where you may be you are never alone
@@ -847,7 +847,7 @@ Orderbringer: {
DisplayName: Orderbringer
Tooltip:
'''
Fires a rainbow blade that emits rainbow rain on death for a time
Fires a rainbow blade that emits rainbow rain from where it dissipated for a time
A pale white sword from a forgotten land
You can hear faint yet comforting whispers emanating from the blade
'No matter where you may be you are never alone
@@ -988,7 +988,7 @@ SausageMaker: {
ScourgeoftheCosmos: {
DisplayName: Scourge of the Cosmos
Tooltip: Throws a bouncing cosmic scourge that emits tiny homing cosmic scourges on death and tile hits
Tooltip: Throws a bouncing cosmic scourge that emits tiny homing cosmic scourges on enemy and tile hits
}
SeashineSword: {
@@ -1085,7 +1085,7 @@ StormRuler: {
DisplayName: Storm Ruler
Tooltip:
'''
Fires beams that generate tornadoes on death
Fires beams that generate tornadoes where they strike
Tornadoes suck enemies in
'Only a storm can fell a greatwood'
'''
@@ -485,16 +485,21 @@ FirestormCannon: {
FlakKraken: {
DisplayName: Flak Kraken
Tooltip: Fires an energy reticle that becomes more powerful over time
Tooltip:
'''
Fires pairs of abyssal flak shells that explode into wide cones of ink shrapnel
Abyssal flak shells burst when they reach the cursor's position
Direct hits with the flak shell will deal reduced shrapnel damage
'''
}
FlakToxicannon: {
DisplayName: Flak Toxicannon
Tooltip:
'''
Fires angled shots in the direction of the cursor
Can only be shot in a wide cone above the player
'High IQ required'
Fires a toxic shell that explodes into a cone of radioactive sludge
Toxic shells burst when they reach the cursor's position
Direct hits with the toxic shell will reduce the damage dealt by the sludge
'''
}
@@ -537,7 +542,7 @@ FrostbiteBlaster: {
Fungicide: {
DisplayName: Fungicide
Tooltip: Converts musket balls into fungal rounds that split on death
Tooltip: Converts musket balls into fungal rounds that split upon impact
}
Galeforce: {
@@ -699,7 +704,7 @@ Malevolence: {
Tooltip:
'''
Fires two arrows at once
Converts wooden arrows into plague arrows that explode into bees on death
Converts wooden arrows into plague arrows that explode into bees
'''
}
@@ -873,7 +878,7 @@ PearlGod: {
PestilentDefiler: {
DisplayName: Pestilent Defiler
Tooltip: Converts musket balls into plague rounds that explode and split apart on death
Tooltip: Converts musket balls into plague rounds that explode and split apart on hit
}
Phangasm: {
@@ -1094,7 +1099,7 @@ Shroomer: {
SlagMagnum: {
DisplayName: Slag Magnum
Tooltip: Converts musket balls into fossil shards that split into additional shards on death
Tooltip: Converts musket balls into fossil shards that split into additional shards on impact
}
SomaPrime: {
@@ -869,7 +869,7 @@ ProfanedPartisan: {
DisplayName: Profaned Partisan
Tooltip:
'''
Fires an unholy spear that explodes on death
Fires an unholy spear that explodes on enemy hits
Stealth strikes spawn smaller spears to fly along side it
'''
}
@@ -243,3 +243,5 @@ WaterSpout.DisplayName: Spout
WulfrumScrapBullet.DisplayName: High Speed Scrap
DragonsBreathFlames.DisplayName: Draconic Flames
DragonsBreathMag.DisplayName: Dragons Breath Cartridge
FlakKrakenProjectile.DisplayName: Flak Kraken
FlakToxicannonProjectile.DisplayName: Flak Toxicannon
+52
View File
@@ -0,0 +1,52 @@
using Microsoft.Xna.Framework;
using Terraria;
namespace CalamityMod.Particles
{
public class MediumMistParticleAlphaBlend : Particle
{
public override string Texture => "CalamityMod/Particles/MediumSmoke";
public override int FrameVariants => 3;
private float Opacity;
private Color ColorFire;
private Color ColorFade;
private float Spin;
public MediumMistParticleAlphaBlend(Vector2 position, Vector2 velocity, Color colorFire, Color colorFade, float scale, float opacity, float rotationSpeed = 0f)
{
Position = position;
Velocity = velocity;
ColorFire = colorFire;
ColorFade = colorFade;
Scale = scale;
Opacity = opacity;
Rotation = Main.rand.NextFloat(MathHelper.TwoPi);
Spin = rotationSpeed;
Variant = Main.rand.Next(3);
}
public override void Update()
{
Rotation += Spin * ((Velocity.X > 0) ? 1f : -1f);
Velocity *= 0.85f;
if (Opacity > 90)
{
Lighting.AddLight(Position, Color.ToVector3() * 0.1f);
Scale += 0.01f;
Opacity -= 3;
}
else
{
Scale *= 0.975f;
Opacity -= 2;
}
if (Opacity < 0)
Kill();
Color = Color.Lerp(ColorFire, ColorFade, MathHelper.Clamp((float)((255 - Opacity) - 100) / 80, 0f, 1f)) * (Opacity / 255f);
}
}
}
@@ -1,8 +1,8 @@
using CalamityMod.Items;
using System;
using CalamityMod.Items;
using CalamityMod.Items.Weapons.DraedonsArsenal;
using Microsoft.Xna.Framework;
using ReLogic.Utilities;
using System;
using Terraria;
using Terraria.Audio;
using Terraria.Localization;
@@ -68,7 +68,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal
// This grabs the weapon's current damage, taking current charge level into account.
int currentDamage = player.GetWeaponDamage(gatling);
bool stillInUse = player.channel && !player.noItems && !player.CCed;
bool stillInUse = !player.CantUseHoldout();
// This both checks if the player has sufficient mana and consumes it if they do.
// If this is false, the Gatling Laser stops functioning.
@@ -129,7 +129,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal
// In addition to typical channel cancellation criteria, the sword fizzles out if it runs out of charge.
Item playerItem = player.ActiveItem();
bool hasCharge = modItem.Charge > 0f;
if (player.channel && !player.noItems && !player.CCed && playerItem.type == ModContent.ItemType<Phaseslayer>() && hasCharge)
if (!player.CantUseHoldout() && playerItem.type == ModContent.ItemType<Phaseslayer>() && hasCharge)
{
// The distance ratio ranges from 0 (your mouse is directly on the player) to 1 (your mouse is at the max range considered, or any further distance).
float mouseDistance = Projectile.Distance(Main.MouseWorld);
+1 -2
View File
@@ -14,7 +14,6 @@ namespace CalamityMod.Projectiles.Magic
private const int FramesPerFireRateIncrease = 36;
private Player Owner => Main.player[Projectile.owner];
private bool OwnerCanShoot => Owner.channel && Owner.HasAmmo(Owner.ActiveItem()) && !Owner.noItems && !Owner.CCed;
private ref float DeployedFrames => ref Projectile.ai[0];
private ref float AnimationRate => ref Projectile.ai[1];
@@ -43,7 +42,7 @@ namespace CalamityMod.Projectiles.Magic
Vector2 gunBarrelPos = armPosition + Projectile.velocity * Projectile.height * 0.4f;
// If the player is unable to continue using the holdout, delete it.
if (!OwnerCanShoot)
if (Owner.CantUseHoldout() || !Owner.HasAmmo(Owner.ActiveItem()))
{
Projectile.Kill();
return;
+2 -1
View File
@@ -1,5 +1,6 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using rail;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
@@ -29,7 +30,7 @@ namespace CalamityMod.Projectiles.Magic
Player player = Main.player[Projectile.owner];
if (Main.myPlayer == Projectile.owner)
{
if (!player.channel || player.noItems || player.CCed || Projectile.ai[0] > 3600f)
if (player.CantUseHoldout() || Projectile.ai[0] > 3600f)
{
Projectile.Kill();
}
+1 -2
View File
@@ -126,8 +126,7 @@ namespace CalamityMod.Projectiles.Magic
if (shouldHitChargedUp && Main.myPlayer == Projectile.owner)
{
bool hasMana = !shouldHitNotCharged || player.CheckMana(player.ActiveItem(), -1, true, false);
bool canUseItem = player.channel && hasMana && !player.noItems && !player.CCed;
if (canUseItem)
if (!player.CantUseHoldout() && hasMana)
{
if (Projectile.ai[0] == 1f)
{
+3 -3
View File
@@ -1,7 +1,7 @@
using CalamityMod.Items.Weapons.Magic;
using System;
using CalamityMod.Items.Weapons.Magic;
using CalamityMod.NPCs.Providence;
using Microsoft.Xna.Framework;
using System;
using Terraria;
using Terraria.Audio;
using Terraria.Localization;
@@ -38,7 +38,7 @@ namespace CalamityMod.Projectiles.Magic
Player player = Main.player[Projectile.owner];
// If the player is no longer able to hold the book, kill it (and by extension the other projectiles).
if (!player.channel || player.noItems || player.CCed)
if (player.CantUseHoldout())
{
Projectile.Kill();
return;
+1 -1
View File
@@ -68,7 +68,7 @@ namespace CalamityMod.Projectiles.Magic
Projectile.ai[1] = (float)(soundDelayer - soundDelayMult * aiSoundDelay);
isActive = true;
}
bool canUseItem = player.channel && !player.noItems && !player.CCed;
bool canUseItem = !player.CantUseHoldout();
if (Projectile.localAI[0] > 0f)
{
Projectile.localAI[0] -= 1f;
+1 -1
View File
@@ -32,7 +32,7 @@ namespace CalamityMod.Projectiles.Magic
Player player = Main.player[Projectile.owner];
float rotoffset = MathHelper.PiOver2;
Vector2 playerpos = player.RotatedRelativePoint(player.MountedCenter, true);
bool shouldBeHeld = player.channel && !player.noItems && !player.CCed;
bool shouldBeHeld = !player.CantUseHoldout();
Projectile.damage = player.ActiveItem() is null ? 0 : player.GetWeaponDamage(player.ActiveItem());
if (Projectile.ai[0] > 0f)
{
+3 -3
View File
@@ -1,7 +1,7 @@
using CalamityMod.Items.Weapons.Magic;
using System;
using CalamityMod.Items.Weapons.Magic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
@@ -37,7 +37,7 @@ namespace CalamityMod.Projectiles.Magic
public override void AI()
{
// If the player is no longer able to hold the book, kill it.
if (!Owner.channel || Owner.noItems || Owner.CCed)
if (Owner.CantUseHoldout())
{
Projectile.Kill();
return;
+1 -2
View File
@@ -15,7 +15,6 @@ namespace CalamityMod.Projectiles.Magic
private static int[] LaserOffsetByAnimationFrame = { 4, 3, 0, 3 };
private Player Owner => Main.player[Projectile.owner];
private bool OwnerCanShoot => Owner.channel && Owner.HasAmmo(Owner.ActiveItem()) && !Owner.noItems && !Owner.CCed;
private ref float DeployedFrames => ref Projectile.ai[0];
private ref float ChargeTowardsNextShot => ref Projectile.ai[1];
@@ -41,7 +40,7 @@ namespace CalamityMod.Projectiles.Magic
Vector2 gunBarrelPos = armPosition + Projectile.velocity * Projectile.height * 0.5f;
// If the player is unable to continue using the holdout, delete it.
if (!OwnerCanShoot)
if (Owner.CantUseHoldout() || !Owner.HasAmmo(Owner.ActiveItem()))
{
Projectile.Kill();
return;
+1 -1
View File
@@ -61,7 +61,7 @@ namespace CalamityMod.Projectiles.Magic
bool shoot = CurrentFrame == ShootFrame && Projectile.ai[0] == 0f;
bool ableToShoot = true;
bool weaponInUse = Owner.channel && !Owner.noItems && !Owner.CCed;
bool weaponInUse = !Owner.CantUseHoldout();
int manaCost = (int)(30f * Owner.manaCost);
Vector2 halvedSize = Projectile.Size / 2f;
Vector2 staffOffset = halvedSize + new Vector2(24f, 24f);
@@ -1,6 +1,6 @@
using CalamityMod.Items.Weapons.Magic;
using System;
using CalamityMod.Items.Weapons.Magic;
using Microsoft.Xna.Framework;
using System;
using Terraria;
using Terraria.Audio;
using Terraria.Localization;
@@ -31,8 +31,7 @@ namespace CalamityMod.Projectiles.Magic
UpdatePlayerVisuals(Owner.Center);
bool stillUsingCannon = Owner.channel && !Owner.noItems && !Owner.CCed;
if (!stillUsingCannon)
if (Owner.CantUseHoldout())
{
Projectile.Kill();
return;
+1 -1
View File
@@ -37,7 +37,7 @@ namespace CalamityMod.Projectiles.Magic
Player player = Main.player[Projectile.owner];
if (player == null)
return;
if (!(player.channel && !player.noItems && !player.CCed))
if (player.CantUseHoldout())
Projectile.Kill();
if (Projectile.type != ModContent.ProjectileType<Snowflake>() ||
Main.player[Projectile.owner].HeldItem.type != ModContent.ItemType<SnowstormStaff>() || !Main.player[Projectile.owner].channel)
+1 -1
View File
@@ -84,7 +84,7 @@ namespace CalamityMod.Projectiles.Magic
// CheckMana returns true if the mana cost can be paid. If mana isn't consumed this frame, the CheckMana short-circuits out of being evaluated.
bool allowContinuedUse = !ShouldConsumeMana() || player.CheckMana(player.ActiveItem(), -1, true, false);
bool crystalStillInUse = player.channel && allowContinuedUse && !player.noItems && !player.CCed;
bool crystalStillInUse = !player.CantUseHoldout() && allowContinuedUse;
// The beams are only projected once (on frame 1).
if (crystalStillInUse && Projectile.ai[0] == 1f)
+18 -18
View File
@@ -1,16 +1,16 @@
using CalamityMod.Particles;
using System;
using System.IO;
using CalamityMod.Items.Weapons.Melee;
using CalamityMod.Particles;
using CalamityMod.Sounds;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using System.IO;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.ModLoader;
using static Terraria.ModLoader.ModContent;
using static CalamityMod.CalamityUtils;
using Terraria.Audio;
using CalamityMod.Sounds;
using static Terraria.ModLoader.ModContent;
namespace CalamityMod.Projectiles.Melee
{
@@ -58,7 +58,7 @@ namespace CalamityMod.Projectiles.Melee
#region Throw variables
//Only used for the long range throw
private bool OwnerCanShoot => Owner.channel && !Owner.noItems && !Owner.CCed && Owner.HeldItem.type == ItemType<ArkoftheCosmos>();
private bool OwnerCanShoot => !Owner.CantUseHoldout() && Owner.HeldItem.type == ItemType<ArkoftheCosmos>();
public bool Thrown => Combo == 2 || Combo == 3;
public const float MaxThrowTime = 140;
public float ThrowReach;
@@ -141,7 +141,7 @@ namespace CalamityMod.Projectiles.Melee
{
if (!initialized) //Initialization
{
Projectile.timeLeft = Thrown ? (int) MaxThrowTime : (int)MaxSwingTime;
Projectile.timeLeft = Thrown ? (int)MaxThrowTime : (int)MaxSwingTime;
SoundStyle sound = (Charge > 0 || Thrown) ? CommonCalamitySounds.LouderPhantomPhoenix : SoundID.Item71;
SoundEngine.PlaySound(sound, Projectile.Center);
direction = Projectile.velocity;
@@ -182,11 +182,11 @@ namespace CalamityMod.Projectiles.Melee
//Slightly shift the blasts up so the final close shots don't go BELOW the cursor and instead go right on it.
float adjustedBlastRotation = Projectile.rotation - MathHelper.PiOver4 * 1.15f * Owner.direction;
var source = Projectile.GetSource_FromThis();
Projectile blast = Projectile.NewProjectileDirect(source, Owner.Center + adjustedBlastRotation.ToRotationVector2() * 10f, adjustedBlastRotation.ToRotationVector2() * 20f, ProjectileType<EonBolt>(), (int)(ArkoftheCosmos.SwirlBoltDamageMultiplier / ArkoftheCosmos.SwirlBoltAmount * Projectile.damage), 0f, Owner.whoAmI, 0.55f, MathHelper.Pi * 0.05f);
{
var source = Projectile.GetSource_FromThis();
Projectile blast = Projectile.NewProjectileDirect(source, Owner.Center + adjustedBlastRotation.ToRotationVector2() * 10f, adjustedBlastRotation.ToRotationVector2() * 20f, ProjectileType<EonBolt>(), (int)(ArkoftheCosmos.SwirlBoltDamageMultiplier / ArkoftheCosmos.SwirlBoltAmount * Projectile.damage), 0f, Owner.whoAmI, 0.55f, MathHelper.Pi * 0.05f);
{
blast.timeLeft = 100;
}
}
}
}
@@ -268,7 +268,7 @@ namespace CalamityMod.Projectiles.Melee
if (Combo == 3f)
{
//Slow down the projectile's retraction
float curveDownGently = MathHelper.Lerp(1f, 0.8f, 1f - (float)Math.Sqrt(1f - (float)Math.Pow(SnapEndCompletion , 2f)));
float curveDownGently = MathHelper.Lerp(1f, 0.8f, 1f - (float)Math.Sqrt(1f - (float)Math.Pow(SnapEndCompletion, 2f)));
Projectile.Center = Owner.Center + direction * curveDownGently;
Projectile.scale = 1.5f;
@@ -276,7 +276,7 @@ namespace CalamityMod.Projectiles.Melee
float extraRotations = (direction.ToRotation() + MathHelper.PiOver4 > Projectile.velocity.ToRotation()) ? -MathHelper.TwoPi : 0f;
Projectile.rotation = MathHelper.Lerp(Projectile.velocity.ToRotation(), direction.ToRotation() + extraRotations, orientateProperly);
Projectile.rotation = MathHelper.Lerp(Projectile.velocity.ToRotation(), direction.ToRotation() + extraRotations, orientateProperly);
}
//Sharticles
@@ -385,7 +385,7 @@ namespace CalamityMod.Projectiles.Melee
Vector2 distance = Main.rand.NextVector2Circular(maxDistance, maxDistance);
Vector2 angularVelocity = Utils.SafeNormalize(distance.RotatedBy(-MathHelper.PiOver2), Vector2.Zero) * 2 * (1f + distance.Length() / 15f);
Color glitterColor = Main.hslToRgb(Main.rand.NextFloat(), 1, 0.5f);
Particle glitter = new CritSpark(Projectile.Center + distance, Owner.velocity + angularVelocity, Color.White , glitterColor, 1f + 1 * (distance.Length() / maxDistance), 10, 0.05f, 3f);
Particle glitter = new CritSpark(Projectile.Center + distance, Owner.velocity + angularVelocity, Color.White, glitterColor, 1f + 1 * (distance.Length() / maxDistance), 10, 0.05f, 3f);
GeneralParticleHandler.SpawnParticle(glitter);
}
@@ -424,14 +424,14 @@ namespace CalamityMod.Projectiles.Melee
{
for (int i = 0; i < 5; i++)
{
Vector2 particleSpeed = Utils.SafeNormalize(target.Center - Projectile.Center , Vector2.One).RotatedByRandom(MathHelper.PiOver4 * 0.8f) * Main.rand.NextFloat(3.6f, 8f);
Vector2 particleSpeed = Utils.SafeNormalize(target.Center - Projectile.Center, Vector2.One).RotatedByRandom(MathHelper.PiOver4 * 0.8f) * Main.rand.NextFloat(3.6f, 8f);
Particle energyLeak = new SquishyLightParticle(target.Center, particleSpeed, Main.rand.NextFloat(0.3f, 0.6f), Color.OrangeRed, 60, 2, 2.5f, hueShift: 0.06f);
GeneralParticleHandler.SpawnParticle(energyLeak);
}
if (Combo == 3f)
{
SoundEngine.PlaySound(CommonCalamitySounds.ScissorGuillotineSnapSound with { Volume =CommonCalamitySounds.ScissorGuillotineSnapSound.Volume * 1.3f }, Projectile.Center);
SoundEngine.PlaySound(CommonCalamitySounds.ScissorGuillotineSnapSound with { Volume = CommonCalamitySounds.ScissorGuillotineSnapSound.Volume * 1.3f }, Projectile.Center);
}
}
@@ -445,7 +445,7 @@ namespace CalamityMod.Projectiles.Melee
SoundEngine.PlaySound(SoundID.Item84, Projectile.Center);
Vector2 sliceDirection = Utils.SafeNormalize(direction, Vector2.One) * 40;
Particle SliceLine = new LineVFX(Projectile.Center - sliceDirection, sliceDirection * 2f, 0.2f, Color.Orange * 0.7f, expansion : 250f)
Particle SliceLine = new LineVFX(Projectile.Center - sliceDirection, sliceDirection * 2f, 0.2f, Color.Orange * 0.7f, expansion: 250f)
{
Lifetime = 10
};
@@ -55,7 +55,7 @@ namespace CalamityMod.Projectiles.Melee
#region Throw variables
//Only used for the long range throw
private bool OwnerCanShoot => Owner.channel && !Owner.noItems && !Owner.CCed && Owner.HeldItem.type == ItemType<ArkoftheElements>();
private bool OwnerCanShoot => !Owner.CantUseHoldout() && Owner.HeldItem.type == ItemType<ArkoftheElements>();
public bool Thrown => Combo == 2 || Combo == 3;
const float MaxThrowTime = 80;
const float ThrowReachMax = 500;
@@ -24,14 +24,10 @@ namespace CalamityMod.Projectiles.Melee
public ref float PogoCooldown => ref Projectile.ai[1]; //Cooldown for the pogo
public Player Owner => Main.player[Projectile.owner];
public bool CanPogo => Owner.velocity.Y != 0 && PogoCooldown <= 0; //Only pogo when in the air and if the cooldown is zero
private bool OwnerCanShoot => Owner.channel && !Owner.noItems && !Owner.CCed;
public const float pogoStrenght = 16f; //How much the player gets pogoed up
public const float maxShred = 500; //How much shred you get
public override void SetStaticDefaults()
{
}
public override void SetDefaults()
{
Projectile.DamageType = DamageClass.Melee;
@@ -102,7 +98,7 @@ namespace CalamityMod.Projectiles.Melee
initialized = true;
}
if (!OwnerCanShoot)
if (Owner.CantUseHoldout())
{
Projectile.Kill();
return;
@@ -62,7 +62,7 @@ namespace CalamityMod.Projectiles.Melee
if (Main.myPlayer == Projectile.owner)
{
if (Owner.channel && !Owner.noItems && !Owner.CCed)
if (!Owner.CantUseHoldout())
{
float scaleFactor6 = 1f;
+1 -1
View File
@@ -69,7 +69,7 @@ namespace CalamityMod.Projectiles.Melee
Vector2 playerRotatedPoint = Owner.RotatedRelativePoint(Owner.MountedCenter, true);
if (Main.myPlayer == Projectile.owner)
{
if (Owner.channel && !Owner.noItems && !Owner.CCed)
if (!Owner.CantUseHoldout())
HandleChannelMovement(playerRotatedPoint);
else
Projectile.Kill();
+1 -1
View File
@@ -58,7 +58,7 @@ namespace CalamityMod.Projectiles.Melee
if (Main.myPlayer == Projectile.owner)
{
if (Owner.channel && !Owner.noItems && !Owner.CCed)
if (!Owner.CantUseHoldout())
{
float scaleFactor6 = 1f;
+8 -12
View File
@@ -1,17 +1,17 @@
using CalamityMod.Particles;
using System;
using System.IO;
using CalamityMod.Items.Weapons.Melee;
using Terraria.Graphics.Shaders;
using CalamityMod.Particles;
using CalamityMod.Tiles.Astral;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using System.IO;
using Terraria;
using Terraria.Audio;
using Terraria.Graphics.Shaders;
using Terraria.ID;
using Terraria.ModLoader;
using static Terraria.ModLoader.ModContent;
using static CalamityMod.CalamityUtils;
using Terraria.Audio;
using CalamityMod.Tiles.Astral;
using static Terraria.ModLoader.ModContent;
namespace CalamityMod.Projectiles.Melee
{
@@ -27,15 +27,11 @@ namespace CalamityMod.Projectiles.Melee
public ref float CurrentIndicator => ref Projectile.localAI[0]; //What "indicator" stage are you on.
public ref float OverCharge => ref Projectile.localAI[1];
private bool OwnerCanShoot => Owner.channel && !Owner.noItems && !Owner.CCed;
const float MaxCharge = 360;
public Vector2 lastDisplacement;
public float dashDuration;
public override void SetStaticDefaults()
{
}
public override void SetDefaults()
{
Projectile.DamageType = DamageClass.Melee;
@@ -79,7 +75,7 @@ namespace CalamityMod.Projectiles.Melee
initialized = true;
}
if (!OwnerCanShoot)
if (Owner.CantUseHoldout())
{
if (State == 0f)
{
+6 -7
View File
@@ -1,15 +1,15 @@
using CalamityMod.Particles;
using System;
using System.Linq;
using CalamityMod.Items.Weapons.Melee;
using CalamityMod.Particles;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using System.Linq;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.ModLoader;
using static Terraria.ModLoader.ModContent;
using static CalamityMod.CalamityUtils;
using Terraria.Audio;
using static Terraria.ModLoader.ModContent;
namespace CalamityMod.Projectiles.Melee
{
@@ -21,7 +21,6 @@ namespace CalamityMod.Projectiles.Melee
public Player Owner => Main.player[Projectile.owner];
public ref float ChainSwapTimer => ref Projectile.ai[0];
public ref float BlastCooldown => ref Projectile.ai[1];
private bool OwnerCanShoot => Owner.channel && !Owner.noItems && !Owner.CCed && Owner.HeldItem.type == ItemType<FourSeasonsGalaxia>();
const float MaxProjReach = 500f; //How far away do you check for enemies for the extra projs from crits be
@@ -120,7 +119,7 @@ namespace CalamityMod.Projectiles.Melee
public override void AI()
{
if (!OwnerCanShoot)
if (Owner.CantUseHoldout() || Owner.HeldItem.type != ItemType<FourSeasonsGalaxia>())
{
//Kill the projectile if too far away from the player or close enough to get "re-absorbed)
if ((Owner.Center - Projectile.Center).Length() < 30f || (Owner.Center - Projectile.Center).Length() > 2000f || Projectile.velocity.Length() > 100f)
+7 -8
View File
@@ -1,16 +1,16 @@
using CalamityMod.Particles;
using System;
using System.IO;
using CalamityMod.Items.Weapons.Melee;
using Terraria.Graphics.Shaders;
using CalamityMod.Particles;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using System.IO;
using Terraria;
using Terraria.Audio;
using Terraria.Graphics.Shaders;
using Terraria.ID;
using Terraria.ModLoader;
using static Terraria.ModLoader.ModContent;
using static CalamityMod.CalamityUtils;
using Terraria.Audio;
using static Terraria.ModLoader.ModContent;
namespace CalamityMod.Projectiles.Melee
{
@@ -22,7 +22,6 @@ namespace CalamityMod.Projectiles.Melee
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 = 90f;
public const float throwOutDistance = 440f;
@@ -87,7 +86,7 @@ namespace CalamityMod.Projectiles.Melee
Projectile.rotation = direction.ToRotation(); //Only done for afterimages
if (!OwnerCanShoot)
if (Owner.CantUseHoldout())
{
if (CurrentState == 2f || (CurrentState == 0f && Empowerment / maxEmpowerment < 0.5))
{
+6 -11
View File
@@ -1,15 +1,15 @@
using CalamityMod.Particles;
using System;
using System.IO;
using CalamityMod.Items.Weapons.Melee;
using CalamityMod.Particles;
using CalamityMod.Sounds;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using System.IO;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.ModLoader;
using static Terraria.ModLoader.ModContent;
using Terraria.Audio;
using CalamityMod.Sounds;
namespace CalamityMod.Projectiles.Melee
{
@@ -25,7 +25,6 @@ namespace CalamityMod.Projectiles.Melee
public float Bounce(float x) => x <= 50 ? x / 50f : x <= 65 ? 1 + 0.15f * (float)Math.Sin((x - 50f) / 15f * MathHelper.Pi) : 1f;
public float ShredRatio => MathHelper.Clamp(Shred / (maxShred * 0.5f), 0f, 1f);
public Player Owner => Main.player[Projectile.owner];
private bool OwnerCanShoot => Owner.channel && !Owner.noItems && !Owner.CCed;
public const float maxShred = 650; //How much shred you get
@@ -36,10 +35,6 @@ namespace CalamityMod.Projectiles.Melee
public Particle[] Rings = new Particle[3];
public Particle PolarStar;
public override void SetStaticDefaults()
{
}
public override void SetDefaults()
{
Projectile.DamageType = DamageClass.Melee;
@@ -93,7 +88,7 @@ namespace CalamityMod.Projectiles.Melee
}
}
if (!OwnerCanShoot)
if (Owner.CantUseHoldout())
{
Projectile.Kill();
return;
@@ -1,13 +1,11 @@
using CalamityMod.Items.Tools;
using System;
using CalamityMod.Items.Tools;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Content;
using System;
using Terraria;
using Terraria.Audio;
using Terraria.GameContent;
using Terraria.Graphics.Shaders;
using Terraria.ID;
using Terraria.Localization;
using Terraria.ModLoader;
@@ -63,10 +61,10 @@ namespace CalamityMod.Projectiles.Melee
Lighting.AddLight(Projectile.Center, Color.Blue.ToVector3() * 0.7f);
}
if (MoveInIntervals > 0f)
MoveInIntervals -= 1f;
if (MoveInIntervals > 0f)
MoveInIntervals -= 1f;
if (!Owner.channel || Owner.noItems || Owner.CCed)
if (Owner.CantUseHoldout())
Projectile.Kill();
else if (MoveInIntervals <= 0f)
@@ -203,7 +201,7 @@ namespace CalamityMod.Projectiles.Melee
{
Main.EntitySpriteDraw(selectionTex, Projectile.Center + offset - Main.screenPosition, null, bloomColor.MultiplyRGB(colorMod), 0f, selectionTex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0);
});
//Draw laser beams going around the selection
Texture2D beamTex = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/GreyscaleGradients/SimpleGradient").Value;
+1 -1
View File
@@ -66,7 +66,7 @@ namespace CalamityMod.Projectiles.Melee
if (MoveInIntervals > 0f)
MoveInIntervals -= 1f;
if (!Owner.channel || Owner.noItems || Owner.CCed)
if (Owner.CantUseHoldout())
Projectile.Kill();
else if (MoveInIntervals <= 0f)
@@ -1,18 +1,18 @@
using CalamityMod.Particles;
using CalamityMod.Items.Weapons.Melee;
using Terraria.Graphics.Shaders;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using System;
using System.IO;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using static Terraria.ModLoader.ModContent;
using static CalamityMod.CalamityUtils;
using Terraria.Audio;
using CalamityMod.Items.Weapons.Melee;
using CalamityMod.Particles;
using CalamityMod.Projectiles.Boss;
using CalamityMod.Tiles.Astral;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.Audio;
using Terraria.Graphics.Shaders;
using Terraria.ID;
using Terraria.ModLoader;
using static CalamityMod.CalamityUtils;
using static Terraria.ModLoader.ModContent;
namespace CalamityMod.Projectiles.Melee
{
@@ -28,15 +28,11 @@ namespace CalamityMod.Projectiles.Melee
public ref float CurrentIndicator => ref Projectile.localAI[0]; //What "indicator" stage are you on.
public ref float OverCharge => ref Projectile.localAI[1];
private bool OwnerCanShoot => Owner.channel && !Owner.noItems && !Owner.CCed;
const float MaxCharge = 500;
public Vector2 lastDisplacement;
public float dashDuration;
public override void SetStaticDefaults()
{
}
public override void SetDefaults()
{
Projectile.DamageType = DamageClass.Melee;
@@ -80,7 +76,7 @@ namespace CalamityMod.Projectiles.Melee
initialized = true;
}
if (!OwnerCanShoot)
if (Owner.CantUseHoldout())
{
if (State == 0f)
{
@@ -1,16 +1,16 @@
using CalamityMod.Particles;
using System;
using System.IO;
using CalamityMod.Items.Weapons.Melee;
using Terraria.Graphics.Shaders;
using CalamityMod.Particles;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using System.IO;
using Terraria;
using Terraria.Audio;
using Terraria.Graphics.Shaders;
using Terraria.ID;
using Terraria.ModLoader;
using static Terraria.ModLoader.ModContent;
using static CalamityMod.CalamityUtils;
using Terraria.Audio;
using static Terraria.ModLoader.ModContent;
namespace CalamityMod.Projectiles.Melee
{
@@ -20,10 +20,9 @@ namespace CalamityMod.Projectiles.Melee
public override string Texture => "CalamityMod/Projectiles/Melee/MendedBiomeBlade_HeavensMight";
private bool initialized = false;
Vector2 direction = Vector2.Zero;
Vector2 oldDirection = Vector2.Zero;
Vector2 oldDirection;
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 = 90f;
public const float throwOutDistance = 440f;
@@ -85,7 +84,7 @@ namespace CalamityMod.Projectiles.Melee
Projectile.rotation = direction.ToRotation(); //Only done for afterimages
if (!OwnerCanShoot)
if (Owner.CantUseHoldout())
{
if (CurrentState == 2f || (CurrentState == 0f && Empowerment / maxEmpowerment < 0.5))
{
@@ -25,7 +25,6 @@ namespace CalamityMod.Projectiles.Melee
public ref float ChargeSoundCooldown => ref Projectile.localAI[1];
public Player Owner => Main.player[Projectile.owner];
public bool CanPogo => Owner.velocity.Y != 0 && PogoCooldown <= 0; //Only pogo when in the air and if the cooldown is zero
private bool OwnerCanShoot => Owner.channel && !Owner.noItems && !Owner.CCed;
public const float pogoStrenght = 16f; //How much the player gets pogoed up
public const float maxShred = 500; //How much shred you get
@@ -104,7 +103,7 @@ namespace CalamityMod.Projectiles.Melee
initialized = true;
}
if (!OwnerCanShoot)
if (Owner.CantUseHoldout())
{
Projectile.Kill();
return;
+1 -1
View File
@@ -115,7 +115,7 @@ namespace CalamityMod.Projectiles.Melee
Vector2 playerRotatedPoint = player.RotatedRelativePoint(player.MountedCenter, true);
if (Main.myPlayer == Projectile.owner)
{
if (player.channel && !player.noItems && !player.CCed)
if (!player.CantUseHoldout())
HandleChannelMovement(player, playerRotatedPoint);
else
{
+1 -1
View File
@@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Melee
Vector2 playerRotatedPoint = Owner.RotatedRelativePoint(Owner.MountedCenter, true);
if (Main.myPlayer == Projectile.owner)
{
if (Owner.channel && !Owner.noItems && !Owner.CCed)
if (!Owner.CantUseHoldout())
HandleChannelMovement(playerRotatedPoint);
else
Projectile.Kill();
+1 -1
View File
@@ -68,7 +68,7 @@ namespace CalamityMod.Projectiles.Melee
Vector2 playerRotatedPosition = Owner.RotatedRelativePoint(Owner.MountedCenter);
if (Main.myPlayer == Projectile.owner)
{
if (Owner.channel && !Owner.noItems && !Owner.CCed)
if (!Owner.CantUseHoldout())
HandleChannelMovement(playerRotatedPosition);
else
Projectile.Kill();
+1 -2
View File
@@ -91,7 +91,6 @@ namespace CalamityMod.Projectiles.Melee.Spears
public void DeterminePlayerVariables()
{
bool spearStillInUse = Owner.channel && !Owner.noItems && !Owner.CCed;
Owner.ChangeDir((Math.Cos(Projectile.rotation - MathHelper.Pi + MathHelper.PiOver4) > 0f).ToDirectionInt());
Owner.heldProj = Projectile.whoAmI;
Owner.itemTime = Owner.itemAnimation = 2;
@@ -99,7 +98,7 @@ namespace CalamityMod.Projectiles.Melee.Spears
Projectile.Center = Owner.Center;
// Die if the spear is no longer in use.
if (!spearStillInUse)
if (Owner.CantUseHoldout())
Projectile.Kill();
}
@@ -86,7 +86,7 @@ namespace CalamityMod.Projectiles.Melee
Vector2 playerRotatedPosition = Owner.RotatedRelativePoint(Owner.MountedCenter);
if (Main.myPlayer == Projectile.owner)
{
if (!Owner.noItems && !Owner.CCed)
if (!Owner.CantUseHoldout())
HandleChannelMovement(playerRotatedPosition);
else
Projectile.Kill();
+1 -1
View File
@@ -104,7 +104,7 @@ namespace CalamityMod.Projectiles.Melee
}
// Attack upon releasing the button
if (!Owner.channel || Owner.noItems || Owner.CCed)
if (Owner.CantUseHoldout())
Attack();
}
@@ -24,7 +24,6 @@ namespace CalamityMod.Projectiles.Melee
public Player Owner => Main.player[Projectile.owner];
public ref float ChainSwapTimer => ref Projectile.ai[0];
public ref float SnapCoyoteTime => ref Projectile.ai[1];
private bool OwnerCanShoot => Owner.channel && !Owner.noItems && !Owner.CCed;
const float MaxTangleReach = 400f; //How long can tangling vines from crits be
@@ -36,9 +35,6 @@ namespace CalamityMod.Projectiles.Melee
public Particle smear;
public Particle smear2;
public override void SetStaticDefaults()
{
}
public override void SetDefaults()
{
Projectile.DamageType = DamageClass.Melee;
@@ -162,7 +158,7 @@ namespace CalamityMod.Projectiles.Melee
public override void AI()
{
if (!OwnerCanShoot)
if (Owner.CantUseHoldout())
{
Projectile.Kill();
return;
@@ -28,15 +28,11 @@ namespace CalamityMod.Projectiles.Melee
public ref float CurrentIndicator => ref Projectile.localAI[0]; //What "indicator" stage are you on.
public ref float OverCharge => ref Projectile.localAI[1];
private bool OwnerCanShoot => Owner.channel && !Owner.noItems && !Owner.CCed;
const float MaxCharge = 500;
public Vector2 lastDisplacement;
public float dashDuration;
public override void SetStaticDefaults()
{
}
public override void SetDefaults()
{
Projectile.DamageType = DamageClass.Melee;
@@ -80,7 +76,7 @@ namespace CalamityMod.Projectiles.Melee
initialized = true;
}
if (!OwnerCanShoot)
if (Owner.CantUseHoldout())
{
if (State == 0f)
{
@@ -27,7 +27,6 @@ namespace CalamityMod.Projectiles.Melee
public ref float ChargeSoundCooldown => ref Projectile.localAI[1];
public Player Owner => Main.player[Projectile.owner];
public bool CanPogo => Owner.velocity.Y != 0 && PogoCooldown <= 0; //Only pogo when in the air and if the cooldown is zero
private bool OwnerCanShoot => Owner.channel && !Owner.noItems && !Owner.CCed;
public const float pogoStrenght = 16f; //How much the player gets pogoed up
public const float maxShred = 500; //How much shred you get
@@ -36,10 +35,6 @@ namespace CalamityMod.Projectiles.Melee
public bool Dashing;
public Vector2 DashStart;
public override void SetStaticDefaults()
{
}
public override void SetDefaults()
{
Projectile.DamageType = DamageClass.Melee;
@@ -127,7 +122,7 @@ namespace CalamityMod.Projectiles.Melee
}
}
if (!OwnerCanShoot)
if (Owner.CantUseHoldout())
{
Projectile.Kill();
return;
@@ -22,7 +22,6 @@ namespace CalamityMod.Projectiles.Melee
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 = 90f;
public const float throwOutDistance = 440f;
@@ -89,7 +88,7 @@ namespace CalamityMod.Projectiles.Melee
Projectile.rotation = direction.ToRotation(); //Only done for afterimages
if (!OwnerCanShoot)
if (Owner.CantUseHoldout())
{
if (CurrentState == 2f || (CurrentState == 0f && Empowerment / maxEmpowerment < 0.5))
{
+2 -4
View File
@@ -30,8 +30,6 @@ namespace CalamityMod.Projectiles.Ranged
private bool ChargeLV1 => CurrentChargingFrames >= ArcNovaDiffuser.Charge1Frames;
private bool ChargeLV2 => CurrentChargingFrames >= ArcNovaDiffuser.Charge2Frames;
private bool OwnerCanShoot => Owner.channel && !Owner.noItems && !Owner.CCed;
public override void SetDefaults()
{
Projectile.width = 72;
@@ -63,7 +61,7 @@ namespace CalamityMod.Projectiles.Ranged
ChargeSound.Position = Projectile.Center;
// Fire if the owner stops channeling or otherwise cannot use the weapon.
if (!OwnerCanShoot)
if (Owner.CantUseHoldout())
{
// Big Shot mode
if (ChargeLV2)
@@ -237,7 +235,7 @@ namespace CalamityMod.Projectiles.Ranged
// Rumble (only while channeling)
float rumble = MathHelper.Clamp(CurrentChargingFrames, 0f, ArcNovaDiffuser.Charge2Frames);
if (OwnerCanShoot)
if (!Owner.CantUseHoldout())
Projectile.position += Main.rand.NextVector2Circular(rumble / 70f, rumble / 70f);
}
+3 -3
View File
@@ -1,6 +1,6 @@
using CalamityMod.Items.Weapons.Ranged;
using System;
using CalamityMod.Items.Weapons.Ranged;
using Microsoft.Xna.Framework;
using System;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
@@ -80,7 +80,7 @@ namespace CalamityMod.Projectiles.Ranged
Projectile.ai[1] = (float)(shootDelayBase - incrementMult * incrementAmt);
willShoot = true;
}
bool canShoot = player.channel && player.HasAmmo(player.ActiveItem()) && !player.noItems && !player.CCed;
bool canShoot = !player.CantUseHoldout() && player.HasAmmo(player.ActiveItem());
if (Projectile.localAI[0] > 0f)
{
Projectile.localAI[0] -= 1f;
+1 -1
View File
@@ -55,7 +55,7 @@ namespace CalamityMod.Projectiles.Ranged
FramesTillNextShot = FireRate;
shouldShoot = true;
}
bool canShoot = player.channel && (player.HasAmmo(player.ActiveItem()) || FreeShotLoaded > 0) && !player.noItems && !player.CCed;
bool canShoot = !player.CantUseHoldout() && (player.HasAmmo(player.ActiveItem()) || FreeShotLoaded > 0);
if (Projectile.soundDelay <= 0 && canShoot)
{
Projectile.soundDelay = (int)FireRate;
+1 -3
View File
@@ -20,9 +20,7 @@ namespace CalamityMod.Projectiles.Ranged
private ref float CurrentChargingFrames => ref Projectile.ai[0];
private ref float LoadedBolts => ref Projectile.ai[1];
private ref float FramesToLoadBolt => ref Projectile.localAI[0];
private ref float LastDirection => ref Projectile.localAI[1];
private bool OwnerCanShoot => Owner.channel && !Owner.noItems && !Owner.CCed;
private float storedVelocity = 1f;
private float angularSpread = MathHelper.ToRadians(16);
@@ -46,7 +44,7 @@ namespace CalamityMod.Projectiles.Ranged
Vector2 tipPosition = armPosition + Projectile.velocity * Projectile.width * 0.5f;
// If the player releases left click, shoot out the arrows
if (!OwnerCanShoot)
if (Owner.CantUseHoldout())
{
if (LoadedBolts <= 0f) //If theres no arrows to shoot
+1 -2
View File
@@ -18,7 +18,6 @@ namespace CalamityMod.Projectiles.Ranged
private ref float ArrowsLoaded => ref Projectile.ai[1];
private ref float FramesToLoadNextArrow => ref Projectile.localAI[0];
private bool OwnerCanShoot => Owner.channel && !Owner.noItems && !Owner.CCed;
private float storedVelocity = 1f;
public const float velocityMultiplier = 1.2f;
public bool homing = false;
@@ -42,7 +41,7 @@ namespace CalamityMod.Projectiles.Ranged
Vector2 tipPosition = armPosition + Projectile.velocity * Projectile.width * 0.5f;
// Fire arrows if the owner stops channeling or otherwise cannot use the weapon.
if (!OwnerCanShoot)
if (Owner.CantUseHoldout())
{
// No arrows left to shoot? The bow disappears.
if (ArrowsLoaded <= 0f)
+1 -2
View File
@@ -87,8 +87,7 @@ namespace CalamityMod.Projectiles.Ranged
}
if (fullSpeed && Main.myPlayer == Projectile.owner)
{
bool canUseItem = player.channel && !player.noItems && !player.CCed;
if (canUseItem)
if (!player.CantUseHoldout())
{
float speed = player.ActiveItem().shootSpeed * Projectile.scale;
Vector2 spawnPos = vector;
+1 -1
View File
@@ -77,7 +77,7 @@ namespace CalamityMod.Projectiles.Ranged
fullSpeed = true;
int arg_1EF4_0 = (int)Projectile.ai[0] / (delayCompare - fireSpeedCompare * fireSpeed);
}
bool canUseItem = player.channel && player.HasAmmo(player.ActiveItem()) && !player.noItems && !player.CCed;
bool canUseItem = !player.CantUseHoldout() && player.HasAmmo(player.ActiveItem());
if (Projectile.localAI[0] > 0f)
{
Projectile.localAI[0] -= 1f;
+1 -1
View File
@@ -77,7 +77,7 @@ namespace CalamityMod.Projectiles.Ranged
timeToFire = true;
}
bool canFire = player.channel && player.HasAmmo(player.ActiveItem()) && !player.noItems && !player.CCed;
bool canFire = !player.CantUseHoldout() && player.HasAmmo(player.ActiveItem());
if (Projectile.soundDelay <= 0 && canFire)
{
@@ -1,10 +1,5 @@
using CalamityMod.Items.Weapons.Ranged;
using CalamityMod.Particles;
using log4net.Core;
using Microsoft.Xna.Framework;
using Mono.Cecil;
using ReLogic.Utilities;
using System;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
@@ -25,7 +20,6 @@ namespace CalamityMod.Projectiles.Ranged
public int ShotCooldown;
public int FireBlobs = 0;
public int Time = 0;
private bool OwnerCanShoot => Owner.channel && !Owner.noItems && !Owner.CCed;
public override void SetDefaults()
{
@@ -55,10 +49,8 @@ namespace CalamityMod.Projectiles.Ranged
Vector2 tipPosition = armPosition + Projectile.velocity * Projectile.width * 0.8f;
// Kill if the owner stops channeling or otherwise cannot use the weapon.
if (!OwnerCanShoot)
{
if (Owner.CantUseHoldout())
Projectile.Kill();
}
else
{
var effectcolor = Main.rand.Next(4) switch
@@ -102,7 +94,7 @@ namespace CalamityMod.Projectiles.Ranged
else
{
if (ShootTimer == 1)
SoundEngine.PlaySound(SoundID.Item73 with { Volume = 0.7f}, Projectile.Center);
SoundEngine.PlaySound(SoundID.Item73 with { Volume = 0.7f }, Projectile.Center);
ShotsFired = 0;
for (int i = 0; i < 2; i++)
{
-131
View File
@@ -1,131 +0,0 @@
using System;
using CalamityMod.Items.Weapons.Ranged;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.Localization;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Ranged
{
public class FlakKrakenGun : ModProjectile
{
public override LocalizedText DisplayName => CalamityUtils.GetItemName<FlakKraken>();
public override string Texture => "CalamityMod/Items/Weapons/Ranged/FlakKraken";
public override void SetDefaults()
{
Projectile.width = 152;
Projectile.height = 58;
Projectile.friendly = true;
Projectile.penetrate = -1;
Projectile.tileCollide = false;
Projectile.DamageType = DamageClass.Ranged;
Projectile.ignoreWater = true;
}
public override void AI()
{
Player player = Main.player[Projectile.owner];
float pi = 0f;
Vector2 playerRotation = player.RotatedRelativePoint(player.MountedCenter, true);
if (Projectile.spriteDirection == -1)
{
pi = 3.14159274f;
}
float hitRate = 30f;
if (Projectile.ai[0] > 90f)
{
hitRate = 15f;
}
if (Projectile.ai[0] > 120f)
{
hitRate = 5f;
}
Projectile.damage = player.ActiveItem() is null ? 0 : player.GetWeaponDamage(player.ActiveItem());
Projectile.ai[0] += 1f;
Projectile.ai[1] += 1f;
bool isUsing = false;
if (Projectile.ai[0] % hitRate == 0f)
{
isUsing = true;
}
if (Projectile.ai[1] >= 1f)
{
Projectile.ai[1] = 0f;
isUsing = true;
if (Main.myPlayer == Projectile.owner)
{
float scaleFactor5 = player.ActiveItem().shootSpeed * Projectile.scale;
Vector2 shootDirection = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - playerRotation;
if (player.gravDir == -1f)
{
shootDirection.Y = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - playerRotation.Y;
}
Vector2 normalizeShoot = Vector2.Normalize(shootDirection);
if (float.IsNaN(normalizeShoot.X) || float.IsNaN(normalizeShoot.Y))
{
normalizeShoot = -Vector2.UnitY;
}
normalizeShoot = Vector2.Normalize(Vector2.Lerp(normalizeShoot, Vector2.Normalize(Projectile.velocity), 0.92f)); //0.92
normalizeShoot *= scaleFactor5;
if (normalizeShoot.X != Projectile.velocity.X || normalizeShoot.Y != Projectile.velocity.Y)
{
Projectile.netUpdate = true;
}
Projectile.velocity = normalizeShoot;
}
}
if (Projectile.soundDelay <= 0)
{
Projectile.soundDelay = 10;
Projectile.soundDelay *= 2;
if (Projectile.ai[0] != 1f && Projectile.ai[0] <= 500f)
{
SoundEngine.PlaySound(SoundID.Item15, Projectile.position);
}
}
if (isUsing && Main.myPlayer == Projectile.owner)
{
bool canUseItem = player.channel && !player.noItems && !player.CCed;
if (canUseItem)
{
if (Projectile.ai[0] == 1f)
{
Vector2 projPos = player.RotatedRelativePoint(player.MountedCenter, true);
float projX = (float)Main.mouseX + Main.screenPosition.X - projPos.X;
float projY = (float)Main.mouseY + Main.screenPosition.Y - projPos.Y;
if (player.gravDir == -1f)
{
projY = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - projPos.Y;
}
if ((float.IsNaN(projX) && float.IsNaN(projY)) || (projX == 0f && projY == 0f))
{
projX = (float)player.direction;
projY = 0f;
}
projPos += new Vector2(projX, projY);
Projectile.NewProjectile(Projectile.GetSource_FromThis(), projPos.X, projPos.Y, 0f, 0f, ModContent.ProjectileType<FlakKrakenProj>(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, (float)Projectile.whoAmI);
Projectile.netUpdate = true;
}
}
else
{
Projectile.Kill();
}
}
Projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - Projectile.Size / 2f;
Projectile.rotation = Projectile.velocity.ToRotation() + pi;
Projectile.spriteDirection = Projectile.direction;
Projectile.timeLeft = 2;
player.ChangeDir(Projectile.direction);
player.heldProj = Projectile.whoAmI;
player.itemTime = 2;
player.itemAnimation = 2;
player.itemRotation = (float)Math.Atan2((double)(Projectile.velocity.Y * (float)Projectile.direction), (double)(Projectile.velocity.X * (float)Projectile.direction));
}
public override bool? CanDamage() => false;
}
}
+245
View File
@@ -0,0 +1,245 @@
using System;
using CalamityMod.Items.Weapons.Ranged;
using CalamityMod.Particles;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.Audio;
using Terraria.DataStructures;
using Terraria.ID;
using Terraria.Localization;
using Terraria.ModLoader;
using static CalamityMod.Items.Weapons.Ranged.FlakKraken;
using static Terraria.ModLoader.ModContent;
namespace CalamityMod.Projectiles.Ranged
{
public class FlakKrakenHoldout : ModProjectile
{
public override LocalizedText DisplayName => CalamityUtils.GetItemName<FlakKraken>();
public override string Texture => "CalamityMod/Items/Weapons/Ranged/FlakKraken";
public Player Owner { get; set; }
public ref float ShootingTimer => ref Projectile.ai[0];
public ref float TimerBetweenBursts => ref Projectile.ai[1];
public ref float OffsetLengthScalar => ref Projectile.localAI[0];
// The type of dust used in the effects and the color of the particles that it'll use depending on the type of rocket used.
// It'll carry over to the projectiles that it shoots.
public static int DustEffectsID { get; set; }
public static Color EffectsColor { get; set; }
public override void SetDefaults()
{
Projectile.width = Projectile.height = 152;
Projectile.tileCollide = false;
Projectile.ignoreWater = true;
Projectile.netImportant = true;
}
public override void AI()
{
// If there's no player, or the player is the server, or the owner's stunned, there'll be no holdout.
if (Owner.CantUseHoldout())
{
Projectile.Kill();
NetUpdate();
return;
}
// The center of the player, taking into account if they have a mount or not.
Vector2 mountedCenter = Owner.MountedCenter;
// The vector between the player and the mouse.
Vector2 ownerToMouse = Owner.Calamity().mouseWorld - mountedCenter;
// Deals with the holdout's rotation and direction, the owner's arms, etc.
ManageHoldout(mountedCenter, ownerToMouse);
// If the timer reaches Item.useTime, it'll shoot.
// It'll shoot once immediately as the timer reaches.
Item heldItem = Owner.ActiveItem();
if (ShootingTimer >= heldItem.useAnimation)
{
float adaptiveTimeBetweenShots = MathF.Floor(TimeBetweenShots * heldItem.useAnimation / OriginalUseTime);
// Every X frames it'll shoot a projectile.
if (ShootingTimer % adaptiveTimeBetweenShots == 0f)
{
// We use the velocity of this projectile as its direction vector.
Vector2 direction = Projectile.velocity.SafeNormalize(Vector2.Zero);
// The position of the tip of the gun.
Vector2 nuzzlePosition = Projectile.Center + direction * Projectile.width / 2f;
// Every time we shoot we use ammo.
// With this method we also use the item's stats, like the shoot speed, or the type of ammo it was used.
Owner.PickAmmo(Owner.ActiveItem(), out _, out float itemShootSpeed, out int itemDamage, out float itemKnockback, out int rocketTypeShot);
// Decides the color of the effects depending on the type of rocket used.
switch (rocketTypeShot)
{
case ItemID.WetRocket:
DustEffectsID = 45;
EffectsColor = Color.RoyalBlue;
break;
case ItemID.LavaRocket:
DustEffectsID = DustID.Torch;
EffectsColor = Color.Red;
break;
case ItemID.HoneyRocket:
DustEffectsID = DustID.Honey;
EffectsColor = Color.Yellow;
break;
default:
DustEffectsID = 109;
EffectsColor = Color.Black;
break;
}
// Spawns the projectile.
Projectile.NewProjectileDirect(
Projectile.GetSource_FromThis(),
nuzzlePosition,
direction * itemShootSpeed,
ProjectileType<FlakKrakenProjectile>(),
itemDamage,
itemKnockback,
Projectile.owner,
rocketTypeShot,
ownerToMouse.Length());
// Applies the knockback to the player.
Owner.velocity += ownerToMouse.SafeNormalize(Vector2.UnitY) * -OwnerKnockbackStrength;
// Inside here go all the things that dedicated servers shouldn't spend resources on.
// Like visuals and sounds.
if (!Main.dedServ)
{
// By decreasing the offset length of the gun from the arms, we give an effect of recoil.
OffsetLengthScalar = 10f;
Owner.Calamity().GeneralScreenShakePower = 3.5f;
Particle shootPulse = new DirectionalPulseRing(nuzzlePosition,
Vector2.Zero,
Color.Gray * 0.7f,
new Vector2(0.5f, 1f),
Projectile.rotation,
0.1f,
0.4f,
20);
GeneralParticleHandler.SpawnParticle(shootPulse);
int smokeAmount = Main.rand.Next(12, 16 + 1);
for (int i = 0; i < smokeAmount; i++)
{
Particle smoke = new HeavySmokeParticle(
nuzzlePosition,
direction.RotatedByRandom(MathHelper.ToRadians(25f)) * Main.rand.NextFloat(2f, 30f),
EffectsColor * 0.1f,
Main.rand.Next(45, 61),
Main.rand.NextFloat(.6f, 1.3f),
Main.rand.NextFloat(0.2f, 0.35f));
GeneralParticleHandler.SpawnParticle(smoke);
}
int dustAmount = Main.rand.Next(15, 20 + 1);
for (int i = 0; i < dustAmount; i++)
{
Dust shootDust = Dust.NewDustPerfect(
nuzzlePosition,
DustEffectsID,
direction.RotatedByRandom(MathHelper.PiOver4 * 0.5f) * Main.rand.NextFloat(2f, 12f),
Scale: Main.rand.NextFloat(0.8f, 1f));
shootDust.fadeIn = 100f;
shootDust.noLight = false;
shootDust.noLightEmittence = false;
}
SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Item/FlakKrakenShoot") { Volume = 0.6f }, nuzzlePosition);
}
NetUpdate();
}
// When it has shot all the projectiles in the burst, reset all the variables and back to shooting.
if (ShootingTimer >= heldItem.useAnimation + adaptiveTimeBetweenShots * (ProjectilesPerBurst - 1))
{
ShootingTimer = 0f;
TimerBetweenBursts = 0f;
NetUpdate();
}
}
// When we change the distance of the gun from the arms for the recoil,
// recover to the original position smoothly.
if (OffsetLengthScalar != 30f)
OffsetLengthScalar = MathHelper.Lerp(OffsetLengthScalar, 30f, 0.05f);
ShootingTimer++;
}
#region AI Methods
public void ManageHoldout(Vector2 mountedCenter, Vector2 ownerToMouse)
{
Vector2 rotationVector = Projectile.rotation.ToRotationVector2();
float velocityRotation = Projectile.velocity.ToRotation();
float proximityLookingUpwards = Vector2.Dot(ownerToMouse.SafeNormalize(Vector2.Zero), -Vector2.UnitY);
int direction = MathF.Sign(ownerToMouse.X);
Vector2 armPosition = Owner.RotatedRelativePoint(mountedCenter, true);
Vector2 lengthOffset = rotationVector * OffsetLengthScalar;
Vector2 armOffset = new Vector2(Utils.Remap(proximityLookingUpwards, -1f, 1f, 15f, -18f) * direction, -20f + Utils.Remap(MathF.Abs(proximityLookingUpwards), 0f, 1f, 0f, proximityLookingUpwards > 0f ? 20f : 10f));
Projectile.Center = armPosition + lengthOffset + armOffset;
Projectile.velocity = velocityRotation.AngleTowards(ownerToMouse.ToRotation(), 0.2f).ToRotationVector2();
Projectile.rotation = velocityRotation;
Projectile.timeLeft = 2;
Owner.heldProj = Projectile.whoAmI;
Owner.itemTime = Owner.itemAnimation = 2;
Owner.itemRotation = (Projectile.velocity * Projectile.direction).ToRotation();
Projectile.spriteDirection = Projectile.direction = direction;
Owner.ChangeDir(direction);
float armRotation = Projectile.rotation - MathHelper.PiOver2; // -Pi/2 because the arms rotation starts with arms pointing down.
Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.ThreeQuarters, armRotation);
Owner.SetCompositeArmBack(true, Player.CompositeArmStretchAmount.Full, armRotation);
}
public void NetUpdate()
{
Projectile.netUpdate = true;
if (Projectile.netSpam >= 10)
Projectile.netSpam = 9;
}
#endregion
public override void OnSpawn(IEntitySource source)
{
Owner = Main.player[Projectile.owner];
OffsetLengthScalar = 30f;
}
// Because we use the velocity as a direction, we don't need it to change its position.
public override bool ShouldUpdatePosition() => false;
public override bool? CanDamage() => false;
public override bool PreDraw(ref Color lightColor)
{
Texture2D texture = Request<Texture2D>(Texture).Value;
Vector2 drawPosition = Projectile.Center - Main.screenPosition;
Color drawColor = Projectile.GetAlpha(lightColor);
float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f);
Vector2 rotationPoint = texture.Size() * 0.5f;
SpriteEffects flipSprite = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None;
Main.EntitySpriteDraw(texture, drawPosition, null, drawColor, drawRotation, rotationPoint, Projectile.scale, flipSprite);
return false;
}
}
}
-155
View File
@@ -1,155 +0,0 @@
using CalamityMod.Buffs.DamageOverTime;
using Microsoft.Xna.Framework;
using System;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Ranged
{
public class FlakKrakenProj : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Ranged";
public override void SetStaticDefaults()
{
ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10;
ProjectileID.Sets.TrailingMode[Projectile.type] = 0;
}
public override void SetDefaults()
{
Projectile.width = 54;
Projectile.height = 54;
Projectile.friendly = true;
Projectile.penetrate = -1;
Projectile.tileCollide = false;
Projectile.scale = 0.002f;
Projectile.timeLeft = 36000;
Projectile.DamageType = DamageClass.Ranged;
Projectile.ignoreWater = true;
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = 10;
}
public override void AI()
{
if (Projectile.type != ModContent.ProjectileType<FlakKrakenProj>() ||
!Main.projectile[(int)Projectile.ai[1]].active ||
Main.projectile[(int)Projectile.ai[1]].type != ModContent.ProjectileType<FlakKrakenGun>())
{
Projectile.Kill();
return;
}
// This code uses player-specific fields (such as the mouse), and does not need to be run for anyone
// other than its owner.
if (Main.myPlayer != Projectile.owner)
return;
// This needs to happen retroactively due to Deadshot Brooch and other potential items boosting updates
Projectile.localNPCHitCooldown = 10 * Projectile.MaxUpdates;
Projectile.rotation += 0.2f;
if (Projectile.localAI[0] < 1f)
{
Projectile.localAI[0] += 0.002f;
Projectile.scale += 0.002f;
Projectile.width = Projectile.height = (int)(50f * Projectile.scale);
}
else
{
Projectile.width = Projectile.height = 50;
}
Player player = Main.player[Projectile.owner];
Vector2 projPos = player.RotatedRelativePoint(player.MountedCenter, true);
float projX = (float)Main.mouseX + Main.screenPosition.X - projPos.X;
float projY = (float)Main.mouseY + Main.screenPosition.Y - projPos.Y;
if (player.gravDir == -1f)
{
projY = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - projPos.Y;
}
if ((float.IsNaN(projX) && float.IsNaN(projY)) || (projX == 0f && projY == 0f))
{
projX = (float)player.direction;
projY = 0f;
}
projPos += new Vector2(projX, projY);
float speed = 30f;
float speedScale = 3f;
Vector2 vectorPos = Projectile.Center;
if (Vector2.Distance(projPos, vectorPos) < 90f)
{
speed = 10f;
speedScale = 1f;
}
if (Vector2.Distance(projPos, vectorPos) < 30f)
{
speed = 3f;
speedScale = 0.3f;
}
if (Vector2.Distance(projPos, vectorPos) < 10f)
{
speed = 1f;
speedScale = 0.1f;
}
float projectileX = projPos.X - vectorPos.X;
float projectileY = projPos.Y - vectorPos.Y;
float projectileAdjust = (float)Math.Sqrt((double)(projectileX * projectileX + projectileY * projectileY));
projectileAdjust = speed / projectileAdjust;
projectileX *= projectileAdjust;
projectileY *= projectileAdjust;
if (Projectile.velocity.X < projectileX)
{
Projectile.velocity.X = Projectile.velocity.X + speedScale;
if (Projectile.velocity.X < 0f && projectileX > 0f)
{
Projectile.velocity.X = Projectile.velocity.X + speedScale;
}
}
else if (Projectile.velocity.X > projectileX)
{
Projectile.velocity.X = Projectile.velocity.X - speedScale;
if (Projectile.velocity.X > 0f && projectileX < 0f)
{
Projectile.velocity.X = Projectile.velocity.X - speedScale;
}
}
if (Projectile.velocity.Y < projectileY)
{
Projectile.velocity.Y = Projectile.velocity.Y + speedScale;
if (Projectile.velocity.Y < 0f && projectileY > 0f)
{
Projectile.velocity.Y = Projectile.velocity.Y + speedScale;
}
}
else if (Projectile.velocity.Y > projectileY)
{
Projectile.velocity.Y = Projectile.velocity.Y - speedScale;
if (Projectile.velocity.Y > 0f && projectileY < 0f)
{
Projectile.velocity.Y = Projectile.velocity.Y - speedScale;
}
}
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType<CrushDepth>(), 180);
public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType<CrushDepth>(), 180);
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
{
modifiers.SourceDamage *= Projectile.localAI[0];
}
public override Color? GetAlpha(Color lightColor)
{
return new Color(255, 200, 50, Projectile.alpha);
}
public override bool PreDraw(ref Color lightColor)
{
CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1);
return false;
}
}
}
+270
View File
@@ -0,0 +1,270 @@
using System.IO;
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Particles;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.DataStructures;
using Terraria.ID;
using Terraria.ModLoader;
using static CalamityMod.Items.Weapons.Ranged.FlakKraken;
using static CalamityMod.Projectiles.Ranged.FlakKrakenHoldout;
using static Terraria.ModLoader.ModContent;
namespace CalamityMod.Projectiles.Ranged
{
public class FlakKrakenProjectile : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Ranged";
public override string Texture => "CalamityMod/Projectiles/Summon/CalamarisLamentProjectile";
public ref float RocketID => ref Projectile.ai[0];
public ref float DistanceOwnerMouse => ref Projectile.ai[1];
public bool IsShrapnel
{
get => Projectile.ai[2] == 1f;
set => Projectile.ai[2] = value == true ? 1f : 0f;
}
public bool HasHitEnemyWithInitialShot;
public Player Owner { get; set; }
public override void SetStaticDefaults()
{
Main.projFrames[Type] = 5;
ProjectileID.Sets.TrailingMode[Type] = 2;
ProjectileID.Sets.TrailCacheLength[Type] = 12;
}
public override void SetDefaults()
{
Projectile.DamageType = DamageClass.Ranged;
Projectile.extraUpdates = 1;
Projectile.width = Projectile.height = 28;
Projectile.timeLeft = 600;
Projectile.localNPCHitCooldown = -1;
Projectile.friendly = true;
Projectile.ignoreWater = true;
Projectile.usesLocalNPCImmunity = true;
}
// Syncs other variables that can't fit into the Projectile.ai[] array.
public override void SendExtraAI(BinaryWriter writer)
{
writer.Write(HasHitEnemyWithInitialShot);
}
public override void ReceiveExtraAI(BinaryReader reader)
{
HasHitEnemyWithInitialShot = reader.ReadBoolean();
}
public override void AI()
{
// Enforces the gravity.
if (IsShrapnel)
{
if (Projectile.velocity.Y < 25f)
Projectile.velocity.Y += ProjectileGravityStrength;
}
// Scale for non Shrapnel
if (!IsShrapnel)
{
Projectile.scale = 1.5f;
Projectile.extraUpdates = 3;
}
// Rotates towards its velocity.
Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2;
Projectile.frameCounter++;
if (Projectile.frameCounter >= 4)
{
Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Type];
Projectile.frameCounter = 0;
}
// If it's the initial shot and the shot has gone past the distance of the player and the mouse when shooting,
// split into shrapnel.
if (!IsShrapnel && !Projectile.WithinRange(Owner.MountedCenter, DistanceOwnerMouse))
Projectile.Kill();
// Below here go all the things that dedicated servers shouldn't spend resources on.
// Like visuals and sounds.
if (Main.dedServ)
return;
// The projectile will fade away as its time alive is ending.
Projectile.alpha = (int)Utils.Remap(Projectile.timeLeft, 30f, 0f, 0f, 255f);
// Shrapnel trail
if (IsShrapnel)
{
if (Projectile.timeLeft % 2 == 0 && Projectile.timeLeft <= 590)
{
AltSparkParticle spark = new AltSparkParticle(Projectile.Center - Projectile.velocity * 1.5f, Projectile.velocity * 0.01f, false, 8, 1.3f, EffectsColor * 0.135f);
GeneralParticleHandler.SpawnParticle(spark);
}
}
else
{
Vector2 dustPos = Projectile.Center - Projectile.velocity * 3 + Main.rand.NextVector2Circular(12, 12);
Dust dust = Dust.NewDustPerfect(dustPos, Main.rand.NextBool(4) ? 191 : DustEffectsID);
dust.noGravity = true;
dust.scale = Main.rand.NextFloat(1.4f, 1.65f);
dust.velocity = -Projectile.velocity * Main.rand.NextFloat(0.1f, 0.7f);
}
Dust trailDust = Dust.NewDustDirect(Projectile.position,
Projectile.width,
Projectile.height,
DustEffectsID,
Scale: Main.rand.NextFloat(0.5f, 0.8f),
Alpha: 127);
trailDust.noGravity = true;
trailDust.noLight = true;
trailDust.alpha = (int)Utils.Remap(Projectile.timeLeft, 30f, 0f, 127f, 0f);
Lighting.AddLight(Projectile.Center, Color.White.ToVector3() * (IsShrapnel ? 0.3f : 1f));
}
public override void OnSpawn(IEntitySource source)
{
Owner = Main.player[Projectile.owner];
Projectile.scale = 1.5f;
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
target.AddBuff(BuffType<CrushDepth>(), 180);
if (!IsShrapnel)
HasHitEnemyWithInitialShot = true;
}
public override void OnHitPlayer(Player target, Player.HurtInfo info)
{
target.AddBuff(BuffType<CrushDepth>(), 180);
if (!IsShrapnel)
HasHitEnemyWithInitialShot = true;
}
// The initial shot deals less damage.
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) => modifiers.SourceDamage *= IsShrapnel ? 1f : InitialShotDamageMultiplier;
public override void ModifyHitPlayer(Player target, ref Player.HurtModifiers modifiers) => modifiers.SourceDamage *= IsShrapnel ? 1f : InitialShotDamageMultiplier;
public override void OnKill(int timeLeft)
{
var info = new CalamityUtils.RocketBehaviorInfo((int)RocketID)
{
// Since we use our own spawning method for the cluster rockets, we don't need them to shoot anything,
// we'll do it ourselves.
clusterProjectileID = ProjectileID.None,
destructiveClusterProjectileID = ProjectileID.None,
};
int blastRadius = Projectile.RocketBehavior(info);
Projectile.ExpandHitboxBy((float)blastRadius);
Projectile.Damage();
if (!IsShrapnel)
{
bool usedClusterRockets = RocketID == ItemID.ClusterRocketI || RocketID == ItemID.ClusterRocketII;
int flakAmount = usedClusterRockets ? ClusterShrapnelAmount : ShrapnelAmount;
for (int i = 0; i < flakAmount; i++)
{
Projectile shrapnel = Projectile.NewProjectileDirect(
Projectile.GetSource_FromThis(),
Projectile.Center,
Projectile.velocity.SafeNormalize(-Vector2.UnitY).RotatedByRandom(usedClusterRockets ? ClusterShrapnelAngleOffset : ShrapnelAngleOffset) * ProjectileShootSpeed * Main.rand.NextFloat(0.45f, 0.85f),
ProjectileType<FlakKrakenProjectile>(),
(int)(Projectile.damage * (HasHitEnemyWithInitialShot ? InitialShotHitShrapnelDamageMultiplier : .6f)),
Projectile.knockBack,
Projectile.owner,
RocketID,
ai2: 1f);
// Since the shrapnel and the initial shot are the same projectile,
// and we want to apply the damage penalty for hitting with the initial shot,
// all shrapnel will have this bool on and we'll apply the penalty here.
if (HasHitEnemyWithInitialShot)
shrapnel.ModProjectile<FlakKrakenProjectile>().HasHitEnemyWithInitialShot = true;
}
}
// Since we do our own spread for the cluster rockets, it won't explode tiles.
// So we do it manually here.
if (RocketID == ItemID.ClusterRocketII)
Projectile.ExplodeTiles(blastRadius, info.respectStandardBlastImmunity, info.tilesToCheck, info.wallsToCheck);
// Inside here go all the things that dedicated servers shouldn't spend resources on.
// Like visuals and sounds.
if (Main.dedServ)
return;
// These effects will only run if the initial shot is splitting,
// or the shrapnel doesn't have the damage pentalty, so we don't have effect overload.
if (!IsShrapnel || (IsShrapnel && !HasHitEnemyWithInitialShot))
{
int dustAmount = Main.rand.Next(20, 30 + 1);
for (int i = 0; i < dustAmount; i++)
{
Dust boomDust = Dust.NewDustPerfect(Projectile.Center,
DustEffectsID,
Main.rand.NextVector2Circular(5f, 5f),
newColor: EffectsColor,
Scale: Main.rand.NextFloat(.8f, 1.2f));
boomDust.noLight = true;
boomDust.noLightEmittence = true;
}
Particle boomRing = new DirectionalPulseRing(Projectile.Center,
Vector2.Zero,
Color.White * 0.3f,
Vector2.One,
0f,
Projectile.width / 1560f,
Projectile.width / 156f,
20);
GeneralParticleHandler.SpawnParticle(boomRing);
int blobAmount = Main.rand.Next(4, 6 + 1);
for (int i = 0; i < blobAmount; i++)
{
Particle blob = new WaterGlobParticle(Projectile.Center,
Main.rand.NextVector2Circular(5f, 5f),
Main.rand.NextFloat(0.8f, 1.2f));
blob.Color = EffectsColor;
GeneralParticleHandler.SpawnParticle(blob);
}
int mistAmount = Main.rand.Next(3, 5 + 1);
for (int mistIndex = 0; mistIndex < mistAmount; mistIndex++)
{
float angle = MathHelper.TwoPi / mistAmount * mistIndex;
Vector2 velocity = angle.ToRotationVector2() * Main.rand.NextFloat(2f, 7f);
Particle boomMist = new HeavySmokeParticle(Projectile.Center,
velocity,
EffectsColor * Main.rand.NextFloat(0.15f, 0.25f),
Main.rand.Next(45, 61),
Main.rand.NextFloat(.4f, 1.1f),
Main.rand.NextFloat(0.2f, 0.35f));
GeneralParticleHandler.SpawnParticle(boomMist);
}
}
}
public override bool PreDraw(ref Color lightColor)
{
Texture2D texture = Request<Texture2D>(Texture).Value;
Vector2 drawPosition = Projectile.Center - Main.screenPosition;
Rectangle frame = texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame);
Color drawColor = IsShrapnel ? Projectile.GetAlpha(lightColor) : Color.Black;
Vector2 origin = frame.Size() * 0.5f;
CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor * 0.3f);
Main.EntitySpriteDraw(texture, drawPosition, frame, drawColor, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None);
return false;
}
}
}
+236
View File
@@ -0,0 +1,236 @@
using System;
using CalamityMod.Items.Weapons.Ranged;
using CalamityMod.Particles;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.Audio;
using Terraria.DataStructures;
using Terraria.ID;
using Terraria.Localization;
using Terraria.ModLoader;
using static CalamityMod.Items.Weapons.Ranged.FlakToxicannon;
using static Terraria.ModLoader.ModContent;
namespace CalamityMod.Projectiles.Ranged
{
public class FlakToxicannonHoldout : ModProjectile, ILocalizedModType
{
public override LocalizedText DisplayName => CalamityUtils.GetItemName<FlakToxicannon>();
public override string Texture => "CalamityMod/Items/Weapons/Ranged/FlakToxicannon";
public Player Owner { get; set; }
public ref float ShootingTimer => ref Projectile.ai[0];
public ref float TimerBetweenBursts => ref Projectile.ai[1];
public ref float OffsetLengthScalar => ref Projectile.localAI[0];
// The type of dust used in the effects and the color of the particles that it'll use depending on the type of rocket used.
// It'll carry over to the projectiles that it shoots.
public static int DustEffectsID { get; set; }
public static Color EffectsColor { get; set; }
public override void SetDefaults()
{
Projectile.width = Projectile.height = 88;
Projectile.tileCollide = false;
Projectile.ignoreWater = true;
Projectile.netImportant = true;
}
public override void AI()
{
// If there's no player, or the player is the server, or the owner's stunned, there'll be no holdout.
if (Owner.CantUseHoldout())
{
Projectile.Kill();
NetUpdate();
return;
}
// The center of the player, taking into account if they have a mount or not.
Vector2 mountedCenter = Owner.MountedCenter;
// The vector between the player and the mouse.
Vector2 ownerToMouse = Owner.Calamity().mouseWorld - mountedCenter;
// Deals with the holdout's rotation and direction, the owner's arms, etc.
ManageHoldout(mountedCenter, ownerToMouse);
// If the timer reaches Item.useTime, it'll shoot.
// It'll shoot once immediately as the timer reaches.
Item heldItem = Owner.ActiveItem();
if (ShootingTimer >= heldItem.useAnimation)
{
// We use the velocity of this projectile as its direction vector.
Vector2 direction = Projectile.velocity.SafeNormalize(Vector2.Zero);
// The position of the tip of the gun.
Vector2 nuzzlePosition = Projectile.Center + direction * Projectile.width / 2f;
// Every time we shoot we use ammo.
// With this method we also use the item's stats, like the shoot speed, or the type of ammo it was used.
Owner.PickAmmo(Owner.ActiveItem(), out _, out float itemShootSpeed, out int itemDamage, out float itemKnockback, out int rocketTypeShot);
// Decides the color of the effects depending on the type of rocket used.
switch (rocketTypeShot)
{
case ItemID.WetRocket:
DustEffectsID = 45;
EffectsColor = Color.RoyalBlue;
break;
case ItemID.LavaRocket:
DustEffectsID = DustID.Torch;
EffectsColor = Color.Red;
break;
case ItemID.HoneyRocket:
DustEffectsID = DustID.Honey;
EffectsColor = Color.Yellow;
break;
default:
DustEffectsID = 298;
EffectsColor = Color.GreenYellow;
break;
}
// Spawns the projectile.
Projectile.NewProjectileDirect(
Projectile.GetSource_FromThis(),
nuzzlePosition,
direction * itemShootSpeed,
ProjectileType<FlakToxicannonProjectile>(),
itemDamage,
itemKnockback,
Projectile.owner,
rocketTypeShot,
ownerToMouse.Length());
// Applies the knockback to the player.
Owner.velocity += ownerToMouse.SafeNormalize(Vector2.UnitY) * -OwnerKnockbackStrength;
// Inside here go all the things that dedicated servers shouldn't spend resources on.
// Like visuals and sounds.
if (!Main.dedServ)
{
// By decreasing the offset length of the gun from the arms, we give an effect of recoil.
OffsetLengthScalar = 25f;
Owner.Calamity().GeneralScreenShakePower = 2f;
Particle shootPulse = new DirectionalPulseRing(nuzzlePosition,
Vector2.Zero,
Color.Gray * 0.7f,
new Vector2(0.5f, 1f),
Projectile.rotation,
0.1f,
0.4f,
20);
GeneralParticleHandler.SpawnParticle(shootPulse);
int smokeAmount = Main.rand.Next(8, 12 + 1);
for (int i = 0; i < smokeAmount; i++)
{
Particle smoke = new HeavySmokeParticle(
nuzzlePosition,
direction.RotatedByRandom(MathHelper.ToRadians(25f)) * Main.rand.NextFloat(2f, 30f),
EffectsColor * 0.4f,
Main.rand.Next(45, 61),
Main.rand.NextFloat(.6f, 1.3f),
Main.rand.NextFloat(0.2f, 0.35f),
0,
true);
GeneralParticleHandler.SpawnParticle(smoke);
}
int dustAmount = Main.rand.Next(10, 15 + 1);
for (int i = 0; i < dustAmount; i++)
{
Dust shootDust = Dust.NewDustPerfect(
nuzzlePosition,
DustEffectsID,
direction.RotatedByRandom(MathHelper.PiOver4 * 0.5f) * Main.rand.NextFloat(2f, 12f),
Scale: Main.rand.NextFloat(0.8f, 1f));
shootDust.fadeIn = 100f;
shootDust.noLight = false;
shootDust.noLightEmittence = false;
}
SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Item/FlakKrakenShoot") { Pitch = 0.65f, Volume = 0.5f }, nuzzlePosition);
}
ShootingTimer = 0f;
NetUpdate();
}
// When we change the distance of the gun from the arms for the recoil,
// recover to the original position smoothly.
if (OffsetLengthScalar != 38f)
OffsetLengthScalar = MathHelper.Lerp(OffsetLengthScalar, 38f, 0.1f);
ShootingTimer++;
}
#region AI Methods
public void ManageHoldout(Vector2 mountedCenter, Vector2 ownerToMouse)
{
Vector2 rotationVector = Projectile.rotation.ToRotationVector2();
float velocityRotation = Projectile.velocity.ToRotation();
float proximityLookingUpwards = Vector2.Dot(ownerToMouse.SafeNormalize(Vector2.Zero), -Vector2.UnitY);
int direction = MathF.Sign(ownerToMouse.X);
Vector2 armPosition = Owner.RotatedRelativePoint(mountedCenter, true);
Vector2 lengthOffset = rotationVector * OffsetLengthScalar;
Vector2 armOffset = new Vector2(Utils.Remap(proximityLookingUpwards, -1f, 1f, 2f, -10f) * direction, -10f + Utils.Remap(MathF.Abs(proximityLookingUpwards), 0f, 1f, 0f, proximityLookingUpwards > 0f ? 10f : 5f));
Projectile.Center = armPosition + lengthOffset + armOffset;
Projectile.velocity = velocityRotation.AngleTowards(ownerToMouse.ToRotation(), 0.2f).ToRotationVector2();
Projectile.rotation = velocityRotation;
Projectile.timeLeft = 2;
Owner.heldProj = Projectile.whoAmI;
Owner.itemTime = Owner.itemAnimation = 2;
Owner.itemRotation = (Projectile.velocity * Projectile.direction).ToRotation();
Projectile.spriteDirection = Projectile.direction = direction;
Owner.ChangeDir(direction);
float armRotation = Projectile.rotation - MathHelper.PiOver2; // -Pi/2 because the arms rotation starts with arms pointing down.
Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.ThreeQuarters, armRotation);
Owner.SetCompositeArmBack(true, Player.CompositeArmStretchAmount.Full, armRotation + MathHelper.ToRadians(25f) * direction);
}
public void NetUpdate()
{
Projectile.netUpdate = true;
if (Projectile.netSpam >= 10)
Projectile.netSpam = 9;
}
#endregion
public override void OnSpawn(IEntitySource source)
{
Owner = Main.player[Projectile.owner];
OffsetLengthScalar = 38f;
}
// Because we use the velocity as a direction, we don't need it to change its position.
public override bool ShouldUpdatePosition() => false;
public override bool? CanDamage() => false;
public override bool PreDraw(ref Color lightColor)
{
Texture2D texture = Request<Texture2D>(Texture).Value;
Vector2 drawPosition = Projectile.Center - Main.screenPosition;
Color drawColor = Projectile.GetAlpha(lightColor);
float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f);
Vector2 rotationPoint = texture.Size() * 0.5f;
SpriteEffects flipSprite = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None;
Main.EntitySpriteDraw(texture, drawPosition, null, drawColor, drawRotation, rotationPoint, Projectile.scale, flipSprite);
return false;
}
}
}
@@ -0,0 +1,265 @@
using System.IO;
using CalamityMod.Buffs.StatDebuffs;
using CalamityMod.Particles;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.DataStructures;
using Terraria.ID;
using Terraria.ModLoader;
using static CalamityMod.Items.Weapons.Ranged.FlakToxicannon;
using static CalamityMod.Projectiles.Ranged.FlakToxicannonHoldout;
using static Terraria.ModLoader.ModContent;
namespace CalamityMod.Projectiles.Ranged
{
public class FlakToxicannonProjectile : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Ranged";
public override string Texture => "CalamityMod/Projectiles/Enemy/FlakAcid";
public ref float RocketID => ref Projectile.ai[0];
public ref float DistanceOwnerMouse => ref Projectile.ai[1];
public bool IsShrapnel
{
get => Projectile.ai[2] == 1f;
set => Projectile.ai[2] = value == true ? 1f : 0f;
}
public bool HasHitEnemyWithInitialShot;
public Player Owner { get; set; }
public override void SetStaticDefaults()
{
ProjectileID.Sets.TrailingMode[Type] = 2;
ProjectileID.Sets.TrailCacheLength[Type] = 12;
}
public override void SetDefaults()
{
Projectile.DamageType = DamageClass.Ranged;
Projectile.extraUpdates = 1;
Projectile.width = Projectile.height = 23;
Projectile.timeLeft = 600;
Projectile.localNPCHitCooldown = -1;
Projectile.friendly = true;
Projectile.ignoreWater = true;
Projectile.usesLocalNPCImmunity = true;
}
// Syncs other variables that can't fit into the Projectile.ai[] array.
public override void SendExtraAI(BinaryWriter writer)
{
writer.Write(HasHitEnemyWithInitialShot);
}
public override void ReceiveExtraAI(BinaryReader reader)
{
HasHitEnemyWithInitialShot = reader.ReadBoolean();
}
public override void AI()
{
// Enforces the gravity.
if (IsShrapnel)
{
if (Projectile.velocity.Y < 25f)
Projectile.velocity.Y += ProjectileGravityStrength;
}
// Scale for non Shrapnel
if (!IsShrapnel)
{
Projectile.scale = 1.3f;
Projectile.extraUpdates = 2;
}
// Rotates towards its velocity.
Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2;
// If it's the initial shot and the shot has gone past the distance of the player and the mouse when shooting,
// split into shrapnel.
if (!IsShrapnel && !Projectile.WithinRange(Owner.MountedCenter, DistanceOwnerMouse))
Projectile.Kill();
// Below here go all the things that dedicated servers shouldn't spend resources on.
// Like visuals and sounds.
if (Main.dedServ)
return;
// The projectile will fade away as its time alive is ending.
Projectile.alpha = (int)Utils.Remap(Projectile.timeLeft, 30f, 0f, 0f, 255f);
// Shrapnel trail
if (IsShrapnel)
{
if (Projectile.timeLeft % 2 == 0 && Projectile.timeLeft <= 590)
{
AltSparkParticle spark = new AltSparkParticle(Projectile.Center - Projectile.velocity * 1.5f, Projectile.velocity * 0.01f, false, 8, 1.3f, EffectsColor * 0.135f);
GeneralParticleHandler.SpawnParticle(spark);
}
}
else
{
Vector2 dustPos = Projectile.Center - Projectile.velocity * 3 + Main.rand.NextVector2Circular(12, 12);
Dust dust = Dust.NewDustPerfect(dustPos, Main.rand.NextBool(3) ? 299 : DustEffectsID);
dust.noGravity = true;
dust.scale = Main.rand.NextFloat(1.4f, 1.65f);
dust.velocity = -Projectile.velocity * Main.rand.NextFloat(0.1f, 0.7f);
}
Dust trailDust = Dust.NewDustDirect(Projectile.position,
Projectile.width,
Projectile.height,
Main.rand.NextBool(3) ? 299 : DustEffectsID,
Scale: Main.rand.NextFloat(0.5f, 0.8f),
Alpha: 127);
trailDust.noGravity = true;
trailDust.noLight = true;
trailDust.alpha = (int)Utils.Remap(Projectile.timeLeft, 30f, 0f, 127f, 0f);
Lighting.AddLight(Projectile.Center, Color.GreenYellow.ToVector3() * (IsShrapnel ? 1.5f : 2.5f));
}
public override void OnSpawn(IEntitySource source)
{
Owner = Main.player[Projectile.owner];
Projectile.scale = 1.5f;
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
target.AddBuff(BuffType<Irradiated>(), 180);
if (!IsShrapnel)
HasHitEnemyWithInitialShot = true;
}
public override void OnHitPlayer(Player target, Player.HurtInfo info)
{
target.AddBuff(BuffType<Irradiated>(), 180);
if (!IsShrapnel)
HasHitEnemyWithInitialShot = true;
}
// The initial shot deals less damage.
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) => modifiers.SourceDamage *= IsShrapnel ? 1f : InitialShotDamageMultiplier;
public override void ModifyHitPlayer(Player target, ref Player.HurtModifiers modifiers) => modifiers.SourceDamage *= IsShrapnel ? 1f : InitialShotDamageMultiplier;
public override void OnKill(int timeLeft)
{
var info = new CalamityUtils.RocketBehaviorInfo((int)RocketID)
{
// Since we use our own spawning method for the cluster rockets, we don't need them to shoot anything,
// we'll do it ourselves.
clusterProjectileID = ProjectileID.None,
destructiveClusterProjectileID = ProjectileID.None,
};
int blastRadius = Projectile.RocketBehavior(info);
Projectile.ExpandHitboxBy((float)blastRadius);
Projectile.Damage();
if (!IsShrapnel)
{
bool usedClusterRockets = RocketID == ItemID.ClusterRocketI || RocketID == ItemID.ClusterRocketII;
int flakAmount = usedClusterRockets ? ClusterShrapnelAmount : ShrapnelAmount;
for (int i = 0; i < flakAmount; i++)
{
Projectile shrapnel = Projectile.NewProjectileDirect(
Projectile.GetSource_FromThis(),
Projectile.Center,
Projectile.velocity.SafeNormalize(-Vector2.UnitY).RotatedByRandom(usedClusterRockets ? ClusterShrapnelAngleOffset : ShrapnelAngleOffset) * ProjectileShootSpeed * Main.rand.NextFloat(0.45f, 0.85f),
ProjectileType<FlakToxicannonProjectile>(),
(int)(Projectile.damage * (HasHitEnemyWithInitialShot ? InitialShotHitShrapnelDamageMultiplier : .6f)),
Projectile.knockBack,
Projectile.owner,
RocketID,
ai2: 1f);
// Since the shrapnel and the initial shot are the same projectile,
// and we want to apply the damage penalty for hitting with the initial shot,
// all shrapnel will have this bool on and we'll apply the penalty here.
if (HasHitEnemyWithInitialShot)
shrapnel.ModProjectile<FlakToxicannonProjectile>().HasHitEnemyWithInitialShot = true;
}
}
// Since we do our own spread for the cluster rockets, it won't explode tiles.
// So we do it manually here.
if (RocketID == ItemID.ClusterRocketII)
Projectile.ExplodeTiles(blastRadius, info.respectStandardBlastImmunity, info.tilesToCheck, info.wallsToCheck);
// Inside here go all the things that dedicated servers shouldn't spend resources on.
// Like visuals and sounds.
if (Main.dedServ)
return;
for (int i = 0; i < (IsShrapnel ? 4 : 12); ++i)
{
int sprayLifetime = Main.rand.Next(15, 20 + 1);
float sprayScale = Main.rand.NextFloat(0.6f, 0.8f);
Color sprayColor = Main.rand.NextBool(3) ? Color.Chartreuse : EffectsColor;
if (Main.rand.NextBool(14))
sprayScale *= 2f;
float randomSpeedMultiplier = Main.rand.NextFloat(1.25f, 2.25f);
Vector2 sprayVelocity = Main.rand.NextVector2Unit() * 5 * randomSpeedMultiplier;
sprayVelocity.Y -= 5f;
BloodParticle spray = new BloodParticle(Projectile.Center, sprayVelocity, sprayLifetime, sprayScale, sprayColor);
GeneralParticleHandler.SpawnParticle(spray);
}
// These effects will only run if the initial shot is splitting,
// or the shrapnel doesn't have the damage pentalty, so we don't have effect overload.
if (!IsShrapnel || (IsShrapnel && !HasHitEnemyWithInitialShot))
{
int dustAmount = Main.rand.Next(14, 23 + 1);
for (int i = 0; i < dustAmount; i++)
{
Dust boomDust = Dust.NewDustPerfect(Projectile.Center,
Main.rand.NextBool(4) ? 299 : DustEffectsID,
Main.rand.NextVector2Circular(5f, 5f),
newColor: EffectsColor,
Scale: Main.rand.NextFloat(.8f, 1.2f));
boomDust.noLight = true;
boomDust.noLightEmittence = true;
}
Particle boomRing = new DirectionalPulseRing(Projectile.Center,
Vector2.Zero,
Color.White * 0.3f,
Vector2.One,
0f,
Projectile.width / 1560f,
Projectile.width / 156f,
20);
GeneralParticleHandler.SpawnParticle(boomRing);
int mistAmount = Main.rand.Next(3, 5 + 1);
for (int mistIndex = 0; mistIndex < mistAmount; mistIndex++)
{
float angle = MathHelper.TwoPi / mistAmount * mistIndex;
Vector2 velocity = angle.ToRotationVector2() * Main.rand.NextFloat(2f, 7f);
Particle boomMist = new HeavySmokeParticle(Projectile.Center,
velocity,
EffectsColor * Main.rand.NextFloat(0.35f, 0.55f),
Main.rand.Next(45, 61),
Main.rand.NextFloat(.4f, 1.1f),
Main.rand.NextFloat(0.2f, 0.35f),
0,
true);
GeneralParticleHandler.SpawnParticle(boomMist);
}
}
}
public override bool PreDraw(ref Color lightColor)
{
Texture2D texture = IsShrapnel ? Request<Texture2D>("CalamityMod/Projectiles/Environment/AcidDrop").Value : Request<Texture2D>(Texture).Value;
Color drawColor = Projectile.GetAlpha(lightColor);
CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], drawColor * 0.35f, 1, texture);
return false;
}
}
}
@@ -77,7 +77,7 @@ namespace CalamityMod.Projectiles.Ranged
Projectile.ai[1] = (float)(initialRate - fireRateMult * fireRate);
shouldShoot = true;
}
bool canShoot = player.channel && player.HasAmmo(player.ActiveItem()) && !player.noItems && !player.CCed;
bool canShoot = !player.CantUseHoldout() && player.HasAmmo(player.ActiveItem());
if (Projectile.localAI[0] > 0f)
{
Projectile.localAI[0] -= 1f;
+3 -3
View File
@@ -1,7 +1,7 @@
using CalamityMod.Items;
using System;
using CalamityMod.Items;
using CalamityMod.Items.Weapons.Ranged;
using Microsoft.Xna.Framework;
using System;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
@@ -143,7 +143,7 @@ namespace CalamityMod.Projectiles.Ranged
// This grabs the weapon's current damage, taking current charge level into account.
int currentDamage = player.GetWeaponDamage(freedomStar);
bool stillInUse = player.channel && !player.noItems && !player.CCed;
bool stillInUse = !player.CantUseHoldout();
// Checks if the Freedom Star has sufficient charge to fire. If this is false, it stops functioning.
CalamityGlobalItem modItem = freedomStar.Calamity();
+8 -12
View File
@@ -1,8 +1,5 @@
using CalamityMod.Items.Weapons.Ranged;
using CalamityMod.Particles;
using Microsoft.Xna.Framework;
using ReLogic.Utilities;
using System;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
@@ -15,7 +12,6 @@ namespace CalamityMod.Projectiles.Ranged
{
// Take the name and texture from the weapon
public override LocalizedText DisplayName => CalamityUtils.GetItemName<Kingsbane>();
private bool OwnerCanShoot => Owner.channel && !Owner.noItems && !Owner.CCed;
public override string Texture => "CalamityMod/Projectiles/Ranged/KingsbaneWindUp";
private Player Owner => Main.player[Projectile.owner];
@@ -47,7 +43,7 @@ namespace CalamityMod.Projectiles.Ranged
soundTimer++;
Projectile.frameCounter++;
if (Projectile.frameCounter > windupAnim && OwnerCanShoot)
if (Projectile.frameCounter > windupAnim && !Owner.CantUseHoldout())
{
if (Projectile.frame == 1 && Time < 85)
{
@@ -59,7 +55,7 @@ namespace CalamityMod.Projectiles.Ranged
windupAnim--;
Projectile.frameCounter = 0;
}
else if (!OwnerCanShoot)
else if (Owner.CantUseHoldout())
{
Projectile.frame++;
}
@@ -74,14 +70,14 @@ namespace CalamityMod.Projectiles.Ranged
}
Vector2 armPosition = Owner.RotatedRelativePoint(Owner.MountedCenter, true);
Vector2 tipPosition = armPosition + Projectile.velocity * Projectile.width * 0.85f + new Vector2 (0, 3.8f);
Vector2 tipPosition = armPosition + Projectile.velocity * Projectile.width * 0.85f + new Vector2(0, 3.8f);
Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * 15;
int bulletAMMO = ProjectileID.Bullet;
Owner.PickAmmo(Owner.ActiveItem(), out bulletAMMO, out float SpeedNoUse, out int bulletDamage, out float kBackNoUse, out int _);
// Fire Auric Bullets if the owner stops channeling or otherwise cannot use the weapon.
if (!OwnerCanShoot)
if (Owner.CantUseHoldout())
{
if (fullRev && fullRevShots > 0)
{
@@ -125,13 +121,13 @@ namespace CalamityMod.Projectiles.Ranged
dust3.scale = Main.rand.NextFloat(0.9f, 1.6f);
}
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Owner.Center, shootVelocity.RotatedByRandom(MathHelper.ToRadians(1.5f)), bulletAMMO, Projectile.damage, Projectile.knockBack, Projectile.owner);
SoundEngine.PlaySound(SoundID.Item41 with { Volume = 0.75f}, Projectile.Center);
SoundEngine.PlaySound(SoundID.Item41 with { Volume = 0.75f }, Projectile.Center);
framesBetweenShots = 3;
}
if (framesBetweenShots > 0)
framesBetweenShots--;
}
}
UpdateProjectileHeldVariables(armPosition);
ManipulatePlayerVariables();
@@ -150,12 +146,12 @@ namespace CalamityMod.Projectiles.Ranged
Projectile.netUpdate = true;
}
}
Projectile.Center = armPosition + Projectile.velocity * MathHelper.Clamp(47f - (framesBetweenShots * 2), 0f, 47f) + new Vector2 (0, 5);
Projectile.Center = armPosition + Projectile.velocity * MathHelper.Clamp(47f - (framesBetweenShots * 2), 0f, 47f) + new Vector2(0, 5);
Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f);
Projectile.spriteDirection = Projectile.direction;
// Rumble
if (!OwnerCanShoot)
if (Owner.CantUseHoldout())
{
Projectile.position += Main.rand.NextVector2Circular(4.5f, 4.5f);
}
+1 -4
View File
@@ -13,9 +13,7 @@ namespace CalamityMod.Projectiles.Ranged
{
public override LocalizedText DisplayName => CalamityUtils.GetItemName<TheMaelstrom>();
private Player Owner => Main.player[Projectile.owner];
private bool OwnerCanShoot => Owner.channel && Owner.HasAmmo(Owner.ActiveItem()) && !Owner.noItems && !Owner.CCed;
private ref float CurrentChargingFrames => ref Projectile.ai[0];
private ref float ArrowsLoaded => ref Projectile.ai[1];
private ref float FramesToLoadNextArrow => ref Projectile.localAI[0];
public override string Texture => "CalamityMod/Items/Weapons/Ranged/TheMaelstrom";
@@ -37,7 +35,7 @@ namespace CalamityMod.Projectiles.Ranged
Vector2 shootPosition = armPosition + Projectile.velocity * Projectile.width * 0.5f;
// Destroy the holdout projectile if the owner is no longer eligible to hold it.
if (!OwnerCanShoot)
if (Owner.CantUseHoldout() || !Owner.HasAmmo(Owner.ActiveItem()))
{
Projectile.Kill();
return;
@@ -93,7 +91,6 @@ namespace CalamityMod.Projectiles.Ranged
float shootSpeed = heldItem.shootSpeed;
float knockback = heldItem.knockBack;
bool uselessFuckYou = OwnerCanShoot;
int projectileType = 0;
Owner.PickAmmo(heldItem, out projectileType, out shootSpeed, out arrowDamage, out knockback, out _);
projectileType = ModContent.ProjectileType<TheMaelstromShark>();
+2 -4
View File
@@ -29,8 +29,6 @@ namespace CalamityMod.Projectiles.Ranged
private bool FullyCharged => CurrentChargingFrames >= MagnaCannon.FullChargeFrames;
public int Time = 0;
private bool OwnerCanShoot => Owner.channel && !Owner.noItems && !Owner.CCed;
public override void SetDefaults()
{
Projectile.width = 58;
@@ -62,7 +60,7 @@ namespace CalamityMod.Projectiles.Ranged
ChargeSound.Position = Projectile.Center;
// Fire if the owner stops channeling or otherwise cannot use the weapon.
if (!OwnerCanShoot)
if (Owner.CantUseHoldout())
{
if (ShotsLoaded > 0)
{
@@ -158,7 +156,7 @@ namespace CalamityMod.Projectiles.Ranged
// Rumble (only while channeling)
float rumble = MathHelper.Clamp(CurrentChargingFrames, 0f, MagnaCannon.FullChargeFrames);
if (OwnerCanShoot)
if (!Owner.CantUseHoldout())
Projectile.position += Main.rand.NextVector2Circular(rumble / 43f, rumble / 43f);
}
+4 -2
View File
@@ -31,9 +31,11 @@ namespace CalamityMod.Projectiles.Ranged
public override void AI()
{
bool cantUse = Owner == null || !Owner.active || Owner.dead || !Owner.channel || Owner.CCed || Owner.noItems;
if (cantUse)
if (Owner.CantUseHoldout())
{
Projectile.Kill();
return;
}
Vector2 mouse = Owner.Calamity().mouseWorld;
+1 -1
View File
@@ -66,7 +66,7 @@ namespace CalamityMod.Projectiles.Ranged
Projectile.ai[1] = baseUseTime - modifier * Projectile.localAI[0];
timeToFire = true;
}
bool canFire = player.channel && player.HasAmmo(player.ActiveItem()) && !player.noItems && !player.CCed;
bool canFire = !player.CantUseHoldout() && player.HasAmmo(player.ActiveItem());
if (Projectile.soundDelay <= 0 && canFire)
{
Projectile.soundDelay = baseUseTime - modifier * (int)Projectile.localAI[0];
+2 -3
View File
@@ -26,7 +26,6 @@ namespace CalamityMod.Projectiles.Ranged
private ref float CurrentChargingFrames => ref Projectile.ai[0];
private bool FullyCharged => CurrentChargingFrames >= OpalStriker.FullChargeFrames;
public int Time = 0;
private bool OwnerCanShoot => Owner.channel && !Owner.noItems && !Owner.CCed;
public override void SetDefaults()
{
@@ -59,7 +58,7 @@ namespace CalamityMod.Projectiles.Ranged
ChargeSound.Position = Projectile.Center;
// Fire if the owner stops channeling or otherwise cannot use the weapon.
if (!OwnerCanShoot)
if (Owner.CantUseHoldout())
{
if (Projectile.ai[1] != 1f)
{
@@ -146,7 +145,7 @@ namespace CalamityMod.Projectiles.Ranged
// Rumble (only while channeling)
float rumble = MathHelper.Clamp(CurrentChargingFrames, 0f, OpalStriker.FullChargeFrames);
if (OwnerCanShoot)
if (!Owner.CantUseHoldout())
Projectile.position += Main.rand.NextVector2Circular(rumble / 30f, rumble / 30f);
}
+1 -1
View File
@@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Ranged
fullSpeed = true;
int arg_1EF4_0 = (int)Projectile.ai[0] / (delayCompare - fireSpeedCompare * fireSpeed);
}
bool canUseItem = player.channel && player.HasAmmo(player.ActiveItem()) && !player.noItems && !player.CCed;
bool canUseItem = !player.CantUseHoldout() && player.HasAmmo(player.ActiveItem());
if (Projectile.localAI[0] > 0f)
{
Projectile.localAI[0] -= 1f;
+1 -2
View File
@@ -26,7 +26,6 @@ namespace CalamityMod.Projectiles.Ranged
private Player Owner => Main.player[Projectile.owner];
private bool OwnerCanShoot => Owner.channel && !Owner.noItems && !Owner.CCed;
private ref float CurrentChargingFrames => ref Projectile.ai[0];
private ref float PumpkinsCharge => ref Projectile.ai[1];
private ref float FramesToLoadNextPumpkin => ref Projectile.localAI[0];
@@ -50,7 +49,7 @@ namespace CalamityMod.Projectiles.Ranged
Vector2 tipPosition = armPosition + Projectile.velocity * Projectile.width * 0.5f;
// Unloads all pumpkins if you can't shoot/stop holding out the projectile or if the gun is overfilled
if (!OwnerCanShoot || Overfilled == 1f)
if (Owner.CantUseHoldout() || Overfilled == 1f)
{
if (PumpkinsCharge <= 0f && Overfilled == 0f) //If the projectile isnt playing its animation and if there arent any pumpkins loaded, kill it
+1 -2
View File
@@ -45,8 +45,7 @@ namespace CalamityMod.Projectiles.Ranged
public override void AI()
{
// If there's no player, or the player is the server, or the owner's stunned, there'll be no holdout.
bool cantUse = Owner == null || !Owner.active || Owner.dead || !Owner.channel || Main.myPlayer != Projectile.owner || Owner.CCed || Owner.noItems;
if (cantUse)
if (Owner.CantUseHoldout())
{
Projectile.Kill();
NetUpdate();
+1 -1
View File
@@ -44,7 +44,7 @@ namespace CalamityMod.Projectiles.Ranged
{
Player player = Main.player[Projectile.owner];
Vector2 playerpos = player.RotatedRelativePoint(player.MountedCenter, true);
bool shouldBeHeld = player.channel && !player.noItems && !player.CCed;
bool shouldBeHeld = !player.CantUseHoldout();
int shot;
float scaleFactor = 14f;
+1 -1
View File
@@ -69,7 +69,7 @@ namespace CalamityMod.Projectiles.Ranged
Projectile.ai[1] = baseUseTime - modifier * Projectile.localAI[0];
timeToFire = true;
}
bool canFire = player.channel && player.HasAmmo(player.ActiveItem()) && !player.noItems && !player.CCed;
bool canFire = !player.CantUseHoldout() && player.HasAmmo(player.ActiveItem());
if (Projectile.soundDelay <= 0 && canFire)
{
Projectile.soundDelay = baseUseTime - modifier * (int)Projectile.localAI[0];
+2 -3
View File
@@ -71,14 +71,13 @@ namespace CalamityMod.Projectiles.Ranged
Projectile.frame = 7;
bool timeToFire = noStars && Projectile.frame == 7;
bool canFire = player.channel && !player.noItems && !player.CCed;
if (!canFire)
if (player.CantUseHoldout())
Projectile.Kill();
Vector2 playerPosition = player.RotatedRelativePoint(player.MountedCenter, true);
if (timeToFire && Main.myPlayer == Projectile.owner)
{
if (canFire)
if (!player.CantUseHoldout())
{
SoundEngine.PlaySound(SoundID.Item92, Projectile.Center);
+4 -7
View File
@@ -12,7 +12,6 @@ namespace CalamityMod.Projectiles.Ranged
{
public override LocalizedText DisplayName => CalamityUtils.GetItemName<SurgeDriver>();
public Player Owner => Main.player[Projectile.owner];
public bool OwnerCanShoot => Owner.channel && !Owner.noItems && !Owner.CCed;
public ref float ShootCountdown => ref Projectile.ai[0];
public override void SetDefaults()
@@ -35,12 +34,10 @@ namespace CalamityMod.Projectiles.Ranged
UpdateProjectileHeldVariables(armPosition);
ManipulatePlayerVariables();
if (!OwnerCanShoot)
{
// Prevent spam clicking by letting the animation run if the player just stops holding
if (Owner.noItems || Owner.CCed || Owner.dead || ShootCountdown < 0f)
Projectile.Kill();
}
// Prevent spam clicking by letting the animation run if the player just stops holding
if (Owner.CantUseHoldout() && ShootCountdown < 0f)
Projectile.Kill();
// Can't shoot on frame 1 as it can't use ammo yet
else if (ShootCountdown < 0f && Owner.HasAmmo(Owner.ActiveItem()))
{
@@ -1,10 +1,5 @@
using CalamityMod.Items.Weapons.Ranged;
using CalamityMod.Particles;
using log4net.Core;
using Microsoft.Xna.Framework;
using Mono.Cecil;
using ReLogic.Utilities;
using System;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
@@ -25,7 +20,6 @@ namespace CalamityMod.Projectiles.Ranged
public int ShotCooldown;
public int FireBlobs = 0;
public int Time = 0;
private bool OwnerCanShoot => Owner.channel && !Owner.noItems && !Owner.CCed;
public override void SetDefaults()
{
@@ -55,10 +49,8 @@ namespace CalamityMod.Projectiles.Ranged
Vector2 tipPosition = armPosition + Projectile.velocity * Projectile.width * 0.8f;
// Kill if the owner stops channeling or otherwise cannot use the weapon.
if (!OwnerCanShoot)
{
if (Owner.CantUseHoldout())
Projectile.Kill();
}
else
{
// While channeled, keep refreshing the projectile lifespan
@@ -92,7 +84,7 @@ namespace CalamityMod.Projectiles.Ranged
else
{
if (ShootTimer == 1)
SoundEngine.PlaySound(SoundID.Item73 with { Volume = 0.7f}, Projectile.Center);
SoundEngine.PlaySound(SoundID.Item73 with { Volume = 0.7f }, Projectile.Center);
ShotsFired = 0;
for (int i = 0; i < 2; i++)
{
-76
View File
@@ -1,76 +0,0 @@
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using CalamityMod.Buffs.StatDebuffs;
namespace CalamityMod.Projectiles.Ranged
{
public class ToxicannonDrop : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Ranged";
public override string Texture => "CalamityMod/Projectiles/Environment/AcidDrop";
public override void SetStaticDefaults()
{
ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5;
ProjectileID.Sets.TrailingMode[Projectile.type] = 0;
}
public override void SetDefaults()
{
Projectile.width = 14;
Projectile.height = 20;
Projectile.friendly = true;
Projectile.tileCollide = true;
Projectile.ignoreWater = false;
Projectile.timeLeft = 300;
Projectile.DamageType = DamageClass.Ranged;
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = 17;
}
public override void AI()
{
NPC potentialTarget = Projectile.Center.ClosestNPCAt(600f, !Projectile.tileCollide);
if (potentialTarget is not null)
{
float flySpeed = Projectile.velocity.Length();
if (flySpeed < 5f)
flySpeed = 5f;
Projectile.velocity = Vector2.Lerp(Projectile.velocity, Projectile.SafeDirectionTo(potentialTarget.Center) * flySpeed, 0.085f);
}
Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2;
Projectile.tileCollide = Projectile.timeLeft <= 300;
}
public override bool OnTileCollide(Vector2 oldVelocity)
{
// Water drip
for (int i = 0; i < 4; i++)
{
int idx = Dust.NewDust(Projectile.position - Projectile.velocity, 2, 2, 154, 0f, 0f, 0, new Color(112, 150, 42, 127), 1f);
Dust dust = Main.dust[idx];
dust.position.X -= 2f;
Main.dust[idx].alpha = 38;
Main.dust[idx].velocity *= 0.1f;
Main.dust[idx].velocity -= Projectile.velocity * 0.025f;
Main.dust[idx].scale = 2f;
}
return true;
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
target.AddBuff(ModContent.BuffType<Irradiated>(), 180);
}
public override bool PreDraw(ref Color lightColor)
{
CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], new Color(255, 255, 255, 127), 2);
return false;
}
}
}
-90
View File
@@ -1,90 +0,0 @@
using CalamityMod.Buffs.StatDebuffs;
using CalamityMod.Dusts;
using Microsoft.Xna.Framework;
using System;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Ranged
{
public class ToxicannonShot : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Ranged";
public override string Texture => "CalamityMod/Projectiles/Enemy/FlakAcid";
public override void SetStaticDefaults()
{
ProjectileID.Sets.TrailCacheLength[Projectile.type] = 3;
ProjectileID.Sets.TrailingMode[Projectile.type] = 0;
}
public override void SetDefaults()
{
Projectile.width = 30;
Projectile.height = 50;
Projectile.friendly = true;
Projectile.timeLeft = 480;
Projectile.DamageType = DamageClass.Ranged;
Projectile.tileCollide = true;
Projectile.ignoreWater = false;
}
public override void AI()
{
if (Projectile.ai[0]++ <= 30f)
{
Projectile.alpha = (int)MathHelper.Lerp(255f, 0f, Projectile.ai[0] / 30f);
}
if (Projectile.velocity.Y < 20f)
Projectile.velocity.Y += 0.3f;
Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2;
if (Math.Sign(Projectile.velocity.Y) != Math.Sign(Projectile.oldVelocity.Y) && Projectile.ai[0] >= 5f)
{
Projectile.Kill();
}
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
target.AddBuff(ModContent.BuffType<Irradiated>(), 240);
}
public override void OnKill(int timeLeft)
{
Projectile.ExpandHitboxBy(180);
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = 10;
Projectile.damage /= 2;
Projectile.Damage();
for (int i = 0; i <= 40; i++)
{
int idx = Dust.NewDust(Projectile.position, 230, 230, (int)CalamityDusts.SulfurousSeaAcid, 0, 0, 0, default, 0.75f);
Main.dust[idx].noGravity = true;
Main.dust[idx].velocity = Vector2.One.RotatedByRandom(MathHelper.TwoPi) * (Main.dust[idx].position - Projectile.Center).Length() / 25f;
Main.dust[idx].scale = 2.5f;
}
for (int i = 0; i <= 90; i++)
{
int idx = Dust.NewDust(Projectile.Center, 0, 0, (int)CalamityDusts.SulfurousSeaAcid);
Main.dust[idx].velocity = Vector2.One.RotatedByRandom(MathHelper.TwoPi) * 12f;
Main.dust[idx].scale = 3f;
Main.dust[idx].noGravity = true;
}
float count = Main.rand.Next(1, 2 + 1);
for (int i = 0; i < count; i++)
{
float angle = MathHelper.TwoPi * i / count;
angle += Main.rand.NextFloat(0.1f, 0.35f) * Main.rand.NextBool().ToDirectionInt();
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, angle.ToRotationVector2() * Main.rand.NextFloat(4f, 16f),
ModContent.ProjectileType<ToxicannonDrop>(), Projectile.damage, 2.5f, Projectile.owner);
}
}
public override bool PreDraw(ref Color lightColor)
{
CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1);
return false;
}
}
}
+3 -4
View File
@@ -1,6 +1,6 @@
using CalamityMod.Items.Weapons.Ranged;
using System;
using CalamityMod.Items.Weapons.Ranged;
using Microsoft.Xna.Framework;
using System;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
@@ -43,8 +43,7 @@ namespace CalamityMod.Projectiles.Ranged
public void AttemptToFireProjectiles(Player player)
{
bool canFire = player.channel && player.HasAmmo(player.ActiveItem()) && !player.noItems && !player.CCed;
if (!canFire)
if (player.CantUseHoldout() || !player.HasAmmo(player.ActiveItem()))
{
Projectile.Kill();
return;
+1 -1
View File
@@ -80,7 +80,7 @@ namespace CalamityMod.Projectiles.Rogue
if (Main.myPlayer == Projectile.owner)
{
if (!player.channel || player.noItems || player.CCed)
if (player.CantUseHoldout())
{
AttemptExecuteAttacks(player);
Projectile.Kill();
+1 -1
View File
@@ -39,7 +39,7 @@ namespace CalamityMod.Projectiles.Typeless
public override void AI()
{
Time++;
if (!Owner.channel || Owner.noItems || Owner.CCed)
if (Owner.CantUseHoldout())
{
// Reset the boss rush timer to what it would normally be if disabling is done prematurely.
if (BossRushEvent.BossRushActive || BossRushEvent.StartTimer > 0)
Binary file not shown.
Loaded 100 of 101 files, more files were not shown because too many files have changed in this diff. Show more